Skip to content

Commit

Permalink
Update tests following changes to GPUFragmentState validation (#655)
Browse files Browse the repository at this point in the history
Tests that use fragment shaders that don't write to the output
must declare the color target with writeMask 0.

Spec PR: gpuweb/gpuweb#1918
Bug: crbug.com/dawn/962
  • Loading branch information
austinEng authored Jul 22, 2021
1 parent 3004629 commit c9b72f0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
10 changes: 6 additions & 4 deletions src/webgpu/api/validation/attachment_compatibility.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ Test that color attachment formats in render passes or bundles match the pipelin
)
.fn(t => {
const { encoderType, encoderFormat, pipelineFormat } = t.params;
const pipeline = t.createRenderPipeline([{ format: pipelineFormat }]);
const pipeline = t.createRenderPipeline([{ format: pipelineFormat, writeMask: 0 }]);

const { encoder, validateFinishAndSubmit } = t.createEncoder(encoderType, {
attachmentInfo: { colorFormats: [encoderFormat] },
Expand All @@ -242,7 +242,9 @@ TODO: Add sparse color attachment compatibility test when defined by specificati
)
.fn(t => {
const { encoderType, encoderCount, pipelineCount } = t.params;
const pipeline = t.createRenderPipeline(range(pipelineCount, () => ({ format: 'rgba8unorm' })));
const pipeline = t.createRenderPipeline(
range(pipelineCount, () => ({ format: 'rgba8unorm', writeMask: 0 }))
);

const { encoder, validateFinishAndSubmit } = t.createEncoder(encoderType, {
attachmentInfo: { colorFormats: range(encoderCount, () => 'rgba8unorm') },
Expand All @@ -269,7 +271,7 @@ Test that the depth attachment format in render passes or bundles match the pipe
await t.selectDeviceForTextureFormatOrSkipTestCase([encoderFormat, pipelineFormat]);

const pipeline = t.createRenderPipeline(
[{ format: 'rgba8unorm' }],
[{ format: 'rgba8unorm', writeMask: 0 }],
pipelineFormat !== undefined ? { format: pipelineFormat } : undefined
);

Expand Down Expand Up @@ -302,7 +304,7 @@ Test that the sample count in render passes or bundles match the pipeline sample
attachmentType === 'depthstencil' ? ('depth24plus-stencil8' as const) : undefined;

const pipeline = t.createRenderPipeline(
colorFormats.map(format => ({ format })),
colorFormats.map(format => ({ format, writeMask: 0 })),
depthStencilFormat ? { format: depthStencilFormat } : undefined,
pipelineSampleCount
);
Expand Down
2 changes: 1 addition & 1 deletion src/webgpu/api/validation/validation_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ export class ValidationTest extends GPUTest {
code: '[[stage(fragment)]] fn main() {}',
}),
entryPoint: 'main',
targets: [{ format: 'rgba8unorm' }],
targets: [{ format: 'rgba8unorm', writeMask: 0 }],
},
primitive: { topology: 'triangle-list' },
});
Expand Down

0 comments on commit c9b72f0

Please sign in to comment.