[Mesa-dev] [PATCH 09/14] vbo: Make no_current_update an argument to vbo_save_NotifyBegin.

Eric Engestrom eric.engestrom at intel.com
Tue Oct 30 12:24:50 UTC 2018


On Tuesday, 2018-10-30 06:07:20 +0100, Mathias.Froehlich at gmx.net wrote:
> From: Mathias Fröhlich <mathias.froehlich at web.de>
> 
> Instead of coding additional information into the primitive
> mode, make the only remaining flag there a direct argument to
> vbo_save_NotifyBegin.
> 
> Signed-off-by: Mathias Fröhlich <Mathias.Froehlich at web.de>
> ---
>  src/mesa/main/dlist.c       |  2 +-
>  src/mesa/vbo/vbo.h          |  3 ++-
>  src/mesa/vbo/vbo_save.h     |  1 -
>  src/mesa/vbo/vbo_save_api.c | 14 +++++++-------
>  4 files changed, 10 insertions(+), 10 deletions(-)
> 
> diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c
> index ae23d29283..97461cede3 100644
> --- a/src/mesa/main/dlist.c
> +++ b/src/mesa/main/dlist.c
> @@ -6094,7 +6094,7 @@ save_Begin(GLenum mode)
>     else {
>        ctx->Driver.CurrentSavePrimitive = mode;
>  
> -      vbo_save_NotifyBegin(ctx, mode);
> +      vbo_save_NotifyBegin(ctx, mode, false);
>     }
>  }
>  
> diff --git a/src/mesa/vbo/vbo.h b/src/mesa/vbo/vbo.h
> index ac0be5acf4..60b725468d 100644
> --- a/src/mesa/vbo/vbo.h
> +++ b/src/mesa/vbo/vbo.h
> @@ -100,7 +100,8 @@ void
>  vbo_save_SaveFlushVertices(struct gl_context *ctx);
>  
>  void
> -vbo_save_NotifyBegin(struct gl_context *ctx, GLenum mode);
> +vbo_save_NotifyBegin(struct gl_context *ctx, GLenum mode,
> +                     bool no_current_update);
>  
>  void
>  vbo_save_NewList(struct gl_context *ctx, GLuint list, GLenum mode);
> diff --git a/src/mesa/vbo/vbo_save.h b/src/mesa/vbo/vbo_save.h
> index 6f2cc5bad4..e8677b1ac5 100644
> --- a/src/mesa/vbo/vbo_save.h
> +++ b/src/mesa/vbo/vbo_save.h
> @@ -137,7 +137,6 @@ _vbo_save_get_vertex_count(const struct vbo_save_vertex_list *node)
>  #define VBO_SAVE_BUFFER_SIZE (256*1024) /* dwords */
>  #define VBO_SAVE_PRIM_SIZE   128
>  #define VBO_SAVE_PRIM_MODE_MASK         0x3f
> -#define VBO_SAVE_PRIM_NO_CURRENT_UPDATE 0x80
>  
>  struct vbo_save_vertex_store {
>     struct gl_buffer_object *bufferobj;
> diff --git a/src/mesa/vbo/vbo_save_api.c b/src/mesa/vbo/vbo_save_api.c
> index 28f8c46793..896a8ac329 100644
> --- a/src/mesa/vbo/vbo_save_api.c
> +++ b/src/mesa/vbo/vbo_save_api.c
> @@ -1193,7 +1193,8 @@ _save_CallLists(GLsizei n, GLenum type, const GLvoid * v)
>   * Updating of ctx->Driver.CurrentSavePrimitive is already taken care of.
>   */
>  void
> -vbo_save_NotifyBegin(struct gl_context *ctx, GLenum mode)
> +vbo_save_NotifyBegin(struct gl_context *ctx, GLenum mode,
> +                     bool no_current_update)
>  {
>     struct vbo_save_context *save = &vbo_context(ctx)->save;
>     const GLuint i = save->prim_count++;
> @@ -1209,8 +1210,7 @@ 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;
> +   save->no_current_update = no_current_update;
>  
>     if (save->out_of_memory) {
>        _mesa_install_save_vtxfmt(ctx, &save->vtxfmt_noop);
> @@ -1280,7 +1280,7 @@ _save_PrimitiveRestartNV(void)
>  
>        /* restart primitive */
>        CALL_End(GET_DISPATCH(), ());
> -      vbo_save_NotifyBegin(ctx, curPrim);
> +      vbo_save_NotifyBegin(ctx, curPrim, false);
>     }
>  }
>  
> @@ -1294,7 +1294,7 @@ static void GLAPIENTRY
>  _save_OBE_Rectf(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2)
>  {
>     GET_CURRENT_CONTEXT(ctx);
> -   vbo_save_NotifyBegin(ctx, GL_QUADS);
> +   vbo_save_NotifyBegin(ctx, GL_QUADS, true);

I won't pretend to understand any of this code, but logic-wise I think
this should be `false`, not `true`.
If the change was on purpose, maybe it belongs in a separate patch with
an explanation?

>     CALL_Vertex2f(GET_DISPATCH(), (x1, y1));
>     CALL_Vertex2f(GET_DISPATCH(), (x2, y1));
>     CALL_Vertex2f(GET_DISPATCH(), (x2, y2));
> @@ -1327,7 +1327,7 @@ _save_OBE_DrawArrays(GLenum mode, GLint start, GLsizei count)
>  
>     _ae_map_vbos(ctx);
>  
> -   vbo_save_NotifyBegin(ctx, (mode | VBO_SAVE_PRIM_NO_CURRENT_UPDATE));
> +   vbo_save_NotifyBegin(ctx, mode, true);
>  
>     for (i = 0; i < count; i++)
>        CALL_ArrayElement(GET_DISPATCH(), (start + i));
> @@ -1410,7 +1410,7 @@ _save_OBE_DrawElementsBaseVertex(GLenum mode, GLsizei count, GLenum type,
>        indices =
>           ADD_POINTERS(indexbuf->Mappings[MAP_INTERNAL].Pointer, indices);
>  
> -   vbo_save_NotifyBegin(ctx, (mode | VBO_SAVE_PRIM_NO_CURRENT_UPDATE));
> +   vbo_save_NotifyBegin(ctx, mode, true);
>  
>     switch (type) {
>     case GL_UNSIGNED_BYTE:
> -- 
> 2.17.2
> 
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list