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

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


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

Author: Ian Romanick <ian.d.romanick at intel.com>
Date:   Fri Jul 27 07:16:41 2012 -0700

mesa/es: Validate glGetBufferParameteriv pname in Mesa code rather than the ES wrapper

v2: Add proper core-profile and GLES3 filtering.

Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
Reviewed-by: Eric Anholt <eric at anholt.net>

---

 src/mesa/main/APIspec.xml |    7 -------
 src/mesa/main/bufferobj.c |    9 ++++++---
 2 files changed, 6 insertions(+), 10 deletions(-)

diff --git a/src/mesa/main/APIspec.xml b/src/mesa/main/APIspec.xml
index 83a32d8..3121226 100644
--- a/src/mesa/main/APIspec.xml
+++ b/src/mesa/main/APIspec.xml
@@ -1874,13 +1874,6 @@
 		<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">
diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c
index d800a4f..f8938a5 100644
--- a/src/mesa/main/bufferobj.c
+++ b/src/mesa/main/bufferobj.c
@@ -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;




More information about the mesa-commit mailing list