11export const description = `
22Validation for attachment compatibility between render passes, bundles, and pipelines
3+
4+ TODO(#3363): Make this into a MaxLimitTest and increase kMaxColorAttachments.
35` ;
46
57import { makeTestGroup } from '../../../../common/framework/test_group.js' ;
68import { range } from '../../../../common/util/util.js' ;
7- import { kMaxColorAttachmentsToTest , kTextureSampleCounts } from '../../../capability_info.js' ;
9+ import { getDefaultLimits , kTextureSampleCounts } from '../../../capability_info.js' ;
810import {
911 kRegularTextureFormats ,
1012 kSizedDepthStencilFormats ,
@@ -15,7 +17,11 @@ import {
1517} from '../../../format_info.js' ;
1618import { ValidationTest } from '../validation_test.js' ;
1719
18- const kColorAttachmentCounts = range ( kMaxColorAttachmentsToTest , i => i + 1 ) ;
20+ // MAINTENANCE_TODO: This should be changed to kMaxColorAttachmentsToTest
21+ // when this is made a MaxLimitTest (see above).
22+ const kMaxColorAttachments = getDefaultLimits ( 'core' ) . maxColorAttachments . default ;
23+
24+ const kColorAttachmentCounts = range ( kMaxColorAttachments , i => i + 1 ) ;
1925const kColorAttachments = kColorAttachmentCounts
2026 . map ( count => {
2127 // generate cases with 0..1 null attachments at different location
@@ -240,26 +246,25 @@ g.test('render_pass_and_bundle,color_sparse')
240246 // introduce attachmentCount to make it easier to split the test
241247 . combine ( 'attachmentCount' , kColorAttachmentCounts )
242248 . beginSubcases ( )
243- . combine ( 'passAttachments' , kColorAttachments )
244- . combine ( 'bundleAttachments' , kColorAttachments )
245- . filter (
246- p =>
247- p . attachmentCount === p . passAttachments . length &&
248- p . attachmentCount === p . bundleAttachments . length
249+ // Indices into kColorAttachments
250+ . expand ( 'iPass' , p =>
251+ range ( kColorAttachments . length , i => i ) . filter (
252+ i => kColorAttachments [ i ] . length === p . attachmentCount
253+ )
254+ )
255+ . expand ( 'iBundle' , p =>
256+ range ( kColorAttachments . length , i => i ) . filter (
257+ i => kColorAttachments [ i ] . length === p . attachmentCount
258+ )
249259 )
250260 )
251261 . fn ( t => {
252- const { passAttachments, bundleAttachments } = t . params ;
262+ const passAttachments = kColorAttachments [ t . params . iPass ] ;
263+ const bundleAttachments = kColorAttachments [ t . params . iBundle ] ;
253264
254265 const { maxColorAttachments } = t . device . limits ;
255- t . skipIf (
256- passAttachments . length > maxColorAttachments ,
257- `num passAttachments: ${ passAttachments . length } > maxColorAttachments for device: ${ maxColorAttachments } `
258- ) ;
259- t . skipIf (
260- bundleAttachments . length > maxColorAttachments ,
261- `num bundleAttachments: ${ bundleAttachments . length } > maxColorAttachments for device: ${ maxColorAttachments } `
262- ) ;
266+ t . skipIf ( passAttachments . length > maxColorAttachments ) ;
267+ t . skipIf ( bundleAttachments . length > maxColorAttachments ) ;
263268
264269 const colorFormats = bundleAttachments . map ( i => ( i ? 'rgba8uint' : null ) ) ;
265270 const bundleEncoder = t . device . createRenderBundleEncoder ( {
@@ -445,25 +450,26 @@ Test that each of color attachments in render passes or bundles match that of th
445450 // introduce attachmentCount to make it easier to split the test
446451 . combine ( 'attachmentCount' , kColorAttachmentCounts )
447452 . beginSubcases ( )
448- . combine ( 'encoderAttachments' , kColorAttachments )
449- . combine ( 'pipelineAttachments' , kColorAttachments )
450- . filter (
451- p =>
452- p . attachmentCount === p . encoderAttachments . length &&
453- p . attachmentCount === p . pipelineAttachments . length
453+ // Indices into kColorAttachments
454+ . expand ( 'iEncoder' , p =>
455+ range ( kColorAttachments . length , i => i ) . filter (
456+ i => kColorAttachments [ i ] . length === p . attachmentCount
457+ )
458+ )
459+ . expand ( 'iPipeline' , p =>
460+ range ( kColorAttachments . length , i => i ) . filter (
461+ i => kColorAttachments [ i ] . length === p . attachmentCount
462+ )
454463 )
455464 )
456465 . fn ( t => {
457- const { encoderType, encoderAttachments, pipelineAttachments } = t . params ;
466+ const { encoderType } = t . params ;
467+ const encoderAttachments = kColorAttachments [ t . params . iEncoder ] ;
468+ const pipelineAttachments = kColorAttachments [ t . params . iPipeline ] ;
469+
458470 const { maxColorAttachments } = t . device . limits ;
459- t . skipIf (
460- encoderAttachments . length > maxColorAttachments ,
461- `num encoderAttachments: ${ encoderAttachments . length } > maxColorAttachments for device: ${ maxColorAttachments } `
462- ) ;
463- t . skipIf (
464- pipelineAttachments . length > maxColorAttachments ,
465- `num pipelineAttachments: ${ pipelineAttachments . length } > maxColorAttachments for device: ${ maxColorAttachments } `
466- ) ;
471+ t . skipIf ( encoderAttachments . length > maxColorAttachments ) ;
472+ t . skipIf ( pipelineAttachments . length > maxColorAttachments ) ;
467473
468474 const colorTargets = pipelineAttachments . map ( i =>
469475 i ? ( { format : 'rgba8uint' , writeMask : 0 } as GPUColorTargetState ) : null
0 commit comments