Skip to content
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
33 changes: 33 additions & 0 deletions src/webgpu/api/validation/createBindGroupLayout.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -524,3 +524,36 @@ g.test('storage_texture,formats')
});
}, !success);
});

const BINDINGS_OF_TYPES: BGLEntry[] = [
{},
{ buffer: { type: 'uniform' } },
{ sampler: { type: 'comparison' } },
{ texture: { multisampled: false, sampleType: 'unfilterable-float' } },
{ storageTexture: { access: 'read-only', format: 'r32uint' } },
];

g.test('binding_type')
.desc(
`
Test that exactly one of the binding types is specified for each entry.
- Test each type of bind group resource.
- Test that a validation error is generated if more than one type is specified.
- Test that a validation error is generated if no type is specified.
`
)
.params(u => u.combine('entry1', BINDINGS_OF_TYPES).combine('entry2', BINDINGS_OF_TYPES))
.fn(t => {
const { entry1, entry2 } = t.params;

const joined = { ...entry1, ...entry2 };

t.expectValidationError(
() => {
t.device.createBindGroupLayout({
entries: [{ binding: 0, visibility: GPUShaderStage.VERTEX, ...joined }],
});
},
!(Object.keys(joined).length === 1)
);
});
Loading