diff options
author | clayjohn <claynjohn@gmail.com> | 2022-05-19 17:38:59 -0700 |
---|---|---|
committer | clayjohn <claynjohn@gmail.com> | 2022-05-19 17:44:38 -0700 |
commit | 39f1be760f59bdc5ae59059bdc458485dfa5188e (patch) | |
tree | 6b5ec758b7c99aeb48907bbdaaad893c4ad60b24 /drivers/gles3 | |
parent | 920ca6252888489ca72647ad8d5ef721d5e5e686 (diff) |
Fix sky updating when DirectionalLight mode changed and shader compatibility for certain drivers
Diffstat (limited to 'drivers/gles3')
-rw-r--r-- | drivers/gles3/rasterizer_scene_gles3.cpp | 2 | ||||
-rw-r--r-- | drivers/gles3/shaders/cubemap_filter.glsl | 4 | ||||
-rw-r--r-- | drivers/gles3/shaders/scene.glsl | 6 |
3 files changed, 6 insertions, 6 deletions
diff --git a/drivers/gles3/rasterizer_scene_gles3.cpp b/drivers/gles3/rasterizer_scene_gles3.cpp index 7937090862..c3af232046 100644 --- a/drivers/gles3/rasterizer_scene_gles3.cpp +++ b/drivers/gles3/rasterizer_scene_gles3.cpp @@ -855,7 +855,7 @@ void RasterizerSceneGLES3::_setup_sky(Environment *p_env, RID p_render_buffers, if (light_data_dirty) { glBindBufferBase(GL_UNIFORM_BUFFER, SKY_DIRECTIONAL_LIGHT_UNIFORM_LOCATION, sky_globals.directional_light_buffer); - glBufferSubData(GL_UNIFORM_BUFFER, 0, sizeof(DirectionalLightData) * sky_globals.directional_light_count, sky_globals.directional_lights); + glBufferData(GL_UNIFORM_BUFFER, sizeof(DirectionalLightData) * sky_globals.max_directional_lights, sky_globals.directional_lights, GL_STREAM_DRAW); glBindBuffer(GL_UNIFORM_BUFFER, 0); DirectionalLightData *temp = sky_globals.last_frame_directional_lights; diff --git a/drivers/gles3/shaders/cubemap_filter.glsl b/drivers/gles3/shaders/cubemap_filter.glsl index 81e66c956c..ebf0c08ec4 100644 --- a/drivers/gles3/shaders/cubemap_filter.glsl +++ b/drivers/gles3/shaders/cubemap_filter.glsl @@ -141,7 +141,7 @@ void main() { vec3 N = texelCoordToVec(uv, face_id); #ifdef MODE_DIRECT_WRITE - frag_color = vec4(textureCubeLod(source_cube, N, 0.0).rgb, 1.0); + frag_color = vec4(textureLod(source_cube, N, 0.0).rgb, 1.0); #else vec4 sum = vec4(0.0); @@ -171,7 +171,7 @@ void main() { float mipLevel = roughness == 0.0 ? 0.0 : 0.5 * log2(solid_angle_sample / solid_angle_texel); - vec3 val = textureCubeLod(source_cube, L, mipLevel).rgb; + vec3 val = textureLod(source_cube, L, mipLevel).rgb; // Mix using linear val = srgb_to_linear(val); diff --git a/drivers/gles3/shaders/scene.glsl b/drivers/gles3/shaders/scene.glsl index 198d1d9ec7..fbea4bdbe4 100644 --- a/drivers/gles3/shaders/scene.glsl +++ b/drivers/gles3/shaders/scene.glsl @@ -812,7 +812,7 @@ vec4 fog_process(vec3 vertex) { // mip_level always reads from the second mipmap and higher so the fog is always slightly blurred float mip_level = mix(1.0 / MAX_ROUGHNESS_LOD, 1.0, 1.0 - (abs(vertex.z) - scene_data.z_near) / (scene_data.z_far - scene_data.z_near)); - sky_fog_color = textureCubeLod(radiance_map, cube_view, mip_level * RADIANCE_MAX_LOD).rgb; + sky_fog_color = textureLod(radiance_map, cube_view, mip_level * RADIANCE_MAX_LOD).rgb; fog_color = mix(fog_color, sky_fog_color, scene_data.fog_aerial_perspective); } @@ -1031,7 +1031,7 @@ void main() { #endif float horizon = min(1.0 + dot(ref_vec, normal), 1.0); ref_vec = scene_data.radiance_inverse_xform * ref_vec; - specular_light = textureCubeLod(radiance_map, ref_vec, roughness * RADIANCE_MAX_LOD).rgb; + specular_light = textureLod(radiance_map, ref_vec, roughness * RADIANCE_MAX_LOD).rgb; specular_light = srgb_to_linear(specular_light); specular_light *= horizon * horizon; specular_light *= scene_data.ambient_light_color_energy.a; @@ -1052,7 +1052,7 @@ void main() { #ifdef USE_RADIANCE_MAP if (scene_data.use_ambient_cubemap) { vec3 ambient_dir = scene_data.radiance_inverse_xform * normal; - vec3 cubemap_ambient = textureCubeLod(radiance_map, ambient_dir, RADIANCE_MAX_LOD).rgb; + vec3 cubemap_ambient = textureLod(radiance_map, ambient_dir, RADIANCE_MAX_LOD).rgb; cubemap_ambient = srgb_to_linear(cubemap_ambient); ambient_light = mix(ambient_light, cubemap_ambient * scene_data.ambient_light_color_energy.a, scene_data.ambient_color_sky_mix); } |