Merge pull request #2753 from FernandoS27/float-convert
Shader_Ir: Implement F16 Variants of F2F, F2I, I2F.
This commit is contained in:
commit
cedc1aab4a
5 changed files with 75 additions and 18 deletions
|
@ -1136,6 +1136,16 @@ private:
|
|||
Type::Float);
|
||||
}
|
||||
|
||||
std::string FCastHalf0(Operation operation) {
|
||||
const std::string op_a = VisitOperand(operation, 0, Type::HalfFloat);
|
||||
return fmt::format("({})[0]", op_a);
|
||||
}
|
||||
|
||||
std::string FCastHalf1(Operation operation) {
|
||||
const std::string op_a = VisitOperand(operation, 0, Type::HalfFloat);
|
||||
return fmt::format("({})[1]", op_a);
|
||||
}
|
||||
|
||||
template <Type type>
|
||||
std::string Min(Operation operation) {
|
||||
return GenerateBinaryCall(operation, "min", type, type, type);
|
||||
|
@ -1292,6 +1302,11 @@ private:
|
|||
return ApplyPrecise(operation, BitwiseCastResult(clamped, Type::HalfFloat));
|
||||
}
|
||||
|
||||
std::string HCastFloat(Operation operation) {
|
||||
const std::string op_a = VisitOperand(operation, 0, Type::Float);
|
||||
return fmt::format("fromHalf2(vec2({}, 0.0f))", op_a);
|
||||
}
|
||||
|
||||
std::string HUnpack(Operation operation) {
|
||||
const std::string operand{VisitOperand(operation, 0, Type::HalfFloat)};
|
||||
const auto value = [&]() -> std::string {
|
||||
|
@ -1732,6 +1747,8 @@ private:
|
|||
&GLSLDecompiler::Negate<Type::Float>,
|
||||
&GLSLDecompiler::Absolute<Type::Float>,
|
||||
&GLSLDecompiler::FClamp,
|
||||
&GLSLDecompiler::FCastHalf0,
|
||||
&GLSLDecompiler::FCastHalf1,
|
||||
&GLSLDecompiler::Min<Type::Float>,
|
||||
&GLSLDecompiler::Max<Type::Float>,
|
||||
&GLSLDecompiler::FCos,
|
||||
|
@ -1792,6 +1809,7 @@ private:
|
|||
&GLSLDecompiler::Absolute<Type::HalfFloat>,
|
||||
&GLSLDecompiler::HNegate,
|
||||
&GLSLDecompiler::HClamp,
|
||||
&GLSLDecompiler::HCastFloat,
|
||||
&GLSLDecompiler::HUnpack,
|
||||
&GLSLDecompiler::HMergeF32,
|
||||
&GLSLDecompiler::HMergeH0,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue