[Mesa-dev] [PATCH] Check for normalized when using BGRA vertex arrays

Corey Richardson corey at octayn.net
Mon Jul 29 19:10:50 PDT 2013


Previously, the piglit test ARB_vertex_array_bgra/api-errors failed because
update_array did not check if normalized == GL_FALSE, and error if so.

Signed-off-by: Corey Richardson <corey at octayn.net>
---
 src/mesa/main/varray.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c
index 529d933..d9a2453 100644
--- a/src/mesa/main/varray.c
+++ b/src/mesa/main/varray.c
@@ -206,6 +206,14 @@ update_array(struct gl_context *ctx,
       } else if (type != GL_UNSIGNED_BYTE)
          bgra_error = GL_TRUE;
 
+      /* From the GL_ARB_vertex_array_bgra specification:
+       *  "The error INVALID_VALUE is generated by VertexAttribPointer if
+       *    size is BGRA and normalized is FALSE."
+       */
+      if (normalized == GL_FALSE) {
+         bgra_error = GL_TRUE;
+      }
+
       if (bgra_error) {
          _mesa_error(ctx, GL_INVALID_VALUE, "%s(GL_BGRA/GLubyte)", func);
          return;
-- 
1.8.3.4



More information about the mesa-dev mailing list