Fix buffer to 3D texture copy (#1354)
This commit is contained in:
parent
bf87f02c0c
commit
76e5af967a
@ -44,6 +44,7 @@ namespace Ryujinx.Graphics.Gpu.Engine
|
|||||||
cbp.SrcStride,
|
cbp.SrcStride,
|
||||||
srcLinear,
|
srcLinear,
|
||||||
src.MemoryLayout.UnpackGobBlocksInY(),
|
src.MemoryLayout.UnpackGobBlocksInY(),
|
||||||
|
src.MemoryLayout.UnpackGobBlocksInZ(),
|
||||||
srcBpp);
|
srcBpp);
|
||||||
|
|
||||||
var dstCalculator = new OffsetCalculator(
|
var dstCalculator = new OffsetCalculator(
|
||||||
@ -52,6 +53,7 @@ namespace Ryujinx.Graphics.Gpu.Engine
|
|||||||
cbp.DstStride,
|
cbp.DstStride,
|
||||||
dstLinear,
|
dstLinear,
|
||||||
dst.MemoryLayout.UnpackGobBlocksInY(),
|
dst.MemoryLayout.UnpackGobBlocksInY(),
|
||||||
|
dst.MemoryLayout.UnpackGobBlocksInZ(),
|
||||||
dstBpp);
|
dstBpp);
|
||||||
|
|
||||||
ulong srcBaseAddress = _context.MemoryManager.Translate(cbp.SrcAddress.Pack());
|
ulong srcBaseAddress = _context.MemoryManager.Translate(cbp.SrcAddress.Pack());
|
||||||
@ -70,7 +72,7 @@ namespace Ryujinx.Graphics.Gpu.Engine
|
|||||||
{
|
{
|
||||||
srcSpan.CopyTo(dstSpan); // No layout conversion has to be performed, just copy the data entirely.
|
srcSpan.CopyTo(dstSpan); // No layout conversion has to be performed, just copy the data entirely.
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
unsafe bool Convert<T>(Span<byte> dstSpan, ReadOnlySpan<byte> srcSpan) where T : unmanaged
|
unsafe bool Convert<T>(Span<byte> dstSpan, ReadOnlySpan<byte> srcSpan) where T : unmanaged
|
||||||
{
|
{
|
||||||
|
@ -41,7 +41,6 @@ namespace Ryujinx.Graphics.Texture
|
|||||||
public BlockLinearLayout(
|
public BlockLinearLayout(
|
||||||
int width,
|
int width,
|
||||||
int height,
|
int height,
|
||||||
int depth,
|
|
||||||
int gobBlocksInY,
|
int gobBlocksInY,
|
||||||
int gobBlocksInZ,
|
int gobBlocksInZ,
|
||||||
int bpp)
|
int bpp)
|
||||||
|
@ -84,7 +84,6 @@ namespace Ryujinx.Graphics.Texture
|
|||||||
BlockLinearLayout layoutConverter = new BlockLinearLayout(
|
BlockLinearLayout layoutConverter = new BlockLinearLayout(
|
||||||
wAligned,
|
wAligned,
|
||||||
h,
|
h,
|
||||||
d,
|
|
||||||
mipGobBlocksInY,
|
mipGobBlocksInY,
|
||||||
mipGobBlocksInZ,
|
mipGobBlocksInZ,
|
||||||
bytesPerPixel);
|
bytesPerPixel);
|
||||||
@ -256,7 +255,6 @@ namespace Ryujinx.Graphics.Texture
|
|||||||
BlockLinearLayout layoutConverter = new BlockLinearLayout(
|
BlockLinearLayout layoutConverter = new BlockLinearLayout(
|
||||||
wAligned,
|
wAligned,
|
||||||
h,
|
h,
|
||||||
d,
|
|
||||||
mipGobBlocksInY,
|
mipGobBlocksInY,
|
||||||
mipGobBlocksInZ,
|
mipGobBlocksInZ,
|
||||||
bytesPerPixel);
|
bytesPerPixel);
|
||||||
|
@ -23,6 +23,7 @@ namespace Ryujinx.Graphics.Texture
|
|||||||
int stride,
|
int stride,
|
||||||
bool isLinear,
|
bool isLinear,
|
||||||
int gobBlocksInY,
|
int gobBlocksInY,
|
||||||
|
int gobBlocksInZ,
|
||||||
int bytesPerPixel)
|
int bytesPerPixel)
|
||||||
{
|
{
|
||||||
_width = width;
|
_width = width;
|
||||||
@ -40,13 +41,22 @@ namespace Ryujinx.Graphics.Texture
|
|||||||
_layoutConverter = new BlockLinearLayout(
|
_layoutConverter = new BlockLinearLayout(
|
||||||
wAligned,
|
wAligned,
|
||||||
height,
|
height,
|
||||||
1,
|
|
||||||
gobBlocksInY,
|
gobBlocksInY,
|
||||||
1,
|
gobBlocksInZ,
|
||||||
bytesPerPixel);
|
bytesPerPixel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public OffsetCalculator(
|
||||||
|
int width,
|
||||||
|
int height,
|
||||||
|
int stride,
|
||||||
|
bool isLinear,
|
||||||
|
int gobBlocksInY,
|
||||||
|
int bytesPerPixel) : this(width, height, stride, isLinear, gobBlocksInY, 1, bytesPerPixel)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
public void SetY(int y)
|
public void SetY(int y)
|
||||||
{
|
{
|
||||||
if (_isLinear)
|
if (_isLinear)
|
||||||
|
Loading…
Reference in New Issue
Block a user