[Mesa-dev] [PATCH] glsl/linker: properly fix output variable overlap check
Kenneth Graunke
kenneth at whitecape.org
Wed Sep 20 20:34:58 UTC 2017
On Wednesday, September 20, 2017 12:58:36 PM PDT Nicolai Hähnle wrote:
> From: Nicolai Hähnle <nicolai.haehnle at amd.com>
>
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=102904
> Fixes: 15cae12804e ("glsl/linker: fix output variable overlap check")
> ---
> src/compiler/glsl/linker.cpp | 18 ++++++++++++------
> 1 file changed, 12 insertions(+), 6 deletions(-)
>
> diff --git a/src/compiler/glsl/linker.cpp b/src/compiler/glsl/linker.cpp
> index ddd8301a739..71312b6a40d 100644
> --- a/src/compiler/glsl/linker.cpp
> +++ b/src/compiler/glsl/linker.cpp
> @@ -2880,39 +2880,45 @@ assign_attribute_or_color_locations(void *mem_ctx,
> if (assigned_component_mask & component_mask) {
> linker_error(prog, "overlapping component is "
> "assigned to %ss %s and %s "
> "(component=%d)\n",
> string, assigned[i]->name, var->name,
> var->data.location_frac);
> return false;
> }
> }
> }
> -
> - /* At most one variable per fragment output component should
> - * reach this. */
> - assert(assigned_attr < ARRAY_SIZE(assigned));
> - assigned[assigned_attr] = var;
> - assigned_attr++;
> } else if (target_index == MESA_SHADER_FRAGMENT ||
> (prog->IsES && prog->data->Version >= 300)) {
> linker_error(prog, "overlapping location is assigned "
> "to %s `%s' %d %d %d\n", string, var->name,
> used_locations, use_mask, attr);
> return false;
> } else {
> linker_warning(prog, "overlapping location is assigned "
> "to %s `%s' %d %d %d\n", string, var->name,
> used_locations, use_mask, attr);
> }
> }
>
> + if (target_index == MESA_SHADER_FRAGMENT && !prog->IsES) {
> + /* Only track assigned variables for non-ES fragment shaders
> + * to avoid overflowing the array.
> + *
> + * At most one variable per fragment output component should
> + * reach this.
> + */
> + assert(assigned_attr < ARRAY_SIZE(assigned));
> + assigned[assigned_attr] = var;
> + assigned_attr++;
> + }
> +
> used_locations |= (use_mask << attr);
>
> /* From the GL 4.5 core spec, section 11.1.1 (Vertex Attributes):
> *
> * "A program with more than the value of MAX_VERTEX_ATTRIBS
> * active attribute variables may fail to link, unless
> * device-dependent optimizations are able to make the program
> * fit within available hardware resources. For the purposes
> * of this test, attribute variables of the type dvec3, dvec4,
> * dmat2x3, dmat2x4, dmat3, dmat3x4, dmat4x3, and dmat4 may
>
Thanks Nicolai!
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part.
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20170920/007551e3/attachment-0001.sig>
More information about the mesa-dev
mailing list