summaryrefslogtreecommitdiffstats
path: root/src/mesa/main
diff options
context:
space:
mode:
authorTimothy Arceri <[email protected]>2018-05-25 13:24:47 +1000
committerMarek Olšák <[email protected]>2019-06-28 15:41:16 -0400
commitcb0f25a9269050a8efbd526c89ae541c2d37c367 (patch)
tree328614d96ff7b9a8ea2c98f9bda2b76171e91609 /src/mesa/main
parenteec5c01b5efc1ab81bfe1af15855e17e852ed4a3 (diff)
mesa: add support for glMapNamedBufferRangeEXT()
Reviewed-by: Marek Olšák <[email protected]> Signed-off-by: Marek Olšák <[email protected]>
Diffstat (limited to 'src/mesa/main')
-rw-r--r--src/mesa/main/bufferobj.c45
-rw-r--r--src/mesa/main/bufferobj.h3
-rw-r--r--src/mesa/main/tests/dispatch_sanity.cpp2
3 files changed, 36 insertions, 14 deletions
diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c
index 0d350dbabd5..a751e41d6e8 100644
--- a/src/mesa/main/bufferobj.c
+++ b/src/mesa/main/bufferobj.c
@@ -3277,30 +3277,49 @@ _mesa_MapNamedBufferRange_no_error(GLuint buffer, GLintptr offset,
"glMapNamedBufferRange");
}
-void * GLAPIENTRY
-_mesa_MapNamedBufferRange(GLuint buffer, GLintptr offset, GLsizeiptr length,
- GLbitfield access)
+static void *
+map_named_buffer_range(GLuint buffer, GLintptr offset, GLsizeiptr length,
+ GLbitfield access, bool dst_ext, const char *func)
{
GET_CURRENT_CONTEXT(ctx);
- struct gl_buffer_object *bufObj;
+ struct gl_buffer_object *bufObj = NULL;
if (!ctx->Extensions.ARB_map_buffer_range) {
_mesa_error(ctx, GL_INVALID_OPERATION,
- "glMapNamedBufferRange("
- "ARB_map_buffer_range not supported)");
+ "%s(ARB_map_buffer_range not supported)", func);
return NULL;
}
- bufObj = _mesa_lookup_bufferobj_err(ctx, buffer, "glMapNamedBufferRange");
- if (!bufObj)
- return NULL;
+ if (dst_ext) {
+ bufObj = _mesa_lookup_bufferobj(ctx, buffer);
+ if (!_mesa_handle_bind_buffer_gen(ctx, buffer, &bufObj, func))
+ return NULL;
+ } else {
+ bufObj = _mesa_lookup_bufferobj_err(ctx, buffer, func);
+ if (!bufObj)
+ return NULL;
+ }
- if (!validate_map_buffer_range(ctx, bufObj, offset, length, access,
- "glMapNamedBufferRange"))
+ if (!validate_map_buffer_range(ctx, bufObj, offset, length, access, func))
return NULL;
- return map_buffer_range(ctx, bufObj, offset, length, access,
- "glMapNamedBufferRange");
+ return map_buffer_range(ctx, bufObj, offset, length, access, func);
+}
+
+void * GLAPIENTRY
+_mesa_MapNamedBufferRangeEXT(GLuint buffer, GLintptr offset, GLsizeiptr length,
+ GLbitfield access)
+{
+ return map_named_buffer_range(buffer, offset, length, access, true,
+ "glMapNamedBufferRangeEXT");
+}
+
+void * GLAPIENTRY
+_mesa_MapNamedBufferRange(GLuint buffer, GLintptr offset, GLsizeiptr length,
+ GLbitfield access)
+{
+ return map_named_buffer_range(buffer, offset, length, access, false,
+ "glMapNamedBufferRange");
}
/**
diff --git a/src/mesa/main/bufferobj.h b/src/mesa/main/bufferobj.h
index 6b35d70606f..c3b57ef7fe6 100644
--- a/src/mesa/main/bufferobj.h
+++ b/src/mesa/main/bufferobj.h
@@ -357,6 +357,9 @@ _mesa_MapNamedBufferRange_no_error(GLuint buffer, GLintptr offset,
void * GLAPIENTRY
_mesa_MapNamedBufferRange(GLuint buffer, GLintptr offset, GLsizeiptr length,
GLbitfield access);
+void * GLAPIENTRY
+_mesa_MapNamedBufferRangeEXT(GLuint buffer, GLintptr offset,
+ GLsizeiptr length, GLbitfield access);
void * GLAPIENTRY
_mesa_MapBuffer_no_error(GLenum target, GLenum access);
diff --git a/src/mesa/main/tests/dispatch_sanity.cpp b/src/mesa/main/tests/dispatch_sanity.cpp
index c789a2d513b..8813e945bfc 100644
--- a/src/mesa/main/tests/dispatch_sanity.cpp
+++ b/src/mesa/main/tests/dispatch_sanity.cpp
@@ -1222,7 +1222,7 @@ const struct function common_desktop_functions_possible[] = {
//{ "glGetVertexArrayPointervEXT", 30, -1 },
//{ "glGetVertexArrayIntegeri_vEXT", 30, -1 },
//{ "glGetVertexArrayPointeri_vEXT", 30, -1 },
- //{ "glMapNamedBufferRangeEXT", 30, -1 },
+ { "glMapNamedBufferRangeEXT", 30, -1 },
//{ "glFlushMappedNamedBufferRangeEXT", 30, -1 },
/* GL_ARB_internalformat_query */