From: Chris Duncan Date: Mon, 20 Jan 2025 07:24:36 +0000 (-0800) Subject: Simplify m initialization with swizzles, and switch them from var to let to enforce... X-Git-Tag: v2.0.0~8 X-Git-Url: https://zoso.dev/?a=commitdiff_plain;h=4ba5b827d265e1635241a88f8f65b1316231baee;p=nano-pow.git Simplify m initialization with swizzles, and switch them from var to let to enforce immutability. --- diff --git a/src/shaders/compute.wgsl b/src/shaders/compute.wgsl index dac36e2..d441379 100644 --- a/src/shaders/compute.wgsl +++ b/src/shaders/compute.wgsl @@ -65,11 +65,11 @@ fn main(id: vec3) { /** * Initialize (nonce||blockhash) concatenation */ - var m0: vec2 = ubo.random ^ vec2(id.x, id.y); - var m1: vec2 = vec2(ubo.blockhash[0u].x, ubo.blockhash[0u].y); - var m2: vec2 = vec2(ubo.blockhash[0u].z, ubo.blockhash[0u].w); - var m3: vec2 = vec2(ubo.blockhash[1u].x, ubo.blockhash[1u].y); - var m4: vec2 = vec2(ubo.blockhash[1u].z, ubo.blockhash[1u].w); + let m0: vec2 = ubo.random ^ id.xy; + let m1: vec2 = ubo.blockhash[0u].xy; + let m2: vec2 = ubo.blockhash[0u].zw; + let m3: vec2 = ubo.blockhash[1u].xy; + let m4: vec2 = ubo.blockhash[1u].zw; /** * Compression buffer initialized to 2 instances of initialization vector. Each