diff options
Diffstat (limited to '')
-rw-r--r-- | dom/webgpu/tests/cts/checkout/src/webgpu/api/validation/render_pipeline/misc.spec.ts | 94 |
1 files changed, 94 insertions, 0 deletions
diff --git a/dom/webgpu/tests/cts/checkout/src/webgpu/api/validation/render_pipeline/misc.spec.ts b/dom/webgpu/tests/cts/checkout/src/webgpu/api/validation/render_pipeline/misc.spec.ts new file mode 100644 index 0000000000..a046ad86c4 --- /dev/null +++ b/dom/webgpu/tests/cts/checkout/src/webgpu/api/validation/render_pipeline/misc.spec.ts @@ -0,0 +1,94 @@ +export const description = ` +misc createRenderPipeline and createRenderPipelineAsync validation tests. +`; + +import { makeTestGroup } from '../../../../common/framework/test_group.js'; +import { kDefaultVertexShaderCode, kDefaultFragmentShaderCode } from '../../../util/shader.js'; + +import { CreateRenderPipelineValidationTest } from './common.js'; + +export const g = makeTestGroup(CreateRenderPipelineValidationTest); + +g.test('basic') + .desc(`Test basic usage of createRenderPipeline.`) + .params(u => u.combine('isAsync', [false, true])) + .fn(async t => { + const { isAsync } = t.params; + const descriptor = t.getDescriptor(); + + t.doCreateRenderPipelineTest(isAsync, true, descriptor); + }); + +g.test('vertex_state_only') + .desc( + `Tests creating vertex-state-only render pipeline. A vertex-only render pipeline has no fragment +state (and thus has no color state), and can be created with or without depth stencil state.` + ) + .params(u => + u + .combine('isAsync', [false, true]) + .beginSubcases() + .combine('depthStencilFormat', [ + 'depth24plus', + 'depth24plus-stencil8', + 'depth32float', + '', + ] as const) + .combine('hasColor', [false, true]) + ) + .fn(async t => { + const { isAsync, depthStencilFormat, hasColor } = t.params; + + let depthStencilState: GPUDepthStencilState | undefined; + if (depthStencilFormat === '') { + depthStencilState = undefined; + } else { + depthStencilState = { format: depthStencilFormat }; + } + + // Having targets or not should have no effect in result, since it will not appear in the + // descriptor in vertex-only render pipeline + const descriptor = t.getDescriptor({ + noFragment: true, + depthStencil: depthStencilState, + targets: hasColor ? [{ format: 'rgba8unorm' }] : [], + }); + + t.doCreateRenderPipelineTest(isAsync, true, descriptor); + }); + +g.test('pipeline_layout,device_mismatch') + .desc( + 'Tests createRenderPipeline(Async) cannot be called with a pipeline layout created from another device' + ) + .paramsSubcasesOnly(u => u.combine('isAsync', [true, false]).combine('mismatched', [true, false])) + .beforeAllSubcases(t => { + t.selectMismatchedDeviceOrSkipTestCase(undefined); + }) + .fn(async t => { + const { isAsync, mismatched } = t.params; + + const sourceDevice = mismatched ? t.mismatchedDevice : t.device; + + const layout = sourceDevice.createPipelineLayout({ bindGroupLayouts: [] }); + + const format = 'rgba8unorm'; + const descriptor = { + layout, + vertex: { + module: t.device.createShaderModule({ + code: kDefaultVertexShaderCode, + }), + entryPoint: 'main', + }, + fragment: { + module: t.device.createShaderModule({ + code: kDefaultFragmentShaderCode, + }), + entryPoint: 'main', + targets: [{ format }] as const, + }, + }; + + t.doCreateRenderPipelineTest(isAsync, !mismatched, descriptor); + }); |