[Mesa-dev] [PATCH 06/10] gallium: add defines/shader opcode for texture cube map array

Dave Airlie airlied at gmail.com
Tue Nov 6 14:16:01 PST 2012


This just adds the texture target and capability along
with 3 new opcodes required to support this extension.

As this extension requires some texture opcodes with samp + 5 args,
we need to use another src register, this is only required
for TEX, TXL and TXB opcodes to implement this spec.

TEX2 is required for shadow cube map arrays
TXL2 is required for cube map array sampler + explicit lod
TXB2 is required for cube map array sampler + lod bias

Signed-off-by: Dave Airlie <airlied at redhat.com>
---
 src/gallium/auxiliary/tgsi/tgsi_info.c     |  5 ++++-
 src/gallium/auxiliary/tgsi/tgsi_strings.c  |  4 +++-
 src/gallium/auxiliary/tgsi/tgsi_util.c     |  2 ++
 src/gallium/auxiliary/util/u_inlines.h     |  3 +++
 src/gallium/include/pipe/p_defines.h       |  4 +++-
 src/gallium/include/pipe/p_shader_tokens.h | 13 ++++++++++---
 6 files changed, 25 insertions(+), 6 deletions(-)

diff --git a/src/gallium/auxiliary/tgsi/tgsi_info.c b/src/gallium/auxiliary/tgsi/tgsi_info.c
index c2b4374..51ca373 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_info.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_info.c
@@ -215,7 +215,10 @@ static const struct tgsi_opcode_info opcode_info[TGSI_OPCODE_LAST] =
    { 1, 3, 0, 0, 0, 0, OTHR, "ATOMUMIN", TGSI_OPCODE_ATOMUMIN },
    { 1, 3, 0, 0, 0, 0, OTHR, "ATOMUMAX", TGSI_OPCODE_ATOMUMAX },
    { 1, 3, 0, 0, 0, 0, OTHR, "ATOMIMIN", TGSI_OPCODE_ATOMIMIN },
-   { 1, 3, 0, 0, 0, 0, OTHR, "ATOMIMAX", TGSI_OPCODE_ATOMIMAX }
+   { 1, 3, 0, 0, 0, 0, OTHR, "ATOMIMAX", TGSI_OPCODE_ATOMIMAX },
+   { 1, 3, 1, 0, 0, 0, OTHR, "TEX2", TGSI_OPCODE_TEX2 },
+   { 1, 3, 1, 0, 0, 0, OTHR, "TXB2", TGSI_OPCODE_TXB2 },
+   { 1, 3, 1, 0, 0, 0, OTHR, "TXL2", TGSI_OPCODE_TXL2 },
 };
 
 const struct tgsi_opcode_info *
diff --git a/src/gallium/auxiliary/tgsi/tgsi_strings.c b/src/gallium/auxiliary/tgsi/tgsi_strings.c
index c15e2a0..70f997b 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_strings.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_strings.c
@@ -99,7 +99,9 @@ const char *tgsi_texture_names[TGSI_TEXTURE_COUNT] =
    "SHADOWCUBE",
    "2D_MSAA",
    "2D_ARRAY_MSAA",
-   "UNKNOWN"
+   "CUBEARRAY",
+   "SHADOWCUBEARRAY",
+   "UNKNOWN",
 };
 
 const char *tgsi_property_names[TGSI_PROPERTY_COUNT] =
