From: Pierre-Eric Pelloux-Prayer Date: Tue, 6 Oct 2020 09:58:29 +0000 (+0200) Subject: dlist: do not call _mesa_lookup_list twice X-Git-Tag: upstream/21.0.0~1613 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7e296c62a71a172540142a0779722b499add5f3d;p=platform%2Fupstream%2Fmesa.git dlist: do not call _mesa_lookup_list twice Reviewed-by: Marek Olšák Reviewed-by: Ian Romanick Part-of: --- diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c index a5b8a8b009e..150a07a4187 100644 --- a/src/mesa/main/dlist.c +++ b/src/mesa/main/dlist.c @@ -11352,14 +11352,16 @@ _mesa_compile_error(struct gl_context *ctx, GLenum error, const char *s) * Test if ID names a display list. */ static GLboolean -islist(struct gl_context *ctx, GLuint list) +islist(struct gl_context *ctx, GLuint list, + struct gl_display_list ** dlist) { - if (list > 0 && _mesa_lookup_list(ctx, list)) { - return GL_TRUE; - } - else { - return GL_FALSE; - } + struct gl_display_list * dl = + list > 0 ? _mesa_lookup_list(ctx, list) : NULL; + + if (dlist) + *dlist = dl; + + return dl != NULL; } @@ -11382,7 +11384,7 @@ execute_list(struct gl_context *ctx, GLuint list) Node *n; GLboolean done; - if (list == 0 || !islist(ctx, list)) + if (list == 0 || !islist(ctx, list, &dlist)) return; if (ctx->ListState.CallDepth == MAX_LIST_NESTING) { @@ -11390,10 +11392,6 @@ execute_list(struct gl_context *ctx, GLuint list) return; } - dlist = _mesa_lookup_list(ctx, list); - if (!dlist) - return; - ctx->ListState.CallDepth++; vbo_save_BeginCallList(ctx, dlist); @@ -13626,7 +13624,7 @@ _mesa_IsList(GLuint list) GET_CURRENT_CONTEXT(ctx); FLUSH_VERTICES(ctx, 0); /* must be called before assert */ ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE); - return islist(ctx, list); + return islist(ctx, list, NULL); } @@ -14696,16 +14694,11 @@ print_list(struct gl_context *ctx, GLuint list, const char *fname) return; } - if (!islist(ctx, list)) { + if (!islist(ctx, list, &dlist)) { fprintf(f, "%u is not a display list ID\n", list); goto out; } - dlist = _mesa_lookup_list(ctx, list); - if (!dlist) { - goto out; - } - n = dlist->Head; fprintf(f, "START-LIST %u, address %p\n", list, (void *) n);