summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/bufferobj.c
diff options
context:
space:
mode:
authorTimothy Arceri <[email protected]>2017-05-12 16:43:30 +1000
committerTimothy Arceri <[email protected]>2017-05-17 10:12:03 +1000
commitcdbfb19420cc48c5d9fe2c88ff9b29da6b407401 (patch)
treedc00967958157d753d201b8d72eab170ca038276 /src/mesa/main/bufferobj.c
parent09687c228243cda6d53e75e3d02b679e7dcd0062 (diff)
mesa: add KHR_no_error support for glNamedBufferStorage()
Reviewed-by: Nicolai Hähnle <[email protected]>
Diffstat (limited to 'src/mesa/main/bufferobj.c')
-rw-r--r--src/mesa/main/bufferobj.c31
1 files changed, 24 insertions, 7 deletions
diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c
index 4afa2ee6779..09ef233a835 100644
--- a/src/mesa/main/bufferobj.c
+++ b/src/mesa/main/bufferobj.c
@@ -1595,22 +1595,26 @@ buffer_storage(struct gl_context *ctx, struct gl_buffer_object *bufObj,
static ALWAYS_INLINE void
inlined_buffer_storage(GLenum target, GLuint buffer, GLsizeiptr size,
const GLvoid *data, GLbitfield flags, bool dsa,
- const char *func)
+ 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_storage(ctx, bufObj, size, flags, func))
+ if (no_error || validate_buffer_storage(ctx, bufObj, size, flags, func))
buffer_storage(ctx, bufObj, target, size, data, flags, func);
}
@@ -1619,10 +1623,23 @@ void GLAPIENTRY
_mesa_BufferStorage(GLenum target, GLsizeiptr size, const GLvoid *data,
GLbitfield flags)
{
- inlined_buffer_storage(target, 0, size, data, flags, false,
+ inlined_buffer_storage(target, 0, size, data, flags, false, false,
"glBufferStorage");
}
+
+void GLAPIENTRY
+_mesa_NamedBufferStorage_no_error(GLuint buffer, GLsizeiptr size,
+ const GLvoid *data, GLbitfield flags)
+{
+ /* In direct state access, buffer objects have an unspecified target
+ * since they are not required to be bound.
+ */
+ inlined_buffer_storage(GL_NONE, buffer, size, data, flags, true, true,
+ "glNamedBufferStorage");
+}
+
+
void GLAPIENTRY
_mesa_NamedBufferStorage(GLuint buffer, GLsizeiptr size, const GLvoid *data,
GLbitfield flags)
@@ -1630,7 +1647,7 @@ _mesa_NamedBufferStorage(GLuint buffer, GLsizeiptr size, const GLvoid *data,
/* In direct state access, buffer objects have an unspecified target
* since they are not required to be bound.
*/
- inlined_buffer_storage(GL_NONE, buffer, size, data, flags, true,
+ inlined_buffer_storage(GL_NONE, buffer, size, data, flags, true, false,
"glNamedBufferStorage");
}