Skip to content

Commit

Permalink
Compat: Fix tests that use @interpole(linear/sample)
Browse files Browse the repository at this point in the history
  • Loading branch information
greggman committed Dec 14, 2023
1 parent cd9505d commit dac947f
Showing 1 changed file with 22 additions and 7 deletions.
29 changes: 22 additions & 7 deletions src/webgpu/api/validation/render_pipeline/inter_stage.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,20 +159,27 @@ g.test('interpolation_type')
{ output: '@interpolate(linear)', input: '@interpolate(perspective)' },
{ output: '@interpolate(flat)', input: '@interpolate(perspective)' },
{ output: '@interpolate(linear)', input: '@interpolate(flat)' },
{ output: '@interpolate(linear, center)', input: '@interpolate(linear, center)' },
{
output: '@interpolate(linear, center)',
input: '@interpolate(linear, center)',
_compat_success: false,
},
])
)
.fn(t => {
const { isAsync, output, input, _success } = t.params;
const { isAsync, output, input, _success, _compat_success } = t.params;

const descriptor = t.getDescriptorWithStates(
t.getVertexStateWithOutputs([`@location(0) ${output} vout0: f32`]),
t.getFragmentStateWithInputs([`@location(0) ${input} fin0: f32`])
);

t.doCreateRenderPipelineTest(isAsync, _success ?? output === input, descriptor);
});
const shouldSucceed =
(_success ?? output === input) && (!t.isCompatibility || _compat_success !== false);

t.doCreateRenderPipelineTest(isAsync, shouldSucceed, descriptor);
});
1;
g.test('interpolation_sampling')
.desc(
`Tests that validation should fail when interpolation sampling of vertex output and fragment input at the same location doesn't match.`
Expand All @@ -186,7 +193,12 @@ g.test('interpolation_sampling')
input: '@interpolate(perspective, center)',
_success: true,
},
{ output: '@interpolate(linear, center)', input: '@interpolate(linear)', _success: true },
{
output: '@interpolate(linear, center)',
input: '@interpolate(linear)',
_success: true,
_compat_success: false,
},
{ output: '@interpolate(flat)', input: '@interpolate(flat)' },
{ output: '@interpolate(perspective)', input: '@interpolate(perspective, sample)' },
{ output: '@interpolate(perspective, center)', input: '@interpolate(perspective, sample)' },
Expand All @@ -198,14 +210,17 @@ g.test('interpolation_sampling')
])
)
.fn(t => {
const { isAsync, output, input, _success } = t.params;
const { isAsync, output, input, _success, _compat_success } = t.params;

const descriptor = t.getDescriptorWithStates(
t.getVertexStateWithOutputs([`@location(0) ${output} vout0: f32`]),
t.getFragmentStateWithInputs([`@location(0) ${input} fin0: f32`])
);

t.doCreateRenderPipelineTest(isAsync, _success ?? output === input, descriptor);
const shouldSucceed =
(_success ?? output === input) && (!t.isCompatibility || _compat_success !== false);

t.doCreateRenderPipelineTest(isAsync, shouldSucceed, descriptor);
});

g.test('max_shader_variable_location')
Expand Down

0 comments on commit dac947f

Please sign in to comment.