Skip to content

Commit 1e545f5

Browse files
authored
Remove many test cases that never run because maxColorAttachments=8 (#4087)
* part 1: use indices instead of full data for subcase params * part 2: remove cases that are always no-ops at maxColorAttachments>8
1 parent 1afb7eb commit 1e545f5

File tree

4 files changed

+62
-39
lines changed

4 files changed

+62
-39
lines changed

src/webgpu/api/validation/encoding/createRenderBundleEncoder.spec.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
export const description = `
22
createRenderBundleEncoder validation tests.
3+
4+
TODO(#3363): Make this into a MaxLimitTest and increase kMaxColorAttachments.
35
`;
46

57
import { makeTestGroup } from '../../../../common/framework/test_group.js';
68
import { range } from '../../../../common/util/util.js';
7-
import { kMaxColorAttachmentsToTest } from '../../../capability_info.js';
9+
import { getDefaultLimits } from '../../../capability_info.js';
810
import {
911
computeBytesPerSampleFromFormats,
1012
kAllTextureFormats,
@@ -14,14 +16,18 @@ import {
1416
} from '../../../format_info.js';
1517
import { ValidationTest } from '../validation_test.js';
1618

19+
// MAINTENANCE_TODO: This should be changed to kMaxColorAttachmentsToTest
20+
// when this is made a MaxLimitTest (see above).
21+
const kMaxColorAttachments = getDefaultLimits('core').maxColorAttachments.default;
22+
1723
export const g = makeTestGroup(ValidationTest);
1824

1925
g.test('attachment_state,limits,maxColorAttachments')
2026
.desc(`Tests that attachment state must have <= device.limits.maxColorAttachments.`)
2127
.params(u =>
2228
u.beginSubcases().combine(
2329
'colorFormatCount',
24-
range(kMaxColorAttachmentsToTest, i => i + 1)
30+
range(kMaxColorAttachments, i => i + 1)
2531
)
2632
)
2733
.fn(t => {
@@ -52,7 +58,7 @@ g.test('attachment_state,limits,maxColorAttachmentBytesPerSample,aligned')
5258
.beginSubcases()
5359
.combine(
5460
'colorFormatCount',
55-
range(kMaxColorAttachmentsToTest, i => i + 1)
61+
range(kMaxColorAttachments, i => i + 1)
5662
)
5763
)
5864
.beforeAllSubcases(t => {

src/webgpu/api/validation/render_pass/attachment_compatibility.spec.ts

Lines changed: 38 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
export const description = `
22
Validation for attachment compatibility between render passes, bundles, and pipelines
3+
4+
TODO(#3363): Make this into a MaxLimitTest and increase kMaxColorAttachments.
35
`;
46

57
import { makeTestGroup } from '../../../../common/framework/test_group.js';
68
import { range } from '../../../../common/util/util.js';
7-
import { kMaxColorAttachmentsToTest, kTextureSampleCounts } from '../../../capability_info.js';
9+
import { getDefaultLimits, kTextureSampleCounts } from '../../../capability_info.js';
810
import {
911
kRegularTextureFormats,
1012
kSizedDepthStencilFormats,
@@ -15,7 +17,11 @@ import {
1517
} from '../../../format_info.js';
1618
import { 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);
1925
const 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

src/webgpu/api/validation/render_pass/render_pass_descriptor.spec.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
export const description = `
22
render pass descriptor validation tests.
33
4+
TODO(#3363): Make this into a MaxLimitTest and increase kMaxColorAttachments.
45
TODO: review for completeness
56
`;
67

78
import { makeTestGroup } from '../../../../common/framework/test_group.js';
89
import { range } from '../../../../common/util/util.js';
9-
import { kMaxColorAttachmentsToTest, kQueryTypes } from '../../../capability_info.js';
10+
import { getDefaultLimits, kQueryTypes } from '../../../capability_info.js';
1011
import { GPUConst } from '../../../constants.js';
1112
import {
1213
computeBytesPerSampleFromFormats,
@@ -16,6 +17,10 @@ import {
1617
} from '../../../format_info.js';
1718
import { ValidationTest } from '../validation_test.js';
1819

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+
1924
class F extends ValidationTest {
2025
createTestTexture(
2126
options: {
@@ -201,7 +206,7 @@ g.test('color_attachments,limits,maxColorAttachmentBytesPerSample,aligned')
201206
.beginSubcases()
202207
.combine(
203208
'attachmentCount',
204-
range(kMaxColorAttachmentsToTest, i => i + 1)
209+
range(kMaxColorAttachments, i => i + 1)
205210
)
206211
)
207212
.beforeAllSubcases(t => {

src/webgpu/api/validation/render_pipeline/fragment_state.spec.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
export const description = `
22
This test dedicatedly tests validation of GPUFragmentState of createRenderPipeline.
3+
4+
TODO(#3363): Make this into a MaxLimitTest and increase kMaxColorAttachments.
35
`;
46

57
import { makeTestGroup } from '../../../../common/framework/test_group.js';
68
import { assert, range } from '../../../../common/util/util.js';
79
import {
10+
getDefaultLimits,
811
IsDualSourceBlendingFactor,
912
kBlendFactors,
1013
kBlendOperations,
11-
kMaxColorAttachmentsToTest,
1214
} from '../../../capability_info.js';
1315
import { GPUConst } from '../../../constants.js';
1416
import {
@@ -28,6 +30,10 @@ import { kTexelRepresentationInfo } from '../../../util/texture/texel_data.js';
2830

2931
import { ColorTargetState, CreateRenderPipelineValidationTest } from './common.js';
3032

33+
// MAINTENANCE_TODO: This should be changed to kMaxColorAttachmentsToTest
34+
// when this is made a MaxLimitTest (see above).
35+
const kMaxColorAttachments = getDefaultLimits('core').maxColorAttachments.default;
36+
3137
export const g = makeTestGroup(CreateRenderPipelineValidationTest);
3238

3339
const values = [0, 1, 0, 1];
@@ -169,7 +175,7 @@ g.test('limits,maxColorAttachmentBytesPerSample,aligned')
169175
.beginSubcases()
170176
.combine(
171177
'attachmentCount',
172-
range(kMaxColorAttachmentsToTest, i => i + 1)
178+
range(kMaxColorAttachments, i => i + 1)
173179
)
174180
.combine('isAsync', [false, true])
175181
)

0 commit comments

Comments
 (0)