[Mesa-dev] [PATCH] glsl: Fix locations of variables in patch qualified interface blocks.
Ilia Mirkin
imirkin at alum.mit.edu
Sun Sep 4 00:07:37 UTC 2016
Reviewed-by: Ilia Mirkin <imirkin at alum.mit.edu>
On Sat, Sep 3, 2016 at 7:53 PM, Kenneth Graunke <kenneth at whitecape.org> wrote:
> As of commit d82f8d9772813949d0f5455cd0edad9003be0fb0, we actually
> parse and attempt to handle the 'patch' qualifier on interface blocks.
>
> This patch fixes explicit locations for variables in such blocks.
> Without it, many program interface query dEQP/CTS tests hit this
> assertion in ir_set_program_inouts.cpp
>
> if (is_patch_generic) {
> assert(idx >= VARYING_SLOT_PATCH0 && idx < VARYING_SLOT_TESS_MAX);
> bitfield = BITFIELD64_BIT(idx - VARYING_SLOT_PATCH0);
> }
>
> because the location was incorrectly based on VARYING_SLOT_VAR0.
>
> Note that most of the tests affected currently fail before they hit
> this, due to confusion about what the program interface query name
> of those resources should be.
>
> Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
> ---
> src/compiler/glsl/ast_to_hir.cpp | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/src/compiler/glsl/ast_to_hir.cpp b/src/compiler/glsl/ast_to_hir.cpp
> index a7f297e..4fc4c5c 100644
> --- a/src/compiler/glsl/ast_to_hir.cpp
> +++ b/src/compiler/glsl/ast_to_hir.cpp
> @@ -6819,7 +6819,8 @@ ast_process_struct_or_iface_block_members(exec_list *instructions,
> unsigned qual_location;
> if (process_qualifier_constant(state, &loc, "location",
> qual->location, &qual_location)) {
> - fields[i].location = VARYING_SLOT_VAR0 + qual_location;
> + fields[i].location = qual_location +
> + (fields[i].patch ? VARYING_SLOT_PATCH0 : VARYING_SLOT_VAR0);
> expl_location = fields[i].location +
> fields[i].type->count_attribute_slots(false);
> }
> @@ -7299,7 +7300,8 @@ ast_interface_block::hir(exec_list *instructions,
> layout.location, &expl_location)) {
> return NULL;
> } else {
> - expl_location = VARYING_SLOT_VAR0 + expl_location;
> + expl_location += this->layout.flags.q.patch ? VARYING_SLOT_PATCH0
> + : VARYING_SLOT_VAR0;
> }
> }
>
> --
> 2.9.3
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
More information about the mesa-dev
mailing list