rsx: Fix build

This commit is contained in:
kd-11 2025-11-16 18:13:32 +03:00
parent c2a894996a
commit b32ccacc57
2 changed files with 16 additions and 9 deletions

View file

@ -32,7 +32,7 @@ enum VectorLane : u8
W = 3, W = 3,
}; };
u32 FragmentProgramDecompiler::get_src_vector_mask(u32 opcode, int operand) u32 FragmentProgramDecompiler::get_src_vector_mask(u32 opcode, u32 operand)
{ {
auto decode = [&](const std::string& expr) -> u32 auto decode = [&](const std::string& expr) -> u32
{ {
@ -59,8 +59,6 @@ u32 FragmentProgramDecompiler::get_src_vector_mask(u32 opcode, int operand)
constexpr u32 xyzw = 0b1111; constexpr u32 xyzw = 0b1111;
constexpr u32 use_dst_mask = 1u << 31; constexpr u32 use_dst_mask = 1u << 31;
u32 temp = 0;
switch (opcode) switch (opcode)
{ {
case RSX_FP_OPCODE_NOP: case RSX_FP_OPCODE_NOP:
@ -672,11 +670,13 @@ void FragmentProgramDecompiler::AddCodeCond(const std::string& lhs, const std::s
AddCode(lhs + " = _select(" + lhs + ", " + src_prefix + rhs + ", " + cond + ");"); AddCode(lhs + " = _select(" + lhs + ", " + src_prefix + rhs + ", " + cond + ");");
} }
template<typename T> std::string FragmentProgramDecompiler::GetSRC(T src) template<typename T>
requires std::is_same_v<T, SRC0> || std::is_same_v<T, SRC1> || std::is_same_v<T, SRC2>
std::string FragmentProgramDecompiler::GetSRC(T src)
{ {
std::string ret; std::string ret;
u32 precision_modifier = 0; u32 precision_modifier = 0;
int operand_idx = -1; u32 operand_idx = umax;
if constexpr (std::is_same_v<T, SRC0>) if constexpr (std::is_same_v<T, SRC0>)
{ {
@ -693,8 +693,11 @@ template<typename T> std::string FragmentProgramDecompiler::GetSRC(T src)
precision_modifier = src1.src2_prec_mod; precision_modifier = src1.src2_prec_mod;
operand_idx = 2; operand_idx = 2;
} }
else
ensure(operand_idx != -1); {
// Unreachable unless we add another SRC type
fmt::throw_exception("Invalid SRC input");
}
switch (src.reg_type) switch (src.reg_type)
{ {

View file

@ -80,7 +80,11 @@ class FragmentProgramDecompiler
void AddCodeCond(const std::string& lhs, const std::string& rhs); void AddCodeCond(const std::string& lhs, const std::string& rhs);
std::string GetRawCond(); std::string GetRawCond();
std::string GetCond(); std::string GetCond();
template<typename T> std::string GetSRC(T src);
template<typename T>
requires std::is_same_v<T, SRC0> || std::is_same_v<T, SRC1> || std::is_same_v<T, SRC2>
std::string GetSRC(T src);
std::string BuildCode(); std::string BuildCode();
static u32 GetData(const u32 d) { return d << 16 | d >> 16; } static u32 GetData(const u32 d) { return d << 16 | d >> 16; }
@ -103,7 +107,7 @@ class FragmentProgramDecompiler
* Calculates the lane mask for a given input * Calculates the lane mask for a given input
* This is a temporary workaround until the decompiler is rewritten with some IR to allow granular split/gather passes * This is a temporary workaround until the decompiler is rewritten with some IR to allow granular split/gather passes
*/ */
u32 get_src_vector_mask(u32 opcode, int operand); u32 get_src_vector_mask(u32 opcode, u32 operand);
protected: protected:
const RSXFragmentProgram &m_prog; const RSXFragmentProgram &m_prog;