mirror of
https://github.com/luanti-org/luanti.git
synced 2025-07-22 17:18:39 +00:00
GL: fix and clean up some code
This commit is contained in:
parent
36edc3f161
commit
1fb7202028
17 changed files with 54 additions and 177 deletions
|
@ -43,8 +43,6 @@ void COpenGLES2Driver::initFeatures()
|
|||
}
|
||||
initExtensions();
|
||||
|
||||
static const GLenum BGRA8_EXT = 0x93A1;
|
||||
|
||||
if (Version.Major >= 3) {
|
||||
// NOTE floating-point formats may not be suitable for render targets.
|
||||
TextureFormats[ECF_A1R5G5B5] = {GL_RGB5_A1, GL_RGBA, GL_UNSIGNED_SHORT_5_5_5_1, CColorConverter::convert_A1R5G5B5toR5G5B5A1};
|
||||
|
@ -64,10 +62,11 @@ void COpenGLES2Driver::initFeatures()
|
|||
TextureFormats[ECF_D24] = {GL_DEPTH_COMPONENT24, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT};
|
||||
TextureFormats[ECF_D24S8] = {GL_DEPTH24_STENCIL8, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8};
|
||||
|
||||
if (FeatureAvailable[IRR_GL_EXT_texture_format_BGRA8888])
|
||||
// NOTE a recent (2024) revision of EXT_texture_format_BGRA8888 also
|
||||
// adds a sized format GL_BGRA8_EXT. We have a workaround in place to
|
||||
// fix up the InternalFormat in case of render targets.
|
||||
if (FeatureAvailable[IRR_GL_EXT_texture_format_BGRA8888] || FeatureAvailable[IRR_GL_APPLE_texture_format_BGRA8888])
|
||||
TextureFormats[ECF_A8R8G8B8] = {GL_BGRA, GL_BGRA, GL_UNSIGNED_BYTE};
|
||||
else if (FeatureAvailable[IRR_GL_APPLE_texture_format_BGRA8888])
|
||||
TextureFormats[ECF_A8R8G8B8] = {BGRA8_EXT, GL_BGRA, GL_UNSIGNED_BYTE};
|
||||
|
||||
// OpenGL ES 3 doesn't include a GL_DEPTH_COMPONENT32, so still use
|
||||
// OES_depth_texture for 32-bit depth texture support.
|
||||
|
@ -87,10 +86,8 @@ void COpenGLES2Driver::initFeatures()
|
|||
TextureFormats[ECF_R8G8B8] = {GL_RGB, GL_RGB, GL_UNSIGNED_BYTE};
|
||||
TextureFormats[ECF_A8R8G8B8] = {GL_RGBA, GL_RGBA, GL_UNSIGNED_BYTE, CColorConverter::convert_A8R8G8B8toA8B8G8R8};
|
||||
|
||||
if (FeatureAvailable[IRR_GL_EXT_texture_format_BGRA8888])
|
||||
if (FeatureAvailable[IRR_GL_EXT_texture_format_BGRA8888] || FeatureAvailable[IRR_GL_APPLE_texture_format_BGRA8888])
|
||||
TextureFormats[ECF_A8R8G8B8] = {GL_BGRA, GL_BGRA, GL_UNSIGNED_BYTE};
|
||||
else if (FeatureAvailable[IRR_GL_APPLE_texture_format_BGRA8888])
|
||||
TextureFormats[ECF_A8R8G8B8] = {BGRA8_EXT, GL_BGRA, GL_UNSIGNED_BYTE};
|
||||
|
||||
if (FeatureAvailable[IRR_GL_OES_texture_half_float]) {
|
||||
TextureFormats[ECF_A16B16G16R16F] = {GL_RGBA, GL_RGBA, HALF_FLOAT_OES};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue