glsl: Add constant gl_MaxClipDistances.
authorPaul Berry <stereotype441@gmail.com>
Fri, 12 Aug 2011 00:33:06 +0000 (17:33 -0700)
committerPaul Berry <stereotype441@gmail.com>
Thu, 8 Sep 2011 16:37:12 +0000 (09:37 -0700)
Fixes piglit tests {vs,fs}-clip-distance-sizeable-to-max.shader_test.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
src/glsl/ir_variable.cpp

index 38094568b4f58697a00ef3aef4404d35e1dea7b2..e0b6f38f1c910def256831837a548dd42ddbf998 100644 (file)
@@ -584,6 +584,17 @@ generate_120_vs_variables(exec_list *instructions,
 }
 
 
+static void
+generate_130_uniforms(exec_list *instructions,
+                     struct _mesa_glsl_parse_state *state)
+{
+   glsl_symbol_table *const symtab = state->symbols;
+
+   add_builtin_constant(instructions, symtab, "gl_MaxClipDistances",
+                        state->Const.MaxClipPlanes);
+}
+
+
 static void
 generate_130_vs_variables(exec_list *instructions,
                          struct _mesa_glsl_parse_state *state)
@@ -595,6 +606,8 @@ generate_130_vs_variables(exec_list *instructions,
                           & builtin_130_vs_variables[i]);
    }
 
+   generate_130_uniforms(instructions, state);
+
    /* From the GLSL 1.30 spec, section 7.1 (Vertex Shader Special
     * Variables):
     *
@@ -811,6 +824,8 @@ generate_130_fs_variables(exec_list *instructions,
 {
    generate_120_fs_variables(instructions, state);
 
+   generate_130_uniforms(instructions, state);
+
    /* From the GLSL 1.30 spec, section 7.2 (Fragment Shader Special
     * Variables):
     *