refactor(render): reduce VulkanBackend forwarding surface#141
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (4)
💤 Files with no reviewable changes (1)
📝 WalkthroughWalkthroughVulkanBackend's public API is refactored to expose internal components (VulkanContext, RenderOutput, ExternalFrameImporter, FilterChainController) via accessor methods instead of providing direct getter/setter methods for Vulkan handles, filter controls, prechain resolution, and frame metadata. Application class is updated to route all filter control, preset path, and prechain operations through filter_chain_controller() and to source Vulkan handles and swapchain configuration from vulkan_context() and render_output(). Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested labels
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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 |
ⓘ You are approaching your monthly quota for Qodo. Upgrade your plan Review Summary by Qodo
WalkthroughsDescription• Remove forwarding methods from VulkanBackend to reduce surface • Expose internal components via accessor methods for direct access • Update Application to use filter_chain_controller(), vulkan_context(), render_output(), and frame_importer() accessors • Update tests to reflect new FilterChainController method locations Diagramflowchart LR
VB["VulkanBackend"]
FCC["FilterChainController"]
VC["VulkanContext"]
RO["RenderOutput"]
EFI["ExternalFrameImporter"]
App["Application"]
VB -- "filter_chain_controller()" --> FCC
VB -- "vulkan_context()" --> VC
VB -- "render_output()" --> RO
VB -- "frame_importer()" --> EFI
App -- "uses accessors" --> VB
File Changes1. src/app/application.cpp
|
Code Review by Qodo
1. Mutable controller exposed
|
| [[nodiscard]] auto filter_chain_controller() -> backend_internal::FilterChainController& { | ||
| return m_filter_chain_controller; | ||
| } |
There was a problem hiding this comment.
1. Mutable controller exposed 🐞 Bug ✓ Correctness
VulkanBackend::filter_chain_controller() returns a mutable reference to backend_internal::FilterChainController, allowing non-backend code to call lifecycle/orchestration APIs and bypass the sequencing enforced by VulkanBackend::render()/shutdown(). This can violate GPU synchronization/resource-lifetime invariants and cause incorrect rendering behavior or hard-to-debug crashes if any future call site uses more than the intended “control” subset of the controller API.
Agent Prompt
### Issue description
`VulkanBackend::filter_chain_controller()` currently returns a **mutable** `backend_internal::FilterChainController&`. This exposes lifecycle/orchestration methods that `VulkanBackend` expects to own and sequence safely.
### Issue Context
`VulkanBackend::render()` calls `advance_frame()`, `check_pending_chain_swap(...)`, and `cleanup_retired_adapters()` in a controlled order. Returning a mutable controller reference makes it easy for future call sites to invoke these APIs out-of-order and break backend invariants.
### Fix Focus Areas
- src/render/backend/vulkan_backend.hpp[73-90]
- src/render/backend/vulkan_backend.cpp[398-548]
- src/render/backend/filter_chain_controller.hpp[67-111]
### Recommended change
- Remove the non-const `filter_chain_controller()` accessor, or restrict it so external code can only perform the intended narrow set of operations.
- Re-introduce a small, explicit `VulkanBackend` facade API for UI interactions (e.g., `list_filter_controls(stage)`, `set_filter_control_value(...)`, `reset_filter_controls()`, `current_preset_path()`, `consume_chain_swapped()`, `current_prechain_resolution()`), so orchestration remains owned by `VulkanBackend`.
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
Summary by CodeRabbit
Refactor
Tests