mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-06-26 04:16:18 +00:00
shader_recompiler: Use VK_AMD_shader_trinary_minmax when available. (#2739)
* shader_recompiler: Use VK_AMD_shader_trinary_minmax when available. * shader_recompiler: Simplify signed/unsigned trinary instruction variants.
This commit is contained in:
parent
eb300d0aa7
commit
afd0251dd2
13 changed files with 168 additions and 34 deletions
|
@ -1336,6 +1336,18 @@ F32F64 IREmitter::FPMin(const F32F64& lhs, const F32F64& rhs, bool is_legacy) {
|
|||
}
|
||||
}
|
||||
|
||||
F32F64 IREmitter::FPMinTri(const F32F64& a, const F32F64& b, const F32F64& c) {
|
||||
return Inst<F32>(Opcode::FPMinTri32, a, b, c);
|
||||
}
|
||||
|
||||
F32F64 IREmitter::FPMaxTri(const F32F64& a, const F32F64& b, const F32F64& c) {
|
||||
return Inst<F32>(Opcode::FPMaxTri32, a, b, c);
|
||||
}
|
||||
|
||||
F32F64 IREmitter::FPMedTri(const F32F64& a, const F32F64& b, const F32F64& c) {
|
||||
return Inst<F32>(Opcode::FPMedTri32, a, b, c);
|
||||
}
|
||||
|
||||
U32U64 IREmitter::IAdd(const U32U64& a, const U32U64& b) {
|
||||
if (a.Type() != b.Type()) {
|
||||
UNREACHABLE_MSG("Mismatching types {} and {}", a.Type(), b.Type());
|
||||
|
@ -1567,6 +1579,42 @@ U32 IREmitter::IMax(const U32& a, const U32& b, bool is_signed) {
|
|||
return is_signed ? SMax(a, b) : UMax(a, b);
|
||||
}
|
||||
|
||||
U32 IREmitter::SMinTri(const U32& a, const U32& b, const U32& c) {
|
||||
return Inst<U32>(Opcode::SMinTri32, a, b, c);
|
||||
}
|
||||
|
||||
U32 IREmitter::UMinTri(const U32& a, const U32& b, const U32& c) {
|
||||
return Inst<U32>(Opcode::UMinTri32, a, b, c);
|
||||
}
|
||||
|
||||
U32 IREmitter::IMinTri(const U32& a, const U32& b, const U32& c, bool is_signed) {
|
||||
return is_signed ? SMinTri(a, b, c) : UMinTri(a, b, c);
|
||||
}
|
||||
|
||||
U32 IREmitter::SMaxTri(const U32& a, const U32& b, const U32& c) {
|
||||
return Inst<U32>(Opcode::SMaxTri32, a, b, c);
|
||||
}
|
||||
|
||||
U32 IREmitter::UMaxTri(const U32& a, const U32& b, const U32& c) {
|
||||
return Inst<U32>(Opcode::UMaxTri32, a, b, c);
|
||||
}
|
||||
|
||||
U32 IREmitter::IMaxTri(const U32& a, const U32& b, const U32& c, bool is_signed) {
|
||||
return is_signed ? SMaxTri(a, b, c) : UMaxTri(a, b, c);
|
||||
}
|
||||
|
||||
U32 IREmitter::SMedTri(const U32& a, const U32& b, const U32& c) {
|
||||
return Inst<U32>(Opcode::SMedTri32, a, b, c);
|
||||
}
|
||||
|
||||
U32 IREmitter::UMedTri(const U32& a, const U32& b, const U32& c) {
|
||||
return Inst<U32>(Opcode::UMedTri32, a, b, c);
|
||||
}
|
||||
|
||||
U32 IREmitter::IMedTri(const U32& a, const U32& b, const U32& c, bool is_signed) {
|
||||
return is_signed ? SMedTri(a, b, c) : UMedTri(a, b, c);
|
||||
}
|
||||
|
||||
U32 IREmitter::SClamp(const U32& value, const U32& min, const U32& max) {
|
||||
return Inst<U32>(Opcode::SClamp32, value, min, max);
|
||||
}
|
||||
|
|
|
@ -233,6 +233,9 @@ public:
|
|||
[[nodiscard]] U1 FPUnordered(const F32F64& lhs, const F32F64& rhs);
|
||||
[[nodiscard]] F32F64 FPMax(const F32F64& lhs, const F32F64& rhs, bool is_legacy = false);
|
||||
[[nodiscard]] F32F64 FPMin(const F32F64& lhs, const F32F64& rhs, bool is_legacy = false);
|
||||
[[nodiscard]] F32F64 FPMinTri(const F32F64& a, const F32F64& b, const F32F64& c);
|
||||
[[nodiscard]] F32F64 FPMaxTri(const F32F64& a, const F32F64& b, const F32F64& c);
|
||||
[[nodiscard]] F32F64 FPMedTri(const F32F64& a, const F32F64& b, const F32F64& c);
|
||||
|
||||
[[nodiscard]] U32U64 IAdd(const U32U64& a, const U32U64& b);
|
||||
[[nodiscard]] Value IAddCary(const U32& a, const U32& b);
|
||||
|
@ -266,6 +269,15 @@ public:
|
|||
[[nodiscard]] U32 SMax(const U32& a, const U32& b);
|
||||
[[nodiscard]] U32 UMax(const U32& a, const U32& b);
|
||||
[[nodiscard]] U32 IMax(const U32& a, const U32& b, bool is_signed);
|
||||
[[nodiscard]] U32 SMinTri(const U32& a, const U32& b, const U32& c);
|
||||
[[nodiscard]] U32 UMinTri(const U32& a, const U32& b, const U32& c);
|
||||
[[nodiscard]] U32 IMinTri(const U32& a, const U32& b, const U32& c, bool is_signed);
|
||||
[[nodiscard]] U32 SMaxTri(const U32& a, const U32& b, const U32& c);
|
||||
[[nodiscard]] U32 UMaxTri(const U32& a, const U32& b, const U32& c);
|
||||
[[nodiscard]] U32 IMaxTri(const U32& a, const U32& b, const U32& c, bool is_signed);
|
||||
[[nodiscard]] U32 SMedTri(const U32& a, const U32& b, const U32& c);
|
||||
[[nodiscard]] U32 UMedTri(const U32& a, const U32& b, const U32& c);
|
||||
[[nodiscard]] U32 IMedTri(const U32& a, const U32& b, const U32& c, bool is_signed);
|
||||
[[nodiscard]] U32 SClamp(const U32& value, const U32& min, const U32& max);
|
||||
[[nodiscard]] U32 UClamp(const U32& value, const U32& min, const U32& max);
|
||||
|
||||
|
|
|
@ -241,6 +241,9 @@ OPCODE(FPMax32, F32, F32,
|
|||
OPCODE(FPMax64, F64, F64, F64, )
|
||||
OPCODE(FPMin32, F32, F32, F32, U1, )
|
||||
OPCODE(FPMin64, F64, F64, F64, )
|
||||
OPCODE(FPMinTri32, F32, F32, F32, F32, )
|
||||
OPCODE(FPMaxTri32, F32, F32, F32, F32, )
|
||||
OPCODE(FPMedTri32, F32, F32, F32, F32, )
|
||||
OPCODE(FPMul32, F32, F32, F32, )
|
||||
OPCODE(FPMul64, F64, F64, F64, )
|
||||
OPCODE(FPDiv32, F32, F32, F32, )
|
||||
|
@ -350,6 +353,12 @@ OPCODE(SMin32, U32, U32,
|
|||
OPCODE(UMin32, U32, U32, U32, )
|
||||
OPCODE(SMax32, U32, U32, U32, )
|
||||
OPCODE(UMax32, U32, U32, U32, )
|
||||
OPCODE(SMinTri32, U32, U32, U32, U32, )
|
||||
OPCODE(UMinTri32, U32, U32, U32, U32, )
|
||||
OPCODE(SMaxTri32, U32, U32, U32, U32, )
|
||||
OPCODE(UMaxTri32, U32, U32, U32, U32, )
|
||||
OPCODE(SMedTri32, U32, U32, U32, U32, )
|
||||
OPCODE(UMedTri32, U32, U32, U32, U32, )
|
||||
OPCODE(SClamp32, U32, U32, U32, U32, )
|
||||
OPCODE(UClamp32, U32, U32, U32, U32, )
|
||||
OPCODE(SLessThan32, U1, U32, U32, )
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue