Changed so that isFramebufferFormatValid checks the format even if it is not supported as a normal texture. Changed so that isTextureValid passes check if format is only supported as FrameBuffer and flags match that. (#1530)
This commit is contained in:
parent
72bf5f9870
commit
e039d996fd
10
src/bgfx.cpp
10
src/bgfx.cpp
@ -3941,11 +3941,19 @@ namespace bgfx
|
||||
return;
|
||||
}
|
||||
|
||||
bool formatSupported = 0 != (g_caps.formats[_format] & (0
|
||||
bool formatSupported;
|
||||
if (0 != (_flags & (BGFX_TEXTURE_RT | BGFX_TEXTURE_RT_WRITE_ONLY)) )
|
||||
{
|
||||
formatSupported = 0 != (g_caps.formats[_format] & BGFX_CAPS_FORMAT_TEXTURE_FRAMEBUFFER);
|
||||
}
|
||||
else
|
||||
{
|
||||
formatSupported = 0 != (g_caps.formats[_format] & (0
|
||||
| BGFX_CAPS_FORMAT_TEXTURE_2D
|
||||
| BGFX_CAPS_FORMAT_TEXTURE_2D_EMULATED
|
||||
| BGFX_CAPS_FORMAT_TEXTURE_2D_SRGB
|
||||
) );
|
||||
}
|
||||
uint16_t srgbCaps = BGFX_CAPS_FORMAT_TEXTURE_2D_SRGB;
|
||||
|
||||
if (_cubeMap)
|
||||
|
@ -1571,8 +1571,7 @@ BX_TRACE("%d, %d, %d, %s", _array, _srgb, _mipAutogen, getName(_format) );
|
||||
? tfi.m_internalFmtSrgb
|
||||
: tfi.m_internalFmt
|
||||
;
|
||||
if (GL_ZERO == internalFmt
|
||||
|| !tfi.m_supported)
|
||||
if (GL_ZERO == internalFmt)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@ -5911,11 +5910,27 @@ BX_TRACE("%d, %d, %d, %s", _array, _srgb, _mipAutogen, getName(_format) );
|
||||
|
||||
if (0 != texture.m_rbo)
|
||||
{
|
||||
GL_CHECK(glFramebufferRenderbuffer(GL_FRAMEBUFFER
|
||||
, attachment
|
||||
, GL_RENDERBUFFER
|
||||
, texture.m_rbo
|
||||
) );
|
||||
#if !(BGFX_CONFIG_RENDERER_OPENGL >= 30 || BGFX_CONFIG_RENDERER_OPENGLES >= 30)
|
||||
if (GL_DEPTH_STENCIL_ATTACHMENT == attachment)
|
||||
{
|
||||
GL_CHECK(glFramebufferRenderbuffer(GL_FRAMEBUFFER
|
||||
, GL_DEPTH_ATTACHMENT
|
||||
, GL_RENDERBUFFER
|
||||
, texture.m_rbo
|
||||
) );
|
||||
GL_CHECK(glFramebufferRenderbuffer(GL_FRAMEBUFFER
|
||||
, GL_STENCIL_ATTACHMENT
|
||||
, GL_RENDERBUFFER
|
||||
, texture.m_rbo
|
||||
) );
|
||||
}
|
||||
else
|
||||
#endif
|
||||
GL_CHECK(glFramebufferRenderbuffer(GL_FRAMEBUFFER
|
||||
, attachment
|
||||
, GL_RENDERBUFFER
|
||||
, texture.m_rbo
|
||||
) );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user