vbo: remove immediate mode code that doesn't do anything and simplify stuff
authorMarek Olšák <marek.olsak@amd.com>
Wed, 22 Jan 2020 23:49:51 +0000 (18:49 -0500)
committerMarge Bot <eric+marge@anholt.net>
Tue, 11 Feb 2020 00:34:57 +0000 (00:34 +0000)
no change in behavior

Reviewed-by: Mathias Fröhlich <mathias.froehlich@web.de>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3766>

src/mesa/drivers/dri/i965/brw_context.c
src/mesa/state_tracker/st_context.c
src/mesa/vbo/vbo.h
src/mesa/vbo/vbo_exec.h
src/mesa/vbo/vbo_exec_api.c

index 16f987812fc463ecfd1d6fa627232c14d226a792..eda8ba2fe70f261116da50f178c8560db58c43f7 100644 (file)
@@ -1135,7 +1135,6 @@ brwCreateContext(gl_api api,
       brw_init_performance_queries(brw);
 
    vbo_use_buffer_objects(ctx);
-   vbo_always_unmap_buffers(ctx);
 
    brw->ctx.Cache = brw->screen->disk_cache;
 
index 5aec2f5bb23819099f78ee141b2cac3f053d7802..d66bd2b904b5cd684dab29daa9b9caf2b551236f 100644 (file)
@@ -620,14 +620,9 @@ st_create_context_priv(struct gl_context *ctx, struct pipe_context *pipe,
    /* we want all vertex data to be placed in buffer objects */
    vbo_use_buffer_objects(ctx);
 
-
-   /* make sure that no VBOs are left mapped when we're drawing. */
-   vbo_always_unmap_buffers(ctx);
-
    /* Need these flags:
     */
    ctx->FragmentProgram._MaintainTexEnvProgram = GL_TRUE;
-
    ctx->VertexProgram._MaintainTnlProgram = GL_TRUE;
 
    if (no_error)
index 3399fcdea466f88bd0e5e6243ddb4addfa74ade6..3dcc44857578a51c97441225545d901b1e8cb3da 100644 (file)
@@ -95,9 +95,6 @@ vbo_get_minmax_indices(struct gl_context *ctx, const struct _mesa_prim *prim,
 void
 vbo_use_buffer_objects(struct gl_context *ctx);
 
-void
-vbo_always_unmap_buffers(struct gl_context *ctx);
-
 void
 vbo_sw_primitive_restart(struct gl_context *ctx,
                          const struct _mesa_prim *prim,
index a5f7888ad4bd0a4ddedca9696babde9fc5ce296e..2c1fb1e6e3aecfc0f98f72f7e41a4cc596c78e7d 100644 (file)
@@ -109,9 +109,6 @@ struct vbo_exec_context
       struct vbo_exec_eval2_map map2[VERT_ATTRIB_MAX];
    } eval;
 
-   /* Which flags to set in vbo_exec_begin_vertices() */
-   GLbitfield begin_vertices_flags;
-
 #ifndef NDEBUG
    GLint flush_call_depth;
 #endif
index 2fac34c20736102be41bb62bdb88b5f0f7142220..01b228f13c21cf02c6bba13c2780c164ceb87397 100644 (file)
@@ -440,24 +440,6 @@ vbo_exec_fixup_vertex(struct gl_context *ctx, GLuint attr,
 }
 
 
-/**
- * Called upon first glVertex, glColor, glTexCoord, etc.
- */
-static void
-vbo_exec_begin_vertices(struct gl_context *ctx)
-{
-   struct vbo_exec_context *exec = &vbo_context(ctx)->exec;
-
-   if (unlikely(!exec->vtx.buffer_ptr))
-      vbo_exec_vtx_map(exec);
-
-   assert((ctx->Driver.NeedFlush & FLUSH_UPDATE_CURRENT) == 0);
-   assert(exec->begin_vertices_flags);
-
-   ctx->Driver.NeedFlush |= exec->begin_vertices_flags;
-}
-
-
 /**
  * If index=0, does glVertexAttrib*() alias glVertex() to emit a vertex?
  * It depends on a few things, including whether we're inside or outside
@@ -508,10 +490,6 @@ do {                                                                    \
       /* This is a glVertex call */                                     \
       GLuint i;                                                         \
                                                                         \
-      if (unlikely((ctx->Driver.NeedFlush & FLUSH_UPDATE_CURRENT) == 0)) { \
-         vbo_exec_begin_vertices(ctx);                                  \
-      }                                                                 \
-                                                                        \
       if (unlikely(!exec->vtx.buffer_ptr)) {                            \
          vbo_exec_vtx_map(exec);                                        \
       }                                                                 \
@@ -525,7 +503,8 @@ do {                                                                    \
                                                                         \
       /* Set FLUSH_STORED_VERTICES to indicate that there's now */      \
       /* something to draw (not just updating a color or texcoord).*/   \
-      ctx->Driver.NeedFlush |= FLUSH_STORED_VERTICES;                   \
+      ctx->Driver.NeedFlush |= FLUSH_UPDATE_CURRENT |                   \
+                               FLUSH_STORED_VERTICES;                   \
                                                                         \
       if (++exec->vtx.vert_count >= exec->vtx.max_vert)                 \
          vbo_exec_vtx_wrap(exec);                                       \
@@ -988,20 +967,6 @@ vbo_use_buffer_objects(struct gl_context *ctx)
 }
 
 
-/**
- * If this function is called, all VBO buffers will be unmapped when
- * we flush.
- * Otherwise, if a simple command like glColor3f() is called and we flush,
- * the current VBO may be left mapped.
- */
-void
-vbo_always_unmap_buffers(struct gl_context *ctx)
-{
-   struct vbo_exec_context *exec = &vbo_context(ctx)->exec;
-   exec->begin_vertices_flags |= FLUSH_STORED_VERTICES;
-}
-
-
 void
 vbo_exec_vtx_init(struct vbo_exec_context *exec)
 {
@@ -1034,8 +999,6 @@ vbo_exec_vtx_init(struct vbo_exec_context *exec)
    }
 
    exec->vtx.vertex_size = 0;
-
-   exec->begin_vertices_flags = FLUSH_UPDATE_CURRENT;
 }
 
 
@@ -1100,8 +1063,7 @@ vbo_exec_FlushVertices(struct gl_context *ctx, GLuint flags)
    /* Flush (draw), and make sure VBO is left unmapped when done */
    vbo_exec_FlushVertices_internal(exec, GL_TRUE);
 
-   /* Need to do this to ensure vbo_exec_begin_vertices gets called again:
-    */
+   /* Clear the dirty flush flags, because the flush is finished. */
    ctx->Driver.NeedFlush &= ~(FLUSH_UPDATE_CURRENT | flags);
 
 #ifndef NDEBUG