v3d: Return an invalid src number if asked for a missing implicit uniform.
authorEric Anholt <eric@anholt.net>
Fri, 20 Jul 2018 21:06:57 +0000 (14:06 -0700)
committerEric Anholt <eric@anholt.net>
Mon, 23 Jul 2018 17:21:43 +0000 (10:21 -0700)
Sometimes when iterating over sources, we might want to check if it's the
implicit one.  We wouldn't want to match on a non-implicit src using this
function.

src/broadcom/compiler/vir.c
src/broadcom/compiler/vir_lower_uniforms.c

index 6ee3b98087a438eff217adf81753d1c6a8c3ef56..5a4bf80f93d497d93c899efeb74cb2be735d2a9a 100644 (file)
@@ -74,6 +74,8 @@ vir_has_implicit_uniform(struct qinst *inst)
 int
 vir_get_implicit_uniform_src(struct qinst *inst)
 {
+        if (!vir_has_implicit_uniform(inst))
+                return -1;
         return vir_get_nsrc(inst) - 1;
 }
 
index 97375b483b071cdc8a0adf211034756eabd62b79..1e900404c9c937949fd76a2b3c218f08f0a4147d 100644 (file)
@@ -76,9 +76,7 @@ is_lowerable_uniform(struct qinst *inst, int i)
 {
         if (inst->src[i].file != QFILE_UNIF)
                 return false;
-        if (vir_has_implicit_uniform(inst))
-                return i != vir_get_implicit_uniform_src(inst);
-        return true;
+        return i != vir_get_implicit_uniform_src(inst);
 }
 
 /* Returns the number of different uniform values referenced by the