mirror of
https://github.com/GreemDev/Ryujinx.git
synced 2024-12-01 04:57:18 +01:00
Fix StoreActions & Don’t Clamp Scissor for Now
This commit is contained in:
parent
bd3df5f26a
commit
e1279f67fe
@ -1,7 +1,6 @@
|
|||||||
using Ryujinx.Common.Logging;
|
using Ryujinx.Common.Logging;
|
||||||
using Ryujinx.Graphics.GAL;
|
using Ryujinx.Graphics.GAL;
|
||||||
using Ryujinx.Graphics.Shader;
|
using Ryujinx.Graphics.Shader;
|
||||||
using SharpMetal.Foundation;
|
|
||||||
using SharpMetal.Metal;
|
using SharpMetal.Metal;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@ -57,6 +56,7 @@ namespace Ryujinx.Graphics.Metal
|
|||||||
var passAttachment = renderPassDescriptor.ColorAttachments.Object((ulong)i);
|
var passAttachment = renderPassDescriptor.ColorAttachments.Object((ulong)i);
|
||||||
passAttachment.Texture = _currentState.RenderTargets[i].MTLTexture;
|
passAttachment.Texture = _currentState.RenderTargets[i].MTLTexture;
|
||||||
passAttachment.LoadAction = MTLLoadAction.Load;
|
passAttachment.LoadAction = MTLLoadAction.Load;
|
||||||
|
passAttachment.StoreAction = MTLStoreAction.Store;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -72,12 +72,14 @@ namespace Ryujinx.Graphics.Metal
|
|||||||
case MTLPixelFormat.Depth32Float:
|
case MTLPixelFormat.Depth32Float:
|
||||||
depthAttachment.Texture = _currentState.DepthStencil.MTLTexture;
|
depthAttachment.Texture = _currentState.DepthStencil.MTLTexture;
|
||||||
depthAttachment.LoadAction = MTLLoadAction.Load;
|
depthAttachment.LoadAction = MTLLoadAction.Load;
|
||||||
|
depthAttachment.StoreAction = MTLStoreAction.Store;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// Stencil Only Attachment
|
// Stencil Only Attachment
|
||||||
case MTLPixelFormat.Stencil8:
|
case MTLPixelFormat.Stencil8:
|
||||||
stencilAttachment.Texture = _currentState.DepthStencil.MTLTexture;
|
stencilAttachment.Texture = _currentState.DepthStencil.MTLTexture;
|
||||||
stencilAttachment.LoadAction = MTLLoadAction.Load;
|
stencilAttachment.LoadAction = MTLLoadAction.Load;
|
||||||
|
stencilAttachment.StoreAction = MTLStoreAction.Store;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// Combined Attachment
|
// Combined Attachment
|
||||||
@ -85,11 +87,13 @@ namespace Ryujinx.Graphics.Metal
|
|||||||
case MTLPixelFormat.Depth32FloatStencil8:
|
case MTLPixelFormat.Depth32FloatStencil8:
|
||||||
depthAttachment.Texture = _currentState.DepthStencil.MTLTexture;
|
depthAttachment.Texture = _currentState.DepthStencil.MTLTexture;
|
||||||
depthAttachment.LoadAction = MTLLoadAction.Load;
|
depthAttachment.LoadAction = MTLLoadAction.Load;
|
||||||
|
depthAttachment.StoreAction = MTLStoreAction.Store;
|
||||||
|
|
||||||
var unpackedFormat = FormatTable.PackedStencilToXFormat(_currentState.DepthStencil.MTLTexture.PixelFormat);
|
var unpackedFormat = FormatTable.PackedStencilToXFormat(_currentState.DepthStencil.MTLTexture.PixelFormat);
|
||||||
var stencilView = _currentState.DepthStencil.MTLTexture.NewTextureView(unpackedFormat);
|
var stencilView = _currentState.DepthStencil.MTLTexture.NewTextureView(unpackedFormat);
|
||||||
stencilAttachment.Texture = stencilView;
|
stencilAttachment.Texture = stencilView;
|
||||||
stencilAttachment.LoadAction = MTLLoadAction.Load;
|
stencilAttachment.LoadAction = MTLLoadAction.Load;
|
||||||
|
stencilAttachment.StoreAction = MTLStoreAction.Store;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
Logger.Error?.PrintMsg(LogClass.Gpu, $"Unsupported Depth/Stencil Format: {_currentState.DepthStencil.MTLTexture.PixelFormat}!");
|
Logger.Error?.PrintMsg(LogClass.Gpu, $"Unsupported Depth/Stencil Format: {_currentState.DepthStencil.MTLTexture.PixelFormat}!");
|
||||||
@ -385,8 +389,8 @@ namespace Ryujinx.Graphics.Metal
|
|||||||
|
|
||||||
_currentState.Scissors[i] = new MTLScissorRect
|
_currentState.Scissors[i] = new MTLScissorRect
|
||||||
{
|
{
|
||||||
height = Math.Clamp((ulong)region.Height, 0, (ulong)_currentState.Viewports[i].height),
|
height = (ulong)region.Height,
|
||||||
width = Math.Clamp((ulong)region.Width, 0, (ulong)_currentState.Viewports[i].width),
|
width = (ulong)region.Width,
|
||||||
x = (ulong)region.X,
|
x = (ulong)region.X,
|
||||||
y = (ulong)region.Y
|
y = (ulong)region.Y
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user