summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2016-01-27 15:19:28 +0100
committerbunnei <bunneidev@gmail.com>2016-01-27 15:19:28 +0100
commita43f8d2fb764be18bd8a6e0a3c1501c52a604226 (patch)
treee3b497457e371bfdff8116288cba447fa4f006e8
parentMerge pull request #1369 from yuriks/jmpu-inverted (diff)
parentShader JIT: Fix off-by-one error when compiling JMPs (diff)
downloadyuzu-a43f8d2fb764be18bd8a6e0a3c1501c52a604226.tar
yuzu-a43f8d2fb764be18bd8a6e0a3c1501c52a604226.tar.gz
yuzu-a43f8d2fb764be18bd8a6e0a3c1501c52a604226.tar.bz2
yuzu-a43f8d2fb764be18bd8a6e0a3c1501c52a604226.tar.lz
yuzu-a43f8d2fb764be18bd8a6e0a3c1501c52a604226.tar.xz
yuzu-a43f8d2fb764be18bd8a6e0a3c1501c52a604226.tar.zst
yuzu-a43f8d2fb764be18bd8a6e0a3c1501c52a604226.zip
-rw-r--r--src/video_core/shader/shader_jit_x64.cpp10
-rw-r--r--src/video_core/shader/shader_jit_x64.h2
2 files changed, 6 insertions, 6 deletions
diff --git a/src/video_core/shader/shader_jit_x64.cpp b/src/video_core/shader/shader_jit_x64.cpp
index 6554830b2..4249675a5 100644
--- a/src/video_core/shader/shader_jit_x64.cpp
+++ b/src/video_core/shader/shader_jit_x64.cpp
@@ -653,7 +653,7 @@ void JitCompiler::Compile_IF(Instruction instr) {
FixupBranch b = J_CC(CC_Z, true);
// Compile the code that corresponds to the condition evaluating as true
- Compile_Block(instr.flow_control.dest_offset - 1);
+ Compile_Block(instr.flow_control.dest_offset);
// If there isn't an "ELSE" condition, we are done here
if (instr.flow_control.num_instructions == 0) {
@@ -667,7 +667,7 @@ void JitCompiler::Compile_IF(Instruction instr) {
// This code corresponds to the "ELSE" condition
// Comple the code that corresponds to the condition evaluating as false
- Compile_Block(instr.flow_control.dest_offset + instr.flow_control.num_instructions - 1);
+ Compile_Block(instr.flow_control.dest_offset + instr.flow_control.num_instructions);
SetJumpTarget(b2);
}
@@ -691,7 +691,7 @@ void JitCompiler::Compile_LOOP(Instruction instr) {
auto loop_start = GetCodePtr();
- Compile_Block(instr.flow_control.dest_offset);
+ Compile_Block(instr.flow_control.dest_offset + 1);
ADD(32, R(LOOPCOUNT_REG), R(LOOPINC)); // Increment LOOPCOUNT_REG by Z-component
SUB(32, R(LOOPCOUNT), Imm8(1)); // Increment loop count by 1
@@ -719,12 +719,12 @@ void JitCompiler::Compile_JMP(Instruction instr) {
SetJumpTarget(b);
}
-void JitCompiler::Compile_Block(unsigned stop) {
+void JitCompiler::Compile_Block(unsigned end) {
// Save current offset pointer
unsigned* prev_offset_ptr = offset_ptr;
unsigned offset = *prev_offset_ptr;
- while (offset <= stop)
+ while (offset < end)
Compile_NextInstr(&offset);
// Restore current offset pointer
diff --git a/src/video_core/shader/shader_jit_x64.h b/src/video_core/shader/shader_jit_x64.h
index 3afbceccf..5ad2d9606 100644
--- a/src/video_core/shader/shader_jit_x64.h
+++ b/src/video_core/shader/shader_jit_x64.h
@@ -61,7 +61,7 @@ public:
void Compile_MAD(Instruction instr);
private:
- void Compile_Block(unsigned stop);
+ void Compile_Block(unsigned end);
void Compile_NextInstr(unsigned* offset);
void Compile_SwizzleSrc(Instruction instr, unsigned src_num, SourceRegister src_reg, Gen::X64Reg dest);