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
This commit is contained in:
gdkchan 2023-08-29 21:10:34 -03:00 committed by GitHub
parent 93d78f9ac4
commit f09bba82b9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
65 changed files with 3912 additions and 593 deletions

View file

@ -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);
}
}
}