void LegacyConverter::visit(VariableDeclaration &var)
{
- if(var.layout && !supports_interface_layouts())
+ if(var.layout)
{
- vector<Layout::Qualifier>::iterator i;
- for(i=var.layout->qualifiers.begin(); (i!=var.layout->qualifiers.end() && i->name!="location"); ++i) ;
- if(i!=var.layout->qualifiers.end())
+ for(vector<Layout::Qualifier>::const_iterator i=var.layout->qualifiers.begin(); i!=var.layout->qualifiers.end(); )
{
- if(stage->type==Stage::VERTEX && var.interface=="in")
+ if(i->name=="location" && !supports_interface_layouts())
{
- stage->locations[var.name] = i->value;
- var.layout->qualifiers.erase(i);
- }
- else if(stage->type==Stage::FRAGMENT && var.interface=="out")
- {
- if(check_extension(&Features::ext_gpu_shader4))
+ if(stage->type==Stage::VERTEX && var.interface=="in")
stage->locations[var.name] = i->value;
- else if(i->value!=0)
- unsupported("EXT_gpu_shader4 required for multiple fragment shader outputs");
- var.layout->qualifiers.erase(i);
- }
+ else if(stage->type==Stage::FRAGMENT && var.interface=="out")
+ {
+ if(check_extension(&Features::ext_gpu_shader4))
+ stage->locations[var.name] = i->value;
+ else if(i->value!=0)
+ unsupported("EXT_gpu_shader4 required for multiple fragment shader outputs");
+ }
- if(var.layout->qualifiers.empty())
- var.layout = 0;
+ i = var.layout->qualifiers.erase(i);
+ }
+ else
+ ++i;
}
+
+ if(var.layout->qualifiers.empty())
+ var.layout = 0;
}
if(var.sampling=="centroid")