@@ -12,16 +12,19 @@ import { GPUConst } from '../../../constants.js';
12
12
import {
13
13
computeBytesPerSampleFromFormats ,
14
14
kDepthStencilFormats ,
15
- kRenderableColorTextureFormats ,
16
- kTextureFormatInfo ,
15
+ kPossiblyRenderableColorTextureFormats ,
16
+ isTextureFormatColorRenderable ,
17
+ isDepthTextureFormat ,
18
+ isStencilTextureFormat ,
19
+ isTextureFormatResolvable ,
17
20
} from '../../../format_info.js' ;
18
- import { ValidationTest } from '../validation_test.js' ;
21
+ import { AllFeaturesMaxLimitsValidationTest } from '../validation_test.js' ;
19
22
20
23
// MAINTENANCE_TODO: This should be changed to kMaxColorAttachmentsToTest
21
24
// when this is made a MaxLimitTest (see above).
22
25
const kMaxColorAttachments = getDefaultLimits ( 'core' ) . maxColorAttachments . default ;
23
26
24
- class F extends ValidationTest {
27
+ class F extends AllFeaturesMaxLimitsValidationTest {
25
28
createTestTexture (
26
29
options : {
27
30
format ?: GPUTextureFormat ;
@@ -202,20 +205,18 @@ g.test('color_attachments,limits,maxColorAttachmentBytesPerSample,aligned')
202
205
)
203
206
. params ( u =>
204
207
u
205
- . combine ( 'format' , kRenderableColorTextureFormats )
208
+ . combine ( 'format' , kPossiblyRenderableColorTextureFormats )
206
209
. beginSubcases ( )
207
210
. combine (
208
211
'attachmentCount' ,
209
212
range ( kMaxColorAttachments , i => i + 1 )
210
213
)
211
214
)
212
- . beforeAllSubcases ( t => {
213
- t . skipIfTextureFormatNotSupportedDeprecated ( t . params . format ) ;
214
- } )
215
215
. fn ( t => {
216
216
const { format, attachmentCount } = t . params ;
217
- const info = kTextureFormatInfo [ format ] ;
218
217
218
+ t . skipIfTextureFormatNotSupported ( format ) ;
219
+ t . skipIfTextureFormatNotUsableAsRenderAttachment ( format ) ;
219
220
t . skipIf (
220
221
attachmentCount > t . device . limits . maxColorAttachments ,
221
222
`attachmentCount: ${ attachmentCount } > maxColorAttachments: ${ t . device . limits . maxColorAttachments } `
@@ -227,7 +228,7 @@ g.test('color_attachments,limits,maxColorAttachmentBytesPerSample,aligned')
227
228
colorAttachments . push ( t . getColorAttachment ( colorTexture ) ) ;
228
229
}
229
230
const shouldError =
230
- info . colorRender === undefined ||
231
+ ! isTextureFormatColorRenderable ( t . device , format ) ||
231
232
computeBytesPerSampleFromFormats ( range ( attachmentCount , ( ) => format ) ) >
232
233
t . device . limits . maxColorAttachmentBytesPerSample ;
233
234
@@ -1049,10 +1050,6 @@ g.test('depth_stencil_attachment,loadOp_storeOp_match_depthReadOnly_stencilReadO
1049
1050
. combine ( 'stencilLoadOp' , [ undefined , 'clear' , 'load' ] as GPULoadOp [ ] )
1050
1051
. combine ( 'stencilStoreOp' , [ undefined , 'discard' , 'store' ] as GPUStoreOp [ ] )
1051
1052
)
1052
- . beforeAllSubcases ( t => {
1053
- const info = kTextureFormatInfo [ t . params . format as GPUTextureFormat ] ;
1054
- t . selectDeviceOrSkipTestCase ( info . feature ) ;
1055
- } )
1056
1053
. fn ( t => {
1057
1054
const {
1058
1055
format,
@@ -1064,6 +1061,8 @@ g.test('depth_stencil_attachment,loadOp_storeOp_match_depthReadOnly_stencilReadO
1064
1061
stencilStoreOp,
1065
1062
} = t . params ;
1066
1063
1064
+ t . skipIfTextureFormatNotSupported ( format ) ;
1065
+
1067
1066
const depthAttachment = t . createTextureTracked ( {
1068
1067
format,
1069
1068
size : { width : 1 , height : 1 , depthOrArrayLayers : 1 } ,
@@ -1092,11 +1091,10 @@ g.test('depth_stencil_attachment,loadOp_storeOp_match_depthReadOnly_stencilReadO
1092
1091
const pass = encoder . beginRenderPass ( renderPassDescriptor ) ;
1093
1092
pass . end ( ) ;
1094
1093
1095
- const info = kTextureFormatInfo [ format ] ;
1096
1094
const hasDepthSettings = ! ! depthLoadOp && ! ! depthStoreOp && ! depthReadOnly ;
1097
1095
const hasStencilSettings = ! ! stencilLoadOp && ! ! stencilStoreOp && ! stencilReadOnly ;
1098
- const hasDepth = info . depth ;
1099
- const hasStencil = info . stencil ;
1096
+ const hasDepth = isDepthTextureFormat ( format ) ;
1097
+ const hasStencil = isStencilTextureFormat ( format ) ;
1100
1098
1101
1099
const goodAspectSettingsPresent =
1102
1100
( hasDepthSettings ? hasDepth : true ) && ( hasStencilSettings ? hasStencil : true ) ;
@@ -1162,27 +1160,19 @@ g.test('resolveTarget,format_supports_resolve')
1162
1160
if and only if they support 'resolve'.
1163
1161
`
1164
1162
)
1165
- . params ( u =>
1166
- u
1167
- . combine ( 'format' , kRenderableColorTextureFormats )
1168
- . filter ( t => kTextureFormatInfo [ t . format ] . multisample )
1169
- )
1170
- . beforeAllSubcases ( t => {
1171
- const { format } = t . params ;
1172
- t . skipIfTextureFormatNotSupportedDeprecated ( format ) ;
1173
- t . skipIfMultisampleNotSupportedForFormatDeprecated ( format ) ;
1174
- } )
1163
+ . params ( u => u . combine ( 'format' , kPossiblyRenderableColorTextureFormats ) )
1175
1164
. fn ( t => {
1176
1165
const { format } = t . params ;
1177
- const info = kTextureFormatInfo [ format ] ;
1166
+ t . skipIfTextureFormatNotSupported ( format ) ;
1167
+ t . skipIfMultisampleNotSupportedForFormat ( format ) ;
1178
1168
1179
1169
const multisampledColorTexture = t . createTestTexture ( { format, sampleCount : 4 } ) ;
1180
1170
const resolveTarget = t . createTestTexture ( { format } ) ;
1181
1171
1182
1172
const colorAttachment = t . getColorAttachment ( multisampledColorTexture ) ;
1183
1173
colorAttachment . resolveTarget = resolveTarget . createView ( ) ;
1184
1174
1185
- t . tryRenderPass ( ! ! info . colorRender ?. resolve , {
1175
+ t . tryRenderPass ( isTextureFormatResolvable ( t . device , format ) , {
1186
1176
colorAttachments : [ colorAttachment ] ,
1187
1177
} ) ;
1188
1178
} ) ;
@@ -1198,10 +1188,8 @@ g.test('timestampWrites,query_set_type')
1198
1188
u //
1199
1189
. combine ( 'queryType' , kQueryTypes )
1200
1190
)
1201
- . beforeAllSubcases ( t => {
1202
- t . selectDeviceOrSkipTestCase ( [ 'timestamp-query' ] ) ;
1203
- } )
1204
1191
. fn ( t => {
1192
+ t . skipIfDeviceDoesNotSupportQueryType ( 'timestamp' ) ;
1205
1193
const { queryType } = t . params ;
1206
1194
1207
1195
const timestampWrites = {
@@ -1231,10 +1219,8 @@ g.test('timestampWrite,query_index')
1231
1219
. combine ( 'beginningOfPassWriteIndex' , [ undefined , 0 , 1 , 2 , 3 ] as const )
1232
1220
. combine ( 'endOfPassWriteIndex' , [ undefined , 0 , 1 , 2 , 3 ] as const )
1233
1221
)
1234
- . beforeAllSubcases ( t => {
1235
- t . selectDeviceOrSkipTestCase ( [ 'timestamp-query' ] ) ;
1236
- } )
1237
1222
. fn ( t => {
1223
+ t . skipIfDeviceDoesNotSupportQueryType ( 'timestamp' ) ;
1238
1224
const { beginningOfPassWriteIndex, endOfPassWriteIndex } = t . params ;
1239
1225
1240
1226
const querySetCount = 2 ;
@@ -1262,13 +1248,9 @@ g.test('timestampWrite,query_index')
1262
1248
g . test ( 'occlusionQuerySet,query_set_type' )
1263
1249
. desc ( `Test that occlusionQuerySet must have type 'occlusion'.` )
1264
1250
. params ( u => u . combine ( 'queryType' , kQueryTypes ) )
1265
- . beforeAllSubcases ( t => {
1266
- if ( t . params . queryType === 'timestamp' ) {
1267
- t . selectDeviceOrSkipTestCase ( [ 'timestamp-query' ] ) ;
1268
- }
1269
- } )
1270
1251
. fn ( t => {
1271
1252
const { queryType } = t . params ;
1253
+ t . skipIfDeviceDoesNotSupportQueryType ( queryType ) ;
1272
1254
1273
1255
const querySet = t . createQuerySetTracked ( {
1274
1256
type : queryType ,
0 commit comments