mirror of
https://github.com/storytold/wgpu.git
synced 2026-11-25 17:01:15 +01:00
[wgsl-in] Handle modf and frexp (#2454)
This commit is contained in:
1 parent
f49314dbbd
commit
5329aa2bd5
26 files changed
+843
-205
No files matched your search
+11
-29
@@ -1015,38 +1015,20 @@ impl super::Validator {
|
||||
}
|
||||
}
|
||||
Mf::Modf | Mf::Frexp => {
|
||||
let arg1_ty = match (arg1_ty, arg2_ty, arg3_ty) {
|
||||
(Some(ty1), None, None) => ty1,
|
||||
_ => return Err(ExpressionError::WrongArgumentCount(fun)),
|
||||
};
|
||||
let (size0, width0) = match *arg_ty {
|
||||
if arg1_ty.is_some() | arg2_ty.is_some() | arg3_ty.is_some() {
|
||||
return Err(ExpressionError::WrongArgumentCount(fun));
|
||||
}
|
||||
if !matches!(
|
||||
*arg_ty,
|
||||
Ti::Scalar {
|
||||
kind: Sk::Float,
|
||||
width,
|
||||
} => (None, width),
|
||||
Ti::Vector {
|
||||
..
|
||||
} | Ti::Vector {
|
||||
kind: Sk::Float,
|
||||
size,
|
||||
width,
|
||||
} => (Some(size), width),
|
||||
_ => return Err(ExpressionError::InvalidArgumentType(fun, 0, arg)),
|
||||
};
|
||||
let good = match *arg1_ty {
|
||||
Ti::Pointer { base, space: _ } => module.types[base].inner == *arg_ty,
|
||||
Ti::ValuePointer {
|
||||
size,
|
||||
kind: Sk::Float,
|
||||
width,
|
||||
space: _,
|
||||
} => size == size0 && width == width0,
|
||||
_ => false,
|
||||
};
|
||||
if !good {
|
||||
return Err(ExpressionError::InvalidArgumentType(
|
||||
fun,
|
||||
1,
|
||||
arg1.unwrap(),
|
||||
));
|
||||
..
|
||||
},
|
||||
) {
|
||||
return Err(ExpressionError::InvalidArgumentType(fun, 1, arg));
|
||||
}
|
||||
}
|
||||
Mf::Ldexp => {
|
||||
|
||||
Reference in new issue
Block a user