@@ -11,8 +11,10 @@ import {
11
11
} from '../../../capability_info.js' ;
12
12
import {
13
13
kAllTextureFormats ,
14
- kTextureFormatInfo ,
15
14
kDepthStencilFormats ,
15
+ isDepthOrStencilTextureFormat ,
16
+ isDepthTextureFormat ,
17
+ isStencilTextureFormat ,
16
18
} from '../../../format_info.js' ;
17
19
import { getFragmentShaderCodeWithOutput } from '../../../util/shader.js' ;
18
20
@@ -27,21 +29,15 @@ g.test('format')
27
29
. combine ( 'isAsync' , [ false , true ] )
28
30
. combine ( 'format' , kAllTextureFormats )
29
31
)
30
- . beforeAllSubcases ( t => {
31
- const { format } = t . params ;
32
- const info = kTextureFormatInfo [ format ] ;
33
- t . skipIfTextureFormatNotSupportedDeprecated ( format ) ;
34
- t . selectDeviceOrSkipTestCase ( info . feature ) ;
35
- } )
36
32
. fn ( t => {
37
33
const { isAsync, format } = t . params ;
38
- const info = kTextureFormatInfo [ format ] ;
34
+ t . skipIfTextureFormatNotSupported ( format ) ;
39
35
40
36
const descriptor = t . getDescriptor ( {
41
37
depthStencil : { format, depthWriteEnabled : false , depthCompare : 'always' } ,
42
38
} ) ;
43
39
44
- t . doCreateRenderPipelineTest ( isAsync , ! ! info . depth || ! ! info . stencil , descriptor ) ;
40
+ t . doCreateRenderPipelineTest ( isAsync , isDepthOrStencilTextureFormat ( format ) , descriptor ) ;
45
41
} ) ;
46
42
47
43
g . test ( 'depthCompare_optional' )
@@ -59,12 +55,6 @@ g.test('depthCompare_optional')
59
55
. combine ( 'stencilFrontDepthFailOp' , [ 'keep' , 'zero' ] as const )
60
56
. combine ( 'stencilBackDepthFailOp' , [ 'keep' , 'zero' ] as const )
61
57
)
62
- . beforeAllSubcases ( t => {
63
- const { format } = t . params ;
64
- const info = kTextureFormatInfo [ format ] ;
65
- t . skipIfTextureFormatNotSupportedDeprecated ( format ) ;
66
- t . selectDeviceOrSkipTestCase ( info . feature ) ;
67
- } )
68
58
. fn ( t => {
69
59
const {
70
60
isAsync,
@@ -74,7 +64,7 @@ g.test('depthCompare_optional')
74
64
stencilFrontDepthFailOp,
75
65
stencilBackDepthFailOp,
76
66
} = t . params ;
77
- const info = kTextureFormatInfo [ format ] ;
67
+ t . skipIfTextureFormatNotSupported ( format ) ;
78
68
const descriptor = t . getDescriptor ( {
79
69
depthStencil : {
80
70
format,
@@ -90,12 +80,12 @@ g.test('depthCompare_optional')
90
80
const stencilStateIsDefault = depthFailOpsAreKeep ;
91
81
let success = true ;
92
82
if ( depthWriteEnabled || ( depthCompare && depthCompare !== 'always' ) ) {
93
- if ( ! info . depth ) success = false ;
83
+ if ( ! isDepthTextureFormat ( format ) ) success = false ;
94
84
}
95
85
if ( ! stencilStateIsDefault ) {
96
- if ( ! info . stencil ) success = false ;
86
+ if ( ! isStencilTextureFormat ( format ) ) success = false ;
97
87
}
98
- if ( info . depth ) {
88
+ if ( isDepthTextureFormat ( format ) ) {
99
89
if ( depthWriteEnabled === undefined ) success = false ;
100
90
if ( depthWriteEnabled || ! depthFailOpsAreKeep ) {
101
91
if ( depthCompare === undefined ) success = false ;
@@ -110,20 +100,14 @@ g.test('depthWriteEnabled_optional')
110
100
`The depthWriteEnabled in depthStencilState is optional for stencil-only formats but required for formats with a depth.`
111
101
)
112
102
. params ( u => u . combine ( 'isAsync' , [ false , true ] ) . combine ( 'format' , kDepthStencilFormats ) )
113
- . beforeAllSubcases ( t => {
114
- const { format } = t . params ;
115
- const info = kTextureFormatInfo [ format ] ;
116
- t . skipIfTextureFormatNotSupportedDeprecated ( format ) ;
117
- t . selectDeviceOrSkipTestCase ( info . feature ) ;
118
- } )
119
103
. fn ( t => {
120
104
const { isAsync, format } = t . params ;
121
- const info = kTextureFormatInfo [ format ] ;
105
+ t . skipIfTextureFormatNotSupported ( format ) ;
122
106
const descriptor = t . getDescriptor ( {
123
107
depthStencil : { format, depthCompare : 'always' , depthWriteEnabled : undefined } ,
124
108
} ) ;
125
109
126
- t . doCreateRenderPipelineTest ( isAsync , ! info . depth , descriptor ) ;
110
+ t . doCreateRenderPipelineTest ( isAsync , ! isDepthTextureFormat ( format ) , descriptor ) ;
127
111
} ) ;
128
112
129
113
g . test ( 'depth_test' )
@@ -136,21 +120,20 @@ g.test('depth_test')
136
120
. combine ( 'format' , kDepthStencilFormats )
137
121
. combine ( 'depthCompare' , kCompareFunctions )
138
122
)
139
- . beforeAllSubcases ( t => {
140
- const { format } = t . params ;
141
- const info = kTextureFormatInfo [ format ] ;
142
- t . selectDeviceOrSkipTestCase ( info . feature ) ;
143
- } )
144
123
. fn ( t => {
145
124
const { isAsync, format, depthCompare } = t . params ;
146
- const info = kTextureFormatInfo [ format ] ;
125
+ t . skipIfTextureFormatNotSupported ( format ) ;
147
126
148
127
const descriptor = t . getDescriptor ( {
149
128
depthStencil : { format, depthCompare, depthWriteEnabled : false } ,
150
129
} ) ;
151
130
152
131
const depthTestEnabled = depthCompare !== undefined && depthCompare !== 'always' ;
153
- t . doCreateRenderPipelineTest ( isAsync , ! depthTestEnabled || ! ! info . depth , descriptor ) ;
132
+ t . doCreateRenderPipelineTest (
133
+ isAsync ,
134
+ ! depthTestEnabled || isDepthTextureFormat ( format ) ,
135
+ descriptor
136
+ ) ;
154
137
} ) ;
155
138
156
139
g . test ( 'depth_write' )
@@ -163,35 +146,28 @@ g.test('depth_write')
163
146
. combine ( 'format' , kDepthStencilFormats )
164
147
. combine ( 'depthWriteEnabled' , [ false , true ] )
165
148
)
166
- . beforeAllSubcases ( t => {
167
- const { format } = t . params ;
168
- const info = kTextureFormatInfo [ format ] ;
169
- t . selectDeviceOrSkipTestCase ( info . feature ) ;
170
- } )
171
149
. fn ( t => {
172
150
const { isAsync, format, depthWriteEnabled } = t . params ;
173
- const info = kTextureFormatInfo [ format ] ;
151
+ t . skipIfTextureFormatNotSupported ( format ) ;
174
152
175
153
const descriptor = t . getDescriptor ( {
176
154
depthStencil : { format, depthWriteEnabled, depthCompare : 'always' } ,
177
155
} ) ;
178
- t . doCreateRenderPipelineTest ( isAsync , ! depthWriteEnabled || ! ! info . depth , descriptor ) ;
156
+ t . doCreateRenderPipelineTest (
157
+ isAsync ,
158
+ ! depthWriteEnabled || isDepthTextureFormat ( format ) ,
159
+ descriptor
160
+ ) ;
179
161
} ) ;
180
162
181
163
g . test ( 'depth_write,frag_depth' )
182
164
. desc ( `Depth aspect must be contained in the format if frag_depth is written in fragment stage.` )
183
165
. params ( u =>
184
166
u . combine ( 'isAsync' , [ false , true ] ) . combine ( 'format' , [ undefined , ...kDepthStencilFormats ] )
185
167
)
186
- . beforeAllSubcases ( t => {
187
- const { format } = t . params ;
188
- if ( format !== undefined ) {
189
- const info = kTextureFormatInfo [ format ] ;
190
- t . selectDeviceOrSkipTestCase ( info . feature ) ;
191
- }
192
- } )
193
168
. fn ( t => {
194
169
const { isAsync, format } = t . params ;
170
+ t . skipIfTextureFormatNotSupported ( format ) ;
195
171
196
172
const descriptor = t . getDescriptor ( {
197
173
// Keep one color target so that the pipeline is still valid with no depth stencil target.
@@ -205,7 +181,7 @@ g.test('depth_write,frag_depth')
205
181
) ,
206
182
} ) ;
207
183
208
- const hasDepth = format ? ! ! kTextureFormatInfo [ format ] . depth : false ;
184
+ const hasDepth = format ? isDepthTextureFormat ( format ) : false ;
209
185
t . doCreateRenderPipelineTest ( isAsync , hasDepth , descriptor ) ;
210
186
} ) ;
211
187
@@ -265,14 +241,9 @@ g.test('stencil_test')
265
241
. combine ( 'face' , [ 'front' , 'back' ] as const )
266
242
. combine ( 'compare' , [ undefined , ...kCompareFunctions ] )
267
243
)
268
- . beforeAllSubcases ( t => {
269
- const { format } = t . params ;
270
- const info = kTextureFormatInfo [ format ] ;
271
- t . selectDeviceOrSkipTestCase ( info . feature ) ;
272
- } )
273
244
. fn ( t => {
274
245
const { isAsync, format, face, compare } = t . params ;
275
- const info = kTextureFormatInfo [ format ] ;
246
+ t . skipIfTextureFormatNotSupported ( format ) ;
276
247
277
248
let descriptor : GPURenderPipelineDescriptor ;
278
249
if ( face === 'front' ) {
@@ -296,7 +267,11 @@ g.test('stencil_test')
296
267
}
297
268
298
269
const stencilTestEnabled = compare !== undefined && compare !== 'always' ;
299
- t . doCreateRenderPipelineTest ( isAsync , ! stencilTestEnabled || ! ! info . stencil , descriptor ) ;
270
+ t . doCreateRenderPipelineTest (
271
+ isAsync ,
272
+ ! stencilTestEnabled || isStencilTextureFormat ( format ) ,
273
+ descriptor
274
+ ) ;
300
275
} ) ;
301
276
302
277
g . test ( 'stencil_write' )
@@ -317,14 +292,9 @@ g.test('stencil_write')
317
292
] as const )
318
293
. combine ( 'op' , [ undefined , ...kStencilOperations ] )
319
294
)
320
- . beforeAllSubcases ( t => {
321
- const { format } = t . params ;
322
- const info = kTextureFormatInfo [ format ] ;
323
- t . selectDeviceOrSkipTestCase ( info . feature ) ;
324
- } )
325
295
. fn ( t => {
326
296
const { isAsync, format, faceAndOpType, op } = t . params ;
327
- const info = kTextureFormatInfo [ format ] ;
297
+ t . skipIfTextureFormatNotSupported ( format ) ;
328
298
329
299
const common = {
330
300
format,
@@ -357,5 +327,9 @@ g.test('stencil_write')
357
327
const descriptor = t . getDescriptor ( { depthStencil } ) ;
358
328
359
329
const stencilWriteEnabled = op !== undefined && op !== 'keep' ;
360
- t . doCreateRenderPipelineTest ( isAsync , ! stencilWriteEnabled || ! ! info . stencil , descriptor ) ;
330
+ t . doCreateRenderPipelineTest (
331
+ isAsync ,
332
+ ! stencilWriteEnabled || isStencilTextureFormat ( format ) ,
333
+ descriptor
334
+ ) ;
361
335
} ) ;
0 commit comments