Mesa (master): st/mesa: mark constant array of swizzles as static const

Chris Forbes chrisf at kemper.freedesktop.org
Tue Feb 3 20:08:06 UTC 2015


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

Author: Nils Wallménius <nils.wallmenius at gmail.com>
Date:   Thu Jan 22 20:47:28 2015 +0100

st/mesa: mark constant array of swizzles as static const

This saves about 0.5k in the text section for a gallium driver
on amd64.

Reviewed-by: Chris Forbes <chrisf at ijw.co.nz>

---

 src/mesa/state_tracker/st_glsl_to_tgsi.cpp |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
index b84f39d..a9ea8c8 100644
--- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
@@ -486,7 +486,7 @@ fail_link(struct gl_shader_program *prog, const char *fmt, ...)
 static int
 swizzle_for_size(int size)
 {
-   int size_swizzles[4] = {
+   static const int size_swizzles[4] = {
       MAKE_SWIZZLE4(SWIZZLE_X, SWIZZLE_X, SWIZZLE_X, SWIZZLE_X),
       MAKE_SWIZZLE4(SWIZZLE_X, SWIZZLE_Y, SWIZZLE_Y, SWIZZLE_Y),
       MAKE_SWIZZLE4(SWIZZLE_X, SWIZZLE_Y, SWIZZLE_Z, SWIZZLE_Z),




More information about the mesa-commit mailing list