Phase 4: WorldRenderer Dependency Inversion Cleanup
Goal
Remove direct concrete coupling from WorldRenderer so it depends on rendering abstractions rather than backend-specific implementation details.
Why this matters
WorldRenderer still reaches into Vulkan-specific types and concrete culling behavior. That weakens DIP and makes renderer refactors harder than they need to be.
Parallel Tasks
Issue 4.1: Introduce an ICullingSystem abstraction
- Type: refactor / solid
- Scope:
src/world/world_renderer.zig, src/engine/graphics/vulkan/culling_system.zig
- Problem: culling is consumed as a concrete system instead of a stable interface.
- Work:
- Define a focused culling interface with the methods
WorldRenderer actually needs
- Keep the current implementation as the first adapter behind the interface
- Avoid exposing Vulkan details through the new abstraction
- Acceptance criteria:
WorldRenderer can compile against the interface only
- The interface is small and purpose-built
- Parallel-safe: yes
Issue 4.2: Adapt the current culling implementation behind the new interface
- Type: refactor / solid
- Scope:
src/engine/graphics/vulkan/culling_system.zig
- Problem: the existing culling system needs to become the concrete implementation behind the abstraction.
- Work:
- Implement the new interface on top of the current culling system
- Preserve all current CPU/GPU fallback behavior
- Keep frame-indexed read/write semantics stable
- Acceptance criteria:
- Existing culling behavior remains unchanged
- The adapter compiles cleanly with the new interface
- Parallel-safe: yes
Issue 4.3: Remove direct VulkanContext coupling from WorldRenderer
- Type: refactor / solid
- Scope:
src/world/world_renderer.zig
- Problem: the renderer still reaches into
VulkanContext and raw native handles for culling and frame data.
- Work:
- Replace direct
VulkanContext access with the minimal interface data required
- Reduce or eliminate
@ptrCast use against Vulkan context internals
- Keep MDI, CPU culling, and GPU culling paths working
- Acceptance criteria:
WorldRenderer no longer depends on backend internals directly
- Rendering output is unchanged
- Parallel-safe: yes
Dependencies
- Phase 3 should land first if GPU block/meshing ownership moves affect the renderer input path
Verification
nix develop --command zig build test
nix develop --command zig build run
Phase 4: WorldRenderer Dependency Inversion Cleanup
Goal
Remove direct concrete coupling from
WorldRendererso it depends on rendering abstractions rather than backend-specific implementation details.Why this matters
WorldRendererstill reaches into Vulkan-specific types and concrete culling behavior. That weakens DIP and makes renderer refactors harder than they need to be.Parallel Tasks
Issue 4.1: Introduce an
ICullingSystemabstractionsrc/world/world_renderer.zig,src/engine/graphics/vulkan/culling_system.zigWorldRendereractually needsWorldRenderercan compile against the interface onlyIssue 4.2: Adapt the current culling implementation behind the new interface
src/engine/graphics/vulkan/culling_system.zigIssue 4.3: Remove direct VulkanContext coupling from
WorldRenderersrc/world/world_renderer.zigVulkanContextand raw native handles for culling and frame data.VulkanContextaccess with the minimal interface data required@ptrCastuse against Vulkan context internalsWorldRendererno longer depends on backend internals directlyDependencies
Verification
nix develop --command zig build testnix develop --command zig build run