refactor(render): flatten FilterChainController config structs#142
refactor(render): flatten FilterChainController config structs#142
Conversation
Delete PrechainResolutionConfig and AdapterBuildConfig wrapper structs. Pass vk::Extent2D and VulkanDeviceInfo/ChainConfig as direct parameters.
ⓘ You are approaching your monthly quota for Qodo. Upgrade your plan Review Summary by QodoFlatten FilterChainController configuration structs
WalkthroughsDescription• Remove wrapper structs AdapterBuildConfig and PrechainResolutionConfig • Pass VulkanDeviceInfo and ChainConfig as direct parameters • Split make_filter_chain_build_config() into separate make_device_info() and make_chain_config() methods • Update all call sites in controller, backend, and tests Diagramflowchart LR
A["AdapterBuildConfig<br/>PrechainResolutionConfig"] -->|"Remove wrappers"| B["Direct Parameters"]
B -->|"VulkanDeviceInfo"| C["recreate_filter_chain"]
B -->|"ChainConfig"| C
B -->|"vk::Extent2D"| D["set_prechain_resolution"]
E["make_filter_chain_build_config"] -->|"Split into"| F["make_device_info"]
E -->|"Split into"| G["make_chain_config"]
File Changes1. src/render/backend/filter_chain_controller.hpp
|
Code Review by Qodo🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0) 📐 Spec deviations (0)
Great, no issues found!Qodo reviewed your code and found no material issues that require reviewⓘ The new review experience is currently in Beta. Learn more |
📝 WalkthroughWalkthroughThis PR refactors the Changes
Possibly related PRs
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes 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 |
There was a problem hiding this comment.
🧹 Nitpick comments (3)
src/render/backend/vulkan_backend.cpp (1)
577-584: Small readability refactor: avoid fetching prechain resolution twice.
current_prechain_resolution()is called twice in the same return object. Caching it once would make this helper slightly clearer.💡 Suggested cleanup
auto VulkanBackend::make_chain_config() const -> backend_internal::FilterChainController::ChainConfig { + const auto prechain = m_filter_chain_controller.current_prechain_resolution(); return { .target_format = static_cast<VkFormat>(m_render_output.swapchain_format), .frames_in_flight = backend_internal::RenderOutput::MAX_FRAMES_IN_FLIGHT, - .initial_prechain_width = m_filter_chain_controller.current_prechain_resolution().width, - .initial_prechain_height = m_filter_chain_controller.current_prechain_resolution().height, + .initial_prechain_width = prechain.width, + .initial_prechain_height = prechain.height, }; }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/render/backend/vulkan_backend.cpp` around lines 577 - 584, In VulkanBackend::make_chain_config cache the result of m_filter_chain_controller.current_prechain_resolution() into a local variable (e.g., auto res = m_filter_chain_controller.current_prechain_resolution()) and use res.width and res.height in the returned ChainConfig instead of calling current_prechain_resolution() twice to improve readability and avoid duplicate calls.src/render/backend/filter_chain_controller.cpp (1)
567-570: Consider extracting shared chain-config normalization.The stage mask + prechain-dimension assignment logic is duplicated across recreate/reload paths. A small helper would reduce drift risk if this policy evolves.
♻️ Suggested direction
+auto normalize_chain_config(FilterChainController::ChainConfig config, + bool prechain_policy_enabled, + bool effect_stage_policy_enabled, + vk::Extent2D source_resolution) + -> FilterChainController::ChainConfig { + config.initial_stage_mask = + stage_mask_from_policy(prechain_policy_enabled, effect_stage_policy_enabled); + config.initial_prechain_width = source_resolution.width; + config.initial_prechain_height = source_resolution.height; + return config; +}Then use it in both methods before slot creation/job submission.
Also applies to: 724-727
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/render/backend/filter_chain_controller.cpp` around lines 567 - 570, The duplicated normalization of chain_config (assigning chain_config.initial_stage_mask via stage_mask_from_policy(prechain_policy_enabled, effect_stage_policy_enabled) and setting chain_config.initial_prechain_width/height from source_resolution.width/height) should be extracted into a small helper function (e.g., normalize_chain_config or init_chain_config_dimensions) and called from both the recreate and reload code paths before slot creation/job submission; update uses of chain_config, stage_mask_from_policy, prechain_policy_enabled, effect_stage_policy_enabled, and source_resolution to call the helper so the same logic is centralized and prevents drift.tests/render/test_filter_chain_retarget.cpp (1)
180-183: Consider renamingmake_adapter_build_configto match the new model.This helper now returns split device/chain inputs, so a name like
make_test_build_config(or similar) would reduce conceptual drift from the removed adapter wrapper type.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@tests/render/test_filter_chain_retarget.cpp` around lines 180 - 183, Rename the helper function make_adapter_build_config to a name that reflects it now returns split device/chain inputs (suggestion: make_test_build_config), update all references/usages to the new name, and adjust any related test identifiers or comments; locate the function definition make_adapter_build_config and its callers in tests/render/test_filter_chain_retarget.cpp and replace with the chosen new name to remove the outdated "adapter" terminology while preserving the same signature and return type (TestBuildConfig).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@src/render/backend/filter_chain_controller.cpp`:
- Around line 567-570: The duplicated normalization of chain_config (assigning
chain_config.initial_stage_mask via
stage_mask_from_policy(prechain_policy_enabled, effect_stage_policy_enabled) and
setting chain_config.initial_prechain_width/height from
source_resolution.width/height) should be extracted into a small helper function
(e.g., normalize_chain_config or init_chain_config_dimensions) and called from
both the recreate and reload code paths before slot creation/job submission;
update uses of chain_config, stage_mask_from_policy, prechain_policy_enabled,
effect_stage_policy_enabled, and source_resolution to call the helper so the
same logic is centralized and prevents drift.
In `@src/render/backend/vulkan_backend.cpp`:
- Around line 577-584: In VulkanBackend::make_chain_config cache the result of
m_filter_chain_controller.current_prechain_resolution() into a local variable
(e.g., auto res = m_filter_chain_controller.current_prechain_resolution()) and
use res.width and res.height in the returned ChainConfig instead of calling
current_prechain_resolution() twice to improve readability and avoid duplicate
calls.
In `@tests/render/test_filter_chain_retarget.cpp`:
- Around line 180-183: Rename the helper function make_adapter_build_config to a
name that reflects it now returns split device/chain inputs (suggestion:
make_test_build_config), update all references/usages to the new name, and
adjust any related test identifiers or comments; locate the function definition
make_adapter_build_config and its callers in
tests/render/test_filter_chain_retarget.cpp and replace with the chosen new name
to remove the outdated "adapter" terminology while preserving the same signature
and return type (TestBuildConfig).
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: de056b78-6e6a-4ff0-b417-c32cf2e3d381
📒 Files selected for processing (6)
src/render/backend/filter_chain_controller.cppsrc/render/backend/filter_chain_controller.hppsrc/render/backend/vulkan_backend.cppsrc/render/backend/vulkan_backend.hpptests/render/test_filter_boundary_contracts.cpptests/render/test_filter_chain_retarget.cpp
Delete PrechainResolutionConfig and AdapterBuildConfig wrapper structs. Pass vk::Extent2D and VulkanDeviceInfo/ChainConfig as direct parameters.
Summary by CodeRabbit