summaryrefslogtreecommitdiffstats
path: root/src/broadcom/compiler
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2018-07-20 14:06:57 -0700
committerEric Anholt <[email protected]>2018-07-23 10:21:43 -0700
commit79e0f042bcd6a1956015cf332c2232ade2c2321f (patch)
tree67e2297f139b11c2701cbc9a2e079ff1efacd03a /src/broadcom/compiler
parentf2ea936f4840f357fd3078857d286dbebded1bf4 (diff)
v3d: Return an invalid src number if asked for a missing implicit uniform.
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.
Diffstat (limited to 'src/broadcom/compiler')
-rw-r--r--src/broadcom/compiler/vir.c2
-rw-r--r--src/broadcom/compiler/vir_lower_uniforms.c4
2 files changed, 3 insertions, 3 deletions
diff --git a/src/broadcom/compiler/vir.c b/src/broadcom/compiler/vir.c
index 6ee3b98087a..5a4bf80f93d 100644
--- a/src/broadcom/compiler/vir.c
+++ b/src/broadcom/compiler/vir.c
@@ -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;
}
diff --git a/src/broadcom/compiler/vir_lower_uniforms.c b/src/broadcom/compiler/vir_lower_uniforms.c
index 97375b483b0..1e900404c9c 100644
--- a/src/broadcom/compiler/vir_lower_uniforms.c
+++ b/src/broadcom/compiler/vir_lower_uniforms.c
@@ -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