mesa: add KHR_no_error support for glNamedBufferSubData()
authorTimothy Arceri <tarceri@itsqueeze.com>
Fri, 12 May 2017 11:29:11 +0000 (21:29 +1000)
committerTimothy Arceri <tarceri@itsqueeze.com>
Wed, 17 May 2017 00:12:03 +0000 (10:12 +1000)
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
src/mapi/glapi/gen/ARB_direct_state_access.xml
src/mesa/main/bufferobj.c
src/mesa/main/bufferobj.h

index fa375e0e7a22cdd3ef7ce1b7b9b86e63b14f7f59..b8780f75b35bf8d1ff9cd2a7b7ff32cc24602380 100644 (file)
@@ -68,7 +68,7 @@
       <param name="usage" type="GLenum" />
    </function>
 
-   <function name="NamedBufferSubData">
+   <function name="NamedBufferSubData" no_error="true">
       <param name="buffer" type="GLuint" />
       <param name="offset" type="GLintptr" />
       <param name="size" type="GLsizeiptr" />
index e53adb32d30d76a398e17999ad5cbb214f1f1642..3e903cb3c29eae21849bf3ca8562dc13e682a782 100644 (file)
@@ -1858,22 +1858,26 @@ _mesa_buffer_sub_data(struct gl_context *ctx, struct gl_buffer_object *bufObj,
 static ALWAYS_INLINE void
 buffer_sub_data(GLenum target, GLuint buffer, GLintptr offset,
                 GLsizeiptr size, const GLvoid *data,
-                bool dsa, const char *func)
+                bool dsa, bool no_error, const char *func)
 {
    GET_CURRENT_CONTEXT(ctx);
    struct gl_buffer_object *bufObj;
 
    if (dsa) {
-      bufObj = _mesa_lookup_bufferobj_err(ctx, buffer, func);
-      if (!bufObj)
-         return;
+      if (no_error) {
+         bufObj = _mesa_lookup_bufferobj(ctx, buffer);
+      } else {
+         bufObj = _mesa_lookup_bufferobj_err(ctx, buffer, func);
+         if (!bufObj)
+            return;
+      }
    } else {
       bufObj = get_buffer(ctx, func, target, GL_INVALID_OPERATION);
       if (!bufObj)
          return;
    }
 
-   if (validate_buffer_sub_data(ctx, bufObj, offset, size, func))
+   if (no_error || validate_buffer_sub_data(ctx, bufObj, offset, size, func))
       _mesa_buffer_sub_data(ctx, bufObj, offset, size, data);
 }
 
@@ -1882,14 +1886,23 @@ void GLAPIENTRY
 _mesa_BufferSubData(GLenum target, GLintptr offset,
                     GLsizeiptr size, const GLvoid *data)
 {
-   buffer_sub_data(target, 0, offset, size, data, false, "glBufferSubData");
+   buffer_sub_data(target, 0, offset, size, data, false, false,
+                   "glBufferSubData");
+}
+
+void GLAPIENTRY
+_mesa_NamedBufferSubData_no_error(GLuint buffer, GLintptr offset,
+                                  GLsizeiptr size, const GLvoid *data)
+{
+   buffer_sub_data(0, buffer, offset, size, data, true, true,
+                   "glNamedBufferSubData");
 }
 
 void GLAPIENTRY
 _mesa_NamedBufferSubData(GLuint buffer, GLintptr offset,
                          GLsizeiptr size, const GLvoid *data)
 {
-   buffer_sub_data(0, buffer, offset, size, data, true,
+   buffer_sub_data(0, buffer, offset, size, data, true, false,
                    "glNamedBufferSubData");
 }
 
index a7a9673b85247066e49a290930f048d5ce2f0fc7..b3cfcc0a4a390d48ff603bbed8c537bfa23ad511 100644 (file)
@@ -197,6 +197,9 @@ _mesa_BufferSubData(GLenum target, GLintptr offset,
                     GLsizeiptr size, const GLvoid *data);
 
 void GLAPIENTRY
+_mesa_NamedBufferSubData_no_error(GLuint buffer, GLintptr offset,
+                                  GLsizeiptr size, const GLvoid *data);
+void GLAPIENTRY
 _mesa_NamedBufferSubData(GLuint buffer, GLintptr offset,
                          GLsizeiptr size, const GLvoid *data);