aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Graphics.OpenGL
diff options
context:
space:
mode:
authormageven <62494521+mageven@users.noreply.github.com>2020-07-21 06:29:13 +0530
committerGitHub <noreply@github.com>2020-07-20 21:59:13 -0300
commit723ae240dcb6ff8b03d1187cdbd81f20424bac52 (patch)
tree1e83917b466d6435b65cd46826ac692ff45204f0 /Ryujinx.Graphics.OpenGL
parent1c84b683c2cc9ffab3ebedca92396ca12c82da9d (diff)
GL: Implement more Point parameters (#1399)
* Fix GL_INVALID_VALUE on glPointSize calls * Implement more of Point primitive state * Use existing Origin enum
Diffstat (limited to 'Ryujinx.Graphics.OpenGL')
-rw-r--r--Ryujinx.Graphics.OpenGL/Pipeline.cs30
1 files changed, 28 insertions, 2 deletions
diff --git a/Ryujinx.Graphics.OpenGL/Pipeline.cs b/Ryujinx.Graphics.OpenGL/Pipeline.cs
index 7537b44f..2016d852 100644
--- a/Ryujinx.Graphics.OpenGL/Pipeline.cs
+++ b/Ryujinx.Graphics.OpenGL/Pipeline.cs
@@ -700,9 +700,35 @@ namespace Ryujinx.Graphics.OpenGL
SetOrigin(clipOrigin);
}
- public void SetPointSize(float size)
+ public void SetPointParameters(float size, bool isProgramPointSize, bool enablePointSprite, Origin origin)
{
- GL.PointSize(size);
+ // GL_POINT_SPRITE was deprecated in core profile 3.2+ and causes GL_INVALID_ENUM when set.
+ // As we don't know if the current context is core or compat, it's safer to keep this code.
+ if (enablePointSprite)
+ {
+ GL.Enable(EnableCap.PointSprite);
+ }
+ else
+ {
+ GL.Disable(EnableCap.PointSprite);
+ }
+
+ if (isProgramPointSize)
+ {
+ GL.Enable(EnableCap.ProgramPointSize);
+ }
+ else
+ {
+ GL.Disable(EnableCap.ProgramPointSize);
+ }
+
+ GL.PointParameter(origin == Origin.LowerLeft
+ ? PointSpriteCoordOriginParameter.LowerLeft
+ : PointSpriteCoordOriginParameter.UpperLeft);
+
+ // Games seem to set point size to 0 which generates a GL_INVALID_VALUE
+ // From the spec, GL_INVALID_VALUE is generated if size is less than or equal to 0.
+ GL.PointSize(Math.Max(float.Epsilon, size));
}
public void SetPrimitiveRestart(bool enable, int index)