Resolve some pipeline creation issue when extended dynamic states are not supported

This commit is contained in:
sunshineinabox 2024-09-01 16:41:36 -07:00
parent 3e5b946289
commit 07f80bdbb7
4 changed files with 11 additions and 4 deletions

View file

@ -63,6 +63,9 @@ namespace Ryujinx.Graphics.GAL
public bool PrimitiveRestartEnable; public bool PrimitiveRestartEnable;
public uint PatchControlPoints; public uint PatchControlPoints;
public float DepthBiasUnits;
public float DepthBiasFactor;
public DepthMode DepthMode; public DepthMode DepthMode;
public void SetVertexAttribs(ReadOnlySpan<VertexAttribDescriptor> vertexAttribs) public void SetVertexAttribs(ReadOnlySpan<VertexAttribDescriptor> vertexAttribs)

View file

@ -854,6 +854,9 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
enables |= (depthBias.FillEnable ? PolygonModeMask.Fill : 0); enables |= (depthBias.FillEnable ? PolygonModeMask.Fill : 0);
_pipeline.BiasEnable = enables; _pipeline.BiasEnable = enables;
_pipeline.DepthBiasUnits = units / 2f;
_pipeline.DepthBiasFactor = factor;
_context.Renderer.Pipeline.SetDepthBias(enables, factor, units / 2f, clamp); _context.Renderer.Pipeline.SetDepthBias(enables, factor, units / 2f, clamp);
} }

View file

@ -893,11 +893,11 @@ namespace Ryujinx.Graphics.Vulkan
{ {
if (_supportExtDynamic) if (_supportExtDynamic)
{ {
DynamicState.SetCullMode(enable ? face.Convert() : CullModeFlags.None); DynamicState.SetCullMode(enable ? face.Convert() : default);
} }
else else
{ {
_newState.CullMode = enable ? face.Convert() : CullModeFlags.None; _newState.CullMode = enable ? face.Convert() : default;
} }
SignalStateChange(); SignalStateChange();

View file

@ -173,7 +173,8 @@ namespace Ryujinx.Graphics.Vulkan
pipeline.PrimitiveRestartEnable = extendedDynamicState2.ExtendedDynamicState2 ? false : state.PrimitiveRestartEnable; pipeline.PrimitiveRestartEnable = extendedDynamicState2.ExtendedDynamicState2 ? false : state.PrimitiveRestartEnable;
pipeline.RasterizerDiscardEnable = extendedDynamicState2.ExtendedDynamicState2 ? false : state.RasterizerDiscard; pipeline.RasterizerDiscardEnable = extendedDynamicState2.ExtendedDynamicState2 ? false : state.RasterizerDiscard;
pipeline.DepthBiasEnable = extendedDynamicState2.ExtendedDynamicState2 ? false : state.BiasEnable != 0; pipeline.DepthBiasEnable = extendedDynamicState2.ExtendedDynamicState2 ? false : ((state.BiasEnable != 0) &&
(state.DepthBiasFactor != 0 && state.DepthBiasUnits != 0));
pipeline.PatchControlPoints = extendedDynamicState2.ExtendedDynamicState2PatchControlPoints ? 0 : state.PatchControlPoints; pipeline.PatchControlPoints = extendedDynamicState2.ExtendedDynamicState2PatchControlPoints ? 0 : state.PatchControlPoints;
@ -185,7 +186,7 @@ namespace Ryujinx.Graphics.Vulkan
if (!extendedDynamicState) if (!extendedDynamicState)
{ {
pipeline.DepthCompareOp = state.DepthTest.TestEnable ? state.DepthTest.Func.Convert() : default; pipeline.DepthCompareOp = state.DepthTest.TestEnable ? state.DepthTest.Func.Convert() : default;
pipeline.CullMode = state.CullEnable ? state.CullMode.Convert() : CullModeFlags.None; pipeline.CullMode = state.CullEnable ? state.CullMode.Convert() : default;
} }
else else
{ {