[Mesa-dev] [PATCH 12/20] mesa/es: Validate glMatrixMode mode in Mesa code rather than the ES wrapper

Ian Romanick idr at freedesktop.org
Fri Aug 24 08:46:56 PDT 2012


From: Ian Romanick <ian.d.romanick at intel.com>

Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
---
 src/mesa/main/APIspec.xml |    7 -------
 src/mesa/main/matrix.c    |    7 ++++---
 2 files changed, 4 insertions(+), 10 deletions(-)

diff --git a/src/mesa/main/APIspec.xml b/src/mesa/main/APIspec.xml
index b37470d..cf4e5f8 100644
--- a/src/mesa/main/APIspec.xml
+++ b/src/mesa/main/APIspec.xml
@@ -803,13 +803,6 @@
 		<return type="void"/>
 		<param name="mode" type="GLenum"/>
 	</proto>
-
-	<desc name="mode">
-		<value name="GL_MODELVIEW"/>
-		<value name="GL_PROJECTION"/>
-		<value name="GL_TEXTURE"/>
-		<value name="GL_MATRIX_PALETTE_OES" category="OES_matrix_palette"/>
-	</desc>
 </template>
 
 <template name="MultMatrix">
diff --git a/src/mesa/main/matrix.c b/src/mesa/main/matrix.c
index b09fa4d..7157433 100644
--- a/src/mesa/main/matrix.c
+++ b/src/mesa/main/matrix.c
@@ -187,7 +187,7 @@ _mesa_MatrixMode( GLenum mode )
    case GL_MATRIX5_NV:
    case GL_MATRIX6_NV:
    case GL_MATRIX7_NV:
-      if (ctx->Extensions.NV_vertex_program) {
+      if (ctx->API == API_OPENGL && ctx->Extensions.NV_vertex_program) {
          ctx->CurrentStack = &ctx->ProgramMatrixStack[mode - GL_MATRIX0_NV];
       }
       else {
@@ -203,8 +203,9 @@ _mesa_MatrixMode( GLenum mode )
    case GL_MATRIX5_ARB:
    case GL_MATRIX6_ARB:
    case GL_MATRIX7_ARB:
-      if (ctx->Extensions.ARB_vertex_program ||
-          ctx->Extensions.ARB_fragment_program) {
+      if (ctx->API == API_OPENGL
+          && (ctx->Extensions.ARB_vertex_program ||
+              ctx->Extensions.ARB_fragment_program)) {
          const GLuint m = mode - GL_MATRIX0_ARB;
          if (m > ctx->Const.MaxProgramMatrices) {
             _mesa_error(ctx, GL_INVALID_ENUM,
-- 
1.7.6.5



More information about the mesa-dev mailing list