gallium: replace pipe_type enum with tgsi_return_type enum
authorBrian Paul <brianp@vmware.com>
Sat, 20 Sep 2014 14:32:39 +0000 (08:32 -0600)
committerBrian Paul <brianp@vmware.com>
Mon, 22 Sep 2014 22:56:24 +0000 (16:56 -0600)
The only place the enum pipe_type was used is for the TGSI sampler
view return type.  So make it a TGSI type.  Note: it appears this
part of TGSI isn't used by anyone so it may be removed in the future.

v2: the new name is tgsi_return_type, not tgsi_type.  This means we
can drop the previously posted tgsi_type -> tgsi_opcode_type patch.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
src/gallium/auxiliary/tgsi/tgsi_build.c
src/gallium/auxiliary/tgsi/tgsi_dump.c
src/gallium/auxiliary/tgsi/tgsi_strings.c
src/gallium/auxiliary/tgsi/tgsi_strings.h
src/gallium/auxiliary/tgsi/tgsi_text.c
src/gallium/include/pipe/p_format.h
src/gallium/include/pipe/p_shader_tokens.h

index bef5c75ac767988b37e05476cc9992fbe365f331..39a4296a3a13c63ef88c362023c9381ed10df6e5 100644 (file)
@@ -297,10 +297,10 @@ tgsi_default_declaration_sampler_view(void)
    struct tgsi_declaration_sampler_view dsv;
 
    dsv.Resource = TGSI_TEXTURE_BUFFER;
-   dsv.ReturnTypeX = PIPE_TYPE_UNORM;
-   dsv.ReturnTypeY = PIPE_TYPE_UNORM;
-   dsv.ReturnTypeZ = PIPE_TYPE_UNORM;
-   dsv.ReturnTypeW = PIPE_TYPE_UNORM;
+   dsv.ReturnTypeX = TGSI_RETURN_TYPE_UNORM;
+   dsv.ReturnTypeY = TGSI_RETURN_TYPE_UNORM;
+   dsv.ReturnTypeZ = TGSI_RETURN_TYPE_UNORM;
+   dsv.ReturnTypeW = TGSI_RETURN_TYPE_UNORM;
 
    return dsv;
 }
index 08d3fde614c75015630f5f80e8b5bcb8e667e377..972a37e83e12d0c21e7c6813a608ac5d739dc672 100644 (file)
@@ -329,15 +329,15 @@ iter_declaration(
       if ((decl->SamplerView.ReturnTypeX == decl->SamplerView.ReturnTypeY) &&
           (decl->SamplerView.ReturnTypeX == decl->SamplerView.ReturnTypeZ) &&
           (decl->SamplerView.ReturnTypeX == decl->SamplerView.ReturnTypeW)) {
-         ENM(decl->SamplerView.ReturnTypeX, tgsi_type_names);
+         ENM(decl->SamplerView.ReturnTypeX, tgsi_return_type_names);
       } else {
-         ENM(decl->SamplerView.ReturnTypeX, tgsi_type_names);
+         ENM(decl->SamplerView.ReturnTypeX, tgsi_return_type_names);
          TXT(", ");
-         ENM(decl->SamplerView.ReturnTypeY, tgsi_type_names);
+         ENM(decl->SamplerView.ReturnTypeY, tgsi_return_type_names);
          TXT(", ");
-         ENM(decl->SamplerView.ReturnTypeZ, tgsi_type_names);
+         ENM(decl->SamplerView.ReturnTypeZ, tgsi_return_type_names);
          TXT(", ");
-         ENM(decl->SamplerView.ReturnTypeW, tgsi_type_names);
+         ENM(decl->SamplerView.ReturnTypeW, tgsi_return_type_names);
       }
    }
 
index 3c108a8c1c9f5a909637de090e61cbde59e2a046..f84cd79b8e464b7458221f4d9d8822552e773053 100644 (file)
@@ -125,7 +125,7 @@ const char *tgsi_property_names[TGSI_PROPERTY_COUNT] =
    "VS_POSITION_WINDOW_SPACE"
 };
 
