Skip to content

Commit b677711

Browse files
committed
fix loading multiple maps; also fix #68
1 parent 56b6f10 commit b677711

File tree

2 files changed

+24
-12
lines changed

2 files changed

+24
-12
lines changed

src/OpenSource.c

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -312,27 +312,34 @@ static void opensrcResizeVk() {
312312
static void opensrcPaint(ATimeUs timestamp, float dt) {
313313
(void)(timestamp); (void)(dt);
314314

315+
for (struct Map *map = g.maps_begin; map; map = map->next) {
316+
if (map->flags & MapFlags_Broken)
317+
continue;
318+
319+
if (map->flags & MapFlags_Loaded)
320+
continue;
321+
322+
if (BSPLoadResult_Success != loadMap(map, g.collection_chain)) {
323+
map->flags |= MapFlags_Broken;
324+
continue;
325+
}
326+
327+
break;
328+
}
329+
315330
float move = dt * (g.run?3000.f:300.f);
316331
cameraMove(&g.camera, aVec3f(g.right * move, 0.f, -g.forward * move));
317332
cameraRecompute(&g.camera);
318333

319334
renderBegin();
320335

321336
int triangles = 0;
322-
int can_load_map = 1;
323337
for (struct Map *map = g.maps_begin; map; map = map->next) {
324338
if (map->flags & MapFlags_Broken)
325339
continue;
326340

327-
if (!(map->flags & MapFlags_Loaded)) {
328-
if (can_load_map) {
329-
if (BSPLoadResult_Success != loadMap(map, g.collection_chain))
330-
map->flags |= MapFlags_Broken;
331-
}
332-
333-
can_load_map = 0;
341+
if (!(map->flags & MapFlags_Loaded))
334342
continue;
335-
}
336343

337344
const RDrawParams params = {
338345
.camera = &g.camera,

src/render_vk.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
/* return ret; */
3434
/* } */
3535

36-
#define MAX_DESC_SETS 1024
36+
#define MAX_DESC_SETS 65536
3737

3838
static struct {
3939
VkFence fence;
@@ -686,10 +686,15 @@ void renderModelDraw(const RDrawParams *params, const struct BSPModel *model) {
686686
for (int i = 0; i < model->detailed.draws_count; ++i) {
687687
const struct BSPDraw* draw = model->detailed.draws + i;
688688

689-
// FIXME HOW: allocate next descriptor pool
690-
if (g.next_free_set >= MAX_DESC_SETS)
689+
//if (draw->material->shader != MShader_LightmappedGeneric)
690+
if (!draw->material->base_texture.texture)
691691
break;
692692

693+
if (g.next_free_set >= MAX_DESC_SETS) {
694+
aAppDebugPrintf("FIXME ran out of descriptor sets");
695+
break;
696+
}
697+
693698
{
694699
VkDescriptorSet set = g.desc_sets[g.next_free_set];
695700
g.next_free_set++;

0 commit comments

Comments
 (0)