diff options
| author | ReinUsesLisp <reinuseslisp@airmail.cc> | 2018-08-25 01:16:58 -0300 |
|---|---|---|
| committer | gdkchan <gab.dark.100@gmail.com> | 2018-08-25 01:16:58 -0300 |
| commit | a42ab2e40cae5db96cc58634f1e70c4e31bb095d (patch) | |
| tree | f727a1f9685fa02a8e4f947e188f4b329135ad39 /Ryujinx.Graphics/Gal/OpenGL/OGLPipeline.cs | |
| parent | da7e7027518c40702536d4c51905ae7cb496cdb5 (diff) | |
Implement vertex instancing (#381)
Diffstat (limited to 'Ryujinx.Graphics/Gal/OpenGL/OGLPipeline.cs')
| -rw-r--r-- | Ryujinx.Graphics/Gal/OpenGL/OGLPipeline.cs | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/Ryujinx.Graphics/Gal/OpenGL/OGLPipeline.cs b/Ryujinx.Graphics/Gal/OpenGL/OGLPipeline.cs index 5828921d..051b1050 100644 --- a/Ryujinx.Graphics/Gal/OpenGL/OGLPipeline.cs +++ b/Ryujinx.Graphics/Gal/OpenGL/OGLPipeline.cs @@ -126,9 +126,9 @@ namespace Ryujinx.Graphics.Gal.OpenGL BindVertexLayout(New); - if (New.FlipX != Old.FlipX || New.FlipY != Old.FlipY) + if (New.FlipX != Old.FlipX || New.FlipY != Old.FlipY || New.Instance != Old.Instance) { - Shader.SetFlip(New.FlipX, New.FlipY); + Shader.SetExtraData(New.FlipX, New.FlipY, New.Instance); } //Note: Uncomment SetFrontFace and SetCullFace when flipping issues are solved @@ -290,8 +290,7 @@ namespace Ryujinx.Graphics.Gal.OpenGL private void BindConstBuffers(GalPipelineState New) { - //Index 0 is reserved - int FreeBinding = 1; + int FreeBinding = OGLShader.ReservedCbufCount; void BindIfNotNull(OGLShaderStage Stage) { @@ -385,6 +384,15 @@ namespace Ryujinx.Graphics.Gal.OpenGL { GL.VertexAttribPointer(Attrib.Index, Size, Type, Normalize, Binding.Stride, Offset); } + + if (Binding.Instanced && Binding.Divisor != 0) + { + GL.VertexAttribDivisor(Attrib.Index, 1); + } + else + { + GL.VertexAttribDivisor(Attrib.Index, 0); + } } } } |
