From 015cf9976a370151049f404a3362b77b3ac71534 Mon Sep 17 00:00:00 2001 From: Greggman Date: Thu, 16 Jan 2025 03:35:09 +0900 Subject: [PATCH] Fix mem-sync same_subresource tests for 0 storage buffers. (#4147) --- .../memory_sync/texture/same_subresource.spec.ts | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/webgpu/api/operation/memory_sync/texture/same_subresource.spec.ts b/src/webgpu/api/operation/memory_sync/texture/same_subresource.spec.ts index eef4f81680e..c2e3c17fbd3 100644 --- a/src/webgpu/api/operation/memory_sync/texture/same_subresource.spec.ts +++ b/src/webgpu/api/operation/memory_sync/texture/same_subresource.spec.ts @@ -65,6 +65,12 @@ function writeOpNeedsStorageTexture({ op, in: context }: { op: Op; in: Operation ); } +function getVisibilityForContext(context: OperationContext) { + return context === 'render-bundle-encoder' || context === 'render-pass-encoder' + ? GPUShaderStage.FRAGMENT + : GPUShaderStage.COMPUTE; +} + class TextureSyncTestHelper extends OperationContextHelper { private texture: GPUTexture; @@ -169,19 +175,19 @@ class TextureSyncTestHelper extends OperationContextHelper { format: this.kTextureFormat, usage: GPUTextureUsage.COPY_SRC | GPUTextureUsage.STORAGE_BINDING, }); - + const visibility = getVisibilityForContext(context); const bindGroupLayout = this.device.createBindGroupLayout({ entries: [ { binding: 0, - visibility: GPUShaderStage.FRAGMENT | GPUShaderStage.COMPUTE, + visibility, texture: { sampleType: 'unfilterable-float', }, }, { binding: 1, - visibility: GPUShaderStage.FRAGMENT | GPUShaderStage.COMPUTE, + visibility, storageTexture: { access: 'write-only', format: this.kTextureFormat, @@ -440,11 +446,12 @@ class TextureSyncTestHelper extends OperationContextHelper { break; } case 'storage': { + const visibility = getVisibilityForContext(context); const bindGroupLayout = this.device.createBindGroupLayout({ entries: [ { binding: 0, - visibility: GPUShaderStage.FRAGMENT | GPUShaderStage.COMPUTE, + visibility, storageTexture: { access: 'write-only', format: this.kTextureFormat,