Mesa (master): gallium/tgsi: Redefine the TGSI_TEXTURE_UNKNOWN texture target.

Jose Fonseca jrfonseca at kemper.freedesktop.org
Fri May 11 06:38:07 PDT 2012


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

Author: José Fonseca <jfonseca at vmware.com>
Date:   Fri May 11 13:36:46 2012 +0100

gallium/tgsi: Redefine the TGSI_TEXTURE_UNKNOWN texture target.

Some code relies on the existing of an invalid texture target. It seems
safer to bring it back than to deal with unintended consequences.

This partially reverts commit a4ebb04214bab1cd9bd41967232ec89441e31744.

Reviewed-by: Brian Paul <brianp at vmware.com>

---

 src/gallium/auxiliary/tgsi/tgsi_build.c            |    2 +-
 src/gallium/auxiliary/tgsi/tgsi_strings.c          |    3 ++-
 src/gallium/auxiliary/util/u_blitter.c             |    2 +-
 .../drivers/nv50/codegen/nv50_ir_from_tgsi.cpp     |    2 ++
 src/gallium/include/pipe/p_shader_tokens.h         |    3 ++-
 5 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/src/gallium/auxiliary/tgsi/tgsi_build.c b/src/gallium/auxiliary/tgsi/tgsi_build.c
index 1d3c4bc..869faa1 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_build.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_build.c
@@ -707,7 +707,7 @@ tgsi_default_instruction_texture( void )
 {
    struct tgsi_instruction_texture instruction_texture;
 
-   instruction_texture.Texture = TGSI_BUFFER;
+   instruction_texture.Texture = TGSI_TEXTURE_UNKNOWN;
    instruction_texture.NumOffsets = 0;
    instruction_texture.Padding = 0;
 
diff --git a/src/gallium/auxiliary/tgsi/tgsi_strings.c b/src/gallium/auxiliary/tgsi/tgsi_strings.c
index d7b74ba..b5fd1fc 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_strings.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_strings.c
@@ -96,7 +96,8 @@ const char *tgsi_texture_names[TGSI_TEXTURE_COUNT] =
    "2DARRAY",
    "SHADOW1DARRAY",
    "SHADOW2DARRAY",
-   "SHADOWCUBE"
+   "SHADOWCUBE",
+   "UNKNOWN"
 };
 
 const char *tgsi_property_names[TGSI_PROPERTY_COUNT] =
diff --git a/src/gallium/auxiliary/util/u_blitter.c b/src/gallium/auxiliary/util/u_blitter.c
index 28e7383..d0b9187 100644
--- a/src/gallium/auxiliary/util/u_blitter.c
+++ b/src/gallium/auxiliary/util/u_blitter.c
@@ -674,7 +674,7 @@ pipe_tex_to_tgsi_tex(enum pipe_texture_target pipe_tex_target)
       return TGSI_TEXTURE_2D_ARRAY;
    default:
       assert(0 && "unexpected texture target");
-      return 0;
+      return TGSI_TEXTURE_UNKNOWN;
    }
 }
 
diff --git a/src/gallium/drivers/nv50/codegen/nv50_ir_from_tgsi.cpp b/src/gallium/drivers/nv50/codegen/nv50_ir_from_tgsi.cpp
index 955eb92..ba08493 100644
--- a/src/gallium/drivers/nv50/codegen/nv50_ir_from_tgsi.cpp
+++ b/src/gallium/drivers/nv50/codegen/nv50_ir_from_tgsi.cpp
@@ -349,6 +349,8 @@ static nv50_ir::TexTarget translateTexture(uint tex)
    NV50_IR_TEX_TARG_CASE(SHADOWRECT, RECT_SHADOW);
    case TGSI_BUFFER:
       return nv50_ir::TEX_TARGET_BUFFER;
+
+   case TGSI_TEXTURE_UNKNOWN:
    default:
       assert(!"invalid texture target");
       return nv50_ir::TEX_TARGET_2D;
diff --git a/src/gallium/include/pipe/p_shader_tokens.h b/src/gallium/include/pipe/p_shader_tokens.h
index 5325e43..615a89a 100644
--- a/src/gallium/include/pipe/p_shader_tokens.h
+++ b/src/gallium/include/pipe/p_shader_tokens.h
@@ -504,7 +504,8 @@ struct tgsi_instruction_label
 #define TGSI_TEXTURE_SHADOW1D_ARRAY 11
 #define TGSI_TEXTURE_SHADOW2D_ARRAY 12
 #define TGSI_TEXTURE_SHADOWCUBE     13
-#define TGSI_TEXTURE_COUNT          14
+#define TGSI_TEXTURE_UNKNOWN        14
+#define TGSI_TEXTURE_COUNT          15
 
 struct tgsi_instruction_texture
 {



More information about the mesa-commit mailing list