Skip to content

Commit

Permalink
Compat: Test that sample_index generates validation error (#3256)
Browse files Browse the repository at this point in the history
  • Loading branch information
greggman authored Jan 10, 2024
1 parent f136a75 commit 80339cf
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,65 @@ Tests that you can not create a render pipeline with a shader module that uses s
);
});

g.test('sample_index')
.desc(
`
Tests that you can not create a render pipeline with a shader module that uses sample_index in compat mode.
- Test that a pipeline with a shader that uses sample_index fails.
- Test that a pipeline that references a module that has a shader that uses sample_index
but the pipeline does not reference that shader succeeds.
`
)
.params(u =>
u.combine('entryPoint', ['fsWithoutSampleIndexUsage', 'fsWithSampleIndexUsage'] as const)
)
.fn(t => {
const { entryPoint } = t.params;

const module = t.device.createShaderModule({
code: `
@vertex fn vs() -> @builtin(position) vec4f {
return vec4f(1);
}
@fragment fn fsWithoutSampleIndexUsage() -> @location(0) vec4f {
return vec4f(0);
}
@fragment fn fsWithSampleIndexUsage(@builtin(sample_index) sampleIndex: u32) -> @location(0) vec4f {
_ = sampleIndex;
return vec4f(0);
}
`,
});

const pipelineDescriptor: GPURenderPipelineDescriptor = {
layout: 'auto',
vertex: {
module,
entryPoint: 'vs',
},
fragment: {
module,
entryPoint,
targets: [
{
format: 'rgba8unorm',
},
],
},
multisample: {
count: 4,
},
};

const isValid = entryPoint === 'fsWithoutSampleIndexUsage';
t.expectGPUError(
'validation',
() => t.device.createRenderPipeline(pipelineDescriptor),
!isValid
);
});

g.test('interpolate')
.desc(
`
Expand Down
1 change: 1 addition & 0 deletions src/webgpu/listing_meta.json
Original file line number Diff line number Diff line change
Expand Up @@ -850,6 +850,7 @@
"webgpu:compat,api,validation,render_pipeline,depth_stencil_state:depthBiasClamp:*": { "subcaseMS": 1.604 },
"webgpu:compat,api,validation,render_pipeline,fragment_state:colorState:*": { "subcaseMS": 32.604 },
"webgpu:compat,api,validation,render_pipeline,shader_module:interpolate:*": { "subcaseMS": 1.502 },
"webgpu:compat,api,validation,render_pipeline,shader_module:sample_index:*": { "subcaseMS": 1.502 },
"webgpu:compat,api,validation,render_pipeline,shader_module:sample_mask:*": { "subcaseMS": 14.801 },
"webgpu:compat,api,validation,render_pipeline,shader_module:unsupportedStorageTextureFormats,computePipeline:*": { "subcaseMS": 0.601 },
"webgpu:compat,api,validation,render_pipeline,shader_module:unsupportedStorageTextureFormats,renderPipeline:*": { "subcaseMS": 0.601 },
Expand Down

0 comments on commit 80339cf

Please sign in to comment.