diff options
| author | 2018-06-05 10:09:35 -0400 | |
|---|---|---|
| committer | 2018-06-05 10:09:35 -0400 | |
| commit | 38eb33f150a8bef4e6be883b1e153fabb21d4384 (patch) | |
| tree | 71cfa84d723526232f7b7203e779b3079a24c597 /src | |
| parent | Merge pull request #520 from bunnei/shader-shl (diff) | |
| parent | GPU: Corrected the branch targets for the shader bra instruction. (diff) | |
| download | yuzu-38eb33f150a8bef4e6be883b1e153fabb21d4384.tar.gz yuzu-38eb33f150a8bef4e6be883b1e153fabb21d4384.tar.xz yuzu-38eb33f150a8bef4e6be883b1e153fabb21d4384.zip | |
Merge pull request #521 from Subv/bra
GPU: Corrected the branch targets for the shader bra instruction.
Diffstat (limited to 'src')
| -rw-r--r-- | src/video_core/engines/shader_bytecode.h | 9 |
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 ef749937e..38757c038 100644 --- a/src/video_core/engines/shader_bytecode.h +++ b/src/video_core/engines/shader_bytecode.h | |||
| @@ -325,15 +325,16 @@ union Instruction { | |||
| 325 | } texs; | 325 | } texs; |
| 326 | 326 | ||
| 327 | union { | 327 | union { |
| 328 | BitField<20, 5, u64> target; | 328 | BitField<20, 24, u64> target; |
| 329 | BitField<5, 1, u64> constant_buffer; | 329 | BitField<5, 1, u64> constant_buffer; |
| 330 | 330 | ||
| 331 | s32 GetBranchTarget() const { | 331 | s32 GetBranchTarget() const { |
| 332 | // Sign extend the branch target offset | 332 | // Sign extend the branch target offset |
| 333 | u32 mask = 1U << (5 - 1); | 333 | u32 mask = 1U << (24 - 1); |
| 334 | u32 value = static_cast<u32>(target); | 334 | u32 value = static_cast<u32>(target); |
| 335 | // The branch offset is relative to the next instruction, so add 1 to it. | 335 | // The branch offset is relative to the next instruction and is stored in bytes, so |
| 336 | return static_cast<s32>((value ^ mask) - mask) + 1; | 336 | // divide it by the size of an instruction and add 1 to it. |
| 337 | return static_cast<s32>((value ^ mask) - mask) / sizeof(Instruction) + 1; | ||
| 337 | } | 338 | } |
| 338 | } bra; | 339 | } bra; |
| 339 | 340 | ||