From b899f5e59c875ab4167fdcf024815c1e751c5c23 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mathias=20Fr=C3=B6hlich?= Date: Mon, 29 Oct 2018 06:13:19 +0100 Subject: [PATCH] vbo: Move no_current_update out of _mesa_prim. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The _mesa_prim::no_current_update flag should tell the compiled display list if the current attributes that are placed in the dlists vbo shall take a defined state past replay of a display list. Immediate mode draws compiled into display lists should set the current values. Array draws may leave the current values in undefined state. So finally this flag is not a property of every primitive but it is a property of the compiled display list and there it is a property of the last primitive compiled into the list. So move the flag out of _mesa_prim into vbo_save. Reviewed-by: Brian Paul Signed-off-by: Mathias Fröhlich --- src/mesa/vbo/vbo.h | 3 +-- src/mesa/vbo/vbo_save.c | 2 ++ src/mesa/vbo/vbo_save.h | 2 ++ src/mesa/vbo/vbo_save_api.c | 10 ++++------ 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/mesa/vbo/vbo.h b/src/mesa/vbo/vbo.h index eccef1a3ffc..ac0be5acf4a 100644 --- a/src/mesa/vbo/vbo.h +++ b/src/mesa/vbo/vbo.h @@ -46,9 +46,8 @@ struct _mesa_prim GLuint indexed:1; GLuint begin:1; GLuint end:1; - GLuint no_current_update:1; GLuint is_indirect:1; - GLuint pad:19; + GLuint pad:20; GLuint start; GLuint count; diff --git a/src/mesa/vbo/vbo_save.c b/src/mesa/vbo/vbo_save.c index 7e77123ba8c..55b7792b85b 100644 --- a/src/mesa/vbo/vbo_save.c +++ b/src/mesa/vbo/vbo_save.c @@ -47,6 +47,8 @@ void vbo_save_init( struct gl_context *ctx ) for (gl_vertex_processing_mode vpm = VP_MODE_FF; vpm < VP_MODE_MAX; ++vpm) save->VAO[vpm] = NULL; + save->no_current_update = false; + ctx->Driver.CurrentSavePrimitive = PRIM_OUTSIDE_BEGIN_END; } diff --git a/src/mesa/vbo/vbo_save.h b/src/mesa/vbo/vbo_save.h index 65293c93f04..6f2cc5bad42 100644 --- a/src/mesa/vbo/vbo_save.h +++ b/src/mesa/vbo/vbo_save.h @@ -173,6 +173,8 @@ struct vbo_save_context { struct _mesa_prim *prims; GLuint prim_count, prim_max; + bool no_current_update; + struct vbo_save_vertex_store *vertex_store; struct vbo_save_primitive_store *prim_store; diff --git a/src/mesa/vbo/vbo_save_api.c b/src/mesa/vbo/vbo_save_api.c index 4cc315136c7..28f8c46793b 100644 --- a/src/mesa/vbo/vbo_save_api.c +++ b/src/mesa/vbo/vbo_save_api.c @@ -602,7 +602,7 @@ compile_vertex_list(struct gl_context *ctx) node->prim_store->refcount++; - if (node->prims[0].no_current_update) { + if (save->no_current_update) { node->current_data = NULL; } else { @@ -720,7 +720,6 @@ wrap_buffers(struct gl_context *ctx) struct vbo_save_context *save = &vbo_context(ctx)->save; GLint i = save->prim_count - 1; GLenum mode; - GLboolean no_current_update; assert(i < (GLint) save->prim_max); assert(i >= 0); @@ -729,7 +728,6 @@ wrap_buffers(struct gl_context *ctx) */ save->prims[i].count = (save->vert_count - save->prims[i].start); mode = save->prims[i].mode; - no_current_update = save->prims[i].no_current_update; /* store the copied vertices, and allocate a new list. */ @@ -738,7 +736,6 @@ wrap_buffers(struct gl_context *ctx) /* Restart interrupted primitive */ save->prims[0].mode = mode; - save->prims[0].no_current_update = no_current_update; save->prims[0].begin = 0; save->prims[0].end = 0; save->prims[0].pad = 0; @@ -1205,8 +1202,6 @@ vbo_save_NotifyBegin(struct gl_context *ctx, GLenum mode) save->prims[i].mode = mode & VBO_SAVE_PRIM_MODE_MASK; save->prims[i].begin = 1; save->prims[i].end = 0; - save->prims[i].no_current_update = - (mode & VBO_SAVE_PRIM_NO_CURRENT_UPDATE) ? 1 : 0; save->prims[i].pad = 0; save->prims[i].start = save->vert_count; save->prims[i].count = 0; @@ -1214,6 +1209,9 @@ vbo_save_NotifyBegin(struct gl_context *ctx, GLenum mode) save->prims[i].base_instance = 0; save->prims[i].is_indirect = 0; + save->no_current_update = + (mode & VBO_SAVE_PRIM_NO_CURRENT_UPDATE) ? 1 : 0; + if (save->out_of_memory) { _mesa_install_save_vtxfmt(ctx, &save->vtxfmt_noop); }