@@ -11,11 +11,14 @@ import {
11
11
} from '../../capability_info.js' ;
12
12
import { GPUConst } from '../../constants.js' ;
13
13
import {
14
- kTextureFormatInfo ,
15
14
kAllTextureFormats ,
16
15
kFeaturesForFormats ,
17
16
filterFormatsByFeature ,
18
- viewCompatibleDeprecated ,
17
+ textureFormatsAreViewCompatible ,
18
+ isDepthTextureFormat ,
19
+ isStencilTextureFormat ,
20
+ getBlockInfoForTextureFormat ,
21
+ isTextureFormatPossiblyUsableAsRenderAttachment ,
19
22
} from '../../format_info.js' ;
20
23
import { kResourceStates } from '../../gpu_test.js' ;
21
24
import {
@@ -25,9 +28,9 @@ import {
25
28
} from '../../util/texture/base.js' ;
26
29
import { reifyExtent3D } from '../../util/unions.js' ;
27
30
28
- import { ValidationTest } from './validation_test.js' ;
31
+ import { AllFeaturesMaxLimitsValidationTest } from './validation_test.js' ;
29
32
30
- export const g = makeTestGroup ( ValidationTest ) ;
33
+ export const g = makeTestGroup ( AllFeaturesMaxLimitsValidationTest ) ;
31
34
32
35
const kLevels = 6 ;
33
36
@@ -48,19 +51,15 @@ g.test('format')
48
51
)
49
52
. combine ( 'useViewFormatList' , [ false , true ] )
50
53
)
51
- . beforeAllSubcases ( t => {
52
- const { textureFormatFeature, viewFormatFeature } = t . params ;
53
- t . selectDeviceOrSkipTestCase ( [ textureFormatFeature , viewFormatFeature ] ) ;
54
- } )
55
54
. fn ( t => {
56
55
const { textureFormat, viewFormat, useViewFormatList } = t . params ;
57
- const { blockWidth, blockHeight } = kTextureFormatInfo [ textureFormat ] ;
56
+ const { blockWidth, blockHeight } = getBlockInfoForTextureFormat ( textureFormat ) ;
58
57
59
- t . skipIfTextureFormatNotSupportedDeprecated ( textureFormat , viewFormat ) ;
58
+ t . skipIfTextureFormatNotSupported ( textureFormat , viewFormat ) ;
60
59
61
60
const compatible =
62
61
viewFormat === undefined ||
63
- viewCompatibleDeprecated ( t . isCompatibility , textureFormat , viewFormat ) ;
62
+ textureFormatsAreViewCompatible ( t . device , textureFormat , viewFormat ) ;
64
63
65
64
const texture = t . createTextureTracked ( {
66
65
format : textureFormat ,
@@ -94,11 +93,9 @@ g.test('dimension')
94
93
. combine ( 'textureDimension' , kTextureDimensions )
95
94
. combine ( 'viewDimension' , [ ...kTextureViewDimensions , undefined ] )
96
95
)
97
- . beforeAllSubcases ( t => {
98
- t . skipIfTextureViewDimensionNotSupportedDeprecated ( t . params . viewDimension ) ;
99
- } )
100
96
. fn ( t => {
101
97
const { textureDimension, viewDimension } = t . params ;
98
+ t . skipIfTextureViewDimensionNotSupported ( t . params . viewDimension ) ;
102
99
103
100
const size = textureDimension === '1d' ? [ 4 ] : [ 4 , 4 , 6 ] ;
104
101
const textureDescriptor = {
@@ -130,24 +127,22 @@ g.test('aspect')
130
127
. combine ( 'format' , kAllTextureFormats )
131
128
. combine ( 'aspect' , kTextureAspects )
132
129
)
133
- . beforeAllSubcases ( t => {
134
- const { format } = t . params ;
135
- t . selectDeviceForTextureFormatOrSkipTestCase ( format ) ;
136
- } )
137
130
. fn ( t => {
138
131
const { format, aspect } = t . params ;
139
- const info = kTextureFormatInfo [ format ] ;
132
+ const { blockWidth, blockHeight } = getBlockInfoForTextureFormat ( format ) ;
133
+
134
+ t . skipIfTextureFormatNotSupported ( format ) ;
140
135
141
136
const texture = t . createTextureTracked ( {
142
137
format,
143
- size : [ info . blockWidth , info . blockHeight , 1 ] ,
138
+ size : [ blockWidth , blockHeight , 1 ] ,
144
139
usage : GPUTextureUsage . TEXTURE_BINDING ,
145
140
} ) ;
146
141
147
142
const success =
148
143
aspect === 'all' ||
149
- ( aspect === 'depth-only' && info . depth ) ||
150
- ( aspect === 'stencil-only' && info . stencil ) ;
144
+ ( aspect === 'depth-only' && isDepthTextureFormat ( format ) ) ||
145
+ ( aspect === 'stencil-only' && isStencilTextureFormat ( format ) ) ;
151
146
t . expectValidationError ( ( ) => {
152
147
texture . createView ( { aspect } ) ;
153
148
} , ! success ) ;
@@ -277,7 +272,7 @@ g.test('mip_levels')
277
272
const { textureDimension, viewDimension, textureLevels, baseMipLevel, mipLevelCount } =
278
273
t . params ;
279
274
280
- t . skipIfTextureViewDimensionNotSupportedDeprecated ( viewDimension ) ;
275
+ t . skipIfTextureViewDimensionNotSupported ( viewDimension ) ;
281
276
282
277
const textureDescriptor : GPUTextureDescriptor = {
283
278
format : 'rgba8unorm' ,
@@ -317,7 +312,7 @@ g.test('cube_faces_square')
317
312
. fn ( t => {
318
313
const { dimension, size } = t . params ;
319
314
320
- t . skipIfTextureViewDimensionNotSupportedDeprecated ( dimension ) ;
315
+ t . skipIfTextureViewDimensionNotSupported ( dimension ) ;
321
316
322
317
const texture = t . createTextureTracked ( {
323
318
format : 'rgba8unorm' ,
@@ -352,43 +347,31 @@ g.test('texture_view_usage')
352
347
. combine ( 'format' , kAllTextureFormats )
353
348
. combine ( 'textureUsage0' , kTextureUsages )
354
349
. combine ( 'textureUsage1' , kTextureUsages )
355
- . filter ( ( { format, textureUsage0, textureUsage1 } ) => {
356
- const info = kTextureFormatInfo [ format ] ;
350
+ . unless ( ( { format, textureUsage0, textureUsage1 } ) => {
357
351
const textureUsage = textureUsage0 | textureUsage1 ;
358
-
359
- if (
352
+ return (
360
353
( textureUsage & GPUConst . TextureUsage . RENDER_ATTACHMENT ) !== 0 &&
361
- info . color &&
362
- ! info . colorRender
363
- ) {
364
- return false ;
365
- }
366
-
367
- return true ;
354
+ ! isTextureFormatPossiblyUsableAsRenderAttachment ( format )
355
+ ) ;
368
356
} )
369
357
. beginSubcases ( )
370
358
. combine ( 'textureViewUsage0' , [ 0 , ...kTextureUsages ] )
371
359
. combine ( 'textureViewUsage1' , [ 0 , ...kTextureUsages ] )
372
360
)
373
- . beforeAllSubcases ( t => {
374
- const { format, textureUsage0, textureUsage1 } = t . params ;
375
- const info = kTextureFormatInfo [ format ] ;
376
- const textureUsage = textureUsage0 | textureUsage1 ;
377
- t . skipIfTextureFormatNotSupportedDeprecated ( format ) ;
378
- t . selectDeviceOrSkipTestCase ( info . feature ) ;
379
- if ( textureUsage & GPUTextureUsage . STORAGE_BINDING ) {
380
- t . skipIfTextureFormatNotUsableAsStorageTextureDeprecated ( format ) ;
381
- }
382
- } )
383
361
. fn ( t => {
384
362
const { format, textureUsage0, textureUsage1, textureViewUsage0, textureViewUsage1 } = t . params ;
385
- const info = kTextureFormatInfo [ format ] ;
386
363
387
- const size = [ info . blockWidth , info . blockHeight , 1 ] ;
364
+ t . skipIfTextureFormatNotSupported ( format ) ;
365
+
366
+ const { blockWidth, blockHeight } = getBlockInfoForTextureFormat ( format ) ;
367
+
368
+ const size = [ blockWidth , blockHeight , 1 ] ;
388
369
const dimension = '2d' ;
389
370
const mipLevelCount = 1 ;
390
371
const usage = textureUsage0 | textureUsage1 ;
391
372
373
+ t . skipIfTextureFormatDoesNotSupportUsage ( usage , format ) ;
374
+
392
375
const textureDescriptor : GPUTextureDescriptor = {
393
376
size,
394
377
mipLevelCount,
0 commit comments