The open source OpenXR runtime
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

c/main: Fix leaks of samplers and tidy code

+9 -6
+9 -6
src/xrt/compositor/main/comp_swapchain.c
··· 84 84 * 85 85 */ 86 86 87 + #define D(TYPE, thing) \ 88 + if (thing != VK_NULL_HANDLE) { \ 89 + vk->vkDestroy##TYPE(vk->device, thing, NULL); \ 90 + thing = VK_NULL_HANDLE; \ 91 + } 92 + 87 93 static struct comp_swapchain * 88 94 alloc_and_set_funcs(struct comp_compositor *c, uint32_t num_images) 89 95 { ··· 204 210 continue; 205 211 } 206 212 207 - vk->vkDestroyImageView(vk->device, views[i], NULL); 208 - views[i] = VK_NULL_HANDLE; 213 + D(ImageView, views[i]); 209 214 } 210 215 211 216 free(views); ··· 232 237 clean_image_views(vk, image->array_size, &image->views.alpha); 233 238 clean_image_views(vk, image->array_size, &image->views.no_alpha); 234 239 235 - if (image->sampler != VK_NULL_HANDLE) { 236 - vk->vkDestroySampler(vk->device, image->sampler, NULL); 237 - image->sampler = VK_NULL_HANDLE; 238 - } 240 + D(Sampler, image->sampler); 241 + D(Sampler, image->repeat_sampler); 239 242 } 240 243 241 244 /*