aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Graphics
diff options
context:
space:
mode:
authorgdkchan <gab.dark.100@gmail.com>2018-06-27 01:32:28 -0300
committergdkchan <gab.dark.100@gmail.com>2018-06-27 01:32:28 -0300
commit900a84ae0a90ae13c8c3f5158eff85c68a953362 (patch)
tree0ccc4383b84da7e4ed6f354b2e4af6beaae549db /Ryujinx.Graphics
parentaf5f059d4ed8921a4efd6acdb264483dfc025ecb (diff)
Fix vertex buffer size on the gpu when the draw vertex count is less than the buffer size, added a few more registers (currently not implemented)
Diffstat (limited to 'Ryujinx.Graphics')
-rw-r--r--Ryujinx.Graphics/Gal/GalComparisonOp.cs14
-rw-r--r--Ryujinx.Graphics/Gal/IGalRasterizer.cs10
-rw-r--r--Ryujinx.Graphics/Gal/OpenGL/OGLEnumConverter.cs11
-rw-r--r--Ryujinx.Graphics/Gal/OpenGL/OGLRasterizer.cs25
-rw-r--r--Ryujinx.Graphics/Gal/OpenGL/OGLShader.cs2
5 files changed, 61 insertions, 1 deletions
diff --git a/Ryujinx.Graphics/Gal/GalComparisonOp.cs b/Ryujinx.Graphics/Gal/GalComparisonOp.cs
new file mode 100644
index 00000000..ddddeceb
--- /dev/null
+++ b/Ryujinx.Graphics/Gal/GalComparisonOp.cs
@@ -0,0 +1,14 @@
+namespace Ryujinx.Graphics.Gal
+{
+ public enum GalComparisonOp
+ {
+ Never = 0x200,
+ Less = 0x201,
+ Equal = 0x202,
+ Lequal = 0x203,
+ Greater = 0x204,
+ NotEqual = 0x205,
+ Gequal = 0x206,
+ Always = 0x207
+ }
+} \ No newline at end of file
diff --git a/Ryujinx.Graphics/Gal/IGalRasterizer.cs b/Ryujinx.Graphics/Gal/IGalRasterizer.cs
index 81c922be..1323372a 100644
--- a/Ryujinx.Graphics/Gal/IGalRasterizer.cs
+++ b/Ryujinx.Graphics/Gal/IGalRasterizer.cs
@@ -8,6 +8,16 @@ namespace Ryujinx.Graphics.Gal
bool IsIboCached(long Key, long DataSize);
+ void EnableCullFace();
+
+ void DisableCullFace();
+
+ void EnableDepthTest();
+
+ void DisableDepthTest();
+
+ void SetDepthFunction(GalComparisonOp Func);
+
void CreateVbo(long Key, byte[] Buffer);
void CreateIbo(long Key, byte[] Buffer);
diff --git a/Ryujinx.Graphics/Gal/OpenGL/OGLEnumConverter.cs b/Ryujinx.Graphics/Gal/OpenGL/OGLEnumConverter.cs
index c2b0c40a..cb2c1a0e 100644
--- a/Ryujinx.Graphics/Gal/OpenGL/OGLEnumConverter.cs
+++ b/Ryujinx.Graphics/Gal/OpenGL/OGLEnumConverter.cs
@@ -5,6 +5,17 @@ namespace Ryujinx.Graphics.Gal.OpenGL
{
static class OGLEnumConverter
{
+ public static DepthFunction GetDepthFunc(GalComparisonOp Func)
+ {
+ if ((int)Func >= (int)DepthFunction.Never &&
+ (int)Func <= (int)DepthFunction.Always)
+ {
+ return (DepthFunction)Func;
+ }
+
+ throw new ArgumentException(nameof(Func));
+ }
+
public static DrawElementsType GetDrawElementsType(GalIndexFormat Format)
{
switch (Format)
diff --git a/Ryujinx.Graphics/Gal/OpenGL/OGLRasterizer.cs b/Ryujinx.Graphics/Gal/OpenGL/OGLRasterizer.cs
index bdf22b9c..05250696 100644
--- a/Ryujinx.Graphics/Gal/OpenGL/OGLRasterizer.cs
+++ b/Ryujinx.Graphics/Gal/OpenGL/OGLRasterizer.cs
@@ -106,6 +106,31 @@ namespace Ryujinx.Graphics.Gal.OpenGL
return IboCache.TryGetSize(Key, out long Size) && Size == DataSize;
}
+ public void EnableCullFace()
+ {
+ GL.Enable(EnableCap.CullFace);
+ }
+
+ public void DisableCullFace()
+ {
+ GL.Disable(EnableCap.CullFace);
+ }
+
+ public void EnableDepthTest()
+ {
+ GL.Enable(EnableCap.DepthTest);
+ }
+
+ public void DisableDepthTest()
+ {
+ GL.Disable(EnableCap.DepthTest);
+ }
+
+ public void SetDepthFunction(GalComparisonOp Func)
+ {
+ GL.DepthFunc(OGLEnumConverter.GetDepthFunc(Func));
+ }
+
public void CreateVbo(long Key, byte[] Buffer)
{
int Handle = GL.GenBuffer();
diff --git a/Ryujinx.Graphics/Gal/OpenGL/OGLShader.cs b/Ryujinx.Graphics/Gal/OpenGL/OGLShader.cs
index 28fa8728..da2762d6 100644
--- a/Ryujinx.Graphics/Gal/OpenGL/OGLShader.cs
+++ b/Ryujinx.Graphics/Gal/OpenGL/OGLShader.cs
@@ -283,7 +283,7 @@ namespace Ryujinx.Graphics.Gal.OpenGL
return FreeBinding;
}
-
+
BindUniformBuffersIfNotNull(Current.Vertex);
BindUniformBuffersIfNotNull(Current.TessControl);
BindUniformBuffersIfNotNull(Current.TessEvaluation);