diff --git a/core/shader/recompiler/Translation/src/TranslationContext/SubwordPacking.cpp b/core/shader/recompiler/Translation/src/TranslationContext/SubwordPacking.cpp index 2179313bf..f16d28d82 100644 --- a/core/shader/recompiler/Translation/src/TranslationContext/SubwordPacking.cpp +++ b/core/shader/recompiler/Translation/src/TranslationContext/SubwordPacking.cpp @@ -1,5 +1,7 @@ #include "Translation/TranslationContext.hpp" #include +#include +#include namespace ShaderRecompiler { @@ -8,7 +10,15 @@ IrU32 TranslationContext::readU32(const RdnaOperand& operand) { } std::array TranslationContext::readU32Pair(const RdnaOperand& operand) { - return {readU32(operand), readU32(offsetOperand(operand, 1u))}; + switch (operand.kind) { + case RdnaOperandKind::LiteralConstant: return {readU32(operand), IrU32(ir.Constant(0u))}; + case RdnaOperandKind::IntegerInlineConstant: return {readU32(operand), IrU32(ir.Constant(operand.signedVal < 0 ? 0xffffffffu : 0u))}; + case RdnaOperandKind::FloatInlineConstant: { + const auto bits = std::bit_cast(static_cast(std::bit_cast(operand.value))); + return {IrU32(ir.Constant(static_cast(bits))), IrU32(ir.Constant(static_cast(bits >> 32u)))}; + } + default: return {readU32(operand), readU32(offsetOperand(operand, 1u))}; + } } IrU64 TranslationContext::readU64(const RdnaOperand& operand) {