rtx: fix toilet crash

Toilet contained brush model with presumably water surfaces which
were not loaded due to how we treat surface flags. That ended up
creating a model with no geometries, which is just rude.
We don't try to render those kind of models now.
This commit is contained in:
Ivan 'provod' Avdeev 2021-04-13 10:13:17 -07:00
parent ad7b210228
commit 01e6a267d5
3 changed files with 25 additions and 14 deletions

View File

@ -1,12 +1,7 @@
## 2021-04-12
- [x] rtx: fix surface-kusok index mismatch
- [x] rtx: try to use light visibility data
-> too few slots for light sources
-> some areas have too many naively visible lights
- [x] rtx: fix light shadow artefacts
## 2021-04-13
- [x] rtx: "toilet error": attempting to get AS device address crashes the driver
# Next
- [ ] rtx: "toilet error": attempting to get AS device address crashes the driver
- [ ] rtx: sometimes we get uninitialized models
- [ ] run under asan
- [ ] rtx: fix blas destruction on exit
@ -183,3 +178,10 @@
## 2021-04-11
- [x] vscode build and debug
## 2021-04-12
- [x] rtx: fix surface-kusok index mismatch
- [x] rtx: try to use light visibility data
-> too few slots for light sources
-> some areas have too many naively visible lights
- [x] rtx: fix light shadow artefacts

View File

@ -127,6 +127,9 @@ void VK_BrushModelDraw( const cl_entity_t *ent, int render_mode )
return;
}
if (bmodel->render_model.num_geometries == 0)
return;
if (!tglob.lightmapTextures[0])
{
gEngine.Con_Printf( S_ERROR "Don't have a lightmap texture\n");
@ -311,7 +314,7 @@ static qboolean loadBrushSurfaces( model_sizes_t sizes, const model_t *mod ) {
bmodel->render_model.index_buffer = index_buffer;
bmodel->render_model.vertex_buffer = vertex_buffer;
return num_surfaces;
return true;
}
qboolean VK_BrushModelLoad( model_t *mod )
@ -326,10 +329,13 @@ qboolean VK_BrushModelLoad( model_t *mod )
{
const model_sizes_t sizes = computeSizes( mod );
vk_brush_model_t *bmodel = Mem_Malloc(vk_core.pool, sizeof(vk_brush_model_t) + (sizeof(msurface_t*) + sizeof(vk_render_geometry_t)) * sizes.num_surfaces);
vk_brush_model_t *bmodel = Mem_Calloc(vk_core.pool, sizeof(vk_brush_model_t) + (sizeof(msurface_t*) + sizeof(vk_render_geometry_t)) * sizes.num_surfaces);
mod->cache.data = bmodel;
bmodel->render_model.debug_name = mod->name;
bmodel->render_model.render_mode = kRenderNormal;
if (sizes.num_surfaces != 0) {
bmodel->render_model.geometries = (vk_render_geometry_t*)((char*)(bmodel + 1) + sizeof(msurface_t*) * sizes.num_surfaces);
if (!loadBrushSurfaces(sizes, mod) || !VK_RenderModelInit(&bmodel->render_model)) {
@ -337,6 +343,7 @@ qboolean VK_BrushModelLoad( model_t *mod )
Mem_Free(bmodel);
return false;
}
}
g_brush.stat.num_indices += sizes.num_indices;
g_brush.stat.num_vertices += sizes.num_vertices;

View File

@ -1033,6 +1033,8 @@ qboolean VK_RayModelInit( vk_ray_model_init_t args ) {
g_rtx.map.num_kusochki += args.model->num_geometries;
}
gEngine.Con_Reportf("Model %s (%p) created blas %p\n", args.model->debug_name, args.model, args.model->rtx.blas);
return result;
}