Re: [Mesa-dev] [PATCH] Plumb invariant output attrib thru TGSI
On 29 June 2018 at 11:03, Robert Tarasov wrote: > ping for push. it's not pushed yet. Oops I thought I'd done it. will push it now. Dave. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] Plumb invariant output attrib thru TGSI
ping for push. it's not pushed yet. On Wed, Jun 20, 2018 at 5:55 PM, Robert Tarasov wrote: > From: "Joe M. Kniss" > > Add support for glsl 'invariant' modifier for output data declarations. > Gallium drivers that use TGSI serialization currently loose invariant > modifiers in glsl shaders. > > v2: use boolean for invariant instead of unsigned. > > Change-Id: Ieac8639116def45233513b6867a847cf7fda2f55 > Tested: chromiumos on qemu with virglrenderer. > --- > src/gallium/auxiliary/tgsi/tgsi_strings.c | 2 ++ > src/gallium/auxiliary/tgsi/tgsi_strings.h | 2 ++ > src/gallium/auxiliary/tgsi/tgsi_text.c | 18 ++ > src/gallium/auxiliary/tgsi/tgsi_ureg.c | 28 +++--- > src/gallium/auxiliary/tgsi/tgsi_ureg.h | 4 +++- > src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 8 +-- > 6 files changed, 46 insertions(+), 16 deletions(-) > > diff --git a/src/gallium/auxiliary/tgsi/tgsi_strings.c > b/src/gallium/auxiliary/tgsi/tgsi_strings.c > index 4f28b49ce8a..434871273f2 100644 > --- a/src/gallium/auxiliary/tgsi/tgsi_strings.c > +++ b/src/gallium/auxiliary/tgsi/tgsi_strings.c > @@ -185,6 +185,8 @@ const char > *tgsi_interpolate_locations[TGSI_INTERPOLATE_LOC_COUNT] > = > "SAMPLE", > }; > > +const char *tgsi_invariant_name = "INVARIANT"; > + > const char *tgsi_primitive_names[PIPE_PRIM_MAX] = > { > "POINTS", > diff --git a/src/gallium/auxiliary/tgsi/tgsi_strings.h > b/src/gallium/auxiliary/tgsi/tgsi_strings.h > index bb2d3458dde..20e3f7127f6 100644 > --- a/src/gallium/auxiliary/tgsi/tgsi_strings.h > +++ b/src/gallium/auxiliary/tgsi/tgsi_strings.h > @@ -52,6 +52,8 @@ extern const char *tgsi_interpolate_names[TGSI_ > INTERPOLATE_COUNT]; > > extern const char *tgsi_interpolate_locations[ > TGSI_INTERPOLATE_LOC_COUNT]; > > +extern const char *tgsi_invariant_name; > + > extern const char *tgsi_primitive_names[PIPE_PRIM_MAX]; > > extern const char *tgsi_fs_coord_origin_names[2]; > diff --git a/src/gallium/auxiliary/tgsi/tgsi_text.c > b/src/gallium/auxiliary/tgsi/tgsi_text.c > index 02241a66bfe..815b1ee65db 100644 > --- a/src/gallium/auxiliary/tgsi/tgsi_text.c > +++ b/src/gallium/auxiliary/tgsi/tgsi_text.c > @@ -1586,10 +1586,6 @@ static boolean parse_declaration( struct > translate_ctx *ctx ) > break; > } >} > - if (i == TGSI_INTERPOLATE_COUNT) { > - report_error( ctx, "Expected semantic or interpolate attribute" > ); > - return FALSE; > - } > } > > cur = ctx->cur; > @@ -1609,6 +1605,20 @@ static boolean parse_declaration( struct > translate_ctx *ctx ) >} > } > > + cur = ctx->cur; > + eat_opt_white( &cur ); > + if (*cur == ',' && !is_vs_input) { > + cur++; > + eat_opt_white( &cur ); > + if (str_match_nocase_whole( &cur, tgsi_invariant_name )) { > + decl.Declaration.Invariant = 1; > + ctx->cur = cur; > + } else { > + report_error( ctx, "Expected semantic, interpolate attribute, or > invariant "); > + return FALSE; > + } > + } > + > advance = tgsi_build_full_declaration( >&decl, >ctx->tokens_cur, > diff --git a/src/gallium/auxiliary/tgsi/tgsi_ureg.c > b/src/gallium/auxiliary/tgsi/tgsi_ureg.c > index 7d2b9af140d..f1bebe1e155 100644 > --- a/src/gallium/auxiliary/tgsi/tgsi_ureg.c > +++ b/src/gallium/auxiliary/tgsi/tgsi_ureg.c > @@ -140,6 +140,7 @@ struct ureg_program >unsigned first; >unsigned last; >unsigned array_id; > + boolean invariant; > } output[UREG_MAX_OUTPUT]; > unsigned nr_outputs, nr_output_regs; > > @@ -427,7 +428,8 @@ ureg_DECL_output_layout(struct ureg_program *ureg, > unsigned index, > unsigned usage_mask, > unsigned array_id, > -unsigned array_size) > +unsigned array_size, > +boolean invariant) > { > unsigned i; > > @@ -455,6 +457,7 @@ ureg_DECL_output_layout(struct ureg_program *ureg, >ureg->output[i].first = index; >ureg->output[i].last = index + array_size - 1; >ureg->output[i].array_id = array_id; > + ureg->output[i].invariant = invariant; >ureg->nr_output_regs = MAX2(ureg->nr_output_regs, index + > array_size); >ureg->nr_outputs++; > } > @@ -480,7 +483,8 @@ ureg_DECL_output_masked(struct ureg_program *ureg, > unsigned array_size) > { > return ureg_DECL_output_layout(ureg, name, index, 0, > - ureg->nr_output_regs, usage_mask, > array_id, array_size); > + ureg->nr_output_regs, usage_mask, > array_id, > + array_size, FALSE); > } > > > @@ -1512,7 +1516,8 @@ emit_decl_semantic(struct ureg_program *ureg, > unsigned semantic_index, > unsigned streams, > unsigned usage_mask, > -
Re: [Mesa-dev] [PATCH] Plumb invariant output attrib thru TGSI
ping... On Wed, Jun 20, 2018 at 5:55 PM, Robert Tarasov wrote: > From: "Joe M. Kniss" > > Add support for glsl 'invariant' modifier for output data declarations. > Gallium drivers that use TGSI serialization currently loose invariant > modifiers in glsl shaders. > > v2: use boolean for invariant instead of unsigned. > > Change-Id: Ieac8639116def45233513b6867a847cf7fda2f55 > Tested: chromiumos on qemu with virglrenderer. > --- > src/gallium/auxiliary/tgsi/tgsi_strings.c | 2 ++ > src/gallium/auxiliary/tgsi/tgsi_strings.h | 2 ++ > src/gallium/auxiliary/tgsi/tgsi_text.c | 18 ++ > src/gallium/auxiliary/tgsi/tgsi_ureg.c | 28 +++--- > src/gallium/auxiliary/tgsi/tgsi_ureg.h | 4 +++- > src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 8 +-- > 6 files changed, 46 insertions(+), 16 deletions(-) > > diff --git a/src/gallium/auxiliary/tgsi/tgsi_strings.c > b/src/gallium/auxiliary/tgsi/tgsi_strings.c > index 4f28b49ce8a..434871273f2 100644 > --- a/src/gallium/auxiliary/tgsi/tgsi_strings.c > +++ b/src/gallium/auxiliary/tgsi/tgsi_strings.c > @@ -185,6 +185,8 @@ const char > *tgsi_interpolate_locations[TGSI_INTERPOLATE_LOC_COUNT] > = > "SAMPLE", > }; > > +const char *tgsi_invariant_name = "INVARIANT"; > + > const char *tgsi_primitive_names[PIPE_PRIM_MAX] = > { > "POINTS", > diff --git a/src/gallium/auxiliary/tgsi/tgsi_strings.h > b/src/gallium/auxiliary/tgsi/tgsi_strings.h > index bb2d3458dde..20e3f7127f6 100644 > --- a/src/gallium/auxiliary/tgsi/tgsi_strings.h > +++ b/src/gallium/auxiliary/tgsi/tgsi_strings.h > @@ -52,6 +52,8 @@ extern const char *tgsi_interpolate_names[TGSI_ > INTERPOLATE_COUNT]; > > extern const char *tgsi_interpolate_locations[ > TGSI_INTERPOLATE_LOC_COUNT]; > > +extern const char *tgsi_invariant_name; > + > extern const char *tgsi_primitive_names[PIPE_PRIM_MAX]; > > extern const char *tgsi_fs_coord_origin_names[2]; > diff --git a/src/gallium/auxiliary/tgsi/tgsi_text.c > b/src/gallium/auxiliary/tgsi/tgsi_text.c > index 02241a66bfe..815b1ee65db 100644 > --- a/src/gallium/auxiliary/tgsi/tgsi_text.c > +++ b/src/gallium/auxiliary/tgsi/tgsi_text.c > @@ -1586,10 +1586,6 @@ static boolean parse_declaration( struct > translate_ctx *ctx ) > break; > } >} > - if (i == TGSI_INTERPOLATE_COUNT) { > - report_error( ctx, "Expected semantic or interpolate attribute" > ); > - return FALSE; > - } > } > > cur = ctx->cur; > @@ -1609,6 +1605,20 @@ static boolean parse_declaration( struct > translate_ctx *ctx ) >} > } > > + cur = ctx->cur; > + eat_opt_white( &cur ); > + if (*cur == ',' && !is_vs_input) { > + cur++; > + eat_opt_white( &cur ); > + if (str_match_nocase_whole( &cur, tgsi_invariant_name )) { > + decl.Declaration.Invariant = 1; > + ctx->cur = cur; > + } else { > + report_error( ctx, "Expected semantic, interpolate attribute, or > invariant "); > + return FALSE; > + } > + } > + > advance = tgsi_build_full_declaration( >&decl, >ctx->tokens_cur, > diff --git a/src/gallium/auxiliary/tgsi/tgsi_ureg.c > b/src/gallium/auxiliary/tgsi/tgsi_ureg.c > index 7d2b9af140d..f1bebe1e155 100644 > --- a/src/gallium/auxiliary/tgsi/tgsi_ureg.c > +++ b/src/gallium/auxiliary/tgsi/tgsi_ureg.c > @@ -140,6 +140,7 @@ struct ureg_program >unsigned first; >unsigned last; >unsigned array_id; > + boolean invariant; > } output[UREG_MAX_OUTPUT]; > unsigned nr_outputs, nr_output_regs; > > @@ -427,7 +428,8 @@ ureg_DECL_output_layout(struct ureg_program *ureg, > unsigned index, > unsigned usage_mask, > unsigned array_id, > -unsigned array_size) > +unsigned array_size, > +boolean invariant) > { > unsigned i; > > @@ -455,6 +457,7 @@ ureg_DECL_output_layout(struct ureg_program *ureg, >ureg->output[i].first = index; >ureg->output[i].last = index + array_size - 1; >ureg->output[i].array_id = array_id; > + ureg->output[i].invariant = invariant; >ureg->nr_output_regs = MAX2(ureg->nr_output_regs, index + > array_size); >ureg->nr_outputs++; > } > @@ -480,7 +483,8 @@ ureg_DECL_output_masked(struct ureg_program *ureg, > unsigned array_size) > { > return ureg_DECL_output_layout(ureg, name, index, 0, > - ureg->nr_output_regs, usage_mask, > array_id, array_size); > + ureg->nr_output_regs, usage_mask, > array_id, > + array_size, FALSE); > } > > > @@ -1512,7 +1516,8 @@ emit_decl_semantic(struct ureg_program *ureg, > unsigned semantic_index, > unsigned streams, > unsigned usage_mask, > - unsigned ar
Re: [Mesa-dev] [PATCH] Plumb invariant output attrib thru TGSI
Reviewed-by: Marek Olšák Marek On Wed, Jun 20, 2018 at 8:55 PM, Robert Tarasov wrote: > From: "Joe M. Kniss" > > Add support for glsl 'invariant' modifier for output data declarations. > Gallium drivers that use TGSI serialization currently loose invariant > modifiers in glsl shaders. > > v2: use boolean for invariant instead of unsigned. > > Change-Id: Ieac8639116def45233513b6867a847cf7fda2f55 > Tested: chromiumos on qemu with virglrenderer. > --- > src/gallium/auxiliary/tgsi/tgsi_strings.c | 2 ++ > src/gallium/auxiliary/tgsi/tgsi_strings.h | 2 ++ > src/gallium/auxiliary/tgsi/tgsi_text.c | 18 ++ > src/gallium/auxiliary/tgsi/tgsi_ureg.c | 28 +++--- > src/gallium/auxiliary/tgsi/tgsi_ureg.h | 4 +++- > src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 8 +-- > 6 files changed, 46 insertions(+), 16 deletions(-) > > diff --git a/src/gallium/auxiliary/tgsi/tgsi_strings.c > b/src/gallium/auxiliary/tgsi/tgsi_strings.c > index 4f28b49ce8a..434871273f2 100644 > --- a/src/gallium/auxiliary/tgsi/tgsi_strings.c > +++ b/src/gallium/auxiliary/tgsi/tgsi_strings.c > @@ -185,6 +185,8 @@ const char > *tgsi_interpolate_locations[TGSI_INTERPOLATE_LOC_COUNT] = > "SAMPLE", > }; > > +const char *tgsi_invariant_name = "INVARIANT"; > + > const char *tgsi_primitive_names[PIPE_PRIM_MAX] = > { > "POINTS", > diff --git a/src/gallium/auxiliary/tgsi/tgsi_strings.h > b/src/gallium/auxiliary/tgsi/tgsi_strings.h > index bb2d3458dde..20e3f7127f6 100644 > --- a/src/gallium/auxiliary/tgsi/tgsi_strings.h > +++ b/src/gallium/auxiliary/tgsi/tgsi_strings.h > @@ -52,6 +52,8 @@ extern const char > *tgsi_interpolate_names[TGSI_INTERPOLATE_COUNT]; > > extern const char *tgsi_interpolate_locations[TGSI_INTERPOLATE_LOC_COUNT]; > > +extern const char *tgsi_invariant_name; > + > extern const char *tgsi_primitive_names[PIPE_PRIM_MAX]; > > extern const char *tgsi_fs_coord_origin_names[2]; > diff --git a/src/gallium/auxiliary/tgsi/tgsi_text.c > b/src/gallium/auxiliary/tgsi/tgsi_text.c > index 02241a66bfe..815b1ee65db 100644 > --- a/src/gallium/auxiliary/tgsi/tgsi_text.c > +++ b/src/gallium/auxiliary/tgsi/tgsi_text.c > @@ -1586,10 +1586,6 @@ static boolean parse_declaration( struct translate_ctx > *ctx ) > break; > } >} > - if (i == TGSI_INTERPOLATE_COUNT) { > - report_error( ctx, "Expected semantic or interpolate attribute" ); > - return FALSE; > - } > } > > cur = ctx->cur; > @@ -1609,6 +1605,20 @@ static boolean parse_declaration( struct translate_ctx > *ctx ) >} > } > > + cur = ctx->cur; > + eat_opt_white( &cur ); > + if (*cur == ',' && !is_vs_input) { > + cur++; > + eat_opt_white( &cur ); > + if (str_match_nocase_whole( &cur, tgsi_invariant_name )) { > + decl.Declaration.Invariant = 1; > + ctx->cur = cur; > + } else { > + report_error( ctx, "Expected semantic, interpolate attribute, or > invariant "); > + return FALSE; > + } > + } > + > advance = tgsi_build_full_declaration( >&decl, >ctx->tokens_cur, > diff --git a/src/gallium/auxiliary/tgsi/tgsi_ureg.c > b/src/gallium/auxiliary/tgsi/tgsi_ureg.c > index 7d2b9af140d..f1bebe1e155 100644 > --- a/src/gallium/auxiliary/tgsi/tgsi_ureg.c > +++ b/src/gallium/auxiliary/tgsi/tgsi_ureg.c > @@ -140,6 +140,7 @@ struct ureg_program >unsigned first; >unsigned last; >unsigned array_id; > + boolean invariant; > } output[UREG_MAX_OUTPUT]; > unsigned nr_outputs, nr_output_regs; > > @@ -427,7 +428,8 @@ ureg_DECL_output_layout(struct ureg_program *ureg, > unsigned index, > unsigned usage_mask, > unsigned array_id, > -unsigned array_size) > +unsigned array_size, > +boolean invariant) > { > unsigned i; > > @@ -455,6 +457,7 @@ ureg_DECL_output_layout(struct ureg_program *ureg, >ureg->output[i].first = index; >ureg->output[i].last = index + array_size - 1; >ureg->output[i].array_id = array_id; > + ureg->output[i].invariant = invariant; >ureg->nr_output_regs = MAX2(ureg->nr_output_regs, index + array_size); >ureg->nr_outputs++; > } > @@ -480,7 +483,8 @@ ureg_DECL_output_masked(struct ureg_program *ureg, > unsigned array_size) > { > return ureg_DECL_output_layout(ureg, name, index, 0, > - ureg->nr_output_regs, usage_mask, > array_id, array_size); > + ureg->nr_output_regs, usage_mask, array_id, > + array_size, FALSE); > } > > > @@ -1512,7 +1516,8 @@ emit_decl_semantic(struct ureg_program *ureg, > unsigned semantic_index, > unsigned streams, > unsigned usage_mask, > -
[Mesa-dev] [PATCH] Plumb invariant output attrib thru TGSI
From: "Joe M. Kniss" Add support for glsl 'invariant' modifier for output data declarations. Gallium drivers that use TGSI serialization currently loose invariant modifiers in glsl shaders. v2: use boolean for invariant instead of unsigned. Change-Id: Ieac8639116def45233513b6867a847cf7fda2f55 Tested: chromiumos on qemu with virglrenderer. --- src/gallium/auxiliary/tgsi/tgsi_strings.c | 2 ++ src/gallium/auxiliary/tgsi/tgsi_strings.h | 2 ++ src/gallium/auxiliary/tgsi/tgsi_text.c | 18 ++ src/gallium/auxiliary/tgsi/tgsi_ureg.c | 28 +++--- src/gallium/auxiliary/tgsi/tgsi_ureg.h | 4 +++- src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 8 +-- 6 files changed, 46 insertions(+), 16 deletions(-) diff --git a/src/gallium/auxiliary/tgsi/tgsi_strings.c b/src/gallium/auxiliary/tgsi/tgsi_strings.c index 4f28b49ce8a..434871273f2 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_strings.c +++ b/src/gallium/auxiliary/tgsi/tgsi_strings.c @@ -185,6 +185,8 @@ const char *tgsi_interpolate_locations[TGSI_INTERPOLATE_LOC_COUNT] = "SAMPLE", }; +const char *tgsi_invariant_name = "INVARIANT"; + const char *tgsi_primitive_names[PIPE_PRIM_MAX] = { "POINTS", diff --git a/src/gallium/auxiliary/tgsi/tgsi_strings.h b/src/gallium/auxiliary/tgsi/tgsi_strings.h index bb2d3458dde..20e3f7127f6 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_strings.h +++ b/src/gallium/auxiliary/tgsi/tgsi_strings.h @@ -52,6 +52,8 @@ extern const char *tgsi_interpolate_names[TGSI_INTERPOLATE_COUNT]; extern const char *tgsi_interpolate_locations[TGSI_INTERPOLATE_LOC_COUNT]; +extern const char *tgsi_invariant_name; + extern const char *tgsi_primitive_names[PIPE_PRIM_MAX]; extern const char *tgsi_fs_coord_origin_names[2]; diff --git a/src/gallium/auxiliary/tgsi/tgsi_text.c b/src/gallium/auxiliary/tgsi/tgsi_text.c index 02241a66bfe..815b1ee65db 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_text.c +++ b/src/gallium/auxiliary/tgsi/tgsi_text.c @@ -1586,10 +1586,6 @@ static boolean parse_declaration( struct translate_ctx *ctx ) break; } } - if (i == TGSI_INTERPOLATE_COUNT) { - report_error( ctx, "Expected semantic or interpolate attribute" ); - return FALSE; - } } cur = ctx->cur; @@ -1609,6 +1605,20 @@ static boolean parse_declaration( struct translate_ctx *ctx ) } } + cur = ctx->cur; + eat_opt_white( &cur ); + if (*cur == ',' && !is_vs_input) { + cur++; + eat_opt_white( &cur ); + if (str_match_nocase_whole( &cur, tgsi_invariant_name )) { + decl.Declaration.Invariant = 1; + ctx->cur = cur; + } else { + report_error( ctx, "Expected semantic, interpolate attribute, or invariant "); + return FALSE; + } + } + advance = tgsi_build_full_declaration( &decl, ctx->tokens_cur, diff --git a/src/gallium/auxiliary/tgsi/tgsi_ureg.c b/src/gallium/auxiliary/tgsi/tgsi_ureg.c index 7d2b9af140d..f1bebe1e155 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_ureg.c +++ b/src/gallium/auxiliary/tgsi/tgsi_ureg.c @@ -140,6 +140,7 @@ struct ureg_program unsigned first; unsigned last; unsigned array_id; + boolean invariant; } output[UREG_MAX_OUTPUT]; unsigned nr_outputs, nr_output_regs; @@ -427,7 +428,8 @@ ureg_DECL_output_layout(struct ureg_program *ureg, unsigned index, unsigned usage_mask, unsigned array_id, -unsigned array_size) +unsigned array_size, +boolean invariant) { unsigned i; @@ -455,6 +457,7 @@ ureg_DECL_output_layout(struct ureg_program *ureg, ureg->output[i].first = index; ureg->output[i].last = index + array_size - 1; ureg->output[i].array_id = array_id; + ureg->output[i].invariant = invariant; ureg->nr_output_regs = MAX2(ureg->nr_output_regs, index + array_size); ureg->nr_outputs++; } @@ -480,7 +483,8 @@ ureg_DECL_output_masked(struct ureg_program *ureg, unsigned array_size) { return ureg_DECL_output_layout(ureg, name, index, 0, - ureg->nr_output_regs, usage_mask, array_id, array_size); + ureg->nr_output_regs, usage_mask, array_id, + array_size, FALSE); } @@ -1512,7 +1516,8 @@ emit_decl_semantic(struct ureg_program *ureg, unsigned semantic_index, unsigned streams, unsigned usage_mask, - unsigned array_id) + unsigned array_id, + boolean invariant) { union tgsi_any_token *out = get_tokens(ureg, DOMAIN_DECL, array_id ? 4 : 3); @@ -1523,7 +1528,8 @@ emit_decl_semantic(struct ureg_program *ureg, out[0].decl.UsageMask = usage_mask; out[0].decl.Semantic = 1;
Re: [Mesa-dev] [PATCH] Plumb invariant output attrib thru TGSI
On Mon, Jun 18, 2018 at 1:06 PM Elie Tournier wrote: > > On Mon, Jun 18, 2018 at 12:06:42PM +0100, Jakob Bornecrantz wrote: > > TGSI already has a invariant field on declarations, we are running > > into a bug with virgl because st_glsl_to_tgsi completely drops the > > invariant flag on the floor when it comes to declarations (tho precise > > is added to the ops). But virgl can't express precise ops (only > > invariant and precise declarations) only declarations. > > > > Going to do some testing on this patch soon. > > > > Cheers, Jakob. > Supposing that it doesn't brake any gallium driver. > Maybe Marek can confirm. I only test on qemu with virgl. > > Reviewed-by: Elie Tournier Did a run with this patch using r600 on the host and virgl in the guest, ran the Android GLES[2-3] CTS in the host and the guest, saw no regressions so patch is Tested-by: Jakob Bornecrantz As Elie said we might want to get somebody else to look at this as this will no plumb down invariant where it in the past did not. Cheers, Jakob. > > > > > On Tue, Apr 10, 2018 at 7:02 PM Marek Olšák wrote: > > > > > > This doesn't change TGSI. It only changes utilities around it. > > > > > > Marek > > > > > > On Mon, Apr 9, 2018 at 6:02 PM, Joe M. Kniss wrote: > > >> > > >> Add support for glsl 'invariant' modifier for output data declarations. > > >> Gallium drivers that use TGSI serialization currently loose invariant > > >> modifiers in glsl shaders. > > >> > > >> Tested: chromiumos on qemu with virglrenderer. > > >> Signed-off-by: Joe M. Kniss > > >> --- > > >> src/gallium/auxiliary/tgsi/tgsi_strings.c | 2 ++ > > >> src/gallium/auxiliary/tgsi/tgsi_strings.h | 2 ++ > > >> src/gallium/auxiliary/tgsi/tgsi_text.c | 18 +++ > > >> src/gallium/auxiliary/tgsi/tgsi_ureg.c | 27 ++ > > >> src/gallium/auxiliary/tgsi/tgsi_ureg.h | 4 +++- > > >> src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 8 +-- > > >> 6 files changed, 45 insertions(+), 16 deletions(-) > > >> > > >> diff --git a/src/gallium/auxiliary/tgsi/tgsi_strings.c > > >> b/src/gallium/auxiliary/tgsi/tgsi_strings.c > > >> index 4f28b49ce8..434871273f 100644 > > >> --- a/src/gallium/auxiliary/tgsi/tgsi_strings.c > > >> +++ b/src/gallium/auxiliary/tgsi/tgsi_strings.c > > >> @@ -185,6 +185,8 @@ const char > > >> *tgsi_interpolate_locations[TGSI_INTERPOLATE_LOC_COUNT] = > > >> "SAMPLE", > > >> }; > > >> > > >> +const char *tgsi_invariant_name = "INVARIANT"; > > >> + > > >> const char *tgsi_primitive_names[PIPE_PRIM_MAX] = > > >> { > > >> "POINTS", > > >> diff --git a/src/gallium/auxiliary/tgsi/tgsi_strings.h > > >> b/src/gallium/auxiliary/tgsi/tgsi_strings.h > > >> index bb2d3458dd..20e3f7127f 100644 > > >> --- a/src/gallium/auxiliary/tgsi/tgsi_strings.h > > >> +++ b/src/gallium/auxiliary/tgsi/tgsi_strings.h > > >> @@ -52,6 +52,8 @@ extern const char > > >> *tgsi_interpolate_names[TGSI_INTERPOLATE_COUNT]; > > >> > > >> extern const char > > >> *tgsi_interpolate_locations[TGSI_INTERPOLATE_LOC_COUNT]; > > >> > > >> +extern const char *tgsi_invariant_name; > > >> + > > >> extern const char *tgsi_primitive_names[PIPE_PRIM_MAX]; > > >> > > >> extern const char *tgsi_fs_coord_origin_names[2]; > > >> diff --git a/src/gallium/auxiliary/tgsi/tgsi_text.c > > >> b/src/gallium/auxiliary/tgsi/tgsi_text.c > > >> index 02241a66bf..815b1ee65d 100644 > > >> --- a/src/gallium/auxiliary/tgsi/tgsi_text.c > > >> +++ b/src/gallium/auxiliary/tgsi/tgsi_text.c > > >> @@ -1586,10 +1586,6 @@ static boolean parse_declaration( struct > > >> translate_ctx *ctx ) > > >> break; > > >> } > > >>} > > >> - if (i == TGSI_INTERPOLATE_COUNT) { > > >> - report_error( ctx, "Expected semantic or interpolate > > >> attribute" ); > > >> - return FALSE; > > >> - } > > >> } > > >> > > >> cur = ctx->cur; > > >> @@ -1609,6 +1605,20 @@ static boolean parse_declaration( struct > > >> translate_ctx *ctx ) > > >>} > > >> } > > >> > > >> + cur = ctx->cur; > > >> + eat_opt_white( &cur ); > > >> + if (*cur == ',' && !is_vs_input) { > > >> + cur++; > > >> + eat_opt_white( &cur ); > > >> + if (str_match_nocase_whole( &cur, tgsi_invariant_name )) { > > >> + decl.Declaration.Invariant = 1; > > >> + ctx->cur = cur; > > >> + } else { > > >> + report_error( ctx, "Expected semantic, interpolate attribute, > > >> or invariant "); > > >> + return FALSE; > > >> + } > > >> + } > > >> + > > >> advance = tgsi_build_full_declaration( > > >>&decl, > > >>ctx->tokens_cur, > > >> diff --git a/src/gallium/auxiliary/tgsi/tgsi_ureg.c > > >> b/src/gallium/auxiliary/tgsi/tgsi_ureg.c > > >> index 393e015001..f54e2229a7 100644 > > >> --- a/src/gallium/auxiliary/tgsi/tgsi_ureg.c > > >> +++ b/src/gallium/auxiliary/tgsi/tgsi_ureg.c > > >> @@ -140,6 +140,7 @@ struct ureg_program > > >>unsigned first; > > >>unsigned l
Re: [Mesa-dev] [PATCH] Plumb invariant output attrib thru TGSI
On Mon, Jun 18, 2018 at 12:06:42PM +0100, Jakob Bornecrantz wrote: > TGSI already has a invariant field on declarations, we are running > into a bug with virgl because st_glsl_to_tgsi completely drops the > invariant flag on the floor when it comes to declarations (tho precise > is added to the ops). But virgl can't express precise ops (only > invariant and precise declarations) only declarations. > > Going to do some testing on this patch soon. > > Cheers, Jakob. Supposing that it doesn't brake any gallium driver. Maybe Marek can confirm. I only test on qemu with virgl. Reviewed-by: Elie Tournier > > On Tue, Apr 10, 2018 at 7:02 PM Marek Olšák wrote: > > > > This doesn't change TGSI. It only changes utilities around it. > > > > Marek > > > > On Mon, Apr 9, 2018 at 6:02 PM, Joe M. Kniss wrote: > >> > >> Add support for glsl 'invariant' modifier for output data declarations. > >> Gallium drivers that use TGSI serialization currently loose invariant > >> modifiers in glsl shaders. > >> > >> Tested: chromiumos on qemu with virglrenderer. > >> Signed-off-by: Joe M. Kniss > >> --- > >> src/gallium/auxiliary/tgsi/tgsi_strings.c | 2 ++ > >> src/gallium/auxiliary/tgsi/tgsi_strings.h | 2 ++ > >> src/gallium/auxiliary/tgsi/tgsi_text.c | 18 +++ > >> src/gallium/auxiliary/tgsi/tgsi_ureg.c | 27 ++ > >> src/gallium/auxiliary/tgsi/tgsi_ureg.h | 4 +++- > >> src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 8 +-- > >> 6 files changed, 45 insertions(+), 16 deletions(-) > >> > >> diff --git a/src/gallium/auxiliary/tgsi/tgsi_strings.c > >> b/src/gallium/auxiliary/tgsi/tgsi_strings.c > >> index 4f28b49ce8..434871273f 100644 > >> --- a/src/gallium/auxiliary/tgsi/tgsi_strings.c > >> +++ b/src/gallium/auxiliary/tgsi/tgsi_strings.c > >> @@ -185,6 +185,8 @@ const char > >> *tgsi_interpolate_locations[TGSI_INTERPOLATE_LOC_COUNT] = > >> "SAMPLE", > >> }; > >> > >> +const char *tgsi_invariant_name = "INVARIANT"; > >> + > >> const char *tgsi_primitive_names[PIPE_PRIM_MAX] = > >> { > >> "POINTS", > >> diff --git a/src/gallium/auxiliary/tgsi/tgsi_strings.h > >> b/src/gallium/auxiliary/tgsi/tgsi_strings.h > >> index bb2d3458dd..20e3f7127f 100644 > >> --- a/src/gallium/auxiliary/tgsi/tgsi_strings.h > >> +++ b/src/gallium/auxiliary/tgsi/tgsi_strings.h > >> @@ -52,6 +52,8 @@ extern const char > >> *tgsi_interpolate_names[TGSI_INTERPOLATE_COUNT]; > >> > >> extern const char *tgsi_interpolate_locations[TGSI_INTERPOLATE_LOC_COUNT]; > >> > >> +extern const char *tgsi_invariant_name; > >> + > >> extern const char *tgsi_primitive_names[PIPE_PRIM_MAX]; > >> > >> extern const char *tgsi_fs_coord_origin_names[2]; > >> diff --git a/src/gallium/auxiliary/tgsi/tgsi_text.c > >> b/src/gallium/auxiliary/tgsi/tgsi_text.c > >> index 02241a66bf..815b1ee65d 100644 > >> --- a/src/gallium/auxiliary/tgsi/tgsi_text.c > >> +++ b/src/gallium/auxiliary/tgsi/tgsi_text.c > >> @@ -1586,10 +1586,6 @@ static boolean parse_declaration( struct > >> translate_ctx *ctx ) > >> break; > >> } > >>} > >> - if (i == TGSI_INTERPOLATE_COUNT) { > >> - report_error( ctx, "Expected semantic or interpolate attribute" > >> ); > >> - return FALSE; > >> - } > >> } > >> > >> cur = ctx->cur; > >> @@ -1609,6 +1605,20 @@ static boolean parse_declaration( struct > >> translate_ctx *ctx ) > >>} > >> } > >> > >> + cur = ctx->cur; > >> + eat_opt_white( &cur ); > >> + if (*cur == ',' && !is_vs_input) { > >> + cur++; > >> + eat_opt_white( &cur ); > >> + if (str_match_nocase_whole( &cur, tgsi_invariant_name )) { > >> + decl.Declaration.Invariant = 1; > >> + ctx->cur = cur; > >> + } else { > >> + report_error( ctx, "Expected semantic, interpolate attribute, or > >> invariant "); > >> + return FALSE; > >> + } > >> + } > >> + > >> advance = tgsi_build_full_declaration( > >>&decl, > >>ctx->tokens_cur, > >> diff --git a/src/gallium/auxiliary/tgsi/tgsi_ureg.c > >> b/src/gallium/auxiliary/tgsi/tgsi_ureg.c > >> index 393e015001..f54e2229a7 100644 > >> --- a/src/gallium/auxiliary/tgsi/tgsi_ureg.c > >> +++ b/src/gallium/auxiliary/tgsi/tgsi_ureg.c > >> @@ -140,6 +140,7 @@ struct ureg_program > >>unsigned first; > >>unsigned last; > >>unsigned array_id; > >> + unsigned invariant; > >> } output[UREG_MAX_OUTPUT]; > >> unsigned nr_outputs, nr_output_regs; > >> > >> @@ -427,7 +428,8 @@ ureg_DECL_output_layout(struct ureg_program *ureg, > >> unsigned index, > >> unsigned usage_mask, > >> unsigned array_id, > >> -unsigned array_size) > >> +unsigned array_size, > >> +unsigned invariant) > >> { > >> unsigned i; > >> > >> @@ -455,6 +457,7 @@ ureg_DECL_output_layout(struct ureg_program *ure
Re: [Mesa-dev] [PATCH] Plumb invariant output attrib thru TGSI
TGSI already has a invariant field on declarations, we are running into a bug with virgl because st_glsl_to_tgsi completely drops the invariant flag on the floor when it comes to declarations (tho precise is added to the ops). But virgl can't express precise ops (only invariant and precise declarations) only declarations. Going to do some testing on this patch soon. Cheers, Jakob. On Tue, Apr 10, 2018 at 7:02 PM Marek Olšák wrote: > > This doesn't change TGSI. It only changes utilities around it. > > Marek > > On Mon, Apr 9, 2018 at 6:02 PM, Joe M. Kniss wrote: >> >> Add support for glsl 'invariant' modifier for output data declarations. >> Gallium drivers that use TGSI serialization currently loose invariant >> modifiers in glsl shaders. >> >> Tested: chromiumos on qemu with virglrenderer. >> Signed-off-by: Joe M. Kniss >> --- >> src/gallium/auxiliary/tgsi/tgsi_strings.c | 2 ++ >> src/gallium/auxiliary/tgsi/tgsi_strings.h | 2 ++ >> src/gallium/auxiliary/tgsi/tgsi_text.c | 18 +++ >> src/gallium/auxiliary/tgsi/tgsi_ureg.c | 27 ++ >> src/gallium/auxiliary/tgsi/tgsi_ureg.h | 4 +++- >> src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 8 +-- >> 6 files changed, 45 insertions(+), 16 deletions(-) >> >> diff --git a/src/gallium/auxiliary/tgsi/tgsi_strings.c >> b/src/gallium/auxiliary/tgsi/tgsi_strings.c >> index 4f28b49ce8..434871273f 100644 >> --- a/src/gallium/auxiliary/tgsi/tgsi_strings.c >> +++ b/src/gallium/auxiliary/tgsi/tgsi_strings.c >> @@ -185,6 +185,8 @@ const char >> *tgsi_interpolate_locations[TGSI_INTERPOLATE_LOC_COUNT] = >> "SAMPLE", >> }; >> >> +const char *tgsi_invariant_name = "INVARIANT"; >> + >> const char *tgsi_primitive_names[PIPE_PRIM_MAX] = >> { >> "POINTS", >> diff --git a/src/gallium/auxiliary/tgsi/tgsi_strings.h >> b/src/gallium/auxiliary/tgsi/tgsi_strings.h >> index bb2d3458dd..20e3f7127f 100644 >> --- a/src/gallium/auxiliary/tgsi/tgsi_strings.h >> +++ b/src/gallium/auxiliary/tgsi/tgsi_strings.h >> @@ -52,6 +52,8 @@ extern const char >> *tgsi_interpolate_names[TGSI_INTERPOLATE_COUNT]; >> >> extern const char *tgsi_interpolate_locations[TGSI_INTERPOLATE_LOC_COUNT]; >> >> +extern const char *tgsi_invariant_name; >> + >> extern const char *tgsi_primitive_names[PIPE_PRIM_MAX]; >> >> extern const char *tgsi_fs_coord_origin_names[2]; >> diff --git a/src/gallium/auxiliary/tgsi/tgsi_text.c >> b/src/gallium/auxiliary/tgsi/tgsi_text.c >> index 02241a66bf..815b1ee65d 100644 >> --- a/src/gallium/auxiliary/tgsi/tgsi_text.c >> +++ b/src/gallium/auxiliary/tgsi/tgsi_text.c >> @@ -1586,10 +1586,6 @@ static boolean parse_declaration( struct >> translate_ctx *ctx ) >> break; >> } >>} >> - if (i == TGSI_INTERPOLATE_COUNT) { >> - report_error( ctx, "Expected semantic or interpolate attribute" ); >> - return FALSE; >> - } >> } >> >> cur = ctx->cur; >> @@ -1609,6 +1605,20 @@ static boolean parse_declaration( struct >> translate_ctx *ctx ) >>} >> } >> >> + cur = ctx->cur; >> + eat_opt_white( &cur ); >> + if (*cur == ',' && !is_vs_input) { >> + cur++; >> + eat_opt_white( &cur ); >> + if (str_match_nocase_whole( &cur, tgsi_invariant_name )) { >> + decl.Declaration.Invariant = 1; >> + ctx->cur = cur; >> + } else { >> + report_error( ctx, "Expected semantic, interpolate attribute, or >> invariant "); >> + return FALSE; >> + } >> + } >> + >> advance = tgsi_build_full_declaration( >>&decl, >>ctx->tokens_cur, >> diff --git a/src/gallium/auxiliary/tgsi/tgsi_ureg.c >> b/src/gallium/auxiliary/tgsi/tgsi_ureg.c >> index 393e015001..f54e2229a7 100644 >> --- a/src/gallium/auxiliary/tgsi/tgsi_ureg.c >> +++ b/src/gallium/auxiliary/tgsi/tgsi_ureg.c >> @@ -140,6 +140,7 @@ struct ureg_program >>unsigned first; >>unsigned last; >>unsigned array_id; >> + unsigned invariant; >> } output[UREG_MAX_OUTPUT]; >> unsigned nr_outputs, nr_output_regs; >> >> @@ -427,7 +428,8 @@ ureg_DECL_output_layout(struct ureg_program *ureg, >> unsigned index, >> unsigned usage_mask, >> unsigned array_id, >> -unsigned array_size) >> +unsigned array_size, >> +unsigned invariant) >> { >> unsigned i; >> >> @@ -455,6 +457,7 @@ ureg_DECL_output_layout(struct ureg_program *ureg, >>ureg->output[i].first = index; >>ureg->output[i].last = index + array_size - 1; >>ureg->output[i].array_id = array_id; >> + ureg->output[i].invariant = invariant; >>ureg->nr_output_regs = MAX2(ureg->nr_output_regs, index + array_size); >>ureg->nr_outputs++; >> } >> @@ -480,7 +483,7 @@ ureg_DECL_output_masked(struct ureg_program *ureg, >> unsigned array_size) >> { >> return ureg_D
Re: [Mesa-dev] [PATCH] Plumb invariant output attrib thru TGSI
This doesn't change TGSI. It only changes utilities around it. Marek On Mon, Apr 9, 2018 at 6:02 PM, Joe M. Kniss wrote: > Add support for glsl 'invariant' modifier for output data declarations. > Gallium drivers that use TGSI serialization currently loose invariant > modifiers in glsl shaders. > > Tested: chromiumos on qemu with virglrenderer. > Signed-off-by: Joe M. Kniss > --- > src/gallium/auxiliary/tgsi/tgsi_strings.c | 2 ++ > src/gallium/auxiliary/tgsi/tgsi_strings.h | 2 ++ > src/gallium/auxiliary/tgsi/tgsi_text.c | 18 +++ > src/gallium/auxiliary/tgsi/tgsi_ureg.c | 27 ++ > src/gallium/auxiliary/tgsi/tgsi_ureg.h | 4 +++- > src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 8 +-- > 6 files changed, 45 insertions(+), 16 deletions(-) > > diff --git a/src/gallium/auxiliary/tgsi/tgsi_strings.c > b/src/gallium/auxiliary/tgsi/tgsi_strings.c > index 4f28b49ce8..434871273f 100644 > --- a/src/gallium/auxiliary/tgsi/tgsi_strings.c > +++ b/src/gallium/auxiliary/tgsi/tgsi_strings.c > @@ -185,6 +185,8 @@ const char > *tgsi_interpolate_locations[TGSI_INTERPOLATE_LOC_COUNT] > = > "SAMPLE", > }; > > +const char *tgsi_invariant_name = "INVARIANT"; > + > const char *tgsi_primitive_names[PIPE_PRIM_MAX] = > { > "POINTS", > diff --git a/src/gallium/auxiliary/tgsi/tgsi_strings.h > b/src/gallium/auxiliary/tgsi/tgsi_strings.h > index bb2d3458dd..20e3f7127f 100644 > --- a/src/gallium/auxiliary/tgsi/tgsi_strings.h > +++ b/src/gallium/auxiliary/tgsi/tgsi_strings.h > @@ -52,6 +52,8 @@ extern const char *tgsi_interpolate_names[TGSI_ > INTERPOLATE_COUNT]; > > extern const char *tgsi_interpolate_locations[ > TGSI_INTERPOLATE_LOC_COUNT]; > > +extern const char *tgsi_invariant_name; > + > extern const char *tgsi_primitive_names[PIPE_PRIM_MAX]; > > extern const char *tgsi_fs_coord_origin_names[2]; > diff --git a/src/gallium/auxiliary/tgsi/tgsi_text.c > b/src/gallium/auxiliary/tgsi/tgsi_text.c > index 02241a66bf..815b1ee65d 100644 > --- a/src/gallium/auxiliary/tgsi/tgsi_text.c > +++ b/src/gallium/auxiliary/tgsi/tgsi_text.c > @@ -1586,10 +1586,6 @@ static boolean parse_declaration( struct > translate_ctx *ctx ) > break; > } >} > - if (i == TGSI_INTERPOLATE_COUNT) { > - report_error( ctx, "Expected semantic or interpolate attribute" > ); > - return FALSE; > - } > } > > cur = ctx->cur; > @@ -1609,6 +1605,20 @@ static boolean parse_declaration( struct > translate_ctx *ctx ) >} > } > > + cur = ctx->cur; > + eat_opt_white( &cur ); > + if (*cur == ',' && !is_vs_input) { > + cur++; > + eat_opt_white( &cur ); > + if (str_match_nocase_whole( &cur, tgsi_invariant_name )) { > + decl.Declaration.Invariant = 1; > + ctx->cur = cur; > + } else { > + report_error( ctx, "Expected semantic, interpolate attribute, or > invariant "); > + return FALSE; > + } > + } > + > advance = tgsi_build_full_declaration( >&decl, >ctx->tokens_cur, > diff --git a/src/gallium/auxiliary/tgsi/tgsi_ureg.c > b/src/gallium/auxiliary/tgsi/tgsi_ureg.c > index 393e015001..f54e2229a7 100644 > --- a/src/gallium/auxiliary/tgsi/tgsi_ureg.c > +++ b/src/gallium/auxiliary/tgsi/tgsi_ureg.c > @@ -140,6 +140,7 @@ struct ureg_program >unsigned first; >unsigned last; >unsigned array_id; > + unsigned invariant; > } output[UREG_MAX_OUTPUT]; > unsigned nr_outputs, nr_output_regs; > > @@ -427,7 +428,8 @@ ureg_DECL_output_layout(struct ureg_program *ureg, > unsigned index, > unsigned usage_mask, > unsigned array_id, > -unsigned array_size) > +unsigned array_size, > +unsigned invariant) > { > unsigned i; > > @@ -455,6 +457,7 @@ ureg_DECL_output_layout(struct ureg_program *ureg, >ureg->output[i].first = index; >ureg->output[i].last = index + array_size - 1; >ureg->output[i].array_id = array_id; > + ureg->output[i].invariant = invariant; >ureg->nr_output_regs = MAX2(ureg->nr_output_regs, index + > array_size); >ureg->nr_outputs++; > } > @@ -480,7 +483,7 @@ ureg_DECL_output_masked(struct ureg_program *ureg, > unsigned array_size) > { > return ureg_DECL_output_layout(ureg, name, index, 0, > - ureg->nr_output_regs, usage_mask, > array_id, array_size); > + ureg->nr_output_regs, usage_mask, > array_id, array_size, 0); > } > > > @@ -1512,7 +1515,8 @@ emit_decl_semantic(struct ureg_program *ureg, > unsigned semantic_index, > unsigned streams, > unsigned usage_mask, > - unsigned array_id) > + unsigned array_id, > + unsigned invariant) >
[Mesa-dev] [PATCH] Plumb invariant output attrib thru TGSI
Add support for glsl 'invariant' modifier for output data declarations. Gallium drivers that use TGSI serialization currently loose invariant modifiers in glsl shaders. Tested: chromiumos on qemu with virglrenderer. Signed-off-by: Joe M. Kniss --- src/gallium/auxiliary/tgsi/tgsi_strings.c | 2 ++ src/gallium/auxiliary/tgsi/tgsi_strings.h | 2 ++ src/gallium/auxiliary/tgsi/tgsi_text.c | 18 +++ src/gallium/auxiliary/tgsi/tgsi_ureg.c | 27 ++ src/gallium/auxiliary/tgsi/tgsi_ureg.h | 4 +++- src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 8 +-- 6 files changed, 45 insertions(+), 16 deletions(-) diff --git a/src/gallium/auxiliary/tgsi/tgsi_strings.c b/src/gallium/auxiliary/tgsi/tgsi_strings.c index 4f28b49ce8..434871273f 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_strings.c +++ b/src/gallium/auxiliary/tgsi/tgsi_strings.c @@ -185,6 +185,8 @@ const char *tgsi_interpolate_locations[TGSI_INTERPOLATE_LOC_COUNT] = "SAMPLE", }; +const char *tgsi_invariant_name = "INVARIANT"; + const char *tgsi_primitive_names[PIPE_PRIM_MAX] = { "POINTS", diff --git a/src/gallium/auxiliary/tgsi/tgsi_strings.h b/src/gallium/auxiliary/tgsi/tgsi_strings.h index bb2d3458dd..20e3f7127f 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_strings.h +++ b/src/gallium/auxiliary/tgsi/tgsi_strings.h @@ -52,6 +52,8 @@ extern const char *tgsi_interpolate_names[TGSI_INTERPOLATE_COUNT]; extern const char *tgsi_interpolate_locations[TGSI_INTERPOLATE_LOC_COUNT]; +extern const char *tgsi_invariant_name; + extern const char *tgsi_primitive_names[PIPE_PRIM_MAX]; extern const char *tgsi_fs_coord_origin_names[2]; diff --git a/src/gallium/auxiliary/tgsi/tgsi_text.c b/src/gallium/auxiliary/tgsi/tgsi_text.c index 02241a66bf..815b1ee65d 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_text.c +++ b/src/gallium/auxiliary/tgsi/tgsi_text.c @@ -1586,10 +1586,6 @@ static boolean parse_declaration( struct translate_ctx *ctx ) break; } } - if (i == TGSI_INTERPOLATE_COUNT) { - report_error( ctx, "Expected semantic or interpolate attribute" ); - return FALSE; - } } cur = ctx->cur; @@ -1609,6 +1605,20 @@ static boolean parse_declaration( struct translate_ctx *ctx ) } } + cur = ctx->cur; + eat_opt_white( &cur ); + if (*cur == ',' && !is_vs_input) { + cur++; + eat_opt_white( &cur ); + if (str_match_nocase_whole( &cur, tgsi_invariant_name )) { + decl.Declaration.Invariant = 1; + ctx->cur = cur; + } else { + report_error( ctx, "Expected semantic, interpolate attribute, or invariant "); + return FALSE; + } + } + advance = tgsi_build_full_declaration( &decl, ctx->tokens_cur, diff --git a/src/gallium/auxiliary/tgsi/tgsi_ureg.c b/src/gallium/auxiliary/tgsi/tgsi_ureg.c index 393e015001..f54e2229a7 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_ureg.c +++ b/src/gallium/auxiliary/tgsi/tgsi_ureg.c @@ -140,6 +140,7 @@ struct ureg_program unsigned first; unsigned last; unsigned array_id; + unsigned invariant; } output[UREG_MAX_OUTPUT]; unsigned nr_outputs, nr_output_regs; @@ -427,7 +428,8 @@ ureg_DECL_output_layout(struct ureg_program *ureg, unsigned index, unsigned usage_mask, unsigned array_id, -unsigned array_size) +unsigned array_size, +unsigned invariant) { unsigned i; @@ -455,6 +457,7 @@ ureg_DECL_output_layout(struct ureg_program *ureg, ureg->output[i].first = index; ureg->output[i].last = index + array_size - 1; ureg->output[i].array_id = array_id; + ureg->output[i].invariant = invariant; ureg->nr_output_regs = MAX2(ureg->nr_output_regs, index + array_size); ureg->nr_outputs++; } @@ -480,7 +483,7 @@ ureg_DECL_output_masked(struct ureg_program *ureg, unsigned array_size) { return ureg_DECL_output_layout(ureg, name, index, 0, - ureg->nr_output_regs, usage_mask, array_id, array_size); + ureg->nr_output_regs, usage_mask, array_id, array_size, 0); } @@ -1512,7 +1515,8 @@ emit_decl_semantic(struct ureg_program *ureg, unsigned semantic_index, unsigned streams, unsigned usage_mask, - unsigned array_id) + unsigned array_id, + unsigned invariant) { union tgsi_any_token *out = get_tokens(ureg, DOMAIN_DECL, array_id ? 4 : 3); @@ -1523,7 +1527,8 @@ emit_decl_semantic(struct ureg_program *ureg, out[0].decl.UsageMask = usage_mask; out[0].decl.Semantic = 1; out[0].decl.Array = array_id != 0; - + out[0].decl.Invariant = invariant; + out[1].value = 0; out[1].decl_range.First = first;