projects
/
mesa.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
mesa/glsl: set num_textures per stage directly in shader_info
[mesa.git]
/
src
/
mesa
/
main
/
bufferobj.c
diff --git
a/src/mesa/main/bufferobj.c
b/src/mesa/main/bufferobj.c
index e60a8ea523751d9c2d48d9d3964dba0af3a6ec4d..eca86aae98ce8e17439d868c821045bc99a2f21a 100644
(file)
--- a/
src/mesa/main/bufferobj.c
+++ b/
src/mesa/main/bufferobj.c
@@
-44,6
+44,7
@@
#include "glformats.h"
#include "texstore.h"
#include "transformfeedback.h"
#include "glformats.h"
#include "texstore.h"
#include "transformfeedback.h"
+#include "varray.h"
/* Debug flags */
/* Debug flags */
@@
-1020,7
+1021,8
@@
bind_buffer_object(struct gl_context *ctx, GLenum target, GLuint buffer)
bindTarget = get_buffer_target(ctx, target);
if (!bindTarget) {
bindTarget = get_buffer_target(ctx, target);
if (!bindTarget) {
- _mesa_error(ctx, GL_INVALID_ENUM, "glBindBufferARB(target 0x%x)", target);
+ _mesa_error(ctx, GL_INVALID_ENUM, "glBindBufferARB(target %s)",
+ _mesa_enum_to_string(target));
return;
}
return;
}
@@
-1097,8
+1099,11
@@
_mesa_lookup_bufferobj(struct gl_context *ctx, GLuint buffer)
struct gl_buffer_object *
_mesa_lookup_bufferobj_locked(struct gl_context *ctx, GLuint buffer)
{
struct gl_buffer_object *
_mesa_lookup_bufferobj_locked(struct gl_context *ctx, GLuint buffer)
{
- return (struct gl_buffer_object *)
- _mesa_HashLookupLocked(ctx->Shared->BufferObjects, buffer);
+ if (buffer == 0)
+ return NULL;
+ else
+ return (struct gl_buffer_object *)
+ _mesa_HashLookupLocked(ctx->Shared->BufferObjects, buffer);
}
/**
}
/**
@@
-1195,11
+1200,13
@@
_mesa_multi_bind_lookup_bufferobj(struct gl_context *ctx,
*/
static void
unbind(struct gl_context *ctx,
*/
static void
unbind(struct gl_context *ctx,
- struct gl_
buffer_object **ptr
,
+ struct gl_
vertex_array_object *vao, unsigned index
,
struct gl_buffer_object *obj)
{
struct gl_buffer_object *obj)
{
- if (*ptr == obj) {
- _mesa_reference_buffer_object(ctx, ptr, ctx->Shared->NullBufferObj);
+ if (vao->BufferBinding[index].BufferObj == obj) {
+ _mesa_bind_vertex_buffer(ctx, vao, index, ctx->Shared->NullBufferObj,
+ vao->BufferBinding[index].Offset,
+ vao->BufferBinding[index].Stride);
}
}
}
}
@@
-1283,10
+1290,11
@@
_mesa_DeleteBuffers(GLsizei n, const GLuint *ids)
return;
}
return;
}
-
mtx_lock(&ctx->Shared->Mutex
);
+
_mesa_HashLockMutex(ctx->Shared->BufferObjects
);
for (i = 0; i < n; i++) {
for (i = 0; i < n; i++) {
- struct gl_buffer_object *bufObj = _mesa_lookup_bufferobj(ctx, ids[i]);
+ struct gl_buffer_object *bufObj =
+ _mesa_lookup_bufferobj_locked(ctx, ids[i]);
if (bufObj) {
struct gl_vertex_array_object *vao = ctx->Array.VAO;
GLuint j;
if (bufObj) {
struct gl_vertex_array_object *vao = ctx->Array.VAO;
GLuint j;
@@
-1296,8
+1304,8
@@
_mesa_DeleteBuffers(GLsizei n, const GLuint *ids)
_mesa_buffer_unmap_all_mappings(ctx, bufObj);
/* unbind any vertex pointers bound to this buffer */
_mesa_buffer_unmap_all_mappings(ctx, bufObj);
/* unbind any vertex pointers bound to this buffer */
- for (j = 0; j < ARRAY_SIZE(vao->
Vertex
Binding); j++) {
- unbind(ctx,
&vao->VertexBinding[j].BufferOb
j, bufObj);
+ for (j = 0; j < ARRAY_SIZE(vao->
Buffer
Binding); j++) {
+ unbind(ctx,
vao,
j, bufObj);
}
if (ctx->Array.ArrayBufferObj == bufObj) {
}
if (ctx->Array.ArrayBufferObj == bufObj) {
@@
-1395,7
+1403,7
@@
_mesa_DeleteBuffers(GLsizei n, const GLuint *ids)
}
/* The ID is immediately freed for re-use */
}
/* The ID is immediately freed for re-use */
- _mesa_HashRemove(ctx->Shared->BufferObjects, ids[i]);
+ _mesa_HashRemove
Locked
(ctx->Shared->BufferObjects, ids[i]);
/* Make sure we do not run into the classic ABA problem on bind.
* We don't want to allow re-binding a buffer object that's been
* "deleted" by glDeleteBuffers().
/* Make sure we do not run into the classic ABA problem on bind.
* We don't want to allow re-binding a buffer object that's been
* "deleted" by glDeleteBuffers().
@@
-1411,7
+1419,7
@@
_mesa_DeleteBuffers(GLsizei n, const GLuint *ids)
}
}
}
}
-
mtx_unlock(&ctx->Shared->Mutex
);
+
_mesa_HashUnlockMutex(ctx->Shared->BufferObjects
);
}
}
@@
-1445,7
+1453,7
@@
create_buffers(GLsizei n, GLuint *buffers, bool dsa)
/*
* This must be atomic (generation and allocation of buffer object IDs)
*/
/*
* This must be atomic (generation and allocation of buffer object IDs)
*/
-
mtx_lock(&ctx->Shared->Mutex
);
+
_mesa_HashLockMutex(ctx->Shared->BufferObjects
);
first = _mesa_HashFindFreeKeyBlock(ctx->Shared->BufferObjects, n);
first = _mesa_HashFindFreeKeyBlock(ctx->Shared->BufferObjects, n);
@@
-1460,17
+1468,17
@@
create_buffers(GLsizei n, GLuint *buffers, bool dsa)
buf = ctx->Driver.NewBufferObject(ctx, buffers[i]);
if (!buf) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "%s", func);
buf = ctx->Driver.NewBufferObject(ctx, buffers[i]);
if (!buf) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "%s", func);
-
mtx_unlock(&ctx->Shared->Mutex
);
+
_mesa_HashUnlockMutex(ctx->Shared->BufferObjects
);
return;
}
}
else
buf = &DummyBufferObject;
return;
}
}
else
buf = &DummyBufferObject;
- _mesa_HashInsert(ctx->Shared->BufferObjects, buffers[i], buf);
+ _mesa_HashInsert
Locked
(ctx->Shared->BufferObjects, buffers[i], buf);
}
}
-
mtx_unlock(&ctx->Shared->Mutex
);
+
_mesa_HashUnlockMutex(ctx->Shared->BufferObjects
);
}
/**
}
/**
@@
-1512,9
+1520,7
@@
_mesa_IsBuffer(GLuint id)
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE);
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE);
- mtx_lock(&ctx->Shared->Mutex);
bufObj = _mesa_lookup_bufferobj(ctx, id);
bufObj = _mesa_lookup_bufferobj(ctx, id);
- mtx_unlock(&ctx->Shared->Mutex);
return bufObj && bufObj != &DummyBufferObject;
}
return bufObj && bufObj != &DummyBufferObject;
}
@@
-1762,7
+1768,7
@@
_mesa_buffer_sub_data(struct gl_context *ctx, struct gl_buffer_object *bufObj,
const char *func)
{
if (!buffer_object_subdata_range_good(ctx, bufObj, offset, size,
const char *func)
{
if (!buffer_object_subdata_range_good(ctx, bufObj, offset, size,
-
fals
e, func)) {
+
tru
e, func)) {
/* error already recorded */
return;
}
/* error already recorded */
return;
}
@@
-3069,11
+3075,11
@@
bind_buffers_check_offset_and_size(struct gl_context *ctx,
const GLsizeiptr *sizes)
{
if (offsets[index] < 0) {
const GLsizeiptr *sizes)
{
if (offsets[index] < 0) {
- /* The ARB_multi_bind spec says:
- *
- * "An INVALID_VALUE error is generated by BindBuffersRange if any
- * value in <offsets> is less than zero (per binding)."
- */
+
/* The ARB_multi_bind spec says:
+
*
+
* "An INVALID_VALUE error is generated by BindBuffersRange if any
+
* value in <offsets> is less than zero (per binding)."
+
*/
_mesa_error(ctx, GL_INVALID_VALUE,
"glBindBuffersRange(offsets[%u]=%" PRId64 " < 0)",
index, (int64_t) offsets[index]);
_mesa_error(ctx, GL_INVALID_VALUE,
"glBindBuffersRange(offsets[%u]=%" PRId64 " < 0)",
index, (int64_t) offsets[index]);
@@
-3081,11
+3087,11
@@
bind_buffers_check_offset_and_size(struct gl_context *ctx,
}
if (sizes[index] <= 0) {
}
if (sizes[index] <= 0) {
- /* The ARB_multi_bind spec says:
- *
- * "An INVALID_VALUE error is generated by BindBuffersRange if any
- * value in <sizes> is less than or equal to zero (per binding)."
- */
+
/* The ARB_multi_bind spec says:
+
*
+
* "An INVALID_VALUE error is generated by BindBuffersRange if any
+
* value in <sizes> is less than or equal to zero (per binding)."
+
*/
_mesa_error(ctx, GL_INVALID_VALUE,
"glBindBuffersRange(sizes[%u]=%" PRId64 " <= 0)",
index, (int64_t) sizes[index]);
_mesa_error(ctx, GL_INVALID_VALUE,
"glBindBuffersRange(sizes[%u]=%" PRId64 " <= 0)",
index, (int64_t) sizes[index]);
@@
-3964,7
+3970,7
@@
_mesa_InvalidateBufferSubData(GLuint buffer, GLintptr offset,
bufObj = _mesa_lookup_bufferobj(ctx, buffer);
if (!bufObj || bufObj == &DummyBufferObject) {
_mesa_error(ctx, GL_INVALID_VALUE,
bufObj = _mesa_lookup_bufferobj(ctx, buffer);
if (!bufObj || bufObj == &DummyBufferObject) {
_mesa_error(ctx, GL_INVALID_VALUE,
- "glInvalidateBufferSubData(name =
0x%x
) invalid object",
+ "glInvalidateBufferSubData(name =
%u
) invalid object",
buffer);
return;
}
buffer);
return;
}
@@
-4015,7
+4021,7
@@
_mesa_InvalidateBufferData(GLuint buffer)
bufObj = _mesa_lookup_bufferobj(ctx, buffer);
if (!bufObj || bufObj == &DummyBufferObject) {
_mesa_error(ctx, GL_INVALID_VALUE,
bufObj = _mesa_lookup_bufferobj(ctx, buffer);
if (!bufObj || bufObj == &DummyBufferObject) {
_mesa_error(ctx, GL_INVALID_VALUE,
- "glInvalidateBufferData(name =
0x%x
) invalid object",
+ "glInvalidateBufferData(name =
%u
) invalid object",
buffer);
return;
}
buffer);
return;
}