- writer.write_op_name(var_id, var.name);
-}
-
-void SpirVGenerator::visit(InterfaceBlock &iface)
-{
- const vector<Layout::Qualifier> *layout_ql = (iface.layout ? &iface.layout->qualifiers : 0);
-
- bool push_const = false;
- if(layout_ql)
- {
- auto i = find_member(*layout_ql, string("push_constant"), &Layout::Qualifier::name);
- push_const = (i!=layout_ql->end());
- }
-
- StorageClass storage = (push_const ? STORAGE_PUSH_CONSTANT : get_interface_storage(iface.interface, true));
- Id type_id;
- if(iface.array)
- type_id = get_array_type_id(*iface.struct_declaration, 0);
- else
- type_id = get_id(*iface.struct_declaration);
- Id ptr_type_id = get_pointer_type_id(type_id, storage);
-
- Id block_id;
- if(iface.interface=="uniform")
- {
- Id &uni_id = declared_uniform_ids["b"+iface.block_name];
- if(uni_id)
- {
- insert_unique(declared_ids, &iface, Declaration(uni_id, ptr_type_id));
- return;
- }
-
- uni_id = block_id = allocate_id(iface, ptr_type_id);
- }
- else
- block_id = allocate_id(iface, ptr_type_id);
- writer.write_op_name(block_id, iface.instance_name);
-
- writer.write_op(content.globals, OP_VARIABLE, ptr_type_id, block_id, storage);
-
- if(layout_ql)
- {
- auto i = find_member(*layout_ql, string("binding"), &Layout::Qualifier::name);
- if(i!=layout_ql->end())
- writer.write_op_decorate(block_id, DECO_BINDING, i->value);
- }