Skip to content

Commit

Permalink
webgpu/shader/execution: Fix bad WGSL generation (#762)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
ben-clayton authored Sep 30, 2021
1 parent ccdb2c2 commit 1c7d6af
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/webgpu/shader/execution/robust_access.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,16 @@ g.test('linear_memory')
.expandWithParams(generateTypes)
)
.fn(async t => {
const { storageClass, storageMode, access, isAtomic, baseType, type, _kTypeInfo } = t.params;
const {
storageClass,
storageMode,
access,
isAtomic,
containerType,
baseType,
type,
_kTypeInfo,
} = t.params;

assert(_kTypeInfo !== undefined, 'not an indexable type');
assert('arrayLength' in _kTypeInfo);
Expand Down Expand Up @@ -264,7 +273,7 @@ g.test('linear_memory')
{
const exprLoadElement = isAtomic ? `atomicLoad(&${exprElement})` : exprElement;
let condition = `${exprLoadElement} != ${exprZeroElement}`;
if ('innerLength' in _kTypeInfo) condition = `any(${condition})`;
if (containerType === 'matrix') condition = `any(${condition})`;
testFunctionSource += `
if (${condition}) { return ${nextErrorReturnValue()}; }`;
}
Expand Down

0 comments on commit 1c7d6af

Please sign in to comment.