Module: Mesa
Branch: master
Commit: efc75e13ea13b4b5b76dbb0be846c996b99af5de
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=efc75e13ea13b4b5b76dbb0be846c996b99af5de

Author: Iago Toral Quiroga <[email protected]>
Date:   Thu Feb 11 12:16:10 2021 +0100

broadcom/compiler: disallow reading two uniforms in the same instruction

The simulator asserts on this, which can happen if we merge a ldunif
(or any other instruction that reads a uniform implicitly) and
ldunifa in the same instruction.

Reviewed-by: Alejandro PiƱeiro <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8980>

---

 src/broadcom/compiler/qpu_schedule.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/src/broadcom/compiler/qpu_schedule.c 
b/src/broadcom/compiler/qpu_schedule.c
index 31f707f63d6..a637ec56dcf 100644
--- a/src/broadcom/compiler/qpu_schedule.c
+++ b/src/broadcom/compiler/qpu_schedule.c
@@ -791,6 +791,22 @@ choose_instruction_to_schedule(const struct 
v3d_device_info *devinfo,
                             dag.link) {
                 const struct v3d_qpu_instr *inst = &n->inst->qpu;
 
+                /* Simulator complains if we have two uniforms loaded in the
+                 * the same instruction, which could happen if we have a ldunif
+                 * or sideband uniform and we pair that with ldunifa.
+                 */
+                if (prev_inst) {
+                        if (vir_has_uniform(prev_inst->inst) &&
+                            (inst->sig.ldunifa || inst->sig.ldunifarf)) {
+                                continue;
+                        }
+                        if ((prev_inst->inst->qpu.sig.ldunifa ||
+                             prev_inst->inst->qpu.sig.ldunifarf) &&
+                            vir_has_uniform(n->inst)) {
+                                continue;
+                        }
+                }
+
                 /* Don't choose the branch instruction until it's the last one
                  * left.  We'll move it up to fit its delay slots after we
                  * choose it.

_______________________________________________
mesa-commit mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to