X-Git-Url: http://git.tdb.fi/?p=libs%2Fgl.git;a=blobdiff_plain;f=source%2Fglsl%2Fvalidate.cpp;h=2da8345de4a7002e0020d98fe536443c72b8cba6;hp=f12177db4a4236109f4060ffc72c13098f66093f;hb=6997ed1c07c382c0f66c57c080934ad53e1d3713;hpb=d03f6d46d0646c53ec3dcd00ddfd6c718ad18720 diff --git a/source/glsl/validate.cpp b/source/glsl/validate.cpp index f12177db..2da8345d 100644 --- a/source/glsl/validate.cpp +++ b/source/glsl/validate.cpp @@ -49,6 +49,8 @@ const char *DeclarationValidator::describe_variable(ScopeType scope) void DeclarationValidator::visit(Layout &layout) { + bool push_constant = false; + bool binding = false; for(const Layout::Qualifier &q: layout.qualifiers) { bool allowed = false; @@ -58,6 +60,8 @@ void DeclarationValidator::visit(Layout &layout) 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"); @@ -141,6 +145,12 @@ void DeclarationValidator::visit(Layout &layout) 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) { @@ -162,6 +172,9 @@ void DeclarationValidator::visit(Layout &layout) 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)