Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix validation tests on the index range of getBindGroupLayout() #4182

Merged
merged 1 commit into from
Feb 8, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 6 additions & 9 deletions src/webgpu/api/validation/getBindGroupLayout.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ export const g = makeTestGroup(ValidationTest);
g.test('index_range,explicit_layout')
.desc(
`
Test that a validation error is generated if the index exceeds the size of the bind group layouts
using a pipeline with an explicit layout.
Test that a validation error is generated if the index is greater than the maximum number of bind
groups.
`
)
.params(u => u.combine('index', [0, 1, 2, 3, 4, 5]))
Expand All @@ -24,7 +24,6 @@ g.test('index_range,explicit_layout')
entries: [],
});

const kBindGroupLayoutsSizeInPipelineLayout = 1;
const pipelineLayout = t.device.createPipelineLayout({
bindGroupLayouts: [pipelineBindGroupLayouts],
});
Expand Down Expand Up @@ -54,7 +53,7 @@ g.test('index_range,explicit_layout')
},
});

const shouldError = index >= kBindGroupLayoutsSizeInPipelineLayout;
const shouldError = index >= t.device.limits.maxBindGroups;

t.expectValidationError(() => {
pipeline.getBindGroupLayout(index);
Expand All @@ -64,16 +63,14 @@ g.test('index_range,explicit_layout')
g.test('index_range,auto_layout')
.desc(
`
Test that a validation error is generated if the index exceeds the size of the bind group layouts
using a pipeline with an auto layout.
Test that a validation error is generated if the index is greater than the maximum number of bind
groups.
`
)
.params(u => u.combine('index', [0, 1, 2, 3, 4, 5]))
.fn(t => {
const { index } = t.params;

const kBindGroupLayoutsSizeInPipelineLayout = 1;

const pipeline = t.device.createRenderPipeline({
layout: 'auto',
vertex: {
Expand Down Expand Up @@ -101,7 +98,7 @@ g.test('index_range,auto_layout')
},
});

const shouldError = index >= kBindGroupLayoutsSizeInPipelineLayout;
const shouldError = index >= t.device.limits.maxBindGroups;

t.expectValidationError(() => {
pipeline.getBindGroupLayout(index);
Expand Down