mesa: add KHR_no_error support for some map buffer functions
authorTimothy Arceri <tarceri@itsqueeze.com>
Thu, 4 May 2017 03:08:57 +0000 (13:08 +1000)
committerTimothy Arceri <tarceri@itsqueeze.com>
Sun, 7 May 2017 05:29:33 +0000 (15:29 +1000)
Reviewed-by: Eric Anholt <eric@anholt.net>
src/mapi/glapi/gen/ARB_direct_state_access.xml
src/mapi/glapi/gen/ARB_map_buffer_range.xml
src/mapi/glapi/gen/gl_API.xml
src/mesa/main/bufferobj.c
src/mesa/main/bufferobj.h

index 43841bb6c060d21303d288f91820d0c9051813fb..b147e7252e0e2494a4260ef43585646ed3f06d07 100644 (file)
       <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" />
index cf7b211482d54e4b22252a641b0c2dd429d5710e..b79b70a308172b6386c3c4a746d704b20875b954 100644 (file)
@@ -15,7 +15,7 @@
     <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"/>
index 83f4c013ee1d79fd853d11ac99ebb43e47d880df..29e4ba43de6deb99bf6b5b0e0b82be85cdaa8e01 100644 (file)
         <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 *"/>
index 797b6fb3069b89b5040e135dad7cf68c84971ff8..d1726d68628b569ac113dacd95097bea51dc7be2 100644 (file)
@@ -2575,6 +2575,19 @@ map_buffer_range(struct gl_context *ctx, struct gl_buffer_object *bufObj,
    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)
@@ -2600,6 +2613,17 @@ _mesa_MapBufferRange(GLenum target, GLintptr offset, GLsizeiptr length,
                            "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)
@@ -2651,6 +2675,21 @@ get_map_buffer_access_flags(struct gl_context *ctx, GLenum access,
    }
 }
 
+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)
 {
@@ -2675,6 +2714,20 @@ _mesa_MapBuffer(GLenum target, GLenum access)
                            "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)
 {
index f9d887465dc0ba1b4044d9a07ffb4a88357be939..f95e31ab107ae53f39cca0602cad02f7bd7f10d8 100644 (file)
@@ -293,16 +293,26 @@ _mesa_CopyNamedBufferSubData(GLuint readBuffer, GLuint writeBuffer,
                              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);