Skip to content

[SOLID] [M16] Fix or delete split-brain RenderDevice; honor bindShader contract (covers M14, m5) #802

Description

@MichaelFisher1997

Part of #776 — SOLID architecture debt umbrella.
Phase: P3 · Finding: M16

Problem

Three related contract gaps:

  • M16: modules/engine-rhi/src/render_device.zigRenderDevice.createBuffer returns a handle never wired to the backend; backend_data always null. The real IResourceFactory.createBuffer ignores RenderDevice. Split-brain.
  • M14: rhi_vulkan.zig:764-769 bindShader is a silent no-op in Vulkan but in the public IGraphicsCommandEncoder contract.
  • m5: render_device.zig:14 doc-comment advertises a backend_type parameter the real signature lacks.

Evidence

rhi_vulkan.zig:764-769:

fn bindShader(ctx_ptr, handle) void {
  _ = ctx_ptr;
  if (handle != rhi.InvalidShaderHandle) {
    log.log.warn("Vulkan RHI bindShader({}) ignored: fixed pipelines...", .{handle});
  }
}

Fix

  1. RenderDevice: wire it to the backend or delete it. The split-brain confuses every reader.
  2. bindShader: either honor the contract or remove the method. A silent no-op is the worst option.
  3. Doc lie: implement the backend_type parameter or fix the doc.

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

M14 may be resolved implicitly by C2 (native handles elimination) — check before implementing.

Tracking: #776

Metadata

Metadata

Assignees

No one assigned

    Labels

    automated-auditIssues found by automated opencode audit scansbugSomething isn't workingdocumentationImprovements or additions to documentationengineenhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions