+ */
+ if (!no_error && memory == 0) {
+ _mesa_error(ctx, GL_INVALID_VALUE, "%s(memory == 0)", func);
+ }
+
+ memObj = _mesa_lookup_memory_object(ctx, memory);
+ if (!memObj)
+ return;
+
+ /* From the EXT_external_objects spec:
+ *
+ * "An INVALID_OPERATION error is generated if <memory> names a
+ * valid memory object which has no associated memory."
+ */
+ if (!no_error && !memObj->Immutable) {
+ _mesa_error(ctx, GL_INVALID_OPERATION, "%s(no associated
memory)",
+ func);
+ return;
+ }
+ }
if (dsa) {
if (no_error) {
bufObj = _mesa_lookup_bufferobj(ctx, buffer);
} else {
bufObj = _mesa_lookup_bufferobj_err(ctx, buffer, func);
if (!bufObj)
return;
}
} else {
@@ -1870,94 +1912,98 @@ inlined_buffer_storage(GLenum target, GLuint
buffer, GLsizeiptr size,
struct gl_buffer_object **bufObjPtr =
get_buffer_target(ctx, target);
bufObj = *bufObjPtr;
} else {
bufObj = get_buffer(ctx, func, target, GL_INVALID_OPERATION);
if (!bufObj)
return;
}
}
if (no_error || validate_buffer_storage(ctx, bufObj, size, flags,
func))
- buffer_storage(ctx, bufObj, target, size, data, flags, func);
+ buffer_storage(ctx, bufObj, memObj, target, size, data, flags,
offset, func);
}
void GLAPIENTRY
_mesa_BufferStorage_no_error(GLenum target, GLsizeiptr size,
const GLvoid *data, GLbitfield flags)
{
- inlined_buffer_storage(target, 0, size, data, flags, false, true,
- "glBufferStorage");
+ inlined_buffer_storage(target, 0, size, data, flags, GL_NONE, 0,
+ false, false, true, "glBufferStorage");
}
void GLAPIENTRY
_mesa_BufferStorage(GLenum target, GLsizeiptr size, const GLvoid *data,
GLbitfield flags)
{
- inlined_buffer_storage(target, 0, size, data, flags, false, false,
- "glBufferStorage");
+ inlined_buffer_storage(target, 0, size, data, flags, GL_NONE, 0,
+ false, false, false, "glBufferStorage");
}
void GLAPIENTRY
_mesa_BufferStorageMemEXT(GLenum target, GLsizeiptr size,
GLuint memory, GLuint64 offset)
{
-
+ inlined_buffer_storage(target, 0, size, NULL, 0, memory, offset,
+ false, true, false, "glBufferStorageMemEXT");
}
void GLAPIENTRY
_mesa_BufferStorageMemEXT_no_error(GLenum target, GLsizeiptr size,
GLuint memory, GLuint64 offset)
{
-
+ inlined_buffer_storage(target, 0, size, NULL, 0, memory, offset,
+ false, true, true, "glBufferStorageMemEXT");
}
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");
+ inlined_buffer_storage(GL_NONE, buffer, size, data, flags,
GL_NONE, 0,
+ true, false, true, "glNamedBufferStorage");
}
void GLAPIENTRY
_mesa_NamedBufferStorage(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,
false,
- "glNamedBufferStorage");
+ inlined_buffer_storage(GL_NONE, buffer, size, data, flags,
GL_NONE, 0,
+ true, false, false, "glNamedBufferStorage");
}
void GLAPIENTRY
_mesa_NamedBufferStorageMemEXT(GLuint buffer, GLsizeiptr size,
GLuint memory, GLuint64 offset)
{
-
+ inlined_buffer_storage(GL_NONE, buffer, size, GL_NONE, 0, memory,
offset,
+ true, true, false,
"glNamedBufferStorageMemEXT");
}
void GLAPIENTRY
_mesa_NamedBufferStorageMemEXT_no_error(GLuint buffer, GLsizeiptr size,
GLuint memory, GLuint64 offset)
{
-
+ inlined_buffer_storage(GL_NONE, buffer, size, GL_NONE, 0, memory,
offset,
+ true, true, true,
"glNamedBufferStorageMemEXT");
}
static ALWAYS_INLINE void
buffer_data(struct gl_context *ctx, struct gl_buffer_object *bufObj,
GLenum target, GLsizeiptr size, const GLvoid *data,
GLenum usage,
const char *func, bool no_error)
{
bool valid_usage;