[Mesa-dev] [PATCH 03/18] mesa: add KHR_no_error support for some map buffer functions
Timothy Arceri
tarceri at itsqueeze.com
Thu May 4 07:41:28 UTC 2017
---
src/mapi/glapi/gen/ARB_direct_state_access.xml | 4 +-
src/mapi/glapi/gen/ARB_map_buffer_range.xml | 2 +-
src/mapi/glapi/gen/gl_API.xml | 2 +-
src/mesa/main/bufferobj.c | 53 ++++++++++++++++++++++++++
src/mesa/main/bufferobj.h | 10 +++++
5 files changed, 67 insertions(+), 4 deletions(-)
diff --git a/src/mapi/glapi/gen/ARB_direct_state_access.xml b/src/mapi/glapi/gen/ARB_direct_state_access.xml
index 43841bb..b147e72 100644
--- a/src/mapi/glapi/gen/ARB_direct_state_access.xml
+++ b/src/mapi/glapi/gen/ARB_direct_state_access.xml
@@ -94,27 +94,27 @@
<function name="ClearNamedBufferSubData">
<param name="buffer" type="GLuint" />
<param name="internalformat" type="GLenum" />
<param name="offset" type="GLintptr" />
<param name="size" type="GLsizeiptr" />
<param name="format" type="GLenum" />
<param name="type" type="GLenum" />
<param name="data" type="const GLvoid *" />
</function>
- <function name="MapNamedBuffer">
+ <function name="MapNamedBuffer" no_error="true">
<return type="GLvoid *" />
<param name="buffer" type="GLuint" />
<param name="access" type="GLenum" />
</function>
- <function name="MapNamedBufferRange">
+ <function name="MapNamedBufferRange" no_error="true">
<return type="GLvoid *" />
<param name="buffer" type="GLuint" />
<param name="offset" type="GLintptr" />
<param name="length" type="GLsizeiptr" />
<param name="access" type="GLbitfield" />
</function>
<function name="UnmapNamedBuffer">
<return type="GLboolean" />
<param name="buffer" type="GLuint" />
diff --git a/src/mapi/glapi/gen/ARB_map_buffer_range.xml b/src/mapi/glapi/gen/ARB_map_buffer_range.xml
index cf7b211..b79b70a 100644
--- a/src/mapi/glapi/gen/ARB_map_buffer_range.xml
+++ b/src/mapi/glapi/gen/ARB_map_buffer_range.xml
@@ -8,21 +8,21 @@
<category name="GL_ARB_map_buffer_range" number="50">
<enum name="MAP_READ_BIT" value="0x0001"/>
<enum name="MAP_WRITE_BIT" value="0x0002"/>
<enum name="MAP_INVALIDATE_RANGE_BIT" value="0x0004"/>
<enum name="MAP_INVALIDATE_BUFFER_BIT" value="0x0008"/>
<enum name="MAP_FLUSH_EXPLICIT_BIT" value="0x0010"/>
<enum name="MAP_UNSYNCHRONIZED_BIT" value="0x0020"/>
- <function name="MapBufferRange" es2="3.0">
+ <function name="MapBufferRange" es2="3.0" no_error="true">
<param name="target" type="GLenum"/>
<param name="offset" type="GLintptr"/>
<param name="length" type="GLsizeiptr"/>
<param name="access" type="GLbitfield"/>
<return type="GLvoid *"/>
</function>
<function name="FlushMappedBufferRange" es2="3.0">
<param name="target" type="GLenum"/>
<param name="offset" type="GLintptr"/>
diff --git a/src/mapi/glapi/gen/gl_API.xml b/src/mapi/glapi/gen/gl_API.xml
index c271887..a10da02 100644
--- a/src/mapi/glapi/gen/gl_API.xml
+++ b/src/mapi/glapi/gen/gl_API.xml
@@ -5090,21 +5090,21 @@
<param name="data" type="GLvoid *" output="true" count="size"/>
<glx ignore="true"/>
</function>
<function name="IsBuffer" es1="1.1" es2="2.0">
<param name="buffer" type="GLuint"/>
<return type="GLboolean"/>
<glx ignore="true"/>
</function>
- <function name="MapBuffer">
+ <function name="MapBuffer" no_error="true">
<param name="target" type="GLenum"/>
<param name="access" type="GLenum"/>
<return type="GLvoid *"/>
<glx ignore="true"/>
</function>
<function name="UnmapBuffer" es2="3.0">
<param name="target" type="GLenum"/>
<return type="GLboolean"/>
<glx ignore="true"/>
diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c
index 797b6fb..d1726d6 100644
--- a/src/mesa/main/bufferobj.c
+++ b/src/mesa/main/bufferobj.c
@@ -2569,20 +2569,33 @@ map_buffer_range(struct gl_context *ctx, struct gl_buffer_object *bufObj,
for (i = 0; i < 100; i++) {
buf[bufObj->Size - i - 1] = 123;
}
}
#endif
return map;
}
void * GLAPIENTRY
+_mesa_MapBufferRange_no_error(GLenum target, GLintptr offset,
+ GLsizeiptr length, GLbitfield access)
+{
+ GET_CURRENT_CONTEXT(ctx);
+
+ struct gl_buffer_object **bufObjPtr = get_buffer_target(ctx, target);
+ struct gl_buffer_object *bufObj = *bufObjPtr;
+
+ return map_buffer_range(ctx, bufObj, offset, length, access,
+ "glMapBufferRange");
+}
+
+void * GLAPIENTRY
_mesa_MapBufferRange(GLenum target, GLintptr offset, GLsizeiptr length,
GLbitfield access)
{
GET_CURRENT_CONTEXT(ctx);
struct gl_buffer_object *bufObj;
if (!ctx->Extensions.ARB_map_buffer_range) {
_mesa_error(ctx, GL_INVALID_OPERATION,
"glMapBufferRange(ARB_map_buffer_range not supported)");
return NULL;
@@ -2594,20 +2607,31 @@ _mesa_MapBufferRange(GLenum target, GLintptr offset, GLsizeiptr length,
if (!validate_map_buffer_range(ctx, bufObj, offset, length, access,
"glMapBufferRange"))
return NULL;
return map_buffer_range(ctx, bufObj, offset, length, access,
"glMapBufferRange");
}
void * GLAPIENTRY
+_mesa_MapNamedBufferRange_no_error(GLuint buffer, GLintptr offset,
+ GLsizeiptr length, GLbitfield access)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ struct gl_buffer_object *bufObj = _mesa_lookup_bufferobj(ctx, buffer);
+
+ return map_buffer_range(ctx, bufObj, offset, length, access,
+ "glMapNamedBufferRange");
+}
+
+void * GLAPIENTRY
_mesa_MapNamedBufferRange(GLuint buffer, GLintptr offset, GLsizeiptr length,
GLbitfield access)
{
GET_CURRENT_CONTEXT(ctx);
struct gl_buffer_object *bufObj;
if (!ctx->Extensions.ARB_map_buffer_range) {
_mesa_error(ctx, GL_INVALID_OPERATION,
"glMapNamedBufferRange("
"ARB_map_buffer_range not supported)");
@@ -2645,20 +2669,35 @@ get_map_buffer_access_flags(struct gl_context *ctx, GLenum access,
return true;
case GL_READ_WRITE_ARB:
*flags = GL_MAP_READ_BIT | GL_MAP_WRITE_BIT;
return _mesa_is_desktop_gl(ctx);
default:
return false;
}
}
void * GLAPIENTRY
+_mesa_MapBuffer_no_error(GLenum target, GLenum access)
+{
+ GET_CURRENT_CONTEXT(ctx);
+
+ GLbitfield accessFlags;
+ get_map_buffer_access_flags(ctx, access, &accessFlags);
+
+ struct gl_buffer_object **bufObjPtr = get_buffer_target(ctx, target);
+ struct gl_buffer_object *bufObj = *bufObjPtr;
+
+ return map_buffer_range(ctx, bufObj, 0, bufObj->Size, accessFlags,
+ "glMapBuffer");
+}
+
+void * GLAPIENTRY
_mesa_MapBuffer(GLenum target, GLenum access)
{
GET_CURRENT_CONTEXT(ctx);
struct gl_buffer_object *bufObj;
GLbitfield accessFlags;
if (!get_map_buffer_access_flags(ctx, access, &accessFlags)) {
_mesa_error(ctx, GL_INVALID_ENUM, "glMapBuffer(invalid access)");
return NULL;
}
@@ -2669,20 +2708,34 @@ _mesa_MapBuffer(GLenum target, GLenum access)
if (!validate_map_buffer_range(ctx, bufObj, 0, bufObj->Size, accessFlags,
"glMapBuffer"))
return NULL;
return map_buffer_range(ctx, bufObj, 0, bufObj->Size, accessFlags,
"glMapBuffer");
}
void * GLAPIENTRY
+_mesa_MapNamedBuffer_no_error(GLuint buffer, GLenum access)
+{
+ GET_CURRENT_CONTEXT(ctx);
+
+ GLbitfield accessFlags;
+ get_map_buffer_access_flags(ctx, access, &accessFlags);
+
+ struct gl_buffer_object *bufObj = _mesa_lookup_bufferobj(ctx, buffer);
+
+ return map_buffer_range(ctx, bufObj, 0, bufObj->Size, accessFlags,
+ "glMapNamedBuffer");
+}
+
+void * GLAPIENTRY
_mesa_MapNamedBuffer(GLuint buffer, GLenum access)
{
GET_CURRENT_CONTEXT(ctx);
struct gl_buffer_object *bufObj;
GLbitfield accessFlags;
if (!get_map_buffer_access_flags(ctx, access, &accessFlags)) {
_mesa_error(ctx, GL_INVALID_ENUM, "glMapNamedBuffer(invalid access)");
return NULL;
}
diff --git a/src/mesa/main/bufferobj.h b/src/mesa/main/bufferobj.h
index f9d8874..f95e31a 100644
--- a/src/mesa/main/bufferobj.h
+++ b/src/mesa/main/bufferobj.h
@@ -286,31 +286,41 @@ void GLAPIENTRY
_mesa_CopyBufferSubData(GLenum readTarget, GLenum writeTarget,
GLintptr readOffset, GLintptr writeOffset,
GLsizeiptr size);
void GLAPIENTRY
_mesa_CopyNamedBufferSubData(GLuint readBuffer, GLuint writeBuffer,
GLintptr readOffset, GLintptr writeOffset,
GLsizeiptr size);
void * GLAPIENTRY
+_mesa_MapBufferRange_no_error(GLenum target, GLintptr offset,
+ GLsizeiptr length, GLbitfield access);
+void * GLAPIENTRY
_mesa_MapBufferRange(GLenum target, GLintptr offset, GLsizeiptr length,
GLbitfield access);
void * GLAPIENTRY
+_mesa_MapNamedBufferRange_no_error(GLuint buffer, GLintptr offset,
+ GLsizeiptr length, GLbitfield access);
+void * GLAPIENTRY
_mesa_MapNamedBufferRange(GLuint buffer, GLintptr offset, GLsizeiptr length,
GLbitfield access);
void * GLAPIENTRY
+_mesa_MapBuffer_no_error(GLenum target, GLenum access);
+void * GLAPIENTRY
_mesa_MapBuffer(GLenum target, GLenum access);
void * GLAPIENTRY
+_mesa_MapNamedBuffer_no_error(GLuint buffer, GLenum access);
+void * GLAPIENTRY
_mesa_MapNamedBuffer(GLuint buffer, GLenum access);
void GLAPIENTRY
_mesa_FlushMappedBufferRange(GLenum target,
GLintptr offset, GLsizeiptr length);
void GLAPIENTRY
_mesa_FlushMappedNamedBufferRange(GLuint buffer, GLintptr offset,
GLsizeiptr length);
--
2.9.3
More information about the mesa-dev
mailing list