From 06c72b4fcf11af7a0c68ef714521b784f0c7cc5b Mon Sep 17 00:00:00 2001 From: Subv Date: Sat, 2 Jun 2018 14:22:55 -0500 Subject: GPU: Added decoding for the BRA instruction. --- src/video_core/engines/shader_bytecode.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/video_core/engines') diff --git a/src/video_core/engines/shader_bytecode.h b/src/video_core/engines/shader_bytecode.h index da64430e9..61643e086 100644 --- a/src/video_core/engines/shader_bytecode.h +++ b/src/video_core/engines/shader_bytecode.h @@ -306,6 +306,7 @@ class OpCode { public: enum class Id { KIL, + BRA, LD_A, ST_A, TEX, @@ -470,6 +471,7 @@ private: std::vector table = { #define INST(bitstring, op, type, name) Detail::GetMatcher(bitstring, op, type, name) INST("111000110011----", Id::KIL, Type::Flow, "KIL"), + INST("111000100100----", Id::BRA, Type::Flow, "BRA"), INST("1110111111011---", Id::LD_A, Type::Memory, "LD_A"), INST("1110111111110---", Id::ST_A, Type::Memory, "ST_A"), INST("1100000000111---", Id::TEX, Type::Memory, "TEX"), -- cgit v1.2.3 From b481d8a00d5f09e091e03ed4b7c4d9f9652e0969 Mon Sep 17 00:00:00 2001 From: Subv Date: Sat, 2 Jun 2018 14:45:50 -0500 Subject: GPU: Partially implemented the shader BRA instruction. --- src/video_core/engines/shader_bytecode.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/video_core/engines') diff --git a/src/video_core/engines/shader_bytecode.h b/src/video_core/engines/shader_bytecode.h index 61643e086..a57b90632 100644 --- a/src/video_core/engines/shader_bytecode.h +++ b/src/video_core/engines/shader_bytecode.h @@ -288,6 +288,19 @@ union Instruction { } } texs; + union { + BitField<20, 5, u64> target; + BitField<5, 1, u64> constant_buffer; + + s32 GetBranchTarget() const { + // Sign extend the branch target offset + u32 mask = 1U << (5 - 1); + u32 value = static_cast(target); + // The branch offset is relative to the next instruction, so add 1 to it. + return static_cast((value ^ mask) - mask) + 1; + } + } bra; + BitField<61, 1, u64> is_b_imm; BitField<60, 1, u64> is_b_gpr; BitField<59, 1, u64> is_c_gpr; -- cgit v1.2.3