Rebase + GAL Changes
This commit is contained in:
parent
00b99770a2
commit
722aa4e45d
5 changed files with 33 additions and 9 deletions
|
@ -1,9 +1,11 @@
|
|||
using Ryujinx.Common.Logging;
|
||||
using Ryujinx.Graphics.GAL;
|
||||
using SharpMetal.Metal;
|
||||
using System.Runtime.Versioning;
|
||||
|
||||
namespace Ryujinx.Graphics.Metal
|
||||
{
|
||||
[SupportedOSPlatform("macos")]
|
||||
static class EnumConversion
|
||||
{
|
||||
public static MTLSamplerAddressMode Convert(this AddressMode mode)
|
||||
|
|
|
@ -70,6 +70,11 @@ namespace Ryujinx.Graphics.Metal
|
|||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public IImageArray CreateImageArray(int size, bool isBuffer)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public BufferHandle CreateBuffer(int size, BufferAccess access)
|
||||
{
|
||||
var buffer = _device.NewBuffer((ulong)size, MTLResourceOptions.ResourceStorageModeShared);
|
||||
|
@ -100,6 +105,11 @@ namespace Ryujinx.Graphics.Metal
|
|||
return texture;
|
||||
}
|
||||
|
||||
public ITextureArray CreateTextureArray(int size, bool isBuffer)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public bool PrepareHostMapping(IntPtr address, ulong size)
|
||||
{
|
||||
// TODO: Metal Host Mapping
|
||||
|
@ -157,6 +167,8 @@ namespace Ryujinx.Graphics.Metal
|
|||
supportsCubemapView: true,
|
||||
supportsNonConstantTextureOffset: false,
|
||||
supportsScaledVertexFormats: true,
|
||||
// TODO: Metal Bindless Support
|
||||
supportsSeparateSampler: false,
|
||||
supportsShaderBallot: false,
|
||||
supportsShaderBarrierDivergence: false,
|
||||
supportsShaderFloat64: false,
|
||||
|
|
|
@ -428,6 +428,11 @@ namespace Ryujinx.Graphics.Metal
|
|||
Logger.Warning?.Print(LogClass.Gpu, "Not Implemented!");
|
||||
}
|
||||
|
||||
public void SetImageArray(ShaderStage stage, int binding, IImageArray array)
|
||||
{
|
||||
Logger.Warning?.Print(LogClass.Gpu, "Not Implemented!");
|
||||
}
|
||||
|
||||
public void SetLineParameters(float width, bool smooth)
|
||||
{
|
||||
// Not supported in Metal
|
||||
|
@ -644,6 +649,11 @@ namespace Ryujinx.Graphics.Metal
|
|||
}
|
||||
}
|
||||
|
||||
public void SetTextureArray(ShaderStage stage, int binding, ITextureArray array)
|
||||
{
|
||||
Logger.Warning?.Print(LogClass.Gpu, "Not Implemented!");
|
||||
}
|
||||
|
||||
public void SetUniformBuffers(ReadOnlySpan<BufferAssignment> buffers)
|
||||
{
|
||||
_uniformBuffers = [];
|
||||
|
|
|
@ -3,6 +3,7 @@ using Ryujinx.Common.Memory;
|
|||
using Ryujinx.Graphics.GAL;
|
||||
using SharpMetal.Metal;
|
||||
using System;
|
||||
using System.Buffers;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.Versioning;
|
||||
|
||||
|
@ -170,11 +171,11 @@ namespace Ryujinx.Graphics.Metal
|
|||
}
|
||||
|
||||
// TODO: Handle array formats
|
||||
public unsafe void SetData(SpanOrArray<byte> data)
|
||||
public unsafe void SetData(IMemoryOwner<byte> data)
|
||||
{
|
||||
var blitCommandEncoder = _pipeline.GetOrCreateBlitEncoder();
|
||||
|
||||
var dataSpan = data.Span;
|
||||
var dataSpan = data.Memory.Span;
|
||||
var mtlBuffer = _device.NewBuffer((ulong)dataSpan.Length, MTLResourceOptions.ResourceStorageModeShared);
|
||||
var bufferSpan = new Span<byte>(mtlBuffer.Contents.ToPointer(), dataSpan.Length);
|
||||
dataSpan.CopyTo(bufferSpan);
|
||||
|
@ -222,7 +223,7 @@ namespace Ryujinx.Graphics.Metal
|
|||
}
|
||||
}
|
||||
|
||||
public void SetData(SpanOrArray<byte> data, int layer, int level)
|
||||
public void SetData(IMemoryOwner<byte> data, int layer, int level)
|
||||
{
|
||||
var blitCommandEncoder = _pipeline.GetOrCreateBlitEncoder();
|
||||
|
||||
|
@ -235,7 +236,7 @@ namespace Ryujinx.Graphics.Metal
|
|||
|
||||
unsafe
|
||||
{
|
||||
var dataSpan = data.Span;
|
||||
var dataSpan = data.Memory.Span;
|
||||
var mtlBuffer = _device.NewBuffer((ulong)dataSpan.Length, MTLResourceOptions.ResourceStorageModeShared);
|
||||
var bufferSpan = new Span<byte>(mtlBuffer.Contents.ToPointer(), dataSpan.Length);
|
||||
dataSpan.CopyTo(bufferSpan);
|
||||
|
@ -254,7 +255,7 @@ namespace Ryujinx.Graphics.Metal
|
|||
}
|
||||
}
|
||||
|
||||
public void SetData(SpanOrArray<byte> data, int layer, int level, Rectangle<int> region)
|
||||
public void SetData(IMemoryOwner<byte> data, int layer, int level, Rectangle<int> region)
|
||||
{
|
||||
var blitCommandEncoder = _pipeline.GetOrCreateBlitEncoder();
|
||||
|
||||
|
@ -267,7 +268,7 @@ namespace Ryujinx.Graphics.Metal
|
|||
|
||||
unsafe
|
||||
{
|
||||
var dataSpan = data.Span;
|
||||
var dataSpan = data.Memory.Span;
|
||||
var mtlBuffer = _device.NewBuffer((ulong)dataSpan.Length, MTLResourceOptions.ResourceStorageModeShared);
|
||||
var bufferSpan = new Span<byte>(mtlBuffer.Contents.ToPointer(), dataSpan.Length);
|
||||
dataSpan.CopyTo(bufferSpan);
|
||||
|
|
|
@ -1054,6 +1054,7 @@ namespace Ryujinx.Ava
|
|||
{
|
||||
GraphicsBackend.Vulkan => "Vulkan",
|
||||
GraphicsBackend.OpenGl => "OpenGL",
|
||||
GraphicsBackend.Metal => "Metal",
|
||||
_ => throw new NotImplementedException()
|
||||
},
|
||||
$"GPU: {_renderer.GetHardwareInfo().GpuDriver}"));
|
||||
|
@ -1072,12 +1073,10 @@ namespace Ryujinx.Ava
|
|||
StatusUpdatedEvent?.Invoke(this, new StatusUpdatedEventArgs(
|
||||
Device.EnableDeviceVsync,
|
||||
LocaleManager.Instance[LocaleKeys.VolumeShort] + $": {(int)(Device.GetVolume() * 100)}%",
|
||||
ConfigurationState.Instance.Graphics.GraphicsBackend.Value.ToString(),
|
||||
dockedMode,
|
||||
ConfigurationState.Instance.Graphics.AspectRatio.Value.ToText(),
|
||||
LocaleManager.Instance[LocaleKeys.Game] + $": {Device.Statistics.GetGameFrameRate():00.00} FPS ({Device.Statistics.GetGameFrameTime():00.00} ms)",
|
||||
$"FIFO: {Device.Statistics.GetFifoPercent():00.00} %",
|
||||
$"GPU: {_renderer.GetHardwareInfo().GpuDriver}"));
|
||||
$"FIFO: {Device.Statistics.GetFifoPercent():00.00} %"));
|
||||
}
|
||||
|
||||
public async Task ShowExitPrompt()
|
||||
|
|
Loading…
Reference in a new issue