[Mesa-dev] [PATCH 8/8] nir: Remove some unused fields from nir_variable

Jason Ekstrand jason at jlekstrand.net
Wed Jul 20 22:28:29 UTC 2016


All of these are happily set from glsl_to_nir or spirv_to_nir but their
values are never used for anything.

Signed-off-by: Jason Ekstrand <jason at jlekstrand.net>
---
 src/compiler/glsl/glsl_to_nir.cpp  |  5 -----
 src/compiler/nir/nir.h             | 34 ----------------------------------
 src/compiler/spirv/vtn_variables.c |  4 ----
 3 files changed, 43 deletions(-)

diff --git a/src/compiler/glsl/glsl_to_nir.cpp b/src/compiler/glsl/glsl_to_nir.cpp
index e6171d9..4d7c4b3 100644
--- a/src/compiler/glsl/glsl_to_nir.cpp
+++ b/src/compiler/glsl/glsl_to_nir.cpp
@@ -372,10 +372,6 @@ nir_visitor::visit(ir_variable *ir)
    var->data.interpolation = ir->data.interpolation;
    var->data.origin_upper_left = ir->data.origin_upper_left;
    var->data.pixel_center_integer = ir->data.pixel_center_integer;
-   var->data.explicit_location = ir->data.explicit_location;
-   var->data.explicit_index = ir->data.explicit_index;
-   var->data.explicit_binding = ir->data.explicit_binding;
-   var->data.has_initializer = ir->data.has_initializer;
    var->data.location_frac = ir->data.location_frac;
 
    switch (ir->data.depth_layout) {
@@ -407,7 +403,6 @@ nir_visitor::visit(ir_variable *ir)
    var->data.image._volatile = ir->data.image_volatile;
    var->data.image.restrict_flag = ir->data.image_restrict;
    var->data.image.format = ir->data.image_format;
-   var->data.max_array_access = ir->data.max_array_access;
 
    var->num_state_slots = ir->get_num_state_slots();
    if (var->num_state_slots > 0) {
diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h
index 93b7e1e..a30b4f0 100644
--- a/src/compiler/nir/nir.h
+++ b/src/compiler/nir/nir.h
@@ -192,32 +192,6 @@ typedef struct nir_variable {
       /*@}*/
 
       /**
-       * Was the location explicitly set in the shader?
-       *
-       * If the location is explicitly set in the shader, it \b cannot be changed
-       * by the linker or by the API (e.g., calls to \c glBindAttribLocation have
-       * no effect).
-       */
-      unsigned explicit_location:1;
-      unsigned explicit_index:1;
-
-      /**
-       * Was an initial binding explicitly set in the shader?
-       *
-       * If so, constant_initializer contains an integer nir_constant
-       * representing the initial binding point.
-       */
-      unsigned explicit_binding:1;
-
-      /**
-       * Does this variable have an initializer?
-       *
-       * This is used by the linker to cross-validiate initializers of global
-       * variables.
-       */
-      unsigned has_initializer:1;
-
-      /**
        * If non-zero, then this variable may be packed along with other variables
        * into a single varying slot, so this offset should be applied when
        * accessing components.  For example, an offset of 1 means that the x
@@ -296,14 +270,6 @@ typedef struct nir_variable {
          /** Image internal format if specified explicitly, otherwise GL_NONE. */
          GLenum format;
       } image;
-
-      /**
-       * Highest element accessed with a constant expression array index
-       *
-       * Not used for non-array variables.
-       */
-      unsigned max_array_access;
-
    } data;
 
    /**
diff --git a/src/compiler/spirv/vtn_variables.c b/src/compiler/spirv/vtn_variables.c
index 84664ad..2b374ce 100644
--- a/src/compiler/spirv/vtn_variables.c
+++ b/src/compiler/spirv/vtn_variables.c
@@ -944,7 +944,6 @@ var_decoration_cb(struct vtn_builder *b, struct vtn_value *val, int member,
       if (nir_var) {
          /* This handles the member and lone variable cases */
          nir_var->data.location = location;
-         nir_var->data.explicit_location = true;
       } else {
          /* This handles the structure member case */
          assert(vtn_var->members);
@@ -952,7 +951,6 @@ var_decoration_cb(struct vtn_builder *b, struct vtn_value *val, int member,
             glsl_get_length(glsl_without_array(vtn_var->type->type));
          for (unsigned i = 0; i < length; i++) {
             vtn_var->members[i]->data.location = location;
-            vtn_var->members[i]->data.explicit_location = true;
             location +=
                glsl_count_attribute_slots(vtn_var->members[i]->interface_type,
                                           is_vertex_input);
@@ -993,7 +991,6 @@ var_decoration_cb(struct vtn_builder *b, struct vtn_value *val, int member,
       nir_var->data.location_frac = dec->literals[0];
       break;
    case SpvDecorationIndex:
-      nir_var->data.explicit_index = true;
       nir_var->data.index = dec->literals[0];
       break;
    case SpvDecorationBuiltIn: {
@@ -1014,7 +1011,6 @@ var_decoration_cb(struct vtn_builder *b, struct vtn_value *val, int member,
 
       nir_variable_mode mode = nir_var->data.mode;
       vtn_get_builtin_location(b, builtin, &nir_var->data.location, &mode);
-      nir_var->data.explicit_location = true;
       nir_var->data.mode = mode;
 
       if (builtin == SpvBuiltInFragCoord || builtin == SpvBuiltInSamplePosition)
-- 
2.5.0.400.gff86faf



More information about the mesa-dev mailing list