Mesa (master): mesa: add sanity check assertion in update_array_format

Brian Paul brianp at kemper.freedesktop.org
Fri Oct 14 00:37:39 UTC 2016


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

Author: Brian Paul <brianp at vmware.com>
Date:   Fri Oct  7 15:21:58 2016 -0600

mesa: add sanity check assertion in update_array_format

At most, one of the normalized, integer, doubles bools can be true.

Reviewed-by: Mathias Fröhlich <mathias.froehlich at web.de>

---

 src/mesa/main/varray.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c
index 9acd868..0f7777b 100644
--- a/src/mesa/main/varray.c
+++ b/src/mesa/main/varray.c
@@ -333,6 +333,9 @@ update_array_format(struct gl_context *ctx,
    GLbitfield typeBit;
    GLenum format = GL_RGBA;
 
+   /* at most, one of these bools can be true */
+   assert((int) normalized + (int) integer + (int) doubles <= 1);
+
    if (ctx->Array.LegalTypesMask == 0 || ctx->Array.LegalTypesMaskAPI != ctx->API) {
       /* Compute the LegalTypesMask only once, unless the context API has
        * changed, in which case we want to compute it again.  We can't do this




More information about the mesa-commit mailing list