@@ -8,14 +8,15 @@ import { makeTestGroup } from '../../../../common/framework/test_group.js';
8
8
import { range } from '../../../../common/util/util.js' ;
9
9
import { getDefaultLimits , kTextureSampleCounts } from '../../../capability_info.js' ;
10
10
import {
11
- kRegularTextureFormats ,
12
11
kSizedDepthStencilFormats ,
13
12
kUnsizedDepthStencilFormats ,
14
- kTextureFormatInfo ,
15
13
filterFormatsByFeature ,
16
14
getFeaturesForFormats ,
15
+ isDepthTextureFormat ,
16
+ isStencilTextureFormat ,
17
+ kPossibleColorRenderableTextureFormats ,
17
18
} from '../../../format_info.js' ;
18
- import { ValidationTest } from '../validation_test.js' ;
19
+ import { AllFeaturesMaxLimitsValidationTest } from '../validation_test.js' ;
19
20
20
21
// MAINTENANCE_TODO: This should be changed to kMaxColorAttachmentsToTest
21
22
// when this is made a MaxLimitTest (see above).
@@ -89,7 +90,7 @@ const kFeaturesForDepthStencilAttachmentFormats = getFeaturesForFormats([
89
90
...kUnsizedDepthStencilFormats ,
90
91
] ) ;
91
92
92
- class F extends ValidationTest {
93
+ class F extends AllFeaturesMaxLimitsValidationTest {
93
94
createAttachmentTextureView ( format : GPUTextureFormat , sampleCount ?: number ) {
94
95
return this . createTextureTracked ( {
95
96
// Size matching the "arbitrary" size used by ValidationTest helpers.
@@ -121,12 +122,12 @@ class F extends ValidationTest {
121
122
const attachment : GPURenderPassDepthStencilAttachment = {
122
123
view : this . createAttachmentTextureView ( format , sampleCount ) ,
123
124
} ;
124
- if ( kTextureFormatInfo [ format ] . depth ) {
125
+ if ( isDepthTextureFormat ( format ) ) {
125
126
attachment . depthClearValue = 0 ;
126
127
attachment . depthLoadOp = 'clear' ;
127
128
attachment . depthStoreOp = 'discard' ;
128
129
}
129
- if ( kTextureFormatInfo [ format ] . stencil ) {
130
+ if ( isStencilTextureFormat ( format ) ) {
130
131
attachment . stencilClearValue = 1 ;
131
132
attachment . stencilLoadOp = 'clear' ;
132
133
attachment . stencilStoreOp = 'discard' ;
@@ -167,21 +168,17 @@ class F extends ValidationTest {
167
168
168
169
export const g = makeTestGroup ( F ) ;
169
170
170
- const kColorAttachmentFormats = kRegularTextureFormats . filter (
171
- format => ! ! kTextureFormatInfo [ format ] . colorRender
172
- ) ;
173
-
174
171
g . test ( 'render_pass_and_bundle,color_format' )
175
172
. desc ( 'Test that color attachment formats in render passes and bundles must match.' )
176
173
. paramsSubcasesOnly ( u =>
177
174
u //
178
- . combine ( 'passFormat' , kColorAttachmentFormats )
179
- . combine ( 'bundleFormat' , kColorAttachmentFormats )
175
+ . combine ( 'passFormat' , kPossibleColorRenderableTextureFormats )
176
+ . combine ( 'bundleFormat' , kPossibleColorRenderableTextureFormats )
180
177
)
181
178
. fn ( t => {
182
179
const { passFormat, bundleFormat } = t . params ;
183
-
184
- t . skipIfTextureFormatNotSupportedDeprecated ( passFormat , bundleFormat ) ;
180
+ t . skipIfTextureFormatNotSupported ( passFormat , bundleFormat ) ;
181
+ t . skipIfTextureFormatNotUsableAsRenderAttachment ( passFormat , bundleFormat ) ;
185
182
186
183
const bundleEncoder = t . device . createRenderBundleEncoder ( {
187
184
colorFormats : [ bundleFormat ] ,
@@ -301,12 +298,9 @@ g.test('render_pass_and_bundle,depth_format')
301
298
filterFormatsByFeature ( bundleFeature , kDepthStencilAttachmentFormats )
302
299
)
303
300
)
304
- . beforeAllSubcases ( t => {
305
- const { passFeature, bundleFeature } = t . params ;
306
- t . selectDeviceOrSkipTestCase ( [ passFeature , bundleFeature ] ) ;
307
- } )
308
301
. fn ( t => {
309
302
const { passFormat, bundleFormat } = t . params ;
303
+ t . skipIfTextureFormatNotSupported ( passFormat , bundleFormat ) ;
310
304
311
305
const bundleEncoder = t . device . createRenderBundleEncoder ( {
312
306
colorFormats : [ 'rgba8unorm' ] ,
@@ -351,9 +345,7 @@ g.test('render_pass_and_bundle,sample_count')
351
345
g . test ( 'render_pass_and_bundle,device_mismatch' )
352
346
. desc ( 'Test that render passes cannot be called with bundles created from another device.' )
353
347
. paramsSubcasesOnly ( u => u . combine ( 'mismatched' , [ true , false ] ) )
354
- . beforeAllSubcases ( t => {
355
- t . selectMismatchedDeviceOrSkipTestCase ( undefined ) ;
356
- } )
348
+ . beforeAllSubcases ( t => t . usesMismatchedDevice ( ) )
357
349
. fn ( t => {
358
350
const { mismatched } = t . params ;
359
351
const sourceDevice = mismatched ? t . mismatchedDevice : t . device ;
@@ -383,13 +375,13 @@ Test that color attachment formats in render passes or bundles match the pipelin
383
375
u
384
376
. combine ( 'encoderType' , [ 'render pass' , 'render bundle' ] as const )
385
377
. beginSubcases ( )
386
- . combine ( 'encoderFormat' , kColorAttachmentFormats )
387
- . combine ( 'pipelineFormat' , kColorAttachmentFormats )
378
+ . combine ( 'encoderFormat' , kPossibleColorRenderableTextureFormats )
379
+ . combine ( 'pipelineFormat' , kPossibleColorRenderableTextureFormats )
388
380
)
389
381
. fn ( t => {
390
382
const { encoderType, encoderFormat, pipelineFormat } = t . params ;
391
-
392
- t . skipIfTextureFormatNotSupportedDeprecated ( encoderFormat , pipelineFormat ) ;
383
+ t . skipIfTextureFormatNotSupported ( encoderFormat , pipelineFormat ) ;
384
+ t . skipIfTextureFormatNotUsableAsRenderAttachment ( encoderFormat , pipelineFormat ) ;
393
385
394
386
const pipeline = t . createRenderPipeline ( [ { format : pipelineFormat , writeMask : 0 } ] ) ;
395
387
@@ -506,12 +498,9 @@ Test that the depth attachment format in render passes or bundles match the pipe
506
498
filterFormatsByFeature ( pipelineFormatFeature , kDepthStencilAttachmentFormats )
507
499
)
508
500
)
509
- . beforeAllSubcases ( t => {
510
- const { encoderFormatFeature, pipelineFormatFeature } = t . params ;
511
- t . selectDeviceOrSkipTestCase ( [ encoderFormatFeature , pipelineFormatFeature ] ) ;
512
- } )
513
501
. fn ( t => {
514
502
const { encoderType, encoderFormat, pipelineFormat } = t . params ;
503
+ t . skipIfTextureFormatNotSupported ( encoderFormat , pipelineFormat ) ;
515
504
516
505
const pipeline = t . createRenderPipeline (
517
506
[ { format : 'rgba8unorm' , writeMask : 0 } ] ,
@@ -554,16 +543,15 @@ Test that the depth stencil read only state in render passes or bundles is compa
554
543
. combine ( 'cullMode' , [ 'none' , 'front' , 'back' ] as const )
555
544
. filter ( p => {
556
545
if ( p . format ) {
557
- const depthStencilInfo = kTextureFormatInfo [ p . format ] ;
558
546
// If the format has no depth aspect, the depthReadOnly, depthWriteEnabled of the pipeline must not be true
559
547
// in order to create a valid render pipeline.
560
- if ( ! depthStencilInfo . depth && p . depthWriteEnabled ) {
548
+ if ( ! isDepthTextureFormat ( p . format ) && p . depthWriteEnabled ) {
561
549
return false ;
562
550
}
563
551
// If the format has no stencil aspect, the stencil state operation must be 'keep'
564
552
// in order to create a valid render pipeline.
565
553
if (
566
- ! depthStencilInfo . stencil &&
554
+ ! isStencilTextureFormat ( p . format ) &&
567
555
( p . stencilFront . failOp !== 'keep' || p . stencilBack . failOp !== 'keep' )
568
556
) {
569
557
return false ;
@@ -573,9 +561,6 @@ Test that the depth stencil read only state in render passes or bundles is compa
573
561
return true ;
574
562
} )
575
563
)
576
- . beforeAllSubcases ( t => {
577
- t . selectDeviceForTextureFormatOrSkipTestCase ( t . params . format ) ;
578
- } )
579
564
. fn ( t => {
580
565
const {
581
566
encoderType,
@@ -588,6 +573,7 @@ Test that the depth stencil read only state in render passes or bundles is compa
588
573
stencilFront,
589
574
stencilBack,
590
575
} = t . params ;
576
+ t . skipIfTextureFormatNotSupported ( format ) ;
591
577
592
578
const pipeline = t . createRenderPipeline (
593
579
[ { format : 'rgba8unorm' , writeMask : 0 } ] ,
0 commit comments