[Mesa-dev] [PATCH 08/14] vbo: Move no_current_update out of _mesa_prim.

Mathias.Froehlich at gmx.net Mathias.Froehlich at gmx.net
Tue Oct 30 05:07:19 UTC 2018


From: Mathias Fröhlich <mathias.froehlich at web.de>

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.

Signed-off-by: Mathias Fröhlich <Mathias.Froehlich at web.de>
---
 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 eccef1a3ff..ac0be5acf4 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 7e77123ba8..55b7792b85 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 65293c93f0..6f2cc5bad4 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 4cc315136c..28f8c46793 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);
    }
-- 
2.17.2



More information about the mesa-dev mailing list