diff --git a/src/gallium/auxiliary/tgsi/tgsi_util.c b/src/gallium/auxiliary/tgsi/tgsi_util.c
index c3fa604..8a5a8ea 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_util.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_util.c
@@ -285,8 +285,10 @@ tgsi_util_get_inst_usage_mask(const struct tgsi_full_instruction *inst,
             read_mask = TGSI_WRITEMASK_XYZ;
             break;
          case TGSI_TEXTURE_SHADOW2D_ARRAY:
+         case TGSI_TEXTURE_CUBE_ARRAY:
          case TGSI_TEXTURE_SHADOWCUBE:
          case TGSI_TEXTURE_2D_ARRAY_MSAA:
+         case TGSI_TEXTURE_SHADOWCUBE_ARRAY:
             read_mask = TGSI_WRITEMASK_XYZW;
             break;
          default:
diff --git a/src/gallium/auxiliary/util/u_inlines.h b/src/gallium/auxiliary/util/u_inlines.h
index 3d68cf5..6ef5fec 100644
--- a/src/gallium/auxiliary/util/u_inlines.h
+++ b/src/gallium/auxiliary/util/u_inlines.h
@@ -523,6 +523,9 @@ util_pipe_tex_to_tgsi_tex(enum pipe_texture_target pipe_tex_target,
       return nr_samples > 1 ? TGSI_TEXTURE_2D_ARRAY_MSAA :
                               TGSI_TEXTURE_2D_ARRAY;
 
+   case PIPE_TEXTURE_CUBE_ARRAY:
+      return TGSI_TEXTURE_CUBE_ARRAY;
+
    default:
       assert(0 && "unexpected texture target");
       return TGSI_TEXTURE_UNKNOWN;
diff --git a/src/gallium/include/pipe/p_defines.h b/src/gallium/include/pipe/p_defines.h
index 184136e..fa2fb07 100644
--- a/src/gallium/include/pipe/p_defines.h
+++ b/src/gallium/include/pipe/p_defines.h
@@ -150,6 +150,7 @@ enum pipe_texture_target {
    PIPE_TEXTURE_RECT     = 5,
    PIPE_TEXTURE_1D_ARRAY = 6,
    PIPE_TEXTURE_2D_ARRAY = 7,
+   PIPE_TEXTURE_CUBE_ARRAY = 8,
    PIPE_MAX_TEXTURE_TYPES
 };
 
@@ -489,7 +490,8 @@ enum pipe_cap {
    PIPE_CAP_START_INSTANCE = 72,
    PIPE_CAP_QUERY_TIMESTAMP = 73,
    PIPE_CAP_TEXTURE_MULTISAMPLE = 74,
-   PIPE_CAP_MIN_MAP_BUFFER_ALIGNMENT = 75
+   PIPE_CAP_MIN_MAP_BUFFER_ALIGNMENT = 75,
+   PIPE_CAP_CUBE_MAP_ARRAY = 76
 };
 
 /**
diff --git a/src/gallium/include/pipe/p_shader_tokens.h b/src/gallium/include/pipe/p_shader_tokens.h
index 7d96f27..3fb12fb 100644
--- a/src/gallium/include/pipe/p_shader_tokens.h
+++ b/src/gallium/include/pipe/p_shader_tokens.h
@@ -431,7 +431,12 @@ struct tgsi_property_data {
 #define TGSI_OPCODE_ATOMIMIN            175
 #define TGSI_OPCODE_ATOMIMAX            176
 
-#define TGSI_OPCODE_LAST                177
+/* to be used for shadow cube map compares */
+#define TGSI_OPCODE_TEX2                177
+#define TGSI_OPCODE_TXB2                178
+#define TGSI_OPCODE_TXL2                179
+
+#define TGSI_OPCODE_LAST                180
 
 #define TGSI_SAT_NONE            0  /* do not saturate */
 #define TGSI_SAT_ZERO_ONE        1  /* clamp to [0,1] */
@@ -507,8 +512,10 @@ struct tgsi_instruction_label
 #define TGSI_TEXTURE_SHADOWCUBE     13
 #define TGSI_TEXTURE_2D_MSAA        14
 #define TGSI_TEXTURE_2D_ARRAY_MSAA  15
-#define TGSI_TEXTURE_UNKNOWN        16
-#define TGSI_TEXTURE_COUNT          17
+#define TGSI_TEXTURE_CUBE_ARRAY     16
+#define TGSI_TEXTURE_SHADOWCUBE_ARRAY 17
+#define TGSI_TEXTURE_UNKNOWN        18
+#define TGSI_TEXTURE_COUNT          19
 
 struct tgsi_instruction_texture
 {
-- 
1.7.11.7



More information about the mesa-dev mailing list