This commit is contained in:
Branimir Karadžić 2015-11-30 14:50:28 -08:00
parent 987ac7c59b
commit 0f8ca11ff7
2 changed files with 20 additions and 7 deletions

View file

@ -533,6 +533,7 @@ namespace bgfx { namespace gl
EXT_shader_image_load_store,
EXT_shader_texture_lod,
EXT_shadow_samplers,
EXT_sRGB_write_control,
EXT_texture_array,
EXT_texture_compression_dxt1,
EXT_texture_compression_latc,
@ -737,6 +738,7 @@ namespace bgfx { namespace gl
{ "EXT_shader_image_load_store", false, true },
{ "EXT_shader_texture_lod", false, true }, // GLES2 extension.
{ "EXT_shadow_samplers", false, true },
{ "EXT_sRGB_write_control", false, true }, // GLES2 extension.
{ "EXT_texture_array", BGFX_CONFIG_RENDERER_OPENGL >= 30, true },
{ "EXT_texture_compression_dxt1", false, true },
{ "EXT_texture_compression_latc", false, true },
@ -1224,6 +1226,7 @@ namespace bgfx { namespace gl
, m_vaoSupport(false)
, m_samplerObjectSupport(false)
, m_shadowSamplersSupport(false)
, m_srgbWriteControlSupport(BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGL) )
, m_borderColorSupport(BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGL) )
, m_programBinarySupport(false)
, m_textureSwizzleSupport(false)
@ -1850,6 +1853,8 @@ namespace bgfx { namespace gl
if (BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGLES) )
{
m_srgbWriteControlSupport = s_extension[Extension::EXT_sRGB_write_control].m_supported;
m_borderColorSupport = s_extension[Extension::NV_texture_border_clamp].m_supported;
s_textureAddress[BGFX_TEXTURE_U_BORDER>>BGFX_TEXTURE_U_SHIFT] = s_extension[Extension::NV_texture_border_clamp].m_supported
? GL_CLAMP_TO_BORDER
@ -2481,14 +2486,17 @@ namespace bgfx { namespace gl
if (!isValid(_fbh) )
{
GL_CHECK(glBindFramebuffer(GL_FRAMEBUFFER, m_msaaBackBufferFbo) );
if (0 != (m_resolution.m_flags & BGFX_RESET_SRGB_BACKBUFFER))
if (m_srgbWriteControlSupport)
{
GL_CHECK(glEnable(GL_FRAMEBUFFER_SRGB));
}
else
{
GL_CHECK(glDisable(GL_FRAMEBUFFER_SRGB));
if (0 != (m_resolution.m_flags & BGFX_RESET_SRGB_BACKBUFFER) )
{
GL_CHECK(glEnable(GL_FRAMEBUFFER_SRGB) );
}
else
{
GL_CHECK(glDisable(GL_FRAMEBUFFER_SRGB) );
}
}
}
else
@ -3223,6 +3231,7 @@ namespace bgfx { namespace gl
bool m_vaoSupport;
bool m_samplerObjectSupport;
bool m_shadowSamplersSupport;
bool m_srgbWriteControlSupport;
bool m_borderColorSupport;
bool m_programBinarySupport;
bool m_textureSwizzleSupport;

View file

@ -738,6 +738,10 @@ typedef uint64_t GLuint64;
# define GL_UNSIGNED_INT_10_10_10_2 0x8DF6
#endif // GL_UNSIGNED_INT_10_10_10_2
#ifndef GL_FRAMEBUFFER_SRGB
# define GL_FRAMEBUFFER_SRGB 0x8DB9
#endif // GL_FRAMEBUFFER_SRGB
// _KHR or _ARB...
#define GL_DEBUG_OUTPUT_SYNCHRONOUS 0x8242
#define GL_DEBUG_NEXT_LOGGED_MESSAGE_LENGTH 0x8243