mesa/es: Validate glGetBufferParameteriv pname in Mesa code rather than the ES wrapper
authorIan Romanick <ian.d.romanick@intel.com>
Fri, 27 Jul 2012 14:16:41 +0000 (07:16 -0700)
committerIan Romanick <ian.d.romanick@intel.com>
Sat, 25 Aug 2012 02:15:20 +0000 (19:15 -0700)
v2: Add proper core-profile and GLES3 filtering.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
src/mesa/main/APIspec.xml
src/mesa/main/bufferobj.c

index 83a32d8e355d046a03d89bd73559f82b3617121d..3121226ca35a9f6efd271292d37a42046e2805fb 100644 (file)
                <param name="pname" type="GLenum"/>
                <vector name="params" type="GLtype *" size="dynamic"/>
        </proto>
-
-       <desc name="pname">
-               <value name="GL_BUFFER_SIZE"/>
-               <value name="GL_BUFFER_USAGE"/>
-               <value name="GL_BUFFER_ACCESS_OES" category="OES_mapbuffer"/>
-               <value name="GL_BUFFER_MAPPED_OES" category="OES_mapbuffer"/>
-       </desc>
 </template>
 
 <template name="IsBuffer" direction="get">
index d800a4f0f96ae295e7fff0e1533253fdf77494c6..f8938a51054bcec20d842ecac3926489cb1cb189 100644 (file)
@@ -1311,17 +1311,20 @@ _mesa_GetBufferParameterivARB(GLenum target, GLenum pname, GLint *params)
       *params = _mesa_bufferobj_mapped(bufObj);
       return;
    case GL_BUFFER_ACCESS_FLAGS:
-      if (!ctx->Extensions.ARB_map_buffer_range)
+      if ((!_mesa_is_desktop_gl(ctx) || !ctx->Extensions.ARB_map_buffer_range)
+          && !_mesa_is_gles3(ctx))
          goto invalid_pname;
       *params = bufObj->AccessFlags;
       return;
    case GL_BUFFER_MAP_OFFSET:
-      if (!ctx->Extensions.ARB_map_buffer_range)
+      if ((!_mesa_is_desktop_gl(ctx) || !ctx->Extensions.ARB_map_buffer_range)
+          && !_mesa_is_gles3(ctx))
          goto invalid_pname;
       *params = (GLint) bufObj->Offset;
       return;
    case GL_BUFFER_MAP_LENGTH:
-      if (!ctx->Extensions.ARB_map_buffer_range)
+      if ((!_mesa_is_desktop_gl(ctx) || !ctx->Extensions.ARB_map_buffer_range)
+          && !_mesa_is_gles3(ctx))
          goto invalid_pname;
       *params = (GLint) bufObj->Length;
       return;