fix(vulkan): resolve startup hang and enable dynamic rendering pipelines#2
Conversation
The application was freezing ("not responding") on startup due to three
synchronization issues in the Vulkan frame loop:
1. Fence reset was called immediately after wait, before any GPU work
was submitted - causing the next frame's wait to block forever.
Moved reset_fences() to just before submit().
2. Swapchain semaphores were indexed by frame-in-flight rather than by
acquired image index, causing semaphore reuse conflicts when the
swapchain image count (3) exceeded frames-in-flight (2).
Changed to image-index-based semaphore management.
3. VulkanDevice::end_frame() reset its internal fence but never
re-signaled it, causing begin_frame() to deadlock on the next
iteration. Added an empty queue submit to signal the fence.
Additionally, all graphics pipelines were created with VkRenderPass
objects but the rendering code uses vkCmdBeginRendering (Vulkan 1.3
dynamic rendering), making every draw call invalid and producing a
blue screen. Fixed by:
- Adding color_attachment_formats / depth_attachment_format fields to
GraphicsPipelineDesc for dynamic rendering compatibility
- Using VkPipelineRenderingCreateInfo (pNext chain) when render_pass
is nullptr in VulkanPipeline creation
- Migrating all 6 pipeline definitions (geometry, lighting, composite,
shadow, SSAO, SSAO blur) to use format-based dynamic rendering
Other fixes included in this changeset:
- Fixed Texture::create() calls (static factory, not member function)
- Added early camera descriptor set binding after UBO creation
- Guarded command list early-return to always call end_frame()
- Locale fix for MinGW path conversion on Turkish Windows
Made-with: Cursor
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (14)
📝 WalkthroughWalkthroughThis pull request removes the legacy OpenGL-based SSAO implementation and migrates the graphics pipeline to Vulkan dynamic rendering. Changes include updating GLSL shaders to version 450 with explicit layout qualifiers, removing the OpenGL SSAO shader and renderer code, restructuring graphics pipeline creation to use format descriptors instead of render passes, adjusting synchronization based on swapchain image counts, and setting the C locale at application startup with improved Windows path encoding for UTF-8. Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~50 minutes Possibly related PRs
Poem
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment Tip CodeRabbit can use Trivy to scan for security misconfigurations and secrets in Infrastructure as Code files.Add a .trivyignore file to your project to customize which findings Trivy reports. |
|


Summary
VkPipelineRenderingCreateInfo, fixing the blue-screen-only output caused by renderPass/dynamic-rendering mismatchTexture::create()static factory usage, added camera descriptor binding at init, locale-safe path conversion for Turkish WindowsChanges
rhi_pipeline.hpp,vk_pipeline.cppcolor_attachment_formats/depth_attachment_formattoGraphicsPipelineDesc; useVkPipelineRenderingCreateInfowhenrender_pass == nullptrvk_device.cppend_frame()application.cpp,application.hppreset_fencesbeforesubmit; image-index-based render semaphores; guard early-returns withend_frame()deferred_renderer.cppshader_compiler.cpp,shader_compiler.hpppath_to_string()for locale-safe path handlingssao_blur.fragssao.vert,ssao.cpp,ssao.hppmain.cppIllegal byte sequencecrashTest Plan
cmake --build build --target horizon_gamecompiles clean (0 errors)Responding: True)Summary by CodeRabbit
Release Notes
Refactor
Bug Fixes