Part of #776 — SOLID architecture debt umbrella.
Phase: P1 · Finding: M3
Problem
modules/engine-rhi/src/rhi.zig (1,384 LOC) mixes interface vtables + 4 wrapper structs + a legacy composite + ~50 deprecated passthroughs (self-admitted at line 1012). VulkanContext (rhi_context_types.zig:192-231) is a 24+-field god-struct spanning every rendering subsystem.
Evidence
rhi.zig:1012:
/// DEPRECATED: retained as a composition root during the RHI
/// modularization refactoring (issue #291 / #272).
rhi_context_types.zig:192-231 — 24+ fields: vulkan_device, resources, frames, swapchain, descriptors, pipeline_manager, render_pass_manager, shadow_system, ssao_system, bloom_system, water_system, taa_state, depth_pyramid, dynamic_resolution, timing, …
Fix
- Split
rhi.zig into interfaces.zig (vtables) + wrappers.zig (ResourceManager/RenderContext/UIRenderer/ShadowSystemWrapper).
- Delete the ~50 deprecated passthrough methods (lines 1120-1383) once migration is confirmed complete.
- Group
VulkanContext fields into PostProcessBackend, ShadowBackend, HdrBackend, etc., then compose.
Verification
nix develop --command zig build test (includes shader validation)
- If rendering-touching: capture headless screenshot baseline before/after (
-Dskip-present)
- If behavior-preserving refactor: golden-output test must stay green
Constraints
- Small reviewable PR targeting
dev; conventional commit (refactor: / feat:)
- Preserve current behavior unless this issue explicitly changes it
- Keep worker-thread RHI isolation intact (no RHI calls off main thread)
Notes
Coordinate with C2/C3 — those issues add new vtable entries; land this split first or agree on a merge order.
Tracking: #776
Part of #776 — SOLID architecture debt umbrella.
Phase: P1 · Finding: M3
Problem
modules/engine-rhi/src/rhi.zig(1,384 LOC) mixes interface vtables + 4 wrapper structs + a legacy composite + ~50 deprecated passthroughs (self-admitted at line 1012).VulkanContext(rhi_context_types.zig:192-231) is a 24+-field god-struct spanning every rendering subsystem.Evidence
rhi.zig:1012:rhi_context_types.zig:192-231— 24+ fields: vulkan_device, resources, frames, swapchain, descriptors, pipeline_manager, render_pass_manager, shadow_system, ssao_system, bloom_system, water_system, taa_state, depth_pyramid, dynamic_resolution, timing, …Fix
rhi.zigintointerfaces.zig(vtables) +wrappers.zig(ResourceManager/RenderContext/UIRenderer/ShadowSystemWrapper).VulkanContextfields intoPostProcessBackend,ShadowBackend,HdrBackend, etc., then compose.Verification
nix develop --command zig build test(includes shader validation)-Dskip-present)Constraints
dev; conventional commit (refactor:/feat:)Notes
Coordinate with C2/C3 — those issues add new vtable entries; land this split first or agree on a merge order.
Tracking: #776