From ef3d3c108100de32a7cad66a338000c67ae7c746 Mon Sep 17 00:00:00 2001 From: David Neto Date: Mon, 8 Jul 2024 11:18:54 -0400 Subject: [PATCH] Fix compound assignment storage_rw when resultType != storage(resultType) (#3846) In the storage_rw case, when the result type is not the same as storage(result type) then generate the full expansion (stylistically): var ret = LHSType(LHS); ret {op}= RHSType(RHS); outputs.value = ret; instead of: outputs.value = {storageType}(LHS); outputs.value {op}= ret; This situation occurs when the value type is bool or bool-vec. In that case the result type is u32, and there are no mixed overloads for & and | such as: u32 & bool u32 | bool Fixes: #3845 --- src/webgpu/shader/execution/expression/expression.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/webgpu/shader/execution/expression/expression.ts b/src/webgpu/shader/execution/expression/expression.ts index 1b9815117f89..29bb8d93674e 100644 --- a/src/webgpu/shader/execution/expression/expression.ts +++ b/src/webgpu/shader/execution/expression/expression.ts @@ -867,7 +867,7 @@ ${body} // Runtime eval ////////////////////////////////////////////////////////////////////////// let operation = ''; - if (inputSource === 'storage_rw') { + if (inputSource === 'storage_rw' && objectEquals(resultType, storageType(resultType))) { operation = ` outputs[i].value = ${storageType(resultType)}(inputs[i].lhs); outputs[i].value ${op} ${rhsType}(inputs[i].rhs);`;