summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/video_core/engines/shader_bytecode.h14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/video_core/engines/shader_bytecode.h b/src/video_core/engines/shader_bytecode.h
index f495b623b..c7e3fb4b1 100644
--- a/src/video_core/engines/shader_bytecode.h
+++ b/src/video_core/engines/shader_bytecode.h
@@ -425,6 +425,7 @@ union Instruction {
425 425
426 union { 426 union {
427 BitField<50, 3, u64> component_mask_selector; 427 BitField<50, 3, u64> component_mask_selector;
428 BitField<0, 8, Register> gpr0;
428 BitField<28, 8, Register> gpr28; 429 BitField<28, 8, Register> gpr28;
429 430
430 bool HasTwoDestinations() const { 431 bool HasTwoDestinations() const {
@@ -432,13 +433,16 @@ union Instruction {
432 } 433 }
433 434
434 bool IsComponentEnabled(size_t component) const { 435 bool IsComponentEnabled(size_t component) const {
435 static constexpr std::array<size_t, 5> one_dest_mask{0x1, 0x2, 0x4, 0x8, 0x3}; 436 static constexpr std::array<std::array<u32, 8>, 4> mask_lut{
436 static constexpr std::array<size_t, 5> two_dest_mask{0x7, 0xb, 0xd, 0xe, 0xf}; 437 {{},
437 const auto& mask{HasTwoDestinations() ? two_dest_mask : one_dest_mask}; 438 {0x1, 0x2, 0x4, 0x8, 0x3},
439 {0x1, 0x2, 0x4, 0x8, 0x3, 0x9, 0xa, 0xc},
440 {0x7, 0xb, 0xd, 0xe, 0xf}}};
438 441
439 ASSERT(component_mask_selector < mask.size()); 442 size_t index{gpr0.Value() != Register::ZeroIndex ? 1U : 0U};
443 index |= gpr28.Value() != Register::ZeroIndex ? 2 : 0;
440 444
441 return ((1ull << component) & mask[component_mask_selector]) != 0; 445 return ((1ull << component) & mask_lut[index][component_mask_selector]) != 0;
442 } 446 }
443 } texs; 447 } texs;
444 448