st/nine: Refactor param->rel
authorAxel Davy <davyaxel0@gmail.com>
Thu, 5 Apr 2018 20:38:03 +0000 (22:38 +0200)
committerAxel Davy <davyaxel0@gmail.com>
Tue, 30 Apr 2019 17:18:51 +0000 (19:18 +0200)
Refactor param->rel to enable different paths
for constants and inputs relative addressing.

Signed-off-by: Axel Davy <davyaxel0@gmail.com>
src/gallium/state_trackers/nine/nine_shader.c

index ff65344d25bc0c9674c76d7438a7d06e89d5a73c..1ec03c67924614a203c3f27e3b6bbd8980aed9f3 100644 (file)
@@ -979,6 +979,8 @@ tx_src_param(struct shader_translator *tx, const struct sm1_src_param *param)
                 }
             }
         }
+        if (param->rel)
+            src = ureg_src_indirect(src, tx_src_param(tx, param->rel));
         break;
     case D3DSPR_PREDICATE:
         if (ureg_dst_is_undef(tx->regs.predicate)) {
@@ -994,8 +996,6 @@ tx_src_param(struct shader_translator *tx, const struct sm1_src_param *param)
         src = ureg_src_register(TGSI_FILE_SAMPLER, param->idx);
         break;
     case D3DSPR_CONST:
-        if (param->rel)
-            tx->indirect_const_access = TRUE;
         if (param->rel || !tx_lconstf(tx, &src, param->idx)) {
             if (!param->rel)
                 nine_info_mark_const_f_used(tx->info, param->idx);
@@ -1019,6 +1019,10 @@ tx_src_param(struct shader_translator *tx, const struct sm1_src_param *param)
                 }
             } else
                 src = NINE_CONSTANT_SRC(param->idx);
+            if (param->rel) {
+                tx->indirect_const_access = TRUE;
+                src = ureg_src_indirect(src, tx_src_param(tx, param->rel));
+            }
         }
         if (!IS_VS && tx->version.major < 2) {
             /* ps 1.X clamps constants */
@@ -1113,8 +1117,6 @@ tx_src_param(struct shader_translator *tx, const struct sm1_src_param *param)
     default:
         assert(!"invalid src D3DSPR");
     }
-    if (param->rel)
-        src = ureg_src_indirect(src, tx_src_param(tx, param->rel));
 
     switch (param->mod) {
     case NINED3DSPSM_DW: