]> git.tdb.fi Git - libs/gl.git/blobdiff - source/glsl/generate.cpp
Some rearranging and comments
[libs/gl.git] / source / glsl / generate.cpp
index 29d52364c1506f1dc151aad780c584dc13b0eab6..158bb4cc91b67b39239358c70bf0237ef5821ed0 100644 (file)
@@ -191,6 +191,9 @@ void TypeResolver::visit(BasicTypeDeclaration &type)
                        if(basic_base->kind==BasicTypeDeclaration::VECTOR)
                        {
                                type.kind = BasicTypeDeclaration::MATRIX;
+                               /* A matrix's base type is its column vector type.  This will put
+                               the column vector's size, i.e. the matrix's row count, in the high
+                               half of the size. */
                                type.size |= basic_base->size<<16;
                        }
 
@@ -591,11 +594,11 @@ void ExpressionResolver::convert_to(RefPtr<Expression> &expr, BasicTypeDeclarati
 
 bool ExpressionResolver::convert_to_element(RefPtr<Expression> &expr, BasicTypeDeclaration &elem_type)
 {
-       if(BasicTypeDeclaration *expr_type = dynamic_cast<BasicTypeDeclaration *>(expr->type))
+       if(BasicTypeDeclaration *expr_basic = dynamic_cast<BasicTypeDeclaration *>(expr->type))
        {
                BasicTypeDeclaration *to_type = &elem_type;
-               if(is_vector_or_matrix(*expr_type))
-                       to_type = find_type(elem_type, expr_type->kind, expr_type->size);
+               if(is_vector_or_matrix(*expr_basic))
+                       to_type = find_type(elem_type, expr_basic->kind, expr_basic->size);
                if(to_type)
                {
                        convert_to(expr, *to_type);