summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBrian Paul <brianp@vmware.com>2009-08-12 15:42:51 -0600
committerBrian Paul <brianp@vmware.com>2009-08-12 17:28:45 -0600
commitbd4c6a2e503db43e81ef41f77d876308badd93eb (patch)
tree37a03bd869fe7eddb60fdcb671ef1cede3ca074f /src
parent684049d97d423a5a873aefc5313d0c4b22528b95 (diff)
vbo: use _mesa_is_bufferobj()
Diffstat (limited to 'src')
-rw-r--r--src/mesa/vbo/vbo_exec_array.c14
-rw-r--r--src/mesa/vbo/vbo_exec_draw.c12
-rw-r--r--src/mesa/vbo/vbo_save_api.c2
-rw-r--r--src/mesa/vbo/vbo_split_copy.c11
4 files changed, 21 insertions, 18 deletions
diff --git a/src/mesa/vbo/vbo_exec_array.c b/src/mesa/vbo/vbo_exec_array.c
index 2693ae62c2..ddf6ca1e07 100644
--- a/src/mesa/vbo/vbo_exec_array.c
+++ b/src/mesa/vbo/vbo_exec_array.c
@@ -51,7 +51,7 @@ vbo_get_minmax_index(GLcontext *ctx,
GLsizei count = prim->count;
const void *indices;
- if (ib->obj->Name) {
+ if (_mesa_is_bufferobj(ib->obj)) {
const GLvoid *map = ctx->Driver.MapBuffer(ctx,
GL_ELEMENT_ARRAY_BUFFER_ARB,
GL_READ_ONLY,
@@ -103,7 +103,7 @@ vbo_get_minmax_index(GLcontext *ctx,
break;
}
- if (ib->obj->Name != 0) {
+ if (_mesa_is_bufferobj(ib->obj)) {
ctx->Driver.UnmapBuffer(ctx,
GL_ELEMENT_ARRAY_BUFFER_ARB,
ib->obj);
@@ -121,7 +121,7 @@ check_array_data(GLcontext *ctx, struct gl_client_array *array,
{
if (array->Enabled) {
const void *data = array->Ptr;
- if (array->BufferObj->Name) {
+ if (_mesa_is_bufferobj(array->BufferObj)) {
if (!array->BufferObj->Pointer) {
/* need to map now */
array->BufferObj->Pointer = ctx->Driver.MapBuffer(ctx,
@@ -166,8 +166,8 @@ static void
unmap_array_buffer(GLcontext *ctx, struct gl_client_array *array)
{
if (array->Enabled &&
- array->BufferObj->Name &&
- array->BufferObj->Pointer) {
+ _mesa_is_bufferobj(array->BufferObj) &&
+ _mesa_bufferobj_mapped(array->BufferObj)) {
ctx->Driver.UnmapBuffer(ctx,
GL_ARRAY_BUFFER_ARB,
array->BufferObj);
@@ -186,7 +186,7 @@ check_draw_elements_data(GLcontext *ctx, GLsizei count, GLenum elemType,
const void *elemMap;
GLint i, k;
- if (ctx->Array.ElementArrayBufferObj->Name) {
+ if (_mesa_is_bufferobj(ctx->Array.ElementArrayBufferObj)) {
elemMap = ctx->Driver.MapBuffer(ctx,
GL_ELEMENT_ARRAY_BUFFER_ARB,
GL_READ_ONLY,
@@ -225,7 +225,7 @@ check_draw_elements_data(GLcontext *ctx, GLsizei count, GLenum elemType,
}
}
- if (ctx->Array.ElementArrayBufferObj->Name) {
+ if (_mesa_is_bufferobj(ctx->Array.ElementArrayBufferObj)) {
ctx->Driver.UnmapBuffer(ctx,
GL_ELEMENT_ARRAY_BUFFER_ARB,
ctx->Array.ElementArrayBufferObj);
diff --git a/src/mesa/vbo/vbo_exec_draw.c b/src/mesa/vbo/vbo_exec_draw.c
index a988424d21..d76c45f356 100644
--- a/src/mesa/vbo/vbo_exec_draw.c
+++ b/src/mesa/vbo/vbo_exec_draw.c
@@ -214,7 +214,7 @@ vbo_exec_bind_arrays( GLcontext *ctx )
/* override the default array set above */
exec->vtx.inputs[attr] = &arrays[attr];
- if (exec->vtx.bufferobj->Name) {
+ if (_mesa_is_bufferobj(exec->vtx.bufferobj)) {
/* a real buffer obj: Ptr is an offset, not a pointer*/
GLsizeiptr offset;
assert(exec->vtx.bufferobj->Pointer); /* buf should be mapped */
@@ -251,7 +251,7 @@ vbo_exec_vtx_unmap( struct vbo_exec_context *exec )
{
GLenum target = GL_ARRAY_BUFFER_ARB;
- if (exec->vtx.bufferobj->Name) {
+ if (_mesa_is_bufferobj(exec->vtx.bufferobj)) {
GLcontext *ctx = exec->ctx;
if (ctx->Driver.FlushMappedBufferRange) {
@@ -291,7 +291,7 @@ vbo_exec_vtx_map( struct vbo_exec_context *exec )
MESA_MAP_NOWAIT_BIT;
const GLenum usage = GL_STREAM_DRAW_ARB;
- if (exec->vtx.bufferobj->Name == 0)
+ if (!_mesa_is_bufferobj(exec->vtx.bufferobj))
return;
if (exec->vtx.buffer_map != NULL) {
@@ -365,7 +365,7 @@ vbo_exec_vtx_flush( struct vbo_exec_context *exec, GLboolean unmap )
if (ctx->NewState)
_mesa_update_state( ctx );
- if (exec->vtx.bufferobj->Name) {
+ if (_mesa_is_bufferobj(exec->vtx.bufferobj)) {
vbo_exec_vtx_unmap( exec );
}
@@ -384,7 +384,7 @@ vbo_exec_vtx_flush( struct vbo_exec_context *exec, GLboolean unmap )
/* If using a real VBO, get new storage -- unless asked not to.
*/
- if (exec->vtx.bufferobj->Name && !unmap) {
+ if (_mesa_is_bufferobj(exec->vtx.bufferobj) && !unmap) {
vbo_exec_vtx_map( exec );
}
}
@@ -393,7 +393,7 @@ vbo_exec_vtx_flush( struct vbo_exec_context *exec, GLboolean unmap )
/* May have to unmap explicitly if we didn't draw:
*/
if (unmap &&
- exec->vtx.bufferobj->Name &&
+ _mesa_is_bufferobj(exec->vtx.bufferobj) &&
exec->vtx.buffer_map) {
vbo_exec_vtx_unmap( exec );
}
diff --git a/src/mesa/vbo/vbo_save_api.c b/src/mesa/vbo/vbo_save_api.c
index d00d304d2e..cdbbc9c187 100644
--- a/src/mesa/vbo/vbo_save_api.c
+++ b/src/mesa/vbo/vbo_save_api.c
@@ -911,7 +911,7 @@ static void GLAPIENTRY _save_OBE_DrawElements(GLenum mode, GLsizei count, GLenum
_ae_map_vbos( ctx );
- if (ctx->Array.ElementArrayBufferObj->Name)
+ if (_mesa_is_bufferobj(ctx->Array.ElementArrayBufferObj))
indices = ADD_POINTERS(ctx->Array.ElementArrayBufferObj->Pointer, indices);
vbo_save_NotifyBegin( ctx, mode | VBO_SAVE_PRIM_WEAK );
diff --git a/src/mesa/vbo/vbo_split_copy.c b/src/mesa/vbo/vbo_split_copy.c
index 3f8a222805..8ec180d550 100644
--- a/src/mesa/vbo/vbo_split_copy.c
+++ b/src/mesa/vbo/vbo_split_copy.c
@@ -30,6 +30,7 @@
*/
#include "main/glheader.h"
+#include "main/bufferobj.h"
#include "main/imports.h"
#include "main/image.h"
#include "main/macros.h"
@@ -444,7 +445,7 @@ replay_init( struct copy_context *copy )
copy->varying[j].size = attr_size(copy->array[i]);
copy->vertex_size += attr_size(copy->array[i]);
- if (vbo->Name && !vbo->Pointer)
+ if (_mesa_is_bufferobj(vbo) && !_mesa_bufferobj_mapped(vbo))
ctx->Driver.MapBuffer(ctx, GL_ARRAY_BUFFER, GL_READ_ONLY, vbo);
copy->varying[j].src_ptr = ADD_POINTERS(vbo->Pointer,
@@ -458,7 +459,8 @@ replay_init( struct copy_context *copy )
* caller convert non-indexed prims to indexed. Could alternately
* do it internally.
*/
- if (copy->ib->obj->Name && !copy->ib->obj->Pointer)
+ if (_mesa_is_bufferobj(copy->ib->obj) &&
+ !_mesa_bufferobj_mapped(copy->ib->obj))
ctx->Driver.MapBuffer(ctx, GL_ELEMENT_ARRAY_BUFFER, GL_READ_ONLY,
copy->ib->obj);
@@ -562,13 +564,14 @@ replay_finish( struct copy_context *copy )
*/
for (i = 0; i < copy->nr_varying; i++) {
struct gl_buffer_object *vbo = copy->varying[i].array->BufferObj;
- if (vbo->Name && vbo->Pointer)
+ if (_mesa_is_bufferobj(vbo) && _mesa_bufferobj_mapped(vbo))
ctx->Driver.UnmapBuffer(ctx, GL_ARRAY_BUFFER, vbo);
}
/* Unmap index buffer:
*/
- if (copy->ib->obj->Name && copy->ib->obj->Pointer) {
+ if (_mesa_is_bufferobj(copy->ib->obj) &&
+ _mesa_bufferobj_mapped(copy->ib->obj)) {
ctx->Driver.UnmapBuffer(ctx, GL_ELEMENT_ARRAY_BUFFER, copy->ib->obj);
}
}