-const char *tgsi_type_names[5] =
+const char *tgsi_return_type_names[TGSI_RETURN_TYPE_COUNT] =
 {
    "UNORM",
    "SNORM",
@@ -195,8 +195,9 @@ tgsi_strings_check(void)
    STATIC_ASSERT(Elements(tgsi_property_names) == TGSI_PROPERTY_COUNT);
    STATIC_ASSERT(Elements(tgsi_primitive_names) == PIPE_PRIM_MAX);
    STATIC_ASSERT(Elements(tgsi_interpolate_names) == TGSI_INTERPOLATE_COUNT);
+   STATIC_ASSERT(Elements(tgsi_return_type_names) == TGSI_RETURN_TYPE_COUNT);
    (void) tgsi_processor_type_names;
-   (void) tgsi_type_names;
+   (void) tgsi_return_type_names;
    (void) tgsi_immediate_type_names;
    (void) tgsi_fs_coord_origin_names;
    (void) tgsi_fs_coord_pixel_center_names;
index 1c37c290974a32f16e0d4b34b6433ef79d957e2b..c84274677937043b2b815be32adf8de05573f12f 100644 (file)
@@ -46,7 +46,7 @@ extern const char *tgsi_texture_names[TGSI_TEXTURE_COUNT];
 
 extern const char *tgsi_property_names[TGSI_PROPERTY_COUNT];
 
-extern const char *tgsi_type_names[5];
+extern const char *tgsi_return_type_names[TGSI_RETURN_TYPE_COUNT];
 
 extern const char *tgsi_interpolate_names[TGSI_INTERPOLATE_COUNT];
 
index 729114594c88357b33ede3d1b2b9589e3145ec36..f965b0130e0533f27fb346a5f932040d454098ad 100644 (file)
@@ -1258,8 +1258,8 @@ static boolean parse_declaration( struct translate_ctx *ctx )
          ++cur;
          eat_opt_white( &cur );
          for (j = 0; j < 4; ++j) {
-            for (i = 0; i < PIPE_TYPE_COUNT; ++i) {
-               if (str_match_nocase_whole(&cur, tgsi_type_names[i])) {
+            for (i = 0; i < TGSI_RETURN_TYPE_COUNT; ++i) {
+               if (str_match_nocase_whole(&cur, tgsi_return_type_names[i])) {
                   switch (j) {
                   case 0:
                      decl.SamplerView.ReturnTypeX = i;
@@ -1279,7 +1279,7 @@ static boolean parse_declaration( struct translate_ctx *ctx )
                   break;
                }
             }
-            if (i == PIPE_TYPE_COUNT) {
+            if (i == TGSI_RETURN_TYPE_COUNT) {
                if (j == 0 || j >  2) {
                   report_error(ctx, "Expected type name");
                   return FALSE;
index 9c024640a2a3410eac33a391e384a0ff222b9247..b007229a2156b69c9985d76d3a213e610f60d16a 100644 (file)
@@ -35,15 +35,6 @@ extern "C" {
 
 #include "p_config.h"
 
-enum pipe_type {
-   PIPE_TYPE_UNORM = 0,
-   PIPE_TYPE_SNORM,
-   PIPE_TYPE_SINT,
-   PIPE_TYPE_UINT,
-   PIPE_TYPE_FLOAT,
-   PIPE_TYPE_COUNT
-};
-
 /**
  * Texture/surface image formats (preliminary)
  */
index 8ab1ea85e576d9c07c6811ffc738d4858d3e556c..df154a27c8ddc0ae72b7549047240daddbcc8596 100644 (file)
@@ -192,12 +192,21 @@ struct tgsi_declaration_resource {
    unsigned Padding     : 22;
 };
 
+enum tgsi_return_type {
+   TGSI_RETURN_TYPE_UNORM = 0,
+   TGSI_RETURN_TYPE_SNORM,
+   TGSI_RETURN_TYPE_SINT,
+   TGSI_RETURN_TYPE_UINT,
+   TGSI_RETURN_TYPE_FLOAT,
+   TGSI_RETURN_TYPE_COUNT
+};
+
 struct tgsi_declaration_sampler_view {
    unsigned Resource    : 8; /**< one of TGSI_TEXTURE_ */
-   unsigned ReturnTypeX : 6; /**< one of enum pipe_type */
-   unsigned ReturnTypeY : 6; /**< one of enum pipe_type */
-   unsigned ReturnTypeZ : 6; /**< one of enum pipe_type */
-   unsigned ReturnTypeW : 6; /**< one of enum pipe_type */
+   unsigned ReturnTypeX : 6; /**< one of enum tgsi_return_type */
+   unsigned ReturnTypeY : 6; /**< one of enum tgsi_return_type */
+   unsigned ReturnTypeZ : 6; /**< one of enum tgsi_return_type */
+   unsigned ReturnTypeW : 6; /**< one of enum tgsi_return_type */
 };
 
 struct tgsi_declaration_array {