mirror of
https://github.com/gfx-rs/wgpu.git
synced 2026-04-22 03:02:01 -04:00
[glsl-in] Fix StorageClass for texture and sampler
This commit is contained in:
committed by
Dzmitry Malyshau
parent
20227e7c87
commit
c04c971907
@@ -1087,7 +1087,7 @@ pomelo! {
|
||||
}).unwrap_or(StorageQualifier::StorageClass(StorageClass::Private));
|
||||
|
||||
match storage {
|
||||
StorageQualifier::StorageClass(class) => {
|
||||
StorageQualifier::StorageClass(storage_class) => {
|
||||
// TODO: Check that the storage qualifiers allow for the bindings
|
||||
let binding = d.type_qualifiers.iter().find_map(|tq| {
|
||||
if let TypeQualifier::Binding(b) = tq { Some(b.clone()) } else { None }
|
||||
@@ -1100,6 +1100,16 @@ pomelo! {
|
||||
for (id, initializer) in d.ids_initializers {
|
||||
let init = initializer.map(|init| extra.solve_constant(init.expression)).transpose()?;
|
||||
|
||||
// use StorageClass::Handle for texture and sampler uniforms
|
||||
let class = if storage_class == StorageClass::Uniform {
|
||||
match extra.module.types[d.ty].inner {
|
||||
TypeInner::Image{..} | TypeInner::Sampler{..} => StorageClass::Handle,
|
||||
_ => storage_class,
|
||||
}
|
||||
} else {
|
||||
storage_class
|
||||
};
|
||||
|
||||
let h = extra.module.global_variables.fetch_or_append(
|
||||
GlobalVariable {
|
||||
name: id.clone(),
|
||||
|
||||
Reference in New Issue
Block a user