]> zoso.dev Git - nano-pow.git/commitdiff
Simplify m initialization with swizzles, and switch them from var to let to enforce...
authorChris Duncan <chris@zoso.dev>
Mon, 20 Jan 2025 07:24:36 +0000 (23:24 -0800)
committerChris Duncan <chris@zoso.dev>
Mon, 20 Jan 2025 07:24:36 +0000 (23:24 -0800)
src/shaders/compute.wgsl

index dac36e2248f542080c87fc5b98d53796fff2bd4e..d441379a2a1cf8f0a7b43bdfd81e7263c894adcc 100644 (file)
@@ -65,11 +65,11 @@ fn main(id: vec3<u32>) {
        /**
        * Initialize (nonce||blockhash) concatenation
        */
-       var m0: vec2<u32> = ubo.random ^ vec2(id.x, id.y);
-       var m1: vec2<u32> = vec2(ubo.blockhash[0u].x, ubo.blockhash[0u].y);
-       var m2: vec2<u32> = vec2(ubo.blockhash[0u].z, ubo.blockhash[0u].w);
-       var m3: vec2<u32> = vec2(ubo.blockhash[1u].x, ubo.blockhash[1u].y);
-       var m4: vec2<u32> = vec2(ubo.blockhash[1u].z, ubo.blockhash[1u].w);
+       let m0: vec2<u32> = ubo.random ^ id.xy;
+       let m1: vec2<u32> = ubo.blockhash[0u].xy;
+       let m2: vec2<u32> = ubo.blockhash[0u].zw;
+       let m3: vec2<u32> = ubo.blockhash[1u].xy;
+       let m4: vec2<u32> = ubo.blockhash[1u].zw;
 
        /**
        * Compression buffer initialized to 2 instances of initialization vector. Each