@@ -12,7 +12,7 @@ import {
12
12
kRegularTextureFormats ,
13
13
kFeaturesForFormats ,
14
14
filterFormatsByFeature ,
15
- textureDimensionAndFormatCompatible ,
15
+ textureFormatAndDimensionPossiblyCompatible ,
16
16
getBlockInfoForTextureFormat ,
17
17
isTextureFormatMultisampled ,
18
18
isTextureFormatColorRenderable ,
@@ -53,11 +53,15 @@ g.test('zero_size_and_usage')
53
53
'usage' ,
54
54
] as const )
55
55
// Filter out incompatible dimension type and format combinations.
56
- . filter ( ( { dimension, format } ) => textureDimensionAndFormatCompatible ( dimension , format ) )
56
+ . filter ( ( { dimension, format } ) =>
57
+ textureFormatAndDimensionPossiblyCompatible ( dimension , format )
58
+ )
57
59
)
58
60
. fn ( t => {
59
61
const { dimension, zeroArgument, format } = t . params ;
60
62
t . skipIfTextureFormatNotSupported ( format ) ;
63
+ t . skipIfTextureFormatAndDimensionNotCompatible ( format , dimension ) ;
64
+
61
65
const info = getBlockInfoForTextureFormat ( format ) ;
62
66
63
67
const size = [ info . blockWidth , info . blockHeight , 1 ] ;
@@ -141,13 +145,16 @@ g.test('mipLevelCount,format')
141
145
. beginSubcases ( )
142
146
. combine ( 'mipLevelCount' , [ 1 , 2 , 3 , 6 , 7 ] )
143
147
// Filter out incompatible dimension type and format combinations.
144
- . filter ( ( { dimension, format } ) => textureDimensionAndFormatCompatible ( dimension , format ) )
148
+ . filter ( ( { dimension, format } ) =>
149
+ textureFormatAndDimensionPossiblyCompatible ( dimension , format )
150
+ )
145
151
. combine ( 'largestDimension' , [ 0 , 1 , 2 ] )
146
152
. unless ( ( { dimension, largestDimension } ) => dimension === '1d' && largestDimension > 0 )
147
153
)
148
154
. fn ( t => {
149
155
const { dimension, format, mipLevelCount, largestDimension } = t . params ;
150
156
t . skipIfTextureFormatNotSupported ( format ) ;
157
+ t . skipIfTextureFormatAndDimensionNotCompatible ( format , dimension ) ;
151
158
const info = getBlockInfoForTextureFormat ( format ) ;
152
159
153
160
// Compute dimensions such that the dimensions are in range [17, 32] and aligned with the
@@ -325,7 +332,9 @@ g.test('sampleCount,valid_sampleCount_with_other_parameter_varies')
325
332
return usageSet ;
326
333
} )
327
334
// Filter out incompatible dimension type and format combinations.
328
- . filter ( ( { dimension, format } ) => textureDimensionAndFormatCompatible ( dimension , format ) )
335
+ . filter ( ( { dimension, format } ) =>
336
+ textureFormatAndDimensionPossiblyCompatible ( dimension , format )
337
+ )
329
338
. unless ( ( { usage, format, mipLevelCount, dimension } ) => {
330
339
return (
331
340
( ( usage & GPUConst . TextureUsage . RENDER_ATTACHMENT ) !== 0 &&
@@ -340,6 +349,7 @@ g.test('sampleCount,valid_sampleCount_with_other_parameter_varies')
340
349
. fn ( t => {
341
350
const { dimension, sampleCount, format, mipLevelCount, arrayLayerCount, usage } = t . params ;
342
351
t . skipIfTextureFormatNotSupported ( format ) ;
352
+ t . skipIfTextureFormatAndDimensionNotCompatible ( format , dimension ) ;
343
353
if ( ( usage & GPUConst . TextureUsage . RENDER_ATTACHMENT ) !== 0 ) {
344
354
t . skipIfTextureFormatNotUsableAsRenderAttachment ( format ) ;
345
355
}
@@ -416,11 +426,14 @@ g.test('texture_size,default_value_and_smallest_size,uncompressed_format')
416
426
. beginSubcases ( )
417
427
. combine ( 'size' , [ [ 1 ] , [ 1 , 1 ] , [ 1 , 1 , 1 ] ] )
418
428
// Filter out incompatible dimension type and format combinations.
419
- . filter ( ( { dimension, format } ) => textureDimensionAndFormatCompatible ( dimension , format ) )
429
+ . filter ( ( { dimension, format } ) =>
430
+ textureFormatAndDimensionPossiblyCompatible ( dimension , format )
431
+ )
420
432
)
421
433
. fn ( t => {
422
434
const { dimension, format, size } = t . params ;
423
435
t . skipIfTextureFormatNotSupported ( format ) ;
436
+ t . skipIfTextureFormatAndDimensionNotCompatible ( format , dimension ) ;
424
437
425
438
const descriptor : GPUTextureDescriptor = {
426
439
size,
@@ -439,9 +452,12 @@ g.test('texture_size,default_value_and_smallest_size,compressed_format')
439
452
)
440
453
. params ( u =>
441
454
u
442
- // Compressed formats are invalid for 1D and 3D .
443
- . combine ( 'dimension' , [ undefined , '2d' ] as const )
455
+ // Compressed formats are invalid for 1D.
456
+ . combine ( 'dimension' , [ undefined , '2d' , '3d' ] as const )
444
457
. combine ( 'format' , kCompressedTextureFormats )
458
+ . filter ( ( { dimension, format } ) =>
459
+ textureFormatAndDimensionPossiblyCompatible ( dimension , format )
460
+ )
445
461
. beginSubcases ( )
446
462
. expandWithParams ( p => {
447
463
const { blockWidth, blockHeight } = getBlockInfoForTextureFormat ( p . format ) ;
@@ -458,6 +474,7 @@ g.test('texture_size,default_value_and_smallest_size,compressed_format')
458
474
. fn ( t => {
459
475
const { dimension, format, size, _success } = t . params ;
460
476
t . skipIfTextureFormatNotSupported ( format ) ;
477
+ t . skipIfTextureFormatAndDimensionNotCompatible ( format , dimension ) ;
461
478
462
479
const descriptor : GPUTextureDescriptor = {
463
480
size,
@@ -770,6 +787,7 @@ g.test('texture_size,3d_texture,uncompressed_format')
770
787
. fn ( t => {
771
788
const { format, sizeVariant } = t . params ;
772
789
t . skipIfTextureFormatNotSupported ( format ) ;
790
+ t . skipIfTextureFormatAndDimensionNotCompatible ( format , '3d' ) ;
773
791
const maxTextureDimension3D = t . device . limits . maxTextureDimension3D ;
774
792
const size = sizeVariant . map ( variant => t . makeLimitVariant ( 'maxTextureDimension3D' , variant ) ) ;
775
793
@@ -945,13 +963,10 @@ g.test('texture_size,3d_texture,compressed_format')
945
963
] ;
946
964
} )
947
965
)
948
- . beforeAllSubcases ( t => {
949
- // Compressed formats are not supported in 3D in WebGPU v1 because they are complicated but not very useful for now.
950
- t . skip ( 'Compressed 3D texture is not supported' ) ;
951
- } )
952
966
. fn ( t => {
953
967
const { format, sizeVariant } = t . params ;
954
968
t . skipIfTextureFormatNotSupported ( format ) ;
969
+ t . skipIfTextureFormatAndDimensionNotCompatible ( format , '3d' ) ;
955
970
const info = getBlockInfoForTextureFormat ( format ) ;
956
971
957
972
const maxTextureDimension3D = t . device . limits . maxTextureDimension3D ;
@@ -974,7 +989,8 @@ g.test('texture_size,3d_texture,compressed_format')
974
989
size [ 1 ] % info . blockHeight === 0 &&
975
990
size [ 0 ] <= maxTextureDimension3D &&
976
991
size [ 1 ] <= maxTextureDimension3D &&
977
- size [ 2 ] <= maxTextureDimension3D ;
992
+ size [ 2 ] <= maxTextureDimension3D &&
993
+ textureDimensionAndFormatCompatibleForDevice ( t . device , '3d' , format ) ;
978
994
979
995
t . expectValidationError ( ( ) => {
980
996
t . createTextureTracked ( descriptor ) ;
@@ -994,11 +1010,14 @@ g.test('texture_usage')
994
1010
. combine ( 'usage0' , kTextureUsages )
995
1011
. combine ( 'usage1' , kTextureUsages )
996
1012
// Filter out incompatible dimension type and format combinations.
997
- . filter ( ( { dimension, format } ) => textureDimensionAndFormatCompatible ( dimension , format ) )
1013
+ . filter ( ( { dimension, format } ) =>
1014
+ textureFormatAndDimensionPossiblyCompatible ( dimension , format )
1015
+ )
998
1016
)
999
1017
. fn ( t => {
1000
1018
const { dimension, format, usage0, usage1 } = t . params ;
1001
1019
t . skipIfTextureFormatNotSupported ( format ) ;
1020
+ t . skipIfTextureFormatAndDimensionNotCompatible ( format , dimension ) ;
1002
1021
const info = getBlockInfoForTextureFormat ( format ) ;
1003
1022
1004
1023
const size = [ info . blockWidth , info . blockHeight , 1 ] ;
0 commit comments