[Mesa-dev] [PATCH 04/10] mesa: Rip out now unused gl_context::aelt_context.

Mathias.Froehlich at gmx.net Mathias.Froehlich at gmx.net
Thu May 2 09:27:14 UTC 2019


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

Now this part of gl_context state is unused and can be removed.

Signed-off-by: Mathias Fröhlich <Mathias.Froehlich at web.de>
---
 src/mesa/drivers/dri/r200/r200_context.c     |   1 -
 src/mesa/drivers/dri/radeon/radeon_context.c |   1 -
 src/mesa/main/api_arrayelt.c                 | 180 -------------------
 src/mesa/main/api_arrayelt.h                 |   4 -
 src/mesa/main/mtypes.h                       |   1 -
 src/mesa/vbo/vbo_context.c                   |  15 --
 src/mesa/vbo/vbo_exec.c                      |  11 --
 7 files changed, 213 deletions(-)

diff --git a/src/mesa/drivers/dri/r200/r200_context.c b/src/mesa/drivers/dri/r200/r200_context.c
index 392c10fb74d..c97eaa56db1 100644
--- a/src/mesa/drivers/dri/r200/r200_context.c
+++ b/src/mesa/drivers/dri/r200/r200_context.c
@@ -256,7 +256,6 @@ GLboolean r200CreateContext( gl_api api,
    _vbo_CreateContext( ctx );
    _tnl_CreateContext( ctx );
    _swsetup_CreateContext( ctx );
-   _ae_create_context( ctx );

    ctx->Const.MaxTextureUnits = driQueryOptioni (&rmesa->radeon.optionCache,
 						 "texture_units");
diff --git a/src/mesa/drivers/dri/radeon/radeon_context.c b/src/mesa/drivers/dri/radeon/radeon_context.c
index db1cc7274db..415810f8bd8 100644
--- a/src/mesa/drivers/dri/radeon/radeon_context.c
+++ b/src/mesa/drivers/dri/radeon/radeon_context.c
@@ -219,7 +219,6 @@ r100CreateContext( gl_api api,
    _vbo_CreateContext( ctx );
    _tnl_CreateContext( ctx );
    _swsetup_CreateContext( ctx );
-   _ae_create_context( ctx );

    ctx->Const.MaxTextureUnits = driQueryOptioni (&rmesa->radeon.optionCache,
 						 "texture_units");
diff --git a/src/mesa/main/api_arrayelt.c b/src/mesa/main/api_arrayelt.c
index 62f1e73ca4c..6d4e548e7bd 100644
--- a/src/mesa/main/api_arrayelt.c
+++ b/src/mesa/main/api_arrayelt.c
@@ -45,39 +45,8 @@
 #include "main/dispatch.h"
 #include "varray.h"

-typedef void (GLAPIENTRY *array_func)( const void * );
-
-typedef struct {
-   const struct gl_array_attributes *array;
-   const struct gl_vertex_buffer_binding *binding;
-   int offset;
-} AEarray;
-
 typedef void (GLAPIENTRY *attrib_func)( GLuint indx, const void *data );

-typedef struct {
-   const struct gl_array_attributes *array;
-   const struct gl_vertex_buffer_binding *binding;
-   attrib_func func;
-   GLuint index;
-} AEattrib;
-
-typedef struct {
-   AEarray arrays[32];
-   AEattrib attribs[VERT_ATTRIB_MAX + 1];
-
-   bool dirty_state;
-} AEcontext;
-
-
-/** Cast wrapper */
-static inline AEcontext *
-AE_CONTEXT(struct gl_context *ctx)
-{
-   return (AEcontext *) ctx->aelt_context;
-}
-
-
 /*
  * Convert GL_BYTE, GL_UNSIGNED_BYTE, .. GL_DOUBLE into an integer
  * in the range [0, 7].  Luckily these type tokens are sequentially
@@ -107,13 +76,6 @@ NORM_IDX(const struct gl_vertex_format *vformat)
 }


-bool
-_ae_is_state_dirty(struct gl_context *ctx)
-{
-   return AE_CONTEXT(ctx)->dirty_state;
-}
-
-
 #define NUM_TYPES 8


@@ -1419,128 +1381,6 @@ static const attrib_func AttribFuncsARB[4][4][NUM_TYPES] = {
 };


-GLboolean
-_ae_create_context(struct gl_context *ctx)
-{
-   if (ctx->aelt_context)
-      return GL_TRUE;
-
-   ctx->aelt_context = calloc(1, sizeof(AEcontext));
-   if (!ctx->aelt_context)
-      return GL_FALSE;
-
-   AE_CONTEXT(ctx)->dirty_state = true;
-   return GL_TRUE;
-}
-
-
-void
-_ae_destroy_context(struct gl_context *ctx)
-{
-   if (AE_CONTEXT(ctx)) {
-      free(ctx->aelt_context);
-      ctx->aelt_context = NULL;
-   }
-}
-
-
-/**
- * Make a list of per-vertex functions to call for each glArrayElement call.
- * These functions access the array data (i.e. glVertex, glColor, glNormal,
- * etc).
- * Note: this may be called during display list construction.
- */
-static void
-_ae_update_state(struct gl_context *ctx)
-{
-   AEcontext *actx = AE_CONTEXT(ctx);
-   AEarray *aa = actx->arrays;  /* non-indexed arrays (ex: glNormal) */
-   AEattrib *at = actx->attribs;  /* indexed arrays (ex: glMultiTexCoord) */
-   GLuint i;
-   struct gl_vertex_array_object *vao = ctx->Array.VAO;
-
-   /* conventional vertex arrays */
-  for (i = 1; i < VERT_ATTRIB_FF_MAX; i++) {  /* skip zero! */
-      if (vao->Enabled & VERT_BIT_FF(i)) {
-         struct gl_array_attributes *attribArray =
-            &vao->VertexAttrib[VERT_ATTRIB_FF(i)];
-         /* NOTE: we use generic glVertexAttribNV functions here.
-          * If we ever remove GL_NV_vertex_program this will have to change.
-          */
-         at->array = attribArray;
-         at->binding = &vao->BufferBinding[attribArray->BufferBindingIndex];
-         assert(!at->array->Format.Normalized);
-         at->func = AttribFuncsNV[at->array->Format.Normalized]
-                                 [at->array->Format.Size-1]
-                                 [TYPE_IDX(at->array->Format.Type)];
-         at->index = VERT_ATTRIB_FF(i);
-         at++;
-      }
-   }
-
-   /* generic vertex attribute arrays */
-   for (i = 1; i < VERT_ATTRIB_GENERIC_MAX; i++) {  /* skip zero! */
-      if (vao->Enabled & VERT_BIT_GENERIC(i)) {
-         struct gl_array_attributes *attribArray =
-            &vao->VertexAttrib[VERT_ATTRIB_GENERIC(i)];
-         at->array = attribArray;
-         at->binding = &vao->BufferBinding[attribArray->BufferBindingIndex];
-         /* Note: we can't grab the _glapi_Dispatch->VertexAttrib1fvNV
-          * function pointer here (for float arrays) since the pointer may
-          * change from one execution of _ae_ArrayElement() to
-          * the next.  Doing so caused UT to break.
-          */
-         at->func = AttribFuncsARB[NORM_IDX(&at->array->Format)]
-            [at->array->Format.Size-1]
-            [TYPE_IDX(at->array->Format.Type)];
-
-         at->index = i;
-         at++;
-      }
-   }
-
-   /* finally, vertex position */
-   if (vao->Enabled & VERT_BIT_GENERIC0) {
-      struct gl_array_attributes *attribArray =
-         &vao->VertexAttrib[VERT_ATTRIB_GENERIC0];
-      /* Use glVertex(v) instead of glVertexAttrib(0, v) to be sure it's
-       * issued as the last (provoking) attribute).
-       */
-      at->array = attribArray;
-      at->binding = &vao->BufferBinding[attribArray->BufferBindingIndex];
-      /* Note: we can't grab the _glapi_Dispatch->VertexAttrib1fvNV
-       * function pointer here (for float arrays) since the pointer may
-       * change from one execution of _ae_ArrayElement() to
-       * the next.  Doing so caused UT to break.
-       */
-      at->func = AttribFuncsNV[at->array->Format.Normalized]
-                              [at->array->Format.Size-1]
-                              [TYPE_IDX(at->array->Format.Type)];
-
-      at->index = 0;
-      at++;
-   }
-   else if (vao->Enabled & VERT_BIT_POS) {
-      struct gl_array_attributes *attribArray =
-         &vao->VertexAttrib[VERT_ATTRIB_POS];
-      at->array = attribArray;
-      at->binding = &vao->BufferBinding[attribArray->BufferBindingIndex];
-      at->func = AttribFuncsNV[at->array->Format.Normalized]
-                              [at->array->Format.Size-1]
-                              [TYPE_IDX(at->array->Format.Type)];
-      at->index = 0;
-      at++;
-   }
-
-   assert(at - actx->attribs <= VERT_ATTRIB_MAX);
-   assert(aa - actx->arrays < 32);
-   at->func = NULL;  /* terminate the list */
-   aa->offset = -1;  /* terminate the list */
-
-   actx->dirty_state = false;
-}
-
-
 static inline attrib_func
 func_nv(const struct gl_vertex_format *vformat)
 {
@@ -1644,26 +1484,6 @@ _ae_ArrayElement(GLint elt)
 }


-void
-_ae_invalidate_state(struct gl_context *ctx)
-{
-   AEcontext *actx = AE_CONTEXT(ctx);
-
-   /* Only interested in this subset of mesa state.  Need to prune
-    * this down as both tnl/ and the drivers can raise statechanges
-    * for arcane reasons in the middle of seemingly atomic operations
-    * like DrawElements, over which we'd like to keep a known set of
-    * arrays and vbo's mapped.
-    *
-    * Luckily, neither the drivers nor tnl muck with the state that
-    * concerns us here:
-    */
-   assert(ctx->NewState & _NEW_ARRAY);
-
-   actx->dirty_state = true;
-}
-
-
 void
 _mesa_install_arrayelt_vtxfmt(struct _glapi_table *disp,
                               const GLvertexformat *vfmt)
diff --git a/src/mesa/main/api_arrayelt.h b/src/mesa/main/api_arrayelt.h
index da047b88c3e..eea229f0487 100644
--- a/src/mesa/main/api_arrayelt.h
+++ b/src/mesa/main/api_arrayelt.h
@@ -32,10 +32,6 @@

 struct _glapi_table;

-extern GLboolean _ae_create_context( struct gl_context *ctx );
-extern void _ae_destroy_context( struct gl_context *ctx );
-extern void _ae_invalidate_state(struct gl_context *ctx);
-extern bool _ae_is_state_dirty(struct gl_context *ctx);
 extern void _mesa_array_element(struct gl_context *ctx,
                                 struct _glapi_table *disp, GLint elt);
 extern void GLAPIENTRY _ae_ArrayElement( GLint elt );
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 8a94e632b65..abe91699a81 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -5118,7 +5118,6 @@ struct gl_context
    void *swtnl_context;
    struct vbo_context *vbo_context;
    struct st_context *st;
-   void *aelt_context;
    /*@}*/

    /**
diff --git a/src/mesa/vbo/vbo_context.c b/src/mesa/vbo/vbo_context.c
index 484625d9aca..4ba0a22bf02 100644
--- a/src/mesa/vbo/vbo_context.c
+++ b/src/mesa/vbo/vbo_context.c
@@ -153,9 +153,6 @@ vbo_exec_invalidate_state(struct gl_context *ctx)
    struct vbo_context *vbo = vbo_context(ctx);
    struct vbo_exec_context *exec = &vbo->exec;

-   if (ctx->NewState & _NEW_ARRAY) {
-      _ae_invalidate_state(ctx);
-   }
    if (ctx->NewState & _NEW_EVAL)
       exec->eval.recalculate_maps = GL_TRUE;
 }
@@ -168,13 +165,6 @@ _vbo_CreateContext(struct gl_context *ctx)

    ctx->vbo_context = vbo;

-   /* Initialize the arrayelt helper
-    */
-   if (!ctx->aelt_context &&
-       !_ae_create_context(ctx)) {
-      return GL_FALSE;
-   }
-
    vbo->binding.Offset = 0;
    vbo->binding.Stride = 0;
    vbo->binding.InstanceDivisor = 0;
@@ -211,11 +201,6 @@ _vbo_DestroyContext(struct gl_context *ctx)
 {
    struct vbo_context *vbo = vbo_context(ctx);

-   if (ctx->aelt_context) {
-      _ae_destroy_context(ctx);
-      ctx->aelt_context = NULL;
-   }
-
    if (vbo) {

       _mesa_reference_buffer_object(ctx, &vbo->binding.BufferObj, NULL);
diff --git a/src/mesa/vbo/vbo_exec.c b/src/mesa/vbo/vbo_exec.c
index 34dbc001c92..c4d4bc6e0ef 100644
--- a/src/mesa/vbo/vbo_exec.c
+++ b/src/mesa/vbo/vbo_exec.c
@@ -115,17 +115,11 @@ vbo_exec_init(struct gl_context *ctx)

    exec->ctx = ctx;

-   /* aelt_context should have been created by the caller */
-   assert(ctx->aelt_context);
-
    vbo_exec_vtx_init(exec);

    ctx->Driver.NeedFlush = 0;
    ctx->Driver.CurrentExecPrimitive = PRIM_OUTSIDE_BEGIN_END;

-   /* The aelt_context state should still be dirty from its creation */
-   assert(_ae_is_state_dirty(ctx));
-
    exec->eval.recalculate_maps = GL_TRUE;
 }

@@ -134,11 +128,6 @@ void vbo_exec_destroy( struct gl_context *ctx )
 {
    struct vbo_exec_context *exec = &vbo_context(ctx)->exec;

-   if (ctx->aelt_context) {
-      _ae_destroy_context( ctx );
-      ctx->aelt_context = NULL;
-   }
-
    vbo_exec_vtx_destroy( exec );
 }

--
2.20.1



More information about the mesa-dev mailing list