[Mesa-dev] [PATCH 58/58] glsl: use last_vert_prog to get last {clip, cull}_distance_array_size

Timothy Arceri timothy.arceri at collabora.com
Sun Nov 20 13:29:37 UTC 2016


---
 src/compiler/glsl/link_varyings.cpp |  6 ++++--
 src/compiler/glsl/linker.cpp        | 14 --------------
 src/mesa/main/mtypes.h              |  7 -------
 3 files changed, 4 insertions(+), 23 deletions(-)

diff --git a/src/compiler/glsl/link_varyings.cpp b/src/compiler/glsl/link_varyings.cpp
index 147a7c3..da51fd8 100644
--- a/src/compiler/glsl/link_varyings.cpp
+++ b/src/compiler/glsl/link_varyings.cpp
@@ -743,10 +743,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;
diff --git a/src/compiler/glsl/linker.cpp b/src/compiler/glsl/linker.cpp
index 2ba5490..86b9c38 100644
--- a/src/compiler/glsl/linker.cpp
+++ b/src/compiler/glsl/linker.cpp
@@ -4902,20 +4902,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.
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index c04cfc2..0b38b4f 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -2770,13 +2770,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;
-
-   /**
     * Map of active uniform names to locations
     *
     * Maps any active uniform that is not an array element to a location.
-- 
2.7.4



More information about the mesa-dev mailing list