@@ -4,8 +4,8 @@ Test related to depth buffer, depth op, compare func, etc.
4
4
5
5
import { makeTestGroup } from '../../../../common/framework/test_group.js' ;
6
6
import { TypedArrayBufferView } from '../../../../common/util/util.js' ;
7
- import { kDepthStencilFormats , kTextureFormatInfo } from '../../../format_info.js' ;
8
- import { GPUTest , TextureTestMixin } from '../../../gpu_test.js' ;
7
+ import { isStencilTextureFormat , kDepthTextureFormats } from '../../../format_info.js' ;
8
+ import { AllFeaturesMaxLimitsGPUTest , TextureTestMixin } from '../../../gpu_test.js' ;
9
9
import { TexelView } from '../../../util/texture/texel_view.js' ;
10
10
11
11
const backgroundColor = [ 0x00 , 0x00 , 0x00 , 0xff ] ;
@@ -21,7 +21,7 @@ type TestStates = {
21
21
depth : number ;
22
22
} ;
23
23
24
- class DepthTest extends TextureTestMixin ( GPUTest ) {
24
+ class DepthTest extends TextureTestMixin ( AllFeaturesMaxLimitsGPUTest ) {
25
25
runDepthStateTest ( testStates : TestStates [ ] , expectedColor : Float32Array ) {
26
26
const renderTargetFormat = 'rgba8unorm' ;
27
27
@@ -187,7 +187,7 @@ g.test('depth_write_disabled')
187
187
. fn ( t => {
188
188
const { depthWriteEnabled, lastDepth, _expectedColor } = t . params ;
189
189
190
- const depthSpencilFormat : GPUTextureFormat = 'depth24plus-stencil8' ;
190
+ const depthStencilFormat : GPUTextureFormat = 'depth24plus-stencil8' ;
191
191
192
192
const stencilState = {
193
193
compare : 'always' ,
@@ -197,7 +197,7 @@ g.test('depth_write_disabled')
197
197
} as const ;
198
198
199
199
const baseState = {
200
- format : depthSpencilFormat ,
200
+ format : depthStencilFormat ,
201
201
depthWriteEnabled : true ,
202
202
depthCompare : 'always' ,
203
203
stencilFront : stencilState ,
@@ -207,7 +207,7 @@ g.test('depth_write_disabled')
207
207
} as const ;
208
208
209
209
const depthWriteState = {
210
- format : depthSpencilFormat ,
210
+ format : depthStencilFormat ,
211
211
depthWriteEnabled,
212
212
depthCompare : 'always' ,
213
213
stencilFront : stencilState ,
@@ -217,7 +217,7 @@ g.test('depth_write_disabled')
217
217
} as const ;
218
218
219
219
const checkState = {
220
- format : depthSpencilFormat ,
220
+ format : depthStencilFormat ,
221
221
depthWriteEnabled : false ,
222
222
depthCompare : 'equal' ,
223
223
stencilFront : stencilState ,
@@ -256,18 +256,18 @@ g.test('depth_test_fail')
256
256
. fn ( t => {
257
257
const { secondDepth, lastDepth, _expectedColor } = t . params ;
258
258
259
- const depthSpencilFormat : GPUTextureFormat = 'depth24plus-stencil8' ;
259
+ const depthStencilFormat : GPUTextureFormat = 'depth24plus-stencil8' ;
260
260
261
261
const baseState = {
262
- format : depthSpencilFormat ,
262
+ format : depthStencilFormat ,
263
263
depthWriteEnabled : true ,
264
264
depthCompare : 'always' ,
265
265
stencilReadMask : 0xff ,
266
266
stencilWriteMask : 0xff ,
267
267
} as const ;
268
268
269
269
const depthTestState = {
270
- format : depthSpencilFormat ,
270
+ format : depthStencilFormat ,
271
271
depthWriteEnabled : true ,
272
272
depthCompare : 'less' ,
273
273
stencilReadMask : 0xff ,
@@ -292,55 +292,48 @@ g.test('depth_compare_func')
292
292
`Tests each depth compare function works properly. Clears the depth attachment to various values, and renders a point at depth 0.5 with various depthCompare modes.`
293
293
)
294
294
. params ( u =>
295
- u
296
- . combine (
297
- 'format' ,
298
- kDepthStencilFormats . filter ( format => kTextureFormatInfo [ format ] . depth )
299
- )
300
- . combineWithParams ( [
301
- { depthCompare : 'never' , depthClearValue : 1.0 , _expected : backgroundColor } ,
302
- { depthCompare : 'never' , depthClearValue : kMiddleDepthValue , _expected : backgroundColor } ,
303
- { depthCompare : 'never' , depthClearValue : 0.0 , _expected : backgroundColor } ,
304
- { depthCompare : 'less' , depthClearValue : 1.0 , _expected : triangleColor } ,
305
- { depthCompare : 'less' , depthClearValue : kMiddleDepthValue , _expected : backgroundColor } ,
306
- { depthCompare : 'less' , depthClearValue : 0.0 , _expected : backgroundColor } ,
307
- { depthCompare : 'less-equal' , depthClearValue : 1.0 , _expected : triangleColor } ,
308
- {
309
- depthCompare : 'less-equal' ,
310
- depthClearValue : kMiddleDepthValue ,
311
- _expected : triangleColor ,
312
- } ,
313
- { depthCompare : 'less-equal' , depthClearValue : 0.0 , _expected : backgroundColor } ,
314
- { depthCompare : 'equal' , depthClearValue : 1.0 , _expected : backgroundColor } ,
315
- { depthCompare : 'equal' , depthClearValue : kMiddleDepthValue , _expected : triangleColor } ,
316
- { depthCompare : 'equal' , depthClearValue : 0.0 , _expected : backgroundColor } ,
317
- { depthCompare : 'not-equal' , depthClearValue : 1.0 , _expected : triangleColor } ,
318
- {
319
- depthCompare : 'not-equal' ,
320
- depthClearValue : kMiddleDepthValue ,
321
- _expected : backgroundColor ,
322
- } ,
323
- { depthCompare : 'not-equal' , depthClearValue : 0.0 , _expected : triangleColor } ,
324
- { depthCompare : 'greater-equal' , depthClearValue : 1.0 , _expected : backgroundColor } ,
325
- {
326
- depthCompare : 'greater-equal' ,
327
- depthClearValue : kMiddleDepthValue ,
328
- _expected : triangleColor ,
329
- } ,
330
- { depthCompare : 'greater-equal' , depthClearValue : 0.0 , _expected : triangleColor } ,
331
- { depthCompare : 'greater' , depthClearValue : 1.0 , _expected : backgroundColor } ,
332
- { depthCompare : 'greater' , depthClearValue : kMiddleDepthValue , _expected : backgroundColor } ,
333
- { depthCompare : 'greater' , depthClearValue : 0.0 , _expected : triangleColor } ,
334
- { depthCompare : 'always' , depthClearValue : 1.0 , _expected : triangleColor } ,
335
- { depthCompare : 'always' , depthClearValue : kMiddleDepthValue , _expected : triangleColor } ,
336
- { depthCompare : 'always' , depthClearValue : 0.0 , _expected : triangleColor } ,
337
- ] as const )
295
+ u . combine ( 'format' , kDepthTextureFormats ) . combineWithParams ( [
296
+ { depthCompare : 'never' , depthClearValue : 1.0 , _expected : backgroundColor } ,
297
+ { depthCompare : 'never' , depthClearValue : kMiddleDepthValue , _expected : backgroundColor } ,
298
+ { depthCompare : 'never' , depthClearValue : 0.0 , _expected : backgroundColor } ,
299
+ { depthCompare : 'less' , depthClearValue : 1.0 , _expected : triangleColor } ,
300
+ { depthCompare : 'less' , depthClearValue : kMiddleDepthValue , _expected : backgroundColor } ,
301
+ { depthCompare : 'less' , depthClearValue : 0.0 , _expected : backgroundColor } ,
302
+ { depthCompare : 'less-equal' , depthClearValue : 1.0 , _expected : triangleColor } ,
303
+ {
304
+ depthCompare : 'less-equal' ,
305
+ depthClearValue : kMiddleDepthValue ,
306
+ _expected : triangleColor ,
307
+ } ,
308
+ { depthCompare : 'less-equal' , depthClearValue : 0.0 , _expected : backgroundColor } ,
309
+ { depthCompare : 'equal' , depthClearValue : 1.0 , _expected : backgroundColor } ,
310
+ { depthCompare : 'equal' , depthClearValue : kMiddleDepthValue , _expected : triangleColor } ,
311
+ { depthCompare : 'equal' , depthClearValue : 0.0 , _expected : backgroundColor } ,
312
+ { depthCompare : 'not-equal' , depthClearValue : 1.0 , _expected : triangleColor } ,
313
+ {
314
+ depthCompare : 'not-equal' ,
315
+ depthClearValue : kMiddleDepthValue ,
316
+ _expected : backgroundColor ,
317
+ } ,
318
+ { depthCompare : 'not-equal' , depthClearValue : 0.0 , _expected : triangleColor } ,
319
+ { depthCompare : 'greater-equal' , depthClearValue : 1.0 , _expected : backgroundColor } ,
320
+ {
321
+ depthCompare : 'greater-equal' ,
322
+ depthClearValue : kMiddleDepthValue ,
323
+ _expected : triangleColor ,
324
+ } ,
325
+ { depthCompare : 'greater-equal' , depthClearValue : 0.0 , _expected : triangleColor } ,
326
+ { depthCompare : 'greater' , depthClearValue : 1.0 , _expected : backgroundColor } ,
327
+ { depthCompare : 'greater' , depthClearValue : kMiddleDepthValue , _expected : backgroundColor } ,
328
+ { depthCompare : 'greater' , depthClearValue : 0.0 , _expected : triangleColor } ,
329
+ { depthCompare : 'always' , depthClearValue : 1.0 , _expected : triangleColor } ,
330
+ { depthCompare : 'always' , depthClearValue : kMiddleDepthValue , _expected : triangleColor } ,
331
+ { depthCompare : 'always' , depthClearValue : 0.0 , _expected : triangleColor } ,
332
+ ] as const )
338
333
)
339
- . beforeAllSubcases ( t => {
340
- t . selectDeviceForTextureFormatOrSkipTestCase ( t . params . format ) ;
341
- } )
342
334
. fn ( t => {
343
335
const { depthCompare, depthClearValue, _expected, format } = t . params ;
336
+ t . skipIfTextureFormatNotSupported ( format ) ;
344
337
345
338
const colorAttachmentFormat = 'rgba8unorm' ;
346
339
const colorAttachment = t . createTextureTracked ( {
@@ -397,7 +390,7 @@ g.test('depth_compare_func')
397
390
depthLoadOp : 'clear' ,
398
391
depthStoreOp : 'store' ,
399
392
} ;
400
- if ( kTextureFormatInfo [ format ] . stencil ) {
393
+ if ( isStencilTextureFormat ( format ) ) {
401
394
depthStencilAttachment . stencilClearValue = 0 ;
402
395
depthStencilAttachment . stencilLoadOp = 'clear' ;
403
396
depthStencilAttachment . stencilStoreOp = 'store' ;
0 commit comments