mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-11-28 18:45:54 -05:00
GL: Check if extension exist before setting border color.
This commit is contained in:
parent
93c6020372
commit
6abfcffb2e
1 changed files with 15 additions and 4 deletions
|
@ -1194,6 +1194,7 @@ namespace bgfx { namespace gl
|
||||||
, m_vaoSupport(false)
|
, m_vaoSupport(false)
|
||||||
, m_samplerObjectSupport(false)
|
, m_samplerObjectSupport(false)
|
||||||
, m_shadowSamplersSupport(false)
|
, m_shadowSamplersSupport(false)
|
||||||
|
, m_borderColorSupport(BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGL) )
|
||||||
, m_programBinarySupport(false)
|
, m_programBinarySupport(false)
|
||||||
, m_textureSwizzleSupport(false)
|
, m_textureSwizzleSupport(false)
|
||||||
, m_depthTextureSupport(false)
|
, m_depthTextureSupport(false)
|
||||||
|
@ -1782,6 +1783,7 @@ namespace bgfx { namespace gl
|
||||||
|
|
||||||
if (BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGLES) )
|
if (BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGLES) )
|
||||||
{
|
{
|
||||||
|
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
|
s_textureAddress[BGFX_TEXTURE_U_BORDER>>BGFX_TEXTURE_U_SHIFT] = s_extension[Extension::NV_texture_border_clamp].m_supported
|
||||||
? GL_CLAMP_TO_BORDER
|
? GL_CLAMP_TO_BORDER
|
||||||
: GL_CLAMP_TO_EDGE
|
: GL_CLAMP_TO_EDGE
|
||||||
|
@ -2552,8 +2554,12 @@ namespace bgfx { namespace gl
|
||||||
GL_CHECK(glSamplerParameteri(sampler, GL_TEXTURE_MAG_FILTER, magFilter) );
|
GL_CHECK(glSamplerParameteri(sampler, GL_TEXTURE_MAG_FILTER, magFilter) );
|
||||||
GL_CHECK(glSamplerParameteri(sampler, GL_TEXTURE_MIN_FILTER, minFilter) );
|
GL_CHECK(glSamplerParameteri(sampler, GL_TEXTURE_MIN_FILTER, minFilter) );
|
||||||
|
|
||||||
|
if (BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGL)
|
||||||
|
|| m_borderColorSupport)
|
||||||
|
{
|
||||||
const float color[] = { 0.0f, 0.0f, 0.0f, 0.0f };
|
const float color[] = { 0.0f, 0.0f, 0.0f, 0.0f };
|
||||||
GL_CHECK(glSamplerParameterfv(sampler, GL_TEXTURE_BORDER_COLOR, color) );
|
GL_CHECK(glSamplerParameterfv(sampler, GL_TEXTURE_BORDER_COLOR, color) );
|
||||||
|
}
|
||||||
|
|
||||||
if (0 != (_flags & (BGFX_TEXTURE_MIN_ANISOTROPIC|BGFX_TEXTURE_MAG_ANISOTROPIC) )
|
if (0 != (_flags & (BGFX_TEXTURE_MIN_ANISOTROPIC|BGFX_TEXTURE_MAG_ANISOTROPIC) )
|
||||||
&& 0.0f < m_maxAnisotropy)
|
&& 0.0f < m_maxAnisotropy)
|
||||||
|
@ -3047,6 +3053,7 @@ namespace bgfx { namespace gl
|
||||||
bool m_vaoSupport;
|
bool m_vaoSupport;
|
||||||
bool m_samplerObjectSupport;
|
bool m_samplerObjectSupport;
|
||||||
bool m_shadowSamplersSupport;
|
bool m_shadowSamplersSupport;
|
||||||
|
bool m_borderColorSupport;
|
||||||
bool m_programBinarySupport;
|
bool m_programBinarySupport;
|
||||||
bool m_textureSwizzleSupport;
|
bool m_textureSwizzleSupport;
|
||||||
bool m_depthTextureSupport;
|
bool m_depthTextureSupport;
|
||||||
|
@ -4200,8 +4207,12 @@ namespace bgfx { namespace gl
|
||||||
GL_CHECK(glTexParameteri(target, GL_TEXTURE_MAG_FILTER, magFilter) );
|
GL_CHECK(glTexParameteri(target, GL_TEXTURE_MAG_FILTER, magFilter) );
|
||||||
GL_CHECK(glTexParameteri(target, GL_TEXTURE_MIN_FILTER, minFilter) );
|
GL_CHECK(glTexParameteri(target, GL_TEXTURE_MIN_FILTER, minFilter) );
|
||||||
|
|
||||||
|
if (BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGL)
|
||||||
|
|| s_renderGL->m_borderColorSupport)
|
||||||
|
{
|
||||||
const float color[] = { 0.0f, 0.0f, 0.0f, 0.0f };
|
const float color[] = { 0.0f, 0.0f, 0.0f, 0.0f };
|
||||||
GL_CHECK(glTexParameterfv(target, GL_TEXTURE_BORDER_COLOR, color) );
|
GL_CHECK(glTexParameterfv(target, GL_TEXTURE_BORDER_COLOR, color) );
|
||||||
|
}
|
||||||
|
|
||||||
if (0 != (flags & (BGFX_TEXTURE_MIN_ANISOTROPIC|BGFX_TEXTURE_MAG_ANISOTROPIC) )
|
if (0 != (flags & (BGFX_TEXTURE_MIN_ANISOTROPIC|BGFX_TEXTURE_MAG_ANISOTROPIC) )
|
||||||
&& 0.0f < s_renderGL->m_maxAnisotropy)
|
&& 0.0f < s_renderGL->m_maxAnisotropy)
|
||||||
|
|
Loading…
Reference in a new issue