summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/video_core/engines/shader_bytecode.h9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/video_core/engines/shader_bytecode.h b/src/video_core/engines/shader_bytecode.h
index 8d4ea3401..edb491464 100644
--- a/src/video_core/engines/shader_bytecode.h
+++ b/src/video_core/engines/shader_bytecode.h
@@ -328,15 +328,16 @@ union Instruction {
328 } texs; 328 } texs;
329 329
330 union { 330 union {
331 BitField<20, 5, u64> target; 331 BitField<20, 24, u64> target;
332 BitField<5, 1, u64> constant_buffer; 332 BitField<5, 1, u64> constant_buffer;
333 333
334 s32 GetBranchTarget() const { 334 s32 GetBranchTarget() const {
335 // Sign extend the branch target offset 335 // Sign extend the branch target offset
336 u32 mask = 1U << (5 - 1); 336 u32 mask = 1U << (24 - 1);
337 u32 value = static_cast<u32>(target); 337 u32 value = static_cast<u32>(target);
338 // The branch offset is relative to the next instruction, so add 1 to it. 338 // The branch offset is relative to the next instruction and is stored in bytes, so
339 return static_cast<s32>((value ^ mask) - mask) + 1; 339 // divide it by the size of an instruction and add 1 to it.
340 return static_cast<s32>((value ^ mask) - mask) / sizeof(Instruction) + 1;
340 } 341 }
341 } bra; 342 } bra;
342 343