diff --git a/naga/src/back/hlsl/help.rs b/naga/src/back/hlsl/help.rs index 8e27a1e86c..bb3235945f 100644 --- a/naga/src/back/hlsl/help.rs +++ b/naga/src/back/hlsl/help.rs @@ -1128,10 +1128,7 @@ impl super::Writer<'_, W> { crate::MathFunction::Abs if matches!( func_ctx.resolve_type(arg, &module.types).scalar(), - Some(crate::Scalar { - kind: ScalarKind::Sint, - width: 4, - }) + Some(crate::Scalar::I32) ) => { let arg_ty = func_ctx.resolve_type(arg, &module.types); @@ -1186,13 +1183,7 @@ impl super::Writer<'_, W> { }; match (op, scalar) { - ( - crate::UnaryOperator::Negate, - crate::Scalar { - kind: ScalarKind::Sint, - width: 4, - }, - ) => { + (crate::UnaryOperator::Negate, crate::Scalar::I32) => { if !self.wrapped.unary_op.insert(wrapped) { continue; } diff --git a/naga/src/back/hlsl/writer.rs b/naga/src/back/hlsl/writer.rs index 4f8bc62974..c4cf8cd16d 100644 --- a/naga/src/back/hlsl/writer.rs +++ b/naga/src/back/hlsl/writer.rs @@ -2775,10 +2775,7 @@ impl<'a, W: fmt::Write> super::Writer<'a, W> { right, } if matches!( func_ctx.resolve_type(expr, &module.types).scalar(), - Some(Scalar { - kind: ScalarKind::Sint, - width: 4 - }) + Some(Scalar::I32) ) => { write!(self.out, "asint(asuint(",)?; @@ -3338,10 +3335,7 @@ impl<'a, W: fmt::Write> super::Writer<'a, W> { let op_str = match op { crate::UnaryOperator::Negate => { match func_ctx.resolve_type(expr, &module.types).scalar() { - Some(Scalar { - kind: ScalarKind::Sint, - width: 4, - }) => NEG_FUNCTION, + Some(Scalar::I32) => NEG_FUNCTION, _ => "-", } } @@ -3444,10 +3438,7 @@ impl<'a, W: fmt::Write> super::Writer<'a, W> { let fun = match fun { // comparison Mf::Abs => match func_ctx.resolve_type(arg, &module.types).scalar() { - Some(Scalar { - kind: ScalarKind::Sint, - width: 4, - }) => Function::Regular(ABS_FUNCTION), + Some(Scalar::I32) => Function::Regular(ABS_FUNCTION), _ => Function::Regular("abs"), }, Mf::Min => Function::Regular("min"), @@ -3735,11 +3726,7 @@ impl<'a, W: fmt::Write> super::Writer<'a, W> { // as non-32bit types are DXC only. Function::MissingIntOverload(fun_name) => { let scalar_kind = func_ctx.resolve_type(arg, &module.types).scalar(); - if let Some(Scalar { - kind: ScalarKind::Sint, - width: 4, - }) = scalar_kind - { + if let Some(Scalar::I32) = scalar_kind { write!(self.out, "asint({fun_name}(asuint(")?; self.write_expr(module, arg, func_ctx)?; write!(self.out, ")))")?; @@ -3753,11 +3740,7 @@ impl<'a, W: fmt::Write> super::Writer<'a, W> { // as non-32bit types are DXC only. Function::MissingIntReturnType(fun_name) => { let scalar_kind = func_ctx.resolve_type(arg, &module.types).scalar(); - if let Some(Scalar { - kind: ScalarKind::Sint, - width: 4, - }) = scalar_kind - { + if let Some(Scalar::I32) = scalar_kind { write!(self.out, "asint({fun_name}(")?; self.write_expr(module, arg, func_ctx)?; write!(self.out, "))")?;