glsl: permit explicit locations on fragment shader outputs, not inputs
authorPaul Berry <stereotype441@gmail.com>
Tue, 28 Jun 2011 16:42:24 +0000 (09:42 -0700)
committerPaul Berry <stereotype441@gmail.com>
Tue, 28 Jun 2011 20:49:11 +0000 (13:49 -0700)
From the OpenGL docs for GL_ARB_explicit_attrib_location:

    This extension provides a method to pre-assign attribute locations to
    named vertex shader inputs and color numbers to named fragment shader
    outputs.

This was accidentally implemented for fragment shader inputs.  This
patch fixes it to apply to fragment shader outputs.

Fixes piglit tests
spec/ARB_explicit_attrib_location/1.{10,20}/compiler/layout-{01,03,06,07,08,09,10}.frag

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
NOTE: This is a candidate for the 7.10 and 7.11 branches.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=38624

src/glsl/ast_to_hir.cpp

index 3b87f0d..35cb206 100644 (file)
@@ -1940,7 +1940,7 @@ apply_type_qualifier_to_variable(const struct ast_type_qualifier *qual,
         break;
 
       case fragment_shader:
-        if (!global_scope || (var->mode != ir_var_in)) {
+        if (!global_scope || (var->mode != ir_var_out)) {
            fail = true;
            string = "output";
         }