* XXX: should we flush here ?
*/
for (i = 0; i < DRAW_MAX_SHADER_VARIANTS / 4; i++) {
- struct draw_llvm_variant_list_item *item =
- last_elem(&fpme->llvm->vs_variants_list);
+ struct draw_llvm_variant_list_item *item;
+ if (is_empty_list(&fpme->llvm->vs_variants_list)) {
+ break;
+ }
+ item = last_elem(&fpme->llvm->vs_variants_list);
+ assert(item);
+ assert(item->base);
draw_llvm_destroy_variant(item->base);
}
}
if (lp->nr_fs_variants >= LP_MAX_SHADER_VARIANTS) {
for (i = 0; i < LP_MAX_SHADER_VARIANTS / 4; i++) {
struct lp_fs_variant_list_item *item;
- item = last_elem(&lp->fs_variants_list);
- if (!item) {
+ if (is_empty_list(&lp->fs_variants_list)) {
break;
}
+ item = last_elem(&lp->fs_variants_list);
+ assert(item);
+ assert(item->base);
llvmpipe_remove_shader_variant(lp, item->base);
}
}
llvmpipe_finish(pipe, __FUNCTION__);
for (i = 0; i < LP_MAX_SETUP_VARIANTS / 4; i++) {
- struct lp_setup_variant_list_item *item = last_elem(&lp->setup_variants_list);
+ struct lp_setup_variant_list_item *item;
+ if (is_empty_list(&lp->setup_variants_list)) {
+ break;
+ }
+ item = last_elem(&lp->setup_variants_list);
+ assert(item);
+ assert(item->base);
remove_setup_variant(lp, item->base);
}
}