Implement user-defined clipping on GL state pipeline (#1118)
This commit is contained in:
parent
12399b8aea
commit
53369e79bd
5 changed files with 38 additions and 0 deletions
|
@ -125,6 +125,11 @@ namespace Ryujinx.Graphics.Gpu.Engine
|
|||
UpdateShaderState(state);
|
||||
}
|
||||
|
||||
if (state.QueryModified(MethodOffset.ClipDistanceEnable))
|
||||
{
|
||||
UpdateUserClipState(state);
|
||||
}
|
||||
|
||||
if (state.QueryModified(MethodOffset.RasterizeEnable))
|
||||
{
|
||||
UpdateRasterizerState(state);
|
||||
|
@ -902,6 +907,20 @@ namespace Ryujinx.Graphics.Gpu.Engine
|
|||
_context.Renderer.Pipeline.SetProgram(gs.HostProgram);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Updates user-defined clipping based on the guest GPU state.
|
||||
/// </summary>
|
||||
/// <param name="state">Current GPU state</param>
|
||||
private void UpdateUserClipState(GpuState state)
|
||||
{
|
||||
int clipMask = state.Get<int>(MethodOffset.ClipDistanceEnable);
|
||||
|
||||
for (int i = 0; i < Constants.TotalClipDistances; ++i)
|
||||
{
|
||||
_context.Renderer.Pipeline.SetUserClipDistance(i, (clipMask & (1 << i)) != 0);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets texture target from a sampler type.
|
||||
/// </summary>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue