[Mesa-dev] [PATCH 05/10] nine: always generate two-dimensional constant file accesses

Nicolai Hähnle nhaehnle at gmail.com
Wed Aug 23 16:41:11 UTC 2017


From: Nicolai Hähnle <nicolai.haehnle at amd.com>

---
 src/gallium/state_trackers/nine/nine_ff.c     |  2 +-
 src/gallium/state_trackers/nine/nine_shader.c | 10 ++++------
 2 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/src/gallium/state_trackers/nine/nine_ff.c b/src/gallium/state_trackers/nine/nine_ff.c
index 2175bdbcc51..39fcb8b1591 100644
--- a/src/gallium/state_trackers/nine/nine_ff.c
+++ b/src/gallium/state_trackers/nine/nine_ff.c
@@ -483,7 +483,7 @@ nine_ff_build_vs(struct NineDevice9 *device, struct vs_build_ctx *vs)
 
         for (i = 0; i < key->vertexblend; ++i) {
             for (c = 0; c < 4; ++c) {
-                cWM[c] = ureg_src_register(TGSI_FILE_CONSTANT, (160 + i * 4) * !key->vertexblend_indexed + c);
+                cWM[c] = ureg_src_dimension(ureg_src_register(TGSI_FILE_CONSTANT, (160 + i * 4) * !key->vertexblend_indexed + c), 0);
                 if (key->vertexblend_indexed)
                     cWM[c] = ureg_src_indirect(cWM[c], ureg_scalar(ureg_src(AR), i));
             }
diff --git a/src/gallium/state_trackers/nine/nine_shader.c b/src/gallium/state_trackers/nine/nine_shader.c
index 5b60dcbac8f..cc667ebfbcd 100644
--- a/src/gallium/state_trackers/nine/nine_shader.c
+++ b/src/gallium/state_trackers/nine/nine_shader.c
@@ -91,7 +91,7 @@ static inline const char *d3dsio_to_string(unsigned opcode);
    TGSI_SWIZZLE_##x, TGSI_SWIZZLE_##y, TGSI_SWIZZLE_##z, TGSI_SWIZZLE_##w
 
 #define NINE_CONSTANT_SRC(index) \
-   ureg_src_register(TGSI_FILE_CONSTANT, index)
+   ureg_src_dimension(ureg_src_register(TGSI_FILE_CONSTANT, index), 0)
 
 #define NINE_APPLY_SWIZZLE(src, s) \
    ureg_swizzle(src, NINE_SWIZZLE4(s, s, s, s))
@@ -1009,7 +1009,7 @@ tx_src_param(struct shader_translator *tx, const struct sm1_src_param *param)
                     src = ureg_src_dimension(src, 0);
                 }
             } else
-                src = ureg_src_register(TGSI_FILE_CONSTANT, param->idx);
+                src = NINE_CONSTANT_SRC(param->idx);
         }
         if (!IS_VS && tx->version.major < 2) {
             /* ps 1.X clamps constants */
@@ -1035,8 +1035,7 @@ tx_src_param(struct shader_translator *tx, const struct sm1_src_param *param)
                 src = ureg_src_register(TGSI_FILE_CONSTANT, param->idx);
                 src = ureg_src_dimension(src, 2);
             } else
-                src = ureg_src_register(TGSI_FILE_CONSTANT,
-                                        tx->info->const_i_base + param->idx);
+                src = NINE_CONSTANT_SRC(tx->info->const_i_base + param->idx);
         }
         break;
     case D3DSPR_CONSTBOOL:
@@ -1049,8 +1048,7 @@ tx_src_param(struct shader_translator *tx, const struct sm1_src_param *param)
                src = ureg_src_register(TGSI_FILE_CONSTANT, r);
                src = ureg_src_dimension(src, 3);
            } else
-               src = ureg_src_register(TGSI_FILE_CONSTANT,
-                                       tx->info->const_b_base + r);
+               src = NINE_CONSTANT_SRC(tx->info->const_b_base + r);
            src = ureg_swizzle(src, s, s, s, s);
         }
         break;
-- 
2.11.0



More information about the mesa-dev mailing list