From 5241b4af9e55f958d9a4c972347c42735643c0bc Mon Sep 17 00:00:00 2001 From: Corentin Wallez Date: Wed, 8 Nov 2023 16:14:37 +0100 Subject: [PATCH] Update validation tests to allow separate read-only depth-stencil. (#3136) --- .../createRenderBundleEncoder.spec.ts | 44 ++----------------- .../validation/encoding/render_bundle.spec.ts | 14 +----- .../attachment_compatibility.spec.ts | 7 --- .../render_pass_descriptor.spec.ts | 8 ++-- src/webgpu/listing_meta.json | 1 - 5 files changed, 7 insertions(+), 67 deletions(-) diff --git a/src/webgpu/api/validation/encoding/createRenderBundleEncoder.spec.ts b/src/webgpu/api/validation/encoding/createRenderBundleEncoder.spec.ts index 2eaa9b43fd23..b4beeb8fbe5d 100644 --- a/src/webgpu/api/validation/encoding/createRenderBundleEncoder.spec.ts +++ b/src/webgpu/api/validation/encoding/createRenderBundleEncoder.spec.ts @@ -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 => @@ -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, }); diff --git a/src/webgpu/api/validation/encoding/render_bundle.spec.ts b/src/webgpu/api/validation/encoding/render_bundle.spec.ts index 883b634446ce..35bdc9958388 100644 --- a/src/webgpu/api/validation/encoding/render_bundle.spec.ts +++ b/src/webgpu/api/validation/encoding/render_bundle.spec.ts @@ -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); @@ -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); diff --git a/src/webgpu/api/validation/render_pass/attachment_compatibility.spec.ts b/src/webgpu/api/validation/render_pass/attachment_compatibility.spec.ts index c0ab23b91c8e..241d576e396d 100644 --- a/src/webgpu/api/validation/render_pass/attachment_compatibility.spec.ts +++ b/src/webgpu/api/validation/render_pass/attachment_compatibility.spec.ts @@ -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) { diff --git a/src/webgpu/api/validation/render_pass/render_pass_descriptor.spec.ts b/src/webgpu/api/validation/render_pass/render_pass_descriptor.spec.ts index 9713beea5262..82e376567894 100644 --- a/src/webgpu/api/validation/render_pass/render_pass_descriptor.spec.ts +++ b/src/webgpu/api/validation/render_pass/render_pass_descriptor.spec.ts @@ -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; @@ -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(); diff --git a/src/webgpu/listing_meta.json b/src/webgpu/listing_meta.json index 51607d396cac..c8396bab2ffc 100644 --- a/src/webgpu/listing_meta.json +++ b/src/webgpu/listing_meta.json @@ -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 },