Skip to content

Fix/vulkan startup hang and dynamic rendering#3

Merged
jackthepunished merged 6 commits intomasterfrom
fix/vulkan-startup-hang-and-dynamic-rendering
Apr 27, 2026
Merged

Fix/vulkan startup hang and dynamic rendering#3
jackthepunished merged 6 commits intomasterfrom
fix/vulkan-startup-hang-and-dynamic-rendering

Conversation

@jackthepunished
Copy link
Copy Markdown
Owner

@jackthepunished jackthepunished commented Apr 27, 2026

Summary by CodeRabbit

Release Notes

  • New Features

    • GPU-driven rendering with automatic frustum culling optimization (toggleable via F2)
    • Dark-themed editor with searchable entity hierarchy, enhanced property inspector, and component editing
    • Improved performance statistics display in editor
    • Editor visibility toggle via F1
  • Chores

    • Updated build configuration for new rendering components

jackthepunished and others added 6 commits April 7, 2026 01:13
- Rewrite EditorUI with full hierarchy tree, search/filter, entity icons
- Add property inspector for all 10 component types (Tag, Transform, Mesh,
  Light, Camera, RigidBody, BoxCollider, SphereCollider, CapsuleCollider, IK)
- Add/remove components via categorized popup (Rendering, Physics, Animation)
- Entity presets: Cube, Sphere, Point Light, Camera, Empty (with physics)
- Right-click context menus for entity delete
- Professional dark theme with blue accent (EditorUI::apply_dark_theme)
- Render stats panel showing Vulkan backend, draw calls, pass timings
- Color-coded console log (red=error, yellow=warning)
- F1 toggle for editor visibility
- Add TagComponent to all scene entities for proper hierarchy display
- Wire EditorUI into application render loop, replacing inline test window
Compute-shader frustum culling that consumes GPUScene buffers and
writes indirect draw commands. Bounding-sphere tests run per-object
in cull.comp, which atomically appends visible draws and a draw count
for downstream draw_indexed_indirect_count consumption.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Lazy-cached centroid + max-radius bounding sphere drives GPU frustum
culling. Per-Mesh gpu_mesh_index slot deduplicates GPUScene mega-buffer
registration across frames.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
create_object_descriptor_set allocates a single-binding set holding
the object SSBO at binding 0, backed by an internal pool. Used by the
GPU-driven geometry pipeline to bind set 2.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Parallel gbuffer pipeline that reads the per-object model matrix from
the GPUScene object SSBO via gl_BaseInstance instead of push constants,
unblocking single-call draw_indexed_indirect_count submission.

Layout: set 0 (camera UBO), set 1 (default material), set 2 (object
SSBO). New vk_geometry_indirect.{vert,frag} share the same gbuffer
output format as the existing pipeline; the legacy CPU-driven pipeline
is kept intact as a fallback.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Owns GPUScene + GpuCullPass and replaces the per-entity gbuffer draw
loop with a single draw_indexed_indirect_count when culling is on.

- Per frame: lazy-register meshes, submit transforms + bounding spheres
  + flags to GPUScene, dispatch the cull compute, then issue one
  indirect draw bound to the GPU-driven pipeline (camera, default
  material, object SSBO).
- Legacy CPU draw loop preserved on the else branch.
- F2 toggles m_use_gpu_culling at runtime for A/B comparison.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings April 27, 2026 21:04
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 27, 2026

Caution

Review failed

Pull request was closed or merged during review

📝 Walkthrough

Walkthrough

Introduces GPU-driven indirect rendering with frustum culling. Adds new shaders for indirect geometry pass, implements compute-based culling, extends GPU scene management, adds mesh bounding sphere calculations, integrates GPU rendering path with F2 toggle in application, and substantially overhauls editor UI with improved hierarchy and inspector panels.

Changes

