mirror of
https://github.com/cemu-project/Cemu.git
synced 2025-07-07 07:21:18 +12:00
add texture copy block size workaround
This commit is contained in:
parent
aec7a182ce
commit
21bc5f247b
1 changed files with 12 additions and 0 deletions
|
@ -762,6 +762,18 @@ void MetalRenderer::texture_setLatteTexture(LatteTextureView* textureView, uint3
|
||||||
|
|
||||||
void MetalRenderer::texture_copyImageSubData(LatteTexture* src, sint32 srcMip, sint32 effectiveSrcX, sint32 effectiveSrcY, sint32 srcSlice, LatteTexture* dst, sint32 dstMip, sint32 effectiveDstX, sint32 effectiveDstY, sint32 dstSlice, sint32 effectiveCopyWidth, sint32 effectiveCopyHeight, sint32 srcDepth_)
|
void MetalRenderer::texture_copyImageSubData(LatteTexture* src, sint32 srcMip, sint32 effectiveSrcX, sint32 effectiveSrcY, sint32 srcSlice, LatteTexture* dst, sint32 dstMip, sint32 effectiveDstX, sint32 effectiveDstY, sint32 dstSlice, sint32 effectiveCopyWidth, sint32 effectiveCopyHeight, sint32 srcDepth_)
|
||||||
{
|
{
|
||||||
|
// Source size seems to apply to the destination texture as well, therefore we need to adjust it when block size doesn't match
|
||||||
|
Uvec2 srcBlockTexelSize = GetMtlPixelFormatInfo(src->format, src->isDepth).blockTexelSize;
|
||||||
|
Uvec2 dstBlockTexelSize = GetMtlPixelFormatInfo(dst->format, dst->isDepth).blockTexelSize;
|
||||||
|
if (srcBlockTexelSize.x != dstBlockTexelSize.x || srcBlockTexelSize.y != dstBlockTexelSize.y)
|
||||||
|
{
|
||||||
|
uint32 multX = (srcBlockTexelSize.x > dstBlockTexelSize.x ? srcBlockTexelSize.x / dstBlockTexelSize.x : dstBlockTexelSize.x / srcBlockTexelSize.x);
|
||||||
|
effectiveCopyWidth *= multX;
|
||||||
|
|
||||||
|
uint32 multY = (srcBlockTexelSize.y > dstBlockTexelSize.y ? srcBlockTexelSize.y / dstBlockTexelSize.y : dstBlockTexelSize.y / srcBlockTexelSize.y);
|
||||||
|
effectiveCopyHeight *= multY;
|
||||||
|
}
|
||||||
|
|
||||||
auto blitCommandEncoder = GetBlitCommandEncoder();
|
auto blitCommandEncoder = GetBlitCommandEncoder();
|
||||||
|
|
||||||
auto mtlSrc = static_cast<LatteTextureMtl*>(src)->GetTexture();
|
auto mtlSrc = static_cast<LatteTextureMtl*>(src)->GetTexture();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue