void DeclarationValidator::visit(Layout &layout)
{
+ bool push_constant = false;
+ bool binding = false;
for(const Layout::Qualifier &q: layout.qualifiers)
{
bool allowed = false;
allowed = (variable && scope==GLOBAL);
else if(q.name=="binding" || q.name=="set")
{
+ binding = true;
+
if(q.name=="set")
{
error(layout, "Layout qualifier 'set' not allowed when targeting OpenGL");
err_descr = "non-matrix variable";
}
}
+ else if(q.name=="push_constant")
+ {
+ push_constant = true;
+ allowed = (iface_block && !variable && iface_block->interface=="uniform");
+ value = false;
+ }
if(!allowed)
{
else if(!value && q.has_value)
error(layout, format("Layout qualifier '%s' does not allow a value", q.name));
}
+
+ if(push_constant && binding)
+ error(layout, "Layout qualifier 'push_constant' not allowed together with 'binding' or 'set'");
}
void DeclarationValidator::visit(InterfaceLayout &layout)