mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-11-24 20:36:24 -05:00
gl_shader_decompiler: Add shader stage hint.
This commit is contained in:
parent
a992aac5eb
commit
50023bdae7
2 changed files with 12 additions and 5 deletions
|
@ -128,8 +128,9 @@ private:
|
||||||
class GLSLGenerator {
|
class GLSLGenerator {
|
||||||
public:
|
public:
|
||||||
GLSLGenerator(const std::set<Subroutine>& subroutines, const ProgramCode& program_code,
|
GLSLGenerator(const std::set<Subroutine>& subroutines, const ProgramCode& program_code,
|
||||||
u32 main_offset)
|
u32 main_offset, Maxwell3D::Regs::ShaderStage stage)
|
||||||
: subroutines(subroutines), program_code(program_code), main_offset(main_offset) {
|
: subroutines(subroutines), program_code(program_code), main_offset(main_offset),
|
||||||
|
stage(stage) {
|
||||||
|
|
||||||
Generate();
|
Generate();
|
||||||
}
|
}
|
||||||
|
@ -429,6 +430,7 @@ private:
|
||||||
const std::set<Subroutine>& subroutines;
|
const std::set<Subroutine>& subroutines;
|
||||||
const ProgramCode& program_code;
|
const ProgramCode& program_code;
|
||||||
const u32 main_offset;
|
const u32 main_offset;
|
||||||
|
Maxwell3D::Regs::ShaderStage stage;
|
||||||
|
|
||||||
ShaderWriter shader;
|
ShaderWriter shader;
|
||||||
ShaderWriter declarations;
|
ShaderWriter declarations;
|
||||||
|
@ -443,10 +445,11 @@ std::string GetCommonDeclarations() {
|
||||||
return "bool exec_shader();";
|
return "bool exec_shader();";
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::optional<std::string> DecompileProgram(const ProgramCode& program_code, u32 main_offset) {
|
boost::optional<std::string> DecompileProgram(const ProgramCode& program_code, u32 main_offset,
|
||||||
|
Maxwell3D::Regs::ShaderStage stage) {
|
||||||
try {
|
try {
|
||||||
auto subroutines = ControlFlowAnalyzer(program_code, main_offset).GetSubroutines();
|
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();
|
return generator.GetShaderCode();
|
||||||
} catch (const DecompileFail& exception) {
|
} catch (const DecompileFail& exception) {
|
||||||
LOG_ERROR(HW_GPU, "Shader decompilation failed: %s", exception.what());
|
LOG_ERROR(HW_GPU, "Shader decompilation failed: %s", exception.what());
|
||||||
|
|
|
@ -7,14 +7,18 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <boost/optional.hpp>
|
#include <boost/optional.hpp>
|
||||||
#include "common/common_types.h"
|
#include "common/common_types.h"
|
||||||
|
#include "video_core/engines/maxwell_3d.h"
|
||||||
#include "video_core/renderer_opengl/gl_shader_gen.h"
|
#include "video_core/renderer_opengl/gl_shader_gen.h"
|
||||||
|
|
||||||
namespace GLShader {
|
namespace GLShader {
|
||||||
namespace Decompiler {
|
namespace Decompiler {
|
||||||
|
|
||||||
|
using Tegra::Engines::Maxwell3D;
|
||||||
|
|
||||||
std::string GetCommonDeclarations();
|
std::string GetCommonDeclarations();
|
||||||
|
|
||||||
boost::optional<std::string> DecompileProgram(const ProgramCode& program_code, u32 main_offset);
|
boost::optional<std::string> DecompileProgram(const ProgramCode& program_code, u32 main_offset,
|
||||||
|
Maxwell3D::Regs::ShaderStage stage);
|
||||||
|
|
||||||
} // namespace Decompiler
|
} // namespace Decompiler
|
||||||
} // namespace GLShader
|
} // namespace GLShader
|
||||||
|
|
Loading…
Reference in a new issue