From 203fb1b3484f621984e4595986cc77c9b9174d6a Mon Sep 17 00:00:00 2001 From: clayjohn Date: Thu, 21 Nov 2019 07:44:09 -0800 Subject: [PATCH] Fix GL error by properly using float uniform --- drivers/gles3/rasterizer_storage_gles3.cpp | 2 +- drivers/gles3/shaders/cubemap_filter.glsl | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/gles3/rasterizer_storage_gles3.cpp b/drivers/gles3/rasterizer_storage_gles3.cpp index ae53f54947d..4509c9d17ed 100644 --- a/drivers/gles3/rasterizer_storage_gles3.cpp +++ b/drivers/gles3/rasterizer_storage_gles3.cpp @@ -1853,7 +1853,7 @@ void RasterizerStorageGLES3::sky_set_texture(RID p_sky, RID p_panorama, int p_ra // Very large Panoramas require way too much effort to compute irradiance so use a mipmap // level that corresponds to a panorama of 1024x512 - shaders.cubemap_filter.set_uniform(CubemapFilterShaderGLES3::SOURCE_MIP_LEVEL, MAX(Math::log(float(texture->width)) / Math::log(2.0f) - 10.0f, 0.0f)); + shaders.cubemap_filter.set_uniform(CubemapFilterShaderGLES3::SOURCE_MIP_LEVEL, MAX(Math::floor(Math::log(float(texture->width)) / Math::log(2.0f)) - 10.0f, 0.0f)); for (int i = 0; i < 2; i++) { glViewport(0, i * size, size, size); diff --git a/drivers/gles3/shaders/cubemap_filter.glsl b/drivers/gles3/shaders/cubemap_filter.glsl index d83a109cb97..f94ac8c81c9 100644 --- a/drivers/gles3/shaders/cubemap_filter.glsl +++ b/drivers/gles3/shaders/cubemap_filter.glsl @@ -35,7 +35,7 @@ uniform sampler2D source_dual_paraboloid; //texunit:0 #endif #if defined(USE_SOURCE_DUAL_PARABOLOID) || defined(COMPUTE_IRRADIANCE) -uniform int source_mip_level; +uniform float source_mip_level; #endif #if !defined(USE_SOURCE_DUAL_PARABOLOID_ARRAY) && !defined(USE_SOURCE_PANORAMA) && !defined(USE_SOURCE_DUAL_PARABOLOID) @@ -236,7 +236,7 @@ vec4 textureDualParaboloid(vec3 normal) { if (norm.z < 0.0) { norm.y = 0.5 - norm.y + 0.5; } - return textureLod(source_dual_paraboloid, norm.xy, float(source_mip_level)); + return textureLod(source_dual_paraboloid, norm.xy, source_mip_level); } #endif