[Mesa-dev] [PATCH 3/5] glsl: rename record_location_offset() -> struct_location_offset()

Timothy Arceri tarceri at itsqueeze.com
Tue Mar 5 05:08:53 UTC 2019


Replace done using:
find ./src -type f -exec sed -i -- \
's/record_location_offset(/struct_location_offset(/g' {} \;
---
 src/amd/common/ac_nir_to_llvm.c                    | 4 ++--
 src/compiler/glsl/gl_nir_lower_samplers_as_deref.c | 2 +-
 src/compiler/glsl_types.cpp                        | 4 ++--
 src/compiler/glsl_types.h                          | 2 +-
 src/compiler/nir_types.cpp                         | 4 ++--
 src/compiler/nir_types.h                           | 2 +-
 src/mesa/program/ir_to_mesa.cpp                    | 2 +-
 src/mesa/state_tracker/st_glsl_to_tgsi.cpp         | 2 +-
 8 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/src/amd/common/ac_nir_to_llvm.c b/src/amd/common/ac_nir_to_llvm.c
index af7a95137c2..96dd9c4b96c 100644
--- a/src/amd/common/ac_nir_to_llvm.c
+++ b/src/amd/common/ac_nir_to_llvm.c
@@ -3050,7 +3050,7 @@ static LLVMValueRef visit_interp(struct ac_nir_context *ctx,
 			LLVMValueRef offset;
 			unsigned sidx = deref_instr->strct.index;
 			deref_instr = nir_src_as_deref(deref_instr->parent);
-			offset = LLVMConstInt(ctx->ac.i32, glsl_get_record_location_offset(deref_instr->type, sidx), false);
+			offset = LLVMConstInt(ctx->ac.i32, glsl_get_struct_location_offset(deref_instr->type, sidx), false);
 			attrib_idx = LLVMBuildAdd(ctx->ac.builder, attrib_idx, offset, "");
 		} else {
 			unreachable("Unsupported deref type");
@@ -3471,7 +3471,7 @@ static LLVMValueRef get_sampler_desc(struct ac_nir_context *ctx,
 			} else if (deref_instr->deref_type == nir_deref_type_struct) {
 				unsigned sidx = deref_instr->strct.index;
 				deref_instr = nir_src_as_deref(deref_instr->parent);
-				constant_index += glsl_get_record_location_offset(deref_instr->type, sidx);
+				constant_index += glsl_get_struct_location_offset(deref_instr->type, sidx);
 			} else {
 				unreachable("Unsupported deref type");
 			}
diff --git a/src/compiler/glsl/gl_nir_lower_samplers_as_deref.c b/src/compiler/glsl/gl_nir_lower_samplers_as_deref.c
index ea32195d42f..27e2d780e70 100644
--- a/src/compiler/glsl/gl_nir_lower_samplers_as_deref.c
+++ b/src/compiler/glsl/gl_nir_lower_samplers_as_deref.c
@@ -104,7 +104,7 @@ remove_struct_derefs_prep(nir_deref_instr **p, char **name,
    }
 
    case nir_deref_type_struct: {
-      *location += glsl_get_record_location_offset(cur->type, next->strct.index);
+      *location += glsl_get_struct_location_offset(cur->type, next->strct.index);
       ralloc_asprintf_append(name, ".%s",
                              glsl_get_struct_elem_name(cur->type, next->strct.index));
 
diff --git a/src/compiler/glsl_types.cpp b/src/compiler/glsl_types.cpp
index 24f319dbde2..bc9bf1380b2 100644
--- a/src/compiler/glsl_types.cpp
+++ b/src/compiler/glsl_types.cpp
@@ -1425,7 +1425,7 @@ glsl_type::component_slots() const
 }
 
 unsigned
-glsl_type::record_location_offset(unsigned length) const
+glsl_type::struct_location_offset(unsigned length) const
 {
    unsigned offset = 0;
    const glsl_type *t = this->without_array();
@@ -1436,7 +1436,7 @@ glsl_type::record_location_offset(unsigned length) const
          const glsl_type *st = t->fields.structure[i].type;
          const glsl_type *wa = st->without_array();
          if (wa->is_struct()) {
-            unsigned r_offset = wa->record_location_offset(wa->length);
+            unsigned r_offset = wa->struct_location_offset(wa->length);
             offset += st->is_array() ?
                st->arrays_of_arrays_size() * r_offset : r_offset;
          } else if (st->is_array() && st->fields.array->is_array()) {
diff --git a/src/compiler/glsl_types.h b/src/compiler/glsl_types.h
index 2e858bf4cd7..3c675112ec1 100644
--- a/src/compiler/glsl_types.h
+++ b/src/compiler/glsl_types.h
@@ -365,7 +365,7 @@ public:
     * For the initial call, length is the index of the member to find the
     * offset for.
     */
-   unsigned record_location_offset(unsigned length) const;
+   unsigned struct_location_offset(unsigned length) const;
 
    /**
     * Calculate the number of unique values from glGetUniformLocation for the
diff --git a/src/compiler/nir_types.cpp b/src/compiler/nir_types.cpp
index 5e51dbc2d90..89028dcaf3d 100644
--- a/src/compiler/nir_types.cpp
+++ b/src/compiler/nir_types.cpp
@@ -192,10 +192,10 @@ glsl_get_sampler_coordinate_components(const struct glsl_type *type)
 }
 
 unsigned
-glsl_get_record_location_offset(const struct glsl_type *type,
+glsl_get_struct_location_offset(const struct glsl_type *type,
                                 unsigned length)
 {
-   return type->record_location_offset(length);
+   return type->struct_location_offset(length);
 }
 
 bool
diff --git a/src/compiler/nir_types.h b/src/compiler/nir_types.h
index 68855a65d8e..e28c1b45960 100644
--- a/src/compiler/nir_types.h
+++ b/src/compiler/nir_types.h
@@ -89,7 +89,7 @@ enum glsl_base_type glsl_get_sampler_result_type(const struct glsl_type *type);
 unsigned glsl_get_sampler_target(const struct glsl_type *type);
 int glsl_get_sampler_coordinate_components(const struct glsl_type *type);
 
-unsigned glsl_get_record_location_offset(const struct glsl_type *type,
+unsigned glsl_get_struct_location_offset(const struct glsl_type *type,
                                          unsigned length);
 
 unsigned glsl_atomic_size(const struct glsl_type *type);
diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp
index e83432356f1..f875c00238f 100644
--- a/src/mesa/program/ir_to_mesa.cpp
+++ b/src/mesa/program/ir_to_mesa.cpp
@@ -1679,7 +1679,7 @@ calc_sampler_offsets(struct gl_shader_program *prog, ir_dereference *deref,
       ir_dereference_record *deref_record = deref->as_dereference_record();
       unsigned field_index = deref_record->field_idx;
       *location +=
-         deref_record->record->type->record_location_offset(field_index);
+         deref_record->record->type->struct_location_offset(field_index);
       calc_sampler_offsets(prog, deref_record->record->as_dereference(),
                            offset, array_elements, location);
       break;
diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
index ed941e44268..5b7203542f3 100644
--- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
@@ -4088,7 +4088,7 @@ glsl_to_tgsi_visitor::calc_deref_offsets(ir_dereference *tail,
       calc_deref_offsets(deref_record->record->as_dereference(), array_elements, index, indirect, location);
 
       assert(field_index >= 0);
-      *location += struct_type->record_location_offset(field_index);
+      *location += struct_type->struct_location_offset(field_index);
       break;
    }
 
-- 
2.20.1



More information about the mesa-dev mailing list