mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-07-30 14:04:55 +00:00
shader_recompiler: renamed SrcValue to SrcValue & added simple docs
This commit is contained in:
parent
523fc24fb1
commit
813e1ef1a3
@ -309,11 +309,8 @@ IR::U64F64 Translator::GetSrcRaw64(const InstOperand& operand, bool integer) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
Translator::SrcAuto Translator::GetSrc<Translator::SrcAuto>(const InstOperand& operand) {
|
Translator::SrcValue Translator::GetSrc<Translator::SrcValue>(const InstOperand& operand) {
|
||||||
return SrcAuto{
|
return SrcValue{*this, operand};
|
||||||
*this,
|
|
||||||
operand,
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
@ -346,31 +343,31 @@ IR::F64 Translator::GetSrc(const InstOperand& operand) {
|
|||||||
return GetSrcRaw64(operand, false);
|
return GetSrcRaw64(operand, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
Translator::SrcAuto::operator IR::U32F32() const {
|
Translator::SrcValue::operator IR::U32F32() const {
|
||||||
return translator.GetSrc<IR::U32F32>(operand);
|
return translator.GetSrc<IR::U32F32>(operand);
|
||||||
}
|
}
|
||||||
|
|
||||||
Translator::SrcAuto::operator IR::Value() const {
|
Translator::SrcValue::operator IR::Value() const {
|
||||||
return IR::Value{translator.GetSrc<IR::U32F32>(operand)};
|
return IR::Value{translator.GetSrc<IR::U32F32>(operand)};
|
||||||
}
|
}
|
||||||
|
|
||||||
Translator::SrcAuto::operator IR::U32() const {
|
Translator::SrcValue::operator IR::U32() const {
|
||||||
return translator.GetSrc<IR::U32>(operand);
|
return translator.GetSrc<IR::U32>(operand);
|
||||||
}
|
}
|
||||||
|
|
||||||
Translator::SrcAuto::operator IR::F32() const {
|
Translator::SrcValue::operator IR::F32() const {
|
||||||
return translator.GetSrc<IR::F32>(operand);
|
return translator.GetSrc<IR::F32>(operand);
|
||||||
}
|
}
|
||||||
|
|
||||||
Translator::SrcAuto::operator IR::U64F64() const {
|
Translator::SrcValue::operator IR::U64F64() const {
|
||||||
return translator.GetSrc<IR::U64F64>(operand);
|
return translator.GetSrc<IR::U64F64>(operand);
|
||||||
}
|
}
|
||||||
|
|
||||||
Translator::SrcAuto::operator IR::U64() const {
|
Translator::SrcValue::operator IR::U64() const {
|
||||||
return translator.GetSrc<IR::U64>(operand);
|
return translator.GetSrc<IR::U64>(operand);
|
||||||
}
|
}
|
||||||
|
|
||||||
Translator::SrcAuto::operator IR::F64() const {
|
Translator::SrcValue::operator IR::F64() const {
|
||||||
return translator.GetSrc<IR::F64>(operand);
|
return translator.GetSrc<IR::F64>(operand);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -209,11 +209,11 @@ public:
|
|||||||
void IMAGE_ATOMIC(AtomicOp op, const GcnInst& inst);
|
void IMAGE_ATOMIC(AtomicOp op, const GcnInst& inst);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
struct SrcAuto;
|
struct SrcValue;
|
||||||
[[nodiscard]] IR::U32F32 GetSrcRaw(const InstOperand& operand, bool integer);
|
[[nodiscard]] IR::U32F32 GetSrcRaw(const InstOperand& operand, bool integer);
|
||||||
[[nodiscard]] IR::U64F64 GetSrcRaw64(const InstOperand& operand, bool integer);
|
[[nodiscard]] IR::U64F64 GetSrcRaw64(const InstOperand& operand, bool integer);
|
||||||
|
|
||||||
template <typename T = SrcAuto>
|
template <typename T = SrcValue>
|
||||||
[[nodiscard]] T GetSrc(const InstOperand& operand);
|
[[nodiscard]] T GetSrc(const InstOperand& operand);
|
||||||
|
|
||||||
void SetDst(const InstOperand& operand, const IR::U32F32& value);
|
void SetDst(const InstOperand& operand, const IR::U32F32& value);
|
||||||
@ -228,23 +228,27 @@ private:
|
|||||||
IR::U32 m0_value;
|
IR::U32 m0_value;
|
||||||
bool opcode_missing = false;
|
bool opcode_missing = false;
|
||||||
|
|
||||||
class SrcAuto {
|
/**
|
||||||
|
* This is a wrapper for IR::Value returned by GetSrc to lazy
|
||||||
|
* evaluate the correct type and auto-cast to integer if needed.
|
||||||
|
*/
|
||||||
|
class SrcValue {
|
||||||
Translator& translator;
|
Translator& translator;
|
||||||
const InstOperand& operand;
|
const InstOperand& operand;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
SrcAuto(Translator& translator, const InstOperand& operand)
|
SrcValue(Translator& translator, const InstOperand& operand)
|
||||||
: translator(translator), operand(operand) {}
|
: translator(translator), operand(operand) {}
|
||||||
|
|
||||||
operator IR::Value() const;
|
explicit(false) operator IR::Value() const;
|
||||||
|
|
||||||
operator IR::U32F32() const;
|
explicit(false) operator IR::U32F32() const;
|
||||||
operator IR::U32() const;
|
explicit(false) operator IR::U32() const;
|
||||||
operator IR::F32() const;
|
explicit(false) operator IR::F32() const;
|
||||||
|
|
||||||
operator IR::U64F64() const;
|
explicit(false) operator IR::U64F64() const;
|
||||||
operator IR::U64() const;
|
explicit(false) operator IR::U64() const;
|
||||||
operator IR::F64() const;
|
explicit(false) operator IR::F64() const;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user