mirror of
https://github.com/gfx-rs/wgpu.git
synced 2026-04-22 03:02:01 -04:00
[mtl] detect binding incomatibility
This commit is contained in:
committed by
Dzmitry Malyshau
parent
6e9410c056
commit
a92f7689f2
@@ -2007,15 +2007,27 @@ impl<W: Write> Writer<W> {
|
||||
let mut ep_error = None;
|
||||
let mut supports_array_length = false;
|
||||
|
||||
// skip this entry point if any global bindings are missing
|
||||
// skip this entry point if any global bindings are missing,
|
||||
// or their types are incompatible.
|
||||
if !options.fake_missing_bindings {
|
||||
for (var_handle, var) in module.global_variables.iter() {
|
||||
if fun_info[var_handle].is_empty() {
|
||||
continue;
|
||||
}
|
||||
if let Some(ref br) = var.binding {
|
||||
if let Err(e) = options.resolve_resource_binding(ep.stage, br) {
|
||||
ep_error = Some(e);
|
||||
let good = match options.per_stage_map[ep.stage].resources.get(br) {
|
||||
Some(target) => match module.types[var.ty].inner {
|
||||
crate::TypeInner::Struct {
|
||||
top_level: true, ..
|
||||
} => target.buffer.is_some(),
|
||||
crate::TypeInner::Image { .. } => target.texture.is_some(),
|
||||
crate::TypeInner::Sampler { .. } => target.sampler.is_some(),
|
||||
_ => false,
|
||||
},
|
||||
None => false,
|
||||
};
|
||||
if !good {
|
||||
ep_error = Some(super::EntryPointError::MissingBinding(br.clone()));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -898,10 +898,9 @@ impl<'function> Context<'function> {
|
||||
let expr_type = program.resolve_type(self, *expr, meta)?;
|
||||
|
||||
if let (&TypeInner::Scalar { .. }, Some(size)) = (expr_type, vector_size) {
|
||||
*expr = self.expressions.append(Expression::Splat {
|
||||
size,
|
||||
value: *expr,
|
||||
})
|
||||
*expr = self
|
||||
.expressions
|
||||
.append(Expression::Splat { size, value: *expr })
|
||||
}
|
||||
|
||||
Ok(())
|
||||
|
||||
Reference in New Issue
Block a user