mirror of
https://github.com/Ryujinx/Ryujinx.git
synced 2024-12-25 19:36:02 +00:00
Clean up for some clarity and attempt to resolve some validation errors.
This commit is contained in:
parent
966c5d463c
commit
266649929f
2 changed files with 28 additions and 30 deletions
|
@ -697,7 +697,7 @@ namespace Ryujinx.Graphics.Vulkan
|
|||
var oldStencilTestEnable = _supportExtDynamic ? DynamicState.StencilTestEnable : _newState.StencilTestEnable;
|
||||
var oldDepthTestEnable = _supportExtDynamic ? DynamicState.DepthTestEnable : _newState.DepthTestEnable;
|
||||
var oldDepthWriteEnable = _supportExtDynamic ? DynamicState.DepthWriteEnable : _newState.DepthWriteEnable;
|
||||
var oldTopology = _supportExtDynamic ? DynamicState.Topology : _newState.Topology;
|
||||
var oldTopology = _newState.Topology;
|
||||
var oldViewports = DynamicState.Viewports;
|
||||
var oldViewportsCount = _supportExtDynamic ? DynamicState.ViewportsCount : _newState.ViewportsCount;
|
||||
|
||||
|
@ -728,14 +728,13 @@ namespace Ryujinx.Graphics.Vulkan
|
|||
if (_supportExtDynamic)
|
||||
{
|
||||
var oldTopologyClass = GetTopologyClass(oldTopology);
|
||||
var newTopologyClass = GetTopologyClass(DynamicState.Topology);
|
||||
|
||||
DynamicState.SetCullMode(oldCullMode);
|
||||
DynamicState.SetStencilTest(oldStencilTestEnable);
|
||||
DynamicState.SetDepthTestBool(oldDepthTestEnable, oldDepthWriteEnable);
|
||||
DynamicState.SetPrimitiveTopology(oldTopology);
|
||||
|
||||
if (oldTopologyClass != newTopologyClass)
|
||||
if (oldTopologyClass != TopologyClass.Triangle)
|
||||
{
|
||||
_newState.TopologyClass = oldTopology;
|
||||
}
|
||||
|
@ -1296,7 +1295,7 @@ namespace Ryujinx.Graphics.Vulkan
|
|||
{
|
||||
if (_supportExtDynamic)
|
||||
{
|
||||
DynamicState.SetStencilOp(
|
||||
DynamicState.SetStencilTestandOp(
|
||||
stencilTest.BackSFail.Convert(),
|
||||
stencilTest.BackDpPass.Convert(),
|
||||
stencilTest.BackDpFail.Convert(),
|
||||
|
@ -1304,9 +1303,8 @@ namespace Ryujinx.Graphics.Vulkan
|
|||
stencilTest.FrontSFail.Convert(),
|
||||
stencilTest.FrontDpPass.Convert(),
|
||||
stencilTest.FrontDpFail.Convert(),
|
||||
stencilTest.FrontFunc.Convert());
|
||||
|
||||
DynamicState.SetStencilTest(stencilTest.TestEnable);
|
||||
stencilTest.FrontFunc.Convert(),
|
||||
stencilTest.TestEnable);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -22,7 +22,6 @@ namespace Ryujinx.Graphics.Vulkan
|
|||
private uint _frontWriteMask;
|
||||
private uint _frontReference;
|
||||
|
||||
private bool _opToo;
|
||||
private StencilOp _backFailOp;
|
||||
private StencilOp _backPassOp;
|
||||
private StencilOp _backDepthFailOp;
|
||||
|
@ -71,7 +70,7 @@ namespace Ryujinx.Graphics.Vulkan
|
|||
FrontFace = 1 << 6,
|
||||
DepthTestBool = 1 << 7,
|
||||
DepthTestCompareOp = 1 << 8,
|
||||
StencilTestEnable = 1 << 9,
|
||||
StencilTestEnableandStencilOp = 1 << 9,
|
||||
LineWidth = 1 << 10,
|
||||
RasterDiscard = 1 << 11,
|
||||
LogicOp = 1 << 12,
|
||||
|
@ -79,7 +78,7 @@ namespace Ryujinx.Graphics.Vulkan
|
|||
PrimitiveRestart = 1 << 14,
|
||||
PrimitiveTopology = 1 << 15,
|
||||
Standard = Blend | DepthBias | Scissor | Stencil | Viewport | LineWidth,
|
||||
Extended = CullMode | FrontFace | DepthTestBool | DepthTestCompareOp | StencilTestEnable | PrimitiveTopology,
|
||||
Extended = CullMode | FrontFace | DepthTestBool | DepthTestCompareOp | StencilTestEnableandStencilOp | PrimitiveTopology,
|
||||
Extended2 = RasterDiscard | LogicOp | PatchControlPoints | PrimitiveRestart,
|
||||
}
|
||||
|
||||
|
@ -123,9 +122,9 @@ namespace Ryujinx.Graphics.Vulkan
|
|||
_dirty |= DirtyFlags.DepthTestCompareOp;
|
||||
}
|
||||
|
||||
public void SetStencilOp(StencilOp backFailOp, StencilOp backPassOp, StencilOp backDepthFailOp,
|
||||
public void SetStencilTestandOp(StencilOp backFailOp, StencilOp backPassOp, StencilOp backDepthFailOp,
|
||||
CompareOp backCompareOp, StencilOp frontFailOp, StencilOp frontPassOp, StencilOp frontDepthFailOp,
|
||||
CompareOp frontCompareOp)
|
||||
CompareOp frontCompareOp, bool stencilTestEnable)
|
||||
{
|
||||
_backFailOp = backFailOp;
|
||||
_backPassOp = backPassOp;
|
||||
|
@ -135,7 +134,17 @@ namespace Ryujinx.Graphics.Vulkan
|
|||
_frontPassOp = frontPassOp;
|
||||
_frontDepthFailOp = frontDepthFailOp;
|
||||
_frontCompareOp = frontCompareOp;
|
||||
_opToo = true;
|
||||
|
||||
StencilTestEnable = stencilTestEnable;
|
||||
|
||||
_dirty |= DirtyFlags.StencilTestEnableandStencilOp;
|
||||
}
|
||||
|
||||
public void SetStencilTest(bool stencilTestEnable)
|
||||
{
|
||||
StencilTestEnable = stencilTestEnable;
|
||||
|
||||
_dirty |= DirtyFlags.StencilTestEnableandStencilOp;
|
||||
}
|
||||
|
||||
public void SetStencilMask(uint backCompareMask, uint backWriteMask, uint backReference,
|
||||
|
@ -150,12 +159,6 @@ namespace Ryujinx.Graphics.Vulkan
|
|||
_dirty |= DirtyFlags.Stencil;
|
||||
}
|
||||
|
||||
public void SetStencilTest(bool stencilTestEnable)
|
||||
{
|
||||
StencilTestEnable = stencilTestEnable;
|
||||
_dirty |= DirtyFlags.StencilTestEnable;
|
||||
}
|
||||
|
||||
public void SetViewport(int index, Viewport viewport)
|
||||
{
|
||||
Viewports[index] = viewport;
|
||||
|
@ -301,9 +304,9 @@ namespace Ryujinx.Graphics.Vulkan
|
|||
RecordDepthTestCompareOp(gd.ExtendedDynamicStateApi, commandBuffer);
|
||||
}
|
||||
|
||||
if (_dirty.HasFlag(DirtyFlags.StencilTestEnable))
|
||||
if (_dirty.HasFlag(DirtyFlags.StencilTestEnableandStencilOp))
|
||||
{
|
||||
RecordStencilTestEnable(gd.ExtendedDynamicStateApi, commandBuffer);
|
||||
RecordStencilTestandOp(gd.ExtendedDynamicStateApi, commandBuffer);
|
||||
}
|
||||
|
||||
if (_dirty.HasFlag(DirtyFlags.LineWidth))
|
||||
|
@ -379,14 +382,6 @@ namespace Ryujinx.Graphics.Vulkan
|
|||
|
||||
private readonly void RecordStencil(VulkanRenderer gd, CommandBuffer commandBuffer)
|
||||
{
|
||||
if (_opToo)
|
||||
{
|
||||
gd.ExtendedDynamicStateApi.CmdSetStencilOp(commandBuffer, StencilFaceFlags.FaceBackBit, _backFailOp, _backPassOp,
|
||||
_backDepthFailOp, _backCompareOp);
|
||||
gd.ExtendedDynamicStateApi.CmdSetStencilOp(commandBuffer, StencilFaceFlags.FaceFrontBit, _frontFailOp, _frontPassOp,
|
||||
_frontDepthFailOp, _frontCompareOp);
|
||||
}
|
||||
|
||||
gd.Api.CmdSetStencilCompareMask(commandBuffer, StencilFaceFlags.FaceBackBit, _backCompareMask);
|
||||
gd.Api.CmdSetStencilWriteMask(commandBuffer, StencilFaceFlags.FaceBackBit, _backWriteMask);
|
||||
gd.Api.CmdSetStencilReference(commandBuffer, StencilFaceFlags.FaceBackBit, _backReference);
|
||||
|
@ -395,9 +390,14 @@ namespace Ryujinx.Graphics.Vulkan
|
|||
gd.Api.CmdSetStencilReference(commandBuffer, StencilFaceFlags.FaceFrontBit, _frontReference);
|
||||
}
|
||||
|
||||
private readonly void RecordStencilTestEnable(ExtExtendedDynamicState api, CommandBuffer commandBuffer)
|
||||
private readonly void RecordStencilTestandOp(ExtExtendedDynamicState api, CommandBuffer commandBuffer)
|
||||
{
|
||||
api.CmdSetStencilTestEnable(commandBuffer, StencilTestEnable);
|
||||
|
||||
api.CmdSetStencilOp(commandBuffer, StencilFaceFlags.FaceBackBit, _backFailOp, _backPassOp,
|
||||
_backDepthFailOp, _backCompareOp);
|
||||
api.CmdSetStencilOp(commandBuffer, StencilFaceFlags.FaceFrontBit, _frontFailOp, _frontPassOp,
|
||||
_frontDepthFailOp, _frontCompareOp);
|
||||
}
|
||||
|
||||
private void RecordViewport(VulkanRenderer gd, CommandBuffer commandBuffer)
|
||||
|
|
Loading…
Reference in a new issue