@@ -12,8 +12,9 @@ import { Float16Array } from '../../../../external/petamoriken/float16/float16.j
12
12
import { kTextureDimensions } from '../../../capability_info.js' ;
13
13
import {
14
14
ColorTextureFormat ,
15
- kColorTextureFormats ,
16
- kTextureFormatInfo ,
15
+ getBlockInfoForColorTextureFormat ,
16
+ getTextureFormatType ,
17
+ kPossibleStorageTextureFormats ,
17
18
} from '../../../format_info.js' ;
18
19
import { AllFeaturesMaxLimitsGPUTest } from '../../../gpu_test.js' ;
19
20
import { kValidShaderStages , TValidShaderStage } from '../../../util/shader.js' ;
@@ -51,8 +52,7 @@ class F extends AllFeaturesMaxLimitsGPUTest {
51
52
storageTexture : GPUTexture ,
52
53
format : ColorTextureFormat
53
54
) : ArrayBuffer {
54
- const bytesPerBlock = kTextureFormatInfo [ format ] . color . bytes ;
55
- assert ( bytesPerBlock !== undefined ) ;
55
+ const { bytesPerBlock } = getBlockInfoForColorTextureFormat ( format ) ;
56
56
57
57
const width = storageTexture . width ;
58
58
const height = storageTexture . height ;
@@ -175,14 +175,16 @@ class F extends AllFeaturesMaxLimitsGPUTest {
175
175
}
176
176
177
177
getTypedArrayBufferForOutputBufferData ( arrayBuffer : ArrayBuffer , format : ColorTextureFormat ) {
178
- switch ( kTextureFormatInfo [ format ] . color . type ) {
178
+ switch ( getTextureFormatType ( format ) ) {
179
179
case 'uint' :
180
180
return new Uint32Array ( arrayBuffer ) ;
181
181
case 'sint' :
182
182
return new Int32Array ( arrayBuffer ) ;
183
183
case 'float' :
184
184
case 'unfilterable-float' :
185
185
return new Float32Array ( arrayBuffer ) ;
186
+ default :
187
+ unreachable ( ) ;
186
188
}
187
189
}
188
190
@@ -220,7 +222,7 @@ class F extends AllFeaturesMaxLimitsGPUTest {
220
222
}
221
223
222
224
getOutputBufferWGSLType ( format : ColorTextureFormat ) {
223
- switch ( kTextureFormatInfo [ format ] . color . type ) {
225
+ switch ( getTextureFormatType ( format ) ) {
224
226
case 'uint' :
225
227
return 'vec4u' ;
226
228
case 'sint' :
@@ -542,25 +544,16 @@ g.test('basic')
542
544
)
543
545
. params ( u =>
544
546
u
545
- . combine ( 'format' , kColorTextureFormats )
546
- . filter (
547
- p => p . format === 'bgra8unorm' || kTextureFormatInfo [ p . format ] . color ?. storage === true
548
- )
547
+ . combine ( 'format' , kPossibleStorageTextureFormats )
549
548
. combine ( 'shaderStage' , kValidShaderStages )
550
549
. combine ( 'dimension' , kTextureDimensions )
551
550
. combine ( 'depthOrArrayLayers' , [ 1 , 2 ] as const )
552
551
. unless ( p => p . dimension === '1d' && p . depthOrArrayLayers > 1 )
553
552
)
554
- . beforeAllSubcases ( t => {
555
- if ( t . params . format === 'bgra8unorm' ) {
556
- t . selectDeviceOrSkipTestCase ( 'bgra8unorm-storage' ) ;
557
- }
558
- if ( t . isCompatibility ) {
559
- t . skipIfTextureFormatNotUsableAsStorageTextureDeprecated ( t . params . format ) ;
560
- }
561
- } )
562
553
. fn ( t => {
563
554
const { format, shaderStage, dimension, depthOrArrayLayers } = t . params ;
555
+ t . skipIfTextureFormatNotSupported ( format ) ;
556
+ t . skipIfTextureFormatNotUsableAsStorageTexture ( format ) ;
564
557
565
558
if ( t . isCompatibility ) {
566
559
if ( shaderStage === 'fragment' ) {
@@ -598,7 +591,7 @@ g.test('basic')
598
591
599
592
t . doTransform ( storageTexture , shaderStage , format , outputBuffer ) ;
600
593
601
- switch ( kTextureFormatInfo [ format ] . color . type ) {
594
+ switch ( getTextureFormatType ( format ) ) {
602
595
case 'uint' :
603
596
t . expectGPUBufferValuesEqual ( outputBuffer , new Uint32Array ( expectedData ) ) ;
604
597
break ;
0 commit comments