From fced6ff2401dfb0504064ee164bc625eac49c4b9 Mon Sep 17 00:00:00 2001 From: grorp Date: Thu, 7 Nov 2024 20:43:05 +0100 Subject: [PATCH] Fix ECF_D32 support in ogles2 video driver OES_depth32 only talks about support for render buffers, not textures, so it's not relevant here: https://github.com/KhronosGroup/OpenGL-Registry/blob/main/extensions/OES/OES_depth32.txt This fixes the scene being black with "video_driver = ogles2" and "enable_post_processing = true" on my desktop computer. --- irr/src/OpenGLES2/Driver.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/irr/src/OpenGLES2/Driver.cpp b/irr/src/OpenGLES2/Driver.cpp index 249b6caef..9a99601fd 100644 --- a/irr/src/OpenGLES2/Driver.cpp +++ b/irr/src/OpenGLES2/Driver.cpp @@ -57,8 +57,12 @@ void COpenGLES2Driver::initFeatures() else if (FeatureAvailable[IRR_GL_APPLE_texture_format_BGRA8888]) TextureFormats[ECF_A8R8G8B8] = {BGRA8_EXT, GL_BGRA, GL_UNSIGNED_BYTE}; - if (FeatureAvailable[IRR_GL_OES_depth32]) - TextureFormats[ECF_D32] = {GL_DEPTH_COMPONENT32, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT}; + // OpenGL ES 3 doesn't include a GL_DEPTH_COMPONENT32, so still use + // OES_depth_texture for 32-bit depth texture support. + // OpenGL ES 3 would allow {GL_DEPTH_COMPONENT32F, GL_DEPTH_COMPONENT, GL_FLOAT}, + // but I guess that would have to be called ECF_D32F... + if (FeatureAvailable[IRR_GL_OES_depth_texture]) + TextureFormats[ECF_D32] = {GL_DEPTH_COMPONENT, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT}; } else { // NOTE These are *texture* formats. They may or may not be suitable // for render targets. The specs only talks on *sized* formats for the @@ -98,8 +102,9 @@ void COpenGLES2Driver::initFeatures() if (FeatureAvailable[IRR_GL_OES_depth_texture]) { TextureFormats[ECF_D16] = {GL_DEPTH_COMPONENT, GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT}; - if (FeatureAvailable[IRR_GL_OES_depth32]) - TextureFormats[ECF_D32] = {GL_DEPTH_COMPONENT, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT}; + // OES_depth_texture includes 32-bit depth texture support. + TextureFormats[ECF_D32] = {GL_DEPTH_COMPONENT, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT}; + if (FeatureAvailable[IRR_GL_OES_packed_depth_stencil]) TextureFormats[ECF_D24S8] = {GL_DEPTH_STENCIL, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8}; }