aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Graphics/Gal/OpenGL/OGLRasterizer.cs
diff options
context:
space:
mode:
authorReinUsesLisp <reinuseslisp@airmail.cc>2018-09-19 22:02:11 -0300
committergdkchan <gab.dark.100@gmail.com>2018-09-19 22:02:11 -0300
commit47a62e826fe15fce9b7e33f5aa8a04807fe3d172 (patch)
tree704de1a40446d8198de34fc93c7fd162642407fa /Ryujinx.Graphics/Gal/OpenGL/OGLRasterizer.cs
parentbed13f2022e3b81d694e51e1c29ee66f4a18f5f9 (diff)
Implement DepthWriteMask and add R16G16 (#425)
Diffstat (limited to 'Ryujinx.Graphics/Gal/OpenGL/OGLRasterizer.cs')
-rw-r--r--Ryujinx.Graphics/Gal/OpenGL/OGLRasterizer.cs15
1 files changed, 15 insertions, 0 deletions
diff --git a/Ryujinx.Graphics/Gal/OpenGL/OGLRasterizer.cs b/Ryujinx.Graphics/Gal/OpenGL/OGLRasterizer.cs
index ebfba63d..a74aee07 100644
--- a/Ryujinx.Graphics/Gal/OpenGL/OGLRasterizer.cs
+++ b/Ryujinx.Graphics/Gal/OpenGL/OGLRasterizer.cs
@@ -5,6 +5,8 @@ namespace Ryujinx.Graphics.Gal.OpenGL
{
class OGLRasterizer : IGalRasterizer
{
+ public bool DepthWriteEnabled { set; private get; }
+
private int[] VertexBuffers;
private OGLCachedResource<int> VboCache;
@@ -28,6 +30,8 @@ namespace Ryujinx.Graphics.Gal.OpenGL
IboCache = new OGLCachedResource<int>(GL.DeleteBuffer);
IndexBuffer = new IbInfo();
+
+ DepthWriteEnabled = true;
}
public void LockCaches()
@@ -49,6 +53,12 @@ namespace Ryujinx.Graphics.Gal.OpenGL
float Depth,
int Stencil)
{
+ //OpenGL needs glDepthMask to be enabled to clear it
+ if (!DepthWriteEnabled)
+ {
+ GL.DepthMask(true);
+ }
+
GL.ColorMask(
Flags.HasFlag(GalClearBufferFlags.ColorRed),
Flags.HasFlag(GalClearBufferFlags.ColorGreen),
@@ -68,6 +78,11 @@ namespace Ryujinx.Graphics.Gal.OpenGL
}
GL.ColorMask(true, true, true, true);
+
+ if (!DepthWriteEnabled)
+ {
+ GL.DepthMask(false);
+ }
}
public bool IsVboCached(long Key, long DataSize)