Cohort / File(s) Summary
Deferred Rendering Shaders
assets/shaders/deferred/vk_geometry_indirect.vert, assets/shaders/deferred/vk_geometry_indirect.frag
New indirect geometry shaders for GPU-driven rendering: vertex shader applies model transforms via SSBO object data and forwards object ID; fragment shader samples albedo/normal/ARM textures and encodes to G-buffer outputs via octahedral mapping.
Deferred Renderer Core
engine/renderer/deferred_renderer.hpp, engine/renderer/deferred_renderer.cpp, engine/CMakeLists.txt
Adds indirect geometry pipeline and layout (descriptor set 2 for object SSBO); exposes new public getters for indirect pipeline/layout and object/camera descriptor sets; includes new rendering component source in build.
GPU Culling System
engine/renderer/gpu_cull_pass.hpp, engine/renderer/gpu_cull_pass.cpp
New GpuCullPass class executes frustum culling via compute shader, manages buffer state transitions (draw count/command buffers), extracts frustum planes, and dispatches compute with object count and view-projection matrix.
GPU Scene Extensions
engine/renderer/gpu_scene.hpp, engine/renderer/gpu_scene.cpp
Adds create_object_descriptor_set() method to lazily allocate descriptor sets binding object SSBO; includes internal descriptor pool for efficient set reuse.
Mesh GPU Support
engine/renderer/mesh.hpp, engine/renderer/mesh.cpp
Introduces cached bounding_sphere() computation and GPU mesh registry indexing via gpu_mesh_index() / set_gpu_mesh_index() methods.
Application Integration
game/src/application.hpp, game/src/application.cpp
Integrates GPU-driven rendering path with F2 toggle; builds per-frame GPU scene data, executes cull pass, and conditionally dispatches indirect draws; maintains fallback CPU geometry rendering path.
Editor UI Overhaul
game/src/editor_ui.hpp, game/src/editor_ui.cpp
Substantially rewrites editor with dark theme, searchable hierarchy panel with entity filtering/icons, modular inspector with per-component editors, enhanced stats panel using RenderStats, and improved console with severity-based styling; extends request polling API for preset entity creation/deletion.

Sequence Diagram

sequenceDiagram
    participant App as Application
    participant GPUScene as GPU Scene
    participant CullPass as GPU Cull Pass
    participant Compute as Compute Shader
    participant DeferredRenderer as Deferred Renderer
    participant GPU as GPU (Indirect Draw)

    App->>GPUScene: register_mesh(mesh)
    App->>GPUScene: add_object(transform, bounds, flags)
    App->>CullPass: execute(cmd, view, projection, scene)
    CullPass->>Compute: bind pipeline & descriptor set
    CullPass->>Compute: dispatch(view_proj, frustum planes, object_count)
    Compute->>Compute: frustum cull per-object
    Compute->>GPUScene: write filtered draw commands
    Compute->>GPUScene: update draw count
    CullPass->>GPUScene: transition buffers to IndirectArgument
    App->>DeferredRenderer: bind indirect geometry pipeline
    App->>DeferredRenderer: bind object descriptor set (GPU-generated)
    App->>GPU: draw_indexed_indirect_count(cmd_buffer, count_buffer)
    GPU->>GPU: execute culled geometry (per-object)
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

  • PR #1: Modifies deferred renderer pipeline/layout and GBuffer descriptor bindings for GPU-driven rendering variant; shares code-level coupling with this PR's indirect geometry pipeline changes.

Poem

🐰 Hop skip, the GPU culls with glee,
Frustum planes set vertices free!
Indirect draws dance through the night,
Bounding spheres, a rabbit's delight!
Editor blossoms in dark theme's embrace, 🎨✨

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Title check ⚠️ Warning The title references 'vulkan startup hang and dynamic rendering' but the changeset primarily implements GPU-driven indirect rendering with frustum culling, editor UI improvements, and mesh bounding sphere computation. The actual changes focus on GPU scene management and indirect draw paths, not fixing startup hangs or addressing dynamic rendering as the core feature. Revise the title to accurately reflect the main changes, such as 'Add GPU-driven indirect rendering with frustum culling and editor UI enhancements' or similar to better represent the actual changeset content.
Docstring Coverage ⚠️ Warning Docstring coverage is 52.38% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/vulkan-startup-hang-and-dynamic-rendering

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@jackthepunished jackthepunished merged commit 1bf431e into master Apr 27, 2026
0 of 3 checks passed
@sonarqubecloud
Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
1 Security Hotspot

See analysis details on SonarQube Cloud

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant