Fix black screen when r_forwardPlusShade invalidates pipelines#153
Draft
Fix black screen when r_forwardPlusShade invalidates pipelines#153
Conversation
r_forwardPlusShade changes PBR fragment specialization on world draw pipelines only. vk_destroy_pipelines() also destroyed gamma, overlay compose, bloom, SMAA, and other post paths unrelated to Forward+, which could leave the swapchain with no valid gamma blit (black screen with audio). Add vk_destroy_world_graphics_pipelines() (same slice as vk_release_resources: indices >= vk.pipelines_world_base) and use it for r_forwardPlusShade invalidation. Persistent pipelines (skybox, fog, etc.) stay valid; PBR world pipelines are recreated lazily via vk_gen_pipeline as before. Co-authored-by: Tim Fox <timfox@outlook.com>
d3c6ce5 to
0d5e677
Compare
vk_destroy_world_graphics_pipelines() must not shrink vk.pipelines_count or zero Vk_Pipeline_Def rows: shader_t stores uint32_t indices into the table; dropping the tail reuses slots and breaks cached indices (wrong draws or vk_gen_pipeline ERR_FATAL). Destroy only VkPipeline handles; lazy recreation picks up the new r_forwardPlusShade specialization. Co-authored-by: Tim Fox <timfox@outlook.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
1. Forward+ shade: avoid full post stack teardown
r_forwardPlusShadeonly needs PBR world draw pipelines. Fullvk_destroy_pipelines()also destroyed gamma/SMAA/bloom/etc. — fixed byvk_destroy_world_graphics_pipelines()(handles only, post stack untouched).2. Critical: do not shrink
pipelines_counton world invalidation (this commit)shader_tcachesuint32_tindices intovk.pipelines[]. The first version ofvk_destroy_world_graphics_pipelines()setpipelines_count = pipelines_world_baseand zeroed rows — that reused slot indices and could make cachedvk_pipelineindices point at wrong/empty entries → corrupt draws, black screen, orvk_gen_pipelinefatal errors.Fix: destroy only the
VkPipelinehandles in world rows; keepdefand keeppipelines_count.vk_gen_pipelinerecreates handles lazily with updated specialization.Validation
idtech3_vulkan_x86buildctest(19/19 passed)