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

Author: Emma Anholt <[email protected]>
Date:   Mon Dec 20 11:28:36 2021 -0800

r300/vs: Reuse rc_match_bgnloop().

Reviewed-by: Marek Olšák <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14271>

---

 src/gallium/drivers/r300/compiler/r3xx_vertprog.c | 19 ++-----------------
 1 file changed, 2 insertions(+), 17 deletions(-)

diff --git a/src/gallium/drivers/r300/compiler/r3xx_vertprog.c 
b/src/gallium/drivers/r300/compiler/r3xx_vertprog.c
index 24121ca8fe4..58f5d0ad60d 100644
--- a/src/gallium/drivers/r300/compiler/r3xx_vertprog.c
+++ b/src/gallium/drivers/r300/compiler/r3xx_vertprog.c
@@ -620,23 +620,8 @@ static void allocate_temporary_registers(struct 
radeon_compiler *c, void *user)
                const struct rc_opcode_info * opcode = 
rc_get_opcode_info(inst->U.I.Opcode);
                /* Instructions inside of loops need to use the ENDLOOP
                 * instruction as their LastRead. */
-               if (!end_loop && inst->U.I.Opcode == RC_OPCODE_BGNLOOP) {
-                       int endloops = 1;
-                       struct rc_instruction * ptr;
-                       for(ptr = inst->Next;
-                               ptr != &compiler->Base.Program.Instructions;
-                                                       ptr = ptr->Next){
-                               if (ptr->U.I.Opcode == RC_OPCODE_BGNLOOP) {
-                                       endloops++;
-                               } else if (ptr->U.I.Opcode == 
RC_OPCODE_ENDLOOP) {
-                                       endloops--;
-                                       if (endloops <= 0) {
-                                               end_loop = ptr;
-                                               break;
-                                       }
-                               }
-                       }
-               }
+               if (!end_loop && inst->U.I.Opcode == RC_OPCODE_BGNLOOP)
+                       end_loop = rc_match_bgnloop(inst);
 
                if (inst == end_loop) {
                        end_loop = NULL;

Reply via email to