fix Stage 1 water effect on Intel UHD (#189)

This commit is contained in:
Alice 2020-02-17 22:06:21 -05:00 committed by GitHub
parent f4a3207f61
commit 00cd15af21
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 1 deletions

Binary file not shown.

View file

@ -5,6 +5,7 @@
#include "defs.glslh"
const float pi = 3.141592653589793; // as supplied by google
const float tau = 2 * pi;
vec2 dir(float a) {
return vec2(cos(a), sin(a));

View file

@ -12,8 +12,13 @@ float smoothNoise(vec2 p) {
p -= f;
f *= f * (3 - f - f);
// Intel's sin() function breaks down with values over 1e4 (yes, really)
// get rid of some bits here w/o sacrificing the nice effect
vec4 a = vec4(0, 1, 27, 28) + p.x + p.y * 27;
vec4 b = mod(a, tau);
// WARNING: Some versions of the Windows AMD driver choke on temp_mat = mat2(temp_vec)
vec4 temp_vec = fract(sin(vec4(0, 1, 27, 28) + p.x + p.y * 27) * 1e5);
vec4 temp_vec = fract(sin(b) * 1e5);
mat2 temp_mat = mat2(temp_vec.x, temp_vec.y, temp_vec.z, temp_vec.w);
return dot(temp_mat * vec2(1 - f.y, f.y), vec2(1 - f.x, f.x));