summaryrefslogtreecommitdiffstats
path: root/dom/webgpu/tests/cts/checkout/src/webgpu/shader/execution/expression/call/builtin/textureStore.spec.ts
blob: efef971e24d9ff686395a1a11bfafa3856771ff3 (plain)
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
export const description = `
Writes a single texel to a texture.

The channel format T depends on the storage texel format F.
See the texel format table for the mapping of texel format to channel format.

Note: An out-of-bounds access occurs if:
 * any element of coords is outside the range [0, textureDimensions(t)) for the corresponding element, or
 * array_index is outside the range of [0, textureNumLayers(t))

If an out-of-bounds access occurs, the built-in function may do any of the following:
 * not be executed
 * store value to some in bounds texel
`;

import { makeTestGroup } from '../../../../../../common/framework/test_group.js';
import { GPUTest } from '../../../../../gpu_test.js';
import { TexelFormats } from '../../../../types.js';

import { generateCoordBoundaries } from './utils.js';

export const g = makeTestGroup(GPUTest);

g.test('store_1d_coords')
  .specURL('https://www.w3.org/TR/WGSL/#texturestore')
  .desc(
    `
C is i32 or u32

fn textureStore(t: texture_storage_1d<F,write>, coords: C, value: vec4<T>)

Parameters:
 * t  The sampled, depth, or external texture to sample.
 * s  The sampler type.
 * coords The texture coordinates used for sampling.
 * value The new texel value
`
  )
  .params(u =>
    u
      .combineWithParams(TexelFormats)
      .beginSubcases()
      .combine('coords', generateCoordBoundaries(1))
      .combine('C', ['i32', 'u32'] as const)
  )
  .unimplemented();

g.test('store_2d_coords')
  .specURL('https://www.w3.org/TR/WGSL/#texturestore')
  .desc(
    `
C is i32 or u32

fn textureStore(t: texture_storage_2d<F,write>, coords: vec2<C>, value: vec4<T>)

Parameters:
 * t  The sampled, depth, or external texture to sample.
 * s  The sampler type.
 * coords The texture coordinates used for sampling.
 * value The new texel value
`
  )
  .params(u =>
    u
      .combineWithParams(TexelFormats)
      .beginSubcases()
      .combine('coords', generateCoordBoundaries(2))
      .combine('C', ['i32', 'u32'] as const)
  )
  .unimplemented();

g.test('store_array_2d_coords')
  .specURL('https://www.w3.org/TR/WGSL/#texturestore')
  .desc(
    `
C is i32 or u32

fn textureStore(t: texture_storage_2d_array<F,write>, coords: vec2<C>, array_index: C, value: vec4<T>)

Parameters:
 * t  The sampled, depth, or external texture to sample.
 * s  The sampler type.
 * array_index The 0-based texture array index
 * coords The texture coordinates used for sampling.
 * value The new texel value
`
  )
  .params(
    u =>
      u
        .combineWithParams(TexelFormats)
        .beginSubcases()
        .combine('coords', generateCoordBoundaries(2))
        .combine('C', ['i32', 'u32'] as const)
        .combine('C_value', [-1, 0, 1, 2, 3, 4] as const)
    /* array_index not param'd as out-of-bounds is implementation specific */
  )
  .unimplemented();

g.test('store_3d_coords')
  .specURL('https://www.w3.org/TR/WGSL/#texturestore')
  .desc(
    `
C is i32 or u32

fn textureStore(t: texture_storage_3d<F,write>, coords: vec3<C>, value: vec4<T>)

Parameters:
 * t  The sampled, depth, or external texture to sample.
 * s  The sampler type.
 * coords The texture coordinates used for sampling.
 * value The new texel value
`
  )
  .params(u =>
    u
      .combineWithParams(TexelFormats)
      .beginSubcases()
      .combine('coords', generateCoordBoundaries(3))
      .combine('C', ['i32', 'u32'] as const)
  )
  .unimplemented();