Module: Mesa
Branch: master
Commit: 6255cc654d372352f060da8f9622bae56d6e8af5
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=6255cc654d372352f060da8f9622bae56d6e8af5

Author: Andres Gomez <ago...@igalia.com>
Date:   Mon Feb 20 17:20:58 2017 +0200

glsl: Interface Block instances don't need linking validation

From page 45 (page 52 of the PDF) of the GLSL ES 3.00 v.6 spec:

  " When instance names are present on matched block names, it is
    allowed for the instance names to differ; they need not match for
    the blocks to match.

From page 51 (page 57 of the PDF) of the GLSL 4.30 v.8 spec:

  " When instance names are present on matched block names, it is
    allowed for the instance names to differ; they need not match for
    the blocks to match."

Therefore, no cross linking validation is needed for the instance name
of an Interface Block.

This patch will make that no link error will be reported on a program
like this:

    "# VS

    layout(binding = 1) Block1 {
      vec4 color;
    } uni_block;

    ...

    # FS

    layout(binding = 2) Block2 {
      vec4 color;
    } uni_block;

    ..."

Fixes GL45-CTS.enhanced_layouts.ssb_layout_qualifier_conflict

Signed-off-by: Andres Gomez <ago...@igalia.com>
Cc: Timothy Arceri <tarc...@itsqueeze.com>
Reviewed-by: Timothy Arceri <tarc...@itsqueeze.com>

---

 src/compiler/glsl/linker.cpp | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/src/compiler/glsl/linker.cpp b/src/compiler/glsl/linker.cpp
index f9c226a22c..7bbffb7621 100644
--- a/src/compiler/glsl/linker.cpp
+++ b/src/compiler/glsl/linker.cpp
@@ -885,6 +885,13 @@ cross_validate_globals(struct gl_shader_program *prog,
       if (var->type->contains_subroutine())
          continue;
 
+      /* Don't cross validate interface instances. These are only relevant
+       * inside a shader. The cross validation is done at the Interface Block
+       * name level.
+       */
+      if (var->is_interface_instance())
+         continue;
+
       /* Don't cross validate temporaries that are at global scope.  These
        * will eventually get pulled into the shaders 'main'.
        */
@@ -897,11 +904,8 @@ cross_validate_globals(struct gl_shader_program *prog,
        */
       ir_variable *const existing = variables->get_variable(var->name);
       if (existing != NULL) {
-         /* Check if types match. Interface blocks have some special
-          * rules so we handle those elsewhere.
-          */
-         if (var->type != existing->type &&
-             !var->is_interface_instance()) {
+         /* Check if types match. */
+         if (var->type != existing->type) {
             if (!validate_intrastage_arrays(prog, var, existing)) {
                if (var->type->is_record() && existing->type->is_record()
                    && existing->type->record_compare(var->type)) {

_______________________________________________
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to