diff --git a/src/back/hlsl/writer.rs b/src/back/hlsl/writer.rs index 39c9cdab75..a37a89444a 100644 --- a/src/back/hlsl/writer.rs +++ b/src/back/hlsl/writer.rs @@ -2422,6 +2422,7 @@ impl<'a, W: fmt::Write> super::Writer<'a, W> { enum Function { Asincosh { is_sin: bool }, Atanh, + Unpack2x16float, Regular(&'static str), MissingIntOverload(&'static str), } @@ -2489,6 +2490,7 @@ impl<'a, W: fmt::Write> super::Writer<'a, W> { Mf::ReverseBits => Function::MissingIntOverload("reversebits"), Mf::FindLsb => Function::Regular("firstbitlow"), Mf::FindMsb => Function::Regular("firstbithigh"), + Mf::Unpack2x16float => Function::Unpack2x16float, _ => return Err(Error::Unimplemented(format!("write_expr_math {:?}", fun))), }; @@ -2512,6 +2514,13 @@ impl<'a, W: fmt::Write> super::Writer<'a, W> { self.write_expr(module, arg, func_ctx)?; write!(self.out, "))")?; } + Function::Unpack2x16float => { + write!(self.out, "float2(f16tof32(")?; + self.write_expr(module, arg, func_ctx)?; + write!(self.out, "), f16tof32((")?; + self.write_expr(module, arg, func_ctx)?; + write!(self.out, ") >> 16))")?; + } Function::Regular(fun_name) => { write!(self.out, "{}(", fun_name)?; self.write_expr(module, arg, func_ctx)?;