diff options
| author | gdkchan <gab.dark.100@gmail.com> | 2018-06-27 23:55:08 -0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-06-27 23:55:08 -0300 |
| commit | e6eeb6f09ff592f5b27e115d1817654de7568757 (patch) | |
| tree | 0c6b7528dc907779fa8e0199822d9f20896752d2 /Ryujinx.Graphics/Gal/OpenGL | |
| parent | 900a84ae0a90ae13c8c3f5158eff85c68a953362 (diff) | |
Add support for Vertex Program A and other small shader improvements (#192)
* Add WIP support for Vertex Program A, add the FADD_I32 shader instruction, small fix on FFMA_I encoding, nits
* Add separate subroutines for program A/B, and copy attributes to a temp
* Move finalization code to main
* Add new line after flip uniform on the shader
* Handle possible case where VPB uses an output attribute written by VPA but not available on the vbo
* Address PR feedback
Diffstat (limited to 'Ryujinx.Graphics/Gal/OpenGL')
| -rw-r--r-- | Ryujinx.Graphics/Gal/OpenGL/OGLShader.cs | 38 |
1 files changed, 28 insertions, 10 deletions
diff --git a/Ryujinx.Graphics/Gal/OpenGL/OGLShader.cs b/Ryujinx.Graphics/Gal/OpenGL/OGLShader.cs index da2762d6..3c5c874e 100644 --- a/Ryujinx.Graphics/Gal/OpenGL/OGLShader.cs +++ b/Ryujinx.Graphics/Gal/OpenGL/OGLShader.cs @@ -97,12 +97,37 @@ namespace Ryujinx.Graphics.Gal.OpenGL public void Create(IGalMemory Memory, long Key, GalShaderType Type) { - Stages.GetOrAdd(Key, (Stage) => ShaderStageFactory(Memory, Key, Type)); + Stages.GetOrAdd(Key, (Stage) => ShaderStageFactory(Memory, Key, 0, false, Type)); } - private ShaderStage ShaderStageFactory(IGalMemory Memory, long Position, GalShaderType Type) + public void Create(IGalMemory Memory, long VpAPos, long Key, GalShaderType Type) { - GlslProgram Program = GetGlslProgram(Memory, Position, Type); + Stages.GetOrAdd(Key, (Stage) => ShaderStageFactory(Memory, VpAPos, Key, true, Type)); + } + + private ShaderStage ShaderStageFactory( + IGalMemory Memory, + long Position, + long PositionB, + bool IsDualVp, + GalShaderType Type) + { + GlslProgram Program; + + GlslDecompiler Decompiler = new GlslDecompiler(); + + if (IsDualVp) + { + Program = Decompiler.Decompile( + Memory, + Position + 0x50, + PositionB + 0x50, + Type); + } + else + { + Program = Decompiler.Decompile(Memory, Position + 0x50, Type); + } return new ShaderStage( Type, @@ -111,13 +136,6 @@ namespace Ryujinx.Graphics.Gal.OpenGL Program.Uniforms); } - private GlslProgram GetGlslProgram(IGalMemory Memory, long Position, GalShaderType Type) - { - GlslDecompiler Decompiler = new GlslDecompiler(); - - return Decompiler.Decompile(Memory, Position + 0x50, Type); - } - public IEnumerable<ShaderDeclInfo> GetTextureUsage(long Key) { if (Stages.TryGetValue(Key, out ShaderStage Stage)) |
