From 9896e2da8435c50d86fdae5b868bb8b5ac699a1b Mon Sep 17 00:00:00 2001 From: Rezmason Date: Sun, 5 Dec 2021 22:58:32 -0800 Subject: [PATCH] Fixing a Firefox Nightly issue in the rain pass. --- TODO.txt | 1 - js/main.js | 2 +- shaders/wgsl/rainPass.wgsl | 12 +++++++----- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/TODO.txt b/TODO.txt index 566adf8..2705730 100644 --- a/TODO.txt +++ b/TODO.txt @@ -2,7 +2,6 @@ TODO: WebGPU FF Nightly - var quadCorners : array, NUM_VERTICES_PER_QUAD> contained the wrong values Bloom pass isn't working right Try https://github.com/brendan-duncan/wgsl_reflect Get rid of end pass once it's possible to copy a bgra8unorm to a canvas texture diff --git a/js/main.js b/js/main.js index 03577ab..3ef18c7 100644 --- a/js/main.js +++ b/js/main.js @@ -7,7 +7,7 @@ document.addEventListener("touchmove", (e) => e.preventDefault(), { }); const supportsWebGPU = async () => { - return window?.GPUQueue?.prototype?.copyExternalImageToTexture != null; + return window.GPUQueue != null; }; document.body.onload = async () => { diff --git a/shaders/wgsl/rainPass.wgsl b/shaders/wgsl/rainPass.wgsl index 5848646..d45c027 100644 --- a/shaders/wgsl/rainPass.wgsl +++ b/shaders/wgsl/rainPass.wgsl @@ -285,10 +285,11 @@ fn computeResult (isFirstFrame : bool, previousResult : vec4, glyphPos : ve // Vertex shader -var quadCorners : array, NUM_VERTICES_PER_QUAD> = array, NUM_VERTICES_PER_QUAD>( - vec2(0.0, 0.0), vec2(1.0, 0.0), vec2(0.0, 1.0), - vec2(1.0, 1.0), vec2(0.0, 1.0), vec2(1.0, 0.0) -); +// Firefox Nightly (that is to say, Naga) currently has a bug that mixes up these values from ones in the uniforms. +// var quadCorners : array, NUM_VERTICES_PER_QUAD> = array, NUM_VERTICES_PER_QUAD>( +// vec2(0.0, 0.0), vec2(1.0, 0.0), vec2(0.0, 1.0), +// vec2(1.0, 1.0), vec2(0.0, 1.0), vec2(1.0, 0.0) +// ); [[stage(vertex)]] fn vertMain(input : VertInput) -> VertOutput { @@ -300,7 +301,8 @@ var quadCorners : array, NUM_VERTICES_PER_QUAD> = array(f32(i % 2), f32((i + 1) % 6 / 3)); var quadPosition = vec2( f32(quadIndex % i32(quadGridSize.x)),