Mesa (staging/21.3): r300: Move the instruction filter for r500_transform_IF() to the top.

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Dec 24 12:37:25 UTC 2021


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

Author: Emma Anholt <emma at anholt.net>
Date:   Tue Dec  7 10:56:42 2021 -0800

r300: Move the instruction filter for r500_transform_IF() to the top.

rc_get_variables() is slow, don't call it if we're going to just exit
immediately anyway.

Cc: mesa-stable
Reviewed-by: Marek Olšák <marek.olsak at amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14117>
(cherry picked from commit 42e8f48be729535449bfae3983d4350993149977)

---

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

diff --git a/.pick_status.json b/.pick_status.json
index e38139811f2..a1f2fba1b4c 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -4018,7 +4018,7 @@
         "description": "r300: Move the instruction filter for r500_transform_IF() to the top.",
         "nominated": true,
         "nomination_type": 0,
-        "resolution": 0,
+        "resolution": 1,
         "main_sha": null,
         "because_sha": null
     },
diff --git a/src/gallium/drivers/r300/compiler/r500_fragprog.c b/src/gallium/drivers/r300/compiler/r500_fragprog.c
index 6be615f33d4..35dab9828c0 100644
--- a/src/gallium/drivers/r300/compiler/r500_fragprog.c
+++ b/src/gallium/drivers/r300/compiler/r500_fragprog.c
@@ -44,16 +44,15 @@ int r500_transform_IF(
 	struct rc_instruction * inst_if,
 	void *data)
 {
+	if (inst_if->U.I.Opcode != RC_OPCODE_IF)
+		return 0;
+
 	struct rc_variable * writer;
 	struct rc_list * writer_list, * list_ptr;
 	struct rc_list * var_list = rc_get_variables(c);
 	unsigned int generic_if = 0;
 	unsigned int alu_chan;
 
-	if (inst_if->U.I.Opcode != RC_OPCODE_IF) {
-		return 0;
-	}
-
 	writer_list = rc_variable_list_get_writers(
 			var_list, inst_if->Type, &inst_if->U.I.SrcReg[0]);
 	if (!writer_list) {



More information about the mesa-commit mailing list