Mesa (master): mesa/es: Validate ColorPointer size in Mesa code rather than the ES wrapper

Ian Romanick idr at kemper.freedesktop.org
Sat Aug 25 02:15:07 UTC 2012


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

Author: Ian Romanick <ian.d.romanick at intel.com>
Date:   Wed Jul 25 14:58:36 2012 -0700

mesa/es: Validate ColorPointer size in Mesa code rather than the ES wrapper

Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>

---

 src/mesa/main/APIspec.xml |    4 ----
 src/mesa/main/varray.c    |    3 ++-
 2 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/src/mesa/main/APIspec.xml b/src/mesa/main/APIspec.xml
index 5201647..3d5f521 100644
--- a/src/mesa/main/APIspec.xml
+++ b/src/mesa/main/APIspec.xml
@@ -1218,10 +1218,6 @@
 		<param name="stride" type="GLsizei"/>
 		<param name="pointer" type="const GLvoid *"/>
 	</proto>
-
-	<desc name="size" error="GL_INVALID_VALUE">
-		<value name="4"/>
-	</desc>
 </template>
 
 <template name="DisableClientState">
diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c
index e64c3c5..f3c869f 100644
--- a/src/mesa/main/varray.c
+++ b/src/mesa/main/varray.c
@@ -294,10 +294,11 @@ _mesa_ColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr)
          HALF_BIT | FLOAT_BIT | DOUBLE_BIT |
          UNSIGNED_INT_2_10_10_10_REV_BIT |
          INT_2_10_10_10_REV_BIT);
+   const GLint sizeMin = (ctx->API == API_OPENGLES) ? 4 : 3;
    ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
 
    update_array(ctx, "glColorPointer", VERT_ATTRIB_COLOR0,
-                legalTypes, 3, BGRA_OR_4,
+                legalTypes, sizeMin, BGRA_OR_4,
                 size, type, stride, GL_TRUE, GL_FALSE, ptr);
 }
 




More information about the mesa-commit mailing list