]> zoso.dev Git - nano-pow.git/commit
Overhaul both WebGPU and WebGL to use vec4 for parallel operation hinting on supporte...
authorChris Duncan <chris@zoso.dev>
Sat, 1 Mar 2025 06:19:48 +0000 (22:19 -0800)
committerChris Duncan <chris@zoso.dev>
Sat, 1 Mar 2025 06:19:48 +0000 (22:19 -0800)
commita06779bc2d091398ee4439f17411bd69276d85f5
tree16ef919f4491087d63163ceafaf45915f43375b1
parent9aaebc24ad06cb44363bf1322f608ae2bd229cbd
Overhaul both WebGPU and WebGL to use vec4 for parallel operation hinting on supported hardware. Refactor WebGL BLAKE2b to simplify pixel-coordinate-based nonce variation, to unroll main G mix function loop for performance, and to better differentiate between search and validate processes. Simplify vertex shader now that it is only required for drawing the fullscreen quad and not for pixel coordinates. Create new downsampling fragment shader which enables larger canvases and more nonces per frame without introducing lag due to synchronous readback. Maintain canvas between draw calls unless effort has changed. Attempt to handle WebGL context loss, with improved reset function, by reinitializing class. Reduce promise stack increases when waiting for query result. Fix color buffer clearing by using correct API function. Improve nonce seed generation in both WebGL and WebGPU by switching from crypto random to insecure random which is OK in the context of PoW. Reduce garbage collection by reusing static variables. Add debugging throughout that obeys user-provided debug flag which is now stored as a static variable as well. Add Typescript typings for new WebGL types. Fix minor issues with test page. Add benchmark results table.
13 files changed:
benchmarks.md [new file with mode: 0644]
main.min.js
src/classes/gl.ts
src/classes/gpu.ts
src/classes/index.ts
src/shaders/compute.wgsl
src/shaders/gl-downsample.ts [new file with mode: 0644]
src/shaders/gl-draw.ts [new file with mode: 0644]
src/shaders/gl-fragment.ts [deleted file]
src/shaders/gl-vertex.ts
src/shaders/index.ts
test.html
types.d.ts