It could have been split in two, but as no changes affect any already-running code,
I do not see any good reason to spend time on splitting this.

Reviewed-by: Martin Peres <martin.pe...@linux.intel.com>

On 12/02/2015 04:05, Laura Ekstrand wrote:
---
  src/mapi/glapi/gen/ARB_direct_state_access.xml | 18 +++++++++++++
  src/mesa/main/bufferobj.c                      | 35 ++++++++++++++++++++++++++
  src/mesa/main/bufferobj.h                      | 11 ++++++++
  src/mesa/main/tests/dispatch_sanity.cpp        |  2 ++
  4 files changed, 66 insertions(+)

diff --git a/src/mapi/glapi/gen/ARB_direct_state_access.xml 
b/src/mapi/glapi/gen/ARB_direct_state_access.xml
index 042b2a8..ce4017b 100644
--- a/src/mapi/glapi/gen/ARB_direct_state_access.xml
+++ b/src/mapi/glapi/gen/ARB_direct_state_access.xml
@@ -43,6 +43,24 @@
        <param name="size" type="GLsizeiptr" />
     </function>
+ <function name="ClearNamedBufferData" offset="assign">
+      <param name="buffer" type="GLuint" />
+      <param name="internalformat" type="GLenum" />
+      <param name="format" type="GLenum" />
+      <param name="type" type="GLenum" />
+      <param name="data" type="const GLvoid *" />
+   </function>
+
+   <function name="ClearNamedBufferSubData" offset="assign">
+      <param name="buffer" type="GLuint" />
+      <param name="internalformat" type="GLenum" />
+      <param name="offset" type="GLintptr" />
+      <param name="size" type="GLsizeiptr" />
+      <param name="format" type="GLenum" />
+      <param name="type" type="GLenum" />
+      <param name="data" type="const GLvoid *" />
+   </function>
+
     <!-- Texture object functions -->
<function name="CreateTextures" offset="assign">
diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c
index b8fa917..bd21c8a 100644
--- a/src/mesa/main/bufferobj.c
+++ b/src/mesa/main/bufferobj.c
@@ -1744,6 +1744,22 @@ _mesa_ClearBufferData(GLenum target, GLenum 
internalformat, GLenum format,
                                 "glClearBufferData", false);
  }
+void GLAPIENTRY
+_mesa_ClearNamedBufferData(GLuint buffer, GLenum internalformat,
+                           GLenum format, GLenum type, const GLvoid *data)
+{
+   GET_CURRENT_CONTEXT(ctx);
+   struct gl_buffer_object *bufObj;
+
+   bufObj = _mesa_lookup_bufferobj_err(ctx, buffer, "glClearNamedBufferData");
+   if (!bufObj)
+      return;
+
+   _mesa_clear_buffer_sub_data(ctx, bufObj, internalformat, 0, bufObj->Size,
+                               format, type, data,
+                               "glClearNamedBufferData", false);
+}
+
void GLAPIENTRY
  _mesa_ClearBufferSubData(GLenum target, GLenum internalformat,
@@ -1763,6 +1779,25 @@ _mesa_ClearBufferSubData(GLenum target, GLenum 
internalformat,
                                 "glClearBufferSubData", true);
  }
+void GLAPIENTRY
+_mesa_ClearNamedBufferSubData(GLuint buffer, GLenum internalformat,
+                              GLintptr offset, GLsizeiptr size,
+                              GLenum format, GLenum type,
+                              const GLvoid *data)
+{
+   GET_CURRENT_CONTEXT(ctx);
+   struct gl_buffer_object *bufObj;
+
+   bufObj = _mesa_lookup_bufferobj_err(ctx, buffer,
+                                       "glClearNamedBufferSubData");
+   if (!bufObj)
+      return;
+
+   _mesa_clear_buffer_sub_data(ctx, bufObj, internalformat, offset, size,
+                               format, type, data,
+                               "glClearNamedBufferSubData", true);
+}
+
void * GLAPIENTRY
  _mesa_MapBuffer(GLenum target, GLenum access)
diff --git a/src/mesa/main/bufferobj.h b/src/mesa/main/bufferobj.h
index 5911270..5254727 100644
--- a/src/mesa/main/bufferobj.h
+++ b/src/mesa/main/bufferobj.h
@@ -223,11 +223,22 @@ _mesa_ClearBufferData(GLenum target, GLenum 
internalformat,
                        const GLvoid * data);
void GLAPIENTRY
+_mesa_ClearNamedBufferData(GLuint buffer, GLenum internalformat,
+                           GLenum format, GLenum type,
+                           const GLvoid *data);
+
+void GLAPIENTRY
  _mesa_ClearBufferSubData(GLenum target, GLenum internalformat,
                           GLintptr offset, GLsizeiptr size,
                           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);
+
  void * GLAPIENTRY
  _mesa_MapBuffer(GLenum target, GLenum access);
diff --git a/src/mesa/main/tests/dispatch_sanity.cpp b/src/mesa/main/tests/dispatch_sanity.cpp
index aa8e352..4bd3e10 100644
--- a/src/mesa/main/tests/dispatch_sanity.cpp
+++ b/src/mesa/main/tests/dispatch_sanity.cpp
@@ -960,6 +960,8 @@ const struct function gl_core_functions_possible[] = {
     { "glNamedBufferData", 45, -1 },
     { "glNamedBufferSubData", 45, -1 },
     { "glCopyNamedBufferSubData", 45, -1 },
+   { "glClearNamedBufferData", 45, -1 },
+   { "glClearNamedBufferSubData", 45, -1 },
     { "glCreateTextures", 45, -1 },
     { "glTextureStorage1D", 45, -1 },
     { "glTextureStorage2D", 45, -1 },

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to