]> zoso.dev Git - libnemo.git/commitdiff
Reset `found` flag between executions.
authorChris Duncan <chris@zoso.dev>
Sat, 4 Jan 2025 12:00:48 +0000 (04:00 -0800)
committerChris Duncan <chris@zoso.dev>
Sat, 4 Jan 2025 12:00:48 +0000 (04:00 -0800)
src/lib/workers/powgpu.ts

index d84221551b0d6036992a0dfd2f4c9e0325dc79da..dedfb79185c332841b3b8d5f01fb13dd48ec8bea 100644 (file)
@@ -306,6 +306,7 @@ export class PowGpu extends WorkerInterface {
                        return
                }
 
+
                // Set up uniform buffer object
                // Note: u32 size is 4, but total alignment must be multiple of 16
                const uboView = new DataView(new ArrayBuffer(48))
@@ -318,7 +319,10 @@ export class PowGpu extends WorkerInterface {
                uboView.setUint32(36, threshold, true)
                PowGpu.#device.queue.writeBuffer(PowGpu.#uboBuffer, 0, uboView)
 
-               // Work buffer
+               // Reset offset 8 `found` flag to 0u in WORK before each calculation
+               PowGpu.#device.queue.writeBuffer(PowGpu.#gpuBuffer, 8, new Uint32Array([0]))
+
+               // Bind UBO read and GPU write buffers
                const bindGroup = PowGpu.#device.createBindGroup({
                        layout: PowGpu.#bindGroupLayout,
                        entries: [