[Mesa-dev] [PATCH 06/19] gallium: add TGSI support for multisample textures

Marek Olšák maraeo at gmail.com
Thu Aug 9 09:07:18 PDT 2012


The only allowed instructions are TXQ_LZ and TXF.

TXQ_LZ is like TXQ, but without the LOD parameter (which is always zero
with MSAA textures)

The 3rd or the 4th texcoord component in TXF should contain the sample index
for a 2D_MSAA or 2D_ARRAY_MSAA texture, respectively.
---
 src/gallium/auxiliary/tgsi/tgsi_info.c     |    3 ++-
 src/gallium/auxiliary/tgsi/tgsi_strings.c  |    2 ++
 src/gallium/auxiliary/tgsi/tgsi_util.c     |    2 ++
 src/gallium/include/pipe/p_shader_tokens.h |    7 +++++--
 4 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/src/gallium/auxiliary/tgsi/tgsi_info.c b/src/gallium/auxiliary/tgsi/tgsi_info.c
index 8bf9aeb..c2b4374 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_info.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_info.c
@@ -140,7 +140,7 @@ static const struct tgsi_opcode_info opcode_info[TGSI_OPCODE_LAST] =
    { 0, 0, 0, 0, 0, 1, NONE, "BGNSUB", TGSI_OPCODE_BGNSUB },
    { 0, 0, 0, 1, 1, 0, NONE, "ENDLOOP", TGSI_OPCODE_ENDLOOP },
    { 0, 0, 0, 0, 1, 0, NONE, "ENDSUB", TGSI_OPCODE_ENDSUB },
-   { 0, 0, 0, 0, 0, 0, NONE, "", 103 },     /* removed */
+   { 1, 1, 1, 0, 0, 0, OTHR, "TXQ_LZ", TGSI_OPCODE_TXQ_LZ },
    { 0, 0, 0, 0, 0, 0, NONE, "", 104 },     /* removed */
    { 0, 0, 0, 0, 0, 0, NONE, "", 105 },     /* removed */
    { 0, 0, 0, 0, 0, 0, NONE, "", 106 },     /* removed */
@@ -338,6 +338,7 @@ tgsi_opcode_infer_dst_type( uint opcode )
    case TGSI_OPCODE_USHR:
    case TGSI_OPCODE_SHL:
    case TGSI_OPCODE_TXQ:
+   case TGSI_OPCODE_TXQ_LZ:
       return TGSI_TYPE_UNSIGNED;
    case TGSI_OPCODE_F2I:
    case TGSI_OPCODE_IDIV:
diff --git a/src/gallium/auxiliary/tgsi/tgsi_strings.c b/src/gallium/auxiliary/tgsi/tgsi_strings.c
index 5f8f4be..c15e2a0 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_strings.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_strings.c
@@ -97,6 +97,8 @@ const char *tgsi_texture_names[TGSI_TEXTURE_COUNT] =
    "SHADOW1D_ARRAY",
    "SHADOW2D_ARRAY",
    "SHADOWCUBE",
+   "2D_MSAA",
+   "2D_ARRAY_MSAA",
    "UNKNOWN"
 };
 
diff --git a/src/gallium/auxiliary/tgsi/tgsi_util.c b/src/gallium/auxiliary/tgsi/tgsi_util.c
index 36dc10d..c3fa604 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_util.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_util.c
@@ -281,10 +281,12 @@ tgsi_util_get_inst_usage_mask(const struct tgsi_full_instruction *inst,
          case TGSI_TEXTURE_2D_ARRAY:
          case TGSI_TEXTURE_3D:
          case TGSI_TEXTURE_CUBE:
+         case TGSI_TEXTURE_2D_MSAA:
             read_mask = TGSI_WRITEMASK_XYZ;
             break;
          case TGSI_TEXTURE_SHADOW2D_ARRAY:
          case TGSI_TEXTURE_SHADOWCUBE:
+         case TGSI_TEXTURE_2D_ARRAY_MSAA:
             read_mask = TGSI_WRITEMASK_XYZW;
             break;
          default:
diff --git a/src/gallium/include/pipe/p_shader_tokens.h b/src/gallium/include/pipe/p_shader_tokens.h
index 6b58293..7d96f27 100644
--- a/src/gallium/include/pipe/p_shader_tokens.h
+++ b/src/gallium/include/pipe/p_shader_tokens.h
@@ -355,6 +355,7 @@ struct tgsi_property_data {
 #define TGSI_OPCODE_BGNSUB              100
 #define TGSI_OPCODE_ENDLOOP             101
 #define TGSI_OPCODE_ENDSUB              102
+#define TGSI_OPCODE_TXQ_LZ              103 /* TXQ for mipmap level 0 */
                                 /* gap */
 #define TGSI_OPCODE_NOP                 107
                                 /* gap */
@@ -504,8 +505,10 @@ struct tgsi_instruction_label
 #define TGSI_TEXTURE_SHADOW1D_ARRAY 11
 #define TGSI_TEXTURE_SHADOW2D_ARRAY 12
 #define TGSI_TEXTURE_SHADOWCUBE     13
-#define TGSI_TEXTURE_UNKNOWN        14
-#define TGSI_TEXTURE_COUNT          15
+#define TGSI_TEXTURE_2D_MSAA        14
+#define TGSI_TEXTURE_2D_ARRAY_MSAA  15
+#define TGSI_TEXTURE_UNKNOWN        16
+#define TGSI_TEXTURE_COUNT          17
 
 struct tgsi_instruction_texture
 {
-- 
1.7.9.5



More information about the mesa-dev mailing list