Mip + blit fixes (#2281)

* D3D12: Fix readback for non-zero mip

* Fix blit with non-zero mip

This required clamping the blit extents to the mip size, which is moved out of the renderers now

* Assert formatting
This commit is contained in:
pezcode
2020-10-10 00:32:50 +02:00
committed by GitHub
parent 7f2861eceb
commit 09c11bca29
9 changed files with 85 additions and 103 deletions

View File

@@ -6943,16 +6943,6 @@ namespace bgfx { namespace gl
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);
GL_CHECK(glCopyImageSubData(src.m_id
, src.m_target
, bi.m_srcMip
@@ -6965,9 +6955,9 @@ namespace bgfx { namespace gl
, bi.m_dstX
, bi.m_dstY
, bi.m_dstZ
, width
, height
, bx::uint32_imax(depth, 1)
, bi.m_width
, bi.m_height
, bx::uint32_imax(bi.m_depth, 1)
) );
}
}
@@ -6980,13 +6970,6 @@ namespace bgfx { namespace gl
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 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 width = bx::uint32_min(srcWidth, dstWidth);
uint32_t height = bx::uint32_min(srcHeight, dstHeight);
BX_ASSERT(0 == bi.m_srcZ && 0 == bi.m_dstZ && 0 == bi.m_depth
, "Blitting 3D regions is not supported"
);
@@ -7016,8 +6999,8 @@ namespace bgfx { namespace gl
, bi.m_dstY
, bi.m_srcX
, bi.m_srcY
, width
, height
, bi.m_width
, bi.m_height
) );
GL_CHECK(glDeleteFramebuffers(1, &fbo) );