From c869387d8aa9c9c00a159a922dee4e66db49aa05 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Mathias=20Fr=C3=B6hlich?= Date: Mon, 29 Apr 2019 07:23:58 +0200 Subject: [PATCH] mesa: Correct the is_vertex_position decision for dlists. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit We have to use _mesa_inside_dlist_begin_end instead of _mesa_inside_begin_end to see if we are inside a glBegin/glEnd block in case of display lists. So split the is_vertex_position function used in vertex attribute processing into a imm and dlist variant and use the appropriate _mesa_inside_begin_end variant. Reviewed-by: Brian Paul Signed-off-by: Mathias Fröhlich --- src/mesa/vbo/vbo_attrib_tmp.h | 14 -------------- src/mesa/vbo/vbo_exec_api.c | 14 ++++++++++++++ src/mesa/vbo/vbo_save_api.c | 14 ++++++++++++++ 3 files changed, 28 insertions(+), 14 deletions(-) diff --git a/src/mesa/vbo/vbo_attrib_tmp.h b/src/mesa/vbo/vbo_attrib_tmp.h index 796b388..5c4beb5 100644 --- a/src/mesa/vbo/vbo_attrib_tmp.h +++ b/src/mesa/vbo/vbo_attrib_tmp.h @@ -522,20 +522,6 @@ TAG(MultiTexCoord4fv)(GLenum target, const GLfloat * v) } -/** - * If index=0, does glVertexAttrib*() alias glVertex() to emit a vertex? - * It depends on a few things, including whether we're inside or outside - * of glBegin/glEnd. - */ -static inline bool -is_vertex_position(const struct gl_context *ctx, GLuint index) -{ - return (index == 0 && - _mesa_attr_zero_aliases_vertex(ctx) && - _mesa_inside_begin_end(ctx)); -} - - static void GLAPIENTRY TAG(VertexAttrib1fARB)(GLuint index, GLfloat x) { diff --git a/src/mesa/vbo/vbo_exec_api.c b/src/mesa/vbo/vbo_exec_api.c index 749a5eb..5b1549d 100644 --- a/src/mesa/vbo/vbo_exec_api.c +++ b/src/mesa/vbo/vbo_exec_api.c @@ -458,6 +458,20 @@ vbo_exec_begin_vertices(struct gl_context *ctx) /** + * If index=0, does glVertexAttrib*() alias glVertex() to emit a vertex? + * It depends on a few things, including whether we're inside or outside + * of glBegin/glEnd. + */ +static inline bool +is_vertex_position(const struct gl_context *ctx, GLuint index) +{ + return (index == 0 && + _mesa_attr_zero_aliases_vertex(ctx) && + _mesa_inside_begin_end(ctx)); +} + + +/** * This macro is used to implement all the glVertex, glColor, glTexCoord, * glVertexAttrib, etc functions. * \param A VBO_ATTRIB_x attribute index diff --git a/src/mesa/vbo/vbo_save_api.c b/src/mesa/vbo/vbo_save_api.c index b33dfa5..d378bdb 100644 --- a/src/mesa/vbo/vbo_save_api.c +++ b/src/mesa/vbo/vbo_save_api.c @@ -979,6 +979,20 @@ reset_vertex(struct gl_context *ctx) } +/** + * If index=0, does glVertexAttrib*() alias glVertex() to emit a vertex? + * It depends on a few things, including whether we're inside or outside + * of glBegin/glEnd. + */ +static inline bool +is_vertex_position(const struct gl_context *ctx, GLuint index) +{ + return (index == 0 && + _mesa_attr_zero_aliases_vertex(ctx) && + _mesa_inside_dlist_begin_end(ctx)); +} + + #define ERROR(err) _mesa_compile_error(ctx, err, __func__); -- 2.7.4