Skip to content

Commit

Permalink
Remove many test cases that never run because maxColorAttachments=8 (#…
Browse files Browse the repository at this point in the history
…4087)

* part 1: use indices instead of full data for subcase params

* part 2: remove cases that are always no-ops at maxColorAttachments>8
  • Loading branch information
kainino0x authored Dec 11, 2024
1 parent 1afb7eb commit 1e545f5
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 39 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
export const description = `
createRenderBundleEncoder validation tests.
TODO(#3363): Make this into a MaxLimitTest and increase kMaxColorAttachments.
`;

import { makeTestGroup } from '../../../../common/framework/test_group.js';
import { range } from '../../../../common/util/util.js';
import { kMaxColorAttachmentsToTest } from '../../../capability_info.js';
import { getDefaultLimits } from '../../../capability_info.js';
import {
computeBytesPerSampleFromFormats,
kAllTextureFormats,
Expand All @@ -14,14 +16,18 @@ import {
} from '../../../format_info.js';
import { ValidationTest } from '../validation_test.js';

// MAINTENANCE_TODO: This should be changed to kMaxColorAttachmentsToTest
// when this is made a MaxLimitTest (see above).
const kMaxColorAttachments = getDefaultLimits('core').maxColorAttachments.default;

export const g = makeTestGroup(ValidationTest);

g.test('attachment_state,limits,maxColorAttachments')
.desc(`Tests that attachment state must have <= device.limits.maxColorAttachments.`)
.params(u =>
u.beginSubcases().combine(
'colorFormatCount',
range(kMaxColorAttachmentsToTest, i => i + 1)
range(kMaxColorAttachments, i => i + 1)
)
)
.fn(t => {
Expand Down Expand Up @@ -52,7 +58,7 @@ g.test('attachment_state,limits,maxColorAttachmentBytesPerSample,aligned')
.beginSubcases()
.combine(
'colorFormatCount',
range(kMaxColorAttachmentsToTest, i => i + 1)
range(kMaxColorAttachments, i => i + 1)
)
)
.beforeAllSubcases(t => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
export const description = `
Validation for attachment compatibility between render passes, bundles, and pipelines
TODO(#3363): Make this into a MaxLimitTest and increase kMaxColorAttachments.
`;

import { makeTestGroup } from '../../../../common/framework/test_group.js';
import { range } from '../../../../common/util/util.js';
import { kMaxColorAttachmentsToTest, kTextureSampleCounts } from '../../../capability_info.js';
import { getDefaultLimits, kTextureSampleCounts } from '../../../capability_info.js';
import {
kRegularTextureFormats,
kSizedDepthStencilFormats,
Expand All @@ -15,7 +17,11 @@ import {
} from '../../../format_info.js';
import { ValidationTest } from '../validation_test.js';

const kColorAttachmentCounts = range(kMaxColorAttachmentsToTest, i => i + 1);
// MAINTENANCE_TODO: This should be changed to kMaxColorAttachmentsToTest
// when this is made a MaxLimitTest (see above).
const kMaxColorAttachments = getDefaultLimits('core').maxColorAttachments.default;

const kColorAttachmentCounts = range(kMaxColorAttachments, i => i + 1);
const kColorAttachments = kColorAttachmentCounts
.map(count => {
// generate cases with 0..1 null attachments at different location
Expand Down Expand Up @@ -240,26 +246,25 @@ g.test('render_pass_and_bundle,color_sparse')
// introduce attachmentCount to make it easier to split the test
.combine('attachmentCount', kColorAttachmentCounts)
.beginSubcases()
.combine('passAttachments', kColorAttachments)
.combine('bundleAttachments', kColorAttachments)
.filter(
p =>
p.attachmentCount === p.passAttachments.length &&
p.attachmentCount === p.bundleAttachments.length
// Indices into kColorAttachments
.expand('iPass', p =>
range(kColorAttachments.length, i => i).filter(
i => kColorAttachments[i].length === p.attachmentCount
)
)
.expand('iBundle', p =>
range(kColorAttachments.length, i => i).filter(
i => kColorAttachments[i].length === p.attachmentCount
)
)
)
.fn(t => {
const { passAttachments, bundleAttachments } = t.params;
const passAttachments = kColorAttachments[t.params.iPass];
const bundleAttachments = kColorAttachments[t.params.iBundle];

const { maxColorAttachments } = t.device.limits;
t.skipIf(
passAttachments.length > maxColorAttachments,
`num passAttachments: ${passAttachments.length} > maxColorAttachments for device: ${maxColorAttachments}`
);
t.skipIf(
bundleAttachments.length > maxColorAttachments,
`num bundleAttachments: ${bundleAttachments.length} > maxColorAttachments for device: ${maxColorAttachments}`
);
t.skipIf(passAttachments.length > maxColorAttachments);
t.skipIf(bundleAttachments.length > maxColorAttachments);

const colorFormats = bundleAttachments.map(i => (i ? 'rgba8uint' : null));
const bundleEncoder = t.device.createRenderBundleEncoder({
Expand Down Expand Up @@ -445,25 +450,26 @@ Test that each of color attachments in render passes or bundles match that of th
// introduce attachmentCount to make it easier to split the test
.combine('attachmentCount', kColorAttachmentCounts)
.beginSubcases()
.combine('encoderAttachments', kColorAttachments)
.combine('pipelineAttachments', kColorAttachments)
.filter(
p =>
p.attachmentCount === p.encoderAttachments.length &&
p.attachmentCount === p.pipelineAttachments.length
// Indices into kColorAttachments
.expand('iEncoder', p =>
range(kColorAttachments.length, i => i).filter(
i => kColorAttachments[i].length === p.attachmentCount
)
)
.expand('iPipeline', p =>
range(kColorAttachments.length, i => i).filter(
i => kColorAttachments[i].length === p.attachmentCount
)
)
)
.fn(t => {
const { encoderType, encoderAttachments, pipelineAttachments } = t.params;
const { encoderType } = t.params;
const encoderAttachments = kColorAttachments[t.params.iEncoder];
const pipelineAttachments = kColorAttachments[t.params.iPipeline];

const { maxColorAttachments } = t.device.limits;
t.skipIf(
encoderAttachments.length > maxColorAttachments,
`num encoderAttachments: ${encoderAttachments.length} > maxColorAttachments for device: ${maxColorAttachments}`
);
t.skipIf(
pipelineAttachments.length > maxColorAttachments,
`num pipelineAttachments: ${pipelineAttachments.length} > maxColorAttachments for device: ${maxColorAttachments}`
);
t.skipIf(encoderAttachments.length > maxColorAttachments);
t.skipIf(pipelineAttachments.length > maxColorAttachments);

const colorTargets = pipelineAttachments.map(i =>
i ? ({ format: 'rgba8uint', writeMask: 0 } as GPUColorTargetState) : null
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
export const description = `
render pass descriptor validation tests.
TODO(#3363): Make this into a MaxLimitTest and increase kMaxColorAttachments.
TODO: review for completeness
`;

import { makeTestGroup } from '../../../../common/framework/test_group.js';
import { range } from '../../../../common/util/util.js';
import { kMaxColorAttachmentsToTest, kQueryTypes } from '../../../capability_info.js';
import { getDefaultLimits, kQueryTypes } from '../../../capability_info.js';
import { GPUConst } from '../../../constants.js';
import {
computeBytesPerSampleFromFormats,
Expand All @@ -16,6 +17,10 @@ import {
} from '../../../format_info.js';
import { ValidationTest } from '../validation_test.js';

// MAINTENANCE_TODO: This should be changed to kMaxColorAttachmentsToTest
// when this is made a MaxLimitTest (see above).
const kMaxColorAttachments = getDefaultLimits('core').maxColorAttachments.default;

class F extends ValidationTest {
createTestTexture(
options: {
Expand Down Expand Up @@ -201,7 +206,7 @@ g.test('color_attachments,limits,maxColorAttachmentBytesPerSample,aligned')
.beginSubcases()
.combine(
'attachmentCount',
range(kMaxColorAttachmentsToTest, i => i + 1)
range(kMaxColorAttachments, i => i + 1)
)
)
.beforeAllSubcases(t => {
Expand Down
10 changes: 8 additions & 2 deletions src/webgpu/api/validation/render_pipeline/fragment_state.spec.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
export const description = `
This test dedicatedly tests validation of GPUFragmentState of createRenderPipeline.
TODO(#3363): Make this into a MaxLimitTest and increase kMaxColorAttachments.
`;

import { makeTestGroup } from '../../../../common/framework/test_group.js';
import { assert, range } from '../../../../common/util/util.js';
import {
getDefaultLimits,
IsDualSourceBlendingFactor,
kBlendFactors,
kBlendOperations,
kMaxColorAttachmentsToTest,
} from '../../../capability_info.js';
import { GPUConst } from '../../../constants.js';
import {
Expand All @@ -28,6 +30,10 @@ import { kTexelRepresentationInfo } from '../../../util/texture/texel_data.js';

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

// MAINTENANCE_TODO: This should be changed to kMaxColorAttachmentsToTest
// when this is made a MaxLimitTest (see above).
const kMaxColorAttachments = getDefaultLimits('core').maxColorAttachments.default;

export const g = makeTestGroup(CreateRenderPipelineValidationTest);

const values = [0, 1, 0, 1];
Expand Down Expand Up @@ -169,7 +175,7 @@ g.test('limits,maxColorAttachmentBytesPerSample,aligned')
.beginSubcases()
.combine(
'attachmentCount',
range(kMaxColorAttachmentsToTest, i => i + 1)
range(kMaxColorAttachments, i => i + 1)
)
.combine('isAsync', [false, true])
)
Expand Down

0 comments on commit 1e545f5

Please sign in to comment.