From 07d31bdbc0cdde5dc561d563d4898f6ed7dae38c Mon Sep 17 00:00:00 2001 From: Corentin Wallez <cwallez@chromium.org> Date: Tue, 3 Sep 2024 18:07:48 +0200 Subject: [PATCH] Fixes for no attachments being an error. (#3927) Previously Dawn didn't correctly validate that render pipelines with no attachments are errors. After fixing Dawn some CTS tests hit the new validation. Fix them up to follow the WebGPU spec. See #3754 --- .../limits/maxInterStageShaderVariables.spec.ts | 1 + .../capability_checks/limits/maxVertexAttributes.spec.ts | 1 + .../limits/maxVertexBufferArrayStride.spec.ts | 1 + .../capability_checks/limits/maxVertexBuffers.spec.ts | 1 + src/webgpu/api/validation/layout_shader_compat.spec.ts | 1 + src/webgpu/api/validation/render_pipeline/misc.spec.ts | 4 ++-- src/webgpu/api/validation/shader_module/entry_point.spec.ts | 2 ++ 7 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/webgpu/api/validation/capability_checks/limits/maxInterStageShaderVariables.spec.ts b/src/webgpu/api/validation/capability_checks/limits/maxInterStageShaderVariables.spec.ts index e54b7f7df178..cb1e2c09dba4 100644 --- a/src/webgpu/api/validation/capability_checks/limits/maxInterStageShaderVariables.spec.ts +++ b/src/webgpu/api/validation/capability_checks/limits/maxInterStageShaderVariables.spec.ts @@ -20,6 +20,7 @@ function getPipelineDescriptor(device: GPUDevice, testValue: number): GPURenderP module, entryPoint: 'vs', }, + depthStencil: { format: 'depth32float', depthWriteEnabled: true, depthCompare: 'always' }, }; } diff --git a/src/webgpu/api/validation/capability_checks/limits/maxVertexAttributes.spec.ts b/src/webgpu/api/validation/capability_checks/limits/maxVertexAttributes.spec.ts index 9e5aaa144bfa..b37cc9230931 100644 --- a/src/webgpu/api/validation/capability_checks/limits/maxVertexAttributes.spec.ts +++ b/src/webgpu/api/validation/capability_checks/limits/maxVertexAttributes.spec.ts @@ -19,6 +19,7 @@ function getPipelineDescriptor(device: GPUDevice, lastIndex: number): GPURenderP }, ], }, + depthStencil: { format: 'depth32float', depthWriteEnabled: true, depthCompare: 'always' }, }; } diff --git a/src/webgpu/api/validation/capability_checks/limits/maxVertexBufferArrayStride.spec.ts b/src/webgpu/api/validation/capability_checks/limits/maxVertexBufferArrayStride.spec.ts index 0af5724f2a2a..be9c7ffd7f7b 100644 --- a/src/webgpu/api/validation/capability_checks/limits/maxVertexBufferArrayStride.spec.ts +++ b/src/webgpu/api/validation/capability_checks/limits/maxVertexBufferArrayStride.spec.ts @@ -32,6 +32,7 @@ function getPipelineDescriptor(device: GPUDevice, testValue: number): GPURenderP }, ], }, + depthStencil: { format: 'depth32float', depthWriteEnabled: true, depthCompare: 'always' }, }; } diff --git a/src/webgpu/api/validation/capability_checks/limits/maxVertexBuffers.spec.ts b/src/webgpu/api/validation/capability_checks/limits/maxVertexBuffers.spec.ts index 9a4108cb0c08..02701de0d1e9 100644 --- a/src/webgpu/api/validation/capability_checks/limits/maxVertexBuffers.spec.ts +++ b/src/webgpu/api/validation/capability_checks/limits/maxVertexBuffers.spec.ts @@ -19,6 +19,7 @@ function getPipelineDescriptor(device: GPUDevice, testValue: number): GPURenderP module, buffers, }, + depthStencil: { format: 'depth32float', depthWriteEnabled: true, depthCompare: 'always' }, }; } diff --git a/src/webgpu/api/validation/layout_shader_compat.spec.ts b/src/webgpu/api/validation/layout_shader_compat.spec.ts index 2b5e609c55d6..5ee16510c77a 100644 --- a/src/webgpu/api/validation/layout_shader_compat.spec.ts +++ b/src/webgpu/api/validation/layout_shader_compat.spec.ts @@ -253,6 +253,7 @@ g.test('pipeline_layout_shader_exact_match') code: vertexShader, }), }, + depthStencil: { format: 'depth32float', depthWriteEnabled: true, depthCompare: 'always' }, }); break; } diff --git a/src/webgpu/api/validation/render_pipeline/misc.spec.ts b/src/webgpu/api/validation/render_pipeline/misc.spec.ts index 861eb4d24c7f..d10c7ca99985 100644 --- a/src/webgpu/api/validation/render_pipeline/misc.spec.ts +++ b/src/webgpu/api/validation/render_pipeline/misc.spec.ts @@ -36,7 +36,7 @@ g.test('no_attachment') 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.` +state (and thus has no color state), and must have a depth-stencil state as an attachment is required.` ) .params(u => u @@ -76,7 +76,7 @@ state (and thus has no color state), and can be created with or without depth st targets: hasColor ? [{ format: 'rgba8unorm' }] : [], }); - t.doCreateRenderPipelineTest(isAsync, true, descriptor); + t.doCreateRenderPipelineTest(isAsync, depthStencilState !== undefined, descriptor); }); g.test('pipeline_layout,device_mismatch') diff --git a/src/webgpu/api/validation/shader_module/entry_point.spec.ts b/src/webgpu/api/validation/shader_module/entry_point.spec.ts index c956dc302144..67dbef1851e1 100644 --- a/src/webgpu/api/validation/shader_module/entry_point.spec.ts +++ b/src/webgpu/api/validation/shader_module/entry_point.spec.ts @@ -128,6 +128,7 @@ and check that the APIs only accept matching entryPoint. module: t.device.createShaderModule({ code }), entryPoint, }, + depthStencil: { format: 'depth32float', depthWriteEnabled: true, depthCompare: 'always' }, }; let _success = true; if (shaderModuleStage !== 'vertex') { @@ -258,6 +259,7 @@ an undefined entryPoint is valid if there's an extra shader stage. }), entryPoint: undefined, }, + depthStencil: { format: 'depth32float', depthWriteEnabled: true, depthCompare: 'always' }, }; const success = extraShaderModuleStage !== 'vertex';