mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-02-21 11:11:37 +00:00
[vulkan] Avoid drawing too many dynamic lights
Trying to draw too many dynamic lights results in various crashes due to the resources being preallocated.
This commit is contained in:
parent
9328c90a74
commit
0d4ffb02bc
1 changed files with 6 additions and 0 deletions
|
@ -289,6 +289,9 @@ lighting_draw_shadow_maps (const exprval_t **params, exprval_t *result,
|
|||
for (size_t i = 0; i < queue->ent_queues[mod_light].size; i++) {
|
||||
entity_t ent = queue->ent_queues[mod_light].a[i];
|
||||
uint32_t id = get_lightid (ent);
|
||||
if (id >= lctx->light_control.size) {
|
||||
continue;
|
||||
}
|
||||
auto r = &lctx->light_control.a[id];
|
||||
if (!r->numLayers) {
|
||||
continue;
|
||||
|
@ -1300,6 +1303,9 @@ upload_light_data (lightingctx_t *lctx, vulkan_ctx_t *ctx)
|
|||
for (uint32_t i = 0; i < count; i++) {
|
||||
entity_t ent = { .reg = reg, .id = light_pool->dense[i] };
|
||||
uint32_t id = get_lightid (ent);
|
||||
if (id >= lctx->light_control.size) {
|
||||
continue;
|
||||
}
|
||||
auto r = &lctx->light_control.a[id];
|
||||
render[i] = (qfv_light_render_t) {
|
||||
.id_data = make_id(r->matrix_id, r->map_index, r->layer, r->mode),
|
||||
|
|
Loading…
Reference in a new issue