[Mesa-dev] [PATCH 06/18] mesa: add KHR_no_error support for unmap buffer functions

Timothy Arceri tarceri at itsqueeze.com
Thu May 4 07:41:31 UTC 2017


---
 src/mapi/glapi/gen/ARB_direct_state_access.xml |  2 +-
 src/mapi/glapi/gen/gl_API.xml                  |  2 +-
 src/mesa/main/bufferobj.c                      | 19 +++++++++++++++++++
 src/mesa/main/bufferobj.h                      |  4 ++++
 4 files changed, 25 insertions(+), 2 deletions(-)

diff --git a/src/mapi/glapi/gen/ARB_direct_state_access.xml b/src/mapi/glapi/gen/ARB_direct_state_access.xml
index b147e72..fe5a7e9 100644
--- a/src/mapi/glapi/gen/ARB_direct_state_access.xml
+++ b/src/mapi/glapi/gen/ARB_direct_state_access.xml
@@ -108,21 +108,21 @@
    </function>
 
    <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">
+   <function name="UnmapNamedBuffer" no_error="true">
       <return type="GLboolean" />
       <param name="buffer" type="GLuint" />
    </function>
 
    <function name="FlushMappedNamedBufferRange">
       <param name="buffer" type="GLuint" />
       <param name="offset" type="GLintptr" />
       <param name="length" type="GLsizeiptr" />
    </function>
 
diff --git a/src/mapi/glapi/gen/gl_API.xml b/src/mapi/glapi/gen/gl_API.xml
index a10da02..50d60f5 100644
--- a/src/mapi/glapi/gen/gl_API.xml
+++ b/src/mapi/glapi/gen/gl_API.xml
@@ -5097,21 +5097,21 @@
         <glx ignore="true"/>
     </function>
 
     <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">
+    <function name="UnmapBuffer" es2="3.0" no_error="true">
         <param name="target" type="GLenum"/>
         <return type="GLboolean"/>
         <glx ignore="true"/>
     </function>
 
     <function name="GenQueries" es2="3.0">
         <param name="n" type="GLsizei" counter="true"/>
         <param name="ids" type="GLuint *" output="true" count="n"/>
         <glx sop="162" always_array="true"/>
     </function>
diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c
index 0fdb623..6fa32e9 100644
--- a/src/mesa/main/bufferobj.c
+++ b/src/mesa/main/bufferobj.c
@@ -2060,33 +2060,52 @@ validate_and_unmap_buffer(struct gl_context *ctx,
          printf("glUnmapBufferARB(%u): %u of %ld unchanged, starting at %d\n",
                       bufObj->Name, unchanged, bufObj->Size, pos);
       }
    }
 #endif
 
    return unmap_buffer(ctx, bufObj);
 }
 
 GLboolean GLAPIENTRY
+_mesa_UnmapBuffer_no_error(GLenum target)
+{
+   GET_CURRENT_CONTEXT(ctx);
+   struct gl_buffer_object **bufObjPtr = get_buffer_target(ctx, target);
+   struct gl_buffer_object *bufObj = *bufObjPtr;
+
+   return unmap_buffer(ctx, bufObj);
+}
+
+GLboolean GLAPIENTRY
 _mesa_UnmapBuffer(GLenum target)
 {
    GET_CURRENT_CONTEXT(ctx);
    struct gl_buffer_object *bufObj;
 
    bufObj = get_buffer(ctx, "glUnmapBuffer", target, GL_INVALID_OPERATION);
    if (!bufObj)
       return GL_FALSE;
 
    return validate_and_unmap_buffer(ctx, bufObj, "glUnmapBuffer");
 }
 
 GLboolean GLAPIENTRY
+_mesa_UnmapNamedBuffer_no_error(GLuint buffer)
+{
+   GET_CURRENT_CONTEXT(ctx);
+   struct gl_buffer_object *bufObj = _mesa_lookup_bufferobj(ctx, buffer);
+
+   return unmap_buffer(ctx, bufObj);
+}
+
+GLboolean GLAPIENTRY
 _mesa_UnmapNamedBuffer(GLuint buffer)
 {
    GET_CURRENT_CONTEXT(ctx);
    struct gl_buffer_object *bufObj;
 
    bufObj = _mesa_lookup_bufferobj_err(ctx, buffer, "glUnmapNamedBuffer");
    if (!bufObj)
       return GL_FALSE;
 
    return validate_and_unmap_buffer(ctx, bufObj, "glUnmapNamedBuffer");
diff --git a/src/mesa/main/bufferobj.h b/src/mesa/main/bufferobj.h
index 30e3105..d538d0f 100644
--- a/src/mesa/main/bufferobj.h
+++ b/src/mesa/main/bufferobj.h
@@ -246,23 +246,27 @@ _mesa_ClearBufferSubData(GLenum target, GLenum internalformat,
                          GLenum format, GLenum type,
                          const GLvoid *data);
 
 void GLAPIENTRY
 _mesa_ClearNamedBufferSubData(GLuint buffer, GLenum internalformat,
                               GLintptr offset, GLsizeiptr size,
                               GLenum format, GLenum type,
                               const GLvoid *data);
 
 GLboolean GLAPIENTRY
+_mesa_UnmapBuffer_no_error(GLenum target);
+GLboolean GLAPIENTRY
 _mesa_UnmapBuffer(GLenum target);
 
 GLboolean GLAPIENTRY
+_mesa_UnmapNamedBuffer_no_error(GLuint buffer);
+GLboolean GLAPIENTRY
 _mesa_UnmapNamedBuffer(GLuint buffer);
 
 void GLAPIENTRY
 _mesa_GetBufferParameteriv(GLenum target, GLenum pname, GLint *params);
 
 void GLAPIENTRY
 _mesa_GetBufferParameteri64v(GLenum target, GLenum pname, GLint64 *params);
 
 void GLAPIENTRY
 _mesa_GetNamedBufferParameteriv(GLuint buffer, GLenum pname, GLint *params);
-- 
2.9.3



More information about the mesa-dev mailing list