mirror of
https://github.com/gfx-rs/wgpu.git
synced 2024-11-26 16:53:48 +00:00
Fix WGSL variable storage classes, spv-out interface
This commit is contained in:
parent
211bec44a1
commit
2d1006835a
@ -390,15 +390,16 @@ impl Writer {
|
||||
let function_id = self.write_function(&entry_point.function, ir_module)?;
|
||||
|
||||
let mut interface_ids = vec![];
|
||||
for ((handle, _), &usage) in ir_module
|
||||
for ((handle, var), &usage) in ir_module
|
||||
.global_variables
|
||||
.iter()
|
||||
.filter(|&(_, var)| {
|
||||
var.class == crate::StorageClass::Input || var.class == crate::StorageClass::Output
|
||||
})
|
||||
.zip(&entry_point.function.global_usage)
|
||||
{
|
||||
if usage.contains(crate::GlobalUse::STORE) || usage.contains(crate::GlobalUse::LOAD) {
|
||||
let is_io = match var.class {
|
||||
crate::StorageClass::Input | crate::StorageClass::Output => !usage.is_empty(),
|
||||
_ => false,
|
||||
};
|
||||
if is_io {
|
||||
let id = self.get_global_variable_id(ir_module, handle)?;
|
||||
interface_ids.push(id);
|
||||
}
|
||||
|
@ -1960,7 +1960,16 @@ impl Parser {
|
||||
crate::BuiltIn::Position => crate::StorageClass::Output,
|
||||
_ => unimplemented!(),
|
||||
},
|
||||
_ => crate::StorageClass::Handle,
|
||||
Some(crate::Binding::Resource { .. }) => {
|
||||
match module.types[pvar.ty].inner {
|
||||
crate::TypeInner::Struct { .. } if pvar.access.is_empty() => {
|
||||
crate::StorageClass::Uniform
|
||||
}
|
||||
crate::TypeInner::Struct { .. } => crate::StorageClass::Storage,
|
||||
_ => crate::StorageClass::Handle,
|
||||
}
|
||||
}
|
||||
_ => crate::StorageClass::Private,
|
||||
},
|
||||
};
|
||||
let var_handle = module.global_variables.append(crate::GlobalVariable {
|
||||
|
Loading…
Reference in New Issue
Block a user