remove IsFinite & IsNormal completely

This commit is contained in:
teoxoy 2023-10-03 15:12:44 +02:00 committed by Jim Blandy
parent 04562dea26
commit d71f2541a3
8 changed files with 18 additions and 35 deletions

View File

@ -2981,12 +2981,8 @@ impl<'a, W: Write> Writer<'a, W> {
use crate::RelationalFunction as Rf;
let fun_name = match fun {
// There's no specific function for this but we can invert the result of `isinf`
Rf::IsFinite => "!isinf",
Rf::IsInf => "isinf",
Rf::IsNan => "isnan",
// There's also no function for this but we can invert `isnan`
Rf::IsNormal => "!isnan",
Rf::All => "all",
Rf::Any => "any",
};

View File

@ -3151,8 +3151,6 @@ impl<'a, W: fmt::Write> super::Writer<'a, W> {
Rf::Any => "any",
Rf::IsNan => "isnan",
Rf::IsInf => "isinf",
Rf::IsFinite => "isfinite",
Rf::IsNormal => "isnormal",
};
write!(self.out, "{fun_str}(")?;
self.write_expr(module, argument, func_ctx)?;

View File

@ -1671,8 +1671,6 @@ impl<W: Write> Writer<W> {
crate::RelationalFunction::All => "all",
crate::RelationalFunction::IsNan => "isnan",
crate::RelationalFunction::IsInf => "isinf",
crate::RelationalFunction::IsFinite => "isfinite",
crate::RelationalFunction::IsNormal => "isnormal",
};
write!(self.out, "{NAMESPACE}::{op}")?;
self.put_call_parameters(iter::once(argument), context)?;

View File

@ -1406,10 +1406,6 @@ impl<'w> BlockContext<'w> {
Rf::Any => spirv::Op::Any,
Rf::IsNan => spirv::Op::IsNan,
Rf::IsInf => spirv::Op::IsInf,
//TODO: these require Kernel capability
Rf::IsFinite | Rf::IsNormal => {
return Err(Error::FeatureNotImplemented("is finite/normal"))
}
};
let id = self.gen_id();
block

View File

@ -52,8 +52,6 @@ pub(super) const fn map_relational_fun(
Op::Any => Ok(Rf::Any),
Op::IsNan => Ok(Rf::IsNan),
Op::IsInf => Ok(Rf::IsInf),
Op::IsFinite => Ok(Rf::IsFinite),
Op::IsNormal => Ok(Rf::IsNormal),
_ => Err(Error::UnknownRelationalFunction(word)),
}
}

View File

@ -1117,8 +1117,6 @@ pub enum RelationalFunction {
Any,
IsNan,
IsInf,
IsFinite,
IsNormal,
}
/// Built-in shader function for math.

View File

@ -648,25 +648,24 @@ impl<'a> ResolveContext<'a> {
width: crate::BOOL_WIDTH,
})
}
crate::RelationalFunction::IsNan
| crate::RelationalFunction::IsInf
| crate::RelationalFunction::IsFinite
| crate::RelationalFunction::IsNormal => match *past(argument)?.inner_with(types) {
Ti::Scalar { .. } => TypeResolution::Value(Ti::Scalar {
kind: crate::ScalarKind::Bool,
width: crate::BOOL_WIDTH,
}),
Ti::Vector { size, .. } => TypeResolution::Value(Ti::Vector {
kind: crate::ScalarKind::Bool,
width: crate::BOOL_WIDTH,
size,
}),
ref other => {
return Err(ResolveError::IncompatibleOperands(format!(
"{fun:?}({other:?})"
)))
crate::RelationalFunction::IsNan | crate::RelationalFunction::IsInf => {
match *past(argument)?.inner_with(types) {
Ti::Scalar { .. } => TypeResolution::Value(Ti::Scalar {
kind: crate::ScalarKind::Bool,
width: crate::BOOL_WIDTH,
}),
Ti::Vector { size, .. } => TypeResolution::Value(Ti::Vector {
kind: crate::ScalarKind::Bool,
width: crate::BOOL_WIDTH,
size,
}),
ref other => {
return Err(ResolveError::IncompatibleOperands(format!(
"{fun:?}({other:?})"
)))
}
}
},
}
},
crate::Expression::Math {
fun,

View File

@ -897,7 +897,7 @@ impl super::Validator {
return Err(ExpressionError::InvalidBooleanVector(argument));
}
},
Rf::IsNan | Rf::IsInf | Rf::IsFinite | Rf::IsNormal => match *argument_inner {
Rf::IsNan | Rf::IsInf => match *argument_inner {
Ti::Scalar {
kind: Sk::Float, ..
}