[Mesa-dev] [PATCH 5/8] mesa: rework vbo_exec_init()
Timothy Arceri
tarceri at itsqueeze.com
Wed Jun 7 06:02:02 UTC 2017
Here we make some assumptions about the AEcontext and set the
recalculate bools directly.
Some formating fixes are also made while we are here.
---
src/mesa/main/api_arrayelt.c | 6 ++++++
src/mesa/main/api_arrayelt.h | 1 +
src/mesa/vbo/vbo_exec.c | 18 ++++++++++--------
3 files changed, 17 insertions(+), 8 deletions(-)
diff --git a/src/mesa/main/api_arrayelt.c b/src/mesa/main/api_arrayelt.c
index 46175e4..c973c5e 100644
--- a/src/mesa/main/api_arrayelt.c
+++ b/src/mesa/main/api_arrayelt.c
@@ -87,20 +87,26 @@ AE_CONTEXT(struct gl_context *ctx)
* in the range [0, 7]. Luckily these type tokens are sequentially
* numbered in gl.h, except for GL_DOUBLE.
*/
static inline int
TYPE_IDX(GLenum t)
{
return t == GL_DOUBLE ? 7 : t & 7;
}
+bool
+_ae_is_state_dirty(struct gl_context *ctx) {
+ return AE_CONTEXT(ctx)->NewState;
+}
+
+
#define NUM_TYPES 8
static const int ColorFuncs[2][NUM_TYPES] = {
{
_gloffset_Color3bv,
_gloffset_Color3ubv,
_gloffset_Color3sv,
_gloffset_Color3usv,
_gloffset_Color3iv,
diff --git a/src/mesa/main/api_arrayelt.h b/src/mesa/main/api_arrayelt.h
index 03cd9ec..9ae79a9 100644
--- a/src/mesa/main/api_arrayelt.h
+++ b/src/mesa/main/api_arrayelt.h
@@ -27,20 +27,21 @@
#ifndef API_ARRAYELT_H
#define API_ARRAYELT_H
#include "main/mtypes.h"
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, GLbitfield new_state );
+extern bool _ae_is_state_dirty(struct gl_context *ctx);
extern void GLAPIENTRY _ae_ArrayElement( GLint elt );
/* May optionally be called before a batch of element calls:
*/
extern void _ae_map_vbos( struct gl_context *ctx );
extern void _ae_unmap_vbos( struct gl_context *ctx );
extern void
_mesa_install_arrayelt_vtxfmt(struct _glapi_table *disp,
const GLvertexformat *vfmt);
diff --git a/src/mesa/vbo/vbo_exec.c b/src/mesa/vbo/vbo_exec.c
index 4db4f40..de8461f 100644
--- a/src/mesa/vbo/vbo_exec.c
+++ b/src/mesa/vbo/vbo_exec.c
@@ -27,38 +27,40 @@
#include "main/api_arrayelt.h"
#include "main/glheader.h"
#include "main/mtypes.h"
#include "main/vtxfmt.h"
#include "vbo_context.h"
-void vbo_exec_init( struct gl_context *ctx )
+void
+vbo_exec_init(struct gl_context *ctx)
{
struct vbo_exec_context *exec = &vbo_context(ctx)->exec;
exec->ctx = ctx;
- /* Initialize the arrayelt helper
- */
- if (!ctx->aelt_context &&
- !_ae_create_context( ctx ))
- return;
+ /* aelt_context should have been created by the caller */
+ assert(ctx->aelt_context);
- vbo_exec_vtx_init( exec );
+ vbo_exec_vtx_init(exec);
ctx->Driver.NeedFlush = 0;
ctx->Driver.CurrentExecPrimitive = PRIM_OUTSIDE_BEGIN_END;
- vbo_exec_invalidate_state( ctx, ~0 );
+ /* The aelt_context state should still be dirty from its creation */
+ assert(_ae_is_state_dirty(ctx));
+
+ exec->array.recalculate_inputs = GL_TRUE;
+ exec->eval.recalculate_maps = GL_TRUE;
}
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;
--
2.9.4
More information about the mesa-dev
mailing list