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
59
|
export const description = `
createSampler validation tests.
`;
import { makeTestGroup } from '../../../common/framework/test_group.js';
import { ValidationTest } from './validation_test.js';
export const g = makeTestGroup(ValidationTest);
g.test('lodMinAndMaxClamp')
.desc('test different combinations of min and max clamp values')
.paramsSubcasesOnly(u =>
u //
.combine('lodMinClamp', [-4e-30, -1, 0, 0.5, 1, 10, 4e30])
.combine('lodMaxClamp', [-4e-30, -1, 0, 0.5, 1, 10, 4e30])
)
.fn(async t => {
t.expectValidationError(() => {
t.device.createSampler({
lodMinClamp: t.params.lodMinClamp,
lodMaxClamp: t.params.lodMaxClamp,
});
}, t.params.lodMinClamp > t.params.lodMaxClamp || t.params.lodMinClamp < 0 || t.params.lodMaxClamp < 0);
});
g.test('maxAnisotropy')
.desc('test different maxAnisotropy values and combinations with min/mag/mipmapFilter')
.params(u =>
u //
.beginSubcases()
.combineWithParams([
...u.combine('maxAnisotropy', [-1, undefined, 0, 1, 2, 4, 7, 16, 32, 33, 1024]),
{ minFilter: 'nearest' as const },
{ magFilter: 'nearest' as const },
{ mipmapFilter: 'nearest' as const },
])
)
.fn(async t => {
const {
maxAnisotropy = 1,
minFilter = 'linear',
magFilter = 'linear',
mipmapFilter = 'linear',
} = t.params as {
maxAnisotropy?: number;
minFilter?: GPUFilterMode;
magFilter?: GPUFilterMode;
mipmapFilter?: GPUFilterMode;
};
t.expectValidationError(() => {
t.device.createSampler({
minFilter,
magFilter,
mipmapFilter,
maxAnisotropy,
});
}, maxAnisotropy < 1 || (maxAnisotropy > 1 && !(minFilter === 'linear' && magFilter === 'linear' && mipmapFilter === 'linear')));
});
|