[spv-in] derive the block status of a structure from its members

This commit is contained in:
Dzmitry Malyshau
2021-02-03 11:32:12 -05:00
committed by Dzmitry Malyshau
parent 71fdaedcec
commit 0970ef0ea5

View File

@@ -34,6 +34,7 @@ use std::{convert::TryInto, num::NonZeroU32, path::PathBuf};
pub const SUPPORTED_CAPABILITIES: &[spirv::Capability] = &[
spirv::Capability::Shader,
spirv::Capability::CullDistance,
spirv::Capability::ImageQuery,
spirv::Capability::StorageImageExtendedFormats,
];
pub const SUPPORTED_EXTENSIONS: &[&str] = &[];
@@ -2016,6 +2017,7 @@ impl<I: Iterator<Item = u32>> Parser<I> {
let mut members = Vec::with_capacity(inst.wc as usize - 2);
let mut member_type_ids = Vec::with_capacity(members.capacity());
let mut host_shared = false;
for i in 0..u32::from(inst.wc) - 2 {
let type_id = self.next()?;
member_type_ids.push(type_id);
@@ -2024,6 +2026,8 @@ impl<I: Iterator<Item = u32>> Parser<I> {
.future_member_decor
.remove(&(id, i))
.unwrap_or_default();
// this is a bit of a hack
host_shared |= decor.offset.is_some();
members.push(crate::StructMember {
name: decor.name,
span: None, //TODO
@@ -2032,7 +2036,7 @@ impl<I: Iterator<Item = u32>> Parser<I> {
}
let inner = crate::TypeInner::Struct {
block: block_decor.is_some(),
block: block_decor.is_some() || host_shared,
members,
};
let ty_handle = module.types.append(crate::Type {