Mesa (master): nir: check shader type before writing to shaderinfo.tess union
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Wed Apr 1 20:41:59 UTC 2020
Module: Mesa
Branch: master
Commit: 90a8b458acea4231a921962bee220ba76e6517a2
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=90a8b458acea4231a921962bee220ba76e6517a2
Author: Mark Janes <markjanes at swizzler.org>
Date: Tue Mar 31 16:40:57 2020 -0700
nir: check shader type before writing to shaderinfo.tess union
If the shader is not a tesselation shader, then writing to the tess
member of the shaderinfo union will overwrite other members and crash.
Closes: #2722
Fixes: f1dd81ae104 ("nir: Collect if shader uses cross-invocation or indirect I/O.")
Reviewed-by: Timur Kristóf <timur.kristof at gmail.com>
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira at intel.com>
Reviewed-by: Jason Ekstrand <jason at jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4408>
---
src/compiler/nir/nir_gather_info.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/compiler/nir/nir_gather_info.c b/src/compiler/nir/nir_gather_info.c
index d902fb7b69e..ef5d053c266 100644
--- a/src/compiler/nir/nir_gather_info.c
+++ b/src/compiler/nir/nir_gather_info.c
@@ -106,7 +106,7 @@ set_io_mask(nir_shader *shader, nir_variable *var, int offset, int len,
shader->info.inputs_read_indirectly |= bitfield;
}
- if (cross_invocation)
+ if (cross_invocation && shader->info.stage == MESA_SHADER_TESS_CTRL)
shader->info.tess.tcs_cross_invocation_inputs_read |= bitfield;
if (shader->info.stage == MESA_SHADER_FRAGMENT) {
@@ -125,7 +125,7 @@ set_io_mask(nir_shader *shader, nir_variable *var, int offset, int len,
shader->info.outputs_accessed_indirectly |= bitfield;
}
- if (cross_invocation)
+ if (cross_invocation && shader->info.stage == MESA_SHADER_TESS_CTRL)
shader->info.tess.tcs_cross_invocation_outputs_read |= bitfield;
} else {
if (is_patch_generic) {
More information about the mesa-commit
mailing list