From d39f02ecfcf55667cb400e5f8a9a629809256f95 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Sat, 27 Aug 2022 17:46:14 +0900 Subject: [PATCH] [renderer] Don't round up scrap allocations I will need to do more work to improve the 2d allocation, but rounding up the requested sizes to the next power of two proved to be excessively wasteful: I was able to allocate spots for only half of the sub-pics I needed (though I did still need to double the number of pixels in the end). --- libs/video/renderer/r_scrap.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/libs/video/renderer/r_scrap.c b/libs/video/renderer/r_scrap.c index 9bb6518d7..8d01ee175 100644 --- a/libs/video/renderer/r_scrap.c +++ b/libs/video/renderer/r_scrap.c @@ -72,16 +72,12 @@ R_ScrapDelete (rscrap_t *scrap) VISIBLE vrect_t * R_ScrapAlloc (rscrap_t *scrap, int width, int height) { - int w, h; vrect_t **t, **best; vrect_t *old, *frags, *rect; - w = pow2rup (width); - h = pow2rup (height); - best = 0; for (t = &scrap->free_rects; *t; t = &(*t)->next) { - if ((*t)->width < w || (*t)->height < h) + if ((*t)->width < width || (*t)->height < height) continue; // won't fit if (!best) { best = t; @@ -94,7 +90,7 @@ R_ScrapAlloc (rscrap_t *scrap, int width, int height) return 0; // couldn't find a spot old = *best; *best = old->next; - rect = VRect_New (old->x, old->y, w, h); + rect = VRect_New (old->x, old->y, width, height); frags = VRect_Difference (old, rect); VRect_Delete (old); if (frags) {