summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2019-12-10 17:15:56 +0100
committerGitHub <noreply@github.com>2019-12-10 17:15:56 +0100
commitec30c8bc25d75fadf1d82b8ad85d3c0f8d1b64aa (patch)
tree73d313c82d060a17d5f5f47b804c3a2f6a06aafe
parentc868baf6581cb082844c7fde822c9b1ad86b3215 (diff)
parente8d652f16095639dac33085b871b76a995fe8d86 (diff)
Merge pull request #34237 from clayjohn/GLES2-force-32bit-buffer-webgl
Force 32 bit depth buffer for WebGL
-rw-r--r--drivers/gles2/rasterizer_storage_gles2.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/gles2/rasterizer_storage_gles2.cpp b/drivers/gles2/rasterizer_storage_gles2.cpp
index 40e7f0c441..4040d94f10 100644
--- a/drivers/gles2/rasterizer_storage_gles2.cpp
+++ b/drivers/gles2/rasterizer_storage_gles2.cpp
@@ -5807,6 +5807,13 @@ void RasterizerStorageGLES2::initialize() {
config.pvrtc_supported = config.extensions.has("IMG_texture_compression_pvrtc") || config.extensions.has("WEBGL_compressed_texture_pvrtc");
config.support_npot_repeat_mipmap = config.extensions.has("GL_OES_texture_npot");
+#ifdef JAVASCRIPT_ENABLED
+ // no way of detecting 32 or 16 bit support for renderbuffer, so default to 32
+ // if the implementation doesn't support 32, it should just quietly use 16 instead
+ // https://www.khronos.org/registry/webgl/extensions/WEBGL_depth_texture/
+ config.depth_buffer_internalformat = GL_DEPTH_COMPONENT;
+ config.depth_type = GL_UNSIGNED_INT;
+#else
// on mobile check for 24 bit depth support for RenderBufferStorage
if (config.extensions.has("GL_OES_depth24")) {
config.depth_buffer_internalformat = _DEPTH_COMPONENT24_OES;
@@ -5816,6 +5823,7 @@ void RasterizerStorageGLES2::initialize() {
config.depth_type = GL_UNSIGNED_SHORT;
}
#endif
+#endif
#ifndef GLES_OVER_GL
//Manually load extensions for android and ios