summaryrefslogtreecommitdiff
path: root/src/mesa/vbo
diff options
context:
space:
mode:
authorAlex Deucher <alexdeucher@gmail.com>2009-07-15 14:17:07 -0400
committerAlex Deucher <alexdeucher@gmail.com>2009-07-15 14:17:07 -0400
commitc5c19919ce627b98d8aab4284da1694573bcccd4 (patch)
tree2e29b313b79b6a392e020fd5723e3cc00c800fd2 /src/mesa/vbo
parenta0d4a12614fce072fa1eb5516e626909171c95e1 (diff)
parent3a3b83e5112b725e22f05b32a273a2351b820944 (diff)
Merge branch 'master' of git+ssh://agd5f@git.freedesktop.org/git/mesa/mesa into r6xx-rewrite
This builds, but I get an assertion in radeonGetLock() due to the drawable being null.
Diffstat (limited to 'src/mesa/vbo')
-rw-r--r--src/mesa/vbo/vbo_context.c3
-rw-r--r--src/mesa/vbo/vbo_exec_draw.c31
-rw-r--r--src/mesa/vbo/vbo_save_api.c55
-rw-r--r--src/mesa/vbo/vbo_save_loopback.c2
-rw-r--r--src/mesa/vbo/vbo_split_copy.c2
-rw-r--r--src/mesa/vbo/vbo_split_inplace.c36
6 files changed, 72 insertions, 57 deletions
diff --git a/src/mesa/vbo/vbo_context.c b/src/mesa/vbo/vbo_context.c
index 90025f62fc..75c32e0b9b 100644
--- a/src/mesa/vbo/vbo_context.c
+++ b/src/mesa/vbo/vbo_context.c
@@ -153,7 +153,8 @@ static void init_mat_currval(GLcontext *ctx)
cl->Stride = 0;
cl->StrideB = 0;
cl->Enabled = 1;
- cl->BufferObj = ctx->Shared->NullBufferObj;
+ _mesa_reference_buffer_object(ctx, &cl->BufferObj,
+ ctx->Shared->NullBufferObj);
}
}
diff --git a/src/mesa/vbo/vbo_exec_draw.c b/src/mesa/vbo/vbo_exec_draw.c
index c939b7b633..18419928b2 100644
--- a/src/mesa/vbo/vbo_exec_draw.c
+++ b/src/mesa/vbo/vbo_exec_draw.c
@@ -51,7 +51,7 @@ vbo_exec_debug_verts( struct vbo_exec_context *exec )
struct _mesa_prim *prim = &exec->vtx.prim[i];
_mesa_printf(" prim %d: %s%s %d..%d %s %s\n",
i,
- _mesa_lookup_enum_by_nr(prim->mode),
+ _mesa_lookup_prim_by_nr(prim->mode),
prim->weak ? " (weak)" : "",
prim->start,
prim->start + prim->count,
@@ -282,9 +282,14 @@ void
vbo_exec_vtx_map( struct vbo_exec_context *exec )
{
GLcontext *ctx = exec->ctx;
- GLenum target = GL_ARRAY_BUFFER_ARB;
- GLenum access = GL_READ_WRITE_ARB;
- GLenum usage = GL_STREAM_DRAW_ARB;
+ const GLenum target = GL_ARRAY_BUFFER_ARB;
+ const GLenum access = GL_READ_WRITE_ARB; /* for MapBuffer */
+ const GLenum accessRange = GL_MAP_WRITE_BIT | /* for MapBufferRange */
+ GL_MAP_INVALIDATE_RANGE_BIT |
+ GL_MAP_UNSYNCHRONIZED_BIT |
+ GL_MAP_FLUSH_EXPLICIT_BIT |
+ MESA_MAP_NOWAIT_BIT;
+ const GLenum usage = GL_STREAM_DRAW_ARB;
if (exec->vtx.bufferobj->Name == 0)
return;
@@ -303,10 +308,7 @@ vbo_exec_vtx_map( struct vbo_exec_context *exec )
exec->vtx.buffer_used,
(VBO_VERT_BUFFER_SIZE -
exec->vtx.buffer_used),
- (GL_MAP_WRITE_BIT |
- GL_MAP_INVALIDATE_RANGE_BIT |
- GL_MAP_UNSYNCHRONIZED_BIT |
- MESA_MAP_NOWAIT_BIT),
+ accessRange,
exec->vtx.bufferobj);
exec->vtx.buffer_ptr = exec->vtx.buffer_map;
}
@@ -318,8 +320,17 @@ vbo_exec_vtx_map( struct vbo_exec_context *exec )
VBO_VERT_BUFFER_SIZE,
NULL, usage, exec->vtx.bufferobj);
- exec->vtx.buffer_map = (GLfloat *)
- ctx->Driver.MapBuffer(ctx, target, access, exec->vtx.bufferobj);
+
+ if (ctx->Driver.MapBufferRange)
+ exec->vtx.buffer_map =
+ (GLfloat *)ctx->Driver.MapBufferRange(ctx, target,
+ 0, VBO_VERT_BUFFER_SIZE,
+ accessRange,
+ exec->vtx.bufferobj);
+ if (!exec->vtx.buffer_map)
+ exec->vtx.buffer_map =
+ (GLfloat *)ctx->Driver.MapBuffer(ctx, target, access, exec->vtx.bufferobj);
+ assert(exec->vtx.buffer_map);
exec->vtx.buffer_ptr = exec->vtx.buffer_map;
}
diff --git a/src/mesa/vbo/vbo_save_api.c b/src/mesa/vbo/vbo_save_api.c
index 868226075a..d00d304d2e 100644
--- a/src/mesa/vbo/vbo_save_api.c
+++ b/src/mesa/vbo/vbo_save_api.c
@@ -667,19 +667,33 @@ do { \
* -- Flush current buffer
* -- Fallback to opcodes for the rest of the begin/end object.
*/
-#define DO_FALLBACK(ctx) \
-do { \
- struct vbo_save_context *save = &vbo_context(ctx)->save; \
- \
- if (save->vert_count || save->prim_count) \
- _save_compile_vertex_list( ctx ); \
- \
- _save_copy_to_current( ctx ); \
- _save_reset_vertex( ctx ); \
- _save_reset_counters( ctx ); \
- _mesa_install_save_vtxfmt( ctx, &ctx->ListState.ListVtxfmt ); \
- ctx->Driver.SaveNeedFlush = 0; \
-} while (0)
+static void DO_FALLBACK( GLcontext *ctx )
+{
+ struct vbo_save_context *save = &vbo_context(ctx)->save;
+
+ if (save->vert_count || save->prim_count) {
+ GLint i = save->prim_count - 1;
+
+ /* Close off in-progress primitive.
+ */
+ save->prim[i].count = (save->vert_count -
+ save->prim[i].start);
+
+ /* Need to replay this display list with loopback,
+ * unfortunately, otherwise this primitive won't be handled
+ * properly:
+ */
+ save->dangling_attr_ref = 1;
+
+ _save_compile_vertex_list( ctx );
+ }
+
+ _save_copy_to_current( ctx );
+ _save_reset_vertex( ctx );
+ _save_reset_counters( ctx );
+ _mesa_install_save_vtxfmt( ctx, &ctx->ListState.ListVtxfmt );
+ ctx->Driver.SaveNeedFlush = 0;
+}
static void GLAPIENTRY _save_EvalCoord1f( GLfloat u )
{
@@ -1130,6 +1144,11 @@ static void vbo_destroy_vertex_list( GLcontext *ctx, void *data )
if ( --node->prim_store->refcount == 0 )
FREE( node->prim_store );
+
+ if (node->current_data) {
+ FREE(node->current_data);
+ node->current_data = NULL;
+ }
}
@@ -1139,16 +1158,16 @@ static void vbo_print_vertex_list( GLcontext *ctx, void *data )
GLuint i;
(void) ctx;
- _mesa_debug(NULL, "VBO-VERTEX-LIST, %u vertices %d primitives, %d vertsize\n",
- node->count,
- node->prim_count,
- node->vertex_size);
+ _mesa_printf("VBO-VERTEX-LIST, %u vertices %d primitives, %d vertsize\n",
+ node->count,
+ node->prim_count,
+ node->vertex_size);
for (i = 0 ; i < node->prim_count ; i++) {
struct _mesa_prim *prim = &node->prim[i];
_mesa_debug(NULL, " prim %d: %s%s %d..%d %s %s\n",
i,
- _mesa_lookup_enum_by_nr(prim->mode),
+ _mesa_lookup_prim_by_nr(prim->mode),
prim->weak ? " (weak)" : "",
prim->start,
prim->start + prim->count,
diff --git a/src/mesa/vbo/vbo_save_loopback.c b/src/mesa/vbo/vbo_save_loopback.c
index 92ca4ea95d..b7a74e4535 100644
--- a/src/mesa/vbo/vbo_save_loopback.c
+++ b/src/mesa/vbo/vbo_save_loopback.c
@@ -97,7 +97,7 @@ static void loopback_prim( GLcontext *ctx,
if (0)
_mesa_printf("loopback prim %s(%s,%s) verts %d..%d\n",
- _mesa_lookup_enum_by_nr(prim->mode),
+ _mesa_lookup_prim_by_nr(prim->mode),
prim->begin ? "begin" : "..",
prim->end ? "end" : "..",
start,
diff --git a/src/mesa/vbo/vbo_split_copy.c b/src/mesa/vbo/vbo_split_copy.c
index dcb14c868b..d7ffebf607 100644
--- a/src/mesa/vbo/vbo_split_copy.c
+++ b/src/mesa/vbo/vbo_split_copy.c
@@ -219,7 +219,7 @@ begin( struct copy_context *copy, GLenum mode, GLboolean begin_flag )
{
struct _mesa_prim *prim = &copy->dstprim[copy->dstprim_nr];
-/* _mesa_printf("begin %s (%d)\n", _mesa_lookup_enum_by_nr(mode), begin_flag); */
+/* _mesa_printf("begin %s (%d)\n", _mesa_lookup_prim_by_nr(mode), begin_flag); */
prim->mode = mode;
prim->begin = begin_flag;
diff --git a/src/mesa/vbo/vbo_split_inplace.c b/src/mesa/vbo/vbo_split_inplace.c
index 3ed6b34fbf..266bc56c82 100644
--- a/src/mesa/vbo/vbo_split_inplace.c
+++ b/src/mesa/vbo/vbo_split_inplace.c
@@ -63,35 +63,19 @@ static void flush_vertex( struct split_context *split )
if (!split->dstprim_nr)
return;
- if (split->ib) {
- /* This should basically be multipass rendering over the same
- * unchanging set of VBO's. Would like the driver not to
- * re-upload the data, or swtnl not to re-transform the
- * vertices.
- */
- assert(split->max_index - split->min_index < split->limits->max_verts);
- min_index = split->min_index;
- max_index = split->max_index;
- }
- else {
- /* Non-indexed rendering. Cannot assume that the primitives are
- * ordered by increasing vertex, because of entrypoints like
- * MultiDrawArrays.
- */
- GLuint i;
- min_index = split->dstprim[0].start;
- max_index = min_index + split->dstprim[0].count - 1;
+ GLuint i;
+ min_index = split->dstprim[0].start;
+ max_index = min_index + split->dstprim[0].count - 1;
- for (i = 1; i < split->dstprim_nr; i++) {
- GLuint tmp_min = split->dstprim[i].start;
- GLuint tmp_max = tmp_min + split->dstprim[i].count - 1;
+ for (i = 1; i < split->dstprim_nr; i++) {
+ GLuint tmp_min = split->dstprim[i].start;
+ GLuint tmp_max = tmp_min + split->dstprim[i].count - 1;
- if (tmp_min < min_index)
- min_index = tmp_min;
+ if (tmp_min < min_index)
+ min_index = tmp_min;
- if (tmp_max > max_index)
- max_index = tmp_max;
- }
+ if (tmp_max > max_index)
+ max_index = tmp_max;
}
assert(max_index >= min_index);