glsl: use last_vert_prog to get last {clip,cull}_distance_array_size
authorTimothy Arceri <timothy.arceri@collabora.com>
Sun, 20 Nov 2016 11:23:17 +0000 (22:23 +1100)
committerTimothy Arceri <timothy.arceri@collabora.com>
Mon, 23 Jan 2017 03:48:04 +0000 (14:48 +1100)
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
src/compiler/glsl/link_varyings.cpp
src/compiler/glsl/linker.cpp
src/mesa/main/mtypes.h

index eef215dfda767e6cee7ab32edaa6245b45cbc330..f0df3d60a5cd1752e011ac3cf30cd642c3f56840 100644 (file)
@@ -745,10 +745,12 @@ tfeedback_decl::assign_location(struct gl_context *ctx,
       unsigned actual_array_size;
       switch (this->lowered_builtin_array_variable) {
       case clip_distance:
-         actual_array_size = prog->LastClipDistanceArraySize;
+         actual_array_size = prog->last_vert_prog ?
+            prog->last_vert_prog->info.clip_distance_array_size : 0;
          break;
       case cull_distance:
-         actual_array_size = prog->LastCullDistanceArraySize;
+         actual_array_size = prog->last_vert_prog ?
+            prog->last_vert_prog->info.cull_distance_array_size : 0;
          break;
       case tess_level_outer:
          actual_array_size = 4;
index 261ac2365516497f7c226b4843f63f3418925ecd..1664c9f5fa8dad8eebfa5776a93a71dfa80b3fd9 100644 (file)
@@ -4775,20 +4775,6 @@ link_shaders(struct gl_context *ctx, struct gl_shader_program *prog)
       }
    }
 
-   if (num_shaders[MESA_SHADER_GEOMETRY] > 0) {
-      prog->LastClipDistanceArraySize = prog->_LinkedShaders[MESA_SHADER_GEOMETRY]->Program->info.clip_distance_array_size;
-      prog->LastCullDistanceArraySize = prog->_LinkedShaders[MESA_SHADER_GEOMETRY]->Program->info.cull_distance_array_size;
-   } else if (num_shaders[MESA_SHADER_TESS_EVAL] > 0) {
-      prog->LastClipDistanceArraySize = prog->_LinkedShaders[MESA_SHADER_TESS_EVAL]->Program->info.clip_distance_array_size;
-      prog->LastCullDistanceArraySize = prog->_LinkedShaders[MESA_SHADER_TESS_EVAL]->Program->info.cull_distance_array_size;
-   } else if (num_shaders[MESA_SHADER_VERTEX] > 0) {
-      prog->LastClipDistanceArraySize = prog->_LinkedShaders[MESA_SHADER_VERTEX]->Program->info.clip_distance_array_size;
-      prog->LastCullDistanceArraySize = prog->_LinkedShaders[MESA_SHADER_VERTEX]->Program->info.cull_distance_array_size;
-   } else {
-      prog->LastClipDistanceArraySize = 0; /* Not used */
-      prog->LastCullDistanceArraySize = 0; /* Not used */
-   }
-
    /* Here begins the inter-stage linking phase.  Some initial validation is
     * performed, then locations are assigned for uniforms, attributes, and
     * varyings.
index 274dbd534b46c77165cf73bf8f780f25a549a524..56ab614d3126f8c74db596ff8d2557a02e3e15f5 100644 (file)
@@ -2793,13 +2793,6 @@ struct gl_shader_program
     */
    struct exec_list EmptyUniformLocations;
 
-   /**
-    * Size of the gl_ClipDistance array that is output from the last pipeline
-    * stage before the fragment shader.
-    */
-   unsigned LastClipDistanceArraySize;
-   unsigned LastCullDistanceArraySize;
-
    /**
     * Total number of explicit uniform location including inactive uniforms.
     */