mirror of
https://github.com/storytold/wgpu.git
synced 2026-11-20 14:31:08 +01:00
Functions can take pointers to unsized structs, but no other unsized types.
This commit is contained in:
1 parent
fd3b2a93d4
commit
1d0b3f3a75
3 files changed
+68
-3
No files matched your search
@@ -37,6 +37,8 @@ pub enum CallError {
|
||||
#[derive(Clone, Debug, thiserror::Error)]
|
||||
#[cfg_attr(test, derive(PartialEq))]
|
||||
pub enum LocalVariableError {
|
||||
#[error("Local variable has a type {0:?} that can't be stored in a local variable.")]
|
||||
InvalidType(Handle<crate::Type>),
|
||||
#[error("Initializer doesn't match the variable type")]
|
||||
InitializerType,
|
||||
}
|
||||
@@ -517,6 +519,12 @@ impl super::Validator {
|
||||
constants: &Arena<crate::Constant>,
|
||||
) -> Result<(), LocalVariableError> {
|
||||
log::debug!("var {:?}", var);
|
||||
if !self.types[var.ty.index()]
|
||||
.flags
|
||||
.contains(TypeFlags::DATA | TypeFlags::SIZED)
|
||||
{
|
||||
return Err(LocalVariableError::InvalidType(var.ty));
|
||||
}
|
||||
if let Some(const_handle) = var.init {
|
||||
match constants[const_handle].inner {
|
||||
crate::ConstantInner::Scalar { width, ref value } => {
|
||||
|
||||
Reference in new issue
Block a user