MCPcopy Index your code
hub / github.com/ColmapView/Colmapview.github.io / makeDevice

Function makeDevice

src/splat/webgpu/gaussianRenderer.test.ts:75–97  ·  view source on GitHub ↗
(options: {
  validationError?: GPUError | null;
  limits?: GPUSupportedLimits;
} = {})

Source from the content-addressed store, hash-verified

73}
74
75function makeDevice(options: {
76 validationError?: GPUError | null;
77 limits?: GPUSupportedLimits;
78} = {}) {
79 const submittedCommand = { label: 'command' } as unknown as GPUCommandBuffer;
80 const encoder = {
81 finish: vi.fn(() => submittedCommand),
82 } as unknown as GPUCommandEncoder;
83 const device = {
84 limits: options.limits,
85 createBuffer: vi.fn((descriptor: GPUBufferDescriptor) =>
86 makeBuffer(String(descriptor.label ?? ''), Number(descriptor.size), Number(descriptor.usage))
87 ),
88 createCommandEncoder: vi.fn(() => encoder),
89 queue: {
90 submit: vi.fn(),
91 onSubmittedWorkDone: vi.fn(async () => undefined),
92 },
93 pushErrorScope: vi.fn(),
94 popErrorScope: vi.fn(async () => options.validationError ?? null),
95 } as unknown as GPUDevice;
96 return { device, encoder, submittedCommand };
97}
98
99function makeRenderTargets(width: number, height: number, format: GPUTextureFormat) {
100 const colorTexture = makeTexture(`rt-${width}x${height}`);

Callers 2

createHarnessFunction · 0.70

Calls 1

makeBufferFunction · 0.85

Tested by

no test coverage detected