This commit is contained in:
Isaac Marovitz 2024-05-18 20:40:37 -04:00 committed by Isaac Marovitz
parent 45b533b23b
commit c97e7d621b
3 changed files with 11 additions and 10 deletions

View file

@ -14,16 +14,15 @@ namespace Ryujinx.Graphics.Metal
struct EncoderStateManager struct EncoderStateManager
{ {
private readonly MTLDevice _device; private readonly MTLDevice _device;
private Pipeline _pipeline; private readonly Pipeline _pipeline;
private EncoderState _currentState = new(); private EncoderState _currentState = new();
private EncoderState _backState = new(); private EncoderState _backState = new();
// Public accessors public readonly MTLBuffer IndexBuffer => _currentState.IndexBuffer;
public MTLBuffer IndexBuffer => _currentState.IndexBuffer; public readonly MTLIndexType IndexType => _currentState.IndexType;
public MTLIndexType IndexType => _currentState.IndexType; public readonly ulong IndexBufferOffset => _currentState.IndexBufferOffset;
public ulong IndexBufferOffset => _currentState.IndexBufferOffset; public readonly PrimitiveTopology Topology => _currentState.Topology;
public PrimitiveTopology Topology => _currentState.Topology;
public EncoderStateManager(MTLDevice device, Pipeline pipeline) public EncoderStateManager(MTLDevice device, Pipeline pipeline)
{ {
@ -495,7 +494,7 @@ namespace Ryujinx.Graphics.Metal
} }
// Inlineable // Inlineable
public void UpdateTextureAndSampler(ShaderStage stage, ulong binding, MTLTexture texture, MTLSamplerState sampler) public readonly void UpdateTextureAndSampler(ShaderStage stage, ulong binding, MTLTexture texture, MTLSamplerState sampler)
{ {
switch (stage) switch (stage)
{ {

View file

@ -186,8 +186,10 @@ namespace Ryujinx.Graphics.Metal
{ {
switch (format) switch (format)
{ {
case MTLPixelFormat.Depth24UnormStencil8: return MTLPixelFormat.X24Stencil8; case MTLPixelFormat.Depth24UnormStencil8:
case MTLPixelFormat.Depth32FloatStencil8: return MTLPixelFormat.X32Stencil8; return MTLPixelFormat.X24Stencil8;
case MTLPixelFormat.Depth32FloatStencil8:
return MTLPixelFormat.X32Stencil8;
default: default:
Logger.Warning?.PrintMsg(LogClass.Gpu, $"Attempted to get stencil format for non packed format {format}!"); Logger.Warning?.PrintMsg(LogClass.Gpu, $"Attempted to get stencil format for non packed format {format}!");
return MTLPixelFormat.Invalid; return MTLPixelFormat.Invalid;

View file

@ -19,8 +19,8 @@ namespace Ryujinx.Graphics.Metal
class HelperShader : IDisposable class HelperShader : IDisposable
{ {
private const string ShadersSourcePath = "/Ryujinx.Graphics.Metal/Shaders"; private const string ShadersSourcePath = "/Ryujinx.Graphics.Metal/Shaders";
private readonly Pipeline _pipeline;
private MTLDevice _device; private MTLDevice _device;
private Pipeline _pipeline;
private readonly IProgram _programColorBlit; private readonly IProgram _programColorBlit;
private readonly IProgram _programColorClearF; private readonly IProgram _programColorClearF;