Skip to content

Commit 4df5ca3

Browse files
committed
fixed compilation of hdr downscale shader on wasm
- #876
1 parent a083632 commit 4df5ca3

File tree

1 file changed

+15
-13
lines changed

1 file changed

+15
-13
lines changed

fyrox-impl/src/renderer/shaders/hdr_downscale.shader

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -63,28 +63,30 @@
6363
void main() {
6464
float x = properties.invSize.x;
6565
float y = properties.invSize.y;
66+
float twoX = 2.0 * x;
67+
float twoY = 2.0 * y;
6668

67-
float a = texture(lumSampler, vec2(texCoord.x - 2*x, texCoord.y + 2*y)).r;
68-
float b = texture(lumSampler, vec2(texCoord.x, texCoord.y + 2*y)).r;
69-
float c = texture(lumSampler, vec2(texCoord.x + 2*x, texCoord.y + 2*y)).r;
69+
float a = texture(lumSampler, vec2(texCoord.x - twoX, texCoord.y + twoY)).r;
70+
float b = texture(lumSampler, vec2(texCoord.x, texCoord.y + twoY)).r;
71+
float c = texture(lumSampler, vec2(texCoord.x + twoX, texCoord.y + twoY)).r;
7072

71-
float d = texture(lumSampler, vec2(texCoord.x - 2*x, texCoord.y)).r;
72-
float e = texture(lumSampler, vec2(texCoord.x, texCoord.y)).r;
73-
float f = texture(lumSampler, vec2(texCoord.x + 2*x, texCoord.y)).r;
73+
float d = texture(lumSampler, vec2(texCoord.x - twoX, texCoord.y)).r;
74+
float e = texture(lumSampler, vec2(texCoord.x, texCoord.y)).r;
75+
float f = texture(lumSampler, vec2(texCoord.x + twoX, texCoord.y)).r;
7476

75-
float g = texture(lumSampler, vec2(texCoord.x - 2*x, texCoord.y - 2*y)).r;
76-
float h = texture(lumSampler, vec2(texCoord.x, texCoord.y - 2*y)).r;
77-
float i = texture(lumSampler, vec2(texCoord.x + 2*x, texCoord.y - 2*y)).r;
77+
float g = texture(lumSampler, vec2(texCoord.x - twoX, texCoord.y - twoY)).r;
78+
float h = texture(lumSampler, vec2(texCoord.x, texCoord.y - twoY)).r;
79+
float i = texture(lumSampler, vec2(texCoord.x + twoX, texCoord.y - twoY)).r;
7880

7981
float j = texture(lumSampler, vec2(texCoord.x - x, texCoord.y + y)).r;
8082
float k = texture(lumSampler, vec2(texCoord.x + x, texCoord.y + y)).r;
8183
float l = texture(lumSampler, vec2(texCoord.x - x, texCoord.y - y)).r;
8284
float m = texture(lumSampler, vec2(texCoord.x + x, texCoord.y - y)).r;
8385

84-
outLum = e*0.125;
85-
outLum += (a+c+g+i)*0.03125;
86-
outLum += (b+d+f+h)*0.0625;
87-
outLum += (j+k+l+m)*0.125;
86+
outLum = e * 0.125;
87+
outLum += (a + c + g + i) * 0.03125;
88+
outLum += (b + d + f + h) * 0.0625;
89+
outLum += (j + k + l + m) * 0.125;
8890
}
8991
"#,
9092
)

0 commit comments

Comments
 (0)