@@ -6,10 +6,12 @@ import { makeTestGroup } from '../../../../common/framework/test_group.js';
6
6
import { range } from '../../../../common/util/util.js' ;
7
7
import {
8
8
computeBytesPerSampleFromFormats ,
9
- kRenderableColorTextureFormats ,
10
- kTextureFormatInfo ,
9
+ getColorRenderByteCost ,
10
+ getTextureFormatType ,
11
+ isSintOrUintFormat ,
12
+ kPossibleColorRenderableTextureFormats ,
11
13
} from '../../../format_info.js' ;
12
- import { GPUTest , TextureTestMixin } from '../../../gpu_test.js' ;
14
+ import { AllFeaturesMaxLimitsGPUTest , TextureTestMixin } from '../../../gpu_test.js' ;
13
15
import { getFragmentShaderCodeWithOutput , getPlainTypeInfo } from '../../../util/shader.js' ;
14
16
import { kTexelRepresentationInfo } from '../../../util/texture/texel_data.js' ;
15
17
@@ -25,7 +27,7 @@ const kVertexShader = `
25
27
}
26
28
` ;
27
29
28
- export const g = makeTestGroup ( TextureTestMixin ( GPUTest ) ) ;
30
+ export const g = makeTestGroup ( TextureTestMixin ( AllFeaturesMaxLimitsGPUTest ) ) ;
29
31
30
32
// Values to write into each attachment
31
33
// We make values different for each attachment index and each channel
@@ -50,33 +52,30 @@ g.test('color,attachments')
50
52
. desc ( `Test that pipeline with sparse color attachments write values correctly.` )
51
53
. params ( u =>
52
54
u
53
- . combine ( 'format' , kRenderableColorTextureFormats )
55
+ . combine ( 'format' , kPossibleColorRenderableTextureFormats )
54
56
. beginSubcases ( )
55
57
. combine ( 'attachmentCount' , [ 2 , 3 , 4 ] )
56
58
. expand ( 'emptyAttachmentId' , p => range ( p . attachmentCount , i => i ) )
57
59
)
58
- . beforeAllSubcases ( t => {
59
- const info = kTextureFormatInfo [ t . params . format ] ;
60
- t . skipIfTextureFormatNotSupportedDeprecated ( t . params . format ) ;
61
- t . selectDeviceOrSkipTestCase ( info . feature ) ;
62
- } )
63
60
. fn ( t => {
64
61
const { format, attachmentCount, emptyAttachmentId } = t . params ;
62
+
63
+ t . skipIfTextureFormatNotSupported ( format ) ;
64
+ t . skipIfTextureFormatNotUsableAsRenderAttachment ( format ) ;
65
+
65
66
const componentCount = kTexelRepresentationInfo [ format ] . componentOrder . length ;
66
- const info = kTextureFormatInfo [ format ] ;
67
67
68
68
// We only need to test formats that have a valid color attachment bytes per sample.
69
- const pixelByteCost = kTextureFormatInfo [ format ] . colorRender ?. byteCost ;
69
+ const pixelByteCost = getColorRenderByteCost ( format ) ;
70
70
t . skipIf (
71
71
pixelByteCost === undefined ||
72
72
computeBytesPerSampleFromFormats ( range ( attachmentCount , ( ) => format ) ) >
73
73
t . device . limits . maxColorAttachmentBytesPerSample
74
74
) ;
75
75
76
- const writeValues =
77
- info . color . type === 'sint' || info . color . type === 'uint'
78
- ? attachmentsIntWriteValues
79
- : attachmentsFloatWriteValues ;
76
+ const writeValues = isSintOrUintFormat ( format )
77
+ ? attachmentsIntWriteValues
78
+ : attachmentsFloatWriteValues ;
80
79
81
80
const renderTargets = range ( attachmentCount , ( ) =>
82
81
t . createTextureTracked ( {
@@ -106,7 +105,7 @@ g.test('color,attachments')
106
105
writeValues [ i ] . B ,
107
106
writeValues [ i ] . A ,
108
107
] ,
109
- plainType : getPlainTypeInfo ( info . color . type ) ,
108
+ plainType : getPlainTypeInfo ( getTextureFormatType ( format ) ! ) ,
110
109
componentCount,
111
110
}
112
111
)
@@ -152,19 +151,15 @@ g.test('color,component_count')
152
151
)
153
152
. params ( u =>
154
153
u
155
- . combine ( 'format' , kRenderableColorTextureFormats )
154
+ . combine ( 'format' , kPossibleColorRenderableTextureFormats )
156
155
. beginSubcases ( )
157
156
. combine ( 'componentCount' , [ 1 , 2 , 3 , 4 ] )
158
157
. filter ( x => x . componentCount >= kTexelRepresentationInfo [ x . format ] . componentOrder . length )
159
158
)
160
- . beforeAllSubcases ( t => {
161
- const info = kTextureFormatInfo [ t . params . format ] ;
162
- t . skipIfTextureFormatNotSupportedDeprecated ( t . params . format ) ;
163
- t . selectDeviceOrSkipTestCase ( info . feature ) ;
164
- } )
165
159
. fn ( t => {
166
160
const { format, componentCount } = t . params ;
167
- const info = kTextureFormatInfo [ format ] ;
161
+ t . skipIfTextureFormatNotSupported ( format ) ;
162
+ t . skipIfTextureFormatNotUsableAsRenderAttachment ( format ) ;
168
163
169
164
// expected RGBA values
170
165
// extra channels are discarded
@@ -189,7 +184,7 @@ g.test('color,component_count')
189
184
code : getFragmentShaderCodeWithOutput ( [
190
185
{
191
186
values,
192
- plainType : getPlainTypeInfo ( info . color . type ) ,
187
+ plainType : getPlainTypeInfo ( getTextureFormatType ( format ) ! ) ,
193
188
componentCount,
194
189
} ,
195
190
] ) ,
@@ -364,10 +359,6 @@ The attachment has a load value of [1, 0, 0, 1]
364
359
] as const )
365
360
. filter ( x => x . output . length >= kTexelRepresentationInfo [ x . format ] . componentOrder . length )
366
361
)
367
- . beforeAllSubcases ( t => {
368
- const info = kTextureFormatInfo [ t . params . format ] ;
369
- t . selectDeviceOrSkipTestCase ( info . feature ) ;
370
- } )
371
362
. fn ( t => {
372
363
const {
373
364
format,
@@ -378,8 +369,10 @@ The attachment has a load value of [1, 0, 0, 1]
378
369
alphaSrcFactor,
379
370
alphaDstFactor,
380
371
} = t . params ;
372
+ t . skipIfTextureFormatNotSupported ( format ) ;
373
+ t . skipIfTextureFormatNotBlendable ( format ) ;
374
+
381
375
const componentCount = output . length ;
382
- const info = kTextureFormatInfo [ format ] ;
383
376
384
377
const renderTarget = t . createTextureTracked ( {
385
378
format,
@@ -400,7 +393,7 @@ The attachment has a load value of [1, 0, 0, 1]
400
393
code : getFragmentShaderCodeWithOutput ( [
401
394
{
402
395
values : output ,
403
- plainType : getPlainTypeInfo ( info . color . type ) ,
396
+ plainType : getPlainTypeInfo ( getTextureFormatType ( format ) ! ) ,
404
397
componentCount,
405
398
} ,
406
399
] ) ,
0 commit comments