tophat2d / tophat

:tophat: a 2d game library for Umka
https://tophat2d.dev
BSD 3-Clause "New" or "Revised" License
73 stars 5 forks source link

Sokol: pass pool exhausted after a Load->Exit->Load cycle in rail game #182

Closed vtereshkov closed 6 months ago

vtereshkov commented 6 months ago
[sg][error][id:100] lib/sokol/sokol_gfx.h:17222:0:
        PASS_POOL_EXHAUSTED: pass pool exhausted

[sg][error][id:201] lib/sokol/sokol_gfx.h:16519:0:
        VALIDATE_BEGINPASS_SWAPCHAIN_EXPECT_WIDTH: sg_begin_pass: expected pass.swapchain.width > 0

[sg][error][id:203] lib/sokol/sokol_gfx.h:16520:0:
        VALIDATE_BEGINPASS_SWAPCHAIN_EXPECT_HEIGHT: sg_begin_pass: expected pass.swapchain.height > 0

[sg][panic][id:298] lib/sokol/sokol_gfx.h:16031:0:
        VALIDATION_FAILED: validation layer checks failed

ABORTING because of [panic]
marekmaskarinec commented 6 months ago

Thank you for reporting this. It was due to a leak of the sg_attachments structure in the render target.

vtereshkov commented 6 months ago

Need to reopen this issue as it still occurs, though only after six or seven Load->Exit iterations.

[sg][error][id:97] lib/sokol/sokol_gfx.h:17186:0:
        SAMPLER_POOL_EXHAUSTED: sampler pool exhausted

[INF]: 2024-05-12T17:23:04: gamemgr.um: load rails
[INF]: 2024-05-12T17:23:04: gamemgr.um: load schedule desc
[INF]: 2024-05-12T17:23:04: gamemgr.um: load schedule
[INF]: 2024-05-12T17:23:04: gamemgr.um: load trains
[sg][error][id:276] lib/sokol/sokol_gfx.h:16829:0:
        VALIDATE_ABND_FS_EXPECTED_SAMPLER_BINDING: sg_apply_bindings: sampler binding on fragment stage is missing or the sampler handle is invalid

[sg][panic][id:298] lib/sokol/sokol_gfx.h:16031:0:
        VALIDATION_FAILED: validation layer checks failed

ABORTING because of [panic]
marekmaskarinec commented 6 months ago

This may be the fault of the unfreed world in the game. Before, all render targets ever created would be leaked. Now only those that are saved somewhere. I will reopen this for now.

marekmaskarinec commented 6 months ago

It was exactly as I said. I fixed this issue in the game by not storing the render targets anywhere in the world structure. However, I think Tophat should check if it's possible to create a render target and return an error.

marekmaskarinec commented 6 months ago

Need to reopen this issue as it still occurs, though only after six or seven Load->Exit iterations.

Reading this again, this is an error about samplers, not passes. This is caused by a large number of images. But I think this too caused by the unfreed world struct.

vtereshkov commented 6 months ago

Not a problem anymore.