Mesa (master): glsl: don' t run intrastage array validation when the interface type is not an array

Samuel Iglesias Gonsálvez samuelig at kemper.freedesktop.org
Mon Dec 4 09:19:09 UTC 2017


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

Author: Samuel Iglesias Gonsálvez <siglesias at igalia.com>
Date:   Thu Nov  9 11:15:03 2017 +0100

glsl: don't run intrastage array validation when the interface type is not an array

We validate that the interface block array type's definition matches.
However, previously, the function could be called if an non-array
interface block has different type definitions -for example, when the
precision qualifier differs in a GLSL ES shader, we would create two
different types-, and it would return invalid as both definitions are
non-arrays.

We fix this by specifying that at least one definition should be an
array to call the validation.

Signed-off-by: Samuel Iglesias Gonsálvez <siglesias at igalia.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle at amd.com>

---

 src/compiler/glsl/link_interface_blocks.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/compiler/glsl/link_interface_blocks.cpp b/src/compiler/glsl/link_interface_blocks.cpp
index c2c3b58f82..ce90d91607 100644
--- a/src/compiler/glsl/link_interface_blocks.cpp
+++ b/src/compiler/glsl/link_interface_blocks.cpp
@@ -137,7 +137,7 @@ intrastage_match(ir_variable *a,
    /* If a block is an array then it must match across the shader.
     * Unsized arrays are also processed and matched agaist sized arrays.
     */
-   if (b->type != a->type &&
+   if (b->type != a->type && (b->type->is_array() || a->type->is_array()) &&
        (b->is_interface_instance() || a->is_interface_instance()) &&
        !validate_intrastage_arrays(prog, b, a))
       return false;




More information about the mesa-commit mailing list