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:
squidbus 2025-04-02 13:36:54 -07:00 committed by GitHub
parent eb300d0aa7
commit afd0251dd2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 168 additions and 34 deletions

View file

@ -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);
}