Mesa (main): mesa/vbo: Always use buffer objects for storage

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Dec 7 19:02:50 UTC 2021


Module: Mesa
Branch: main
Commit: 087f196a084ecff01a18b939e1c3b877ef14cbcd
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=087f196a084ecff01a18b939e1c3b877ef14cbcd

Author: Adam Jackson <ajax at redhat.com>
Date:   Wed Jun  2 00:07:36 2021 -0400

mesa/vbo: Always use buffer objects for storage

Reviewed-by: Dave Airlie <airlied at redhat.com>
Reviewed-by: Marek Olšák <marek.olsak at amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14098>

---

 src/mesa/state_tracker/st_context.c |  2 +-
 src/mesa/vbo/vbo.h                  |  2 +-
 src/mesa/vbo/vbo_context.c          |  4 ++--
 src/mesa/vbo/vbo_exec.c             |  4 ++--
 src/mesa/vbo/vbo_exec.h             |  4 ++--
 src/mesa/vbo/vbo_exec_api.c         | 14 ++------------
 6 files changed, 10 insertions(+), 20 deletions(-)

diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c
index 36c0ebb37ec..d7e39e44fe0 100644
--- a/src/mesa/state_tracker/st_context.c
+++ b/src/mesa/state_tracker/st_context.c
@@ -856,7 +856,7 @@ st_create_context_priv(struct gl_context *ctx, struct pipe_context *pipe,
    /* This must be done after extensions are initialized to enable persistent
     * mappings immediately.
     */
-   _vbo_CreateContext(ctx, true);
+   _vbo_CreateContext(ctx);
 
    _mesa_initialize_dispatch_tables(ctx);
    _mesa_initialize_vbo_vtxfmt(ctx);
diff --git a/src/mesa/vbo/vbo.h b/src/mesa/vbo/vbo.h
index c01ff41030e..cebe442cca0 100644
--- a/src/mesa/vbo/vbo.h
+++ b/src/mesa/vbo/vbo.h
@@ -184,7 +184,7 @@ struct vbo_save_context {
 };
 
 GLboolean
-_vbo_CreateContext(struct gl_context *ctx, bool use_buffer_objects);
+_vbo_CreateContext(struct gl_context *ctx);
 
 void
 _vbo_DestroyContext(struct gl_context *ctx);
diff --git a/src/mesa/vbo/vbo_context.c b/src/mesa/vbo/vbo_context.c
index 9930894d9db..f6102f30346 100644
--- a/src/mesa/vbo/vbo_context.c
+++ b/src/mesa/vbo/vbo_context.c
@@ -159,7 +159,7 @@ vbo_exec_update_eval_maps(struct gl_context *ctx)
 
 
 GLboolean
-_vbo_CreateContext(struct gl_context *ctx, bool use_buffer_objects)
+_vbo_CreateContext(struct gl_context *ctx)
 {
    struct vbo_context *vbo = &ctx->vbo_context;
 
@@ -180,7 +180,7 @@ _vbo_CreateContext(struct gl_context *ctx, bool use_buffer_objects)
     * will pretty much be permanently installed, which means that the
     * vtxfmt mechanism can be removed now.
     */
-   vbo_exec_init(ctx, use_buffer_objects);
+   vbo_exec_init(ctx);
    if (ctx->API == API_OPENGL_COMPAT)
       vbo_save_init(ctx);
 
diff --git a/src/mesa/vbo/vbo_exec.c b/src/mesa/vbo/vbo_exec.c
index bc8e6448b16..fbc65bed865 100644
--- a/src/mesa/vbo/vbo_exec.c
+++ b/src/mesa/vbo/vbo_exec.c
@@ -109,11 +109,11 @@ _vbo_attribute_alias_map[VP_MODE_MAX][VERT_ATTRIB_MAX] = {
 
 
 void
-vbo_exec_init(struct gl_context *ctx, bool use_buffer_objects)
+vbo_exec_init(struct gl_context *ctx)
 {
    struct vbo_exec_context *exec = &vbo_context(ctx)->exec;
 
-   vbo_exec_vtx_init(exec, use_buffer_objects);
+   vbo_exec_vtx_init(exec);
 
    ctx->Driver.NeedFlush = 0;
    ctx->Driver.CurrentExecPrimitive = PRIM_OUTSIDE_BEGIN_END;
diff --git a/src/mesa/vbo/vbo_exec.h b/src/mesa/vbo/vbo_exec.h
index c8b141dbc5b..b8ba42b851d 100644
--- a/src/mesa/vbo/vbo_exec.h
+++ b/src/mesa/vbo/vbo_exec.h
@@ -40,13 +40,13 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
 #include "vbo_attrib.h"
 
 void
-vbo_exec_init(struct gl_context *ctx, bool use_buffer_objects);
+vbo_exec_init(struct gl_context *ctx);
 
 void
 vbo_exec_destroy(struct gl_context *ctx);
 
 void
-vbo_exec_vtx_init(struct vbo_exec_context *exec, bool use_buffer_objects);
+vbo_exec_vtx_init(struct vbo_exec_context *exec);
 
 void
 vbo_exec_vtx_destroy(struct vbo_exec_context *exec);
diff --git a/src/mesa/vbo/vbo_exec_api.c b/src/mesa/vbo/vbo_exec_api.c
index 6b61b739289..ed78f4fddf7 100644
--- a/src/mesa/vbo/vbo_exec_api.c
+++ b/src/mesa/vbo/vbo_exec_api.c
@@ -1030,21 +1030,11 @@ vbo_reset_all_attr(struct vbo_exec_context *exec)
 
 
 void
-vbo_exec_vtx_init(struct vbo_exec_context *exec, bool use_buffer_objects)
+vbo_exec_vtx_init(struct vbo_exec_context *exec)
 {
    struct gl_context *ctx = gl_context_from_vbo_exec(exec);
 
-   if (use_buffer_objects) {
-      /* Use buffer objects for immediate mode. */
-      struct vbo_exec_context *exec = &vbo_context(ctx)->exec;
-      exec->vtx.bufferobj = ctx->Driver.NewBufferObject(ctx, IMM_BUFFER_NAME);
-   } else {
-      /* Use allocated memory for immediate mode. */
-      exec->vtx.bufferobj = NULL;
-      exec->vtx.buffer_map =
-         align_malloc(ctx->Const.glBeginEndBufferSize, 64);
-      exec->vtx.buffer_ptr = exec->vtx.buffer_map;
-   }
+   exec->vtx.bufferobj = ctx->Driver.NewBufferObject(ctx, IMM_BUFFER_NAME);
 
    vbo_exec_vtxfmt_init(exec);
    _mesa_noop_vtxfmt_init(ctx, &exec->vtxfmt_noop);



More information about the mesa-commit mailing list