From 620388d004c66a7e789ada76004d412266055e0b Mon Sep 17 00:00:00 2001 From: Chris Duncan Date: Wed, 5 Feb 2025 05:56:46 -0800 Subject: [PATCH] Short-circuit 'and' does not appear to be working, at least within this select statement. This reverts commit 79e20147888328156f07667ed5430c218455adbb. --- src/shaders/compute.wgsl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/shaders/compute.wgsl b/src/shaders/compute.wgsl index 0ea306e..6f2a29a 100644 --- a/src/shaders/compute.wgsl +++ b/src/shaders/compute.wgsl @@ -1456,6 +1456,8 @@ fn main(id: vec3) { * Set nonce if it passes the threshold and no other thread has set it. * Only high bits are needed for comparison since threshold low bits are zero. */ - work.nonce = select(work.nonce, m0, (BLAKE2B_IV_0.y ^ v0.y ^ v8.y) >= ubo.threshold && atomicExchange(&work.found, 1u) == 0u); + if ((BLAKE2B_IV_0.y ^ v0.y ^ v8.y) >= ubo.threshold && atomicExchange(&work.found, 1u) == 0u) { + work.nonce = m0; + } return; } -- 2.34.1