Skip to content

Commit caf1670

Browse files
committed
Merge pull request godotengine#118695 from shiena/fix/webgl-angle-shader-compilation
Fix GLES3 scene shader int literal type errors for WebGL
2 parents c065d8a + 462d633 commit caf1670

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

drivers/gles3/shaders/area_lights_inc.glsl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ float acos_approx(float p_x) {
88
float x = abs(p_x);
99
float res = -0.156583f * x + (M_PI / 2.0);
1010
res *= sqrt(1.0f - x);
11-
return (p_x >= 0) ? res : M_PI - res;
11+
return (p_x >= 0.0) ? res : M_PI - res;
1212
}
1313

1414
vec3 integrate_edge_hill(vec3 p0, vec3 p1) {

drivers/gles3/shaders/scene.glsl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1797,7 +1797,7 @@ void light_process_area(uint idx, vec3 vertex, vec3 eye_vec, vec3 normal, vec3 f
17971797
if (dot(area_width, area_width) < EPSILON || dot(area_height, area_height) < EPSILON) { // area is 0
17981798
return;
17991799
}
1800-
if (dot(area_direction, vertex - area_lights[idx].position) <= 0) {
1800+
if (dot(area_direction, vertex - area_lights[idx].position) <= 0.0) {
18011801
return; // vertex is behind light
18021802
}
18031803

@@ -1829,7 +1829,7 @@ void light_process_area(uint idx, vec3 vertex, vec3 eye_vec, vec3 normal, vec3 f
18291829
float f90 = clamp(dot(f0, vec3(50.0 * 0.33)), metallic, 1.0);
18301830
vec3 fresnel_color = f0 * max(ltc_fresnel.x, 0.0) + (f90 - f0) * max(ltc_fresnel.y, 0.0);
18311831

1832-
float light_length = max(0, dist);
1832+
float light_length = max(0.0, dist);
18331833
float light_attenuation_raw = get_omni_spot_attenuation(light_length, area_lights[idx].inv_radius, area_lights[idx].attenuation);
18341834
float light_attenuation_ltc = light_attenuation_raw * light_length * light_length; // solid angle already decreases by inverse square, so attenuation power is 2.0 by default -> subtract 2.0
18351835

0 commit comments

Comments
 (0)