aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorReinUsesLisp <reinuseslisp@airmail.cc>2018-08-20 16:02:38 -0300
committergdkchan <gab.dark.100@gmail.com>2018-08-20 16:02:38 -0300
commitafdeee2b866bd5e41dd629553939d9b5d8bc1d50 (patch)
treecbe43419eddfa85c9a01943888b8eca4bac81b32
parentd021d5dfa9d884160625c273c7f54ffbbeb08802 (diff)
Use signed and unsigned vertex types (#370)
-rw-r--r--Ryujinx.Graphics/Gal/OpenGL/OGLPipeline.cs59
1 files changed, 42 insertions, 17 deletions
diff --git a/Ryujinx.Graphics/Gal/OpenGL/OGLPipeline.cs b/Ryujinx.Graphics/Gal/OpenGL/OGLPipeline.cs
index c9e7f6c3..5828921d 100644
--- a/Ryujinx.Graphics/Gal/OpenGL/OGLPipeline.cs
+++ b/Ryujinx.Graphics/Gal/OpenGL/OGLPipeline.cs
@@ -25,23 +25,41 @@ namespace Ryujinx.Graphics.Gal.OpenGL
{ GalVertexAttribSize._11_11_10, 3 }
};
- private static Dictionary<GalVertexAttribSize, VertexAttribPointerType> AttribTypes =
+ private static Dictionary<GalVertexAttribSize, VertexAttribPointerType> SignedAttribTypes =
new Dictionary<GalVertexAttribSize, VertexAttribPointerType>()
{
- { GalVertexAttribSize._32_32_32_32, VertexAttribPointerType.Int },
- { GalVertexAttribSize._32_32_32, VertexAttribPointerType.Int },
- { GalVertexAttribSize._16_16_16_16, VertexAttribPointerType.Short },
- { GalVertexAttribSize._32_32, VertexAttribPointerType.Int },
- { GalVertexAttribSize._16_16_16, VertexAttribPointerType.Short },
- { GalVertexAttribSize._8_8_8_8, VertexAttribPointerType.Byte },
- { GalVertexAttribSize._16_16, VertexAttribPointerType.Short },
- { GalVertexAttribSize._32, VertexAttribPointerType.Int },
- { GalVertexAttribSize._8_8_8, VertexAttribPointerType.Byte },
- { GalVertexAttribSize._8_8, VertexAttribPointerType.Byte },
- { GalVertexAttribSize._16, VertexAttribPointerType.Short },
- { GalVertexAttribSize._8, VertexAttribPointerType.Byte },
- { GalVertexAttribSize._10_10_10_2, VertexAttribPointerType.Int }, //?
- { GalVertexAttribSize._11_11_10, VertexAttribPointerType.Int } //?
+ { GalVertexAttribSize._32_32_32_32, VertexAttribPointerType.Int },
+ { GalVertexAttribSize._32_32_32, VertexAttribPointerType.Int },
+ { GalVertexAttribSize._16_16_16_16, VertexAttribPointerType.Short },
+ { GalVertexAttribSize._32_32, VertexAttribPointerType.Int },
+ { GalVertexAttribSize._16_16_16, VertexAttribPointerType.Short },
+ { GalVertexAttribSize._8_8_8_8, VertexAttribPointerType.Byte },
+ { GalVertexAttribSize._16_16, VertexAttribPointerType.Short },
+ { GalVertexAttribSize._32, VertexAttribPointerType.Int },
+ { GalVertexAttribSize._8_8_8, VertexAttribPointerType.Byte },
+ { GalVertexAttribSize._8_8, VertexAttribPointerType.Byte },
+ { GalVertexAttribSize._16, VertexAttribPointerType.Short },
+ { GalVertexAttribSize._8, VertexAttribPointerType.Byte },
+ { GalVertexAttribSize._10_10_10_2, VertexAttribPointerType.Int2101010Rev }
+ };
+
+ private static Dictionary<GalVertexAttribSize, VertexAttribPointerType> UnsignedAttribTypes =
+ new Dictionary<GalVertexAttribSize, VertexAttribPointerType>()
+ {
+ { GalVertexAttribSize._32_32_32_32, VertexAttribPointerType.UnsignedInt },
+ { GalVertexAttribSize._32_32_32, VertexAttribPointerType.UnsignedInt },
+ { GalVertexAttribSize._16_16_16_16, VertexAttribPointerType.UnsignedShort },
+ { GalVertexAttribSize._32_32, VertexAttribPointerType.UnsignedInt },
+ { GalVertexAttribSize._16_16_16, VertexAttribPointerType.UnsignedShort },
+ { GalVertexAttribSize._8_8_8_8, VertexAttribPointerType.UnsignedByte },
+ { GalVertexAttribSize._16_16, VertexAttribPointerType.UnsignedShort },
+ { GalVertexAttribSize._32, VertexAttribPointerType.UnsignedInt },
+ { GalVertexAttribSize._8_8_8, VertexAttribPointerType.UnsignedByte },
+ { GalVertexAttribSize._8_8, VertexAttribPointerType.UnsignedByte },
+ { GalVertexAttribSize._16, VertexAttribPointerType.UnsignedShort },
+ { GalVertexAttribSize._8, VertexAttribPointerType.UnsignedByte },
+ { GalVertexAttribSize._10_10_10_2, VertexAttribPointerType.UnsignedInt2101010Rev },
+ { GalVertexAttribSize._11_11_10, VertexAttribPointerType.UnsignedInt10F11F11FRev }
};
private GalPipelineState Old;
@@ -326,7 +344,7 @@ namespace Ryujinx.Graphics.Gal.OpenGL
bool Unsigned =
Attrib.Type == GalVertexAttribType.Unorm ||
- Attrib.Type == GalVertexAttribType.Uint ||
+ Attrib.Type == GalVertexAttribType.Uint ||
Attrib.Type == GalVertexAttribType.Uscaled;
bool Normalize =
@@ -341,7 +359,14 @@ namespace Ryujinx.Graphics.Gal.OpenGL
}
else
{
- Type = AttribTypes[Attrib.Size] + (Unsigned ? 1 : 0);
+ if (Unsigned)
+ {
+ Type = UnsignedAttribTypes[Attrib.Size];
+ }
+ else
+ {
+ Type = SignedAttribTypes[Attrib.Size];
+ }
}
int Size = AttribElements[Attrib.Size];