Skip to content

Commit 490d2a4

Browse files
authored
wgsl: Stub textureSampleBias tests (#1392)
This PR adds unimplemented stubs for the `textureSampleBias` tests Issue: #1267
1 parent 41afbc9 commit 490d2a4

File tree

1 file changed

+114
-0
lines changed

1 file changed

+114
-0
lines changed
Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
export const description = `
2+
Execution tests for the 'textureSampleBias' builtin function
3+
4+
Samples a texture with a bias to the mip level.
5+
Must only be used in a fragment shader stage.
6+
Must only be invoked in uniform control flow.
7+
`;
8+
9+
import { makeTestGroup } from '../../../../../../common/framework/test_group.js';
10+
import { GPUTest } from '../../../../../gpu_test.js';
11+
12+
export const g = makeTestGroup(GPUTest);
13+
14+
g.test('stage')
15+
.specURL('https://www.w3.org/TR/WGSL/#texturesamplebias')
16+
.desc(
17+
`
18+
Tests that 'textureSampleBias' can only be called in 'fragment' shaders.
19+
`
20+
)
21+
.params(u => u.combine('stage', ['fragment', 'vertex', 'compute'] as const))
22+
.unimplemented();
23+
24+
g.test('control_flow')
25+
.specURL('https://www.w3.org/TR/WGSL/#texturesamplebias')
26+
.desc(
27+
`
28+
Tests that 'textureSampleBias' can only be called in uniform control flow.
29+
`
30+
)
31+
.params(u => u.combine('stage', ['fragment', 'vertex', 'compute'] as const))
32+
.unimplemented();
33+
34+
g.test('sampled')
35+
.specURL('https://www.w3.org/TR/WGSL/#texturesamplebias')
36+
.desc(
37+
`
38+
fn textureSampleBias(t: texture_2d<f32>, s: sampler, coords: vec2<f32>, bias: f32) -> vec4<f32>
39+
fn textureSampleBias(t: texture_2d<f32>, s: sampler, coords: vec2<f32>, bias: f32, offset: vec2<i32>) -> vec4<f32>
40+
fn textureSampleBias(t: texture_3d<f32>, s: sampler, coords: vec3<f32>, bias: f32) -> vec4<f32>
41+
fn textureSampleBias(t: texture_3d<f32>, s: sampler, coords: vec3<f32>, bias: f32, offset: vec3<i32>) -> vec4<f32>
42+
fn textureSampleBias(t: texture_cube<f32>, s: sampler, coords: vec3<f32>, bias: f32) -> vec4<f32>
43+
44+
Parameters:
45+
* t: The sampled texture to read from
46+
* s: The sampler type
47+
* coords: The texture coordinates
48+
* bias: The bias to apply to the mip level before sampling. bias must be between -16.0 and 15.99.
49+
* offset:
50+
- The optional texel offset applied to the unnormalized texture coordinate before sampling the texture.
51+
This offset is applied before applying any texture wrapping modes.
52+
- The offset expression must be a creation-time expression (e.g. vec2<i32>(1, 2)).
53+
- Each offset component must be at least -8 and at most 7.
54+
Values outside of this range will result in a shader-creation error.
55+
`
56+
)
57+
.params(u =>
58+
u
59+
.combine('texture_type', ['texture_2d', 'texture_3d', 'texture_cube'] as const)
60+
.combine('S', ['clamp-to-edge', 'repeat', 'mirror-repeat'])
61+
.combine('coords', [
62+
'left-wrap',
63+
'right-wrap',
64+
'bottom-wrap',
65+
'top-wrap',
66+
'in-bounds',
67+
] as const)
68+
.combine('bias', [-16.1, -16, 0, 1, 15.99, 16] as const)
69+
.combine('offset', [undefined, [-9, -9], [-8, -8], [0, 0], [1, 2], [7, 7], [8, 8]] as const)
70+
)
71+
.unimplemented();
72+
73+
g.test('arrayed')
74+
.specURL('https://www.w3.org/TR/WGSL/#texturesamplebias')
75+
.desc(
76+
`
77+
C: i32, u32
78+
79+
fn textureSampleBias(t: texture_2d_array<f32>, s: sampler, coords: vec2<f32>, array_index: C, bias: f32) -> vec4<f32>
80+
fn textureSampleBias(t: texture_2d_array<f32>, s: sampler, coords: vec2<f32>, array_index: C, bias: f32, offset: vec2<i32>) -> vec4<f32>
81+
fn textureSampleBias(t: texture_cube_array<f32>, s: sampler, coords: vec3<f32>, array_index: C, bias: f32) -> vec4<f32>
82+
83+
Parameters:
84+
* t: The sampled texture to read from
85+
* s: The sampler type
86+
* coords: The texture coordinates
87+
* array_index: The 0-based texture array index to sample.
88+
* bias: The bias to apply to the mip level before sampling. bias must be between -16.0 and 15.99.
89+
* offset:
90+
- The optional texel offset applied to the unnormalized texture coordinate before sampling the texture.
91+
This offset is applied before applying any texture wrapping modes.
92+
- The offset expression must be a creation-time expression (e.g. vec2<i32>(1, 2)).
93+
- Each offset component must be at least -8 and at most 7.
94+
Values outside of this range will result in a shader-creation error.
95+
`
96+
)
97+
.params(u =>
98+
u
99+
.combine('texture_type', ['texture_2d_array', 'texture_cube_array'] as const)
100+
.combine('S', ['clamp-to-edge', 'repeat', 'mirror-repeat'])
101+
.combine('coords', [
102+
'left-wrap',
103+
'right-wrap',
104+
'bottom-wrap',
105+
'top-wrap',
106+
'in-bounds',
107+
] as const)
108+
.combine('C', ['i32', 'u32'] as const)
109+
.combine('C_value', [-1, 0, 1, 2, 3, 4] as const)
110+
/* array_index not param'd as out-of-bounds is implementation specific */
111+
.combine('bias', [-16.1, -16, 0, 1, 15.99, 16] as const)
112+
.combine('offset', [undefined, [-9, -9], [-8, -8], [0, 0], [1, 2], [7, 7], [8, 8]] as const)
113+
)
114+
.unimplemented();

0 commit comments

Comments
 (0)