Skip to content

Commit

Permalink
Revert FMA usage in shader to fix compatibility mode
Browse files Browse the repository at this point in the history
  • Loading branch information
TokisanGames committed Oct 28, 2024
1 parent 361e318 commit dc21920
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/shaders/main.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ vec4 height_blend(vec4 a_value, float a_height, vec4 b_value, float b_height, fl
float ma = max(a_height + (1.0 - blend), b_height + blend) - (1.001 - blend_sharpness);
float b1 = max(a_height + (1.0 - blend) - ma, 0.0);
float b2 = max(b_height + blend - ma, 0.0);
return fma(a_value, vec4(b1), b_value * b2) / (b1 + b2);
return (a_value * b1 + b_value * b2) / (b1 + b2);
} else {
float contrast = 1.0 - blend_sharpness;
float factor = (blend - contrast) / contrast;
Expand Down
8 changes: 4 additions & 4 deletions src/shaders/world_noise.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ float hashv2(vec2 v) {
vec3 noise2D(vec2 x) {
vec2 f = fract(x);
// Quintic Hermine Curve. Similar to SmoothStep()
vec2 u = f * f * f * fma(f, fma(f, vec2(6.0), vec2(-15.0)), vec2(10.0));
vec2 du = 30.0 * f * f * fma(f, (f - 2.0), vec2(1.0));
vec2 u = f*f*f*(f*(f*6.0-15.0)+10.0);
vec2 du = 30.0*f*f*(f*(f-2.0)+1.0);

vec2 p = floor(x);

Expand All @@ -63,8 +63,8 @@ vec3 noise2D(vec2 x) {
float k1 = b - a;
float k2 = c - a;
float k3 = a - b - c + d;
return vec3( fma(k3, u.x * u.y, fma(u.y, k2, fma(k1, u.x, k0))),
du * fma(u.yx, vec2(k3), vec2(k1, k2)) );
return vec3( k0 + k1 * u.x + k2 * u.y + k3 * u.x * u.y,
du * ( vec2(k1, k2) + k3 * u.yx) );
}

float world_noise(vec2 p) {
Expand Down

0 comments on commit dc21920

Please sign in to comment.