summaryrefslogtreecommitdiffstats
path: root/src/mesa/vbo/vbo_exec_draw.c
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2008-09-04 15:25:45 -0600
committerBrian Paul <[email protected]>2008-09-04 15:25:45 -0600
commita69fc5129bdf2f245c5bf2e0fe7b542caf7809a9 (patch)
treebd6af433f80000dd97513781276ca7d0a9671a5a /src/mesa/vbo/vbo_exec_draw.c
parent9a64440154319738445e203339156e54232908ee (diff)
mesa: improved gl_buffer_object reference counting
Use new _mesa_reference_buffer_object() function wherever possible. Fixes buffer object/display list crash reported in ParaView.
Diffstat (limited to 'src/mesa/vbo/vbo_exec_draw.c')
-rw-r--r--src/mesa/vbo/vbo_exec_draw.c26
1 files changed, 19 insertions, 7 deletions
diff --git a/src/mesa/vbo/vbo_exec_draw.c b/src/mesa/vbo/vbo_exec_draw.c
index 3609a7452af..f497e9a5a55 100644
--- a/src/mesa/vbo/vbo_exec_draw.c
+++ b/src/mesa/vbo/vbo_exec_draw.c
@@ -1,8 +1,8 @@
/*
* Mesa 3-D graphics library
- * Version: 5.1
+ * Version: 7.2
*
- * Copyright (C) 1999-2003 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2008 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -26,6 +26,7 @@
*/
#include "main/glheader.h"
+#include "main/bufferobj.h"
#include "main/context.h"
#include "main/enums.h"
#include "main/state.h"
@@ -155,8 +156,12 @@ static void vbo_exec_bind_arrays( GLcontext *ctx )
*/
switch (get_program_mode(exec->ctx)) {
case VP_NONE:
- memcpy(arrays, vbo->legacy_currval, 16 * sizeof(arrays[0]));
- memcpy(arrays + 16, vbo->mat_currval, MAT_ATTRIB_MAX * sizeof(arrays[0]));
+ for (attr = 0; attr < 16; attr++) {
+ exec->vtx.inputs[attr] = &vbo->legacy_currval[attr];
+ }
+ for (attr = 0; attr < MAT_ATTRIB_MAX; attr++) {
+ exec->vtx.inputs[attr + 16] = &vbo->mat_currval[attr];
+ }
map = vbo->map_vp_none;
break;
case VP_NV:
@@ -165,8 +170,10 @@ static void vbo_exec_bind_arrays( GLcontext *ctx )
* occurred. NV vertex programs cannot access material values,
* nor attributes greater than VERT_ATTRIB_TEX7.
*/
- memcpy(arrays, vbo->legacy_currval, 16 * sizeof(arrays[0]));
- memcpy(arrays + 16, vbo->generic_currval, 16 * sizeof(arrays[0]));
+ for (attr = 0; attr < 16; attr++) {
+ exec->vtx.inputs[attr] = &vbo->legacy_currval[attr];
+ exec->vtx.inputs[attr + 16] = &vbo->generic_currval[attr];
+ }
map = vbo->map_vp_arb;
break;
}
@@ -178,6 +185,9 @@ static void vbo_exec_bind_arrays( GLcontext *ctx )
const GLuint src = map[attr];
if (exec->vtx.attrsz[src]) {
+ /* override the default array set above */
+ exec->vtx.inputs[attr] = &arrays[attr];
+
if (exec->vtx.bufferobj->Name) {
/* a real buffer obj: Ptr is an offset, not a pointer*/
int offset;
@@ -195,7 +205,9 @@ static void vbo_exec_bind_arrays( GLcontext *ctx )
arrays[attr].Stride = exec->vtx.vertex_size * sizeof(GLfloat);
arrays[attr].Type = GL_FLOAT;
arrays[attr].Enabled = 1;
- arrays[attr].BufferObj = exec->vtx.bufferobj;
+ _mesa_reference_buffer_object(ctx,
+ &arrays[attr].BufferObj,
+ exec->vtx.bufferobj);
arrays[attr]._MaxElement = count; /* ??? */
data += exec->vtx.attrsz[src] * sizeof(GLfloat);