[Mesa-dev] [PATCH 1/3] tgsi: rename TGSI_TYPE_x -> TGSI_OPCODE_TYPE_x

Brian Paul brianp at vmware.com
Mon Sep 22 08:44:26 PDT 2014


To avoid conflicts with coming TGSI_TYPE_x enums.
---
 src/gallium/auxiliary/gallivm/lp_bld_tgsi.c        |   26 ++++-----
 src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c    |   57 ++++++++++----------
 src/gallium/auxiliary/tgsi/tgsi_info.c             |   14 ++---
 src/gallium/auxiliary/tgsi/tgsi_info.h             |   12 ++---
 src/gallium/drivers/ilo/shader/toy_tgsi.c          |   12 ++---
 src/gallium/drivers/radeon/radeon_llvm.h           |    8 +--
 .../drivers/radeon/radeon_setup_tgsi_llvm.c        |    8 +--
 7 files changed, 69 insertions(+), 68 deletions(-)

diff --git a/src/gallium/auxiliary/gallivm/lp_bld_tgsi.c b/src/gallium/auxiliary/gallivm/lp_bld_tgsi.c
index 51cb54c..9464348 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_tgsi.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_tgsi.c
@@ -315,15 +315,15 @@ lp_build_emit_fetch(
 
    if (reg->Register.Absolute) {
       switch (stype) {
-      case TGSI_TYPE_FLOAT:
-      case TGSI_TYPE_DOUBLE:
-      case TGSI_TYPE_UNTYPED:
+      case TGSI_OPCODE_TYPE_FLOAT:
+      case TGSI_OPCODE_TYPE_DOUBLE:
+      case TGSI_OPCODE_TYPE_UNTYPED:
           /* modifiers on movs assume data is float */
          res = lp_build_emit_llvm_unary(bld_base, TGSI_OPCODE_ABS, res);
          break;
-      case TGSI_TYPE_UNSIGNED:
-      case TGSI_TYPE_SIGNED:
-      case TGSI_TYPE_VOID:
+      case TGSI_OPCODE_TYPE_UNSIGNED:
+      case TGSI_OPCODE_TYPE_SIGNED:
+      case TGSI_OPCODE_TYPE_VOID:
       default:
          /* abs modifier is only legal on floating point types */
          assert(0);
@@ -333,20 +333,20 @@ lp_build_emit_fetch(
 
    if (reg->Register.Negate) {
       switch (stype) {
-      case TGSI_TYPE_FLOAT:
-      case TGSI_TYPE_UNTYPED:
+      case TGSI_OPCODE_TYPE_FLOAT:
+      case TGSI_OPCODE_TYPE_UNTYPED:
          /* modifiers on movs assume data is float */
          res = lp_build_negate( &bld_base->base, res );
          break;
-      case TGSI_TYPE_DOUBLE:
+      case TGSI_OPCODE_TYPE_DOUBLE:
          /* no double build context */
          assert(0);
          break;
-      case TGSI_TYPE_SIGNED:
-      case TGSI_TYPE_UNSIGNED:
+      case TGSI_OPCODE_TYPE_SIGNED:
+      case TGSI_OPCODE_TYPE_UNSIGNED:
          res = lp_build_negate( &bld_base->int_bld, res );
          break;
-      case TGSI_TYPE_VOID:
+      case TGSI_OPCODE_TYPE_VOID:
       default:
          assert(0);
          break;
@@ -381,7 +381,7 @@ lp_build_emit_fetch_texoffset(
    struct tgsi_full_src_register reg;
    unsigned swizzle;
    LLVMValueRef res;
-   enum tgsi_opcode_type stype = TGSI_TYPE_SIGNED;
+   enum tgsi_opcode_type stype = TGSI_OPCODE_TYPE_SIGNED;
 
    /* convert offset "register" to ordinary register so can use normal emit funcs */
    memset(&reg, 0, sizeof(reg));
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
index c0bd7be..d500116 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
@@ -1148,18 +1148,18 @@ stype_to_fetch(struct lp_build_tgsi_context * bld_base,
    struct lp_build_context *bld_fetch;
 
    switch (stype) {
-   case TGSI_TYPE_FLOAT:
-   case TGSI_TYPE_UNTYPED:
+   case TGSI_OPCODE_TYPE_FLOAT:
+   case TGSI_OPCODE_TYPE_UNTYPED:
       bld_fetch = &bld_base->base;
       break;
-   case TGSI_TYPE_UNSIGNED:
+   case TGSI_OPCODE_TYPE_UNSIGNED:
       bld_fetch = &bld_base->uint_bld;
       break;
-   case TGSI_TYPE_SIGNED:
+   case TGSI_OPCODE_TYPE_SIGNED:
       bld_fetch = &bld_base->int_bld;
       break;
-   case TGSI_TYPE_VOID:
-   case TGSI_TYPE_DOUBLE:
+   case TGSI_OPCODE_TYPE_VOID:
+   case TGSI_OPCODE_TYPE_DOUBLE:
    default:
       assert(0);
       bld_fetch = NULL;
@@ -1271,7 +1271,7 @@ emit_fetch_constant(
       res = lp_build_broadcast_scalar(&bld_base->base, scalar);
    }
 
-   if (stype == TGSI_TYPE_SIGNED || stype == TGSI_TYPE_UNSIGNED) {
+   if (stype == TGSI_OPCODE_TYPE_SIGNED || stype == TGSI_OPCODE_TYPE_UNSIGNED) {
       struct lp_build_context *bld_fetch = stype_to_fetch(bld_base, stype);
       res = LLVMBuildBitCast(builder, res, bld_fetch->vec_type, "");
    }
@@ -1332,9 +1332,9 @@ emit_fetch_immediate(
       res = bld->immediates[reg->Register.Index][swizzle];
    }
 
-   if (stype == TGSI_TYPE_UNSIGNED) {
+   if (stype == TGSI_OPCODE_TYPE_UNSIGNED) {
       res = LLVMBuildBitCast(builder, res, bld_base->uint_bld.vec_type, "");
-   } else if (stype == TGSI_TYPE_SIGNED) {
+   } else if (stype == TGSI_OPCODE_TYPE_SIGNED) {
       res = LLVMBuildBitCast(builder, res, bld_base->int_bld.vec_type, "");
    }
    return res;
@@ -1389,9 +1389,9 @@ emit_fetch_input(
 
    assert(res);
 
-   if (stype == TGSI_TYPE_UNSIGNED) {
+   if (stype == TGSI_OPCODE_TYPE_UNSIGNED) {
       res = LLVMBuildBitCast(builder, res, bld_base->uint_bld.vec_type, "");
-   } else if (stype == TGSI_TYPE_SIGNED) {
+   } else if (stype == TGSI_OPCODE_TYPE_SIGNED) {
       res = LLVMBuildBitCast(builder, res, bld_base->int_bld.vec_type, "");
    }
 
@@ -1420,7 +1420,8 @@ emit_fetch_gs_input(
       assert(!reg->Register.Indirect);
       assert(!reg->Dimension.Indirect);
       res = bld->system_values.prim_id;
-      if (stype != TGSI_TYPE_UNSIGNED && stype != TGSI_TYPE_SIGNED) {
+      if (stype != TGSI_OPCODE_TYPE_UNSIGNED &&
+          stype != TGSI_OPCODE_TYPE_SIGNED) {
          res = LLVMBuildBitCast(builder, res, bld_base->base.vec_type, "");
       }
       return res;
@@ -1453,9 +1454,9 @@ emit_fetch_gs_input(
 
    assert(res);
 
-   if (stype == TGSI_TYPE_UNSIGNED) {
+   if (stype == TGSI_OPCODE_TYPE_UNSIGNED) {
       res = LLVMBuildBitCast(builder, res, bld_base->uint_bld.vec_type, "");
-   } else if (stype == TGSI_TYPE_SIGNED) {
+   } else if (stype == TGSI_OPCODE_TYPE_SIGNED) {
       res = LLVMBuildBitCast(builder, res, bld_base->int_bld.vec_type, "");
    }
 
@@ -1503,7 +1504,7 @@ emit_fetch_temporary(
       res = LLVMBuildLoad(builder, temp_ptr, "");
    }
 
-   if (stype == TGSI_TYPE_SIGNED || stype == TGSI_TYPE_UNSIGNED) {
+   if (stype == TGSI_OPCODE_TYPE_SIGNED || stype == TGSI_OPCODE_TYPE_UNSIGNED) {
       struct lp_build_context *bld_fetch = stype_to_fetch(bld_base, stype);
       res = LLVMBuildBitCast(builder, res, bld_fetch->vec_type, "");
    }
@@ -1530,32 +1531,32 @@ emit_fetch_system_value(
    switch (info->system_value_semantic_name[reg->Register.Index]) {
    case TGSI_SEMANTIC_INSTANCEID:
       res = lp_build_broadcast_scalar(&bld_base->uint_bld, bld->system_values.instance_id);
-      atype = TGSI_TYPE_UNSIGNED;
+      atype = TGSI_OPCODE_TYPE_UNSIGNED;
       break;
 
    case TGSI_SEMANTIC_VERTEXID:
       res = bld->system_values.vertex_id;
-      atype = TGSI_TYPE_UNSIGNED;
+      atype = TGSI_OPCODE_TYPE_UNSIGNED;
       break;
 
    case TGSI_SEMANTIC_PRIMID:
       res = bld->system_values.prim_id;
-      atype = TGSI_TYPE_UNSIGNED;
+      atype = TGSI_OPCODE_TYPE_UNSIGNED;
       break;
 
    default:
       assert(!"unexpected semantic in emit_fetch_system_value");
       res = bld_base->base.zero;
-      atype = TGSI_TYPE_FLOAT;
+      atype = TGSI_OPCODE_TYPE_FLOAT;
       break;
    }
 
    if (atype != stype) {
-      if (stype == TGSI_TYPE_FLOAT) {
+      if (stype == TGSI_OPCODE_TYPE_FLOAT) {
          res = LLVMBuildBitCast(builder, res, bld_base->base.vec_type, "");
-      } else if (stype == TGSI_TYPE_UNSIGNED) {
+      } else if (stype == TGSI_OPCODE_TYPE_UNSIGNED) {
          res = LLVMBuildBitCast(builder, res, bld_base->uint_bld.vec_type, "");
-      } else if (stype == TGSI_TYPE_SIGNED) {
+      } else if (stype == TGSI_OPCODE_TYPE_SIGNED) {
          res = LLVMBuildBitCast(builder, res, bld_base->int_bld.vec_type, "");
       }
    }
@@ -1686,15 +1687,15 @@ emit_store_chan(
       break;
 
    case TGSI_SAT_ZERO_ONE:
-      assert(dtype == TGSI_TYPE_FLOAT ||
-             dtype == TGSI_TYPE_UNTYPED);
+      assert(dtype == TGSI_OPCODE_TYPE_FLOAT ||
+             dtype == TGSI_OPCODE_TYPE_UNTYPED);
       value = LLVMBuildBitCast(builder, value, float_bld->vec_type, "");
       value = lp_build_clamp_zero_one_nanzero(float_bld, value);
       break;
 
    case TGSI_SAT_MINUS_PLUS_ONE:
-      assert(dtype == TGSI_TYPE_FLOAT ||
-             dtype == TGSI_TYPE_UNTYPED);
+      assert(dtype == TGSI_OPCODE_TYPE_FLOAT ||
+             dtype == TGSI_OPCODE_TYPE_UNTYPED);
       value = LLVMBuildBitCast(builder, value, float_bld->vec_type, "");
       /* This will give -1.0 for NaN which is probably not what we want. */
       value = lp_build_max_ext(float_bld, value,
@@ -1779,7 +1780,7 @@ emit_store_chan(
       break;
 
    case TGSI_FILE_ADDRESS:
-      assert(dtype == TGSI_TYPE_SIGNED);
+      assert(dtype == TGSI_OPCODE_TYPE_SIGNED);
       assert(LLVMTypeOf(value) == int_bld->vec_type);
       value = LLVMBuildBitCast(builder, value, int_bld->vec_type, "");
       lp_exec_mask_store(&bld->exec_mask, int_bld, pred, value,
@@ -2686,7 +2687,7 @@ emit_dump_file(struct lp_build_tgsi_soa_context *bld,
             reg.Register.SwizzleZ = 2;
             reg.Register.SwizzleW = 3;
 
-            res = bld->bld_base.emit_fetch_funcs[file](&bld->bld_base, &reg, TGSI_TYPE_FLOAT, chan);
+            res = bld->bld_base.emit_fetch_funcs[file](&bld->bld_base, &reg, TGSI_OPCODE_TYPE_FLOAT, chan);
             if (!res) {
                continue;
             }
diff --git a/src/gallium/auxiliary/tgsi/tgsi_info.c b/src/gallium/auxiliary/tgsi/tgsi_info.c
index 74d186c..cf16d63 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_info.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_info.c
@@ -291,7 +291,7 @@ tgsi_opcode_infer_type( uint opcode )
    switch (opcode) {
    case TGSI_OPCODE_MOV:
    case TGSI_OPCODE_UCMP:
-      return TGSI_TYPE_UNTYPED;
+      return TGSI_OPCODE_TYPE_UNTYPED;
    case TGSI_OPCODE_NOT:
    case TGSI_OPCODE_SHL:
    case TGSI_OPCODE_AND:
@@ -314,7 +314,7 @@ tgsi_opcode_infer_type( uint opcode )
    case TGSI_OPCODE_USNE:
    case TGSI_OPCODE_SVIEWINFO:
    case TGSI_OPCODE_UMUL_HI:
-      return TGSI_TYPE_UNSIGNED;
+      return TGSI_OPCODE_TYPE_UNSIGNED;
    case TGSI_OPCODE_ARL:
    case TGSI_OPCODE_ARR:
    case TGSI_OPCODE_MOD:
@@ -335,9 +335,9 @@ tgsi_opcode_infer_type( uint opcode )
    case TGSI_OPCODE_IABS:
    case TGSI_OPCODE_ISSG:
    case TGSI_OPCODE_IMUL_HI:
-      return TGSI_TYPE_SIGNED;
+      return TGSI_OPCODE_TYPE_SIGNED;
    default:
-      return TGSI_TYPE_FLOAT;
+      return TGSI_OPCODE_TYPE_FLOAT;
    }
 }
 
@@ -358,10 +358,10 @@ tgsi_opcode_infer_src_type( uint opcode )
    case TGSI_OPCODE_SAMPLE_I:
    case TGSI_OPCODE_SAMPLE_I_MS:
    case TGSI_OPCODE_UMUL_HI:
-      return TGSI_TYPE_UNSIGNED;
+      return TGSI_OPCODE_TYPE_UNSIGNED;
    case TGSI_OPCODE_IMUL_HI:
    case TGSI_OPCODE_I2F:
-      return TGSI_TYPE_SIGNED;
+      return TGSI_OPCODE_TYPE_SIGNED;
    case TGSI_OPCODE_ARL:
    case TGSI_OPCODE_ARR:
    case TGSI_OPCODE_TXQ_LZ:
@@ -372,7 +372,7 @@ tgsi_opcode_infer_src_type( uint opcode )
    case TGSI_OPCODE_FSLT:
    case TGSI_OPCODE_FSNE:
    case TGSI_OPCODE_UCMP:
-      return TGSI_TYPE_FLOAT;
+      return TGSI_OPCODE_TYPE_FLOAT;
    default:
       return tgsi_opcode_infer_type(opcode);
    }
diff --git a/src/gallium/auxiliary/tgsi/tgsi_info.h b/src/gallium/auxiliary/tgsi/tgsi_info.h
index aa7edd1..0ecacad 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_info.h
+++ b/src/gallium/auxiliary/tgsi/tgsi_info.h
@@ -92,12 +92,12 @@ const char *
 tgsi_get_processor_name( uint processor );
 
 enum tgsi_opcode_type {
-   TGSI_TYPE_UNTYPED, /* for MOV */
-   TGSI_TYPE_VOID,
-   TGSI_TYPE_UNSIGNED,
-   TGSI_TYPE_SIGNED,
-   TGSI_TYPE_FLOAT,
-   TGSI_TYPE_DOUBLE
+   TGSI_OPCODE_TYPE_UNTYPED, /* for MOV */
+   TGSI_OPCODE_TYPE_VOID,
+   TGSI_OPCODE_TYPE_UNSIGNED,
+   TGSI_OPCODE_TYPE_SIGNED,
+   TGSI_OPCODE_TYPE_FLOAT,
+   TGSI_OPCODE_TYPE_DOUBLE
 };
 
 enum tgsi_opcode_type
diff --git a/src/gallium/drivers/ilo/shader/toy_tgsi.c b/src/gallium/drivers/ilo/shader/toy_tgsi.c
index 7c74bad..e4344f8 100644
--- a/src/gallium/drivers/ilo/shader/toy_tgsi.c
+++ b/src/gallium/drivers/ilo/shader/toy_tgsi.c
@@ -1694,15 +1694,15 @@ ra_infer_opcode_type(int tgsi_opcode, bool is_dst)
       type = tgsi_opcode_infer_src_type(tgsi_opcode);
 
    switch (type) {
-   case TGSI_TYPE_UNSIGNED:
+   case TGSI_OPCODE_TYPE_UNSIGNED:
       return TOY_TYPE_UD;
-   case TGSI_TYPE_SIGNED:
+   case TGSI_OPCODE_TYPE_SIGNED:
       return TOY_TYPE_D;
-   case TGSI_TYPE_FLOAT:
+   case TGSI_OPCODE_TYPE_FLOAT:
       return TOY_TYPE_F;
-   case TGSI_TYPE_UNTYPED:
-   case TGSI_TYPE_VOID:
-   case TGSI_TYPE_DOUBLE:
+   case TGSI_OPCODE_TYPE_UNTYPED:
+   case TGSI_OPCODE_TYPE_VOID:
+   case TGSI_OPCODE_TYPE_DOUBLE:
    default:
       assert(!"unsupported TGSI type");
       return TOY_TYPE_UD;
diff --git a/src/gallium/drivers/radeon/radeon_llvm.h b/src/gallium/drivers/radeon/radeon_llvm.h
index 00714fb..e504c24 100644
--- a/src/gallium/drivers/radeon/radeon_llvm.h
+++ b/src/gallium/drivers/radeon/radeon_llvm.h
@@ -143,11 +143,11 @@ static inline LLVMTypeRef tgsi2llvmtype(
 	LLVMContextRef ctx = bld_base->base.gallivm->context;
 
 	switch (type) {
-	case TGSI_TYPE_UNSIGNED:
-	case TGSI_TYPE_SIGNED:
+	case TGSI_OPCODE_TYPE_UNSIGNED:
+	case TGSI_OPCODE_TYPE_SIGNED:
 		return LLVMInt32TypeInContext(ctx);
-	case TGSI_TYPE_UNTYPED:
-	case TGSI_TYPE_FLOAT:
+	case TGSI_OPCODE_TYPE_UNTYPED:
+	case TGSI_OPCODE_TYPE_FLOAT:
 		return LLVMFloatTypeInContext(ctx);
 	default: break;
 	}
diff --git a/src/gallium/drivers/radeon/radeon_setup_tgsi_llvm.c b/src/gallium/drivers/radeon/radeon_setup_tgsi_llvm.c
index 119e613..c3e8321 100644
--- a/src/gallium/drivers/radeon/radeon_setup_tgsi_llvm.c
+++ b/src/gallium/drivers/radeon/radeon_setup_tgsi_llvm.c
@@ -376,7 +376,7 @@ emit_store(
 			continue;
 		}
 	
-		value = bitcast(bld_base, TGSI_TYPE_FLOAT, value);
+		value = bitcast(bld_base, TGSI_OPCODE_TYPE_FLOAT, value);
 
 		if (reg->Register.Indirect) {
 			struct tgsi_declaration_range range = get_array_range(bld_base,
@@ -384,7 +384,7 @@ emit_store(
 
         		unsigned i, size = range.Last - range.First + 1;
 			LLVMValueRef array = LLVMBuildInsertElement(builder,
-				emit_array_fetch(bld_base, reg->Register.File, TGSI_TYPE_FLOAT, range, chan_index),
+				emit_array_fetch(bld_base, reg->Register.File, TGSI_OPCODE_TYPE_FLOAT, range, chan_index),
 				value,  emit_array_index(bld, &reg->Indirect, reg->Register.Index - range.First), "");
 
         		for (i = 0; i < size; ++i) {
@@ -607,7 +607,7 @@ static void uif_emit(
 	LLVMValueRef cond;
 
 	cond = LLVMBuildICmp(gallivm->builder, LLVMIntNE,
-	        bitcast(bld_base, TGSI_TYPE_UNSIGNED, emit_data->args[0]),
+	        bitcast(bld_base, TGSI_OPCODE_TYPE_UNSIGNED, emit_data->args[0]),
 			bld_base->int_bld.zero, "");
 
 	if_cond_emit(action, bld_base, emit_data, cond);
@@ -943,7 +943,7 @@ static void emit_not(
 		struct lp_build_emit_data * emit_data)
 {
 	LLVMBuilderRef builder = bld_base->base.gallivm->builder;
-	LLVMValueRef v = bitcast(bld_base, TGSI_TYPE_UNSIGNED,
+	LLVMValueRef v = bitcast(bld_base, TGSI_OPCODE_TYPE_UNSIGNED,
 			emit_data->args[0]);
 	emit_data->output[emit_data->chan] = LLVMBuildNot(builder, v, "");
 }
-- 
1.7.10.4



More information about the mesa-dev mailing list