1
0
mirror of https://github.com/luanti-org/luanti.git synced 2025-11-20 08:25:23 +01:00

Dynamic shadows with the ogles2 driver on OpenGL ES 3.0+ (#16661)

This commit is contained in:
grorp
2025-11-17 17:55:13 +01:00
committed by GitHub
parent ac0ebf39ad
commit fcd96e9244
22 changed files with 97 additions and 70 deletions

View File

@@ -133,6 +133,11 @@ enum E_VIDEO_DRIVER_FEATURE
//! Support for 2D array textures.
EVDF_TEXTURE_2D_ARRAY,
//! Support for floating-point textures as framebuffer color attachments.
// (The formats are a. color-renderable and b. part of the required framebuffer formats)
// (This refers to at least ECF_R16F, ECF_R32F, ECF_A16B16G16R16F and ECF_A32B32G32R32F)
EVDF_RENDER_TO_FLOAT_TEXTURE,
//! Only used for counting the elements of this enum
EVDF_COUNT
};

View File

@@ -580,6 +580,8 @@ bool COpenGLExtensionHandler::queryFeature(E_VIDEO_DRIVER_FEATURE feature) const
return FeatureAvailable[IRR_NV_depth_clamp] || FeatureAvailable[IRR_ARB_depth_clamp];
case EVDF_TEXTURE_MULTISAMPLE:
return (Version >= 302) || FeatureAvailable[IRR_ARB_texture_multisample];
case EVDF_RENDER_TO_FLOAT_TEXTURE:
return Version >= 300;
default:
return false;

View File

@@ -76,6 +76,8 @@ public:
return TextureMultisampleSupported;
case EVDF_TEXTURE_2D_ARRAY:
return Texture2DArraySupported;
case EVDF_RENDER_TO_FLOAT_TEXTURE:
return RenderToFloatTextureSupported;
default:
return false;
};
@@ -178,6 +180,7 @@ public:
bool TextureMultisampleSupported = false;
bool Texture2DArraySupported = false;
bool KHRDebugSupported = false;
bool RenderToFloatTextureSupported = false;
u32 MaxLabelLength = 0;
};

View File

@@ -69,10 +69,11 @@ void COpenGL3Driver::initFeatures()
LODBiasSupported = true;
BlendMinMaxSupported = true;
TextureMultisampleSupported = true;
Texture2DArraySupported = Version.Major >= 3 || queryExtension("GL_EXT_texture_array");
Texture2DArraySupported = true;
KHRDebugSupported = isVersionAtLeast(4, 6) || queryExtension("GL_KHR_debug");
if (KHRDebugSupported)
MaxLabelLength = GetInteger(GL.MAX_LABEL_LENGTH);
RenderToFloatTextureSupported = true;
// COGLESCoreExtensionHandler::Feature
static_assert(MATERIAL_MAX_TEXTURES <= 16, "Only up to 16 textures are guaranteed");

View File

@@ -43,6 +43,7 @@ void COpenGLES2Driver::initFeatures()
if (Version.Major >= 3) {
// NOTE floating-point formats may not be suitable for render targets.
// See also EVDF_RENDER_TO_FLOAT_TEXTURE.
TextureFormats[ECF_A1R5G5B5] = {GL_RGB5_A1, GL_RGBA, GL_UNSIGNED_SHORT_5_5_5_1, CColorConverter::convert_A1R5G5B5toR5G5B5A1};
TextureFormats[ECF_R5G6B5] = {GL_RGB565, GL_RGB, GL_UNSIGNED_SHORT_5_6_5};
TextureFormats[ECF_R8G8B8] = {GL_RGB8, GL_RGB, GL_UNSIGNED_BYTE};
@@ -126,6 +127,7 @@ void COpenGLES2Driver::initFeatures()
KHRDebugSupported = queryExtension("GL_KHR_debug");
if (KHRDebugSupported)
MaxLabelLength = GetInteger(GL.MAX_LABEL_LENGTH);
RenderToFloatTextureSupported = isVersionAtLeast(3, 2)|| queryExtension("GL_EXT_color_buffer_float");
// COGLESCoreExtensionHandler::Feature
static_assert(MATERIAL_MAX_TEXTURES <= 8, "Only up to 8 textures are guaranteed");