diff options
author | Nicolai Hähnle <nicolai.haehnle@amd.com> | 2016-10-12 17:24:37 +0200 |
---|---|---|
committer | Nicolai Hähnle <nicolai.haehnle@amd.com> | 2016-10-12 18:50:10 +0200 |
commit | 2b460c750a3cd4acbe05036e92e860800b6d5a96 (patch) | |
tree | 8a09382b58c80b4e94859c2f3b26efa27501f91b /src/gallium | |
parent | 047a7c7a0b419ac9e6deb4ff885a08c684495ce4 (diff) | |
download | external_mesa3d-2b460c750a3cd4acbe05036e92e860800b6d5a96.zip external_mesa3d-2b460c750a3cd4acbe05036e92e860800b6d5a96.tar.gz external_mesa3d-2b460c750a3cd4acbe05036e92e860800b6d5a96.tar.bz2 |
tgsi/ureg: add ureg_DECL_output_layout
For specifying an exact location/component.
v2: change the order of parameters (Dave)
Reviewed-by: Edward O'Callaghan <funfunctor@folklore1984.net> (v1)
Reviewed-by: Dave Airlie <airlied@redhat.com> (v1)
Diffstat (limited to 'src/gallium')
-rw-r--r-- | src/gallium/auxiliary/tgsi/tgsi_ureg.c | 42 | ||||
-rw-r--r-- | src/gallium/auxiliary/tgsi/tgsi_ureg.h | 9 |
2 files changed, 38 insertions, 13 deletions
diff --git a/src/gallium/auxiliary/tgsi/tgsi_ureg.c b/src/gallium/auxiliary/tgsi/tgsi_ureg.c index 348c371..ede648e 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_ureg.c +++ b/src/gallium/auxiliary/tgsi/tgsi_ureg.c @@ -405,9 +405,10 @@ out: } -struct ureg_dst -ureg_DECL_output_masked(struct ureg_program *ureg, - unsigned name, +struct ureg_dst +ureg_DECL_output_layout(struct ureg_program *ureg, + unsigned semantic_name, + unsigned semantic_index, unsigned index, unsigned usage_mask, unsigned array_id, @@ -418,22 +419,24 @@ ureg_DECL_output_masked(struct ureg_program *ureg, assert(usage_mask != 0); for (i = 0; i < ureg->nr_outputs; i++) { - if (ureg->output[i].semantic_name == name && - ureg->output[i].semantic_index == index) { - assert(ureg->output[i].array_id == array_id); - ureg->output[i].usage_mask |= usage_mask; - goto out; + if (ureg->output[i].semantic_name == semantic_name && + ureg->output[i].semantic_index == semantic_index) { + if (ureg->output[i].array_id == array_id) { + ureg->output[i].usage_mask |= usage_mask; + goto out; + } + assert((ureg->output[i].usage_mask & usage_mask) == 0); } } if (ureg->nr_outputs < UREG_MAX_OUTPUT) { - ureg->output[i].semantic_name = name; - ureg->output[i].semantic_index = index; + ureg->output[i].semantic_name = semantic_name; + ureg->output[i].semantic_index = semantic_index; ureg->output[i].usage_mask = usage_mask; - ureg->output[i].first = ureg->nr_output_regs; - ureg->output[i].last = ureg->nr_output_regs + array_size - 1; + ureg->output[i].first = index; + ureg->output[i].last = index + array_size - 1; ureg->output[i].array_id = array_id; - ureg->nr_output_regs += array_size; + ureg->nr_output_regs = MAX2(ureg->nr_output_regs, index + array_size); ureg->nr_outputs++; } else { @@ -446,6 +449,19 @@ out: } +struct ureg_dst +ureg_DECL_output_masked(struct ureg_program *ureg, + unsigned name, + unsigned index, + unsigned usage_mask, + unsigned array_id, + unsigned array_size) +{ + return ureg_DECL_output_layout(ureg, name, index, + ureg->nr_output_regs, usage_mask, array_id, array_size); +} + + struct ureg_dst ureg_DECL_output(struct ureg_program *ureg, unsigned name, diff --git a/src/gallium/auxiliary/tgsi/tgsi_ureg.h b/src/gallium/auxiliary/tgsi/tgsi_ureg.h index 0fa35bf..d3c28b3 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_ureg.h +++ b/src/gallium/auxiliary/tgsi/tgsi_ureg.h @@ -248,6 +248,15 @@ ureg_DECL_system_value(struct ureg_program *, unsigned semantic_index); struct ureg_dst +ureg_DECL_output_layout(struct ureg_program *, + unsigned semantic_name, + unsigned semantic_index, + unsigned index, + unsigned usage_mask, + unsigned array_id, + unsigned array_size); + +struct ureg_dst ureg_DECL_output_masked(struct ureg_program *, unsigned semantic_name, unsigned semantic_index, |