From 50023bdae790a607b3a6e6279465c2520279f70b Mon Sep 17 00:00:00 2001 From: bunnei Date: Mon, 9 Apr 2018 22:07:30 -0400 Subject: gl_shader_decompiler: Add shader stage hint. --- src/video_core/renderer_opengl/gl_shader_decompiler.cpp | 11 +++++++---- src/video_core/renderer_opengl/gl_shader_decompiler.h | 6 +++++- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp index 60857c623..704b24307 100644 --- a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp +++ b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp @@ -128,8 +128,9 @@ private: class GLSLGenerator { public: GLSLGenerator(const std::set& subroutines, const ProgramCode& program_code, - u32 main_offset) - : subroutines(subroutines), program_code(program_code), main_offset(main_offset) { + u32 main_offset, Maxwell3D::Regs::ShaderStage stage) + : subroutines(subroutines), program_code(program_code), main_offset(main_offset), + stage(stage) { Generate(); } @@ -429,6 +430,7 @@ private: const std::set& subroutines; const ProgramCode& program_code; const u32 main_offset; + Maxwell3D::Regs::ShaderStage stage; ShaderWriter shader; ShaderWriter declarations; @@ -443,10 +445,11 @@ std::string GetCommonDeclarations() { return "bool exec_shader();"; } -boost::optional DecompileProgram(const ProgramCode& program_code, u32 main_offset) { +boost::optional DecompileProgram(const ProgramCode& program_code, u32 main_offset, + Maxwell3D::Regs::ShaderStage stage) { try { auto subroutines = ControlFlowAnalyzer(program_code, main_offset).GetSubroutines(); - GLSLGenerator generator(subroutines, program_code, main_offset); + GLSLGenerator generator(subroutines, program_code, main_offset, stage); return generator.GetShaderCode(); } catch (const DecompileFail& exception) { LOG_ERROR(HW_GPU, "Shader decompilation failed: %s", exception.what()); diff --git a/src/video_core/renderer_opengl/gl_shader_decompiler.h b/src/video_core/renderer_opengl/gl_shader_decompiler.h index 061dd6102..2f4047d87 100644 --- a/src/video_core/renderer_opengl/gl_shader_decompiler.h +++ b/src/video_core/renderer_opengl/gl_shader_decompiler.h @@ -7,14 +7,18 @@ #include #include #include "common/common_types.h" +#include "video_core/engines/maxwell_3d.h" #include "video_core/renderer_opengl/gl_shader_gen.h" namespace GLShader { namespace Decompiler { +using Tegra::Engines::Maxwell3D; + std::string GetCommonDeclarations(); -boost::optional DecompileProgram(const ProgramCode& program_code, u32 main_offset); +boost::optional DecompileProgram(const ProgramCode& program_code, u32 main_offset, + Maxwell3D::Regs::ShaderStage stage); } // namespace Decompiler } // namespace GLShader -- cgit v1.2.3