diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/video_core/renderer_opengl/gl_shader_decompiler.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp index de137558d..c23f590cd 100644 --- a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp +++ b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp | |||
| @@ -276,6 +276,18 @@ private: | |||
| 276 | shader.AddLine(dest + " = " + src + ";"); | 276 | shader.AddLine(dest + " = " + src + ";"); |
| 277 | } | 277 | } |
| 278 | 278 | ||
| 279 | /* | ||
| 280 | * Returns whether the instruction at the specified offset is a 'sched' instruction. | ||
| 281 | * Sched instructions always appear before a sequence of 3 instructions. | ||
| 282 | */ | ||
| 283 | bool IsSchedInstruction(u32 offset) const { | ||
| 284 | // sched instructions appear once every 4 instructions. | ||
| 285 | static constexpr size_t SchedPeriod = 4; | ||
| 286 | u32 absolute_offset = offset - main_offset; | ||
| 287 | |||
| 288 | return (absolute_offset % SchedPeriod) == 0; | ||
| 289 | } | ||
| 290 | |||
| 279 | /** | 291 | /** |
| 280 | * Compiles a single instruction from Tegra to GLSL. | 292 | * Compiles a single instruction from Tegra to GLSL. |
| 281 | * @param offset the offset of the Tegra shader instruction. | 293 | * @param offset the offset of the Tegra shader instruction. |
| @@ -283,6 +295,10 @@ private: | |||
| 283 | * + 1. If the current instruction always terminates the program, returns PROGRAM_END. | 295 | * + 1. If the current instruction always terminates the program, returns PROGRAM_END. |
| 284 | */ | 296 | */ |
| 285 | u32 CompileInstr(u32 offset) { | 297 | u32 CompileInstr(u32 offset) { |
| 298 | // Ignore sched instructions when generating code. | ||
| 299 | if (IsSchedInstruction(offset)) | ||
| 300 | return offset + 1; | ||
| 301 | |||
| 286 | const Instruction instr = {program_code[offset]}; | 302 | const Instruction instr = {program_code[offset]}; |
| 287 | 303 | ||
| 288 | shader.AddLine("// " + std::to_string(offset) + ": " + OpCode::GetInfo(instr.opcode).name); | 304 | shader.AddLine("// " + std::to_string(offset) + ": " + OpCode::GetInfo(instr.opcode).name); |