Mesa (main): draw: Don't look at .nir if !IR_NIR.

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Feb 15 18:42:52 UTC 2022


Module: Mesa
Branch: main
Commit: 3652ff2fa1db74a1f742138d50f3130f7a7a0ab9
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=3652ff2fa1db74a1f742138d50f3130f7a7a0ab9

Author: Emma Anholt <emma at anholt.net>
Date:   Sat Feb  5 20:18:58 2022 -0800

draw: Don't look at .nir if !IR_NIR.

I suspect this double-check and comment was due to originally using ir.nir
as the condition, which might be uninitialized if !IR_NIR.  You could only
take the branch if IR_NIR was set, and you should always not take if it
!IR_NIR, so it worked out in the end, but it would cause spurious valgrind
warnings if you hadn't zeroed out your TGSI shader's struct.

Reviewed-by: Zoltán Böszörményi <zboszor at gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14896>

---

 src/gallium/auxiliary/draw/draw_vs_llvm.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/src/gallium/auxiliary/draw/draw_vs_llvm.c b/src/gallium/auxiliary/draw/draw_vs_llvm.c
index 00c63ed5f45..a605ee102fe 100644
--- a/src/gallium/auxiliary/draw/draw_vs_llvm.c
+++ b/src/gallium/auxiliary/draw/draw_vs_llvm.c
@@ -94,9 +94,7 @@ draw_create_vs_llvm(struct draw_context *draw,
    if (!vs)
       return NULL;
 
-   /* due to some bugs in the feedback state tracker we have to check
-      for ir.nir & PIPE_SHADER_IR_NIR here. */
-   if (state->ir.nir && state->type == PIPE_SHADER_IR_NIR) {
+   if (state->type == PIPE_SHADER_IR_NIR) {
       vs->base.state.ir.nir = state->ir.nir;
       nir_shader *nir = (nir_shader *)state->ir.nir;
       if (!nir->options->lower_uniforms_to_ubo)



More information about the mesa-commit mailing list