[Mesa-dev] [PATCH] mesa: Reject VertexAttribPointer() with GL_BGRA and !normalized.

Kenneth Graunke kenneth at whitecape.org
Sun Jul 14 23:17:34 PDT 2013


Fixes Piglit's ARB_vertex_attrib_bgra/api-errors test.

Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
---
 src/mesa/main/varray.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c
index 529d933..48f15bd 100644
--- a/src/mesa/main/varray.c
+++ b/src/mesa/main/varray.c
@@ -463,6 +463,16 @@ _mesa_VertexAttribPointer(GLuint index, GLint size, GLenum type,
       return;
    }
 
+   /* 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 (size == GL_BGRA && !normalized) {
+      _mesa_error(ctx, GL_INVALID_VALUE,
+                  "glVertexAttribPointer(BGRA and !normalized)");
+      return;
+   }
+
    update_array(ctx, "glVertexAttribPointer", VERT_ATTRIB_GENERIC(index),
                 legalTypes, 1, BGRA_OR_4,
                 size, type, stride, normalized, GL_FALSE, ptr);
-- 
1.8.3.2



More information about the mesa-dev mailing list