]> git.tdb.fi Git - libs/gl.git/blobdiff - source/glsl/compatibility.cpp
Record assignment targets more precisely
[libs/gl.git] / source / glsl / compatibility.cpp
index 55fa30d9154af0812be6ae5ccf9c7b6e58b56477..193ae123fae31126b6b23d740df12cd55a9fa6d2 100644 (file)
@@ -172,8 +172,8 @@ void LegacyConverter::visit(VariableReference &var)
 void LegacyConverter::visit(Assignment &assign)
 {
        TraversingVisitor::visit(assign);
-       if(assign.target_declaration==frag_out && !supports_unified_interface_syntax())
-               assign.target_declaration = 0;
+       if(assign.target.declaration==frag_out && !supports_unified_interface_syntax())
+               assign.target.declaration = 0;
 }
 
 bool LegacyConverter::supports_unified_sampling_functions() const
@@ -341,10 +341,20 @@ bool LegacyConverter::supports_interface_blocks(const string &iface) const
 
 void LegacyConverter::visit(InterfaceBlock &iface)
 {
-       if(!supports_interface_blocks(iface.interface))
+       if(!supports_interface_blocks(iface.interface) && iface.type_declaration)
        {
-               stage->content.body.splice(uniform_insert_point, iface.members.body);
-               nodes_to_remove.insert(&iface);
+               if(!iface.instance_name.empty())
+                       unsupported("ARB_uniform_buffer_object required for interface block instances");
+               else if(iface.struct_declaration)
+               {
+                       stage->content.body.splice(uniform_insert_point, iface.struct_declaration->members.body);
+                       nodes_to_remove.insert(&iface);
+                       nodes_to_remove.insert(iface.struct_declaration);
+               }
+               else
+                       /* If the interface block is an array, it should have an instance
+                       name too, so this should never be reached */
+                       throw logic_error("Unexpected interface block configuration");
        }
 }