mirror of
https://github.com/bkaradzic/bgfx.git
synced 2026-02-17 20:52:36 +01:00
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:
@@ -3955,16 +3955,7 @@ namespace bgfx { namespace webgpu
|
||||
const TextureWgpu& src = m_textures[blit.m_src.idx];
|
||||
const TextureWgpu& dst = m_textures[blit.m_dst.idx];
|
||||
|
||||
uint32_t srcWidth = bx::uint32_min(src.m_width, blit.m_srcX + blit.m_width) - blit.m_srcX;
|
||||
uint32_t srcHeight = bx::uint32_min(src.m_height, blit.m_srcY + blit.m_height) - blit.m_srcY;
|
||||
uint32_t srcDepth = bx::uint32_min(src.m_depth, blit.m_srcZ + blit.m_depth) - blit.m_srcZ;
|
||||
uint32_t dstWidth = bx::uint32_min(dst.m_width, blit.m_dstX + blit.m_width) - blit.m_dstX;
|
||||
uint32_t dstHeight = bx::uint32_min(dst.m_height, blit.m_dstY + blit.m_height) - blit.m_dstY;
|
||||
uint32_t dstDepth = bx::uint32_min(dst.m_depth, blit.m_dstZ + blit.m_depth) - blit.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);
|
||||
bool readBack = !!(dst.m_flags & BGFX_TEXTURE_READ_BACK);
|
||||
bool readBack = !!(dst.m_flags & BGFX_TEXTURE_READ_BACK);
|
||||
|
||||
wgpu::TextureCopyView srcView;
|
||||
srcView.texture = src.m_ptr;
|
||||
@@ -3978,14 +3969,14 @@ namespace bgfx { namespace webgpu
|
||||
dstView.mipLevel = blit.m_dstMip;
|
||||
dstView.arrayLayer = blit.m_dstZ;
|
||||
|
||||
if (depth == 0)
|
||||
if (blit.m_depth == 0)
|
||||
{
|
||||
wgpu::Extent3D copyExtent = { width, height, 1 };
|
||||
wgpu::Extent3D copyExtent = { blit.m_width, blit.m_height, 1 };
|
||||
bce.CopyTextureToTexture(&srcView, &dstView, ©Extent);
|
||||
}
|
||||
else
|
||||
{
|
||||
wgpu::Extent3D copyExtent = { width, height, depth };
|
||||
wgpu::Extent3D copyExtent = { blit.m_width, blit.m_height, blit.m_depth };
|
||||
bce.CopyTextureToTexture(&srcView, &dstView, ©Extent);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user