Mesa (master): swrast: use STATIC_ASSERT to make sure texfetch table isn' t missing entries

Brian Paul brianp at kemper.freedesktop.org
Wed Nov 30 14:21:17 UTC 2011


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

Author: Brian Paul <brianp at vmware.com>
Date:   Mon Nov 28 18:13:44 2011 -0700

swrast: use STATIC_ASSERT to make sure texfetch table isn't missing entries

When new MESA_FORMAT_x enums are added we need to add a new entry in
the table of texture fetch functions.  In the past this has been
missed if swrast isn't actually tested.  Using a static assertion
should help with that.

---

 src/mesa/swrast/s_texfetch.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/src/mesa/swrast/s_texfetch.c b/src/mesa/swrast/s_texfetch.c
index bcd63b6..ab7cfb5 100644
--- a/src/mesa/swrast/s_texfetch.c
+++ b/src/mesa/swrast/s_texfetch.c
@@ -1282,7 +1282,8 @@ _mesa_get_texel_fetch_func(gl_format format, GLuint dims)
    }
 #endif
 
-   assert(Elements(texfetch_funcs) == MESA_FORMAT_COUNT);
+   STATIC_ASSERT(Elements(texfetch_funcs) == MESA_FORMAT_COUNT);
+
    assert(format < MESA_FORMAT_COUNT);
 
    switch (dims) {




More information about the mesa-commit mailing list