summaryrefslogtreecommitdiffstats
path: root/src/mesa/main
diff options
context:
space:
mode:
authorFredrik Höglund <[email protected]>2012-10-10 16:27:31 +0200
committerFredrik Höglund <[email protected]>2012-10-16 13:21:41 +0200
commit762d9ace6b02e792b2efe69e81c6c5b81069e43b (patch)
treed8a71e0cf4ab298e9958ea2f969cd7a10b03fb17 /src/mesa/main
parent017c6fb324194ba1c2e15fbee2f85a2fd8f140c4 (diff)
mesa/es: Enable GL_EXT_map_buffer_range
This extension is functionally the same as GL_ARB_map_buffer_range. Reviewed-by: Ian Romanick <[email protected]>
Diffstat (limited to 'src/mesa/main')
-rw-r--r--src/mesa/main/api_exec.c7
-rw-r--r--src/mesa/main/bufferobj.c22
-rw-r--r--src/mesa/main/extensions.c1
-rw-r--r--src/mesa/main/tests/dispatch_sanity.cpp2
4 files changed, 22 insertions, 10 deletions
diff --git a/src/mesa/main/api_exec.c b/src/mesa/main/api_exec.c
index a7d4da5eeb6..09df007f439 100644
--- a/src/mesa/main/api_exec.c
+++ b/src/mesa/main/api_exec.c
@@ -756,10 +756,9 @@ _mesa_create_exec_table(struct gl_context *ctx)
SET_RenderbufferStorageMultisample(exec, _mesa_RenderbufferStorageMultisample);
}
- if (ctx->API != API_OPENGLES2) {
- SET_MapBufferRange(exec, _mesa_MapBufferRange);
- SET_FlushMappedBufferRange(exec, _mesa_FlushMappedBufferRange);
- }
+ /* GL_ARB_map_buffer_range / GL_EXT_map_buffer_range */
+ SET_MapBufferRange(exec, _mesa_MapBufferRange);
+ SET_FlushMappedBufferRange(exec, _mesa_FlushMappedBufferRange);
/* GL_ARB_copy_buffer */
if (ctx->API != API_OPENGLES2) {
diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c
index d9afe37a041..ac6bbc56b82 100644
--- a/src/mesa/main/bufferobj.c
+++ b/src/mesa/main/bufferobj.c
@@ -1312,20 +1312,17 @@ _mesa_GetBufferParameterivARB(GLenum target, GLenum pname, GLint *params)
*params = _mesa_bufferobj_mapped(bufObj);
return;
case GL_BUFFER_ACCESS_FLAGS:
- if ((!_mesa_is_desktop_gl(ctx) || !ctx->Extensions.ARB_map_buffer_range)
- && !_mesa_is_gles3(ctx))
+ if (!ctx->Extensions.ARB_map_buffer_range)
goto invalid_pname;
*params = bufObj->AccessFlags;
return;
case GL_BUFFER_MAP_OFFSET:
- if ((!_mesa_is_desktop_gl(ctx) || !ctx->Extensions.ARB_map_buffer_range)
- && !_mesa_is_gles3(ctx))
+ if (!ctx->Extensions.ARB_map_buffer_range)
goto invalid_pname;
*params = (GLint) bufObj->Offset;
return;
case GL_BUFFER_MAP_LENGTH:
- if ((!_mesa_is_desktop_gl(ctx) || !ctx->Extensions.ARB_map_buffer_range)
- && !_mesa_is_gles3(ctx))
+ if (!ctx->Extensions.ARB_map_buffer_range)
goto invalid_pname;
*params = (GLint) bufObj->Length;
return;
@@ -1524,6 +1521,19 @@ _mesa_MapBufferRange(GLenum target, GLintptr offset, GLsizeiptr length,
return NULL;
}
+ /* Page 38 of the PDF of the OpenGL ES 3.0 spec says:
+ *
+ * "An INVALID_OPERATION error is generated for any of the following
+ * conditions:
+ *
+ * * <length> is zero."
+ */
+ if (_mesa_is_gles(ctx) && length == 0) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glMapBufferRange(length = 0)");
+ return NULL;
+ }
+
if (access & ~(GL_MAP_READ_BIT |
GL_MAP_WRITE_BIT |
GL_MAP_INVALIDATE_RANGE_BIT |
diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c
index 8681c4c63af..3b2fa310e86 100644
--- a/src/mesa/main/extensions.c
+++ b/src/mesa/main/extensions.c
@@ -176,6 +176,7 @@ static const struct extension extension_table[] = {
{ "GL_EXT_framebuffer_sRGB", o(EXT_framebuffer_sRGB), GL, 1998 },
{ "GL_EXT_gpu_program_parameters", o(EXT_gpu_program_parameters), GLL, 2006 },
{ "GL_EXT_gpu_shader4", o(EXT_gpu_shader4), GL, 2006 },
+ { "GL_EXT_map_buffer_range", o(ARB_map_buffer_range), ES1 | ES2, 2012 },
{ "GL_EXT_multi_draw_arrays", o(dummy_true), GLL | ES1 | ES2, 1999 },
{ "GL_EXT_packed_depth_stencil", o(EXT_packed_depth_stencil), GL, 2005 },
{ "GL_EXT_packed_float", o(EXT_packed_float), GL, 2004 },
diff --git a/src/mesa/main/tests/dispatch_sanity.cpp b/src/mesa/main/tests/dispatch_sanity.cpp
index a8839a5a414..ca753b3ca39 100644
--- a/src/mesa/main/tests/dispatch_sanity.cpp
+++ b/src/mesa/main/tests/dispatch_sanity.cpp
@@ -195,6 +195,7 @@ const struct function gles2_functions_possible[] = {
{ "glEnableVertexAttribArray", -1 },
{ "glFinish", _gloffset_Finish },
{ "glFlush", _gloffset_Flush },
+ { "glFlushMappedBufferRangeEXT", -1 },
{ "glFramebufferRenderbuffer", -1 },
{ "glFramebufferTexture2D", -1 },
{ "glFramebufferTexture3DOES", -1 },
@@ -244,6 +245,7 @@ const struct function gles2_functions_possible[] = {
{ "glLineWidth", _gloffset_LineWidth },
{ "glLinkProgram", -1 },
{ "glMapBufferOES", -1 },
+ { "glMapBufferRangeEXT", -1 },
{ "glMultiDrawArraysEXT", -1 },
{ "glMultiDrawElementsEXT", -1 },
{ "glPixelStorei", _gloffset_PixelStorei },