From 9625efe168a4bb17d2d7cc50b0486e1d26b4317a Mon Sep 17 00:00:00 2001 From: Gregg Tavares Date: Tue, 14 Jan 2025 17:05:04 -0800 Subject: [PATCH] Compat: Fix canvas configure test for 0 storagebuffers --- src/webgpu/web_platform/canvas/configure.spec.ts | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/webgpu/web_platform/canvas/configure.spec.ts b/src/webgpu/web_platform/canvas/configure.spec.ts index 3e9905dd5bd8..69e058d8d1a3 100644 --- a/src/webgpu/web_platform/canvas/configure.spec.ts +++ b/src/webgpu/web_platform/canvas/configure.spec.ts @@ -16,10 +16,10 @@ import { filterFormatsByFeature, viewCompatible, } from '../../format_info.js'; -import { GPUTest } from '../../gpu_test.js'; +import { GPUTest, MaxLimitsTestMixin } from '../../gpu_test.js'; import { kAllCanvasTypes, createCanvas } from '../../util/create_elements.js'; -export const g = makeTestGroup(GPUTest); +export const g = makeTestGroup(MaxLimitsTestMixin(GPUTest)); g.test('defaults') .desc( @@ -212,6 +212,7 @@ g.test('usage') ) .fn(t => { const { canvasType, usage } = t.params; + const canvas = createCanvas(t, canvasType, 2, 2); const ctx = canvas.getContext('webgpu'); assert(ctx instanceof GPUCanvasContext, 'Failed to get WebGPU context from canvas'); @@ -269,7 +270,13 @@ g.test('usage') }); } - if (usage & GPUConst.TextureUsage.STORAGE_BINDING) { + const canUseStorageTextureInFragmentShader = + !t.isCompatibility || t.device.limits.maxStorageTexturesInFragmentStage! > 0; + + if ( + (usage & GPUConst.TextureUsage.STORAGE_BINDING) !== 0 && + canUseStorageTextureInFragmentShader + ) { const bgl = t.device.createBindGroupLayout({ entries: [ {