index.tsx 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. import {Fragment} from 'react';
  2. import ContextBlock from 'sentry/components/events/contexts/contextBlock';
  3. import {Event} from 'sentry/types/event';
  4. import {geKnownData, getUnknownData} from '../utils';
  5. import {getGPUKnownDataDetails} from './getGPUKnownDataDetails';
  6. import {GPUData, GPUKnownDataType} from './types';
  7. type Props = {
  8. data: GPUData;
  9. event: Event;
  10. };
  11. export const gpuKnownDataValues = [
  12. GPUKnownDataType.NAME,
  13. GPUKnownDataType.VERSION,
  14. GPUKnownDataType.VENDOR_NAME,
  15. GPUKnownDataType.MEMORY,
  16. GPUKnownDataType.NPOT_SUPPORT,
  17. GPUKnownDataType.MULTI_THREAD_RENDERING,
  18. GPUKnownDataType.API_TYPE,
  19. ];
  20. const gpuIgnoredDataValues = [];
  21. export function GPUEventContext({event, data}: Props) {
  22. const meta = event._meta?.contexts?.gpu ?? {};
  23. if (data.vendor_id > 0) {
  24. gpuKnownDataValues.unshift[GPUKnownDataType.VENDOR_ID];
  25. }
  26. if (data.id > 0) {
  27. gpuKnownDataValues.unshift[GPUKnownDataType.ID];
  28. }
  29. return (
  30. <Fragment>
  31. <ContextBlock
  32. data={geKnownData<GPUData, GPUKnownDataType>({
  33. data,
  34. meta,
  35. knownDataTypes: gpuKnownDataValues,
  36. onGetKnownDataDetails: v => getGPUKnownDataDetails(v),
  37. })}
  38. />
  39. <ContextBlock
  40. data={getUnknownData({
  41. allData: data,
  42. knownKeys: [...gpuKnownDataValues, ...gpuIgnoredDataValues],
  43. meta,
  44. })}
  45. />
  46. </Fragment>
  47. );
  48. }