Allow stepping on floats in the validator (#724)

This commit is contained in:
Dzmitry Malyshau 2021-04-16 16:16:15 -04:00 committed by GitHub
parent 285a855e19
commit daf4c82376
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 7 deletions

View File

@ -280,7 +280,7 @@ impl<'a, W> Writer<'a, W> {
}
}
fn varying_required_features(&mut self, binding: Option<&Binding>, ty: Handle<Type>) {
fn varying_required_features(&mut self, binding: Option<&Binding>, ty: Handle<Type>) {
match self.module.types[ty].inner {
crate::TypeInner::Struct { ref members, .. } => {
for member in members {
@ -290,9 +290,11 @@ impl<'a, W> Writer<'a, W> {
_ => {
if let Some(&Binding::Location(_, Some(interpolation))) = binding {
match interpolation {
Interpolation::Linear => self.features.request(Features::NOPERSPECTIVE_QUALIFIER),
Interpolation::Linear => {
self.features.request(Features::NOPERSPECTIVE_QUALIFIER)
}
Interpolation::Sample => self.features.request(Features::SAMPLE_QUALIFIER),
_ => ()
_ => (),
};
}
}

View File

@ -949,7 +949,7 @@ impl super::Validator {
_ => return Err(ExpressionError::InvalidArgumentType(fun, 0, arg)),
}
}
Mf::Atan2 | Mf::Pow | Mf::Distance => {
Mf::Atan2 | Mf::Pow | Mf::Distance | Mf::Step => {
let arg1_ty = match (arg1_ty, arg2_ty) {
(Some(ty1), None) => ty1,
_ => return Err(ExpressionError::WrongArgumentCount(fun)),
@ -1006,7 +1006,7 @@ impl super::Validator {
));
}
}
Mf::Dot | Mf::Outer | Mf::Cross | Mf::Step | Mf::Reflect => {
Mf::Dot | Mf::Outer | Mf::Cross | Mf::Reflect => {
let arg1_ty = match (arg1_ty, arg2_ty) {
(Some(ty1), None) => ty1,
_ => return Err(ExpressionError::WrongArgumentCount(fun)),

View File

@ -35,7 +35,7 @@ struct Parameters {
msl_custom: bool,
#[cfg_attr(not(feature = "glsl-out"), allow(dead_code))]
#[serde(default)]
glsl_desktop_version: Option<u16>
glsl_desktop_version: Option<u16>,
}
#[allow(dead_code, unused_variables)]
@ -225,7 +225,10 @@ fn convert_wgsl() {
("image-copy", Targets::METAL),
("texture-array", Targets::SPIRV | Targets::METAL),
("operators", Targets::SPIRV | Targets::METAL | Targets::GLSL),
("interpolate", Targets::SPIRV | Targets::METAL | Targets::GLSL),
(
"interpolate",
Targets::SPIRV | Targets::METAL | Targets::GLSL,
),
];
for &(name, targets) in inputs.iter() {