]> git.tdb.fi Git - libs/gl.git/blobdiff - source/glsl/debug.cpp
Recognize swizzles in GLSL
[libs/gl.git] / source / glsl / debug.cpp
index ee50bf46e2ccb3af903f44249187cc70a5eb9fb4..fd1fd667257b788f86f4b523575d8af730afbd9d 100644 (file)
@@ -178,6 +178,16 @@ void DumpTree::visit(MemberAccess &memacc)
        annotated_branch(text, *memacc.left);
 }
 
+void DumpTree::visit(Swizzle &swizzle)
+{
+       static const char components[4] = { 'x', 'y', 'z', 'w' };
+       string text = "Swizzle: .";
+       for(unsigned i=0; i<swizzle.count; ++i)
+               text += components[swizzle.components[i]];
+       text += format(" -> %s", format_type(swizzle.type));
+       annotated_branch(text, *swizzle.left);
+}
+
 void DumpTree::visit(UnaryExpression &unary)
 {
        string text = format("Unary: %s, %sfix -> %s", unary.oper->token, (unary.oper->type==Operator::PREFIX ? "pre" : "post"), format_type(unary.type));