1
0
Fork 0
mirror of https://github.com/Ryujinx/Ryujinx.git synced 2024-12-19 04:52:01 +00:00

Stencil Fixes

This commit is contained in:
Isaac Marovitz 2024-05-27 21:46:43 -04:00 committed by Isaac Marovitz
parent 1b86360a61
commit 0a6f11d247
2 changed files with 4 additions and 19 deletions

View file

@ -141,9 +141,7 @@ namespace Ryujinx.Graphics.Metal
depthAttachment.LoadAction = MTLLoadAction.Load; depthAttachment.LoadAction = MTLLoadAction.Load;
depthAttachment.StoreAction = MTLStoreAction.Store; depthAttachment.StoreAction = MTLStoreAction.Store;
var unpackedFormat = FormatTable.PackedStencilToXFormat(_currentState.DepthStencil.MTLTexture.PixelFormat); stencilAttachment.Texture = _currentState.DepthStencil.MTLTexture;
var stencilView = _currentState.DepthStencil.MTLTexture.NewTextureView(unpackedFormat);
stencilAttachment.Texture = stencilView;
stencilAttachment.LoadAction = MTLLoadAction.Load; stencilAttachment.LoadAction = MTLLoadAction.Load;
stencilAttachment.StoreAction = MTLStoreAction.Store; stencilAttachment.StoreAction = MTLStoreAction.Store;
break; break;

View file

@ -171,29 +171,16 @@ namespace Ryujinx.Graphics.Metal
{ {
var mtlFormat = _table[(int)format]; var mtlFormat = _table[(int)format];
if (mtlFormat == MTLPixelFormat.Depth24UnormStencil8 || mtlFormat == MTLPixelFormat.Depth32FloatStencil8) if (mtlFormat == MTLPixelFormat.Depth24UnormStencil8)
{ {
if (!MTLDevice.CreateSystemDefaultDevice().Depth24Stencil8PixelFormatSupported) if (!MTLDevice.CreateSystemDefaultDevice().Depth24Stencil8PixelFormatSupported)
{ {
mtlFormat = MTLPixelFormat.Depth32Float; Logger.Error?.PrintMsg(LogClass.Gpu, "Application requested Depth24Stencil8, which is unsupported on this device!");
mtlFormat = MTLPixelFormat.Depth32FloatStencil8;
} }
} }
return mtlFormat; return mtlFormat;
} }
public static MTLPixelFormat PackedStencilToXFormat(MTLPixelFormat format)
{
switch (format)
{
case MTLPixelFormat.Depth24UnormStencil8:
return MTLPixelFormat.X24Stencil8;
case MTLPixelFormat.Depth32FloatStencil8:
return MTLPixelFormat.X32Stencil8;
default:
Logger.Warning?.PrintMsg(LogClass.Gpu, $"Attempted to get stencil format for non packed format {format}!");
return MTLPixelFormat.Invalid;
}
}
} }
} }