summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/gles2/shaders/copy.glsl19
-rw-r--r--drivers/gles3/rasterizer_scene_gles3.cpp5
-rw-r--r--drivers/gles3/rasterizer_storage_gles3.cpp8
-rw-r--r--drivers/gles3/shaders/cubemap_filter.glsl5
-rw-r--r--drivers/gles3/shaders/scene.glsl8
5 files changed, 27 insertions, 18 deletions
diff --git a/drivers/gles2/shaders/copy.glsl b/drivers/gles2/shaders/copy.glsl
index cb42970921..3f060cb97f 100644
--- a/drivers/gles2/shaders/copy.glsl
+++ b/drivers/gles2/shaders/copy.glsl
@@ -16,6 +16,7 @@ attribute vec2 uv_in; // attrib:4
#endif
attribute vec2 uv2_in; // attrib:5
+
#ifdef USE_CUBEMAP
varying vec3 cube_interp;
#else
@@ -58,7 +59,9 @@ float sRGB_gamma_correct(float c){
#define LUM_RANGE 4.0
-#ifdef USE_CUBEMAP
+#ifdef USE_ARRAY
+uniform sampler2DArray source;
+#elif defined(USE_CUBEMAP)
varying vec3 cube_interp;
uniform samplerCube source_cube;
#else
@@ -145,23 +148,17 @@ uniform float custom_alpha;
void main() {
//vec4 color = color_interp;
-#ifdef USE_HIGHP_SOURCE
-#ifdef USE_CUBEMAP
+
+#ifdef USE_ARRAY
+ highp vec4 color = textureLod( source, vec3(uv_interp,0.0),0.0 );
+#elif defined(USE_CUBEMAP)
highp vec4 color = textureCube( source_cube, normalize(cube_interp) );
#else
highp vec4 color = texture2D( source, uv_interp );
#endif
-#else
-
-#ifdef USE_CUBEMAP
- vec4 color = textureCube( source_cube, normalize(cube_interp) );
-
-#else
- vec4 color = texture2D( source, uv_interp );
-#endif
#endif
diff --git a/drivers/gles3/rasterizer_scene_gles3.cpp b/drivers/gles3/rasterizer_scene_gles3.cpp
index 08ff51866d..f8ed7956a2 100644
--- a/drivers/gles3/rasterizer_scene_gles3.cpp
+++ b/drivers/gles3/rasterizer_scene_gles3.cpp
@@ -1889,6 +1889,7 @@ void RasterizerSceneGLES3::_render_list(RenderList::Element **p_elements, int p_
} else {
glBindTexture(GL_TEXTURE_2D, p_base_env);
}
+
state.scene_shader.set_conditional(SceneShaderGLES3::USE_RADIANCE_MAP, true);
state.scene_shader.set_conditional(SceneShaderGLES3::USE_RADIANCE_MAP_ARRAY, storage->config.use_texture_array_environment);
} else {
@@ -4233,7 +4234,11 @@ void RasterizerSceneGLES3::render_scene(const Transform &p_cam_transform, const
storage->canvas->canvas_begin();
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, env_radiance_tex);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
storage->canvas->draw_generic_textured_rect(Rect2(0, 0, storage->frame.current_rt->width / 2, storage->frame.current_rt->height / 2), Rect2(0, 0, 1, 1));
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
}
}
diff --git a/drivers/gles3/rasterizer_storage_gles3.cpp b/drivers/gles3/rasterizer_storage_gles3.cpp
index 8b86316da8..036ff58719 100644
--- a/drivers/gles3/rasterizer_storage_gles3.cpp
+++ b/drivers/gles3/rasterizer_storage_gles3.cpp
@@ -1260,6 +1260,10 @@ void RasterizerStorageGLES3::sky_set_texture(RID p_sky, RID p_panorama, int p_ra
glActiveTexture(GL_TEXTURE0);
glBindTexture(texture->target, texture->tex_id);
+ glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
+ glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
+ glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
+ glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); //need this for proper sampling
if (config.srgb_decode_supported && texture->srgb && !texture->using_srgb) {
@@ -1377,8 +1381,8 @@ void RasterizerStorageGLES3::sky_set_texture(RID p_sky, RID p_panorama, int p_ra
glTexParameterf(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
glTexParameterf(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
- glTexParameterf(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_WRAP_S, GL_REPEAT);
- glTexParameterf(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_WRAP_T, GL_REPEAT);
+ glTexParameterf(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
+ glTexParameterf(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glBindFramebuffer(GL_FRAMEBUFFER, RasterizerStorageGLES3::system_fbo);
glDeleteFramebuffers(1, &tmp_fb);
diff --git a/drivers/gles3/shaders/cubemap_filter.glsl b/drivers/gles3/shaders/cubemap_filter.glsl
index 88a97a04aa..10a803cafe 100644
--- a/drivers/gles3/shaders/cubemap_filter.glsl
+++ b/drivers/gles3/shaders/cubemap_filter.glsl
@@ -219,9 +219,8 @@ void main() {
N.z = 0.5 - 0.5*((N.x * N.x) + (N.y * N.y));
N = normalize(N);
- if (!z_flip) {
- //N.y=-N.y; //y is flipped to improve blending between both sides
- } else {
+ if (z_flip) {
+ N.y=-N.y; //y is flipped to improve blending between both sides
N.z=-N.z;
}
diff --git a/drivers/gles3/shaders/scene.glsl b/drivers/gles3/shaders/scene.glsl
index f94ca6fcba..247d1468c3 100644
--- a/drivers/gles3/shaders/scene.glsl
+++ b/drivers/gles3/shaders/scene.glsl
@@ -429,7 +429,9 @@ vec3 textureDualParaboloid(sampler2DArray p_tex, vec3 p_vec,float p_roughness) {
// we need to lie the derivatives (normg) and assume that DP side is always the same
// to get proper texure filtering
vec2 normg=norm.xy;
- norm.y+=max(0.0,sign(norm.z))*0.5;
+ if (norm.z>0) {
+ norm.y=0.5-norm.y+0.5;
+ }
// thanks to OpenGL spec using floor(layer + 0.5) for texture arrays,
// it's easy to have precision errors using fract() to interpolate layers
@@ -451,7 +453,9 @@ vec3 textureDualParaboloid(sampler2D p_tex, vec3 p_vec,float p_roughness) {
vec3 norm = normalize(p_vec);
norm.xy/=1.0+abs(norm.z);
norm.xy=norm.xy * vec2(0.5,0.25) + vec2(0.5,0.25);
- norm.y+=max(0.0,sign(norm.z))*0.5;
+ if (norm.z>0) {
+ norm.y=0.5-norm.y+0.5;
+ }
return textureLod(p_tex, norm.xy, p_roughness * RADIANCE_MAX_LOD).xyz;
}