diff options
author | Subv <subv2112@gmail.com> | 2018-04-20 16:02:28 +0200 |
---|---|---|
committer | Subv <subv2112@gmail.com> | 2018-04-20 21:57:40 +0200 |
commit | 2e0a9f66a0d41dd81bfaa7078aad9b53bedb547e (patch) | |
tree | 853ca33dfdf07bfdab7d60c3b2b448e7c214a732 /src/video_core/renderer_opengl | |
parent | Merge pull request #367 from lioncash/clamp (diff) | |
download | yuzu-2e0a9f66a0d41dd81bfaa7078aad9b53bedb547e.tar yuzu-2e0a9f66a0d41dd81bfaa7078aad9b53bedb547e.tar.gz yuzu-2e0a9f66a0d41dd81bfaa7078aad9b53bedb547e.tar.bz2 yuzu-2e0a9f66a0d41dd81bfaa7078aad9b53bedb547e.tar.lz yuzu-2e0a9f66a0d41dd81bfaa7078aad9b53bedb547e.tar.xz yuzu-2e0a9f66a0d41dd81bfaa7078aad9b53bedb547e.tar.zst yuzu-2e0a9f66a0d41dd81bfaa7078aad9b53bedb547e.zip |
Diffstat (limited to 'src/video_core/renderer_opengl')
-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: shader.AddLine(dest + " = " + src + ";"); } + /* + * Returns whether the instruction at the specified offset is a 'sched' instruction. + * Sched instructions always appear before a sequence of 3 instructions. + */ + bool IsSchedInstruction(u32 offset) const { + // sched instructions appear once every 4 instructions. + static constexpr size_t SchedPeriod = 4; + u32 absolute_offset = offset - main_offset; + + return (absolute_offset % SchedPeriod) == 0; + } + /** * Compiles a single instruction from Tegra to GLSL. * @param offset the offset of the Tegra shader instruction. @@ -283,6 +295,10 @@ private: * + 1. If the current instruction always terminates the program, returns PROGRAM_END. */ u32 CompileInstr(u32 offset) { + // Ignore sched instructions when generating code. + if (IsSchedInstruction(offset)) + return offset + 1; + const Instruction instr = {program_code[offset]}; shader.AddLine("// " + std::to_string(offset) + ": " + OpCode::GetInfo(instr.opcode).name); |