mirror of
https://github.com/GreemDev/Ryujinx.git
synced 2024-12-23 05:45:47 +00:00
revert deferred clears
This commit is contained in:
parent
79acae3709
commit
295845e6e3
2 changed files with 11 additions and 74 deletions
|
@ -134,6 +134,7 @@ namespace Ryujinx.Graphics.Metal
|
||||||
SetDepthStencilState(renderCommandEncoder);
|
SetDepthStencilState(renderCommandEncoder);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Clear the dirty flags
|
||||||
_currentState.Dirty.Clear();
|
_currentState.Dirty.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,26 +18,6 @@ namespace Ryujinx.Graphics.Metal
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
|
||||||
[SupportedOSPlatform("macos")]
|
|
||||||
struct ColorClear
|
|
||||||
{
|
|
||||||
public int Layer;
|
|
||||||
public int LayerCount;
|
|
||||||
public uint ComponentMask;
|
|
||||||
public ColorF Color;
|
|
||||||
}
|
|
||||||
|
|
||||||
[SupportedOSPlatform("macos")]
|
|
||||||
struct DepthStencilClear
|
|
||||||
{
|
|
||||||
public int Layer;
|
|
||||||
public int LayerCount;
|
|
||||||
public float DepthValue;
|
|
||||||
public bool DepthMask;
|
|
||||||
public int StencilValue;
|
|
||||||
public int StencilMask;
|
|
||||||
}
|
|
||||||
|
|
||||||
[SupportedOSPlatform("macos")]
|
[SupportedOSPlatform("macos")]
|
||||||
class Pipeline : IPipeline, IDisposable
|
class Pipeline : IPipeline, IDisposable
|
||||||
{
|
{
|
||||||
|
@ -56,10 +36,6 @@ namespace Ryujinx.Graphics.Metal
|
||||||
|
|
||||||
private EncoderStateManager _encoderStateManager;
|
private EncoderStateManager _encoderStateManager;
|
||||||
|
|
||||||
// Deferred clears
|
|
||||||
private ColorClear?[] _colorClears = new ColorClear?[Constants.MaxColorAttachments];
|
|
||||||
private DepthStencilClear? _depthStencilClear;
|
|
||||||
|
|
||||||
public Pipeline(MTLDevice device, MTLCommandQueue commandQueue)
|
public Pipeline(MTLDevice device, MTLCommandQueue commandQueue)
|
||||||
{
|
{
|
||||||
_device = device;
|
_device = device;
|
||||||
|
@ -176,38 +152,6 @@ namespace Ryujinx.Graphics.Metal
|
||||||
return computeCommandEncoder;
|
return computeCommandEncoder;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ExecuteDeferredColorClears()
|
|
||||||
{
|
|
||||||
for (int i = 0; i < Constants.MaxColorAttachments; i++)
|
|
||||||
{
|
|
||||||
if (_colorClears[i] != null)
|
|
||||||
{
|
|
||||||
ColorF color = _colorClears[i].Value.Color;
|
|
||||||
float[] colors = [color.Red, color.Green, color.Blue, color.Alpha];
|
|
||||||
|
|
||||||
Texture target = _encoderStateManager.RenderTargets[i];
|
|
||||||
|
|
||||||
_encoderStateManager.SwapStates();
|
|
||||||
|
|
||||||
_helperShader.ClearColor(target, colors);
|
|
||||||
}
|
|
||||||
_colorClears[i] = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void ExecuteDeferredDepthStencilClear()
|
|
||||||
{
|
|
||||||
if (_depthStencilClear != null)
|
|
||||||
{
|
|
||||||
Texture target = _encoderStateManager.DepthStencil;
|
|
||||||
|
|
||||||
_encoderStateManager.SwapStates();
|
|
||||||
|
|
||||||
_helperShader.ClearDepthStencil(target, [_depthStencilClear.Value.DepthValue], _depthStencilClear.Value.DepthMask, _depthStencilClear.Value.StencilValue, _depthStencilClear.Value.StencilMask);
|
|
||||||
}
|
|
||||||
_depthStencilClear = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Present(CAMetalDrawable drawable, ITexture texture)
|
public void Present(CAMetalDrawable drawable, ITexture texture)
|
||||||
{
|
{
|
||||||
if (texture is not Texture tex)
|
if (texture is not Texture tex)
|
||||||
|
@ -259,30 +203,22 @@ namespace Ryujinx.Graphics.Metal
|
||||||
|
|
||||||
public void ClearRenderTargetColor(int index, int layer, int layerCount, uint componentMask, ColorF color)
|
public void ClearRenderTargetColor(int index, int layer, int layerCount, uint componentMask, ColorF color)
|
||||||
{
|
{
|
||||||
_colorClears[index] = new ColorClear
|
float[] colors = [color.Red, color.Green, color.Blue, color.Alpha];
|
||||||
{
|
|
||||||
Layer = layer,
|
|
||||||
LayerCount = layerCount,
|
|
||||||
ComponentMask = componentMask,
|
|
||||||
Color = color
|
|
||||||
};
|
|
||||||
|
|
||||||
ExecuteDeferredColorClears();
|
Texture target = _encoderStateManager.RenderTargets[index];
|
||||||
|
|
||||||
|
_encoderStateManager.SwapStates();
|
||||||
|
|
||||||
|
_helperShader.ClearColor(target, colors);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ClearRenderTargetDepthStencil(int layer, int layerCount, float depthValue, bool depthMask, int stencilValue, int stencilMask)
|
public void ClearRenderTargetDepthStencil(int layer, int layerCount, float depthValue, bool depthMask, int stencilValue, int stencilMask)
|
||||||
{
|
{
|
||||||
_depthStencilClear = new DepthStencilClear
|
Texture target = _encoderStateManager.DepthStencil;
|
||||||
{
|
|
||||||
Layer = layer,
|
|
||||||
LayerCount = layerCount,
|
|
||||||
DepthValue = depthValue,
|
|
||||||
DepthMask = depthMask,
|
|
||||||
StencilValue = stencilValue,
|
|
||||||
StencilMask = stencilMask
|
|
||||||
};
|
|
||||||
|
|
||||||
ExecuteDeferredDepthStencilClear();
|
_encoderStateManager.SwapStates();
|
||||||
|
|
||||||
|
_helperShader.ClearDepthStencil(target, [depthValue], depthMask, stencilValue, stencilMask);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void CommandBufferBarrier()
|
public void CommandBufferBarrier()
|
||||||
|
|
Loading…
Reference in a new issue