@@ -13,15 +13,18 @@ import {
13
13
computeBytesPerSampleFromFormats ,
14
14
kDepthStencilFormats ,
15
15
kRenderableColorTextureFormats ,
16
- kTextureFormatInfo ,
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 ;
@@ -214,7 +217,6 @@ g.test('color_attachments,limits,maxColorAttachmentBytesPerSample,aligned')
214
217
} )
215
218
. fn ( t => {
216
219
const { format, attachmentCount } = t . params ;
217
- const info = kTextureFormatInfo [ format ] ;
218
220
219
221
t . skipIf (
220
222
attachmentCount > t . device . limits . maxColorAttachments ,
@@ -227,7 +229,7 @@ g.test('color_attachments,limits,maxColorAttachmentBytesPerSample,aligned')
227
229
colorAttachments . push ( t . getColorAttachment ( colorTexture ) ) ;
228
230
}
229
231
const shouldError =
230
- info . colorRender === undefined ||
232
+ isTextureFormatColorRenderable ( t . device , format ) === undefined ||
231
233
computeBytesPerSampleFromFormats ( range ( attachmentCount , ( ) => format ) ) >
232
234
t . device . limits . maxColorAttachmentBytesPerSample ;
233
235
@@ -1049,10 +1051,6 @@ g.test('depth_stencil_attachment,loadOp_storeOp_match_depthReadOnly_stencilReadO
1049
1051
. combine ( 'stencilLoadOp' , [ undefined , 'clear' , 'load' ] as GPULoadOp [ ] )
1050
1052
. combine ( 'stencilStoreOp' , [ undefined , 'discard' , 'store' ] as GPUStoreOp [ ] )
1051
1053
)
1052
- . beforeAllSubcases ( t => {
1053
- const info = kTextureFormatInfo [ t . params . format as GPUTextureFormat ] ;
1054
- t . selectDeviceOrSkipTestCase ( info . feature ) ;
1055
- } )
1056
1054
. fn ( t => {
1057
1055
const {
1058
1056
format,
@@ -1064,6 +1062,8 @@ g.test('depth_stencil_attachment,loadOp_storeOp_match_depthReadOnly_stencilReadO
1064
1062
stencilStoreOp,
1065
1063
} = t . params ;
1066
1064
1065
+ t . skipIfTextureFormatNotSupported ( format ) ;
1066
+
1067
1067
const depthAttachment = t . createTextureTracked ( {
1068
1068
format,
1069
1069
size : { width : 1 , height : 1 , depthOrArrayLayers : 1 } ,
@@ -1092,11 +1092,10 @@ g.test('depth_stencil_attachment,loadOp_storeOp_match_depthReadOnly_stencilReadO
1092
1092
const pass = encoder . beginRenderPass ( renderPassDescriptor ) ;
1093
1093
pass . end ( ) ;
1094
1094
1095
- const info = kTextureFormatInfo [ format ] ;
1096
1095
const hasDepthSettings = ! ! depthLoadOp && ! ! depthStoreOp && ! depthReadOnly ;
1097
1096
const hasStencilSettings = ! ! stencilLoadOp && ! ! stencilStoreOp && ! stencilReadOnly ;
1098
- const hasDepth = info . depth ;
1099
- const hasStencil = info . stencil ;
1097
+ const hasDepth = isDepthTextureFormat ( format ) ;
1098
+ const hasStencil = isStencilTextureFormat ( format ) ;
1100
1099
1101
1100
const goodAspectSettingsPresent =
1102
1101
( hasDepthSettings ? hasDepth : true ) && ( hasStencilSettings ? hasStencil : true ) ;
@@ -1162,27 +1161,19 @@ g.test('resolveTarget,format_supports_resolve')
1162
1161
if and only if they support 'resolve'.
1163
1162
`
1164
1163
)
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
- } )
1164
+ . params ( u => u . combine ( 'format' , kRenderableColorTextureFormats ) )
1175
1165
. fn ( t => {
1176
1166
const { format } = t . params ;
1177
- const info = kTextureFormatInfo [ format ] ;
1167
+ t . skipIfTextureFormatNotSupported ( format ) ;
1168
+ t . skipIfMultisampleNotSupportedForFormat ( format ) ;
1178
1169
1179
1170
const multisampledColorTexture = t . createTestTexture ( { format, sampleCount : 4 } ) ;
1180
1171
const resolveTarget = t . createTestTexture ( { format } ) ;
1181
1172
1182
1173
const colorAttachment = t . getColorAttachment ( multisampledColorTexture ) ;
1183
1174
colorAttachment . resolveTarget = resolveTarget . createView ( ) ;
1184
1175
1185
- t . tryRenderPass ( ! ! info . colorRender ?. resolve , {
1176
+ t . tryRenderPass ( isTextureFormatResolvable ( t . device , format ) , {
1186
1177
colorAttachments : [ colorAttachment ] ,
1187
1178
} ) ;
1188
1179
} ) ;
@@ -1198,10 +1189,8 @@ g.test('timestampWrites,query_set_type')
1198
1189
u //
1199
1190
. combine ( 'queryType' , kQueryTypes )
1200
1191
)
1201
- . beforeAllSubcases ( t => {
1202
- t . selectDeviceOrSkipTestCase ( [ 'timestamp-query' ] ) ;
1203
- } )
1204
1192
. fn ( t => {
1193
+ t . skipIfDeviceDoesNotSupportQueryType ( 'timestamp' ) ;
1205
1194
const { queryType } = t . params ;
1206
1195
1207
1196
const timestampWrites = {
@@ -1231,10 +1220,8 @@ g.test('timestampWrite,query_index')
1231
1220
. combine ( 'beginningOfPassWriteIndex' , [ undefined , 0 , 1 , 2 , 3 ] as const )
1232
1221
. combine ( 'endOfPassWriteIndex' , [ undefined , 0 , 1 , 2 , 3 ] as const )
1233
1222
)
1234
- . beforeAllSubcases ( t => {
1235
- t . selectDeviceOrSkipTestCase ( [ 'timestamp-query' ] ) ;
1236
- } )
1237
1223
. fn ( t => {
1224
+ t . skipIfDeviceDoesNotSupportQueryType ( 'timestamp' ) ;
1238
1225
const { beginningOfPassWriteIndex, endOfPassWriteIndex } = t . params ;
1239
1226
1240
1227
const querySetCount = 2 ;
@@ -1262,13 +1249,9 @@ g.test('timestampWrite,query_index')
1262
1249
g . test ( 'occlusionQuerySet,query_set_type' )
1263
1250
. desc ( `Test that occlusionQuerySet must have type 'occlusion'.` )
1264
1251
. params ( u => u . combine ( 'queryType' , kQueryTypes ) )
1265
- . beforeAllSubcases ( t => {
1266
- if ( t . params . queryType === 'timestamp' ) {
1267
- t . selectDeviceOrSkipTestCase ( [ 'timestamp-query' ] ) ;
1268
- }
1269
- } )
1270
1252
. fn ( t => {
1271
1253
const { queryType } = t . params ;
1254
+ t . skipIfDeviceDoesNotSupportQueryType ( queryType ) ;
1272
1255
1273
1256
const querySet = t . createQuerySetTracked ( {
1274
1257
type : queryType ,
0 commit comments