1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
export const description = `
Tests for capabilities added by float32-filterable flag.
`;
import { makeTestGroup } from '../../../../common/framework/test_group.js';
import { kTextureSampleTypes } from '../../../capability_info.js';
import { ValidationTest } from '../validation_test.js';
export const g = makeTestGroup(ValidationTest);
const kFloat32Formats: GPUTextureFormat[] = ['r32float', 'rg32float', 'rgba32float'];
g.test('create_bind_group')
.desc(
`
Test that it is valid to bind a float32 texture format to a 'float' sampled texture iff
float32-filterable is enabled.
`
)
.params(u =>
u
.combine('enabled', [true, false] as const)
.beginSubcases()
.combine('format', kFloat32Formats)
.combine('sampleType', kTextureSampleTypes)
)
.beforeAllSubcases(t => {
if (t.params.enabled) {
t.selectDeviceOrSkipTestCase('float32-filterable');
}
})
.fn(t => {
const { enabled, format, sampleType } = t.params;
const layout = t.device.createBindGroupLayout({
entries: [
{
binding: 0,
visibility: GPUShaderStage.FRAGMENT,
texture: { sampleType },
},
],
});
const textureDesc = {
size: { width: 4, height: 4 },
format,
usage: GPUTextureUsage.TEXTURE_BINDING,
};
const shouldError = !(
(enabled && sampleType === 'float') ||
sampleType === 'unfilterable-float'
);
t.expectValidationError(() => {
t.device.createBindGroup({
entries: [{ binding: 0, resource: t.device.createTexture(textureDesc).createView() }],
layout,
});
}, shouldError);
});
|