#include "glheader.h"
#include "enums.h"
#include "hash.h"
-#include "util/imports.h"
#include "context.h"
#include "bufferobj.h"
#include "externalobjects.h"
#include "transformfeedback.h"
#include "varray.h"
#include "util/u_atomic.h"
+#include "util/u_memory.h"
/* Debug flags */
(void) ctx;
vbo_delete_minmax_cache(bufObj);
- _mesa_align_free(bufObj->Data);
+ align_free(bufObj->Data);
/* assign strange values here to help w/ debugging */
bufObj->RefCount = -1000;
(void) target;
- _mesa_align_free( bufObj->Data );
+ align_free( bufObj->Data );
- new_data = _mesa_align_malloc( size, ctx->Const.MinMapBufferAlignment );
+ new_data = align_malloc( size, ctx->Const.MinMapBufferAlignment );
if (new_data) {
bufObj->Data = (GLubyte *) new_data;
bufObj->Size = size;
if (vao->BufferBinding[index].BufferObj == obj) {
_mesa_bind_vertex_buffer(ctx, vao, index, NULL,
vao->BufferBinding[index].Offset,
- vao->BufferBinding[index].Stride);
+ vao->BufferBinding[index].Stride, true, false);
}
}
bind_buffer_object(ctx, bindTarget, buffer);
}
+void
+_mesa_InternalBindElementBuffer(struct gl_context *ctx,
+ struct gl_buffer_object *buf)
+{
+ struct gl_buffer_object **bindTarget =
+ get_buffer_target(ctx, GL_ELEMENT_ARRAY_BUFFER);
+
+ /* Move the buffer reference from the parameter to the bind point. */
+ _mesa_reference_buffer_object(ctx, bindTarget, NULL);
+ if (buf)
+ *bindTarget = buf;
+}
+
/**
* Binds a buffer object to a binding point.
*
"glCopyNamedBufferSubData");
}
+void GLAPIENTRY
+_mesa_InternalBufferSubDataCopyMESA(GLintptr srcBuffer, GLuint srcOffset,
+ GLuint dstTargetOrName, GLintptr dstOffset,
+ GLsizeiptr size, GLboolean named,
+ GLboolean ext_dsa)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ struct gl_buffer_object *src = (struct gl_buffer_object *)srcBuffer;
+ struct gl_buffer_object *dst;
+ const char *func;
+
+ /* Handle behavior for all 3 variants. */
+ if (named && ext_dsa) {
+ func = "glNamedBufferSubDataEXT";
+ dst = _mesa_lookup_bufferobj(ctx, dstTargetOrName);
+ if (!_mesa_handle_bind_buffer_gen(ctx, dstTargetOrName, &dst, func))
+ goto done;
+ } else if (named) {
+ func = "glNamedBufferSubData";
+ dst = _mesa_lookup_bufferobj_err(ctx, dstTargetOrName, func);
+ if (!dst)
+ goto done;
+ } else {
+ assert(!ext_dsa);
+ func = "glBufferSubData";
+ dst = get_buffer(ctx, func, dstTargetOrName, GL_INVALID_OPERATION);
+ if (!dst)
+ goto done;
+ }
+
+ if (!validate_buffer_sub_data(ctx, dst, dstOffset, size, func))
+ goto done; /* the error is already set */
+
+ dst->MinMaxCacheDirty = true;
+ ctx->Driver.CopyBufferSubData(ctx, src, dst, srcOffset, dstOffset, size);
+
+done:
+ /* The caller passes the reference to this function, so unreference it. */
+ _mesa_reference_buffer_object(ctx, &src, NULL);
+}
+
static bool
validate_map_buffer_range(struct gl_context *ctx,
struct gl_buffer_object *bufObj, GLintptr offset,