From be9653762190607af90bc820fdd50fc2ef705964 Mon Sep 17 00:00:00 2001 From: Wai Lin <69816317+wailin247@users.noreply.github.com> Date: Tue, 19 Nov 2024 23:12:39 +0630 Subject: [PATCH] Fix bgra8unorm storage handling Related to #3847 --- For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/gpuweb/cts/issues/3847?shareId=XXXX-XXXX-XXXX-XXXX). --- src/webgpu/api/operation/storage_texture/read_only.spec.ts | 2 +- src/webgpu/api/operation/storage_texture/read_write.spec.ts | 2 +- .../api/validation/texture/bgra8unorm_storage.spec.ts | 6 ++++++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/webgpu/api/operation/storage_texture/read_only.spec.ts b/src/webgpu/api/operation/storage_texture/read_only.spec.ts index b5224eec2b9d..767836f11a6d 100644 --- a/src/webgpu/api/operation/storage_texture/read_only.spec.ts +++ b/src/webgpu/api/operation/storage_texture/read_only.spec.ts @@ -580,7 +580,7 @@ g.test('basic') t.selectDeviceOrSkipTestCase('bgra8unorm-storage'); } if (t.isCompatibility) { - t.skipIfTextureFormatNotUsableAsStorageTexture(t.params.format); + t.skipIfTextureFormatNotUsableAsStorageTexture(t.params.format, t.device); } }) .fn(t => { diff --git a/src/webgpu/api/operation/storage_texture/read_write.spec.ts b/src/webgpu/api/operation/storage_texture/read_write.spec.ts index 03f613284238..4a7015a0dc35 100644 --- a/src/webgpu/api/operation/storage_texture/read_write.spec.ts +++ b/src/webgpu/api/operation/storage_texture/read_write.spec.ts @@ -316,7 +316,7 @@ g.test('basic') .unless(p => p.textureDimension === '1d' && p.depthOrArrayLayers > 1) ) .beforeAllSubcases(t => { - t.skipIfTextureFormatNotUsableAsStorageTexture(t.params.format); + t.skipIfTextureFormatNotUsableAsStorageTexture(t.params.format, t.device); }) .fn(t => { const { format, shaderStage, textureDimension, depthOrArrayLayers } = t.params; diff --git a/src/webgpu/api/validation/texture/bgra8unorm_storage.spec.ts b/src/webgpu/api/validation/texture/bgra8unorm_storage.spec.ts index 9a4834cdd124..9bdf35d516bb 100644 --- a/src/webgpu/api/validation/texture/bgra8unorm_storage.spec.ts +++ b/src/webgpu/api/validation/texture/bgra8unorm_storage.spec.ts @@ -34,6 +34,12 @@ class BGRA8UnormStorageValidationTests extends ValidationTest { }); }, !success); } + + skipIfTextureFormatNotUsableAsStorageTexture(format: GPUTextureFormat, device: GPUDevice): void { + if (format === 'bgra8unorm' && !device.features.has('bgra8unorm-storage')) { + this.skip('bgra8unorm-storage feature is not supported'); + } + } } export const g = makeTestGroup(BGRA8UnormStorageValidationTests);