nir: only uniforms with dynamically_uniform offset are dynamically_uniform
authorJose Maria Casanova Crespo <jmcasanova@igalia.com>
Wed, 17 Jun 2020 00:30:23 +0000 (02:30 +0200)
committerMarge Bot <eric+marge@anholt.net>
Tue, 23 Jun 2020 13:04:04 +0000 (13:04 +0000)
Previously all nir_intrinsic_load_uniform that were used as sources were
considered to be dynamically_uniform but when offsets of load_uniform
are indirect it can not be determined.

This fixes artefacts in Google Maps 3D view in V3D.

Fixes: 886d46b08971 ("nir: Add a function to determine if a source is dynamically uniform")
Reviewed-by: Neil Roberts <nroberts@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5587>

src/compiler/nir/nir.c

index 8d2e1098301dda7a0ea6ac351700dac3b888784e..2567be6efa0a58772ccb7f79f6c93c057245b62c 100644 (file)
@@ -1349,8 +1349,8 @@ nir_src_is_dynamically_uniform(nir_src src)
    /* As are uniform variables */
    if (src.ssa->parent_instr->type == nir_instr_type_intrinsic) {
       nir_intrinsic_instr *intr = nir_instr_as_intrinsic(src.ssa->parent_instr);
-
-      if (intr->intrinsic == nir_intrinsic_load_uniform)
+      if (intr->intrinsic == nir_intrinsic_load_uniform &&
+          nir_src_is_dynamically_uniform(intr->src[0]))
          return true;
    }