From 4251e57c4ffb6c70db09e41b458cba62a9b48485 Mon Sep 17 00:00:00 2001 From: Samson <16504129+sagudev@users.noreply.github.com> Date: Mon, 24 Jun 2024 22:44:44 +0200 Subject: [PATCH] Add dummy targets to render pipelines (#3807) Also allow manual dispatch of push workflow, useful for deployment of WIP branches. --- .github/workflows/push.yml | 1 + src/webgpu/api/operation/labels.spec.ts | 16 ++++++++++++++++ .../capability_checks/limits/limit_utils.ts | 8 ++++++++ .../api/validation/render_pipeline/misc.spec.ts | 4 ++++ .../render_pipeline/shader_module.spec.ts | 7 +++++++ 5 files changed, 36 insertions(+) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index f1645e120a40..b7cdb2450ef1 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -1,6 +1,7 @@ name: Push CI on: + workflow_dispatch: push: branches: [main] diff --git a/src/webgpu/api/operation/labels.spec.ts b/src/webgpu/api/operation/labels.spec.ts index 77ff02581212..d9c4be858dce 100644 --- a/src/webgpu/api/operation/labels.spec.ts +++ b/src/webgpu/api/operation/labels.spec.ts @@ -106,6 +106,14 @@ const kTestFunctions: { [name: string]: TestFunction } = { module, entryPoint: 'foo', }, + // Specify a color attachment so we have at least one render target. Otherwise, details here + // are not relevant to this test. + fragment: { + targets: [{ format: 'rgba8unorm' }], + module: t.device.createShaderModule({ + code: `@fragment fn main() -> @location(0) vec4f { return vec4f(0); }`, + }), + }, }); t.expect(renderPipeline.label === label); }, @@ -143,6 +151,14 @@ const kTestFunctions: { [name: string]: TestFunction } = { module, entryPoint: 'foo', }, + // Specify a color attachment so we have at least one render target. Otherwise, details here + // are not relevant to this test. + fragment: { + targets: [{ format: 'rgba8unorm' }], + module: t.device.createShaderModule({ + code: `@fragment fn main() -> @location(0) vec4f { return vec4f(0); }`, + }), + }, }); t.expect(renderPipeline.label === label); }, diff --git a/src/webgpu/api/validation/capability_checks/limits/limit_utils.ts b/src/webgpu/api/validation/capability_checks/limits/limit_utils.ts index 2daed5c57c42..b2d791e600c3 100644 --- a/src/webgpu/api/validation/capability_checks/limits/limit_utils.ts +++ b/src/webgpu/api/validation/capability_checks/limits/limit_utils.ts @@ -718,12 +718,20 @@ export class LimitTestsImpl extends GPUTestBase { } _createRenderPipelineDescriptor(module: GPUShaderModule): GPURenderPipelineDescriptor { + const { device } = this; return { layout: 'auto', vertex: { module, entryPoint: 'mainVS', }, + // Specify a color attachment so we have at least one render target. + fragment: { + targets: [{ format: 'rgba8unorm' }], + module: device.createShaderModule({ + code: `@fragment fn main() -> @location(0) vec4f { return vec4f(0); }`, + }), + }, }; } diff --git a/src/webgpu/api/validation/render_pipeline/misc.spec.ts b/src/webgpu/api/validation/render_pipeline/misc.spec.ts index 3a32be57ab52..861eb4d24c7f 100644 --- a/src/webgpu/api/validation/render_pipeline/misc.spec.ts +++ b/src/webgpu/api/validation/render_pipeline/misc.spec.ts @@ -49,6 +49,10 @@ state (and thus has no color state), and can be created with or without depth st '', ] as const) .combine('hasColor', [false, true]) + .unless(({ depthStencilFormat, hasColor }) => { + // Render pipeline needs at least one attachement + return hasColor === false && depthStencilFormat === ''; + }) ) .fn(t => { const { isAsync, depthStencilFormat, hasColor } = t.params; diff --git a/src/webgpu/api/validation/render_pipeline/shader_module.spec.ts b/src/webgpu/api/validation/render_pipeline/shader_module.spec.ts index 5d9c4b46124d..63f60aa84d23 100644 --- a/src/webgpu/api/validation/render_pipeline/shader_module.spec.ts +++ b/src/webgpu/api/validation/render_pipeline/shader_module.spec.ts @@ -83,6 +83,13 @@ g.test('invalid,vertex') : t.createInvalidShaderModule(), entryPoint: 'main', }, + // Specify a color attachment so we have at least one render target. + fragment: { + targets: [{ format: 'rgba8unorm' }], + module: t.device.createShaderModule({ + code: `@fragment fn main() -> @location(0) vec4f { return vec4f(0); }`, + }), + }, }); });