}
+void DeclarationValidator::apply(Stage &s, const Features &f)
+{
+ stage = &s;
+ features = f;
+ s.content.visit(*this);
+}
+
const char *DeclarationValidator::describe_variable(ScopeType scope)
{
switch(scope)
{
binding = true;
- if(q.name=="set")
+ if(q.name=="set" && features.target_api!=VULKAN)
{
error(layout, "Layout qualifier 'set' not allowed when targeting OpenGL");
continue;
error(var, format("Mismatched interface qualifier '%s' inside '%s' block", var.interface, iface_block->interface));
else if(scope==STRUCT || scope==FUNCTION)
error(var, format("Interface qualifier not allowed on %s", descr));
+ else if(scope==GLOBAL && variable->interface=="uniform" && features.target_api==VULKAN)
+ {
+ TypeDeclaration *type = variable->type_declaration;
+ while(BasicTypeDeclaration *basic = dynamic_cast<BasicTypeDeclaration *>(type))
+ type = basic->base_type;
+ if(!dynamic_cast<ImageTypeDeclaration *>(type))
+ error(var, "Interface qualifier 'uniform' not allowed on non-opaque variable in global scope");
+ }
}
TypeDeclaration *type = var.type_declaration;