# Session Log — 2026-07-05 ## Completed - **DAG refactoring** (`scratchpad/dag.c`): Decoupled PrGraph from PrNodeManager. Graph tracks its own active vertices (`vertex_count`, `max_vertex_ever`, `b8 active`). `prGraphAddEdge`, `prGraphTopologicalSort` no longer take `PrNodeManager*`. Kahn's algorithm integrated into `prGraphAddEdge` for cycle detection with rollback. Output verified matching baseline. - **RHI research document** written to `documents/research/rendering-hardware-interface.md`. Covers 8 reference RHIs, architecture patterns, core API surface, Vulkan-specific considerations, Slang integration, and proposed directory layout / lifecycle design. - Added NVRHI to `documents/resources.md`. - **RHI API surface** (`scratchpad/rhi/pr_rhi.h`, `pr_rhi_types.h`): Full RHI API designed with compile-time alias dispatch, by-value desc structs, wapp array types for pointer+count replacement, `PrRhiSwapchainResult` enum, surface capabilities, compute pipeline support, all primitive topologies, and aligned function declarations grouped by subsystem section. - **Initial opencode setup** (opencode.json, justfile, skills, trimmed AGENTS.md). ## Key Decisions - Graph API is self-contained — no graphics or node-manager dependencies. - RHI will use compile-time alias dispatch (`#define prRhiCreateDevice prRhiCreateDeviceVk`) over vtbl — zero runtime overhead, dead-stripping, separate builds per backend. - `justfile` (Just) as task runner. - Object lifecycle: `prRhiCreate*` / `prRhiDestroy*` with explicit `WpAllocator*`. - All GPU state explicit (no hidden pipeline state). - Per-frame command pools and descriptor pools, arena-allocated scratch. - `#version-macro` convention removed from Slang files; `__slang` define used instead. - Desc structs passed by value (not `const *`) for simpler caller ergonomics. - Array aliases grouped: opaque handles (`**`) first, value types (`*`) second, separated by blank line — element types before array aliases before desc structs. ## Next Steps - Begin Vulkan backend implementation starting with `pr_rhi_vk_device.c` (instance/device/surface/swapchain creation). - Implement Slang shader compilation + reflection integration. - Wire up per-frame lifecycle (command pool reset, descriptor pool reset, scratch reset).