vrend: move last used shader program in front of the list

With that shaders that are used more frequently will remain at the
top of the list, and since the search in the shader program list is
linear, this should save some time.

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
macos/master
Gert Wollny 4 years ago
parent 5f1f099222
commit b9f7be9e98
  1. 10
      src/vrend_renderer.c

@ -1662,9 +1662,12 @@ static struct vrend_linked_shader_program *lookup_cs_shader_program(struct vrend
LIST_FOR_EACH_ENTRY(ent, &ctx->sub->programs, head) {
if (!ent->ss[PIPE_SHADER_COMPUTE])
continue;
if (ent->ss[PIPE_SHADER_COMPUTE]->id == cs_id)
if (ent->ss[PIPE_SHADER_COMPUTE]->id == cs_id) {
list_del(&ent->head);
list_add(&ent->head, &ctx->sub->programs);
return ent;
}
}
return NULL;
}
@ -1697,6 +1700,11 @@ static struct vrend_linked_shader_program *lookup_shader_program(struct vrend_co
continue;
return ent;
}
/* put the entry in front */
list_del(&ent->head);
list_add(&ent->head, &ctx->sub->programs);
return NULL;
}

Loading…
Cancel
Save