glsl: Modify interface to link_invalidate_variable_locations
authorIan Romanick <ian.d.romanick@intel.com>
Tue, 22 Oct 2013 22:07:00 +0000 (15:07 -0700)
committerIan Romanick <ian.d.romanick@intel.com>
Tue, 22 Oct 2013 22:23:30 +0000 (15:23 -0700)
This will make it easier to unit test this function in successive
patches.  Also, correct the prototype in linker.h.  It was... wrong.

v2: Split the interface change from adding the unit tests.  Suggested by
Paul.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
src/glsl/linker.cpp
src/glsl/linker.h

index 0a949b46699911f54be5d1b5bcae968e097f5f6a..bf96d606488594830f1717cb3043b5282eb6d4c8 100644 (file)
@@ -366,10 +366,10 @@ parse_program_resource_name(const GLchar *name,
 
 
 void
-link_invalidate_variable_locations(gl_shader *sh, int input_base,
+link_invalidate_variable_locations(exec_list *ir, int input_base,
                                    int output_base)
 {
-   foreach_list(node, sh->ir) {
+   foreach_list(node, ir) {
       ir_variable *const var = ((ir_instruction *) node)->as_variable();
 
       if (var == NULL)
@@ -2217,17 +2217,17 @@ link_shaders(struct gl_context *ctx, struct gl_shader_program *prog)
    /* Mark all generic shader inputs and outputs as unpaired. */
    if (prog->_LinkedShaders[MESA_SHADER_VERTEX] != NULL) {
       link_invalidate_variable_locations(
-            prog->_LinkedShaders[MESA_SHADER_VERTEX],
+            prog->_LinkedShaders[MESA_SHADER_VERTEX]->ir,
             VERT_ATTRIB_GENERIC0, VARYING_SLOT_VAR0);
    }
    if (prog->_LinkedShaders[MESA_SHADER_GEOMETRY] != NULL) {
       link_invalidate_variable_locations(
-            prog->_LinkedShaders[MESA_SHADER_GEOMETRY],
+            prog->_LinkedShaders[MESA_SHADER_GEOMETRY]->ir,
             VARYING_SLOT_VAR0, VARYING_SLOT_VAR0);
    }
    if (prog->_LinkedShaders[MESA_SHADER_FRAGMENT] != NULL) {
       link_invalidate_variable_locations(
-            prog->_LinkedShaders[MESA_SHADER_FRAGMENT],
+            prog->_LinkedShaders[MESA_SHADER_FRAGMENT]->ir,
             VARYING_SLOT_VAR0, FRAG_RESULT_DATA0);
    }
 
index 8a0027d2bcab30c7e9bba6eea6f9a18d32b43d57..9915c38b01e91c2170bda0373bb072d6c33f9bf0 100644 (file)
@@ -31,8 +31,8 @@ link_function_calls(gl_shader_program *prog, gl_shader *main,
                    gl_shader **shader_list, unsigned num_shaders);
 
 extern void
-link_invalidate_variable_locations(gl_shader *sh, enum ir_variable_mode mode,
-                                  int generic_base);
+link_invalidate_variable_locations(exec_list *ir, int input_base,
+                                   int output_base);
 
 extern void
 link_assign_uniform_locations(struct gl_shader_program *prog);