summaryrefslogtreecommitdiffstats
path: root/src/gallium/state_trackers
diff options
context:
space:
mode:
authorAxel Davy <axel.davy@ens.fr>2016-06-12 22:20:21 +0200
committerAxel Davy <axel.davy@ens.fr>2016-10-10 23:43:49 +0200
commit03f60a335767957dca451ff013a170557e0244b6 (patch)
tree23cd0ca7a913e66c0af5e48dc824634d06c4b4d7 /src/gallium/state_trackers
parenta5d308e51a7be7e90d1373fa8ec7813ae8018ae5 (diff)
downloadexternal_mesa3d-03f60a335767957dca451ff013a170557e0244b6.zip
external_mesa3d-03f60a335767957dca451ff013a170557e0244b6.tar.gz
external_mesa3d-03f60a335767957dca451ff013a170557e0244b6.tar.bz2
st/nine: Implement relative addressing for ps inputs
To implement the feature we copy the ps inputs to a temp array. This is not optimal for performance, but it is the simplest solution. This is a feature that is very very rarely used. Signed-off-by: Axel Davy <axel.davy@ens.fr>
Diffstat (limited to 'src/gallium/state_trackers')
-rw-r--r--src/gallium/state_trackers/nine/nine_shader.c30
1 files changed, 27 insertions, 3 deletions
diff --git a/src/gallium/state_trackers/nine/nine_shader.c b/src/gallium/state_trackers/nine/nine_shader.c
index 4c58a6d..140226e 100644
--- a/src/gallium/state_trackers/nine/nine_shader.c
+++ b/src/gallium/state_trackers/nine/nine_shader.c
@@ -477,6 +477,7 @@ struct shader_translator
struct ureg_dst o[PIPE_MAX_SHADER_OUTPUTS];
struct ureg_dst oDepth;
struct ureg_src v[PIPE_MAX_SHADER_INPUTS];
+ struct ureg_src v_consecutive; /* copy in temp array of ps inputs for rel addressing */
struct ureg_src vPos;
struct ureg_src vFace;
struct ureg_src s;
@@ -894,9 +895,32 @@ tx_src_param(struct shader_translator *tx, const struct sm1_src_param *param)
TGSI_INTERPOLATE_LOC_CENTROID : 0,
0, 1);
} else {
- assert(!param->rel); /* TODO */
- assert(param->idx < ARRAY_SIZE(tx->regs.v));
- src = tx->regs.v[param->idx];
+ if(param->rel) {
+ /* Copy all inputs (non consecutive)
+ * to temp array (consecutive).
+ * This is not good for performance.
+ * A better way would be to have inputs
+ * consecutive (would need implement alternative
+ * way to match vs outputs and ps inputs).
+ * However even with the better way, the temp array
+ * copy would need to be used if some inputs
+ * are not GENERIC or if they have different
+ * interpolation flag. */
+ if (ureg_src_is_undef(tx->regs.v_consecutive)) {
+ int i;
+ tx->regs.v_consecutive = ureg_src(ureg_DECL_array_temporary(ureg, 10, 0));
+ for (i = 0; i < 10; i++) {
+ if (!ureg_src_is_undef(tx->regs.v[i]))
+ ureg_MOV(ureg, ureg_dst_array_offset(ureg_dst(tx->regs.v_consecutive), i), tx->regs.v[i]);
+ else
+ ureg_MOV(ureg, ureg_dst_array_offset(ureg_dst(tx->regs.v_consecutive), i), ureg_imm4f(ureg, 0.0f, 0.0f, 0.0f, 1.0f));
+ }
+ }
+ src = ureg_src_array_offset(tx->regs.v_consecutive, param->idx);
+ } else {
+ assert(param->idx < ARRAY_SIZE(tx->regs.v));
+ src = tx->regs.v[param->idx];
+ }
}
}
break;