dlist: do not call _mesa_lookup_list twice

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7078>
This commit is contained in:
Pierre-Eric Pelloux-Prayer
2020-10-06 11:58:29 +02:00
parent 2b1930a50a
commit 7e296c62a7
+12 -19
View File
@@ -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);