mirror of
https://github.com/gfx-rs/wgpu.git
synced 2026-04-22 03:02:01 -04:00
Handle Unpack2x16float in hlsl (#2002)
This commit is contained in:
@@ -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)?;
|
||||
|
||||
Reference in New Issue
Block a user