Browse Source
Merge pull request #521 from Subv/bra
GPU: Corrected the branch targets for the shader bra instruction.
pull/15/merge
bunnei
8 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
5 additions and
4 deletions
-
src/video_core/engines/shader_bytecode.h
|
|
@ -325,15 +325,16 @@ union Instruction { |
|
|
} texs; |
|
|
} texs; |
|
|
|
|
|
|
|
|
union { |
|
|
union { |
|
|
BitField<20, 5, u64> target; |
|
|
|
|
|
|
|
|
BitField<20, 24, u64> target; |
|
|
BitField<5, 1, u64> constant_buffer; |
|
|
BitField<5, 1, u64> constant_buffer; |
|
|
|
|
|
|
|
|
s32 GetBranchTarget() const { |
|
|
s32 GetBranchTarget() const { |
|
|
// Sign extend the branch target offset |
|
|
// Sign extend the branch target offset |
|
|
u32 mask = 1U << (5 - 1); |
|
|
|
|
|
|
|
|
u32 mask = 1U << (24 - 1); |
|
|
u32 value = static_cast<u32>(target); |
|
|
u32 value = static_cast<u32>(target); |
|
|
// The branch offset is relative to the next instruction, so add 1 to it. |
|
|
|
|
|
return static_cast<s32>((value ^ mask) - mask) + 1; |
|
|
|
|
|
|
|
|
// The branch offset is relative to the next instruction and is stored in bytes, so |
|
|
|
|
|
// divide it by the size of an instruction and add 1 to it. |
|
|
|
|
|
return static_cast<s32>((value ^ mask) - mask) / sizeof(Instruction) + 1; |
|
|
} |
|
|
} |
|
|
} bra; |
|
|
} bra; |
|
|
|
|
|
|
|
|
|