[Mesa-dev] [PATCH 081/101] mesa: add KHR_no_error support to glNamedBufferData() and glBufferData()

Samuel Pitoiset samuel.pitoiset at gmail.com
Fri Jul 21 17:40:30 UTC 2017


Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
---
 src/mapi/glapi/gen/ARB_direct_state_access.xml |  2 +-
 src/mapi/glapi/gen/gl_API.xml                  |  2 +-
 src/mesa/main/bufferobj.c                      | 30 ++++++++++++++++++++++++++
 src/mesa/main/bufferobj.h                      |  8 +++++++
 4 files changed, 40 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 7927a4e1f6..ca2ef76bfe 100644
--- a/src/mapi/glapi/gen/ARB_direct_state_access.xml
+++ b/src/mapi/glapi/gen/ARB_direct_state_access.xml
@@ -61,7 +61,7 @@
       <param name="flags" type="GLbitfield" />
    </function>
 
-   <function name="NamedBufferData" marshal="custom">
+   <function name="NamedBufferData" marshal="custom" no_error="true">
       <param name="buffer" type="GLuint" />
       <param name="size" type="GLsizeiptr" />
       <param name="data" type="const GLvoid *" />
diff --git a/src/mapi/glapi/gen/gl_API.xml b/src/mapi/glapi/gen/gl_API.xml
index 8c4277b984..e1b3c43fb1 100644
--- a/src/mapi/glapi/gen/gl_API.xml
+++ b/src/mapi/glapi/gen/gl_API.xml
@@ -5045,7 +5045,7 @@
         <glx ignore="true"/>
     </function>
 
-    <function name="BufferData" es1="1.1" es2="2.0" marshal="custom">
+    <function name="BufferData" es1="1.1" es2="2.0" marshal="custom" no_error="true">
         <param name="target" type="GLenum"/>
         <param name="size" type="GLsizeiptr" counter="true"/>
         <param name="data" type="const GLvoid *" count="size" img_null_flag="true"/>
diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c
index 17d6eff1ca..c3dc3e779e 100644
--- a/src/mesa/main/bufferobj.c
+++ b/src/mesa/main/bufferobj.c
@@ -1815,6 +1815,14 @@ buffer_data_error(struct gl_context *ctx, struct gl_buffer_object *bufObj,
    buffer_data(ctx, bufObj, target, size, data, usage, func, false);
 }
 
+static void
+buffer_data_no_error(struct gl_context *ctx, struct gl_buffer_object *bufObj,
+                     GLenum target, GLsizeiptr size, const GLvoid *data,
+                     GLenum usage, const char *func)
+{
+   buffer_data(ctx, bufObj, target, size, data, usage, func, true);
+}
+
 void
 _mesa_buffer_data(struct gl_context *ctx, struct gl_buffer_object *bufObj,
                   GLenum target, GLsizeiptr size, const GLvoid *data,
@@ -1824,6 +1832,17 @@ _mesa_buffer_data(struct gl_context *ctx, struct gl_buffer_object *bufObj,
 }
 
 void GLAPIENTRY
+_mesa_BufferData_no_error(GLenum target, GLsizeiptr size, const GLvoid *data,
+                          GLenum usage)
+{
+   GET_CURRENT_CONTEXT(ctx);
+
+   struct gl_buffer_object **bufObj = get_buffer_target(ctx, target);
+   buffer_data_no_error(ctx, *bufObj, target, size, data, usage,
+                        "glBufferData");
+}
+
+void GLAPIENTRY
 _mesa_BufferData(GLenum target, GLsizeiptr size,
                  const GLvoid *data, GLenum usage)
 {
@@ -1839,6 +1858,17 @@ _mesa_BufferData(GLenum target, GLsizeiptr size,
 }
 
 void GLAPIENTRY
+_mesa_NamedBufferData_no_error(GLuint buffer, GLsizeiptr size,
+                               const GLvoid *data, GLenum usage)
+{
+   GET_CURRENT_CONTEXT(ctx);
+
+   struct gl_buffer_object *bufObj = _mesa_lookup_bufferobj(ctx, buffer);
+   buffer_data_no_error(ctx, bufObj, GL_NONE, size, data, usage,
+                        "glNamedBufferData");
+}
+
+void GLAPIENTRY
 _mesa_NamedBufferData(GLuint buffer, GLsizeiptr size, const GLvoid *data,
                       GLenum usage)
 {
diff --git a/src/mesa/main/bufferobj.h b/src/mesa/main/bufferobj.h
index 69e8549818..19f935d1be 100644
--- a/src/mesa/main/bufferobj.h
+++ b/src/mesa/main/bufferobj.h
@@ -197,10 +197,18 @@ _mesa_NamedBufferStorage(GLuint buffer, GLsizeiptr size, const GLvoid *data,
                          GLbitfield flags);
 
 void GLAPIENTRY
+_mesa_BufferData_no_error(GLenum target, GLsizeiptr size,
+                          const GLvoid *data, GLenum usage);
+
+void GLAPIENTRY
 _mesa_BufferData(GLenum target, GLsizeiptr size,
                  const GLvoid *data, GLenum usage);
 
 void GLAPIENTRY
+_mesa_NamedBufferData_no_error(GLuint buffer, GLsizeiptr size,
+                               const GLvoid *data, GLenum usage);
+
+void GLAPIENTRY
 _mesa_NamedBufferData(GLuint buffer, GLsizeiptr size,
                       const GLvoid *data, GLenum usage);
 
-- 
2.13.3



More information about the mesa-dev mailing list