Mesa (master): i965: Make the brw_format_for_mesa_format table static const .

Eric Anholt anholt at kemper.freedesktop.org
Fri Jun 24 17:49:49 UTC 2011


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

Author: Eric Anholt <eric at anholt.net>
Date:   Tue Jun 21 17:38:20 2011 -0700

i965: Make the brw_format_for_mesa_format table static const.

Once again, assuming the compiler is clever works out so poorly.  The
generated code initialized the structure on the stack, then did a
lookup into it.  This was a performance regression from
70c6cd39bd9396b0d3f9e84df41fd8bef1f26cc4.

Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>

---

 src/mesa/drivers/dri/i965/brw_wm_surface_state.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
index ac8005d..89fea9c 100644
--- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
+++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
@@ -73,7 +73,7 @@ translate_tex_target(GLenum target)
 uint32_t
 brw_format_for_mesa_format(gl_format mesa_format)
 {
-   uint32_t table[MESA_FORMAT_COUNT] =
+   static const uint32_t table[MESA_FORMAT_COUNT] =
    {
       [MESA_FORMAT_L8] = BRW_SURFACEFORMAT_L8_UNORM,
       [MESA_FORMAT_I8] = BRW_SURFACEFORMAT_I8_UNORM,




More information about the mesa-commit mailing list