Mesa (glsl-to-tgsi): glsl: remove glsl_type::get_vec4_type()

Dave Airlie airlied at kemper.freedesktop.org
Fri Jun 17 22:10:19 UTC 2011


Module: Mesa
Branch: glsl-to-tgsi
Commit: 066294cbe9f8d59933dfb943ca0ec3db0cae7731
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=066294cbe9f8d59933dfb943ca0ec3db0cae7731

Author: Bryan Cain <bryancain3 at gmail.com>
Date:   Wed Jun 15 17:31:51 2011 -0500

glsl: remove glsl_type::get_vec4_type()

Thanks to Kenneth Graunke for pointing out that glsl_type::get_instance(base, 4, 1) is the same as glsl_type::get_vec4_type(base).

The function was only used in st_glsl_to_tgsi, and this commit replaces that usage with get_instance.

---

 src/glsl/glsl_types.h                      |   15 ---------------
 src/mesa/state_tracker/st_glsl_to_tgsi.cpp |    4 ++--
 2 files changed, 2 insertions(+), 17 deletions(-)

diff --git a/src/glsl/glsl_types.h b/src/glsl/glsl_types.h
index eb9d501..1b069df 100644
--- a/src/glsl/glsl_types.h
+++ b/src/glsl/glsl_types.h
@@ -165,21 +165,6 @@ struct glsl_type {
    static const glsl_type *const mat4x3_type;
    static const glsl_type *const mat4_type;
    /*@}*/
-   
-   /**
-    * Get the built-in instance of the vec4 type for a specific base type
-    */
-   static const glsl_type *get_vec4_type(glsl_base_type base_type)
-   {
-      if (base_type == GLSL_TYPE_FLOAT)
-         return vec4_type;
-      else if (base_type == GLSL_TYPE_INT)
-         return ivec4_type;
-      else if (base_type == GLSL_TYPE_UINT)
-         return uvec4_type;
-      else
-         return NULL;
-   }
 
 
    /**
diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
index 438f214..5fedf26 100644
--- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
@@ -1361,7 +1361,7 @@ glsl_to_tgsi_visitor::visit(ir_expression *ir)
       if (ir->operands[0]->type->is_vector() ||
           ir->operands[1]->type->is_vector()) {
          st_src_reg temp = get_temp(glsl_version >= 130 ? 
-               glsl_type::get_vec4_type(ir->operands[0]->type->base_type) : 
+               glsl_type::get_instance(ir->operands[0]->type->base_type, 4, 1) :
                glsl_type::vec4_type);
          assert(ir->operands[0]->type->base_type == GLSL_TYPE_FLOAT);
          emit(ir, TGSI_OPCODE_SNE, st_dst_reg(temp), op[0], op[1]);
@@ -1376,7 +1376,7 @@ glsl_to_tgsi_visitor::visit(ir_expression *ir)
       if (ir->operands[0]->type->is_vector() ||
           ir->operands[1]->type->is_vector()) {
          st_src_reg temp = get_temp(glsl_version >= 130 ? 
-               glsl_type::get_vec4_type(ir->operands[0]->type->base_type) : 
+               glsl_type::get_instance(ir->operands[0]->type->base_type, 4, 1) :
                glsl_type::vec4_type);
          assert(ir->operands[0]->type->base_type == GLSL_TYPE_FLOAT);
          emit(ir, TGSI_OPCODE_SNE, st_dst_reg(temp), op[0], op[1]);




More information about the mesa-commit mailing list