Module: Mesa
Branch: staging/21.3
Commit: fa64a71f3b3f32d5a6fe77dd33540d97a9540c94
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=fa64a71f3b3f32d5a6fe77dd33540d97a9540c94

Author: Emma Anholt <[email protected]>
Date:   Mon Dec 20 12:48:15 2021 -0800

r300/vs: Fix flow control processing just after an endloop.

We tried to step over the instruction we just generated, except we didn't
always just generate one.  In the sequence_vertex tests, that meant we
skipped processing the next BGNLOOP and then underflowed our stack.

Cc: mesa-stable
Reviewed-by: Marek Olšák <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14271>
(cherry picked from commit 658b2ca4677fb8326781ea519df3a7dcdcd3b7d6)

---

 .pick_status.json                                  | 2 +-
 src/gallium/drivers/r300/compiler/radeon_vert_fc.c | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/.pick_status.json b/.pick_status.json
index 8bc63694f7e..1685ef3e884 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -463,7 +463,7 @@
         "description": "r300/vs: Fix flow control processing just after an 
endloop.",
         "nominated": true,
         "nomination_type": 0,
-        "resolution": 0,
+        "resolution": 1,
         "main_sha": null,
         "because_sha": null
     },
diff --git a/src/gallium/drivers/r300/compiler/radeon_vert_fc.c 
b/src/gallium/drivers/r300/compiler/radeon_vert_fc.c
index fded485aaa9..51ab6213f25 100644
--- a/src/gallium/drivers/r300/compiler/radeon_vert_fc.c
+++ b/src/gallium/drivers/r300/compiler/radeon_vert_fc.c
@@ -257,10 +257,10 @@ void rc_vert_fc(struct radeon_compiler *c, void *user)
                        if (fc_state.BranchDepth != 0
                                        || fc_state.LoopDepth != 1) {
                                lower_endloop(inst, &fc_state);
+                               /* Skip the new PRED_RESTORE */
+                               inst = inst->Next;
                        }
                        fc_state.LoopDepth--;
-                       /* Skip PRED_RESTORE */
-                       inst = inst->Next;
                        break;
                case RC_OPCODE_IF:
                        lower_if(inst, &fc_state);

Reply via email to