From ee0263e03fbc897767bf8b787dc0cc917481e826 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Sat, 21 Mar 2020 01:40:30 -0400 Subject: [PATCH] mesa: replace _NEW_EVAL with vbo_exec_update_eval_maps Reviewed-by: Erik Faye-Lund Part-of: --- src/mesa/drivers/dri/i965/brw_state_upload.c | 1 - src/mesa/main/attrib.c | 2 +- src/mesa/main/debug.c | 3 +- src/mesa/main/enable.c | 57 +++++++++++++------- src/mesa/main/eval.c | 12 +++-- src/mesa/main/mtypes.h | 2 +- src/mesa/main/state.c | 1 - src/mesa/vbo/vbo.h | 2 +- src/mesa/vbo/vbo_context.c | 6 +-- 9 files changed, 52 insertions(+), 34 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_state_upload.c b/src/mesa/drivers/dri/i965/brw_state_upload.c index 87e459376a8..564ac0e677e 100644 --- a/src/mesa/drivers/dri/i965/brw_state_upload.c +++ b/src/mesa/drivers/dri/i965/brw_state_upload.c @@ -400,7 +400,6 @@ static struct dirty_bit_map mesa_bits[] = { DEFINE_BIT(_NEW_TEXTURE_MATRIX), DEFINE_BIT(_NEW_COLOR), DEFINE_BIT(_NEW_DEPTH), - DEFINE_BIT(_NEW_EVAL), DEFINE_BIT(_NEW_FOG), DEFINE_BIT(_NEW_HINT), DEFINE_BIT(_NEW_LIGHT), diff --git a/src/mesa/main/attrib.c b/src/mesa/main/attrib.c index e95bf19846b..b7e06ca21da 100644 --- a/src/mesa/main/attrib.c +++ b/src/mesa/main/attrib.c @@ -1178,7 +1178,7 @@ _mesa_PopAttrib(void) break; case GL_EVAL_BIT: memcpy(&ctx->Eval, attr->data, sizeof(struct gl_eval_attrib)); - ctx->NewState |= _NEW_EVAL; + vbo_exec_update_eval_maps(ctx); break; case GL_FOG_BIT: { diff --git a/src/mesa/main/debug.c b/src/mesa/main/debug.c index 5d00cc0a8c7..d3f4d82194b 100644 --- a/src/mesa/main/debug.c +++ b/src/mesa/main/debug.c @@ -73,7 +73,7 @@ void _mesa_print_state( const char *msg, GLuint state ) { _mesa_debug(NULL, - "%s: (0x%x) %s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n", + "%s: (0x%x) %s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n", msg, state, (state & _NEW_MODELVIEW) ? "ctx->ModelView, " : "", @@ -81,7 +81,6 @@ _mesa_print_state( const char *msg, GLuint state ) (state & _NEW_TEXTURE_MATRIX) ? "ctx->TextureMatrix, " : "", (state & _NEW_COLOR) ? "ctx->Color, " : "", (state & _NEW_DEPTH) ? "ctx->Depth, " : "", - (state & _NEW_EVAL) ? "ctx->Eval/EvalMap, " : "", (state & _NEW_FOG) ? "ctx->Fog, " : "", (state & _NEW_HINT) ? "ctx->Hint, " : "", (state & _NEW_LIGHT) ? "ctx->Light, " : "", diff --git a/src/mesa/main/enable.c b/src/mesa/main/enable.c index 7e0162b0040..8d33b71df75 100644 --- a/src/mesa/main/enable.c +++ b/src/mesa/main/enable.c @@ -405,7 +405,8 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state) goto invalid_enum_error; if (ctx->Eval.AutoNormal == state) return; - FLUSH_VERTICES(ctx, _NEW_EVAL); + FLUSH_VERTICES(ctx, 0); + vbo_exec_update_eval_maps(ctx); ctx->Eval.AutoNormal = state; break; case GL_BLEND: @@ -604,7 +605,8 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state) goto invalid_enum_error; if (ctx->Eval.Map1Color4 == state) return; - FLUSH_VERTICES(ctx, _NEW_EVAL); + FLUSH_VERTICES(ctx, 0); + vbo_exec_update_eval_maps(ctx); ctx->Eval.Map1Color4 = state; break; case GL_MAP1_INDEX: @@ -612,7 +614,8 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state) goto invalid_enum_error; if (ctx->Eval.Map1Index == state) return; - FLUSH_VERTICES(ctx, _NEW_EVAL); + FLUSH_VERTICES(ctx, 0); + vbo_exec_update_eval_maps(ctx); ctx->Eval.Map1Index = state; break; case GL_MAP1_NORMAL: @@ -620,7 +623,8 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state) goto invalid_enum_error; if (ctx->Eval.Map1Normal == state) return; - FLUSH_VERTICES(ctx, _NEW_EVAL); + FLUSH_VERTICES(ctx, 0); + vbo_exec_update_eval_maps(ctx); ctx->Eval.Map1Normal = state; break; case GL_MAP1_TEXTURE_COORD_1: @@ -628,7 +632,8 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state) goto invalid_enum_error; if (ctx->Eval.Map1TextureCoord1 == state) return; - FLUSH_VERTICES(ctx, _NEW_EVAL); + FLUSH_VERTICES(ctx, 0); + vbo_exec_update_eval_maps(ctx); ctx->Eval.Map1TextureCoord1 = state; break; case GL_MAP1_TEXTURE_COORD_2: @@ -636,7 +641,8 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state) goto invalid_enum_error; if (ctx->Eval.Map1TextureCoord2 == state) return; - FLUSH_VERTICES(ctx, _NEW_EVAL); + FLUSH_VERTICES(ctx, 0); + vbo_exec_update_eval_maps(ctx); ctx->Eval.Map1TextureCoord2 = state; break; case GL_MAP1_TEXTURE_COORD_3: @@ -644,7 +650,8 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state) goto invalid_enum_error; if (ctx->Eval.Map1TextureCoord3 == state) return; - FLUSH_VERTICES(ctx, _NEW_EVAL); + FLUSH_VERTICES(ctx, 0); + vbo_exec_update_eval_maps(ctx); ctx->Eval.Map1TextureCoord3 = state; break; case GL_MAP1_TEXTURE_COORD_4: @@ -652,7 +659,8 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state) goto invalid_enum_error; if (ctx->Eval.Map1TextureCoord4 == state) return; - FLUSH_VERTICES(ctx, _NEW_EVAL); + FLUSH_VERTICES(ctx, 0); + vbo_exec_update_eval_maps(ctx); ctx->Eval.Map1TextureCoord4 = state; break; case GL_MAP1_VERTEX_3: @@ -660,7 +668,8 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state) goto invalid_enum_error; if (ctx->Eval.Map1Vertex3 == state) return; - FLUSH_VERTICES(ctx, _NEW_EVAL); + FLUSH_VERTICES(ctx, 0); + vbo_exec_update_eval_maps(ctx); ctx->Eval.Map1Vertex3 = state; break; case GL_MAP1_VERTEX_4: @@ -668,7 +677,8 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state) goto invalid_enum_error; if (ctx->Eval.Map1Vertex4 == state) return; - FLUSH_VERTICES(ctx, _NEW_EVAL); + FLUSH_VERTICES(ctx, 0); + vbo_exec_update_eval_maps(ctx); ctx->Eval.Map1Vertex4 = state; break; case GL_MAP2_COLOR_4: @@ -676,7 +686,8 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state) goto invalid_enum_error; if (ctx->Eval.Map2Color4 == state) return; - FLUSH_VERTICES(ctx, _NEW_EVAL); + FLUSH_VERTICES(ctx, 0); + vbo_exec_update_eval_maps(ctx); ctx->Eval.Map2Color4 = state; break; case GL_MAP2_INDEX: @@ -684,7 +695,8 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state) goto invalid_enum_error; if (ctx->Eval.Map2Index == state) return; - FLUSH_VERTICES(ctx, _NEW_EVAL); + FLUSH_VERTICES(ctx, 0); + vbo_exec_update_eval_maps(ctx); ctx->Eval.Map2Index = state; break; case GL_MAP2_NORMAL: @@ -692,7 +704,8 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state) goto invalid_enum_error; if (ctx->Eval.Map2Normal == state) return; - FLUSH_VERTICES(ctx, _NEW_EVAL); + FLUSH_VERTICES(ctx, 0); + vbo_exec_update_eval_maps(ctx); ctx->Eval.Map2Normal = state; break; case GL_MAP2_TEXTURE_COORD_1: @@ -700,7 +713,8 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state) goto invalid_enum_error; if (ctx->Eval.Map2TextureCoord1 == state) return; - FLUSH_VERTICES(ctx, _NEW_EVAL); + FLUSH_VERTICES(ctx, 0); + vbo_exec_update_eval_maps(ctx); ctx->Eval.Map2TextureCoord1 = state; break; case GL_MAP2_TEXTURE_COORD_2: @@ -708,7 +722,8 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state) goto invalid_enum_error; if (ctx->Eval.Map2TextureCoord2 == state) return; - FLUSH_VERTICES(ctx, _NEW_EVAL); + FLUSH_VERTICES(ctx, 0); + vbo_exec_update_eval_maps(ctx); ctx->Eval.Map2TextureCoord2 = state; break; case GL_MAP2_TEXTURE_COORD_3: @@ -716,7 +731,8 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state) goto invalid_enum_error; if (ctx->Eval.Map2TextureCoord3 == state) return; - FLUSH_VERTICES(ctx, _NEW_EVAL); + FLUSH_VERTICES(ctx, 0); + vbo_exec_update_eval_maps(ctx); ctx->Eval.Map2TextureCoord3 = state; break; case GL_MAP2_TEXTURE_COORD_4: @@ -724,7 +740,8 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state) goto invalid_enum_error; if (ctx->Eval.Map2TextureCoord4 == state) return; - FLUSH_VERTICES(ctx, _NEW_EVAL); + FLUSH_VERTICES(ctx, 0); + vbo_exec_update_eval_maps(ctx); ctx->Eval.Map2TextureCoord4 = state; break; case GL_MAP2_VERTEX_3: @@ -732,7 +749,8 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state) goto invalid_enum_error; if (ctx->Eval.Map2Vertex3 == state) return; - FLUSH_VERTICES(ctx, _NEW_EVAL); + FLUSH_VERTICES(ctx, 0); + vbo_exec_update_eval_maps(ctx); ctx->Eval.Map2Vertex3 = state; break; case GL_MAP2_VERTEX_4: @@ -740,7 +758,8 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state) goto invalid_enum_error; if (ctx->Eval.Map2Vertex4 == state) return; - FLUSH_VERTICES(ctx, _NEW_EVAL); + FLUSH_VERTICES(ctx, 0); + vbo_exec_update_eval_maps(ctx); ctx->Eval.Map2Vertex4 = state; break; case GL_NORMALIZE: diff --git a/src/mesa/main/eval.c b/src/mesa/main/eval.c index f6bdc29a89c..874f5255e9c 100644 --- a/src/mesa/main/eval.c +++ b/src/mesa/main/eval.c @@ -353,7 +353,8 @@ map1(GLenum target, GLfloat u1, GLfloat u2, GLint ustride, pnts = _mesa_copy_map_points1d(target, ustride, uorder, (GLdouble*) points); - FLUSH_VERTICES(ctx, _NEW_EVAL); + FLUSH_VERTICES(ctx, 0); + vbo_exec_update_eval_maps(ctx); map->Order = uorder; map->u1 = u1; map->u2 = u2; @@ -448,7 +449,8 @@ map2( GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, vstride, vorder, (GLdouble*) points); - FLUSH_VERTICES(ctx, _NEW_EVAL); + FLUSH_VERTICES(ctx, 0); + vbo_exec_update_eval_maps(ctx); map->Uorder = uorder; map->u1 = u1; map->u2 = u2; @@ -768,7 +770,8 @@ _mesa_MapGrid1f( GLint un, GLfloat u1, GLfloat u2 ) _mesa_error( ctx, GL_INVALID_VALUE, "glMapGrid1f" ); return; } - FLUSH_VERTICES(ctx, _NEW_EVAL); + FLUSH_VERTICES(ctx, 0); + vbo_exec_update_eval_maps(ctx); ctx->Eval.MapGrid1un = un; ctx->Eval.MapGrid1u1 = u1; ctx->Eval.MapGrid1u2 = u2; @@ -798,7 +801,8 @@ _mesa_MapGrid2f( GLint un, GLfloat u1, GLfloat u2, return; } - FLUSH_VERTICES(ctx, _NEW_EVAL); + FLUSH_VERTICES(ctx, 0); + vbo_exec_update_eval_maps(ctx); ctx->Eval.MapGrid2un = un; ctx->Eval.MapGrid2u1 = u1; ctx->Eval.MapGrid2u2 = u2; diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 1f1e8e7ada0..db55117bc08 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -4482,7 +4482,7 @@ struct gl_matrix_stack #define _NEW_TEXTURE_MATRIX (1u << 2) /**< gl_context::TextureMatrix */ #define _NEW_COLOR (1u << 3) /**< gl_context::Color */ #define _NEW_DEPTH (1u << 4) /**< gl_context::Depth */ -#define _NEW_EVAL (1u << 5) /**< gl_context::Eval, EvalMap */ +/* gap */ #define _NEW_FOG (1u << 6) /**< gl_context::Fog */ #define _NEW_HINT (1u << 7) /**< gl_context::Hint */ #define _NEW_LIGHT (1u << 8) /**< gl_context::Light */ diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c index f38e7b138c4..7d02f1aa9fd 100644 --- a/src/mesa/main/state.c +++ b/src/mesa/main/state.c @@ -463,7 +463,6 @@ _mesa_update_state_locked( struct gl_context *ctx ) new_prog_state |= update_program_constants(ctx); ctx->NewState |= new_prog_state; - vbo_exec_invalidate_state(ctx); /* * Give the driver a chance to act upon the new_state flags. diff --git a/src/mesa/vbo/vbo.h b/src/mesa/vbo/vbo.h index c402caa74f1..bd99e246514 100644 --- a/src/mesa/vbo/vbo.h +++ b/src/mesa/vbo/vbo.h @@ -48,7 +48,7 @@ void _vbo_DestroyContext(struct gl_context *ctx); void -vbo_exec_invalidate_state(struct gl_context *ctx); +vbo_exec_update_eval_maps(struct gl_context *ctx); void _vbo_install_exec_vtxfmt(struct gl_context *ctx); diff --git a/src/mesa/vbo/vbo_context.c b/src/mesa/vbo/vbo_context.c index 06786e13bdb..698419efe0a 100644 --- a/src/mesa/vbo/vbo_context.c +++ b/src/mesa/vbo/vbo_context.c @@ -149,13 +149,11 @@ _vbo_install_exec_vtxfmt(struct gl_context *ctx) void -vbo_exec_invalidate_state(struct gl_context *ctx) +vbo_exec_update_eval_maps(struct gl_context *ctx) { struct vbo_context *vbo = vbo_context(ctx); - struct vbo_exec_context *exec = &vbo->exec; - if (ctx->NewState & _NEW_EVAL) - exec->eval.recalculate_maps = GL_TRUE; + vbo->exec.eval.recalculate_maps = GL_TRUE; }