glsl/linker: check for xfb_offset aliasing
authorAndres Gomez <agomez@igalia.com>
Wed, 30 Jan 2019 13:58:42 +0000 (15:58 +0200)
committerAndres Gomez <agomez@igalia.com>
Mon, 29 Apr 2019 10:13:29 +0000 (12:13 +0200)
commitc81fbb42d94293e78e9c767bb00ad22855f9e0b0
tree176f131044bc985f891683d18327be93907f60fc
parent812288bf0f65c360fd93803d14f1c74754835535
glsl/linker: check for xfb_offset aliasing

From page 76 (page 80 of the PDF) of the GLSL 4.60 v.5 spec:

  " No aliasing in output buffers is allowed: It is a compile-time or
    link-time error to specify variables with overlapping transform
    feedback offsets."

Currently, this is expected to fail, but it succeeds:

  "

    ...

    layout (xfb_offset = 0) out vec2 a;
    layout (xfb_offset = 0) out vec4 b;

    ...

  "

Fixes the following piglit test:
tests/spec/arb_enhanced_layouts/compiler/transform-feedback-layout-qualifiers/xfb_offset/invalid-overlap.vert

Fixes the following test:
KHR-GL44.enhanced_layouts.xfb_output_overlapping

v2:
  - Use a data structure to track the used components instead of a
    nested loop (Ilia).

v3:
  - Take the BITSET_WORD array out from the
    gl_transform_feedback_buffer struct and make it local to the
    validation process (Timothy).
  - Do not use a nested scope for the validation (Timothy).

v4:
  - Add reference to the fixed piglit test in the commit log.
  - Add reference to the fixed VK-GL-CTS test in the commit
    log (Tapani).
  - Empty initialize the BITSET_WORD pointers array (Tapani).

Cc: Timothy Arceri <tarceri@itsqueeze.com>
Cc: Ilia Mirkin <imirkin@alum.mit.edu>
Signed-off-by: Andres Gomez <agomez@igalia.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
src/compiler/glsl/link_varyings.cpp
src/compiler/glsl/link_varyings.h