Mesa (master): mesa: Add assert to _mesa_primitive_restart_index.

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Mar 15 05:34:59 UTC 2019


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

Author: Mathias Fröhlich <mathias.froehlich at web.de>
Date:   Thu Mar 14 05:58:43 2019 +0100

mesa: Add assert to _mesa_primitive_restart_index.

Make sure the inde_size parameter is meant to be in bytes.

Reviewed-by: Brian Paul <brianp at vmware.com>
Signed-off-by: Mathias Fröhlich <Mathias.Froehlich at web.de>

---

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

diff --git a/src/mesa/main/varray.h b/src/mesa/main/varray.h
index 0be57971bd7..2831720edfc 100644
--- a/src/mesa/main/varray.h
+++ b/src/mesa/main/varray.h
@@ -316,6 +316,9 @@ static inline unsigned
 _mesa_primitive_restart_index(const struct gl_context *ctx,
                               unsigned index_size)
 {
+   /* The index_size parameter is menat to be in bytes. */
+   assert(index_size == 1 || index_size == 2 || index_size == 4);
+
    /* From the OpenGL 4.3 core specification, page 302:
     * "If both PRIMITIVE_RESTART and PRIMITIVE_RESTART_FIXED_INDEX are
     *  enabled, the index value determined by PRIMITIVE_RESTART_FIXED_INDEX




More information about the mesa-commit mailing list