]> zoso.dev Git - nano-pow.git/commitdiff
Move temp variables to be near other declarations in main.
authorChris Duncan <chris@zoso.dev>
Tue, 4 Feb 2025 21:38:32 +0000 (13:38 -0800)
committerChris Duncan <chris@zoso.dev>
Tue, 4 Feb 2025 21:38:32 +0000 (13:38 -0800)
src/shaders/compute.wgsl

index c07ce350855132278807bc02b81f5231cbb90355..f6a11e5851103314673519701700ef2cfa5ad144 100644 (file)
@@ -108,6 +108,14 @@ fn main(id: vec3<u32>) {
        var vCD: vec4<u32> = vec4(0xADE682F9u, 0x510E527Fu, 0x2B3E6C1Fu, 0x9B05688Cu);
        var vEF: vec4<u32> = vec4(0x04BE4294u, 0xE07C2654u, 0x137E2179u, 0x5BE0CD19u);
 
+       /**
+       * Temporary variables used for subprocesses i=4 through i=7
+       */
+       var v56: vec4<u32>;
+       var vFC: vec4<u32>;
+       var v74: vec4<u32>;
+       var vDE: vec4<u32>;
+
        /**
        * Twelve rounds of G mixing as part of BLAKE2b compression step. Normally,
        * each round is divided into eight subprocesses; NanoPow compresses these
@@ -144,10 +152,7 @@ fn main(id: vec3<u32>) {
        * Each sum step has an extra carry addition. Note that the m[sigma] sum is
        * skipped if m[sigma] is zero since it effectively does nothing.
        */
-       var v56: vec4<u32>;
-       var vFC: vec4<u32>;
-       var v74: vec4<u32>;
-       var vDE: vec4<u32>;
+
        /****************************************************************************
        *                                                                                                                               ROUND(0)                                                                                                                                        *
        ****************************************************************************/