mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-11-25 00:58:30 -05:00
Fixed bug caused by mixing GLES and GL texture extensions.
This commit is contained in:
parent
a0bc7e3711
commit
3a7090684a
2 changed files with 21 additions and 3 deletions
|
@ -18,7 +18,7 @@ extern void dbgPrintf(const char* _format, ...);
|
|||
extern void dbgPrintfData(const void* _data, uint32_t _size, const char* _format, ...);
|
||||
|
||||
#ifndef BGFX_CONFIG_DEBUG
|
||||
# define BGFX_CONFIG_DEBUG 0
|
||||
# define BGFX_CONFIG_DEBUG 1
|
||||
#endif // BGFX_CONFIG_DEBUG
|
||||
|
||||
#if BGFX_CONFIG_DEBUG
|
||||
|
|
|
@ -18,6 +18,7 @@ namespace bgfx
|
|||
{
|
||||
EXT_texture_filter_anisotropic,
|
||||
EXT_texture_format_BGRA8888,
|
||||
EXT_bgra,
|
||||
EXT_texture_compression_s3tc,
|
||||
EXT_texture_compression_dxt1,
|
||||
CHROMIUM_texture_compression_dxt3,
|
||||
|
@ -68,6 +69,7 @@ namespace bgfx
|
|||
{
|
||||
{ "GL_EXT_texture_filter_anisotropic", false, true },
|
||||
{ "GL_EXT_texture_format_BGRA8888", false, true },
|
||||
{ "GL_EXT_bgra", false, true },
|
||||
{ "GL_EXT_texture_compression_s3tc", false, true },
|
||||
{ "GL_EXT_texture_compression_dxt1", false, true },
|
||||
{ "GL_CHROMIUM_texture_compression_dxt3", false, true },
|
||||
|
@ -1819,7 +1821,8 @@ namespace bgfx
|
|||
s_textureFormat[TextureFormat::BC3].m_supported = bc123Supported || s_extension[Extension::CHROMIUM_texture_compression_dxt5].m_supported;
|
||||
|
||||
bool bc45Supported = s_extension[Extension::EXT_texture_compression_latc].m_supported
|
||||
|| s_extension[Extension::EXT_texture_compression_rgtc].m_supported;
|
||||
|| s_extension[Extension::EXT_texture_compression_rgtc].m_supported
|
||||
;
|
||||
s_textureFormat[TextureFormat::BC4].m_supported = bc45Supported;
|
||||
s_textureFormat[TextureFormat::BC5].m_supported = bc45Supported;
|
||||
|
||||
|
@ -1843,10 +1846,25 @@ namespace bgfx
|
|||
glGetFloatv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &s_renderCtx.m_maxAnisotropy);
|
||||
}
|
||||
|
||||
if (s_extension[Extension::EXT_texture_format_BGRA8888].m_supported)
|
||||
if (s_extension[Extension::EXT_texture_format_BGRA8888].m_supported
|
||||
|| s_extension[Extension::EXT_bgra].m_supported)
|
||||
{
|
||||
s_textureFormat[TextureFormat::BGRX8].m_fmt = GL_BGRA_EXT;
|
||||
s_textureFormat[TextureFormat::BGRA8].m_fmt = GL_BGRA_EXT;
|
||||
|
||||
// Mixing GLES and GL extensions here. OpenGL EXT_bgra wants
|
||||
// format to be BGRA but internal format to stay RGBA, but
|
||||
// EXT_texture_format_BGRA8888 wants both format and internal
|
||||
// format to be BGRA.
|
||||
//
|
||||
// Reference:
|
||||
// https://www.khronos.org/registry/gles/extensions/EXT/EXT_texture_format_BGRA8888.txt
|
||||
// https://www.opengl.org/registry/specs/EXT/bgra.txt
|
||||
if (!s_extension[Extension::EXT_bgra].m_supported)
|
||||
{
|
||||
s_textureFormat[TextureFormat::BGRX8].m_internalFmt = GL_BGRA_EXT;
|
||||
s_textureFormat[TextureFormat::BGRA8].m_internalFmt = GL_BGRA_EXT;
|
||||
}
|
||||
}
|
||||
|
||||
#if !BGFX_CONFIG_RENDERER_OPENGLES3
|
||||
|
|
Loading…
Reference in a new issue