Check if the location of the original variable is set
This commit is contained in:
parent
2f48065ec1
commit
bafde4e917
@ -996,6 +996,12 @@ uint64_t Compiler::get_decoration_mask(uint32_t id) const
|
||||
return dec.decoration_flags;
|
||||
}
|
||||
|
||||
bool Compiler::is_decoration_set(uint32_t id, spv::Decoration decoration) const
|
||||
{
|
||||
auto &dec = meta.at(id).decoration;
|
||||
return (dec.decoration_flags & (1ull << DecorationLocation));
|
||||
}
|
||||
|
||||
uint32_t Compiler::get_decoration(uint32_t id, Decoration decoration) const
|
||||
{
|
||||
auto &dec = meta.at(id).decoration;
|
||||
|
@ -136,6 +136,8 @@ public:
|
||||
// Gets a bitmask for the decorations which are applied to ID.
|
||||
// I.e. (1ull << spv::DecorationFoo) | (1ull << spv::DecorationBar)
|
||||
uint64_t get_decoration_mask(uint32_t id) const;
|
||||
|
||||
bool is_decoration_set(uint32_t id, spv::Decoration decoration) const;
|
||||
|
||||
// Gets the value for decorations which take arguments.
|
||||
// If decoration doesn't exist or decoration is not recognized,
|
||||
|
@ -494,7 +494,9 @@ uint32_t CompilerMSL::add_interface_struct(StorageClass storage, uint32_t vtx_bi
|
||||
|
||||
// Copy the variable location from the original variable to the member
|
||||
auto &dec = meta[p_var->self].decoration;
|
||||
set_member_decoration(ib_type.self, ib_mbr_idx, DecorationLocation, dec.location);
|
||||
if (is_decoration_set(p_var->self, DecorationLocation)) {
|
||||
set_member_decoration(ib_type.self, ib_mbr_idx, DecorationLocation, dec.location);
|
||||
}
|
||||
|
||||
// Mark the member as builtin if needed
|
||||
if (is_builtin_variable(*p_var))
|
||||
|
Loading…
Reference in New Issue
Block a user