Just learned about the private storage class. The rain pass can use it to look up the corner positions of quads, rather than derive them mathematically.

This commit is contained in:
Rezmason
2021-11-12 00:03:06 -08:00
parent 910d29e175
commit cebd6877bb

View File

@@ -285,6 +285,11 @@ fn computeResult (isFirstFrame : bool, previousResult : vec4<f32>, glyphPos : ve
// Vertex shader
var<private> quadCorners : array<vec2<f32>, NUM_VERTICES_PER_QUAD> = array<vec2<f32>, NUM_VERTICES_PER_QUAD>(
vec2<f32>(0.0, 0.0), vec2<f32>(1.0, 0.0), vec2<f32>(0.0, 1.0),
vec2<f32>(1.0, 1.0), vec2<f32>(0.0, 1.0), vec2<f32>(1.0, 0.0)
);
[[stage(vertex)]] fn vertMain(input : VertInput) -> VertOutput {
var volumetric = bool(config.volumetric);
@@ -295,10 +300,7 @@ fn computeResult (isFirstFrame : bool, previousResult : vec4<f32>, glyphPos : ve
var i = i32(input.index);
var quadIndex = i / NUM_VERTICES_PER_QUAD;
var quadCorner = vec2<f32>(
f32(i % 2),
f32((i + 1) % NUM_VERTICES_PER_QUAD / 3)
);
var quadCorner = quadCorners[i % NUM_VERTICES_PER_QUAD];
var quadPosition = vec2<f32>(
f32(quadIndex % i32(quadGridSize.x)),