Resolve two validation errors that were created by changes

1. One stating that the bound pipeline is identical to the previous with a dynamic state that was previously static (DepthBias) which might cause issues in non Vulkan SDK 1.3 conformant drivers.

2. DynamicState command is sent without current pipeline having the dynamic state enabled.
This commit is contained in:
sunshineinabox 2024-07-21 14:22:15 -07:00
parent 20101e2ea3
commit 48ad342ee9
2 changed files with 8 additions and 21 deletions

View file

@ -793,24 +793,22 @@ namespace Ryujinx.Graphics.Vulkan
} }
bool depthBiasEnable = (enables != PolygonModeMask.None) && (factor != 0 && units != 0); bool depthBiasEnable = (enables != PolygonModeMask.None) && (factor != 0 && units != 0);
bool changed = false;
if (_newState.DepthBiasEnable != depthBiasEnable) if (_newState.DepthBiasEnable != depthBiasEnable)
{ {
_newState.DepthBiasEnable = depthBiasEnable; _newState.DepthBiasEnable = depthBiasEnable;
changed = true;
} }
if (depthBiasEnable) if (depthBiasEnable)
{ {
DynamicState.SetDepthBias(factor, units, clamp); DynamicState.SetDepthBias(factor, units, clamp);
changed = true; }
else
{
DynamicState.SetDepthBias(0, 0, 0);
} }
if (changed) SignalStateChange();
{
SignalStateChange();
}
} }
public void SetDepthClamp(bool clamp) public void SetDepthClamp(bool clamp)

View file

@ -565,12 +565,7 @@ namespace Ryujinx.Graphics.Vulkan
bool supportsExtDynamicState = gd.Capabilities.SupportsExtendedDynamicState; bool supportsExtDynamicState = gd.Capabilities.SupportsExtendedDynamicState;
int dynamicStatesCount = supportsExtDynamicState ? 7 : 6; int dynamicStatesCount = supportsExtDynamicState ? 8 : 7;
if (DepthBiasEnable)
{
dynamicStatesCount++;
}
DynamicState* dynamicStates = stackalloc DynamicState[dynamicStatesCount]; DynamicState* dynamicStates = stackalloc DynamicState[dynamicStatesCount];
@ -580,17 +575,11 @@ namespace Ryujinx.Graphics.Vulkan
dynamicStates[3] = DynamicState.StencilWriteMask; dynamicStates[3] = DynamicState.StencilWriteMask;
dynamicStates[4] = DynamicState.StencilReference; dynamicStates[4] = DynamicState.StencilReference;
dynamicStates[5] = DynamicState.BlendConstants; dynamicStates[5] = DynamicState.BlendConstants;
dynamicStates[6] = DynamicState.DepthBias;
dynamicStatesCount = 6;
if (DepthBiasEnable)
{
dynamicStates[dynamicStatesCount++] = DynamicState.DepthBias;
}
if (supportsExtDynamicState) if (supportsExtDynamicState)
{ {
dynamicStates[dynamicStatesCount++] = DynamicState.VertexInputBindingStrideExt; dynamicStates[7] = DynamicState.VertexInputBindingStrideExt;
} }
var pipelineDynamicStateCreateInfo = new PipelineDynamicStateCreateInfo var pipelineDynamicStateCreateInfo = new PipelineDynamicStateCreateInfo