summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/bufferobj.c
diff options
context:
space:
mode:
authorIan Romanick <[email protected]>2012-07-25 16:17:25 -0700
committerIan Romanick <[email protected]>2012-08-24 19:13:18 -0700
commit93d109645a2b3d43b4b0106f2b496ece11970c01 (patch)
treed893aeaa3bd92207c61be9a197983fa2c1e268a1 /src/mesa/main/bufferobj.c
parentbd4e5dd3553c5d7152af419f8b12ce228aba2dd2 (diff)
mesa/es: Validate glMapBuffer access in Mesa code rather than the ES wrapper
v2: Add proper core-profile and GLES3 filtering. v3: *Really* add proper core-profile and GLES3 filtering based on review feedback from Eric Anholt. It looks like previously there was some rebase / merge fail. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
Diffstat (limited to 'src/mesa/main/bufferobj.c')
-rw-r--r--src/mesa/main/bufferobj.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c
index a5c2a7a1064..d800a4f0f96 100644
--- a/src/mesa/main/bufferobj.c
+++ b/src/mesa/main/bufferobj.c
@@ -1135,20 +1135,29 @@ _mesa_MapBufferARB(GLenum target, GLenum access)
struct gl_buffer_object * bufObj;
GLbitfield accessFlags;
void *map;
+ bool valid_access;
ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, NULL);
switch (access) {
case GL_READ_ONLY_ARB:
accessFlags = GL_MAP_READ_BIT;
+ valid_access = _mesa_is_desktop_gl(ctx);
break;
case GL_WRITE_ONLY_ARB:
accessFlags = GL_MAP_WRITE_BIT;
+ valid_access = true;
break;
case GL_READ_WRITE_ARB:
accessFlags = GL_MAP_READ_BIT | GL_MAP_WRITE_BIT;
+ valid_access = _mesa_is_desktop_gl(ctx);
break;
default:
+ valid_access = false;
+ break;
+ }
+
+ if (!valid_access) {
_mesa_error(ctx, GL_INVALID_ENUM, "glMapBufferARB(access)");
return NULL;
}