[vulkan] Up max lights to 2048 and quantize sizes

This seems excessive, but gmsp3v2 map has 1399 lights. Worse, it has a
lot of different light sizes that go up by small increments (generally
around 10) resulting in 33 shadow map images (1 too many). Quantizing
the sizes to 32 drops this nicely to 20, and reduces memory consumption
slightly too (image buffer overhead, I guess).
This commit is contained in:
Bill Currie 2023-08-15 14:34:23 +09:00
parent efea07f488
commit c46e15af9b
2 changed files with 7 additions and 4 deletions

View file

@ -42,7 +42,7 @@
typedef struct qfv_lightmatset_s DARRAY_TYPE (mat4f_t) qfv_lightmatset_t;
#define MaxLights 768
#define MaxLights 2048
enum {
ST_NONE, // no shadows

View file

@ -79,6 +79,7 @@
#include "vid_vulkan.h"
#include "vkparse.h"
#define shadow_quanta 32
#define lnearclip 4
#define num_cascade 4
@ -1555,7 +1556,9 @@ 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]);
int light_size = getsize (&mctx->lights[li]) + shadow_quanta - 1;
light_size = ((light_size + shadow_quanta - 1) / shadow_quanta)
* shadow_quanta;
if (size != light_size || numLayers + layers > mctx->maxLayers) {
if (numLayers) {
mctx->maps[mctx->numMaps++] = (mapdesc_t) {
@ -1725,7 +1728,7 @@ build_shadow_maps (lightingctx_t *lctx, vulkan_ctx_t *ctx)
int cube = maps[i].cube;
lctx->map_cube[i] = cube;
images[i] = (qfv_resobj_t) {
.name = va (ctx->va_ctx, "map:image:%d:%d", i, maps[i].size),
.name = va (ctx->va_ctx, "map:image:%02d:%d", i, maps[i].size),
.type = qfv_res_image,
.image = {
.flags = cube ? VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT : 0,
@ -1740,7 +1743,7 @@ build_shadow_maps (lightingctx_t *lctx, vulkan_ctx_t *ctx)
},
};
views[i] = (qfv_resobj_t) {
.name = va (ctx->va_ctx, "map:view:%d:%d", i, maps[i].size),
.name = va (ctx->va_ctx, "map:view:%02d:%d", i, maps[i].size),
.type = qfv_res_image_view,
.image_view = {
.image = i,