diff options
author | Brian Paul <[email protected]> | 2016-09-22 16:10:02 -0600 |
---|---|---|
committer | Brian Paul <[email protected]> | 2016-09-23 19:54:42 -0600 |
commit | 07d1f8faf9a7b4bdf6989de7df928105cd248251 (patch) | |
tree | 2a1f4c09f668cb9c0be46a3e91c00b51e0aee357 /src/mesa/state_tracker | |
parent | 1cdc232e1ae683a7c45f81b44818cf8656480df8 (diff) |
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.
Reviewed-by: Charmaine Lee <[email protected]>
Diffstat (limited to 'src/mesa/state_tracker')
-rw-r--r-- | src/mesa/state_tracker/st_atom_texture.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/mesa/state_tracker/st_atom_texture.c b/src/mesa/state_tracker/st_atom_texture.c index a6135333b3e..19df6622ef1 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) { |