Mesa (master): glsl: Rename "vertex_input_slots" -> "is_vertex_input"

Matt Turner mattst88 at kemper.freedesktop.org
Wed Apr 13 17:59:10 UTC 2016


Module: Mesa
Branch: master
Commit: 9bac27dbf92d32cd8685868d21d0317a5a56f333
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=9bac27dbf92d32cd8685868d21d0317a5a56f333

Author: Matt Turner <mattst88 at gmail.com>
Date:   Tue Apr 12 15:26:06 2016 -0700

glsl: Rename "vertex_input_slots" -> "is_vertex_input"

vertex_input_slots would be an appropriate name for an integer, but not
a bool.

Also remove a cond ? true : false from a count_attribute_slots() call
site, noticed during the rename.

Reviewed-by: Timothy Arceri <timothy.arceri at collabora.com>
Reviewed-by: Iago Toral Quiroga <itoral at igalia.com>

---

 src/compiler/glsl/ir_set_program_inouts.cpp | 6 +++---
 src/compiler/glsl/linker.cpp                | 6 +++---
 src/compiler/glsl_types.cpp                 | 8 ++++----
 src/compiler/glsl_types.h                   | 2 +-
 src/compiler/nir_types.cpp                  | 4 ++--
 src/compiler/nir_types.h                    | 2 +-
 6 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/src/compiler/glsl/ir_set_program_inouts.cpp b/src/compiler/glsl/ir_set_program_inouts.cpp
