@@ -88,7 +88,7 @@ class F extends ValidationTest {
8888
8989export const g = makeTestGroup ( F ) ;
9090
91- g . test ( 'one_color_attachment' )
91+ g . test ( 'attachments, one_color_attachment' )
9292 . desc ( `Test that a render pass works with only one color attachment.` )
9393 . fn ( t => {
9494 const colorTexture = t . createTexture ( { format : 'rgba8unorm' } ) ;
@@ -99,7 +99,7 @@ g.test('one_color_attachment')
9999 t . tryRenderPass ( true , descriptor ) ;
100100 } ) ;
101101
102- g . test ( 'one_depth_stencil_attachment' )
102+ g . test ( 'attachments, one_depth_stencil_attachment' )
103103 . desc ( `Test that a render pass works with only one depthStencil attachment.` )
104104 . fn ( t => {
105105 const depthStencilTexture = t . createTexture ( { format : 'depth24plus-stencil8' } ) ;
@@ -111,7 +111,7 @@ g.test('one_depth_stencil_attachment')
111111 t . tryRenderPass ( true , descriptor ) ;
112112 } ) ;
113113
114- g . test ( 'color_attachments_empty ' )
114+ g . test ( 'color_attachments,empty ' )
115115 . desc (
116116 `
117117 Test that when colorAttachments has all values be 'undefined' or the sequence is empty, the
@@ -150,7 +150,7 @@ g.test('color_attachments_empty')
150150 } ) ;
151151 } ) ;
152152
153- g . test ( 'out_of_bounds_color_attachments ' )
153+ g . test ( 'color_attachments,out_of_bounds ' )
154154 . desc (
155155 `
156156 Test that the out of bound of color attachment indexes are handled.
@@ -173,7 +173,7 @@ g.test('out_of_bounds_color_attachments')
173173 t . tryRenderPass ( _success , { colorAttachments } ) ;
174174 } ) ;
175175
176- g . test ( 'attachments_same_size ' )
176+ g . test ( 'attachments,same_size ' )
177177 . desc (
178178 `
179179 Test that attachments have the same size. Otherwise, a validation error should be generated.
@@ -234,34 +234,44 @@ g.test('attachments_same_size')
234234 }
235235 } ) ;
236236
237- g . test ( 'attachments_must_match_whether_they_are_used_for_color_or_depth_stencil' ) . fn ( async t => {
238- const colorTexture = t . createTexture ( { format : 'rgba8unorm' } ) ;
239- const depthStencilTexture = t . createTexture ( { format : 'depth24plus-stencil8' } ) ;
237+ g . test ( 'attachments,color_depth_mismatch' )
238+ . desc ( `Test that attachments match whether they are used for color or depth stencil.` )
239+ . fn ( async t => {
240+ const colorTexture = t . createTexture ( { format : 'rgba8unorm' } ) ;
241+ const depthStencilTexture = t . createTexture ( { format : 'depth24plus-stencil8' } ) ;
240242
241- {
242- // Using depth-stencil for color
243- const descriptor : GPURenderPassDescriptor = {
244- colorAttachments : [ t . getColorAttachment ( depthStencilTexture ) ] ,
245- } ;
243+ {
244+ // Using depth-stencil for color
245+ const descriptor : GPURenderPassDescriptor = {
246+ colorAttachments : [ t . getColorAttachment ( depthStencilTexture ) ] ,
247+ } ;
246248
247- t . tryRenderPass ( false , descriptor ) ;
248- }
249- {
250- // Using color for depth-stencil
251- const descriptor : GPURenderPassDescriptor = {
252- colorAttachments : [ ] ,
253- depthStencilAttachment : t . getDepthStencilAttachment ( colorTexture ) ,
254- } ;
249+ t . tryRenderPass ( false , descriptor ) ;
250+ }
251+ {
252+ // Using color for depth-stencil
253+ const descriptor : GPURenderPassDescriptor = {
254+ colorAttachments : [ ] ,
255+ depthStencilAttachment : t . getDepthStencilAttachment ( colorTexture ) ,
256+ } ;
255257
256- t . tryRenderPass ( false , descriptor ) ;
257- }
258- } ) ;
258+ t . tryRenderPass ( false , descriptor ) ;
259+ }
260+ } ) ;
259261
260- g . test ( 'check_layer_count_for_color_or_depth_stencil' )
262+ g . test ( 'attachments,layer_count' )
263+ . desc (
264+ `
265+ Test the layer counts for color or depth stencil.
266+ - Fail if using 2D array texture view with arrayLayerCount > 1.
267+ - Succeed if using 2D array texture view that covers the first layer of the texture.
268+ - Succeed if using 2D array texture view that covers the last layer for depth stencil.
269+ `
270+ )
261271 . paramsSimple ( [
262- { arrayLayerCount : 5 , baseArrayLayer : 0 , _success : false } , // using 2D array texture view with arrayLayerCount > 1 is not allowed
263- { arrayLayerCount : 1 , baseArrayLayer : 0 , _success : true } , // using 2D array texture view that covers the first layer of the texture is OK
264- { arrayLayerCount : 1 , baseArrayLayer : 9 , _success : true } , // using 2D array texture view that covers the last layer is OK for depth stencil
272+ { arrayLayerCount : 5 , baseArrayLayer : 0 , _success : false } ,
273+ { arrayLayerCount : 1 , baseArrayLayer : 0 , _success : true } ,
274+ { arrayLayerCount : 1 , baseArrayLayer : 9 , _success : true } ,
265275 ] )
266276 . fn ( async t => {
267277 const { arrayLayerCount, baseArrayLayer, _success } = t . params ;
@@ -326,11 +336,19 @@ g.test('check_layer_count_for_color_or_depth_stencil')
326336 }
327337 } ) ;
328338
329- g . test ( 'check_mip_level_count_for_color_or_depth_stencil' )
339+ g . test ( 'attachments,mip_level_count' )
340+ . desc (
341+ `
342+ Test the mip level count for color or depth stencil.
343+ - Fail if using 2D texture view with mipLevelCount > 1.
344+ - Succeed if using 2D texture view that covers the first level of the texture.
345+ - Succeed if using 2D texture view that covers the last level of the texture.
346+ `
347+ )
330348 . paramsSimple ( [
331- { mipLevelCount : 2 , baseMipLevel : 0 , _success : false } , // using 2D texture view with mipLevelCount > 1 is not allowed
332- { mipLevelCount : 1 , baseMipLevel : 0 , _success : true } , // using 2D texture view that covers the first level of the texture is OK
333- { mipLevelCount : 1 , baseMipLevel : 3 , _success : true } , // using 2D texture view that covers the last level of the texture is OK
349+ { mipLevelCount : 2 , baseMipLevel : 0 , _success : false } ,
350+ { mipLevelCount : 1 , baseMipLevel : 0 , _success : true } ,
351+ { mipLevelCount : 1 , baseMipLevel : 3 , _success : true } ,
334352 ] )
335353 . fn ( async t => {
336354 const { mipLevelCount, baseMipLevel, _success } = t . params ;
@@ -395,8 +413,13 @@ g.test('check_mip_level_count_for_color_or_depth_stencil')
395413 }
396414 } ) ;
397415
398- g . test ( 'it_is_invalid_to_set_resolve_target_if_color_attachment_is_non_multisampled' ) . fn (
399- async t => {
416+ g . test ( 'color_attachments,non_multisampled' )
417+ . desc (
418+ `
419+ Test that setting a resolve target is invalid if the color attachments is non multisampled.
420+ `
421+ )
422+ . fn ( async t => {
400423 const colorTexture = t . createTexture ( { sampleCount : 1 } ) ;
401424 const resolveTargetTexture = t . createTexture ( { sampleCount : 1 } ) ;
402425
@@ -413,49 +436,68 @@ g.test('it_is_invalid_to_set_resolve_target_if_color_attachment_is_non_multisamp
413436 } ;
414437
415438 t . tryRenderPass ( false , descriptor ) ;
416- }
417- ) ;
439+ } ) ;
418440
419- g . test ( 'check_the_use_of_multisampled_textures_as_color_attachments' ) . fn ( async t => {
420- const colorTexture = t . createTexture ( { sampleCount : 1 } ) ;
421- const multisampledColorTexture = t . createTexture ( { sampleCount : 4 } ) ;
441+ g . test ( 'color_attachments,sample_count' )
442+ . desc (
443+ `
444+ Test the usages of multisampled textures for color attachments.
445+ - Succeed if using a multisampled color attachment without setting a resolve target.
446+ - Fail if using multiple color attachments with different sample counts.
447+ `
448+ )
449+ . fn ( async t => {
450+ const colorTexture = t . createTexture ( { sampleCount : 1 } ) ;
451+ const multisampledColorTexture = t . createTexture ( { sampleCount : 4 } ) ;
422452
423- {
424- // It is allowed to use a multisampled color attachment without setting resolve target
425- const descriptor : GPURenderPassDescriptor = {
426- colorAttachments : [ t . getColorAttachment ( multisampledColorTexture ) ] ,
427- } ;
428- t . tryRenderPass ( true , descriptor ) ;
429- }
430- {
431- // It is not allowed to use multiple color attachments with different sample counts
432- const descriptor : GPURenderPassDescriptor = {
433- colorAttachments : [
434- t . getColorAttachment ( colorTexture ) ,
435- t . getColorAttachment ( multisampledColorTexture ) ,
436- ] ,
437- } ;
453+ {
454+ // It is allowed to use a multisampled color attachment without setting resolve target
455+ const descriptor : GPURenderPassDescriptor = {
456+ colorAttachments : [ t . getColorAttachment ( multisampledColorTexture ) ] ,
457+ } ;
458+ t . tryRenderPass ( true , descriptor ) ;
459+ }
460+ {
461+ // It is not allowed to use multiple color attachments with different sample counts
462+ const descriptor : GPURenderPassDescriptor = {
463+ colorAttachments : [
464+ t . getColorAttachment ( colorTexture ) ,
465+ t . getColorAttachment ( multisampledColorTexture ) ,
466+ ] ,
467+ } ;
438468
439- t . tryRenderPass ( false , descriptor ) ;
440- }
441- } ) ;
469+ t . tryRenderPass ( false , descriptor ) ;
470+ }
471+ } ) ;
442472
443- g . test ( 'it_is_invalid_to_use_a_multisampled_resolve_target' ) . fn ( async t => {
444- const multisampledColorTexture = t . createTexture ( { sampleCount : 4 } ) ;
445- const multisampledResolveTargetTexture = t . createTexture ( { sampleCount : 4 } ) ;
473+ g . test ( 'resolveTarget,sample_count' )
474+ . desc (
475+ `
476+ Test that using multisampled resolve target is invalid for color attachments.
477+ `
478+ )
479+ . fn ( async t => {
480+ const multisampledColorTexture = t . createTexture ( { sampleCount : 4 } ) ;
481+ const multisampledResolveTargetTexture = t . createTexture ( { sampleCount : 4 } ) ;
446482
447- const colorAttachment = t . getColorAttachment ( multisampledColorTexture ) ;
448- colorAttachment . resolveTarget = multisampledResolveTargetTexture . createView ( ) ;
483+ const colorAttachment = t . getColorAttachment ( multisampledColorTexture ) ;
484+ colorAttachment . resolveTarget = multisampledResolveTargetTexture . createView ( ) ;
449485
450- const descriptor : GPURenderPassDescriptor = {
451- colorAttachments : [ colorAttachment ] ,
452- } ;
486+ const descriptor : GPURenderPassDescriptor = {
487+ colorAttachments : [ colorAttachment ] ,
488+ } ;
453489
454- t . tryRenderPass ( false , descriptor ) ;
455- } ) ;
490+ t . tryRenderPass ( false , descriptor ) ;
491+ } ) ;
456492
457- g . test ( 'it_is_invalid_to_use_a_resolve_target_with_array_layer_count_greater_than_1' ) . fn (
458- async t => {
493+ g . test ( 'resolveTarget,array_layer_count' )
494+ . desc (
495+ `
496+ Test that using a resolve target with array layer count is greater than 1 is invalid for color
497+ attachments.
498+ `
499+ )
500+ . fn ( async t => {
459501 const multisampledColorTexture = t . createTexture ( { sampleCount : 4 } ) ;
460502 const resolveTargetTexture = t . createTexture ( { arrayLayerCount : 2 } ) ;
461503
@@ -467,11 +509,16 @@ g.test('it_is_invalid_to_use_a_resolve_target_with_array_layer_count_greater_tha
467509 } ;
468510
469511 t . tryRenderPass ( false , descriptor ) ;
470- }
471- ) ;
512+ } ) ;
472513
473- g . test ( 'it_is_invalid_to_use_a_resolve_target_with_mipmap_level_count_greater_than_1' ) . fn (
474- async t => {
514+ g . test ( 'resolveTarget,mipmap_level_count' )
515+ . desc (
516+ `
517+ Test that using a resolve target with that mipmap level count is greater than 1 is invalid for
518+ color attachments.
519+ `
520+ )
521+ . fn ( async t => {
475522 const multisampledColorTexture = t . createTexture ( { sampleCount : 4 } ) ;
476523 const resolveTargetTexture = t . createTexture ( { mipLevelCount : 2 } ) ;
477524
@@ -483,24 +530,32 @@ g.test('it_is_invalid_to_use_a_resolve_target_with_mipmap_level_count_greater_th
483530 } ;
484531
485532 t . tryRenderPass ( false , descriptor ) ;
486- }
487- ) ;
488-
489- g . test ( 'it_is_invalid_to_use_a_resolve_target_whose_usage_is_not_RENDER_ATTACHMENT' ) . fn ( async t => {
490- const multisampledColorTexture = t . createTexture ( { sampleCount : 4 } ) ;
491- const resolveTargetTexture = t . createTexture ( {
492- usage : GPUTextureUsage . COPY_SRC | GPUTextureUsage . COPY_DST ,
493533 } ) ;
494534
495- const colorAttachment = t . getColorAttachment ( multisampledColorTexture ) ;
496- colorAttachment . resolveTarget = resolveTargetTexture . createView ( ) ;
535+ g . test ( 'resolveTarget,usage' )
536+ . desc (
537+ `
538+ Test that using a resolve target whose usage is not RENDER_ATTACHMENT is invalid for color
539+ attachments.
497540
498- const descriptor : GPURenderPassDescriptor = {
499- colorAttachments : [ colorAttachment ] ,
500- } ;
541+ TODO: Add a control case (include vs exclude RENDER_ATTACHMENT usage)
542+ `
543+ )
544+ . fn ( async t => {
545+ const multisampledColorTexture = t . createTexture ( { sampleCount : 4 } ) ;
546+ const resolveTargetTexture = t . createTexture ( {
547+ usage : GPUTextureUsage . COPY_SRC | GPUTextureUsage . COPY_DST ,
548+ } ) ;
501549
502- t . tryRenderPass ( false , descriptor ) ;
503- } ) ;
550+ const colorAttachment = t . getColorAttachment ( multisampledColorTexture ) ;
551+ colorAttachment . resolveTarget = resolveTargetTexture . createView ( ) ;
552+
553+ const descriptor : GPURenderPassDescriptor = {
554+ colorAttachments : [ colorAttachment ] ,
555+ } ;
556+
557+ t . tryRenderPass ( false , descriptor ) ;
558+ } ) ;
504559
505560g . test ( 'it_is_invalid_to_use_a_resolve_target_in_error_state' ) . fn ( async t => {
506561 const ARRAY_LAYER_COUNT = 1 ;
0 commit comments