diff options
author | Nicolai Hähnle <[email protected]> | 2016-11-29 12:38:48 +0100 |
---|---|---|
committer | Nicolai Hähnle <[email protected]> | 2016-12-12 09:04:03 +0100 |
commit | 2eaacba7f28da49c2d248fa2df9feeca32f3480c (patch) | |
tree | c070ec1501ac5c1a5acd46c1adaac70b422354b8 /src/gallium/auxiliary | |
parent | cc34a6f0bd1e1c01ef8eb4f7be2bc8bde859ca1f (diff) |
st/glsl_to_tgsi: plumb the GS output stream qualifier through to TGSI
Allow drivers to emit GS outputs in a smarter way.
Reviewed-by: Marek Olšák <[email protected]>
Diffstat (limited to 'src/gallium/auxiliary')
-rw-r--r-- | src/gallium/auxiliary/tgsi/tgsi_ureg.c | 21 | ||||
-rw-r--r-- | src/gallium/auxiliary/tgsi/tgsi_ureg.h | 1 |
2 files changed, 21 insertions, 1 deletions
diff --git a/src/gallium/auxiliary/tgsi/tgsi_ureg.c b/src/gallium/auxiliary/tgsi/tgsi_ureg.c index 7bcd242975c..196a893b759 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_ureg.c +++ b/src/gallium/auxiliary/tgsi/tgsi_ureg.c @@ -127,6 +127,7 @@ struct ureg_program struct { unsigned semantic_name; unsigned semantic_index; + unsigned streams; unsigned usage_mask; /* = TGSI_WRITEMASK_* */ unsigned first; unsigned last; @@ -409,6 +410,7 @@ struct ureg_dst ureg_DECL_output_layout(struct ureg_program *ureg, unsigned semantic_name, unsigned semantic_index, + unsigned streams, unsigned index, unsigned usage_mask, unsigned array_id, @@ -417,6 +419,10 @@ ureg_DECL_output_layout(struct ureg_program *ureg, unsigned i; assert(usage_mask != 0); + assert(!(streams & 0x03) || (usage_mask & 1)); + assert(!(streams & 0x0c) || (usage_mask & 2)); + assert(!(streams & 0x30) || (usage_mask & 4)); + assert(!(streams & 0xc0) || (usage_mask & 8)); for (i = 0; i < ureg->nr_outputs; i++) { if (ureg->output[i].semantic_name == semantic_name && @@ -441,9 +447,12 @@ ureg_DECL_output_layout(struct ureg_program *ureg, } else { set_bad( ureg ); + i = 0; } out: + ureg->output[i].streams |= streams; + return ureg_dst_array_register(TGSI_FILE_OUTPUT, ureg->output[i].first, array_id); } @@ -457,7 +466,7 @@ ureg_DECL_output_masked(struct ureg_program *ureg, unsigned array_id, unsigned array_size) { - return ureg_DECL_output_layout(ureg, name, index, + return ureg_DECL_output_layout(ureg, name, index, 0, ureg->nr_output_regs, usage_mask, array_id, array_size); } @@ -1554,6 +1563,7 @@ emit_decl_semantic(struct ureg_program *ureg, unsigned last, unsigned semantic_name, unsigned semantic_index, + unsigned streams, unsigned usage_mask, unsigned array_id) { @@ -1574,6 +1584,10 @@ emit_decl_semantic(struct ureg_program *ureg, out[2].value = 0; out[2].decl_semantic.Name = semantic_name; out[2].decl_semantic.Index = semantic_index; + out[2].decl_semantic.StreamX = streams & 3; + out[2].decl_semantic.StreamY = (streams >> 2) & 3; + out[2].decl_semantic.StreamZ = (streams >> 4) & 3; + out[2].decl_semantic.StreamW = (streams >> 6) & 3; if (array_id) { out[3].value = 0; @@ -1878,6 +1892,7 @@ static void emit_decls( struct ureg_program *ureg ) ureg->input[i].last, ureg->input[i].semantic_name, ureg->input[i].semantic_index, + 0, TGSI_WRITEMASK_XYZW, ureg->input[i].array_id); } @@ -1891,6 +1906,7 @@ static void emit_decls( struct ureg_program *ureg ) ureg->input[i].semantic_name, ureg->input[i].semantic_index + (j - ureg->input[i].first), + 0, TGSI_WRITEMASK_XYZW, 0); } } @@ -1904,6 +1920,7 @@ static void emit_decls( struct ureg_program *ureg ) i, ureg->system_value[i].semantic_name, ureg->system_value[i].semantic_index, + 0, TGSI_WRITEMASK_XYZW, 0); } @@ -1915,6 +1932,7 @@ static void emit_decls( struct ureg_program *ureg ) ureg->output[i].last, ureg->output[i].semantic_name, ureg->output[i].semantic_index, + ureg->output[i].streams, ureg->output[i].usage_mask, ureg->output[i].array_id); } @@ -1928,6 +1946,7 @@ static void emit_decls( struct ureg_program *ureg ) ureg->output[i].semantic_name, ureg->output[i].semantic_index + (j - ureg->output[i].first), + ureg->output[i].streams, ureg->output[i].usage_mask, 0); } } diff --git a/src/gallium/auxiliary/tgsi/tgsi_ureg.h b/src/gallium/auxiliary/tgsi/tgsi_ureg.h index d3c28b33e84..51f69853b7e 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_ureg.h +++ b/src/gallium/auxiliary/tgsi/tgsi_ureg.h @@ -251,6 +251,7 @@ struct ureg_dst ureg_DECL_output_layout(struct ureg_program *, unsigned semantic_name, unsigned semantic_index, + unsigned streams, unsigned index, unsigned usage_mask, unsigned array_id, |