From b48852436e3005728e7f2cb1a77eea68e7c21a50 Mon Sep 17 00:00:00 2001 From: Emma Anholt Date: Mon, 20 Dec 2021 11:28:36 -0800 Subject: [PATCH] r300/vs: Reuse rc_match_bgnloop(). MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-by: Marek Olšák Part-of: --- .../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;