mirror of
https://git.ryujinx.app/ryubing/ryujinx.git
synced 2025-12-14 19:36:59 +00:00
Merge branch 'gpu/dma-apple' into 'master'
Gpu: exclude RGBA16Float texture format for fast DMA copy on Apple silicon. See merge request [ryubing/ryujinx!206](https://git.ryujinx.app/ryubing/ryujinx/-/merge_requests/206)
This commit is contained in:
commit
016db915a3
4 changed files with 34 additions and 20 deletions
|
|
@ -27,6 +27,7 @@ namespace Ryujinx.Graphics.GAL
|
||||||
public readonly bool SupportsSparseBuffer;
|
public readonly bool SupportsSparseBuffer;
|
||||||
public readonly bool Supports5BitComponentFormat;
|
public readonly bool Supports5BitComponentFormat;
|
||||||
public readonly bool SupportsBlendEquationAdvanced;
|
public readonly bool SupportsBlendEquationAdvanced;
|
||||||
|
public readonly bool SupportsFastDmaTextureCopy;
|
||||||
public readonly bool SupportsFragmentShaderInterlock;
|
public readonly bool SupportsFragmentShaderInterlock;
|
||||||
public readonly bool SupportsFragmentShaderOrderingIntel;
|
public readonly bool SupportsFragmentShaderOrderingIntel;
|
||||||
public readonly bool SupportsGeometryShader;
|
public readonly bool SupportsGeometryShader;
|
||||||
|
|
@ -95,6 +96,7 @@ namespace Ryujinx.Graphics.GAL
|
||||||
bool supports5BitComponentFormat,
|
bool supports5BitComponentFormat,
|
||||||
bool supportsSparseBuffer,
|
bool supportsSparseBuffer,
|
||||||
bool supportsBlendEquationAdvanced,
|
bool supportsBlendEquationAdvanced,
|
||||||
|
bool supportsFastDmaTextureCopy,
|
||||||
bool supportsFragmentShaderInterlock,
|
bool supportsFragmentShaderInterlock,
|
||||||
bool supportsFragmentShaderOrderingIntel,
|
bool supportsFragmentShaderOrderingIntel,
|
||||||
bool supportsGeometryShader,
|
bool supportsGeometryShader,
|
||||||
|
|
@ -157,6 +159,7 @@ namespace Ryujinx.Graphics.GAL
|
||||||
Supports5BitComponentFormat = supports5BitComponentFormat;
|
Supports5BitComponentFormat = supports5BitComponentFormat;
|
||||||
SupportsSparseBuffer = supportsSparseBuffer;
|
SupportsSparseBuffer = supportsSparseBuffer;
|
||||||
SupportsBlendEquationAdvanced = supportsBlendEquationAdvanced;
|
SupportsBlendEquationAdvanced = supportsBlendEquationAdvanced;
|
||||||
|
SupportsFastDmaTextureCopy = supportsFastDmaTextureCopy;
|
||||||
SupportsFragmentShaderInterlock = supportsFragmentShaderInterlock;
|
SupportsFragmentShaderInterlock = supportsFragmentShaderInterlock;
|
||||||
SupportsFragmentShaderOrderingIntel = supportsFragmentShaderOrderingIntel;
|
SupportsFragmentShaderOrderingIntel = supportsFragmentShaderOrderingIntel;
|
||||||
SupportsGeometryShader = supportsGeometryShader;
|
SupportsGeometryShader = supportsGeometryShader;
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
using Ryujinx.Common;
|
using Ryujinx.Common;
|
||||||
using Ryujinx.Common.Memory;
|
using Ryujinx.Common.Memory;
|
||||||
using Ryujinx.Graphics.Device;
|
using Ryujinx.Graphics.Device;
|
||||||
|
using Ryujinx.Graphics.GAL;
|
||||||
using Ryujinx.Graphics.Gpu.Engine.Threed;
|
using Ryujinx.Graphics.Gpu.Engine.Threed;
|
||||||
using Ryujinx.Graphics.Gpu.Memory;
|
using Ryujinx.Graphics.Gpu.Memory;
|
||||||
using Ryujinx.Graphics.Texture;
|
using Ryujinx.Graphics.Texture;
|
||||||
|
|
@ -287,9 +288,9 @@ namespace Ryujinx.Graphics.Gpu.Engine.Dma
|
||||||
bool completeSource = IsTextureCopyComplete(src, srcLinear, srcBpp, srcStride, xCount, yCount);
|
bool completeSource = IsTextureCopyComplete(src, srcLinear, srcBpp, srcStride, xCount, yCount);
|
||||||
bool completeDest = IsTextureCopyComplete(dst, dstLinear, dstBpp, dstStride, 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.
|
// 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)
|
if (completeSource && completeDest && !srcLinear && isIdentityRemap)
|
||||||
{
|
{
|
||||||
|
|
@ -307,27 +308,35 @@ namespace Ryujinx.Graphics.Gpu.Engine.Dma
|
||||||
|
|
||||||
if (source != null && source.Height == yCount)
|
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;
|
||||||
|
|
||||||
Image.Texture target = memoryManager.Physical.TextureCache.FindOrCreateTexture(
|
if (!skipDma)
|
||||||
memoryManager,
|
|
||||||
source.Info.FormatInfo,
|
|
||||||
dstGpuVa,
|
|
||||||
xCount,
|
|
||||||
yCount,
|
|
||||||
dstStride,
|
|
||||||
dstLinear,
|
|
||||||
dst.MemoryLayout.UnpackGobBlocksInY(),
|
|
||||||
dst.MemoryLayout.UnpackGobBlocksInZ());
|
|
||||||
|
|
||||||
if (source.ScaleFactor != target.ScaleFactor)
|
|
||||||
{
|
{
|
||||||
target.PropagateScale(source);
|
source.SynchronizeMemory();
|
||||||
}
|
|
||||||
|
|
||||||
source.HostTexture.CopyTo(target.HostTexture, 0, 0);
|
Image.Texture target = memoryManager.Physical.TextureCache.FindOrCreateTexture(
|
||||||
target.SignalModified();
|
memoryManager,
|
||||||
return;
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -169,6 +169,7 @@ namespace Ryujinx.Graphics.OpenGL
|
||||||
supports5BitComponentFormat: true,
|
supports5BitComponentFormat: true,
|
||||||
supportsSparseBuffer: false,
|
supportsSparseBuffer: false,
|
||||||
supportsBlendEquationAdvanced: HwCapabilities.SupportsBlendEquationAdvanced,
|
supportsBlendEquationAdvanced: HwCapabilities.SupportsBlendEquationAdvanced,
|
||||||
|
supportsFastDmaTextureCopy: true,
|
||||||
supportsFragmentShaderInterlock: HwCapabilities.SupportsFragmentShaderInterlock,
|
supportsFragmentShaderInterlock: HwCapabilities.SupportsFragmentShaderInterlock,
|
||||||
supportsFragmentShaderOrderingIntel: HwCapabilities.SupportsFragmentShaderOrdering,
|
supportsFragmentShaderOrderingIntel: HwCapabilities.SupportsFragmentShaderOrdering,
|
||||||
supportsGeometryShader: true,
|
supportsGeometryShader: true,
|
||||||
|
|
|
||||||
|
|
@ -760,6 +760,7 @@ namespace Ryujinx.Graphics.Vulkan
|
||||||
supports5BitComponentFormat: supports5BitComponentFormat,
|
supports5BitComponentFormat: supports5BitComponentFormat,
|
||||||
supportsSparseBuffer: features2.Features.SparseBinding && mainQueueProperties.QueueFlags.HasFlag(QueueFlags.SparseBindingBit),
|
supportsSparseBuffer: features2.Features.SparseBinding && mainQueueProperties.QueueFlags.HasFlag(QueueFlags.SparseBindingBit),
|
||||||
supportsBlendEquationAdvanced: Capabilities.SupportsBlendEquationAdvanced,
|
supportsBlendEquationAdvanced: Capabilities.SupportsBlendEquationAdvanced,
|
||||||
|
supportsFastDmaTextureCopy: !IsMoltenVk,
|
||||||
supportsFragmentShaderInterlock: Capabilities.SupportsFragmentShaderInterlock,
|
supportsFragmentShaderInterlock: Capabilities.SupportsFragmentShaderInterlock,
|
||||||
supportsFragmentShaderOrderingIntel: false,
|
supportsFragmentShaderOrderingIntel: false,
|
||||||
supportsGeometryShader: Capabilities.SupportsGeometryShader,
|
supportsGeometryShader: Capabilities.SupportsGeometryShader,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue