mesa/es: Validate glMatrixMode mode in Mesa code rather than the ES wrapper
authorIan Romanick <ian.d.romanick@intel.com>
Fri, 27 Jul 2012 22:47:16 +0000 (15:47 -0700)
committerIan Romanick <ian.d.romanick@intel.com>
Wed, 29 Aug 2012 22:09:35 +0000 (15:09 -0700)
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
src/mesa/main/APIspec.xml
src/mesa/main/matrix.c

index b37470d94ae8849566e019165f1c247f74e4e2d7..cf4e5f85929b51db630d676e1f21bd864ed8e887 100644 (file)
                <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">
index b09fa4d3d813dd9c7e2d565b6a5e7e0ec4776d8f..7157433de4d23cca56cb5642cd7c53448c7a4e8b 100644 (file)
@@ -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,