mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-10 23:32:09 +00:00
[vulkan] Cope with an empty world model
Vulkan doesn't appreciate the empty buffers that result from the model not having any textures or surfaces that can be rendered (rightfully so, for such a bare-metal api).
This commit is contained in:
parent
5703df00fd
commit
c4d56afd33
3 changed files with 25 additions and 7 deletions
|
@ -303,7 +303,9 @@ Vulkan_Mod_ProcessTexture (model_t *mod, texture_t *tx, vulkan_ctx_t *ctx)
|
|||
mod->data = mctx;
|
||||
|
||||
r_notexture_mip->render = &vulkan_notexture;
|
||||
load_textures (mod, ctx);
|
||||
if (mod->brush.numtextures) {
|
||||
load_textures (mod, ctx);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -413,6 +413,10 @@ Vulkan_BuildDisplayLists (model_t **models, int num_models, vulkan_ctx_t *ctx)
|
|||
bsppoly_t *poly;
|
||||
mod_brush_t *brush;
|
||||
|
||||
if (!num_models) {
|
||||
return;
|
||||
}
|
||||
|
||||
// run through all surfaces, chaining them to their textures, thus
|
||||
// effectively sorting the surfaces by texture (without worrying about
|
||||
// surface order on the same texture chain).
|
||||
|
@ -1037,6 +1041,9 @@ Vulkan_DrawWorld (qfv_renderframe_t *rFrame)
|
|||
bctx->color = 0;
|
||||
|
||||
R_VisitWorldNodes (brush, ctx);
|
||||
if (!bctx->vertex_buffer) {
|
||||
return;
|
||||
}
|
||||
if (r_drawentities) {
|
||||
for (size_t i = 0; i < r_ent_queue->ent_queues[mod_brush].size; i++) {
|
||||
entity_t *ent = r_ent_queue->ent_queues[mod_brush].a[i];
|
||||
|
@ -1089,6 +1096,9 @@ Vulkan_Bsp_Flush (vulkan_ctx_t *ctx)
|
|||
size_t offset = bframe->index_offset;
|
||||
size_t size = bframe->index_count * sizeof (uint32_t);
|
||||
|
||||
if (!bframe->index_count) {
|
||||
return;
|
||||
}
|
||||
offset &= ~atom_mask;
|
||||
size = (size + atom_mask) & ~atom_mask;
|
||||
|
||||
|
|
|
@ -927,6 +927,10 @@ Vulkan_LoadLights (model_t *model, const char *entity_data, vulkan_ctx_t *ctx)
|
|||
lightingctx_t *lctx = ctx->lighting_context;
|
||||
plitem_t *entities = 0;
|
||||
|
||||
if (!entity_data) {
|
||||
return;
|
||||
}
|
||||
|
||||
lctx->lights.size = 0;
|
||||
lctx->lightleafs.size = 0;
|
||||
lctx->lightmats.size = 0;
|
||||
|
@ -1006,11 +1010,13 @@ Vulkan_LoadLights (model_t *model, const char *entity_data, vulkan_ctx_t *ctx)
|
|||
PL_Free (entities);
|
||||
}
|
||||
Sys_MaskPrintf (SYS_vulkan, "loaded %zd lights\n", lctx->lights.size);
|
||||
build_shadow_maps (lctx, ctx);
|
||||
create_light_matrices (lctx);
|
||||
locate_lights (model, lctx);
|
||||
for (size_t i = 0; i < lctx->lights.size; i++) {
|
||||
dump_light (&lctx->lights.a[i], lctx->lightleafs.a[i],
|
||||
lctx->lightmats.a[i]);
|
||||
if (lctx->lights.size) {
|
||||
build_shadow_maps (lctx, ctx);
|
||||
create_light_matrices (lctx);
|
||||
locate_lights (model, lctx);
|
||||
for (size_t i = 0; i < lctx->lights.size; i++) {
|
||||
dump_light (&lctx->lights.a[i], lctx->lightleafs.a[i],
|
||||
lctx->lightmats.a[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue