[Mesa-dev] [PATCH 08/18] mesa: add KHR_no_error support for flush mapped buffer functions
Timothy Arceri
tarceri at itsqueeze.com
Thu May 4 07:41:33 UTC 2017
---
src/mapi/glapi/gen/ARB_direct_state_access.xml | 2 +-
src/mapi/glapi/gen/ARB_map_buffer_range.xml | 2 +-
src/mesa/main/bufferobj.c | 25 +++++++++++++++++++++++++
src/mesa/main/bufferobj.h | 7 ++++++-
4 files changed, 33 insertions(+), 3 deletions(-)
diff --git a/src/mapi/glapi/gen/ARB_direct_state_access.xml b/src/mapi/glapi/gen/ARB_direct_state_access.xml
index fe5a7e9..03f6c8b 100644
--- a/src/mapi/glapi/gen/ARB_direct_state_access.xml
+++ b/src/mapi/glapi/gen/ARB_direct_state_access.xml
@@ -113,21 +113,21 @@
<param name="offset" type="GLintptr" />
<param name="length" type="GLsizeiptr" />
<param name="access" type="GLbitfield" />
</function>
<function name="UnmapNamedBuffer" no_error="true">
<return type="GLboolean" />
<param name="buffer" type="GLuint" />
</function>
- <function name="FlushMappedNamedBufferRange">
+ <function name="FlushMappedNamedBufferRange" no_error="true">
<param name="buffer" type="GLuint" />
<param name="offset" type="GLintptr" />
<param name="length" type="GLsizeiptr" />
</function>
<function name="GetNamedBufferParameteriv">
<param name="buffer" type="GLuint" />
<param name="pname" type="GLenum" />
<param name="params" type="GLint *" />
</function>
diff --git a/src/mapi/glapi/gen/ARB_map_buffer_range.xml b/src/mapi/glapi/gen/ARB_map_buffer_range.xml
index b79b70a..35a20be 100644
--- a/src/mapi/glapi/gen/ARB_map_buffer_range.xml
+++ b/src/mapi/glapi/gen/ARB_map_buffer_range.xml
@@ -16,19 +16,19 @@
<enum name="MAP_UNSYNCHRONIZED_BIT" value="0x0020"/>
<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">
+ <function name="FlushMappedBufferRange" es2="3.0" no_error="true">
<param name="target" type="GLenum"/>
<param name="offset" type="GLintptr"/>
<param name="length" type="GLsizeiptr"/>
</function>
</category>
</OpenGLAPI>
diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c
index 75526b5..9e96f31 100644
--- a/src/mesa/main/bufferobj.c
+++ b/src/mesa/main/bufferobj.c
@@ -2824,36 +2824,61 @@ flush_mapped_buffer_range(struct gl_context *ctx,
}
assert(bufObj->Mappings[MAP_USER].AccessFlags & GL_MAP_WRITE_BIT);
if (ctx->Driver.FlushMappedBufferRange)
ctx->Driver.FlushMappedBufferRange(ctx, offset, length, bufObj,
MAP_USER);
}
void GLAPIENTRY
+_mesa_FlushMappedBufferRange_no_error(GLenum target, GLintptr offset,
+ GLsizeiptr length)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ struct gl_buffer_object **bufObjPtr = get_buffer_target(ctx, target);
+ struct gl_buffer_object *bufObj = *bufObjPtr;
+
+ if (ctx->Driver.FlushMappedBufferRange)
+ ctx->Driver.FlushMappedBufferRange(ctx, offset, length, bufObj,
+ MAP_USER);
+}
+
+void GLAPIENTRY
_mesa_FlushMappedBufferRange(GLenum target, GLintptr offset,
GLsizeiptr length)
{
GET_CURRENT_CONTEXT(ctx);
struct gl_buffer_object *bufObj;
bufObj = get_buffer(ctx, "glFlushMappedBufferRange", target,
GL_INVALID_OPERATION);
if (!bufObj)
return;
flush_mapped_buffer_range(ctx, bufObj, offset, length,
"glFlushMappedBufferRange");
}
void GLAPIENTRY
+_mesa_FlushMappedNamedBufferRange_no_error(GLuint buffer, GLintptr offset,
+ GLsizeiptr length)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ struct gl_buffer_object *bufObj = _mesa_lookup_bufferobj(ctx, buffer);
+
+ if (ctx->Driver.FlushMappedBufferRange)
+ ctx->Driver.FlushMappedBufferRange(ctx, offset, length, bufObj,
+ MAP_USER);
+}
+
+void GLAPIENTRY
_mesa_FlushMappedNamedBufferRange(GLuint buffer, GLintptr offset,
GLsizeiptr length)
{
GET_CURRENT_CONTEXT(ctx);
struct gl_buffer_object *bufObj;
bufObj = _mesa_lookup_bufferobj_err(ctx, buffer,
"glFlushMappedNamedBufferRange");
if (!bufObj)
return;
diff --git a/src/mesa/main/bufferobj.h b/src/mesa/main/bufferobj.h
index 44fcaaa..c7c89a9 100644
--- a/src/mesa/main/bufferobj.h
+++ b/src/mesa/main/bufferobj.h
@@ -303,26 +303,31 @@ _mesa_MapNamedBufferRange(GLuint buffer, GLintptr offset, GLsizeiptr length,
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_no_error(GLenum target, GLintptr offset,
+ GLsizeiptr length);
void GLAPIENTRY
_mesa_FlushMappedBufferRange(GLenum target,
GLintptr offset, GLsizeiptr length);
void GLAPIENTRY
+_mesa_FlushMappedNamedBufferRange_no_error(GLuint buffer, GLintptr offset,
+ GLsizeiptr length);
+void GLAPIENTRY
_mesa_FlushMappedNamedBufferRange(GLuint buffer, GLintptr offset,
GLsizeiptr length);
void GLAPIENTRY
_mesa_BindBufferRange(GLenum target, GLuint index,
GLuint buffer, GLintptr offset, GLsizeiptr size);
void GLAPIENTRY
_mesa_BindBufferBase(GLenum target, GLuint index, GLuint buffer);
--
2.9.3
More information about the mesa-dev
mailing list