aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/vbo
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2012-02-13 08:50:32 +0100
committermarha <marha@users.sourceforge.net>2012-02-13 08:50:32 +0100
commit179ebdfaf7fe0a0017054c052b76210eeff084a9 (patch)
tree5daa6e5583ced6a6b12b03e12c16ef2acedb5b5c /mesalib/src/mesa/vbo
parent535951cba015f2a2b63292e0ca983d0d6e736b71 (diff)
parenteaa70945cb3f1a432b8c505ecede9ebc7769f36d (diff)
downloadvcxsrv-179ebdfaf7fe0a0017054c052b76210eeff084a9.tar.gz
vcxsrv-179ebdfaf7fe0a0017054c052b76210eeff084a9.tar.bz2
vcxsrv-179ebdfaf7fe0a0017054c052b76210eeff084a9.zip
Merge remote-tracking branch 'origin/released'
Diffstat (limited to 'mesalib/src/mesa/vbo')
-rw-r--r--mesalib/src/mesa/vbo/vbo_save.h8
-rw-r--r--mesalib/src/mesa/vbo/vbo_save_api.c20
-rw-r--r--mesalib/src/mesa/vbo/vbo_save_draw.c24
3 files changed, 40 insertions, 12 deletions
diff --git a/mesalib/src/mesa/vbo/vbo_save.h b/mesalib/src/mesa/vbo/vbo_save.h
index 4d4a5bf17..0b4d563a7 100644
--- a/mesalib/src/mesa/vbo/vbo_save.h
+++ b/mesalib/src/mesa/vbo/vbo_save.h
@@ -187,6 +187,14 @@ void vbo_save_playback_vertex_list( struct gl_context *ctx, void *data );
void vbo_save_api_init( struct vbo_save_context *save );
+GLfloat *
+vbo_save_map_vertex_store(struct gl_context *ctx,
+ struct vbo_save_vertex_store *vertex_store);
+
+void
+vbo_save_unmap_vertex_store(struct gl_context *ctx,
+ struct vbo_save_vertex_store *vertex_store);
+
#else /* FEATURE_dlist */
static inline void
diff --git a/mesalib/src/mesa/vbo/vbo_save_api.c b/mesalib/src/mesa/vbo/vbo_save_api.c
index 952136747..13604333e 100644
--- a/mesalib/src/mesa/vbo/vbo_save_api.c
+++ b/mesalib/src/mesa/vbo/vbo_save_api.c
@@ -237,9 +237,9 @@ free_vertex_store(struct gl_context *ctx,
}
-static GLfloat *
-map_vertex_store(struct gl_context *ctx,
- struct vbo_save_vertex_store *vertex_store)
+GLfloat *
+vbo_save_map_vertex_store(struct gl_context *ctx,
+ struct vbo_save_vertex_store *vertex_store)
{
assert(vertex_store->bufferobj);
assert(!vertex_store->buffer);
@@ -259,9 +259,9 @@ map_vertex_store(struct gl_context *ctx,
}
-static void
-unmap_vertex_store(struct gl_context *ctx,
- struct vbo_save_vertex_store *vertex_store)
+void
+vbo_save_unmap_vertex_store(struct gl_context *ctx,
+ struct vbo_save_vertex_store *vertex_store)
{
if (vertex_store->bufferobj->Size > 0) {
ctx->Driver.UnmapBuffer(ctx, vertex_store->bufferobj);
@@ -407,7 +407,7 @@ _save_compile_vertex_list(struct gl_context *ctx)
/* Unmap old store:
*/
- unmap_vertex_store(ctx, save->vertex_store);
+ vbo_save_unmap_vertex_store(ctx, save->vertex_store);
/* Release old reference:
*/
@@ -418,7 +418,7 @@ _save_compile_vertex_list(struct gl_context *ctx)
/* Allocate and map new store:
*/
save->vertex_store = alloc_vertex_store(ctx);
- save->buffer_ptr = map_vertex_store(ctx, save->vertex_store);
+ save->buffer_ptr = vbo_save_map_vertex_store(ctx, save->vertex_store);
save->out_of_memory = save->buffer_ptr == NULL;
}
@@ -1398,7 +1398,7 @@ vbo_save_NewList(struct gl_context *ctx, GLuint list, GLenum mode)
if (!save->vertex_store)
save->vertex_store = alloc_vertex_store(ctx);
- save->buffer_ptr = map_vertex_store(ctx, save->vertex_store);
+ save->buffer_ptr = vbo_save_map_vertex_store(ctx, save->vertex_store);
_save_reset_vertex(ctx);
_save_reset_counters(ctx);
@@ -1435,7 +1435,7 @@ vbo_save_EndList(struct gl_context *ctx)
_mesa_install_save_vtxfmt(ctx, &ctx->ListState.ListVtxfmt);
}
- unmap_vertex_store(ctx, save->vertex_store);
+ vbo_save_unmap_vertex_store(ctx, save->vertex_store);
assert(save->vertex_size == 0);
}
diff --git a/mesalib/src/mesa/vbo/vbo_save_draw.c b/mesalib/src/mesa/vbo/vbo_save_draw.c
index b903757c0..b8e1e7883 100644
--- a/mesalib/src/mesa/vbo/vbo_save_draw.c
+++ b/mesalib/src/mesa/vbo/vbo_save_draw.c
@@ -249,6 +249,19 @@ vbo_save_playback_vertex_list(struct gl_context *ctx, void *data)
(const struct vbo_save_vertex_list *) data;
struct vbo_save_context *save = &vbo_context(ctx)->save;
struct vbo_exec_context *exec = &vbo_context(ctx)->exec;
+ GLboolean remap_vertex_store = GL_FALSE;
+
+ if (save->vertex_store->buffer) {
+ /* The vertex store is currently mapped but we're about to replay
+ * a display list. This can happen when a nested display list is
+ * being build with GL_COMPILE_AND_EXECUTE.
+ * We never want to have mapped vertex buffers when we're drawing.
+ * Unmap the vertex store, execute the list, then remap the vertex
+ * store.
+ */
+ vbo_save_unmap_vertex_store(ctx, save->vertex_store);
+ remap_vertex_store = GL_TRUE;
+ }
FLUSH_CURRENT(ctx, 0);
@@ -264,14 +277,16 @@ vbo_save_playback_vertex_list(struct gl_context *ctx, void *data)
printf("displaylist recursive begin");
vbo_save_loopback_vertex_list( ctx, node );
- return;
+
+ goto end;
}
else if (save->replay_flags) {
/* Various degnerate cases: translate into immediate mode
* calls rather than trying to execute in place.
*/
vbo_save_loopback_vertex_list( ctx, node );
- return;
+
+ goto end;
}
if (ctx->NewState)
@@ -310,6 +325,11 @@ vbo_save_playback_vertex_list(struct gl_context *ctx, void *data)
/* Copy to current?
*/
_playback_copy_to_current( ctx, node );
+
+end:
+ if (remap_vertex_store) {
+ save->buffer_ptr = vbo_save_map_vertex_store(ctx, save->vertex_store);
+ }
}