Files
game-engine/.cache/clangd/index/gpu_cull.cpp.D959275CFDE8D9FA.idx
a155352fc2 [P4-07] CPU-baked SDF probe volume into the shade pass (Cornell tint path) (#224)
* parity: 105 wire GiFrameGraph resolve output into the shade pass

Part 2 of P4-07 (part 1 merged as #191): per-frame MeshSdf-brick bake
+ probe upload, mesh.frag resolve-to-shade indirect term. Cornell floor
tint now comes from graph-produced data bound in the frame; no CPU-baked
volume in the path (unit-scale baker, gain in UBO).

Fix-forward vs main: P5-02 helper extraction had swapped two -Z cube
corners (uncovered left triangle per back-wall face); restored. Both
goldens match unmodified; differential best=0.112245, ECS_RENDER_OK,
GAME_GI_BAKER_OK. No ABI change.

Closes #105. Closes #197.

* parity: 105 fix CI round 1 — MSVC C4251 guard + MoltenVK-safe probe fetch

- gi_baker.hpp: standard _MSC_VER 4251 push/pop (std::vector members in
  ENGINE_CORE_API class, same as the other renderer headers).
- mesh.frag: texture() -> textureLod(..., 0.0) for the probe fetch.
  Single-mip volume (NEAREST, maxLod 0) so lod 0 is exact; explicit-LOD
  fetches are derivative-free, which MoltenVK requires inside the
  divergent gain branch (implicit texture() fails MSL transpile with
  undeclared probeVolSmplr). Lavapipe output unchanged (goldens still
  match, differential best=0.112245).

* parity: 105 fix CI round 2 — skinned layout + probe image init layout

- Skinned pipeline shared mesh.frag but kept joints at set 0 (STORAGE)
  where the frag expects sampler3D+UBO: incompatible layouts (lavapipe
  intermittent segfault/hang in engine_forward_mesh, MoltenVK refusal).
  Joints move to set 1; skinned pipe layout is [shared probe set 0,
  joint set 1] (probe resources created on demand); record binds both.
- mesh_skinned.vert gains the frag's location-2 v_world output.
- Probe image transitioned to SHADER_READ_ONLY at creation (was
  UNDEFINED until first bake while every draw binds it as sampled).
  Full local ctest green; forward_mesh stable 6/6.

* parity: 105 fix CI round 3 — branchless probe fetch for MoltenVK uniform flow

* parity: 105 diagnose mac black frame — expose gi_probe_live

* parity: 105 fix CI round 2b — probe upload outside the open pass

Transfer work (barrier+copy) recorded inside dynamic rendering breaks
tile-based drivers (MoltenVK black frame). Upload now runs as a
fence-waited one-time submit; create-time transition seeds SHADER_READ
so first upload barriers from there. Lavapipe output unchanged.

* parity: 105 notes round 2b — mac black-frame fix

* parity: 105 fix CI round 4 — zero-fill probe volume, branch the fetch

Branchless fetch read the uninitialized volume even with gain 0
(NaN texels poison pixels on drivers without zero-filled fresh
memory — WARP golden diffs, MoltenVK black ON frame). Fetch is
branched on gain again (textureLod stays: derivative-free, divergent
safe); creation zero-clears the volume via the one-time submit.

* parity: 105 review fixes — stale-gain reset, align-safe copy, split helpers

CodeRabbit round: ON->OFF now pushes a gain-0 box (stale indirect term
gone; test asserts off-after-on bit-identity). WorldTransform rows copy
via byte loop (alignas(64) vs flecs columns under -mavx2). Probe create /
upload split into small helpers (make_probe_image/host/sampler_set,
seed_probe_image, write_probe_box/copy_probe_image, gather_brick_rows);
uploads skip when the box bytes are unchanged (steady-state identical
rewrite also avoids touching in-flight host-visible memory).

* parity: 105 fix MSVC C4702 — drop duplicated return

* parity: 105 cherry-pick P5-03 physics flake fix (zero-init RigidBody rows)

Windows CI run on this branch hit the known physics_bodies flake
(free-fall y ~= -14.2 from garbage is_sensor -> Jolt sensor): cherry-pick
a3e6e71 from parity/p5-03-animator-state-machine-c. Test-only change.

* parity: 105 Sonar new-code pass — arrays, auto, split helpers

S5945: C arrays -> std::array (+ .data() at Vulkan/C call sites) in
GiBake params/light, GiBrickRow, probe box shadow, Vk descriptor sets,
bake AABB, test camera basis. S5827/S1905: auto + drop redundant
void* casts. S6022: std::byte loop. S107: TraceCtx bundles trace args.
S1188/S3574: AllocProbeHostBuffer + SampleSdfTrilerp + gather_probe
extracted; test add_cube/render_frame -> shared helpers. S6004
init-statements, S5817 const (gather_brick_rows/bake), S6181 bit_cast,
S6164 pi_v, S6188 span bake params. C++20-legal only (no std::print).

* parity: 105 fix GCC -Wconversion — size_t array indices

* parity: 105 notes rounds 5-6 — review + Sonar log

* parity: P4-07 GI resolve shade CodeRabbit round (frame scratch, payload compare, bake cap)

* parity: P4-07 GI resolve shade round 2 (shadow reset, baker scratch, cap order, docstrings, drop physics hunk)

* parity: drop stray clangd index, ignore .cache/

---------

Co-authored-by: hermes-agent <hermes-agent@local>
Co-authored-by: Hermes <hermes@local>
2026-11-06 06:28:24 -05:00

3.8 KiB