Skip to content

Commit

Permalink
Update validation tests to allow separate read-only depth-stencil. (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
Kangz authored Nov 8, 2023
1 parent 2835c6b commit 5241b4a
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 67 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -196,10 +196,7 @@ g.test('valid_texture_formats')
g.test('depth_stencil_readonly')
.desc(
`
Tests that createRenderBundleEncoder validation of depthReadOnly and stencilReadOnly
- With depth-only formats
- With stencil-only formats
- With depth-stencil-combined formats
Test that allow combinations of depth-stencil format, depthReadOnly and stencilReadOnly are allowed.
`
)
.params(u =>
Expand All @@ -215,44 +212,9 @@ g.test('depth_stencil_readonly')
})
.fn(t => {
const { depthStencilFormat, depthReadOnly, stencilReadOnly } = t.params;

let shouldError = false;
if (
kTextureFormatInfo[depthStencilFormat].depth &&
kTextureFormatInfo[depthStencilFormat].stencil &&
depthReadOnly !== stencilReadOnly
) {
shouldError = true;
}

t.expectValidationError(() => {
t.device.createRenderBundleEncoder({
colorFormats: [],
depthStencilFormat,
depthReadOnly,
stencilReadOnly,
});
}, shouldError);
});

g.test('depth_stencil_readonly_with_undefined_depth')
.desc(
`
Tests that createRenderBundleEncoder validation of depthReadOnly and stencilReadOnly is ignored
if there is no depthStencilFormat set.
`
)
.params(u =>
u //
.beginSubcases()
.combine('depthReadOnly', [false, true])
.combine('stencilReadOnly', [false, true])
)
.fn(t => {
const { depthReadOnly, stencilReadOnly } = t.params;

t.device.createRenderBundleEncoder({
colorFormats: ['bgra8unorm'],
colorFormats: [],
depthStencilFormat,
depthReadOnly,
stencilReadOnly,
});
Expand Down
14 changes: 1 addition & 13 deletions src/webgpu/api/validation/encoding/render_bundle.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Tests execution of render bundles.
`;

import { makeTestGroup } from '../../../../common/framework/test_group.js';
import { kDepthStencilFormats, kTextureFormatInfo } from '../../../format_info.js';
import { kDepthStencilFormats } from '../../../format_info.js';
import { ValidationTest } from '../validation_test.js';

export const g = makeTestGroup(ValidationTest);
Expand Down Expand Up @@ -170,18 +170,6 @@ g.test('depth_stencil_readonly_mismatch')
.combine('bundleStencilReadOnly', [false, true])
.combine('passDepthReadOnly', [false, true])
.combine('passStencilReadOnly', [false, true])
.filter(p => {
// For combined depth/stencil formats the depth and stencil read only state must match
// in order to create a valid render bundle or render pass.
const depthStencilInfo = kTextureFormatInfo[p.depthStencilFormat];
if (depthStencilInfo.depth && depthStencilInfo.stencil) {
return (
p.passDepthReadOnly === p.passStencilReadOnly &&
p.bundleDepthReadOnly === p.bundleStencilReadOnly
);
}
return true;
})
)
.beforeAllSubcases(t => {
t.selectDeviceForTextureFormatOrSkipTestCase(t.params.depthStencilFormat);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -551,13 +551,6 @@ Test that the depth stencil read only state in render passes or bundles is compa
.filter(p => {
if (p.format) {
const depthStencilInfo = kTextureFormatInfo[p.format];
// For combined depth/stencil formats the depth and stencil read only state must match
// in order to create a valid render bundle or render pass.
if (depthStencilInfo.depth && depthStencilInfo.stencil) {
if (p.depthReadOnly !== p.stencilReadOnly) {
return false;
}
}
// If the format has no depth aspect, the depthReadOnly, depthWriteEnabled of the pipeline must not be true
// in order to create a valid render pipeline.
if (!depthStencilInfo.depth && p.depthWriteEnabled) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -909,10 +909,8 @@ g.test('depth_stencil_attachment,loadOp_storeOp_match_depthReadOnly_stencilReadO
const hasDepth = info.depth;
const hasStencil = info.stencil;

const goodAspectCombo =
(hasDepth && hasStencil ? !depthReadOnly === !stencilReadOnly : true) &&
(hasDepthSettings ? hasDepth : true) &&
(hasStencilSettings ? hasStencil : true);
const goodAspectSettingsPresent =
(hasDepthSettings ? hasDepth : true) && (hasStencilSettings ? hasStencil : true);

const hasBothDepthOps = !!depthLoadOp && !!depthStoreOp;
const hasBothStencilOps = !!stencilLoadOp && !!stencilStoreOp;
Expand All @@ -923,7 +921,7 @@ g.test('depth_stencil_attachment,loadOp_storeOp_match_depthReadOnly_stencilReadO
const goodStencilCombo =
hasStencil && !stencilReadOnly ? hasBothStencilOps : hasNeitherStencilOps;

const shouldError = !goodAspectCombo || !goodDepthCombo || !goodStencilCombo;
const shouldError = !goodAspectSettingsPresent || !goodDepthCombo || !goodStencilCombo;

t.expectValidationError(() => {
encoder.finish();
Expand Down
1 change: 0 additions & 1 deletion src/webgpu/listing_meta.json
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,6 @@
"webgpu:api,validation,encoding,createRenderBundleEncoder:attachment_state,limits,maxColorAttachmentBytesPerSample,unaligned:*": { "subcaseMS": 0.750 },
"webgpu:api,validation,encoding,createRenderBundleEncoder:attachment_state,limits,maxColorAttachments:*": { "subcaseMS": 0.145 },
"webgpu:api,validation,encoding,createRenderBundleEncoder:depth_stencil_readonly:*": { "subcaseMS": 1.804 },
"webgpu:api,validation,encoding,createRenderBundleEncoder:depth_stencil_readonly_with_undefined_depth:*": { "subcaseMS": 14.825 },
"webgpu:api,validation,encoding,createRenderBundleEncoder:valid_texture_formats:*": { "subcaseMS": 2.130 },
"webgpu:api,validation,encoding,encoder_open_state:compute_pass_commands:*": { "subcaseMS": 4.208 },
"webgpu:api,validation,encoding,encoder_open_state:non_pass_commands:*": { "subcaseMS": 26.191 },
Expand Down

0 comments on commit 5241b4a

Please sign in to comment.