[Mesa-dev] [PATCH 8/8] st/mesa: small optimization in swizzle_swizzle()

Charmaine Lee charmainel at vmware.com
Fri Sep 23 21:53:50 UTC 2016


Series looks good to me.

Reviewed-by: Charmaine Lee <charmainel at vmware.com>

________________________________________
From: Brian Paul <brianp at vmware.com>
Sent: Friday, September 23, 2016 8:48 AM
To: mesa-dev at lists.freedesktop.org
Cc: Charmaine Lee
Subject: [PATCH 8/8] st/mesa: small optimization in swizzle_swizzle()

Usually, there's no user-specified texture swizzle so we can optimize
the swizzle_swizzle() function and skip the loop/switch.
---
 src/mesa/state_tracker/st_atom_texture.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/mesa/state_tracker/st_atom_texture.c b/src/mesa/state_tracker/st_atom_texture.c
index a613533..19df662 100644
--- a/src/mesa/state_tracker/st_atom_texture.c
+++ b/src/mesa/state_tracker/st_atom_texture.c
@@ -59,6 +59,11 @@ swizzle_swizzle(unsigned swizzle1, unsigned swizzle2)
 {
    unsigned i, swz[4];

+   if (swizzle1 == SWIZZLE_XYZW) {
+      /* identity swizzle, no change to swizzle2 */
+      return swizzle2;
+   }
+
    for (i = 0; i < 4; i++) {
       unsigned s = GET_SWZ(swizzle1, i);
       switch (s) {
--
1.9.1



More information about the mesa-dev mailing list