summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJuan Linietsky <juan@godotengine.org>2018-12-21 09:50:15 -0300
committerJuan Linietsky <juan@godotengine.org>2018-12-21 09:50:57 -0300
commit9ea27ec03249e25aaef5ae75393ea5079f852423 (patch)
tree6f018143586cef9917022f0acf8be1865eb03f0d
parentbe8c0d57c565bae9ce4fae140355d9e886c8443b (diff)
Fixes to framebuffer formats for GLES2, closes #24518
-rw-r--r--drivers/gles2/rasterizer_storage_gles2.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/drivers/gles2/rasterizer_storage_gles2.cpp b/drivers/gles2/rasterizer_storage_gles2.cpp
index 810fa701c0..dcdb7da5ff 100644
--- a/drivers/gles2/rasterizer_storage_gles2.cpp
+++ b/drivers/gles2/rasterizer_storage_gles2.cpp
@@ -4216,9 +4216,13 @@ RID RasterizerStorageGLES2::canvas_light_shadow_buffer_create(int p_width) {
glGenTextures(1, &cls->distance);
glBindTexture(GL_TEXTURE_2D, cls->distance);
if (config.use_rgba_2d_shadows) {
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, cls->size, cls->height, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, cls->size, cls->height, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
} else {
+#ifdef GLES_OVER_GL
glTexImage2D(GL_TEXTURE_2D, 0, GL_R32F, cls->size, cls->height, 0, GL_RED, GL_FLOAT, NULL);
+#else
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_FLOAT, cls->size, cls->height, 0, GL_RED, GL_FLOAT, NULL);
+#endif
}
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
@@ -4634,8 +4638,12 @@ void RasterizerStorageGLES2::initialize() {
config.float_texture_supported = config.extensions.has("GL_ARB_texture_float") || config.extensions.has("GL_OES_texture_float");
config.s3tc_supported = config.extensions.has("GL_EXT_texture_compression_s3tc");
config.etc1_supported = config.extensions.has("GL_OES_compressed_ETC1_RGB8_texture");
- config.use_rgba_2d_shadows = false;
+#ifdef GLES_OVER_GL
+ config.use_rgba_2d_shadows = false;
+#else
+ config.use_rgba_2d_shadows = config.extensions.has("GL_OES_texture_float");
+#endif
frame.count = 0;
frame.delta = 0;
frame.current_rt = NULL;