From a7bedaf935c979b4c369ce05e1ff2ac164cf8440 Mon Sep 17 00:00:00 2001 From: Thomas Herzog Date: Thu, 23 Aug 2018 17:08:16 +0200 Subject: [PATCH] [GLES2] attempt to fix some android problems --- drivers/gles2/rasterizer_scene_gles2.cpp | 6 +++--- drivers/gles2/shaders/cubemap_filter.glsl | 7 ++++++- drivers/gles2/shaders/scene.glsl | 7 ++++++- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/drivers/gles2/rasterizer_scene_gles2.cpp b/drivers/gles2/rasterizer_scene_gles2.cpp index 288a144b32a..5d208682943 100644 --- a/drivers/gles2/rasterizer_scene_gles2.cpp +++ b/drivers/gles2/rasterizer_scene_gles2.cpp @@ -107,7 +107,7 @@ void RasterizerSceneGLES2::shadow_atlas_set_size(RID p_atlas, int p_size) { glActiveTexture(GL_TEXTURE0); glGenTextures(1, &shadow_atlas->depth); glBindTexture(GL_TEXTURE_2D, shadow_atlas->depth); - glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT16, shadow_atlas->size, shadow_atlas->size, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, NULL); + glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT, shadow_atlas->size, shadow_atlas->size, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, NULL); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); @@ -2401,7 +2401,7 @@ void RasterizerSceneGLES2::initialize() { glBindTexture(GL_TEXTURE_CUBE_MAP, cube.cubemap); for (int i = 0; i < 6; i++) { - glTexImage2D(_cube_side_enum[i], 0, GL_DEPTH_COMPONENT16, cube_size, cube_size, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT, NULL); + glTexImage2D(_cube_side_enum[i], 0, GL_DEPTH_COMPONENT, cube_size, cube_size, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT, NULL); } glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MIN_FILTER, GL_NEAREST); @@ -2435,7 +2435,7 @@ void RasterizerSceneGLES2::initialize() { glGenTextures(1, &directional_shadow.depth); glBindTexture(GL_TEXTURE_2D, directional_shadow.depth); - glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT16, directional_shadow.size, directional_shadow.size, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, NULL); + glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT, directional_shadow.size, directional_shadow.size, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, NULL); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); diff --git a/drivers/gles2/shaders/cubemap_filter.glsl b/drivers/gles2/shaders/cubemap_filter.glsl index 62ecd9471b1..35f0a163252 100644 --- a/drivers/gles2/shaders/cubemap_filter.glsl +++ b/drivers/gles2/shaders/cubemap_filter.glsl @@ -21,7 +21,12 @@ void main() { [fragment] -#extension GL_ARB_shader_texture_lod : require +#extension GL_ARB_shader_texture_lod : enable + +#ifndef GL_ARB_shader_texture_lod +#define texture2DLod(img, coord, lod) texture2D(img, coord) +#define textureCubeLod(img, coord, lod) textureCube(img, coord) +#endif #ifdef USE_GLES_OVER_GL #define mediump diff --git a/drivers/gles2/shaders/scene.glsl b/drivers/gles2/shaders/scene.glsl index 3e64c92e96e..204f22c0467 100644 --- a/drivers/gles2/shaders/scene.glsl +++ b/drivers/gles2/shaders/scene.glsl @@ -262,7 +262,12 @@ VERTEX_SHADER_CODE } [fragment] -#extension GL_ARB_shader_texture_lod : require +#extension GL_ARB_shader_texture_lod : enable + +#ifndef GL_ARB_shader_texture_lod +#define texture2DLod(img, coord, lod) texture2D(img, coord) +#define textureCubeLod(img, coord, lod) textureCube(img, coord) +#endif #ifdef USE_GLES_OVER_GL #define mediump