glsl: Allow swizzles on scalars.
authorMatt Turner <mattst88@gmail.com>
Mon, 20 May 2013 18:01:37 +0000 (11:01 -0700)
committerMatt Turner <mattst88@gmail.com>
Fri, 14 Jun 2013 18:25:49 +0000 (11:25 -0700)
Required by ARB_shading_language_420pack.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/glsl/hir_field_selection.cpp

index cc7ba61c8f1d767f9ee925d5708bb2ccf0217b3e..ceb0a4cdb62b908b9aa8b4d532358ef1d7513f0a 100644 (file)
@@ -96,7 +96,9 @@ _mesa_ast_field_selection_to_hir(const ast_expression *expr,
       } else {
         _mesa_glsl_error(&loc, state, "Unknown method: `%s'.", method);
       }
-   } else if (op->type->is_vector()) {
+   } else if (op->type->is_vector() ||
+              (state->ARB_shading_language_420pack_enable &&
+               op->type->is_scalar())) {
       ir_swizzle *swiz = ir_swizzle::create(op,
                                            expr->primary_expression.identifier,
                                            op->type->vector_elements);