mirror of
https://git.ryujinx.app/projects/Kenji-NX.git
synced 2026-10-10 20:28:51 +02:00
Gpu: exclude RGBA16Float texture format for fast DMA copy on Apple silicon.
* Store a boolean for if Fast DMA texture copy is supported instead of checking vendor every time
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
using Ryujinx.Common;
|
||||
using Ryujinx.Common.Memory;
|
||||
using Ryujinx.Graphics.Device;
|
||||
using Ryujinx.Graphics.GAL;
|
||||
using Ryujinx.Graphics.Gpu.Engine.Threed;
|
||||
using Ryujinx.Graphics.Gpu.Memory;
|
||||
using Ryujinx.Graphics.Texture;
|
||||
@@ -287,9 +288,9 @@ namespace Ryujinx.Graphics.Gpu.Engine.Dma
|
||||
bool completeSource = IsTextureCopyComplete(src, srcLinear, srcBpp, srcStride, xCount, yCount);
|
||||
bool completeDest = IsTextureCopyComplete(dst, dstLinear, dstBpp, dstStride, xCount, yCount);
|
||||
|
||||
// Check if the source texture exists on the GPU, if it does, do a GPU side copy.
|
||||
// Check if the source texture exists on the GPU, if it does, do a GPU-side copy.
|
||||
// Otherwise, we would need to flush the source texture which is costly.
|
||||
// We don't expect the source to be linear in such cases, as linear source usually indicates buffer or CPU written data.
|
||||
// We don't expect the source to be linear in such cases, as linear source usually indicates buffer or CPU-written data.
|
||||
|
||||
if (completeSource && completeDest && !srcLinear && isIdentityRemap)
|
||||
{
|
||||
@@ -307,27 +308,35 @@ namespace Ryujinx.Graphics.Gpu.Engine.Dma
|
||||
|
||||
if (source != null && source.Height == yCount)
|
||||
{
|
||||
source.SynchronizeMemory();
|
||||
// HACK: Exclude RGBA16Float texture format for fast DMA copy on Apple Silicon.
|
||||
// Fixes Sonic Frontiers when VK_EXT_external_memory_host is not available.
|
||||
bool skipDma = !_context.Capabilities.SupportsFastDmaTextureCopy &&
|
||||
source.Info.FormatInfo.Format == Format.R16G16B16A16Float;
|
||||
|
||||
var target = memoryManager.Physical.TextureCache.FindOrCreateTexture(
|
||||
memoryManager,
|
||||
source.Info.FormatInfo,
|
||||
dstGpuVa,
|
||||
xCount,
|
||||
yCount,
|
||||
dstStride,
|
||||
dstLinear,
|
||||
dst.MemoryLayout.UnpackGobBlocksInY(),
|
||||
dst.MemoryLayout.UnpackGobBlocksInZ());
|
||||
|
||||
if (source.ScaleFactor != target.ScaleFactor)
|
||||
if (!skipDma)
|
||||
{
|
||||
target.PropagateScale(source);
|
||||
}
|
||||
source.SynchronizeMemory();
|
||||
|
||||
source.HostTexture.CopyTo(target.HostTexture, 0, 0);
|
||||
target.SignalModified();
|
||||
return;
|
||||
var target = memoryManager.Physical.TextureCache.FindOrCreateTexture(
|
||||
memoryManager,
|
||||
source.Info.FormatInfo,
|
||||
dstGpuVa,
|
||||
xCount,
|
||||
yCount,
|
||||
dstStride,
|
||||
dstLinear,
|
||||
dst.MemoryLayout.UnpackGobBlocksInY(),
|
||||
dst.MemoryLayout.UnpackGobBlocksInZ());
|
||||
|
||||
if (source.ScaleFactor != target.ScaleFactor)
|
||||
{
|
||||
target.PropagateScale(source);
|
||||
}
|
||||
|
||||
source.HostTexture.CopyTo(target.HostTexture, 0, 0);
|
||||
target.SignalModified();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user