Mesa (master): spirv: Don't leak GS initialization to other stages

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Sat Nov 9 00:44:34 UTC 2019


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

Author: Caio Marcelo de Oliveira Filho <caio.oliveira at intel.com>
Date:   Fri Nov  8 15:58:15 2019 -0800

spirv: Don't leak GS initialization to other stages

The stage specific fields of shader_info are in an union.  We've
likely been lucky that this value was either overwritten or ignored by
other stages.  The recent change in shader_info layout in commit
84a1a2578da ("compiler: pack shader_info from 160 bytes to 96 bytes")
made this issue visible.

Fixes: cf2257069cb ("nir/spirv: Set a default number of invocations for geometry shaders")
Reviewed-by: Jason Ekstrand <jason at jlekstrand.net>
Reviewed-by: Marek Olšák <marek.olsak at amd.com>

---

 src/compiler/spirv/spirv_to_nir.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/compiler/spirv/spirv_to_nir.c b/src/compiler/spirv/spirv_to_nir.c
index 4c1da666261..eeca640ba49 100644
--- a/src/compiler/spirv/spirv_to_nir.c
+++ b/src/compiler/spirv/spirv_to_nir.c
@@ -5152,7 +5152,8 @@ spirv_to_nir(const uint32_t *words, size_t word_count,
    }
 
    /* Set shader info defaults */
-   b->shader->info.gs.invocations = 1;
+   if (stage == MESA_SHADER_GEOMETRY)
+      b->shader->info.gs.invocations = 1;
 
    /* Parse rounding mode execution modes. This has to happen earlier than
     * other changes in the execution modes since they can affect, for example,




More information about the mesa-commit mailing list