aboutsummaryrefslogtreecommitdiff
path: root/src/Ryujinx.Graphics.Gpu/Engine/Threed/StateUpdater.cs
diff options
context:
space:
mode:
authorgdkchan <gab.dark.100@gmail.com>2023-08-29 21:10:34 -0300
committerGitHub <noreply@github.com>2023-08-29 21:10:34 -0300
commitf09bba82b9366e5912b639a610ae89cbb1cf352c (patch)
tree4811ffa52206eed7cf8aa200c64deb7410e5c56b /src/Ryujinx.Graphics.Gpu/Engine/Threed/StateUpdater.cs
parent93d78f9ac4a37a50f0cc2e57addd330d072af742 (diff)
Geometry shader emulation for macOS (#5551)
* Implement vertex and geometry shader conversion to compute * Call InitializeReservedCounts for compute too * PR feedback * Set clip distance mask for geometry and tessellation shaders too * Transform feedback emulation only for vertex
Diffstat (limited to 'src/Ryujinx.Graphics.Gpu/Engine/Threed/StateUpdater.cs')
-rw-r--r--src/Ryujinx.Graphics.Gpu/Engine/Threed/StateUpdater.cs31
1 files changed, 30 insertions, 1 deletions
diff --git a/src/Ryujinx.Graphics.Gpu/Engine/Threed/StateUpdater.cs b/src/Ryujinx.Graphics.Gpu/Engine/Threed/StateUpdater.cs
index 1f919d9b..48a497b5 100644
--- a/src/Ryujinx.Graphics.Gpu/Engine/Threed/StateUpdater.cs
+++ b/src/Ryujinx.Graphics.Gpu/Engine/Threed/StateUpdater.cs
@@ -20,6 +20,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
public const int RasterizerStateIndex = 15;
public const int ScissorStateIndex = 16;
public const int VertexBufferStateIndex = 0;
+ public const int IndexBufferStateIndex = 23;
public const int PrimitiveRestartStateIndex = 12;
public const int RenderTargetStateIndex = 27;
@@ -290,7 +291,13 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
// of the shader for the new state.
if (_shaderSpecState != null && _currentSpecState.HasChanged())
{
- if (!_shaderSpecState.MatchesGraphics(_channel, ref _currentSpecState.GetPoolState(), ref _currentSpecState.GetGraphicsState(), _vsUsesDrawParameters, false))
+ if (!_shaderSpecState.MatchesGraphics(
+ _channel,
+ ref _currentSpecState.GetPoolState(),
+ ref _currentSpecState.GetGraphicsState(),
+ _drawState.VertexAsCompute != null,
+ _vsUsesDrawParameters,
+ checkTextures: false))
{
// Shader must be reloaded. _vtgWritesRtLayer should not change.
UpdateShaderState();
@@ -1453,6 +1460,19 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
_fsReadsFragCoord = false;
}
+ if (gs.VertexAsCompute != null)
+ {
+ _drawState.VertexAsCompute = gs.VertexAsCompute;
+ _drawState.GeometryAsCompute = gs.GeometryAsCompute;
+ _drawState.VertexPassthrough = gs.HostProgram;
+ }
+ else
+ {
+ _drawState.VertexAsCompute = null;
+ _drawState.GeometryAsCompute = null;
+ _drawState.VertexPassthrough = null;
+ }
+
_context.Renderer.Pipeline.SetProgram(gs.HostProgram);
}
@@ -1540,5 +1560,14 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
{
_updateTracker.ForceDirty(ShaderStateIndex);
}
+
+ /// <summary>
+ /// Forces a register group as dirty, by index.
+ /// </summary>
+ /// <param name="groupIndex">Index of the group to be dirtied</param>
+ public void ForceDirty(int groupIndex)
+ {
+ _updateTracker.ForceDirty(groupIndex);
+ }
}
}