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

Function createHarness

src/splat/webgpu/gaussianRenderer.test.ts:169–222  ·  view source on GitHub ↗
(options: {
  scene?: GpuGaussianSceneRef;
  validationError?: GPUError | null;
  canvasContext?: GPUCanvasContext | null;
  debugValidation?: boolean;
} = {})

Source from the content-addressed store, hash-verified

167}
168
169function createHarness(options: {
170 scene?: GpuGaussianSceneRef;
171 validationError?: GPUError | null;
172 canvasContext?: GPUCanvasContext | null;
173 debugValidation?: boolean;
174} = {}) {
175 const order: string[] = [];
176 const projection = makeModule('projection', order);
177 const sort = makeModule('sort', order);
178 const raster = makeModule('raster', order);
179 const output = makeModule('output', order);
180 const renderTargets: Array<ReturnType<typeof makeRenderTargets>> = [];
181 const destroyedRenderTargets: Array<ReturnType<typeof makeRenderTargets>> = [];
182 const { device, submittedCommand } = makeDevice({ validationError: options.validationError });
183 const scene = options.scene ?? makeScene({ device });
184 const session = createSplatRenderSession({
185 device,
186 scene,
187 format: 'rgba8unorm',
188 canvasContext: options.canvasContext,
189 debugValidation: options.debugValidation,
190 deps: {
191 createProjectionModule: vi.fn(() => projection as unknown as ReturnType<ProjectionModuleFactory>),
192 createSortModule: vi.fn(() => sort as unknown as ReturnType<SortModuleFactory>),
193 createRasterModule: vi.fn(() => raster as unknown as ReturnType<RasterModuleFactory>),
194 createOutputModule: vi.fn(() => output as unknown as ReturnType<OutputModuleFactory>),
195 createRenderTargets: vi.fn((_, width, height, format) => {
196 const targets = makeRenderTargets(width, height, format);
197 renderTargets.push(targets);
198 return targets;
199 }),
200 destroyRenderTargets: vi.fn((targets) => {
201 destroyedRenderTargets.push(targets as ReturnType<typeof makeRenderTargets>);
202 targets.colorTexture.destroy();
203 }),
204 },
205 });
206
207 return {
208 session,
209 device,
210 scene,
211 submittedCommand,
212 modules: {
213 projection,
214 sort,
215 raster,
216 output,
217 },
218 order,
219 renderTargets,
220 destroyedRenderTargets,
221 };
222}
223
224describe('gaussian renderer session', () => {
225 beforeEach(() => {

Callers 1

Calls 6

createSplatRenderSessionFunction · 0.90
makeModuleFunction · 0.85
makeSceneFunction · 0.85
makeRenderTargetsFunction · 0.85
makeDeviceFunction · 0.70
destroyMethod · 0.65

Tested by

no test coverage detected