summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Subv2018-06-04 22:56:28 -0500
committerGravatar Subv2018-06-04 22:56:28 -0500
commite7dfcdde74e0dfdb3c8da097201d90cbc48c7ff9 (patch)
treec53ffcd6a965b7483ec5013c505a963071cf7437 /src
parentMerge pull request #518 from Subv/incomplete_shaders (diff)
downloadyuzu-e7dfcdde74e0dfdb3c8da097201d90cbc48c7ff9.tar.gz
yuzu-e7dfcdde74e0dfdb3c8da097201d90cbc48c7ff9.tar.xz
yuzu-e7dfcdde74e0dfdb3c8da097201d90cbc48c7ff9.zip
GPU: Corrected the branch targets for the shader bra instruction.
Diffstat (limited to 'src')
-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