@@ -60,9 +60,13 @@ class F extends AllFeaturesMaxLimitsGPUTest {
6060
6161 getColorAttachment (
6262 texture : GPUTexture ,
63- textureViewDescriptor ?: GPUTextureViewDescriptor
63+ options : {
64+ textureViewDescriptor ?: GPUTextureViewDescriptor ;
65+ bindTextureResource ?: boolean ;
66+ } = { }
6467 ) : GPURenderPassColorAttachment {
65- const view = texture . createView ( textureViewDescriptor ) ;
68+ const { textureViewDescriptor, bindTextureResource = false } = options ;
69+ const view = bindTextureResource ? texture : texture . createView ( textureViewDescriptor ) ;
6670
6771 return {
6872 view,
@@ -74,9 +78,13 @@ class F extends AllFeaturesMaxLimitsGPUTest {
7478
7579 getDepthStencilAttachment (
7680 texture : GPUTexture ,
77- textureViewDescriptor ?: GPUTextureViewDescriptor
81+ options : {
82+ textureViewDescriptor ?: GPUTextureViewDescriptor ;
83+ bindTextureResource ?: boolean ;
84+ } = { }
7885 ) : GPURenderPassDepthStencilAttachment {
79- const view = texture . createView ( textureViewDescriptor ) ;
86+ const { textureViewDescriptor, bindTextureResource = false } = options ;
87+ const view = bindTextureResource ? texture : texture . createView ( textureViewDescriptor ) ;
8088
8189 return {
8290 view,
@@ -105,6 +113,7 @@ const kArrayLayerCount = 10;
105113
106114g . test ( 'attachments,one_color_attachment' )
107115 . desc ( `Test that a render pass works with only one color attachment.` )
116+ . paramsSubcasesOnly ( u => u . combine ( 'bindTextureResource' , [ false , true ] as const ) )
108117 . fn ( t => {
109118 const colorTexture = t . createTestTexture ( { format : 'rgba8unorm' } ) ;
110119 const descriptor = {
@@ -116,6 +125,7 @@ g.test('attachments,one_color_attachment')
116125
117126g . test ( 'attachments,one_depth_stencil_attachment' )
118127 . desc ( `Test that a render pass works with only one depthStencil attachment.` )
128+ . paramsSubcasesOnly ( u => u . combine ( 'bindTextureResource' , [ false , true ] as const ) )
119129 . fn ( t => {
120130 const depthStencilTexture = t . createTestTexture ( { format : 'depth24plus-stencil8' } ) ;
121131 const descriptor = {
@@ -350,14 +360,14 @@ g.test('color_attachments,depthSlice,bound_check')
350360 mipLevelCount : mipLevel + 1 ,
351361 } ) ;
352362
353- const viewDescriptor : GPUTextureViewDescriptor = {
363+ const textureViewDescriptor : GPUTextureViewDescriptor = {
354364 baseMipLevel : mipLevel ,
355365 mipLevelCount : 1 ,
356366 baseArrayLayer : 0 ,
357367 arrayLayerCount : 1 ,
358368 } ;
359369
360- const colorAttachment = t . getColorAttachment ( texture , viewDescriptor ) ;
370+ const colorAttachment = t . getColorAttachment ( texture , { textureViewDescriptor } ) ;
361371 colorAttachment . depthSlice = depthSlice ;
362372
363373 const passDescriptor : GPURenderPassDescriptor = {
@@ -442,7 +452,7 @@ g.test('color_attachments,depthSlice,overlaps,diff_miplevel')
442452 } ;
443453 const texture = t . createTestTexture ( texDescriptor ) ;
444454
445- const viewDescriptor : GPUTextureViewDescriptor = {
455+ const textureViewDescriptor : GPUTextureViewDescriptor = {
446456 baseMipLevel : 0 ,
447457 mipLevelCount : 1 ,
448458 baseArrayLayer : 0 ,
@@ -452,9 +462,9 @@ g.test('color_attachments,depthSlice,overlaps,diff_miplevel')
452462 const colorAttachments = [ ] ;
453463 for ( let i = 0 ; i < mipLevelCount ; i ++ ) {
454464 if ( ! sameMipLevel ) {
455- viewDescriptor . baseMipLevel = i ;
465+ textureViewDescriptor . baseMipLevel = i ;
456466 }
457- const colorAttachment = t . getColorAttachment ( texture , viewDescriptor ) ;
467+ const colorAttachment = t . getColorAttachment ( texture , { textureViewDescriptor } ) ;
458468 colorAttachment . depthSlice = 0 ;
459469 colorAttachments . push ( colorAttachment ) ;
460470 }
@@ -605,7 +615,7 @@ g.test('attachments,layer_count')
605615 } ;
606616
607617 const descriptor : GPURenderPassDescriptor = {
608- colorAttachments : [ t . getColorAttachment ( colorTexture , textureViewDescriptor ) ] ,
618+ colorAttachments : [ t . getColorAttachment ( colorTexture , { textureViewDescriptor } ) ] ,
609619 } ;
610620
611621 t . tryRenderPass ( _success , descriptor ) ;
@@ -619,10 +629,9 @@ g.test('attachments,layer_count')
619629
620630 const descriptor : GPURenderPassDescriptor = {
621631 colorAttachments : [ ] ,
622- depthStencilAttachment : t . getDepthStencilAttachment (
623- depthStencilTexture ,
624- textureViewDescriptor
625- ) ,
632+ depthStencilAttachment : t . getDepthStencilAttachment ( depthStencilTexture , {
633+ textureViewDescriptor,
634+ } ) ,
626635 } ;
627636
628637 t . tryRenderPass ( _success , descriptor ) ;
@@ -682,7 +691,7 @@ g.test('attachments,mip_level_count')
682691 } ;
683692
684693 const descriptor : GPURenderPassDescriptor = {
685- colorAttachments : [ t . getColorAttachment ( colorTexture , textureViewDescriptor ) ] ,
694+ colorAttachments : [ t . getColorAttachment ( colorTexture , { textureViewDescriptor } ) ] ,
686695 } ;
687696
688697 t . tryRenderPass ( _success , descriptor ) ;
@@ -696,10 +705,9 @@ g.test('attachments,mip_level_count')
696705
697706 const descriptor : GPURenderPassDescriptor = {
698707 colorAttachments : [ ] ,
699- depthStencilAttachment : t . getDepthStencilAttachment (
700- depthStencilTexture ,
701- textureViewDescriptor
702- ) ,
708+ depthStencilAttachment : t . getDepthStencilAttachment ( depthStencilTexture , {
709+ textureViewDescriptor,
710+ } ) ,
703711 } ;
704712
705713 t . tryRenderPass ( _success , descriptor ) ;
0 commit comments