mirror of
https://github.com/storytold/wgpu.git
synced 2026-11-20 06:21:13 +01:00
Handle Unpack2x16float in hlsl (#2002)
This commit is contained in:
1 parent
8f302a89ef
commit
cc985396da
1 file changed
+9
@@ -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