renderer: split destroy program out from free programs

Split out from Marc-André's larger patchset.
macos/master
Marc-André Lureau 11 years ago committed by Dave Airlie
parent e2b6de9a89
commit 5ddb7c3d0a
  1. 20
      src/vrend_renderer.c

@ -855,29 +855,33 @@ static struct vrend_linked_shader_program *lookup_shader_program(struct vrend_co
return 0; return 0;
} }
static void vrend_free_programs(struct vrend_sub_context *sub) static void vrend_destroy_program(struct vrend_linked_shader_program *ent)
{ {
struct vrend_linked_shader_program *ent, *tmp;
int i; int i;
if (LIST_IS_EMPTY(&sub->programs))
return;
LIST_FOR_EACH_ENTRY_SAFE(ent, tmp, &sub->programs, head) {
glDeleteProgram(ent->id); glDeleteProgram(ent->id);
list_del(&ent->head); list_del(&ent->head);
for (i = PIPE_SHADER_VERTEX; i <= PIPE_SHADER_GEOMETRY; i++) { for (i = PIPE_SHADER_VERTEX; i <= PIPE_SHADER_GEOMETRY; i++) {
// vrend_shader_state_reference(&ent->ss[i], NULL);
free(ent->shadow_samp_mask_locs[i]); free(ent->shadow_samp_mask_locs[i]);
free(ent->shadow_samp_add_locs[i]); free(ent->shadow_samp_add_locs[i]);
free(ent->samp_locs[i]); free(ent->samp_locs[i]);
free(ent->const_locs[i]); free(ent->const_locs[i]);
free(ent->ubo_locs[i]); free(ent->ubo_locs[i]);
} }
free(ent->attrib_locs); free(ent->attrib_locs);
free(ent); free(ent);
} }
static void vrend_free_programs(struct vrend_sub_context *sub)
{
struct vrend_linked_shader_program *ent, *tmp;
if (LIST_IS_EMPTY(&sub->programs))
return;
LIST_FOR_EACH_ENTRY_SAFE(ent, tmp, &sub->programs, head) {
vrend_destroy_program(ent);
}
} }
static void vrend_apply_sampler_state(struct vrend_context *ctx, static void vrend_apply_sampler_state(struct vrend_context *ctx,

Loading…
Cancel
Save