Added blit caps.

This commit is contained in:
Branimir Karadžić
2015-10-16 17:42:40 -07:00
parent 8745d3fa45
commit bf60b513aa
6 changed files with 65 additions and 43 deletions

View File

@@ -1203,6 +1203,7 @@ namespace bgfx { namespace gl
, m_maxAnisotropyDefault(0.0f)
, m_maxMsaa(0)
, m_vao(0)
, m_blitSupported(false)
, m_vaoSupport(false)
, m_samplerObjectSupport(false)
, m_shadowSamplersSupport(false)
@@ -1705,6 +1706,18 @@ namespace bgfx { namespace gl
: 0
;
if (s_extension[Extension::ARB_copy_image].m_supported
|| s_extension[Extension::EXT_copy_image].m_supported
|| s_extension[Extension:: NV_copy_image].m_supported
|| s_extension[Extension::OES_copy_image].m_supported)
{
m_blitSupported = NULL != glCopyImageSubData;
g_caps.supported |= m_blitSupported
? BGFX_CAPS_BLIT
: 0
;
}
g_caps.maxTextureSize = uint16_t(glGet(GL_MAX_TEXTURE_SIZE) );
if (BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGL)
@@ -3092,6 +3105,7 @@ namespace bgfx { namespace gl
float m_maxAnisotropyDefault;
int32_t m_maxMsaa;
GLuint m_vao;
bool m_blitSupported;
bool m_vaoSupport;
bool m_samplerObjectSupport;
bool m_shadowSamplersSupport;
@@ -5272,40 +5286,43 @@ namespace bgfx { namespace gl
GL_CHECK(glEnable(GL_CULL_FACE) );
GL_CHECK(glDisable(GL_BLEND) );
for (; blitItem < numBlitItems && blitKey.m_view == view; blitItem++)
if (m_blitSupported)
{
const BlitItem& bi = _render->m_blitItem[blitItem];
blitKey.decode(_render->m_blitKeys[blitItem+1]);
for (; blitItem < numBlitItems && blitKey.m_view <= view; blitItem++)
{
const BlitItem& bi = _render->m_blitItem[blitItem];
blitKey.decode(_render->m_blitKeys[blitItem + 1]);
const TextureGL& src = m_textures[bi.m_src.idx];
const TextureGL& dst = m_textures[bi.m_dst.idx];
const TextureGL& src = m_textures[bi.m_src.idx];
const TextureGL& dst = m_textures[bi.m_dst.idx];
uint32_t srcWidth = bx::uint32_min(src.m_width, bi.m_srcX + bi.m_width) - bi.m_srcX;
uint32_t srcHeight = bx::uint32_min(src.m_height, bi.m_srcY + bi.m_height) - bi.m_srcY;
uint32_t srcDepth = bx::uint32_min(src.m_depth, bi.m_srcZ + bi.m_depth) - bi.m_srcZ;
uint32_t dstWidth = bx::uint32_min(dst.m_width, bi.m_dstX + bi.m_width) - bi.m_dstX;
uint32_t dstHeight = bx::uint32_min(dst.m_height, bi.m_dstY + bi.m_height) - bi.m_dstY;
uint32_t dstDepth = bx::uint32_min(dst.m_depth, bi.m_dstZ + bi.m_depth) - bi.m_dstZ;
uint32_t width = bx::uint32_min(srcWidth, dstWidth);
uint32_t height = bx::uint32_min(srcHeight, dstHeight);
uint32_t depth = bx::uint32_min(srcDepth, dstDepth);
uint32_t srcWidth = bx::uint32_min(src.m_width, bi.m_srcX + bi.m_width) - bi.m_srcX;
uint32_t srcHeight = bx::uint32_min(src.m_height, bi.m_srcY + bi.m_height) - bi.m_srcY;
uint32_t srcDepth = bx::uint32_min(src.m_depth, bi.m_srcZ + bi.m_depth) - bi.m_srcZ;
uint32_t dstWidth = bx::uint32_min(dst.m_width, bi.m_dstX + bi.m_width) - bi.m_dstX;
uint32_t dstHeight = bx::uint32_min(dst.m_height, bi.m_dstY + bi.m_height) - bi.m_dstY;
uint32_t dstDepth = bx::uint32_min(dst.m_depth, bi.m_dstZ + bi.m_depth) - bi.m_dstZ;
uint32_t width = bx::uint32_min(srcWidth, dstWidth);
uint32_t height = bx::uint32_min(srcHeight, dstHeight);
uint32_t depth = bx::uint32_min(srcDepth, dstDepth);
GL_CHECK(glCopyImageSubData(src.m_id
, src.m_target
, bi.m_srcMip
, bi.m_srcX
, bi.m_srcY
, bi.m_srcZ
, dst.m_id
, dst.m_target
, bi.m_dstMip
, bi.m_dstX
, bi.m_dstY
, bi.m_dstZ
, width
, height
, bx::uint32_max(depth, 1)
) );
GL_CHECK(glCopyImageSubData(src.m_id
, src.m_target
, bi.m_srcMip
, bi.m_srcX
, bi.m_srcY
, bi.m_srcZ
, dst.m_id
, dst.m_target
, bi.m_dstMip
, bi.m_dstX
, bi.m_dstY
, bi.m_dstZ
, width
, height
, bx::uint32_max(depth, 1)
) );
}
}
}