summaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary/tgsi
diff options
context:
space:
mode:
authorNicolai Hähnle <[email protected]>2016-12-07 11:27:25 +0100
committerNicolai Hähnle <[email protected]>2016-12-12 09:03:51 +0100
commit04811354c87e40b0bd5e970fa413ea056ed94173 (patch)
treee0431dae2ec440456e85cbc2d1d3ce6d3fc3ce1d /src/gallium/auxiliary/tgsi
parent173d80b40159669b303ea19e8b6abd24d7fce39b (diff)
tgsi: add Stream{X,Y,Z,W} fields to tgsi_declaration_semantic
This is for geometry shader outputs. Without it, drivers have no way of knowing which stream each output is intended for, and have to conservatively write all outputs to all streams. Separate stream numbers for each component are required due to output packing. Reviewed-by: Marek Olšák <[email protected]>
Diffstat (limited to 'src/gallium/auxiliary/tgsi')
-rw-r--r--src/gallium/auxiliary/tgsi/tgsi_build.c18
-rw-r--r--src/gallium/auxiliary/tgsi/tgsi_dump.c13
-rw-r--r--src/gallium/auxiliary/tgsi/tgsi_text.c48
3 files changed, 77 insertions, 2 deletions
diff --git a/src/gallium/auxiliary/tgsi/tgsi_build.c b/src/gallium/auxiliary/tgsi/tgsi_build.c
index d525c8ff34e..773f8926cb2 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_build.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_build.c
@@ -239,7 +239,10 @@ tgsi_default_declaration_semantic( void )
ds.Name = TGSI_SEMANTIC_POSITION;
ds.Index = 0;
- ds.Padding = 0;
+ ds.StreamX = 0;
+ ds.StreamY = 0;
+ ds.StreamZ = 0;
+ ds.StreamW = 0;
return ds;
}
@@ -248,6 +251,10 @@ static struct tgsi_declaration_semantic
tgsi_build_declaration_semantic(
unsigned semantic_name,
unsigned semantic_index,
+ unsigned streamx,
+ unsigned streamy,
+ unsigned streamz,
+ unsigned streamw,
struct tgsi_declaration *declaration,
struct tgsi_header *header )
{
@@ -258,7 +265,10 @@ tgsi_build_declaration_semantic(
ds.Name = semantic_name;
ds.Index = semantic_index;
- ds.Padding = 0;
+ ds.StreamX = streamx;
+ ds.StreamY = streamy;
+ ds.StreamZ = streamz;
+ ds.StreamW = streamw;
declaration_grow( declaration, header );
@@ -461,6 +471,10 @@ tgsi_build_full_declaration(
*ds = tgsi_build_declaration_semantic(
full_decl->Semantic.Name,
full_decl->Semantic.Index,
+ full_decl->Semantic.StreamX,
+ full_decl->Semantic.StreamY,
+ full_decl->Semantic.StreamZ,
+ full_decl->Semantic.StreamW,
declaration,
header );
}
diff --git a/src/gallium/auxiliary/tgsi/tgsi_dump.c b/src/gallium/auxiliary/tgsi/tgsi_dump.c
index 614bcb2ef3c..f74aad167fa 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_dump.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_dump.c
@@ -360,6 +360,19 @@ iter_declaration(
UID( decl->Semantic.Index );
CHR( ']' );
}
+
+ if (decl->Semantic.StreamX != 0 || decl->Semantic.StreamY != 0 ||
+ decl->Semantic.StreamZ != 0 || decl->Semantic.StreamW != 0) {
+ TXT(", STREAM(");
+ UID(decl->Semantic.StreamX);
+ TXT(", ");
+ UID(decl->Semantic.StreamY);
+ TXT(", ");
+ UID(decl->Semantic.StreamZ);
+ TXT(", ");
+ UID(decl->Semantic.StreamW);
+ CHR(')');
+ }
}
if (decl->Declaration.File == TGSI_FILE_IMAGE) {
diff --git a/src/gallium/auxiliary/tgsi/tgsi_text.c b/src/gallium/auxiliary/tgsi/tgsi_text.c
index be808425199..1b4f5940460 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_text.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_text.c
@@ -1546,6 +1546,54 @@ static boolean parse_declaration( struct translate_ctx *ctx )
cur = ctx->cur;
eat_opt_white( &cur );
+ if (*cur == ',' &&
+ file == TGSI_FILE_OUTPUT && ctx->processor == PIPE_SHADER_GEOMETRY) {
+ cur++;
+ eat_opt_white(&cur);
+ if (str_match_nocase_whole(&cur, "STREAM")) {
+ uint stream[4];
+
+ eat_opt_white(&cur);
+ if (*cur != '(') {
+ report_error(ctx, "Expected '('");
+ return FALSE;
+ }
+ cur++;
+
+ for (int i = 0; i < 4; ++i) {
+ eat_opt_white(&cur);
+ if (!parse_uint(&cur, &stream[i])) {
+ report_error(ctx, "Expected literal integer");
+ return FALSE;
+ }
+
+ eat_opt_white(&cur);
+ if (i < 3) {
+ if (*cur != ',') {
+ report_error(ctx, "Expected ','");
+ return FALSE;
+ }
+ cur++;
+ }
+ }
+
+ if (*cur != ')') {
+ report_error(ctx, "Expected ')'");
+ return FALSE;
+ }
+ cur++;
+
+ decl.Semantic.StreamX = stream[0];
+ decl.Semantic.StreamY = stream[1];
+ decl.Semantic.StreamZ = stream[2];
+ decl.Semantic.StreamW = stream[3];
+
+ ctx->cur = cur;
+ }
+ }
+
+ cur = ctx->cur;
+ eat_opt_white( &cur );
if (*cur == ',' && !is_vs_input) {
uint i;