Skip to content

Commit

Permalink
Compat: Fix canvas configure test for 0 storagebuffers
Browse files Browse the repository at this point in the history
  • Loading branch information
greggman committed Jan 15, 2025
1 parent 015cf99 commit 7fcec24
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/webgpu/web_platform/canvas/configure.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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');
Expand Down Expand Up @@ -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: [
{
Expand Down

0 comments on commit 7fcec24

Please sign in to comment.