index df06923..6768d82 100644
--- a/src/compiler/glsl/ir_set_program_inouts.cpp
+++ b/src/compiler/glsl/ir_set_program_inouts.cpp
@@ -149,7 +149,7 @@ void
 ir_set_program_inouts_visitor::mark_whole_variable(ir_variable *var)
 {
    const glsl_type *type = var->type;
-   bool vertex_input = false;
+   bool is_vertex_input = false;
    if (this->shader_stage == MESA_SHADER_GEOMETRY &&
        var->data.mode == ir_var_shader_in && type->is_array()) {
       type = type->fields.array;
@@ -175,9 +175,9 @@ ir_set_program_inouts_visitor::mark_whole_variable(ir_variable *var)
 
    if (this->shader_stage == MESA_SHADER_VERTEX &&
        var->data.mode == ir_var_shader_in)
-      vertex_input = true;
+      is_vertex_input = true;
 
-   mark(this->prog, var, 0, type->count_attribute_slots(vertex_input),
+   mark(this->prog, var, 0, type->count_attribute_slots(is_vertex_input),
         this->shader_stage);
 }
 
diff --git a/src/compiler/glsl/linker.cpp b/src/compiler/glsl/linker.cpp
index 0773d42..dcc8a57 100644
--- a/src/compiler/glsl/linker.cpp
+++ b/src/compiler/glsl/linker.cpp
@@ -2618,7 +2618,7 @@ assign_attribute_or_color_locations(gl_shader_program *prog,
          return false;
       }
 
-      const unsigned slots = var->type->count_attribute_slots(target_index == MESA_SHADER_VERTEX ? true : false);
+      const unsigned slots = var->type->count_attribute_slots(target_index == MESA_SHADER_VERTEX);
 
       /* If the variable is not a built-in and has a location statically
        * assigned in the shader (presumably via a layout qualifier), make sure
@@ -3575,7 +3575,7 @@ add_shader_variable(struct gl_shader_program *shProg, unsigned stage_mask,
                     const char *name, const glsl_type *type,
                     bool use_implicit_location, int location)
 {
-   const bool vertex_input_slots =
+   const bool is_vertex_input =
       programInterface == GL_PROGRAM_INPUT &&
       stage_mask == MESA_SHADER_VERTEX;
 
@@ -3600,7 +3600,7 @@ add_shader_variable(struct gl_shader_program *shProg, unsigned stage_mask,
             return false;
 
          field_location +=
-            field->type->count_attribute_slots(vertex_input_slots);
+            field->type->count_attribute_slots(is_vertex_input);
       }
       return true;
    }
diff --git a/src/compiler/glsl_types.cpp b/src/compiler/glsl_types.cpp
index 39585bf..c058283 100644
--- a/src/compiler/glsl_types.cpp
+++ b/src/compiler/glsl_types.cpp
@@ -1897,7 +1897,7 @@ glsl_type::std430_size(bool row_major) const
 }
 
 unsigned
-glsl_type::count_attribute_slots(bool vertex_input_slots) const
+glsl_type::count_attribute_slots(bool is_vertex_input) const
 {
    /* From page 31 (page 37 of the PDF) of the GLSL 1.50 spec:
     *
@@ -1931,7 +1931,7 @@ glsl_type::count_attribute_slots(bool vertex_input_slots) const
    case GLSL_TYPE_BOOL:
       return this->matrix_columns;
    case GLSL_TYPE_DOUBLE:
-      if (this->vector_elements > 2 && !vertex_input_slots)
+      if (this->vector_elements > 2 && !is_vertex_input)
          return this->matrix_columns * 2;
       else
          return this->matrix_columns;
@@ -1940,13 +1940,13 @@ glsl_type::count_attribute_slots(bool vertex_input_slots) const
       unsigned size = 0;
 
       for (unsigned i = 0; i < this->length; i++)
-         size += this->fields.structure[i].type->count_attribute_slots(vertex_input_slots);
+         size += this->fields.structure[i].type->count_attribute_slots(is_vertex_input);
 
       return size;
    }
 
    case GLSL_TYPE_ARRAY:
-      return this->length * this->fields.array->count_attribute_slots(vertex_input_slots);
+      return this->length * this->fields.array->count_attribute_slots(is_vertex_input);
 
    case GLSL_TYPE_FUNCTION:
    case GLSL_TYPE_SAMPLER:
diff --git a/src/compiler/glsl_types.h b/src/compiler/glsl_types.h
index dd46479..a47b0ff 100644
--- a/src/compiler/glsl_types.h
+++ b/src/compiler/glsl_types.h
@@ -344,7 +344,7 @@ struct glsl_type {
     * For vertex shader attributes - doubles only take one slot.
     * For inter-shader varyings - dvec3/dvec4 take two slots.
     */
-   unsigned count_attribute_slots(bool vertex_input_slots) const;
+   unsigned count_attribute_slots(bool is_vertex_input) const;
 
    /**
     * Alignment in bytes of the start of this type in a std140 uniform
diff --git a/src/compiler/nir_types.cpp b/src/compiler/nir_types.cpp
index 70e9cd3..62a1071 100644
--- a/src/compiler/nir_types.cpp
+++ b/src/compiler/nir_types.cpp
@@ -126,9 +126,9 @@ glsl_get_aoa_size(const struct glsl_type *type)
 
 unsigned
 glsl_count_attribute_slots(const struct glsl_type *type,
-                           bool vertex_input_slots)
+                           bool is_vertex_input)
 {
-   return type->count_attribute_slots(vertex_input_slots);
+   return type->count_attribute_slots(is_vertex_input);
 }
 
 const char *
diff --git a/src/compiler/nir_types.h b/src/compiler/nir_types.h
index 5efdd85..851096f 100644
--- a/src/compiler/nir_types.h
+++ b/src/compiler/nir_types.h
@@ -69,7 +69,7 @@ unsigned glsl_get_length(const struct glsl_type *type);
 unsigned glsl_get_aoa_size(const struct glsl_type *type);
 
 unsigned glsl_count_attribute_slots(const struct glsl_type *type,
-                                    bool vertex_input_slots);
+                                    bool is_vertex_input);
 
 const char *glsl_get_struct_elem_name(const struct glsl_type *type,
                                       unsigned index);




More information about the mesa-commit mailing list