[glsl-in] Add support for interface blocks

This commit is contained in:
Kristoffer Søholm
2020-11-02 21:40:04 +01:00
committed by Dzmitry Malyshau
parent 8618a8a207
commit 973cfbc5d3

View File

@@ -1071,7 +1071,29 @@ pomelo! {
);
if let Some(id) = id {
extra.lookup_global_variables.insert(id, h);
} else {
// variables in interface blocks without an instance name are in the global namespace
// https://www.khronos.org/opengl/wiki/Interface_Block_(GLSL)
if let TypeInner::Struct { members } = &extra.module.types[d.ty].inner {
for m in members {
if let Some(name) = &m.name {
let h = extra
.module
.global_variables
.fetch_or_append(GlobalVariable {
name: Some(name.into()),
class,
binding: binding.clone(),
ty: m.ty,
interpolation,
storage_access: StorageAccess::empty(), // TODO
});
extra.lookup_global_variables.insert(name.into(), h);
}
}
}
}
}
}