Skip to content

Commit 1c7d6af

Browse files
authored
webgpu/shader/execution: Fix bad WGSL generation (#762)
Subcases of `webgpu:shader,execution,robust_access:linear_memory,*` tests were attempting to call `any()` on boolean scalars. No such overload exists. Currently for these tests, only matrices, when indexed, produce a vector. So instead of checking fro `innerLength`, check the outer container type is a matrix. Fixes 6 test cases.
1 parent ccdb2c2 commit 1c7d6af

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/webgpu/shader/execution/robust_access.spec.ts

+11-2
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,16 @@ g.test('linear_memory')
146146
.expandWithParams(generateTypes)
147147
)
148148
.fn(async t => {
149-
const { storageClass, storageMode, access, isAtomic, baseType, type, _kTypeInfo } = t.params;
149+
const {
150+
storageClass,
151+
storageMode,
152+
access,
153+
isAtomic,
154+
containerType,
155+
baseType,
156+
type,
157+
_kTypeInfo,
158+
} = t.params;
150159

151160
assert(_kTypeInfo !== undefined, 'not an indexable type');
152161
assert('arrayLength' in _kTypeInfo);
@@ -264,7 +273,7 @@ g.test('linear_memory')
264273
{
265274
const exprLoadElement = isAtomic ? `atomicLoad(&${exprElement})` : exprElement;
266275
let condition = `${exprLoadElement} != ${exprZeroElement}`;
267-
if ('innerLength' in _kTypeInfo) condition = `any(${condition})`;
276+
if (containerType === 'matrix') condition = `any(${condition})`;
268277
testFunctionSource += `
269278
if (${condition}) { return ${nextErrorReturnValue()}; }`;
270279
}

0 commit comments

Comments
 (0)