mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-02-24 20:51:35 +00:00
[vulkan] Round shadow map sizes correctly
I'd added some developer output to see how the layers were distributed between images and found the image widths to be... odd. It turns out I was double-adding the shadow_quanta. Oops. Results in ~164MB less memory used by marcher (for 32 pixel quanta).
This commit is contained in:
parent
175e9fd7c9
commit
694d969c83
1 changed files with 8 additions and 1 deletions
|
@ -1615,7 +1615,7 @@ allocate_map (mapctx_t *mctx, int type, int (*getsize) (const light_t *light))
|
|||
if (lr->mode != type) {
|
||||
continue;
|
||||
}
|
||||
int light_size = getsize (&mctx->lights[li]) + shadow_quanta - 1;
|
||||
int light_size = getsize (&mctx->lights[li]);
|
||||
light_size = ((light_size + shadow_quanta - 1) / shadow_quanta)
|
||||
* shadow_quanta;
|
||||
if (size != light_size || numLayers + layers > mctx->maxLayers) {
|
||||
|
@ -1854,6 +1854,13 @@ build_shadow_maps (lightingctx_t *lctx, vulkan_ctx_t *ctx)
|
|||
totalLayers, lctx->num_maps,
|
||||
lctx->shadow_resources ? lctx->shadow_resources->size
|
||||
: (VkDeviceSize) 0);
|
||||
if (developer & SYS_lighting) {
|
||||
auto images = lctx->shadow_resources->objects;
|
||||
for (int i = 0; i < lctx->num_maps; i++) {
|
||||
printf ("map id:%d width:%d layers:%d\n", i,
|
||||
images[i].image.extent.width, images[i].image.num_layers);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
Loading…
Reference in a new issue