<div dir="ltr">This is NamedBufferStorage, not NamedBufferData. The storage function uses a bitfield instead of an enum.<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Feb 18, 2015 at 7:04 AM, Martin Peres <span dir="ltr"><<a href="mailto:martin.peres@linux.intel.com" target="_blank">martin.peres@linux.intel.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On 12/02/15 04:05, Laura Ekstrand wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
---<br>
src/mapi/glapi/gen/ARB_direct_<u></u>state_access.xml | 7 +++<br>
src/mesa/main/bufferobj.c | 63 +++++++++++++++++++-------<br>
src/mesa/main/bufferobj.h | 9 ++++<br>
src/mesa/main/tests/dispatch_<u></u>sanity.cpp | 1 +<br>
4 files changed, 64 insertions(+), 16 deletions(-)<br>
<br>
diff --git a/src/mapi/glapi/gen/ARB_<u></u>direct_state_access.xml b/src/mapi/glapi/gen/ARB_<u></u>direct_state_access.xml<br>
index 6c9d0e8..ff81c21 100644<br>
--- a/src/mapi/glapi/gen/ARB_<u></u>direct_state_access.xml<br>
+++ b/src/mapi/glapi/gen/ARB_<u></u>direct_state_access.xml<br>
@@ -14,6 +14,13 @@<br>
<param name="buffers" type="GLuint *" /><br>
</function><br>
+ <function name="NamedBufferStorage" offset="assign"><br>
+ <param name="buffer" type="GLuint" /><br>
+ <param name="size" type="GLsizeiptr" /><br>
+ <param name="data" type="const GLvoid *" /><br>
+ <param name="flags" type="GLbitfield" /><br>
</blockquote></span>
Isn't this supposed to be an enum? Here is the prototype found in core 4.5:<br>
void NamedBufferData( uint buffer, sizeiptr size, const void *data, enum usage );<br>
<br>
Other than that, this looks good to me.<br>
<br>
Reviewed-by: Martin Peres <<a href="mailto:martin.peres@linux.intel.com" target="_blank">martin.peres@linux.intel.com</a>><div class="HOEnZb"><div class="h5"><br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+ </function><br>
+<br>
<!-- Texture object functions --><br>
<function name="CreateTextures" offset="assign"><br>
diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c<br>
index 785f0ff..6259db1 100644<br>
--- a/src/mesa/main/bufferobj.c<br>
+++ b/src/mesa/main/bufferobj.c<br>
@@ -1386,15 +1386,13 @@ _mesa_IsBuffer(GLuint id)<br>
}<br>
-void GLAPIENTRY<br>
-_mesa_BufferStorage(GLenum target, GLsizeiptr size, const GLvoid *data,<br>
- GLbitfield flags)<br>
+void<br>
+_mesa_buffer_storage(struct gl_context *ctx, struct gl_buffer_object *bufObj,<br>
+ GLenum target, GLsizeiptr size, const GLvoid *data,<br>
+ GLbitfield flags, const char *func)<br>
{<br>
- GET_CURRENT_CONTEXT(ctx);<br>
- struct gl_buffer_object *bufObj;<br>
-<br>
if (size <= 0) {<br>
- _mesa_error(ctx, GL_INVALID_VALUE, "glBufferStorage(size <= 0)");<br>
+ _mesa_error(ctx, GL_INVALID_VALUE, "%s(size <= 0)", func);<br>
return;<br>
}<br>
@@ -1404,27 +1402,25 @@ _mesa_BufferStorage(GLenum target, GLsizeiptr size, const GLvoid *data,<br>
GL_MAP_COHERENT_BIT |<br>
GL_DYNAMIC_STORAGE_BIT |<br>
GL_CLIENT_STORAGE_BIT)) {<br>
- _mesa_error(ctx, GL_INVALID_VALUE, "glBufferStorage(flags)");<br>
+ _mesa_error(ctx, GL_INVALID_VALUE, "%s(invalid flag bits set)", func);<br>
return;<br>
}<br>
if (flags & GL_MAP_PERSISTENT_BIT &&<br>
!(flags & (GL_MAP_READ_BIT | GL_MAP_WRITE_BIT))) {<br>
- _mesa_error(ctx, GL_INVALID_VALUE, "glBufferStorage(flags!=READ/<u></u>WRITE)");<br>
+ _mesa_error(ctx, GL_INVALID_VALUE,<br>
+ "%s(PERSISTENT and flags!=READ/WRITE)", func);<br>
return;<br>
}<br>
if (flags & GL_MAP_COHERENT_BIT && !(flags & GL_MAP_PERSISTENT_BIT)) {<br>
- _mesa_error(ctx, GL_INVALID_VALUE, "glBufferStorage(flags!=<u></u>PERSISTENT)");<br>
+ _mesa_error(ctx, GL_INVALID_VALUE,<br>
+ "%s(COHERENT and flags!=PERSISTENT)", func);<br>
return;<br>
}<br>
- bufObj = get_buffer(ctx, "glBufferStorage", target, GL_INVALID_OPERATION);<br>
- if (!bufObj)<br>
- return;<br>
-<br>
if (bufObj->Immutable) {<br>
- _mesa_error(ctx, GL_INVALID_OPERATION, "glBufferStorage(immutable)");<br>
+ _mesa_error(ctx, GL_INVALID_OPERATION, "%s(immutable)", func);<br>
return;<br>
}<br>
@@ -1439,10 +1435,45 @@ _mesa_BufferStorage(GLenum target, GLsizeiptr size, const GLvoid *data,<br>
ASSERT(ctx->Driver.BufferData)<u></u>;<br>
if (!ctx->Driver.BufferData(ctx, target, size, data, GL_DYNAMIC_DRAW,<br>
flags, bufObj)) {<br>
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glBufferStorage()");<br>
+ _mesa_error(ctx, GL_OUT_OF_MEMORY, "%s()", func);<br>
}<br>
}<br>
+void GLAPIENTRY<br>
+_mesa_BufferStorage(GLenum target, GLsizeiptr size, const GLvoid *data,<br>
+ GLbitfield flags)<br>
+{<br>
+ GET_CURRENT_CONTEXT(ctx);<br>
+ struct gl_buffer_object *bufObj;<br>
+<br>
+ bufObj = get_buffer(ctx, "glBufferStorage", target, GL_INVALID_OPERATION);<br>
+ if (!bufObj)<br>
+ return;<br>
+<br>
+ _mesa_buffer_storage(ctx, bufObj, target, size, data, flags,<br>
+ "glBufferStorage");<br>
+}<br>
+<br>
+void GLAPIENTRY<br>
+_mesa_NamedBufferStorage(<u></u>GLuint buffer, GLsizeiptr size, const GLvoid *data,<br>
+ GLbitfield flags)<br>
+{<br>
+ GET_CURRENT_CONTEXT(ctx);<br>
+ struct gl_buffer_object *bufObj;<br>
+<br>
+ bufObj = _mesa_lookup_bufferobj_err(<u></u>ctx, buffer, "glNamedBufferStorage");<br>
+ if (!bufObj)<br>
+ return;<br>
+<br>
+ /*<br>
+ * In direct state access, buffer objects have an unspecified target since<br>
+ * they are not required to be bound.<br>
+ */<br>
+ _mesa_buffer_storage(ctx, bufObj, GL_NONE, size, data, flags,<br>
+ "glNamedBufferStorage");<br>
+}<br>
+<br>
+<br>
void GLAPIENTRY<br>
_mesa_BufferData(GLenum target, GLsizeiptrARB size,<br>
diff --git a/src/mesa/main/bufferobj.h b/src/mesa/main/bufferobj.h<br>
index 48d253b..3c337aa 100644<br>
--- a/src/mesa/main/bufferobj.h<br>
+++ b/src/mesa/main/bufferobj.h<br>
@@ -130,6 +130,11 @@ extern void<br>
_mesa_init_buffer_object_<u></u>functions(struct dd_function_table *driver);<br>
extern void<br>
+_mesa_buffer_storage(struct gl_context *ctx, struct gl_buffer_object *bufObj,<br>
+ GLenum target, GLsizeiptr size, const GLvoid *data,<br>
+ GLbitfield flags, const char *func);<br>
+<br>
+extern void<br>
_mesa_buffer_unmap_all_<u></u>mappings(struct gl_context *ctx,<br>
struct gl_buffer_object *bufObj);<br>
@@ -163,6 +168,10 @@ _mesa_BufferStorage(GLenum target, GLsizeiptr size, const GLvoid *data,<br>
GLbitfield flags);<br>
void GLAPIENTRY<br>
+_mesa_NamedBufferStorage(<u></u>GLuint buffer, GLsizeiptr size, const GLvoid *data,<br>
+ GLbitfield flags);<br>
+<br>
+void GLAPIENTRY<br>
_mesa_BufferData(GLenum target, GLsizeiptrARB size,<br>
const GLvoid * data, GLenum usage);<br>
diff --git a/src/mesa/main/tests/<u></u>dispatch_sanity.cpp b/src/mesa/main/tests/<u></u>dispatch_sanity.cpp<br>
index aa33702..9f663be 100644<br>
--- a/src/mesa/main/tests/<u></u>dispatch_sanity.cpp<br>
+++ b/src/mesa/main/tests/<u></u>dispatch_sanity.cpp<br>
@@ -956,6 +956,7 @@ const struct function gl_core_functions_possible[] = {<br>
/* GL_ARB_direct_state_access */<br>
{ "glCreateBuffers", 45, -1 },<br>
+ { "glNamedBufferStorage", 45, -1 },<br>
{ "glCreateTextures", 45, -1 },<br>
{ "glTextureStorage1D", 45, -1 },<br>
{ "glTextureStorage2D", 45, -1 },<br>
</blockquote>
<br>
</div></div></blockquote></div><br></div>