WIP: feat(vk): ray-traced ambient occlusion, sun shadows, global illumination and reflections #727

Draft
winterelfeas wants to merge 106 commits from winterelfeas/Longshot:feat/ray-tracing into main
First-time contributor

Type: feat · Risk: medium · Tested on: Windows 11, RTX 5090; Windows 11, Radeon RX 9070 XT (by Drommedhar) · Needs: Linux (AMD RADV), Intel Arc, an older NVIDIA RTX card

Why

The game lights its world with tricks made for a handheld: a screen-space ambient occlusion that only sees what is on screen, sun shadows from low-resolution cascades that fade out in the distance, light baked once per object that never bounces off what is near it, and reflections that show a fixed environment picture instead of the scene. On a PC with a ray tracing GPU, all four can be traced against the real scene instead. This PR adds that, as four options in the Graphics tab, all off by default, so nothing changes for anyone who doesn't turn them on.

No issue asks for it (searched the tracker for ray tracing, reflections, AO and shadows: #601 and #603 are about the game's own character shadows, which this leaves as they are).

What changed

Ray tracing over the game's own frame. The renderer keeps the scene's geometry as Vulkan acceleration structures, built from the game's own vertex and index buffers, and each effect goes in where the game computes the same thing: AO and sun shadows into the game's screen-space light mask, the bounce light and the reflections inside the game's own lighting programs, by a SPIR-V patch of their fragment modules when they are made. The game's renderer is otherwise left as it is; with every row off nothing here runs (rt::mode() is one load). docs/ray-tracing.md describes each part, what it found in the game's frame, the requirements, the cost and the switches.

  • Interface: gpu/vk/vk_rt.h. The parts are told of each draw before and after it is recorded (vk_draw.cpp), of each dispatch, and of each present (vk_replay.cpp).
  • Scene (vk_rt_scene.cpp, vk_rt_omm.h, shaders/rt_scene_*): bottom levels from the depth pre-pass's draws, skinned characters (re-skinned in a compute pass), terrain patches, and the mesh-shader foliage (in the default native mode by running the compute fallback for capture only, every 4th frame per draw; RX_VK_RT_NATIVE_MESH=0 turns that off), and the cascade draws placed by their own vertex stage (the Lost Woods' falling leaves) captured by transform feedback where the device has VK_EXT_transform_feedback (RX_VK_RT_XFB=0 turns that off), and static models the camera has drawn kept as casters while out of view, so interiors keep their roofs (RX_VK_RT_REMEMBER=0 turns that off); a top level a frame with instance masks by kind (opaque, cutout, skinned, foliage, out-of-view casters, cascade-only blockers). Alpha-tested cards are cut by opacity micromaps from the game's own alpha where the device has VK_EXT_opacity_micromap; hit normals by position fetch. The game's pools become build inputs only with ray tracing on (pool_usage() in vk_memory.cpp). Device extensions and features are asked for only when a row or RX_VK_RT is on (vk_main.cpp).
  • AO and sun shadows (vk_rt_mask.cpp, shaders/rt_ao_*): after the game's combine writes its light mask (found by what it does, since it is another program in each kind of place), a trace, a temporal pass and a filter write the mask's AO and sun channels. The traced sun shadow takes the place of the game's (RX_VK_RT_SUN_KEEP=1 adds it to the game's instead, for debugging), and a gate keeps the game's own where the rays would take away sunlight the game shows. Every caster's sun shadow is traced, in both mesh modes: the world, the characters and the plants; past 60 m the traced shadow hands over to the game's (fully by 120 m). The gate is a safety net for a broken structure only.
  • Global illumination (vk_rt_gi.cpp, rt_gi_spirv.h, shaders/rt_gi_*): one diffuse bounce at half resolution, one ray a pixel, from the previous frame's lit colour, accumulated and filtered, added in the lit programs' ambient term.
  • Reflections (vk_rt_refl.cpp, rt_refl_spirv.h, shaders/rt_refl_*): the lit programs' specular environment lookup replaced by a traced reflection along the same vector, on water first, and on smooth metal and glass by their roughness; a march against the previous frame's colour, then the structure for what is off screen.
  • Program cache (vk_progcache.cpp, vk_shader.h): the GI and reflection patches are applied when a module is made, so the cache's records are the game's own, unchanged, and its stamp does not move.
  • Replay: par_threads() turns parallel replay off while ray tracing is on: its parts record in the stream's order (the frame's captures, the structure's builds), and the log says so.
  • Menu (vk_menu.cpp, vk_menu.h): a Ray tracing (Experimental) section at the end of the Graphics tab, four Off/On rows, read once at the start (restart rows, outside the quality presets), and a Reflections: max roughness row (Low / Medium / High / Max, applied at once). RX_VK_RT=<bits> goes over them.
  • From Drommedhar's #1151 (their commits, cherry-picked with their authorship): the bottom levels' budget follows the card's video memory, and on a card without opacity micromaps (RX_VK_RT_ALPHA=1, off by default) the cut-outs' baked bits are tested in the rays' loop, with FULL split into micromaps and position fetch.
  • Checks: tests/test_menu_sections.py and the README's table know the rows; tests/test_recorder_sync.py knows the structure builds (with a control case); the program cache, import and fallback pipeline fixtures stand in for the new hooks; gpu/vk/tests/rt_*_spirv_test.cpp patch modules for spirv-val.

Measurements

Verdict: with the rows off this PR costs nothing measurable: main and this PR with RX_VK_RT=0 both hold the 60 fps cap with the same GPU time a frame and the same video memory. With all four rows on, the frame rate falls from 60 to 51.9 fps at the tester's settings (4K output, DLSS at 50%) and to 39.8 fps at 4K DLAA on an RTX 5090 (GPU time about +4 and +8.5 ms a frame, video memory +1.5 and +2.2 GB): the rows are off by default and marked Experimental, for cards with room to spare.

Hardware: Windows 11 Home (26200), RTX 5090 32 GB, driver 621.01, Ryzen 7 9800X3D, 64 GB
Scene: Kokiri Forest by day, child Link standing at the save's spot; scripted (longshot_ctl.py), the game's window not focused, sound off, no other GPU work alternating with the runs
Method: 30 s standing, then the log's vk: N presents, X fps lines over 90 s, each run's median; a warm-up run, then main, this PR with RX_VK_RT=15 and this PR with RX_VK_RT=0, interleaved, three times (twice for RX_VK_RT=0); the median of the runs. RX_VK_LOAD=create, RX_VK_PRECOMPILE=0
Baseline: main 54ef5ca3's renderer against this PR's at bd3ca8e6 (this branch rebased on 54ef5ca3), both built alone (RX_VK_ONLY, release) and swapped in one game folder built by make_game.py from this branch, so the exe (API 29) is the same on every side
How to reproduce: python -I scripts/longshot_ctl.py launch <game> --save <a save in Kokiri Forest> --env RX_VK_RT=0 (then =15), with the renderers swapped, and read the fps lines

Before: main @ 54ef5ca3 After, rows off (RX_VK_RT=0): this PR @ bd3ca8e6 After, all four rows on (RX_VK_RT=15): this PR @ bd3ca8e6
fps at the tester's settings (3840x2160 output, DLSS at 50%: a 1920x1080 scene; AO Ultra, reflections Max), median of the runs 60.0 (60.0, 60.0, 60.0) 60.0 (60.0, 60.0) 51.9 (50.5, 51.9, 52.1)
GPU time a frame, same 7.5-8.2 ms 7.7-8.0 ms 11.3-12.3 ms
video memory in use, same 5.9 GB 5.9 GB 7.3-7.5 GB
fps at 4K DLAA (a 3840x2160 scene), median of the runs 60.0 (60.0, 60.0, 60.0) 60.0 (60.0, 60.0) 39.8 (39.8, 39.8, 40.0)
GPU time a frame, same 8.7-9.3 ms 8.7-9.0 ms 17.3-17.4 ms
video memory in use, same 6.2-6.4 GB 6.3 GB 8.4-8.5 GB

Main and the rows-off side are held at the cap, so this pair says only that nothing visible is lost at the cap; their GPU times agree within a few tenths of a millisecond. No device lost in these 18 runs. The earlier A/B on d34ac44b (before the sun gate's fix below) gave 49.8 and 32.3 fps all on. In that earlier batch, the first all-on runs (44.8 and 22.4 fps, with a GPU time of 28.5 or 45 ms a frame at 4K) were taken while another game's runs alternated with these on the same GPU; with nothing alternating, five 4K runs held 24-25 ms throughout. One run of this PR with the rows off lost the device (frame 11193, in a draw of the game's program 999fd641ba1fc2b0 with no ray tracing pass in the frame; Windows logged one nvlddmkm event 153); the runs after it (twenty-odd, all four parts on and off) did not. Logs and pictures are in the comment with these numbers; docs/tested/2026-11-17-ray-tracing-winterelfeas-ab-*.md has this batch's two rows.

The sun gate's sums (the light mask's count of sunlit texels, read back by the CPU) were atomics into host memory, over PCIe; they now go into a 16-byte device-local buffer, copied out once a frame (cc5c18cf). That took the AO and sun shadows' "filter and write" span from 1.06 to 0.18 ms at the tester's settings and from 4.31 to 0.70 ms at 4K DLAA (interleaved before/after, 2 runs a side, pictures and the gate's readings unchanged), and it is the likely cause of the occasional 45 ms frames under load. The per-part table below is from before it.

GPU time of each part (this PR at d34ac44b, the tester's settings: 4K output, DLSS at 50%; all four rows on with RX_VK_PASS_TIMING=1, each part switched live, 45 s windows, nothing else on the GPU but a video player; fps is held at the 60 cap in most states, so the GPU time a frame is the measure; "structure only" is all four parts off with the scene still built every frame):

Place RX_VK_RT=0 structure only + AO Ultra + sun shadows + GI + reflections (Max) all four top level, CPU (render thread)
Kokiri Forest 7.4 ms 9.1 ms 9.05 ms 10.5 ms 9.3 ms 11.1 ms 13.3-13.7 ms (47.5-49.7 fps) 4.5-4.8 ms
Market 6.8 ms 7.85 ms 7.95 ms 9.45 ms 8.1 ms 9.4 ms 11.5-12.0 ms (51.5-53.5 fps) 3.1-3.3 ms
Kakariko Village 7.1 ms 8.8 ms 8.5 ms 9.8 ms 8.6 ms 9.7 ms 12.1-12.2 ms (57-58 fps) 2.9-3.1 ms
Lake Hylia 7.0 ms 9.3 ms 8.5 ms 9.7 ms 8.7 ms 10.2 ms 12.2-13.4 ms (55-60 fps) 1.2-2.0 ms

Over the structure alone: AO about 0 (it takes the place of the game's SSAO, whose dispatches are left out), sun shadows +1.0 to +1.6 ms, GI +0.0 to +0.25 ms, reflections at Max +0.9 to +2.0 ms; the structure itself +1.0 to +2.3 ms over RX_VK_RT=0; all four +3.4 to +4.6 ms. AO's quality rows cost 8.7 / 8.8 / 8.9 / 9.05 ms (Low to Ultra, Kokiri); the reflections' roughness rows 9.0 / 9.6 / 10.4 / 11.1 ms (Low to Max, Kokiri). Video memory with all four: +1.1 to +1.5 GB at the tester's settings, +2.3 GB at 4K DLAA. At 4K DLAA (pass-timed, steady): 24.6-25.4 ms a frame, 30-32 fps; the largest spans were then the AO and sun shadows' filter and write (4.3 ms, 0.7 ms since cc5c18cf) and their rays (2.8 ms). Building the top level is CPU work on the render thread (1.2 to 5 ms a frame by place); moving it off that thread is the next optimisation. No device lost in these 9 runs.

GPU-assisted validation (VK_LAYER_KHRONOS_validation with GPU-AV, core checks off), Kokiri Forest, all four rows on: no device lost, no out-of-bounds access, no invalid address, with the opacity micromaps and with the path without them forced (RX_VK_RT_OMM=0 RX_VK_RT_ALPHA=1). The one report from this PR's code, VUID-vkCmdBuildMicromapsEXT-pInfos-07515 (micromap data not 256-aligned), is fixed in 4171fade and gone in its own run. The other reports are not this PR's: VUID-RuntimeSpirv-MeshEXT-12380 (the shader translator's mesh path) and SharedMemoryDataRace in two of the game's own compute programs. The Market and the other towns were not reached under validation (a few frames a second).

Quality, measured on the parts' branches before they were joined here: the structure agrees with the game's depth on 90-99% of the screen across eight areas; with the sun gate the rays keep 98-100% of the game's sunlit screen in Kokiri Forest and 92-96% in the gorge; GI adds 11% to Kokiri Forest's picture and 17-30% inside the Deku Tree, never darkening; at night (22:00) the traced shadows follow the moon's cascades and GI adds 12-22% with nothing darker; reflections reach ten water surfaces, the armour and the Market's shop windows.

Flags and settings

Five new menu rows (ini keys from their names) and the RX_VK_RT switch family; all off as shipped.

Flag What it is Before this PR After this PR Effect Helps / doesn't help / untested Recommendation
Ray-traced ambient occlusion (Graphics row) AO traced in place of the game's SSAO - Off contact and corner shading from the scene, not the screen helps on RTX 5090; untested elsewhere off by default until other GPUs are tested
Ray-traced sun shadows (Graphics row) sun shadows traced into the light mask, the cascades kept where the rays would lose light - Off sharp, far-reaching sun shadows helps on RTX 5090; leaf shadows need RX_VK_MESH_SHADERS=compute off by default
Ray-traced global illumination (Graphics row) one diffuse bounce added to the baked ambient - Off coloured light in the shade helps on RTX 5090; untested elsewhere off by default
Ray-traced reflections (Graphics row) traced reflections in place of the environment lookup - Off water and smooth surfaces reflect the scene helps on RTX 5090; some water (Kakariko's pond, the moat, the river) not reached yet off by default
RX_VK_RT=<bits> the four for one run: 1 AO, 2 sun shadows, 4 GI, 8 reflections - unset (the rows) over the rows testing for testing and A/B runs
RX_VK_RT_*: RX_VK_RT_AO_CONTACT, RX_VK_RT_AO_FALLOFF, RX_VK_RT_AO_FAR, RX_VK_RT_AO_INTO_SSAO, RX_VK_RT_AO_MARCH_RADIUS, RX_VK_RT_AO_MARCH_WEIGHT, RX_VK_RT_AO_MASK, RX_VK_RT_AO_POWER, RX_VK_RT_AO_QUALITY, RX_VK_RT_AO_QUARTER, RX_VK_RT_AO_RADIUS, RX_VK_RT_AO_RAYS, RX_VK_RT_AO_STEPS, RX_VK_RT_AO_STRENGTH, RX_VK_RT_AO_THICKNESS, RX_VK_RT_ALPHA, RX_VK_RT_ALPHA_CENSUS, RX_VK_RT_ALPHA_LEVEL, RX_VK_RT_ALPHA_MB, RX_VK_RT_ALPHA_MESH_LEVEL, RX_VK_RT_ALPHA_REBAKE, RX_VK_RT_ALPHA_SKINNED, RX_VK_RT_ALPHA_TRIS, RX_VK_RT_ARENA_MB, RX_VK_RT_BACK, RX_VK_RT_BIAS, RX_VK_RT_BLAS_MB, RX_VK_RT_BUILD_TRIS, RX_VK_RT_CASCADES, RX_VK_RT_CASCADE_MESH, RX_VK_RT_CHANNELS, RX_VK_RT_CLAMP, RX_VK_RT_CONTACT, RX_VK_RT_CONTACT_STEPS, RX_VK_RT_CONTACT_THICKNESS, RX_VK_RT_CUT, RX_VK_RT_CUTOUT, RX_VK_RT_CUTOUT_COVER, RX_VK_RT_CUT_LEVEL, RX_VK_RT_DEBUG, RX_VK_RT_DEBUG_FILE, RX_VK_RT_DEBUG_GAIN, RX_VK_RT_DEBUG_MASK, RX_VK_RT_DEBUG_POINT, RX_VK_RT_DEBUG_VIEW, RX_VK_RT_EMISSION, RX_VK_RT_EMISSION_DEFAULTS, RX_VK_RT_EMISSION_GAIN, RX_VK_RT_FETCH, RX_VK_RT_FILTER, RX_VK_RT_FORCE, RX_VK_RT_GI_ADD, RX_VK_RT_GI_AREA, RX_VK_RT_GI_CACHE, RX_VK_RT_GI_CLAMP, RX_VK_RT_GI_CTL, RX_VK_RT_GI_FALLBACK, RX_VK_RT_GI_FEEDBACK, RX_VK_RT_GI_FILTER, RX_VK_RT_GI_FORGET, RX_VK_RT_GI_HISTORY, RX_VK_RT_GI_HOLD, RX_VK_RT_GI_KERNEL, RX_VK_RT_GI_LENGTH, RX_VK_RT_GI_NEAR, RX_VK_RT_GI_OCCLUDE, RX_VK_RT_GI_PROBE, RX_VK_RT_GI_RAYS, RX_VK_RT_GI_REGION, RX_VK_RT_GI_REPLACE, RX_VK_RT_GI_SELF, RX_VK_RT_GI_STABLE, RX_VK_RT_GI_STEPS, RX_VK_RT_GI_STRENGTH, RX_VK_RT_GI_THICKNESS, RX_VK_RT_GI_TRACE, RX_VK_RT_GI_WAY, RX_VK_RT_GROUND_MATERIAL, RX_VK_RT_HISTORY, RX_VK_RT_HISTORY_TOL, RX_VK_RT_HOLES, RX_VK_RT_HYBRID, RX_VK_RT_KEEP, RX_VK_RT_LEAF_CUT, RX_VK_RT_LEAF_CUT_LEVEL, RX_VK_RT_LEAF_LOG, RX_VK_RT_LEAF_MB, RX_VK_RT_LEAF_MIN, RX_VK_RT_LEAF_MIN_FAR, RX_VK_RT_LEAF_PROGS, RX_VK_RT_LIFT, RX_VK_RT_MAT_LOG, RX_VK_RT_MARCH, RX_VK_RT_MESH, RX_VK_RT_MESH_EDGE, RX_VK_RT_MESH_EDGE_CTL, RX_VK_RT_MESH_EVERY, RX_VK_RT_MESH_MB, RX_VK_RT_MESH_TEST, RX_VK_RT_NATIVE_MESH, RX_VK_RT_NEAR_DEDUPE, RX_VK_RT_OMM, RX_VK_RT_OMM_ALPHA, RX_VK_RT_OMM_LEVEL, RX_VK_RT_PALETTE_COPY, RX_VK_RT_PROBE, RX_VK_RT_REFL_AMBIENT, RX_VK_RT_REFL_BOUND, RX_VK_RT_REFL_CLAMP, RX_VK_RT_REFL_CONE, RX_VK_RT_REFL_CTL, RX_VK_RT_REFL_DITHER, RX_VK_RT_REFL_GLOW, RX_VK_RT_REFL_LENGTH, RX_VK_RT_REFL_MARCH_ALL, RX_VK_RT_REFL_MASK, RX_VK_RT_REFL_METAL_RAYS, RX_VK_RT_REFL_METAL_ROUGH, RX_VK_RT_REFL_NEAR, RX_VK_RT_REFL_NEAR_FAR, RX_VK_RT_REFL_OWN, RX_VK_RT_REFL_PROBE, RX_VK_RT_REFL_RAYS, RX_VK_RT_REFL_RES, RX_VK_RT_REFL_ROUGH, RX_VK_RT_REFL_SCREEN, RX_VK_RT_REFL_SHEEN, RX_VK_RT_REFL_SHEEN_BITS, RX_VK_RT_REFL_SHEEN_SHARE, RX_VK_RT_REFL_SHEEN_TINT, RX_VK_RT_REFL_SHARE, RX_VK_RT_REFL_STEPS, RX_VK_RT_REFL_STRENGTH, RX_VK_RT_REFL_STRIDE, RX_VK_RT_REFL_SUN, RX_VK_RT_REFL_THICKNESS, RX_VK_RT_REMEMBER, RX_VK_RT_REMEMBER_SKINNED, RX_VK_RT_SCENE_EARLY, RX_VK_RT_SCENE_LOG, RX_VK_RT_SCENE_SPV, RX_VK_RT_SCRATCH_MB, RX_VK_RT_SHADOW_BIAS, RX_VK_RT_SHADOW_DIST, RX_VK_RT_SHADOW_MASK, RX_VK_RT_SHADOW_RAYS, RX_VK_RT_SHADOW_SLOPE, RX_VK_RT_STATIC_MAP, RX_VK_RT_STATIC_MESH, RX_VK_RT_STATIC_MESH_MB, RX_VK_RT_SUN_CUTOUT, RX_VK_RT_SUN_FADE, RX_VK_RT_SUN_GATE, RX_VK_RT_SUN_GATE_FAR, RX_VK_RT_SUN_KEEP, RX_VK_RT_SUN_LOG, RX_VK_RT_SUN_SOFT, RX_VK_RT_SUN_TILT, RX_VK_RT_SUN_TURN, RX_VK_RT_TERRAIN_MASK, RX_VK_RT_TINT, RX_VK_RT_TINT_PROGS, RX_VK_RT_TINT_SHEEN, RX_VK_RT_TUNE, RX_VK_RT_XFB, RX_VK_RT_XFB_DUMP, RX_VK_RT_XFB_MASK, RX_VK_RT_XFB_MB each part's tuning, memory budgets and debug pictures (docs/ray-tracing.md; the head of each part's .cpp file) - unset - (unset: the defaults the rows use) testing only leave unset

Documented in docs/ray-tracing.md, in docs/development.md ("The GPU") and in the README's option table, and each has its row in gpu/vk/switches.def (160 rows; the light mask's tuning switches are named whole in kNamed so the table's check sees their reads).

Screenshots

The Graphics tab's Ray tracing (Experimental) rows (this PR's build):

The Graphics tab: Ray tracing (Experimental)

The same spot and frame, the feature off (left) and on (right), 4K on an RTX 5090, from the parts' development builds (this PR's code; the sun shadow ones also carry the static shadow map's casters, still in testing).

Sun shadows (RX_VK_RT=2 against 0): each clover leaf, grass blade and fence slat casts its own cut shadow where the game's maps give soft patches.

Sun shadows, Kakariko's gate: off left, on right

Sun shadows, Kakariko's fence: off left, on right

In Kokiri Forest, leaf-over-leaf and stem shadows inside the plant, which the game's cascades don't resolve:

Sun shadows, Kokiri Forest: off left, on right

GI (RX_VK_RT=4 against 0): light bounced from lamps, doorways and lava into what the game leaves near black.

GI, a Kakariko house: off left, on right

GI, Link's house: off left, on right

GI, Dodongo's Cavern: off left, on right

AO (RX_VK_RT=9, AO and reflections, the AO switched off and on in the same frame): under the bedside table, behind its legs and where the bed meets the floor, the traced AO shades what the game's SSAO leaves light.

AO, a Kakariko house: off left, on right

The occlusion buffers of one frame (not the final picture), the game's SSAO left and the traced AO right: the game's is grainy, haloed round the table and fades out with distance; the traced one is clean and holds at any distance.

AO buffers, a Kakariko house: the game's SSAO left, traced right

AO buffers, the Temple of Time's door: the game's SSAO left, traced right

Reflections (RX_VK_RT=9, the reflections switched off and on in the same frame): water takes what is really around it instead of the game's fixed environment picture.

Reflections, Gerudo Valley's stream: off left, on right

Reflections, Zora's River in shade: off left, on right

Testing

Tested:

  • python -I -B tests/run_all.py on Windows (llvm-mingw and the Vulkan SDK on PATH, the renderer build's variables set), this branch rebased onto main 544229a2: 643 passed, 44 failed, 45 skipped (the same 44 on 54ef5ca3). main 54ef5ca3 in the same environment on this PC: 630 passed, 45 failed: the same 44 (test_auto_handheld, test_bug_report_defaults, test_cpu_report, test_crash_dialog, test_crt_options, test_damage_debug_menu, test_display_startup_failure, test_dlss_feature_size, test_failed_compile_keeps_objects, test_finish_output, test_framegen_preset, test_fsr_uniform_ownership, test_guest_imported, test_hud_layout_row, test_import_reach, test_invalidate_vcore, test_job_queue, test_linux_preflight, test_linux_pressure, test_mirror_budget, test_missing_nup, test_pads_after_menu, test_parallel_init_order, test_pending_guest_import, test_perf_report, test_pipeline_play_cache, test_present_thread, test_profiling_mode, test_readback_timeout_source, test_recorder_sync, test_replay_write_order, test_rumble_menu, test_run_all_changed, test_slow_frames, test_staging_burst, test_switch_table, test_target_image_pool, test_tested_configurations, test_upscaler_round_trip, test_upscaler_rows, test_vcore_escape, test_vk_occlusion_queries, test_vk_swapchain_compat, test_walk_key) and test_longshot_ctl, which times out at times when the tests run 16 at once. test_switch_table fails on main too, for RX_VK_PGO_FILE, which only nx2/build.py passes to the compiler; with that name left out it passes here with the 160 ray tracing rows.
  • On AMD by Drommedhar (thank you): Radeon RX 9070 XT (16 GB), driver 26.11.1, Windows 11, FSR 4.1.2 at 1440p, this branch from e9518463 to f70c348d, all four rows on, by day and at night in Kokiri Forest, the Deku Tree, the Market, the Temple of Time, Kakariko, Hyrule Field and Zora's Fountain: it works. That driver has no VK_EXT_opacity_micromap, so it ran the path without micromaps throughout; their fixes from that run (the bottom levels' budget by video memory, position fetch apart from micromaps, cut-outs tested in the rays with RX_VK_RT_ALPHA=1) are in this PR as their own commits. Their report also names what is still off on that card: reflections of hits off the screen are flat colours, and a first start with the rows on built pipelines for about 17 minutes.
  • In the game, on Windows 11, RTX 5090, 621.01: this PR's full build (make_game.py) at d34ac44b, an earlier push of this branch on main 26ce01b5, in about 40 runs on 16 Nov (the measurements, GPU-assisted validation of both paths, the parts switched live in Kokiri Forest, the Market, Kakariko Village and Lake Hylia): one device lost, with the rows off (Measurements); the later commits' alignment fix passed its own GPU-assisted run.
  • The parked-corner fix (1327215a, 94f6920f, e7cc11df), on Windows 11, RTX 5090: Kokiri Forest by the houses, with Foliage distance at 125% (a graphics option from outside this PR, in a local build that has it), was 10.7 fps against 42 at 100%, with huge sun shadows flickering over the area: falling leaves and faded mesh-shader foliage had corners parked off the view, unprojected to far places, so triangles spanning the area. With the fix, 38.8 fps at 125% against 40.1 at 100%, the rays' pass 0.46 against 0.44 ms. A regression check with RX_VK_RT_MESH_EDGE_CTL (switched live, the camera still): at Foliage 100%, in Kokiri Forest (three views), the Lost Woods, the Sacred Forest Meadow, Hyrule Field and Kakariko Village, the sun and AO views with the check off and at 30, 8, 4, 2, 1 and 0.05 m differ no more than two shots with it off do (wind sway): no tree or shadow goes missing. Live at 125%: check off 13.7 fps with the huge shadows, on 42 fps. The game-free checks on this head against the head before it, in the same environment: the same 641 passed and the same failing tests.
  • On the parts' branches, over a night of runs on the v3.0.0-rc.3 base: Kokiri Forest, Lost Woods, Hyrule Field, Lake Hylia, Kakariko Village, the Market, Death Mountain Trail, the gorge and inside the Deku Tree, in both mesh shader modes.
  • scripts/check_guide_screenshots.py --review-sources: settings-graphics.png now also names vk_menu.cpp and vk_menu.h (main already names four other files for it). The new section is at the end of the Graphics tab, below Anisotropic filtering, far below what the image shows, so the image still matches; the review record is left for the documentation maintainer with main's four.

Not tested:

  • Any GPU other than the RTX 5090 and Drommedhar's RX 9070 XT: Intel, older NVIDIA cards, AMD on Linux (RADV).
  • Linux: no Linux PC here; the renderer is meant to build there as it is (no Windows-only code added), not tried.
  • Frame generation and the other upscalers with the rows on (DLAA and the game's own upscaler only).
  • Areas past the first few hours of the game.

Must be tested:

  • linux (Test Farm): build, then the same as below, expecting the same (Test Farm: @Beanstalk build and ray tracing rows on, Linux)
  • linux, amd, radv (Test Farm): turn on the four Ray tracing rows, restart, play a few minutes in Kokiri Forest and at Lake Hylia, expecting no device lost and the log's vk: rt: lines saying the scene is kept as acceleration structures (Test Farm: @Beanstalk ray tracing rows on, Kokiri Forest and Lake Hylia, RDNA 2 or newer)
  • windows, intel arc (Test Farm): the same, expecting the same (Test Farm: @Beanstalk ray tracing rows on, Intel Arc)
  • windows, NVIDIA RTX 20 or 30 series (by hand or Test Farm): the same, and the frame rate with the rows on against off, expecting the cost to scale with the GPU
  • A GPU without ray tracing (any): the rows on, expecting the game to run as with them off, apart from AO and sun shadows marched against the depth buffer and GI against the depth buffer alone (by hand: the log's vk: rt: lines and the picture)

Risks

What could break: with the rows on: a device lost or a hang on a driver this was not run on; a long first start while the patched lit programs' pipelines are built (about 17 minutes on Drommedhar's RX 9070 XT, about 3.5 later; the game draws what is ready meanwhile); wrong shading where the patched lighting programs meet a program the patch did not expect (it only patches programs it recognises, and leaves the rest as they are); memory (about 365 MB of images for AO and sun shadows at 4K, plus the structures). With the rows off: nothing should change; the hooks are behind rt::on(), one load. Parallel replay is off while ray tracing is on, which costs CPU time on PCs that use it.

Turning it off: the four rows (off by default), or RX_VK_RT=0 for a run.

Compatibility: saves unchanged. longshot_options.ini gains the ray tracing rows' keys, written only when the menu saves. The shader and program caches are unchanged (the patch is applied when a module is made, after the cache); with GI or reflections on, the driver's pipeline cache builds the lit programs again on the first run. The vk ABI (MKWVK_API_VERSION) is unchanged. The builder's tools are unchanged.

Checklist

Everyone

  • One topic.
  • The title is a Conventional Commit (type(scope): description) of the status line's type.
  • Why gives the reason plainly and links the issues that fit (the tracker searched).
  • Measurements has a verdict, or one line saying why there is nothing to measure.
  • Testing names what was tested, what wasn't, and what must still be tested, where and how.
  • Rebased on current main.
  • python -I -B tests/run_all.py passes (any failure that also fails on main is named).
  • No game files, dumps, build output or generated files.
  • third_party/ untouched (a new folder with a PROVENANCE.md instead).
  • The license is OK: GPL-3.0-or-later, nothing incompatible and nothing decompiled.

When it applies

  • AI assistance recorded with Assisted-by: / Co-Authored-By: trailers.
  • Numbers from the same PC, scene and settings, at least 2 interleaved runs each, the median reported.
  • Switches documented (docs/development.md; the README for a menu row) and shipped at their recommended value.
  • Screenshots of the same spot, captioned like the Measurements columns, for a change that shows on screen.
  • A file in docs/tested/ for each new measured run (format in docs/tested-configurations.md).
  • The SPIR-V headers regenerated with glslang (a shader changed).
  • A check under tests/ that reads changed source updated in this PR, not weakened.
  • Host code builds on both Windows (llvm-mingw) and Linux, with UTF-8 paths. (built and tested on Windows only: no Linux PC here. The changed C++ uses no Windows-only API, headers or paths (searched); the Linux build is asked of the Test Farm under Must be tested, or of a reviewer with Linux)
  • Docs updated.

🤖 Generated with Claude Code

**Type:** feat · **Risk:** medium · **Tested on:** Windows 11, RTX 5090; Windows 11, Radeon RX 9070 XT (by Drommedhar) · **Needs:** Linux (AMD RADV), Intel Arc, an older NVIDIA RTX card ## Why The game lights its world with tricks made for a handheld: a screen-space ambient occlusion that only sees what is on screen, sun shadows from low-resolution cascades that fade out in the distance, light baked once per object that never bounces off what is near it, and reflections that show a fixed environment picture instead of the scene. On a PC with a ray tracing GPU, all four can be traced against the real scene instead. This PR adds that, as four options in the Graphics tab, all off by default, so nothing changes for anyone who doesn't turn them on. No issue asks for it (searched the tracker for ray tracing, reflections, AO and shadows: #601 and #603 are about the game's own character shadows, which this leaves as they are). ## What changed Ray tracing over the game's own frame. The renderer keeps the scene's geometry as Vulkan acceleration structures, built from the game's own vertex and index buffers, and each effect goes in where the game computes the same thing: AO and sun shadows into the game's screen-space light mask, the bounce light and the reflections inside the game's own lighting programs, by a SPIR-V patch of their fragment modules when they are made. The game's renderer is otherwise left as it is; with every row off nothing here runs (`rt::mode()` is one load). `docs/ray-tracing.md` describes each part, what it found in the game's frame, the requirements, the cost and the switches. - **Interface:** `gpu/vk/vk_rt.h`. The parts are told of each draw before and after it is recorded (`vk_draw.cpp`), of each dispatch, and of each present (`vk_replay.cpp`). - **Scene** (`vk_rt_scene.cpp`, `vk_rt_omm.h`, `shaders/rt_scene_*`): bottom levels from the depth pre-pass's draws, skinned characters (re-skinned in a compute pass), terrain patches, and the mesh-shader foliage (in the default native mode by running the compute fallback for capture only, every 4th frame per draw; `RX_VK_RT_NATIVE_MESH=0` turns that off), and the cascade draws placed by their own vertex stage (the Lost Woods' falling leaves) captured by transform feedback where the device has `VK_EXT_transform_feedback` (`RX_VK_RT_XFB=0` turns that off), and static models the camera has drawn kept as casters while out of view, so interiors keep their roofs (`RX_VK_RT_REMEMBER=0` turns that off); a top level a frame with instance masks by kind (opaque, cutout, skinned, foliage, out-of-view casters, cascade-only blockers). Alpha-tested cards are cut by opacity micromaps from the game's own alpha where the device has `VK_EXT_opacity_micromap`; hit normals by position fetch. The game's pools become build inputs only with ray tracing on (`pool_usage()` in `vk_memory.cpp`). Device extensions and features are asked for only when a row or `RX_VK_RT` is on (`vk_main.cpp`). - **AO and sun shadows** (`vk_rt_mask.cpp`, `shaders/rt_ao_*`): after the game's combine writes its light mask (found by what it does, since it is another program in each kind of place), a trace, a temporal pass and a filter write the mask's AO and sun channels. The traced sun shadow takes the place of the game's (`RX_VK_RT_SUN_KEEP=1` adds it to the game's instead, for debugging), and a gate keeps the game's own where the rays would take away sunlight the game shows. Every caster's sun shadow is traced, in both mesh modes: the world, the characters and the plants; past 60 m the traced shadow hands over to the game's (fully by 120 m). The gate is a safety net for a broken structure only. - **Global illumination** (`vk_rt_gi.cpp`, `rt_gi_spirv.h`, `shaders/rt_gi_*`): one diffuse bounce at half resolution, one ray a pixel, from the previous frame's lit colour, accumulated and filtered, added in the lit programs' ambient term. - **Reflections** (`vk_rt_refl.cpp`, `rt_refl_spirv.h`, `shaders/rt_refl_*`): the lit programs' specular environment lookup replaced by a traced reflection along the same vector, on water first, and on smooth metal and glass by their roughness; a march against the previous frame's colour, then the structure for what is off screen. - **Program cache** (`vk_progcache.cpp`, `vk_shader.h`): the GI and reflection patches are applied when a module is made, so the cache's records are the game's own, unchanged, and its stamp does not move. - **Replay:** `par_threads()` turns parallel replay off while ray tracing is on: its parts record in the stream's order (the frame's captures, the structure's builds), and the log says so. - **Menu** (`vk_menu.cpp`, `vk_menu.h`): a Ray tracing (Experimental) section at the end of the Graphics tab, four Off/On rows, read once at the start (restart rows, outside the quality presets), and a Reflections: max roughness row (Low / Medium / High / Max, applied at once). `RX_VK_RT=<bits>` goes over them. - **From Drommedhar's #1151** (their commits, cherry-picked with their authorship): the bottom levels' budget follows the card's video memory, and on a card without opacity micromaps (`RX_VK_RT_ALPHA=1`, off by default) the cut-outs' baked bits are tested in the rays' loop, with `FULL` split into micromaps and position fetch. - **Checks:** `tests/test_menu_sections.py` and the README's table know the rows; `tests/test_recorder_sync.py` knows the structure builds (with a control case); the program cache, import and fallback pipeline fixtures stand in for the new hooks; `gpu/vk/tests/rt_*_spirv_test.cpp` patch modules for `spirv-val`. ## Measurements **Verdict:** with the rows off this PR costs nothing measurable: main and this PR with `RX_VK_RT=0` both hold the 60 fps cap with the same GPU time a frame and the same video memory. With all four rows on, the frame rate falls from 60 to 51.9 fps at the tester's settings (4K output, DLSS at 50%) and to 39.8 fps at 4K DLAA on an RTX 5090 (GPU time about +4 and +8.5 ms a frame, video memory +1.5 and +2.2 GB): the rows are off by default and marked Experimental, for cards with room to spare. Hardware: Windows 11 Home (26200), RTX 5090 32 GB, driver 621.01, Ryzen 7 9800X3D, 64 GB Scene: Kokiri Forest by day, child Link standing at the save's spot; scripted (`longshot_ctl.py`), the game's window not focused, sound off, no other GPU work alternating with the runs Method: 30 s standing, then the log's `vk: N presents, X fps` lines over 90 s, each run's median; a warm-up run, then main, this PR with `RX_VK_RT=15` and this PR with `RX_VK_RT=0`, interleaved, three times (twice for `RX_VK_RT=0`); the median of the runs. `RX_VK_LOAD=create`, `RX_VK_PRECOMPILE=0` Baseline: main 54ef5ca3's renderer against this PR's at bd3ca8e6 (this branch rebased on 54ef5ca3), both built alone (`RX_VK_ONLY`, release) and swapped in one game folder built by `make_game.py` from this branch, so the exe (API 29) is the same on every side How to reproduce: `python -I scripts/longshot_ctl.py launch <game> --save <a save in Kokiri Forest> --env RX_VK_RT=0` (then `=15`), with the renderers swapped, and read the fps lines | | Before: main @ 54ef5ca3 | After, rows off (`RX_VK_RT=0`): this PR @ bd3ca8e6 | After, all four rows on (`RX_VK_RT=15`): this PR @ bd3ca8e6 | |---|---|---|---| | fps at the tester's settings (3840x2160 output, DLSS at 50%: a 1920x1080 scene; AO Ultra, reflections Max), median of the runs | 60.0 (60.0, 60.0, 60.0) | 60.0 (60.0, 60.0) | 51.9 (50.5, 51.9, 52.1) | | GPU time a frame, same | 7.5-8.2 ms | 7.7-8.0 ms | 11.3-12.3 ms | | video memory in use, same | 5.9 GB | 5.9 GB | 7.3-7.5 GB | | fps at 4K DLAA (a 3840x2160 scene), median of the runs | 60.0 (60.0, 60.0, 60.0) | 60.0 (60.0, 60.0) | 39.8 (39.8, 39.8, 40.0) | | GPU time a frame, same | 8.7-9.3 ms | 8.7-9.0 ms | 17.3-17.4 ms | | video memory in use, same | 6.2-6.4 GB | 6.3 GB | 8.4-8.5 GB | Main and the rows-off side are held at the cap, so this pair says only that nothing visible is lost at the cap; their GPU times agree within a few tenths of a millisecond. No device lost in these 18 runs. The earlier A/B on d34ac44b (before the sun gate's fix below) gave 49.8 and 32.3 fps all on. In that earlier batch, the first all-on runs (44.8 and 22.4 fps, with a GPU time of 28.5 or 45 ms a frame at 4K) were taken while another game's runs alternated with these on the same GPU; with nothing alternating, five 4K runs held 24-25 ms throughout. One run of this PR with the rows off lost the device (frame 11193, in a draw of the game's program 999fd641ba1fc2b0 with no ray tracing pass in the frame; Windows logged one nvlddmkm event 153); the runs after it (twenty-odd, all four parts on and off) did not. Logs and pictures are in the comment with these numbers; `docs/tested/2026-11-17-ray-tracing-winterelfeas-ab-*.md` has this batch's two rows. The sun gate's sums (the light mask's count of sunlit texels, read back by the CPU) were atomics into host memory, over PCIe; they now go into a 16-byte device-local buffer, copied out once a frame (cc5c18cf). That took the AO and sun shadows' "filter and write" span from 1.06 to 0.18 ms at the tester's settings and from 4.31 to 0.70 ms at 4K DLAA (interleaved before/after, 2 runs a side, pictures and the gate's readings unchanged), and it is the likely cause of the occasional 45 ms frames under load. The per-part table below is from before it. GPU time of each part (this PR at d34ac44b, the tester's settings: 4K output, DLSS at 50%; all four rows on with `RX_VK_PASS_TIMING=1`, each part switched live, 45 s windows, nothing else on the GPU but a video player; fps is held at the 60 cap in most states, so the GPU time a frame is the measure; "structure only" is all four parts off with the scene still built every frame): | Place | `RX_VK_RT=0` | structure only | + AO Ultra | + sun shadows | + GI | + reflections (Max) | all four | top level, CPU (render thread) | |---|---|---|---|---|---|---|---|---| | Kokiri Forest | 7.4 ms | 9.1 ms | 9.05 ms | 10.5 ms | 9.3 ms | 11.1 ms | 13.3-13.7 ms (47.5-49.7 fps) | 4.5-4.8 ms | | Market | 6.8 ms | 7.85 ms | 7.95 ms | 9.45 ms | 8.1 ms | 9.4 ms | 11.5-12.0 ms (51.5-53.5 fps) | 3.1-3.3 ms | | Kakariko Village | 7.1 ms | 8.8 ms | 8.5 ms | 9.8 ms | 8.6 ms | 9.7 ms | 12.1-12.2 ms (57-58 fps) | 2.9-3.1 ms | | Lake Hylia | 7.0 ms | 9.3 ms | 8.5 ms | 9.7 ms | 8.7 ms | 10.2 ms | 12.2-13.4 ms (55-60 fps) | 1.2-2.0 ms | Over the structure alone: AO about 0 (it takes the place of the game's SSAO, whose dispatches are left out), sun shadows +1.0 to +1.6 ms, GI +0.0 to +0.25 ms, reflections at Max +0.9 to +2.0 ms; the structure itself +1.0 to +2.3 ms over `RX_VK_RT=0`; all four +3.4 to +4.6 ms. AO's quality rows cost 8.7 / 8.8 / 8.9 / 9.05 ms (Low to Ultra, Kokiri); the reflections' roughness rows 9.0 / 9.6 / 10.4 / 11.1 ms (Low to Max, Kokiri). Video memory with all four: +1.1 to +1.5 GB at the tester's settings, +2.3 GB at 4K DLAA. At 4K DLAA (pass-timed, steady): 24.6-25.4 ms a frame, 30-32 fps; the largest spans were then the AO and sun shadows' filter and write (4.3 ms, 0.7 ms since cc5c18cf) and their rays (2.8 ms). Building the top level is CPU work on the render thread (1.2 to 5 ms a frame by place); moving it off that thread is the next optimisation. No device lost in these 9 runs. GPU-assisted validation (`VK_LAYER_KHRONOS_validation` with GPU-AV, core checks off), Kokiri Forest, all four rows on: no device lost, no out-of-bounds access, no invalid address, with the opacity micromaps and with the path without them forced (`RX_VK_RT_OMM=0 RX_VK_RT_ALPHA=1`). The one report from this PR's code, VUID-vkCmdBuildMicromapsEXT-pInfos-07515 (micromap data not 256-aligned), is fixed in 4171fade and gone in its own run. The other reports are not this PR's: VUID-RuntimeSpirv-MeshEXT-12380 (the shader translator's mesh path) and SharedMemoryDataRace in two of the game's own compute programs. The Market and the other towns were not reached under validation (a few frames a second). Quality, measured on the parts' branches before they were joined here: the structure agrees with the game's depth on 90-99% of the screen across eight areas; with the sun gate the rays keep 98-100% of the game's sunlit screen in Kokiri Forest and 92-96% in the gorge; GI adds 11% to Kokiri Forest's picture and 17-30% inside the Deku Tree, never darkening; at night (22:00) the traced shadows follow the moon's cascades and GI adds 12-22% with nothing darker; reflections reach ten water surfaces, the armour and the Market's shop windows. ### Flags and settings Five new menu rows (ini keys from their names) and the `RX_VK_RT` switch family; all off as shipped. | Flag | What it is | Before this PR | After this PR | Effect | Helps / doesn't help / untested | Recommendation | |---|---|---|---|---|---|---| | Ray-traced ambient occlusion (Graphics row) | AO traced in place of the game's SSAO | - | Off | contact and corner shading from the scene, not the screen | helps on RTX 5090; untested elsewhere | off by default until other GPUs are tested | | Ray-traced sun shadows (Graphics row) | sun shadows traced into the light mask, the cascades kept where the rays would lose light | - | Off | sharp, far-reaching sun shadows | helps on RTX 5090; leaf shadows need `RX_VK_MESH_SHADERS=compute` | off by default | | Ray-traced global illumination (Graphics row) | one diffuse bounce added to the baked ambient | - | Off | coloured light in the shade | helps on RTX 5090; untested elsewhere | off by default | | Ray-traced reflections (Graphics row) | traced reflections in place of the environment lookup | - | Off | water and smooth surfaces reflect the scene | helps on RTX 5090; some water (Kakariko's pond, the moat, the river) not reached yet | off by default | | `RX_VK_RT=<bits>` | the four for one run: 1 AO, 2 sun shadows, 4 GI, 8 reflections | - | unset (the rows) | over the rows | testing | for testing and A/B runs | | `RX_VK_RT_*`: `RX_VK_RT_AO_CONTACT`, `RX_VK_RT_AO_FALLOFF`, `RX_VK_RT_AO_FAR`, `RX_VK_RT_AO_INTO_SSAO`, `RX_VK_RT_AO_MARCH_RADIUS`, `RX_VK_RT_AO_MARCH_WEIGHT`, `RX_VK_RT_AO_MASK`, `RX_VK_RT_AO_POWER`, `RX_VK_RT_AO_QUALITY`, `RX_VK_RT_AO_QUARTER`, `RX_VK_RT_AO_RADIUS`, `RX_VK_RT_AO_RAYS`, `RX_VK_RT_AO_STEPS`, `RX_VK_RT_AO_STRENGTH`, `RX_VK_RT_AO_THICKNESS`, `RX_VK_RT_ALPHA`, `RX_VK_RT_ALPHA_CENSUS`, `RX_VK_RT_ALPHA_LEVEL`, `RX_VK_RT_ALPHA_MB`, `RX_VK_RT_ALPHA_MESH_LEVEL`, `RX_VK_RT_ALPHA_REBAKE`, `RX_VK_RT_ALPHA_SKINNED`, `RX_VK_RT_ALPHA_TRIS`, `RX_VK_RT_ARENA_MB`, `RX_VK_RT_BACK`, `RX_VK_RT_BIAS`, `RX_VK_RT_BLAS_MB`, `RX_VK_RT_BUILD_TRIS`, `RX_VK_RT_CASCADES`, `RX_VK_RT_CASCADE_MESH`, `RX_VK_RT_CHANNELS`, `RX_VK_RT_CLAMP`, `RX_VK_RT_CONTACT`, `RX_VK_RT_CONTACT_STEPS`, `RX_VK_RT_CONTACT_THICKNESS`, `RX_VK_RT_CUT`, `RX_VK_RT_CUTOUT`, `RX_VK_RT_CUTOUT_COVER`, `RX_VK_RT_CUT_LEVEL`, `RX_VK_RT_DEBUG`, `RX_VK_RT_DEBUG_FILE`, `RX_VK_RT_DEBUG_GAIN`, `RX_VK_RT_DEBUG_MASK`, `RX_VK_RT_DEBUG_POINT`, `RX_VK_RT_DEBUG_VIEW`, `RX_VK_RT_EMISSION`, `RX_VK_RT_EMISSION_DEFAULTS`, `RX_VK_RT_EMISSION_GAIN`, `RX_VK_RT_FETCH`, `RX_VK_RT_FILTER`, `RX_VK_RT_FORCE`, `RX_VK_RT_GI_ADD`, `RX_VK_RT_GI_AREA`, `RX_VK_RT_GI_CACHE`, `RX_VK_RT_GI_CLAMP`, `RX_VK_RT_GI_CTL`, `RX_VK_RT_GI_FALLBACK`, `RX_VK_RT_GI_FEEDBACK`, `RX_VK_RT_GI_FILTER`, `RX_VK_RT_GI_FORGET`, `RX_VK_RT_GI_HISTORY`, `RX_VK_RT_GI_HOLD`, `RX_VK_RT_GI_KERNEL`, `RX_VK_RT_GI_LENGTH`, `RX_VK_RT_GI_NEAR`, `RX_VK_RT_GI_OCCLUDE`, `RX_VK_RT_GI_PROBE`, `RX_VK_RT_GI_RAYS`, `RX_VK_RT_GI_REGION`, `RX_VK_RT_GI_REPLACE`, `RX_VK_RT_GI_SELF`, `RX_VK_RT_GI_STABLE`, `RX_VK_RT_GI_STEPS`, `RX_VK_RT_GI_STRENGTH`, `RX_VK_RT_GI_THICKNESS`, `RX_VK_RT_GI_TRACE`, `RX_VK_RT_GI_WAY`, `RX_VK_RT_GROUND_MATERIAL`, `RX_VK_RT_HISTORY`, `RX_VK_RT_HISTORY_TOL`, `RX_VK_RT_HOLES`, `RX_VK_RT_HYBRID`, `RX_VK_RT_KEEP`, `RX_VK_RT_LEAF_CUT`, `RX_VK_RT_LEAF_CUT_LEVEL`, `RX_VK_RT_LEAF_LOG`, `RX_VK_RT_LEAF_MB`, `RX_VK_RT_LEAF_MIN`, `RX_VK_RT_LEAF_MIN_FAR`, `RX_VK_RT_LEAF_PROGS`, `RX_VK_RT_LIFT`, `RX_VK_RT_MAT_LOG`, `RX_VK_RT_MARCH`, `RX_VK_RT_MESH`, `RX_VK_RT_MESH_EDGE`, `RX_VK_RT_MESH_EDGE_CTL`, `RX_VK_RT_MESH_EVERY`, `RX_VK_RT_MESH_MB`, `RX_VK_RT_MESH_TEST`, `RX_VK_RT_NATIVE_MESH`, `RX_VK_RT_NEAR_DEDUPE`, `RX_VK_RT_OMM`, `RX_VK_RT_OMM_ALPHA`, `RX_VK_RT_OMM_LEVEL`, `RX_VK_RT_PALETTE_COPY`, `RX_VK_RT_PROBE`, `RX_VK_RT_REFL_AMBIENT`, `RX_VK_RT_REFL_BOUND`, `RX_VK_RT_REFL_CLAMP`, `RX_VK_RT_REFL_CONE`, `RX_VK_RT_REFL_CTL`, `RX_VK_RT_REFL_DITHER`, `RX_VK_RT_REFL_GLOW`, `RX_VK_RT_REFL_LENGTH`, `RX_VK_RT_REFL_MARCH_ALL`, `RX_VK_RT_REFL_MASK`, `RX_VK_RT_REFL_METAL_RAYS`, `RX_VK_RT_REFL_METAL_ROUGH`, `RX_VK_RT_REFL_NEAR`, `RX_VK_RT_REFL_NEAR_FAR`, `RX_VK_RT_REFL_OWN`, `RX_VK_RT_REFL_PROBE`, `RX_VK_RT_REFL_RAYS`, `RX_VK_RT_REFL_RES`, `RX_VK_RT_REFL_ROUGH`, `RX_VK_RT_REFL_SCREEN`, `RX_VK_RT_REFL_SHEEN`, `RX_VK_RT_REFL_SHEEN_BITS`, `RX_VK_RT_REFL_SHEEN_SHARE`, `RX_VK_RT_REFL_SHEEN_TINT`, `RX_VK_RT_REFL_SHARE`, `RX_VK_RT_REFL_STEPS`, `RX_VK_RT_REFL_STRENGTH`, `RX_VK_RT_REFL_STRIDE`, `RX_VK_RT_REFL_SUN`, `RX_VK_RT_REFL_THICKNESS`, `RX_VK_RT_REMEMBER`, `RX_VK_RT_REMEMBER_SKINNED`, `RX_VK_RT_SCENE_EARLY`, `RX_VK_RT_SCENE_LOG`, `RX_VK_RT_SCENE_SPV`, `RX_VK_RT_SCRATCH_MB`, `RX_VK_RT_SHADOW_BIAS`, `RX_VK_RT_SHADOW_DIST`, `RX_VK_RT_SHADOW_MASK`, `RX_VK_RT_SHADOW_RAYS`, `RX_VK_RT_SHADOW_SLOPE`, `RX_VK_RT_STATIC_MAP`, `RX_VK_RT_STATIC_MESH`, `RX_VK_RT_STATIC_MESH_MB`, `RX_VK_RT_SUN_CUTOUT`, `RX_VK_RT_SUN_FADE`, `RX_VK_RT_SUN_GATE`, `RX_VK_RT_SUN_GATE_FAR`, `RX_VK_RT_SUN_KEEP`, `RX_VK_RT_SUN_LOG`, `RX_VK_RT_SUN_SOFT`, `RX_VK_RT_SUN_TILT`, `RX_VK_RT_SUN_TURN`, `RX_VK_RT_TERRAIN_MASK`, `RX_VK_RT_TINT`, `RX_VK_RT_TINT_PROGS`, `RX_VK_RT_TINT_SHEEN`, `RX_VK_RT_TUNE`, `RX_VK_RT_XFB`, `RX_VK_RT_XFB_DUMP`, `RX_VK_RT_XFB_MASK`, `RX_VK_RT_XFB_MB` | each part's tuning, memory budgets and debug pictures (`docs/ray-tracing.md`; the head of each part's `.cpp` file) | - | unset | - (unset: the defaults the rows use) | testing only | leave unset | Documented in `docs/ray-tracing.md`, in `docs/development.md` ("The GPU") and in the README's option table, and each has its row in `gpu/vk/switches.def` (160 rows; the light mask's tuning switches are named whole in `kNamed` so the table's check sees their reads). ## Screenshots The Graphics tab's Ray tracing (Experimental) rows (this PR's build): ![The Graphics tab: Ray tracing (Experimental)](https://git.magicbean.dev/attachments/695472c3-273d-4812-90c7-ae5e843f1675) The same spot and frame, the feature off (left) and on (right), 4K on an RTX 5090, from the parts' development builds (this PR's code; the sun shadow ones also carry the static shadow map's casters, still in testing). **Sun shadows** (`RX_VK_RT=2` against 0): each clover leaf, grass blade and fence slat casts its own cut shadow where the game's maps give soft patches. ![Sun shadows, Kakariko's gate: off left, on right](https://git.magicbean.dev/attachments/df1860c1-0485-4337-8d43-0f0632241b11) ![Sun shadows, Kakariko's fence: off left, on right](https://git.magicbean.dev/attachments/9376dd86-34d3-417c-89cf-dc850181d063) In Kokiri Forest, leaf-over-leaf and stem shadows inside the plant, which the game's cascades don't resolve: ![Sun shadows, Kokiri Forest: off left, on right](https://git.magicbean.dev/attachments/6d3d204e-947e-49c1-860d-5763100ad4b9) **GI** (`RX_VK_RT=4` against 0): light bounced from lamps, doorways and lava into what the game leaves near black. ![GI, a Kakariko house: off left, on right](https://git.magicbean.dev/attachments/4d697f53-ecab-4dfa-81ed-4fed83a7e2a4) ![GI, Link's house: off left, on right](https://git.magicbean.dev/attachments/5ef7dee5-51b7-4f95-80a7-4af325efccf3) ![GI, Dodongo's Cavern: off left, on right](https://git.magicbean.dev/attachments/fbbc8221-5675-47c9-bb21-57b42a412ea4) **AO** (`RX_VK_RT=9`, AO and reflections, the AO switched off and on in the same frame): under the bedside table, behind its legs and where the bed meets the floor, the traced AO shades what the game's SSAO leaves light. ![AO, a Kakariko house: off left, on right](https://git.magicbean.dev/attachments/fa9a855b-dfe9-434f-a13e-c78bdfcdee0b) The occlusion buffers of one frame (not the final picture), the game's SSAO left and the traced AO right: the game's is grainy, haloed round the table and fades out with distance; the traced one is clean and holds at any distance. ![AO buffers, a Kakariko house: the game's SSAO left, traced right](https://git.magicbean.dev/attachments/cf6c1328-d0ed-4c56-b021-6305d11f0f6f) ![AO buffers, the Temple of Time's door: the game's SSAO left, traced right](https://git.magicbean.dev/attachments/f7decdee-aa67-44ff-81ba-0b690b40097d) **Reflections** (`RX_VK_RT=9`, the reflections switched off and on in the same frame): water takes what is really around it instead of the game's fixed environment picture. ![Reflections, Gerudo Valley's stream: off left, on right](https://git.magicbean.dev/attachments/d439e774-d466-4c42-9f89-9aac26a6f4f7) ![Reflections, Zora's River in shade: off left, on right](https://git.magicbean.dev/attachments/68026231-d79d-4744-a7a9-875591b2ce06) ## Testing **Tested:** - `python -I -B tests/run_all.py` on Windows (llvm-mingw and the Vulkan SDK on PATH, the renderer build's variables set), this branch rebased onto main 544229a2: 643 passed, 44 failed, 45 skipped (the same 44 on 54ef5ca3). main 54ef5ca3 in the same environment on this PC: 630 passed, 45 failed: the same 44 (test_auto_handheld, test_bug_report_defaults, test_cpu_report, test_crash_dialog, test_crt_options, test_damage_debug_menu, test_display_startup_failure, test_dlss_feature_size, test_failed_compile_keeps_objects, test_finish_output, test_framegen_preset, test_fsr_uniform_ownership, test_guest_imported, test_hud_layout_row, test_import_reach, test_invalidate_vcore, test_job_queue, test_linux_preflight, test_linux_pressure, test_mirror_budget, test_missing_nup, test_pads_after_menu, test_parallel_init_order, test_pending_guest_import, test_perf_report, test_pipeline_play_cache, test_present_thread, test_profiling_mode, test_readback_timeout_source, test_recorder_sync, test_replay_write_order, test_rumble_menu, test_run_all_changed, test_slow_frames, test_staging_burst, test_switch_table, test_target_image_pool, test_tested_configurations, test_upscaler_round_trip, test_upscaler_rows, test_vcore_escape, test_vk_occlusion_queries, test_vk_swapchain_compat, test_walk_key) and test_longshot_ctl, which times out at times when the tests run 16 at once. test_switch_table fails on main too, for `RX_VK_PGO_FILE`, which only `nx2/build.py` passes to the compiler; with that name left out it passes here with the 160 ray tracing rows. - On AMD by Drommedhar (thank you): Radeon RX 9070 XT (16 GB), driver 26.11.1, Windows 11, FSR 4.1.2 at 1440p, this branch from e9518463 to f70c348d, all four rows on, by day and at night in Kokiri Forest, the Deku Tree, the Market, the Temple of Time, Kakariko, Hyrule Field and Zora's Fountain: it works. That driver has no `VK_EXT_opacity_micromap`, so it ran the path without micromaps throughout; their fixes from that run (the bottom levels' budget by video memory, position fetch apart from micromaps, cut-outs tested in the rays with `RX_VK_RT_ALPHA=1`) are in this PR as their own commits. [Their report](https://git.magicbean.dev/MagicBeanDev/Longshot/pulls/727#issuecomment-36272) also names what is still off on that card: reflections of hits off the screen are flat colours, and a first start with the rows on built pipelines for about 17 minutes. - In the game, on Windows 11, RTX 5090, 621.01: this PR's full build (`make_game.py`) at d34ac44b, an earlier push of this branch on main 26ce01b5, in about 40 runs on 16 Nov (the measurements, GPU-assisted validation of both paths, the parts switched live in Kokiri Forest, the Market, Kakariko Village and Lake Hylia): one device lost, with the rows off (Measurements); the later commits' alignment fix passed its own GPU-assisted run. - The parked-corner fix (1327215a, 94f6920f, e7cc11df), on Windows 11, RTX 5090: Kokiri Forest by the houses, with Foliage distance at 125% (a graphics option from outside this PR, in a local build that has it), was 10.7 fps against 42 at 100%, with huge sun shadows flickering over the area: falling leaves and faded mesh-shader foliage had corners parked off the view, unprojected to far places, so triangles spanning the area. With the fix, 38.8 fps at 125% against 40.1 at 100%, the rays' pass 0.46 against 0.44 ms. A regression check with `RX_VK_RT_MESH_EDGE_CTL` (switched live, the camera still): at Foliage 100%, in Kokiri Forest (three views), the Lost Woods, the Sacred Forest Meadow, Hyrule Field and Kakariko Village, the sun and AO views with the check off and at 30, 8, 4, 2, 1 and 0.05 m differ no more than two shots with it off do (wind sway): no tree or shadow goes missing. Live at 125%: check off 13.7 fps with the huge shadows, on 42 fps. The game-free checks on this head against the head before it, in the same environment: the same 641 passed and the same failing tests. - On the parts' branches, over a night of runs on the v3.0.0-rc.3 base: Kokiri Forest, Lost Woods, Hyrule Field, Lake Hylia, Kakariko Village, the Market, Death Mountain Trail, the gorge and inside the Deku Tree, in both mesh shader modes. - `scripts/check_guide_screenshots.py --review-sources`: `settings-graphics.png` now also names `vk_menu.cpp` and `vk_menu.h` (main already names four other files for it). The new section is at the end of the Graphics tab, below Anisotropic filtering, far below what the image shows, so the image still matches; the review record is left for the documentation maintainer with main's four. **Not tested:** - Any GPU other than the RTX 5090 and Drommedhar's RX 9070 XT: Intel, older NVIDIA cards, AMD on Linux (RADV). - Linux: no Linux PC here; the renderer is meant to build there as it is (no Windows-only code added), not tried. - Frame generation and the other upscalers with the rows on (DLAA and the game's own upscaler only). - Areas past the first few hours of the game. **Must be tested:** - linux (Test Farm): build, then the same as below, expecting the same (Test Farm: @Beanstalk build and ray tracing rows on, Linux) - linux, amd, radv (Test Farm): turn on the four Ray tracing rows, restart, play a few minutes in Kokiri Forest and at Lake Hylia, expecting no device lost and the log's `vk: rt:` lines saying the scene is kept as acceleration structures (Test Farm: @Beanstalk ray tracing rows on, Kokiri Forest and Lake Hylia, RDNA 2 or newer) - windows, intel arc (Test Farm): the same, expecting the same (Test Farm: @Beanstalk ray tracing rows on, Intel Arc) - windows, NVIDIA RTX 20 or 30 series (by hand or Test Farm): the same, and the frame rate with the rows on against off, expecting the cost to scale with the GPU - A GPU without ray tracing (any): the rows on, expecting the game to run as with them off, apart from AO and sun shadows marched against the depth buffer and GI against the depth buffer alone (by hand: the log's `vk: rt:` lines and the picture) ## Risks **What could break:** with the rows on: a device lost or a hang on a driver this was not run on; a long first start while the patched lit programs' pipelines are built (about 17 minutes on Drommedhar's RX 9070 XT, about 3.5 later; the game draws what is ready meanwhile); wrong shading where the patched lighting programs meet a program the patch did not expect (it only patches programs it recognises, and leaves the rest as they are); memory (about 365 MB of images for AO and sun shadows at 4K, plus the structures). With the rows off: nothing should change; the hooks are behind `rt::on()`, one load. Parallel replay is off while ray tracing is on, which costs CPU time on PCs that use it. **Turning it off:** the four rows (off by default), or `RX_VK_RT=0` for a run. **Compatibility:** saves unchanged. `longshot_options.ini` gains the ray tracing rows' keys, written only when the menu saves. The shader and program caches are unchanged (the patch is applied when a module is made, after the cache); with GI or reflections on, the driver's pipeline cache builds the lit programs again on the first run. The vk ABI (`MKWVK_API_VERSION`) is unchanged. The builder's tools are unchanged. ## Checklist ### Everyone - [x] One topic. - [x] The title is a Conventional Commit (`type(scope): description`) of the status line's type. - [x] Why gives the reason plainly and links the issues that fit (the tracker searched). - [x] Measurements has a verdict, or one line saying why there is nothing to measure. - [x] Testing names what was tested, what wasn't, and what must still be tested, where and how. - [x] Rebased on current `main`. - [x] `python -I -B tests/run_all.py` passes (any failure that also fails on `main` is named). - [x] No game files, dumps, build output or generated files. - [x] `third_party/` untouched (a new folder with a `PROVENANCE.md` instead). - [x] The license is OK: GPL-3.0-or-later, nothing incompatible and nothing decompiled. ### When it applies - [x] AI assistance recorded with `Assisted-by:` / `Co-Authored-By:` trailers. - [x] Numbers from the same PC, scene and settings, at least 2 interleaved runs each, the median reported. - [x] Switches documented (docs/development.md; the README for a menu row) and shipped at their recommended value. - [x] Screenshots of the same spot, captioned like the Measurements columns, for a change that shows on screen. - [x] A file in `docs/tested/` for each new measured run (format in `docs/tested-configurations.md`). - [x] The SPIR-V headers regenerated with glslang (a shader changed). - [x] A check under `tests/` that reads changed source updated in this PR, not weakened. - [ ] Host code builds on both Windows (llvm-mingw) and Linux, with UTF-8 paths. (built and tested on Windows only: no Linux PC here. The changed C++ uses no Windows-only API, headers or paths (searched); the Linux build is asked of the Test Farm under Must be tested, or of a reviewer with Linux) - [x] Docs updated. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Ported from the work on v3.0.0-rc.3 (rt-all 2ad17d6) onto main e090cc4.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Fable 5.2 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The checks test_drawn_page_map and test_recorder_sync now know the RT passes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The mask part's ray query trace declared VK_EXT_opacity_micromap's capability on every device: a second build without it
(rt_ao_trace_rq_plain) where the scene cuts no cards. docs/ray-tracing.md describes the four parts, their requirements,
cost and switches, and the comments point to it; docs/development.md's switch table names RX_VK_RT.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
fix(vk): the sun's coverage-weighted cards are RX_VK_RT_SUN_CUTOUT, no longer sharing RX_VK_RT_CUTOUT with the scene's cutout rule
Some checks failed
PR description / Description follows the template (pull_request_target) Has been cancelled
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
Guide screenshots / Guide images and local UI source review (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
f7abe7e73a
Co-Authored-By: Claude Opus 5.5 <[email protected]>
feat(vk): the traced sun shadow is added to the game's instead of replacing it (RX_VK_RT_SUN_KEEP, default 1)
Some checks failed
PR description / Description follows the template (pull_request_target) Successful in 5s
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
Guide screenshots / Guide images and local UI source review (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
1ffa9e4b79
The rays alone miss casters the game's cascades and static map have: with native mesh shaders every plant (a mesh stage's output cannot be captured), 15 % of the Kokiri spawn's picture is game shadow the rays leave lit; with RX_VK_MESH_SHADERS=compute 5.8 %. The static map's channel now takes min(game, traced) under the sun gate, the cascades stay the game's in both modes. Same-frame 4K dumps, share of the picture, lost shadow / lost sun: native Kokiri 1.7 -> 0 % / 1.9 %; compute Kokiri 5.8 -> 0 % / 7.3 -> 7.7 %; gorge 1.1 -> 0 % (compute); Lake Hylia 0 % / 8.9 % (past the cascades' reach). RX_VK_RT_SUN_KEEP=0: as before. docs/ray-tracing.md describes it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Author
First-time contributor

New commit 1ffa9e4: the traced sun shadow is now added to the game's instead of replacing it (RX_VK_RT_SUN_KEEP=1, the default; =0 is the previous behaviour).

Why: the rays alone miss casters the game's shadow maps have. With native mesh shaders the plants can't be captured into the acceleration structure, so 15 % of the Kokiri spawn's picture was game shadow the rays left lit (5.8 % with RX_VK_MESH_SHADERS=compute). The static map's channel now takes the darker of the game's value and the traced one under the sun gate; the cascades' channel stays the game's.

Measured on the same frames (4K dumps, RTX 5090), share of the picture, lost shadow / lost sun, before -> after: native Kokiri 1.7 -> 0 % / 1.9 %; compute Kokiri 5.8 -> 0 % / 7.3 -> 7.7 %; compute gorge exit 1.1 -> 0 % / 1.8 -> 2.1 %; native gorge 0 % / 0.9 % and Lake Hylia 0 % / 8.9 % unchanged (the far cliffs past the cascades' reach: being worked on). Also checked: RX_VK_RT_OMM=0 runs the plain (no micromap) ray-query shader with no errors.

Checks after the commit: tests/run_all.py 540 passed, 18 failed, the same 18 as main on this PC. docs/ray-tracing.md updated.

New commit 1ffa9e4: the traced sun shadow is now added to the game's instead of replacing it (`RX_VK_RT_SUN_KEEP=1`, the default; `=0` is the previous behaviour). Why: the rays alone miss casters the game's shadow maps have. With native mesh shaders the plants can't be captured into the acceleration structure, so 15 % of the Kokiri spawn's picture was game shadow the rays left lit (5.8 % with `RX_VK_MESH_SHADERS=compute`). The static map's channel now takes the darker of the game's value and the traced one under the sun gate; the cascades' channel stays the game's. Measured on the same frames (4K dumps, RTX 5090), share of the picture, lost shadow / lost sun, before -> after: native Kokiri 1.7 -> 0 % / 1.9 %; compute Kokiri 5.8 -> 0 % / 7.3 -> 7.7 %; compute gorge exit 1.1 -> 0 % / 1.8 -> 2.1 %; native gorge 0 % / 0.9 % and Lake Hylia 0 % / 8.9 % unchanged (the far cliffs past the cascades' reach: being worked on). Also checked: `RX_VK_RT_OMM=0` runs the plain (no micromap) ray-query shader with no errors. Checks after the commit: `tests/run_all.py` 540 passed, 18 failed, the same 18 as main on this PC. `docs/ray-tracing.md` updated.
feat(vk): the traced sun shadow takes the game's place by default; RX_VK_RT_SUN_KEEP=1 (added to the game's) is a debug switch
Some checks failed
PR description / Description follows the template (pull_request_target) Successful in 4s
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
Guide screenshots / Guide images and local UI source review (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
801b951e27
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Author
First-time contributor

New commit 801b951: the traced sun shadow takes the place of the game's by default again. Adding it on top of the game's (RX_VK_RT_SUN_KEEP=1) is now only a debug switch, to see what the rays miss.

The goal is ray-traced sun shadows for every caster. What's missing for that in the default (native) mesh mode is the plants: their geometry comes from mesh shaders and isn't captured into the acceleration structure yet, so their shadows still come from the game's cascades (with RX_VK_MESH_SHADERS=compute they are traced). Capturing them in the native mode is what's being worked on next.

New commit 801b951: the traced sun shadow takes the place of the game's by default again. Adding it on top of the game's (`RX_VK_RT_SUN_KEEP=1`) is now only a debug switch, to see what the rays miss. The goal is ray-traced sun shadows for every caster. What's missing for that in the default (native) mesh mode is the plants: their geometry comes from mesh shaders and isn't captured into the acceleration structure yet, so their shadows still come from the game's cascades (with `RX_VK_MESH_SHADERS=compute` they are traced). Capturing them in the native mode is what's being worked on next.
Author
First-time contributor

New commit 6228330: the mesh-shader plants (grass, ferns, flowers, tree leaves) are now in the ray tracing structure in the default native mesh mode, not only with RX_VK_MESH_SHADERS=compute.

How: after a native task/mesh draw of the depth pre-pass or a sun cascade whose bottom level is due (every 4th frame per draw, RX_VK_RT_MESH_EVERY), draw() runs once more with the program's compute fallback variant, for capture only: its task and mesh stages write the records the bottom level is built from, nothing is drawn, and the cards are cut by opacity micromaps as in compute mode. RX_VK_RT_NATIVE_MESH=0 turns it off. The capture helpers sit before writes_memory() in vk_draw.cpp, and tests/test_draw_side_effects.py stubs the two calls the readiness block makes.

Kokiri Forest, native, RTX 5090: leaves and grass in the structure, 23 mesh draws a frame, about a quarter captured each frame, none left out; no device lost, no validation line. A first uncapped sample with the capture: median 320 fps, 1.8 ms GPU; the comparison against native without capture and compute mode is running. The first native run in an area compiles the fallback variants (a slow first minute).

Next: the sun shadow pass uses the captured plants in the native mode too, so every sun shadow is traced. Checks after the commit: tests/run_all.py 540 passed, 18 failed, the same 18 as main on this PC.

New commit 6228330: the mesh-shader plants (grass, ferns, flowers, tree leaves) are now in the ray tracing structure in the default native mesh mode, not only with `RX_VK_MESH_SHADERS=compute`. How: after a native task/mesh draw of the depth pre-pass or a sun cascade whose bottom level is due (every 4th frame per draw, `RX_VK_RT_MESH_EVERY`), `draw()` runs once more with the program's compute fallback variant, for capture only: its task and mesh stages write the records the bottom level is built from, nothing is drawn, and the cards are cut by opacity micromaps as in compute mode. `RX_VK_RT_NATIVE_MESH=0` turns it off. The capture helpers sit before `writes_memory()` in `vk_draw.cpp`, and `tests/test_draw_side_effects.py` stubs the two calls the readiness block makes. Kokiri Forest, native, RTX 5090: leaves and grass in the structure, 23 mesh draws a frame, about a quarter captured each frame, none left out; no device lost, no validation line. A first uncapped sample with the capture: median 320 fps, 1.8 ms GPU; the comparison against native without capture and compute mode is running. The first native run in an area compiles the fallback variants (a slow first minute). Next: the sun shadow pass uses the captured plants in the native mode too, so every sun shadow is traced. Checks after the commit: `tests/run_all.py` 540 passed, 18 failed, the same 18 as main on this PC.
feat(vk): mesh-shader foliage in the ray tracing structure with native mesh shaders
Some checks failed
PR description / Description follows the template (pull_request_target) Successful in 13s
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
Guide screenshots / Guide images and local UI source review (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
6228330faa
After each native task/mesh draw of the pre-pass or a sun cascade whose bottom level is due (RX_VK_RT_MESH_EVERY), draw() runs again for capture only with the program's compute fallback variant: its task and mesh stages write the records, nothing is drawn, and the cards are cut by micromaps as in compute mode. Kokiri Forest, native: leaves and grass in the structure, 23 mesh draws a frame, about a quarter captured each frame, none left out; no device loss or validation line. RX_VK_RT_NATIVE_MESH=0 turns it off. The first native run in an area compiles the fallback variants.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
perf(vk): rt gi: the passes under 1 ms at 4K (1 ray, a 3 x 3 filter by default); a stability measure and two history switches
Some checks failed
PR description / Description follows the template (pull_request_target) Successful in 17s
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
Guide screenshots / Guide images and local UI source review (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
3f68dfd1bf
GI's passes cost 0.94 ms at 4K on an RTX 5090 (were 1.4): one ray a half-size pixel and a 3 x 3 a-trous filter by default (RX_VK_RT_GI_RAYS, RX_VK_RT_GI_KERNEL=5 for the old taps), and the hit's own sun ray only where neither the screen nor the cache knows the hit. RX_VK_RT_GI_STABLE=1 logs how much the light changes a frame where the same surface is seen (about 6 % still, 10-12 % turning, below the game's own lit colour's 10-16 %); RX_VK_RT_GI_HOLD and RX_VK_RT_GI_FEEDBACK are the history's clamp and feedback, for testing. The head comment says what the energy rule is now (the scale held between 1 and 2.5, ADD 2).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Author
First-time contributor

New commit 3f68dfd: GI's passes cost 0.94 ms at 4K on the RTX 5090 (were 1.4 ms), with no visible loss in the irradiance pictures compared.

What changed: one ray a half-size pixel and a 3 x 3 a-trous filter by default (RX_VK_RT_GI_RAYS=2 and RX_VK_RT_GI_KERNEL=5 give the old settings), and a hit's own sun ray is traced only where neither the screen nor the world-space cache knows the hit. Timing from the pass report: filter 0.39 -> 0.16 ms, rays 1.0 -> 0.51 ms.

Stability was measured too (RX_VK_RT_GI_STABLE=1 logs it): the GI term changes about 6 % a frame with the camera still and 10-12 % while turning, which is below the game's own lit colour (10-16 %, partly its TAA jitter). More rays, a longer history or more filter steps barely moved it, so it is not ray noise; RX_VK_RT_GI_HOLD and RX_VK_RT_GI_FEEDBACK are history switches for testing that.

Checks after the commit: tests/run_all.py 540 passed, 18 failed, the same 18 as main on this PC. docs/ray-tracing.md updated.

New commit 3f68dfd: GI's passes cost 0.94 ms at 4K on the RTX 5090 (were 1.4 ms), with no visible loss in the irradiance pictures compared. What changed: one ray a half-size pixel and a 3 x 3 a-trous filter by default (`RX_VK_RT_GI_RAYS=2` and `RX_VK_RT_GI_KERNEL=5` give the old settings), and a hit's own sun ray is traced only where neither the screen nor the world-space cache knows the hit. Timing from the pass report: filter 0.39 -> 0.16 ms, rays 1.0 -> 0.51 ms. Stability was measured too (`RX_VK_RT_GI_STABLE=1` logs it): the GI term changes about 6 % a frame with the camera still and 10-12 % while turning, which is below the game's own lit colour (10-16 %, partly its TAA jitter). More rays, a longer history or more filter steps barely moved it, so it is not ray noise; `RX_VK_RT_GI_HOLD` and `RX_VK_RT_GI_FEEDBACK` are history switches for testing that. Checks after the commit: `tests/run_all.py` 540 passed, 18 failed, the same 18 as main on this PC. `docs/ray-tracing.md` updated.
Author
First-time contributor

New commit 0b32254, two small ones: GI gets an area row for Death Mountain Trail (its light-mask program is its own), and a place with no row now takes the switches' values instead of the previous area's; the scene's status line counts the sun cascades' draws left out of the structure, by reason, and names their programs once. GI was also checked at Death Mountain Trail, Zora's Domain and the Market.

Checks after the commit: tests/run_all.py 540 passed, 18 failed, the same 18 as main on this PC.

New commit 0b32254, two small ones: GI gets an area row for Death Mountain Trail (its light-mask program is its own), and a place with no row now takes the switches' values instead of the previous area's; the scene's status line counts the sun cascades' draws left out of the structure, by reason, and names their programs once. GI was also checked at Death Mountain Trail, Zora's Domain and the Market. Checks after the commit: `tests/run_all.py` 540 passed, 18 failed, the same 18 as main on this PC.
feat(vk): rt gi: Death Mountain Trail's area row; the scene's status line counts the sun cascades' draws left out
Some checks failed
PR description / Description follows the template (pull_request_target) Successful in 6s
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
Guide screenshots / Guide images and local UI source review (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
0b32254dd7
GI: Death Mountain Trail gets its own area row (its light-mask program is its own), and a place with no row takes the switches' values instead of the last area's. Scene: the status line counts the sun cascades' draws left out of the structure, by reason, and names their programs once.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Author
First-time contributor

Rebased onto current main (aa95d35, after v3.0.0-rc.4); force-pushed. One conflict: tests/test_menu_sections.py, where #735 removed the VRAM budget row next to the new Ray tracing rows; resolved by keeping both changes. The renderer builds, and tests/run_all.py gives 540 passed, 18 failed on both main aa95d35 and this branch, the same 18.

Rebased onto current main (aa95d35, after v3.0.0-rc.4); force-pushed. One conflict: `tests/test_menu_sections.py`, where #735 removed the VRAM budget row next to the new Ray tracing rows; resolved by keeping both changes. The renderer builds, and `tests/run_all.py` gives 540 passed, 18 failed on both main aa95d35 and this branch, the same 18.
winterelfeas force-pushed feat/ray-tracing from 0b32254dd7
Some checks failed
PR description / Description follows the template (pull_request_target) Successful in 6s
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
Guide screenshots / Guide images and local UI source review (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
to b4e2584ed3
Some checks failed
PR description / Description follows the template (pull_request_target) Has been cancelled
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
Guide screenshots / Guide images and local UI source review (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
Website / Website on Cloudflare (pull_request) Has been cancelled
2026-11-15 11:27:43 +00:00
Compare
feat(vk): rt reflections: rough metal smoothed by rays shared over the quad; no cut classes without micromaps
Some checks failed
PR description / Description follows the template (pull_request_target) Successful in 4s
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
Guide screenshots / Guide images and local UI source review (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
aa8853afef
Neighbouring pixels share their reflection rays through quad subgroup swaps (RX_VK_RT_REFL_SHARE, default 2): for the material-F0 class (armour, water) each pixel traces 2 rays and the 2 x 2 quad averages them, so rough plate armour is smooth and as steady frame to frame as the game's own (Kakariko's guard); a single-ray pixel takes the quad leader's answer when it is on the same surface. A device without quad operations in fragment shaders gets no reflections, logged. Without opacity micromaps the rays leave the cut classes out (mask 0x85 in place of 0x97), as GI does. The kept picture is half size, and nothing is captured while reflections are off. The Castle moat shows the scene (a ninth water surface). The SPIR-V linker check passes: 20 modules, 0 invalid.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Author
First-time contributor

New commit aa8853a, reflections:

  • Rough metal: neighbouring pixels share their reflection rays through quad subgroup swaps (RX_VK_RT_REFL_SHARE, default 2). For the material-F0 class each pixel traces 2 rays and the 2 x 2 quad averages them, so rough plate armour (Kakariko's guard) is smooth and as steady frame to frame as the game's own, where 1 ray a pixel left blotches. A device without quad operations in fragment shaders gets no reflections, and the log says so.
  • Without opacity micromaps the reflection rays leave the cut classes out (mask 0x85 in place of 0x97), as GI already does, so cards are never traced as whole triangles.
  • The Castle moat now reflects the scene: nine water surfaces in all.
  • The kept picture is half size, and nothing is captured while reflections are off.

The SPIR-V linker check passes (20 modules, 0 invalid). Checks after the commit: tests/run_all.py 540 passed, 18 failed, the same 18 as main aa95d35 on this PC. docs/ray-tracing.md updated.

New commit aa8853a, reflections: - Rough metal: neighbouring pixels share their reflection rays through quad subgroup swaps (`RX_VK_RT_REFL_SHARE`, default 2). For the material-F0 class each pixel traces 2 rays and the 2 x 2 quad averages them, so rough plate armour (Kakariko's guard) is smooth and as steady frame to frame as the game's own, where 1 ray a pixel left blotches. A device without quad operations in fragment shaders gets no reflections, and the log says so. - Without opacity micromaps the reflection rays leave the cut classes out (mask 0x85 in place of 0x97), as GI already does, so cards are never traced as whole triangles. - The Castle moat now reflects the scene: nine water surfaces in all. - The kept picture is half size, and nothing is captured while reflections are off. The SPIR-V linker check passes (20 modules, 0 invalid). Checks after the commit: `tests/run_all.py` 540 passed, 18 failed, the same 18 as main aa95d35 on this PC. `docs/ray-tracing.md` updated.
feat(vk): rt sun shadows replace the game's for every caster: plants in the native mode, characters, a far hand-over, the gate as a safety net
Some checks failed
PR description / Description follows the template (pull_request_target) Successful in 4s
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
Guide screenshots / Guide images and local UI source review (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
fb962659b7
The traced sun shadow takes the game's place in all three channels the sun goes through: the cascades', the static map's and the characters' (Link and the people are in the structure), so nothing is shadowed twice. The plants count as traced with the scene's native capture as in compute mode (foliage_traced()). Past 60 m the traced shadow hands over to the game's value, fully by 120 m (RX_VK_RT_SUN_FADE). The sun gate only catches a broken structure: the game's shadow comes back under 25 % of its sunlight kept (back over 40 %), or over 125 % (back under 115 %), and its log names its sums. Debug views sun_cmp and sun_cmp2 put the game's sun, the traced and the depth in one frame.

Native mode, one frame per view at 4K, share of the picture, lost shadow / shadow the game lacks: Kokiri spawn 4.3 % (15.0 % before the native foliage capture) / 4.9 %; Hyrule Field tunnel 0.1 / 1.0 %; gorge exit 0.9 / 1.7 %; Lost Woods 2.4 / 15.6 % (real canopy and blade-on-blade shadow); Lake Hylia 5.4 / 1.4 % (the game's blurred map past the traced edge). The gate fired in none. The menu help, README and docs no longer say leaf shadows need the compute mesh mode.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Author
First-time contributor

New commit fb96265: the traced sun shadow now replaces the game's for every caster, in the default native mesh mode too.

  • It takes the game's place in all three channels the sun goes through: the cascades', the static map's and the characters' (Link and the people are skinned in the structure), so nothing is shadowed twice.
  • The plants count as traced with the scene's native capture (6228330), as in compute mode, so leaf and grass shadows are traced by default.
  • Past 60 m the traced shadow hands over to the game's value, fully by 120 m (RX_VK_RT_SUN_FADE).
  • The sun gate is only a safety net for a broken structure: the game's shadow comes back under 25 % of its sunlight kept, or over 125 %.

Native mode, one frame per view at 4K, share of the picture (lost shadow: the game shadows, the rays don't / shadow the game lacks):

View Lost shadow Shadow the game lacks
Kokiri Forest spawn 4.3 % (15.0 % before the native foliage capture) 4.9 %
Hyrule Field, the tunnel 0.1 % 1.0 %
Hyrule Field, the gorge exit 0.9 % 1.7 %
Lost Woods 2.4 % 15.6 % (canopy and blade-on-blade shadow the cascades lack)
Lake Hylia 5.4 % 1.4 %

The gate fired in none of the five. What is left is not a missing caster: scattered bits at Kokiri (leaf surfaces drawn at another level of detail, thin edges), and at Lake Hylia a band along shadow edges where the game's blurred static map reaches further than the traced edge. The Graphics menu's help, the README and docs/ray-tracing.md no longer say leaf shadows need the compute mesh mode. Not checked yet: the night (moon) and held items.

Checks after the commit: the renderer builds, tests/run_all.py 540 passed, 18 failed, the same 18 as main aa95d35 on this PC.

New commit fb96265: the traced sun shadow now replaces the game's for every caster, in the default native mesh mode too. - It takes the game's place in all three channels the sun goes through: the cascades', the static map's and the characters' (Link and the people are skinned in the structure), so nothing is shadowed twice. - The plants count as traced with the scene's native capture (6228330), as in compute mode, so leaf and grass shadows are traced by default. - Past 60 m the traced shadow hands over to the game's value, fully by 120 m (`RX_VK_RT_SUN_FADE`). - The sun gate is only a safety net for a broken structure: the game's shadow comes back under 25 % of its sunlight kept, or over 125 %. Native mode, one frame per view at 4K, share of the picture (lost shadow: the game shadows, the rays don't / shadow the game lacks): | View | Lost shadow | Shadow the game lacks | |---|---|---| | Kokiri Forest spawn | 4.3 % (15.0 % before the native foliage capture) | 4.9 % | | Hyrule Field, the tunnel | 0.1 % | 1.0 % | | Hyrule Field, the gorge exit | 0.9 % | 1.7 % | | Lost Woods | 2.4 % | 15.6 % (canopy and blade-on-blade shadow the cascades lack) | | Lake Hylia | 5.4 % | 1.4 % | The gate fired in none of the five. What is left is not a missing caster: scattered bits at Kokiri (leaf surfaces drawn at another level of detail, thin edges), and at Lake Hylia a band along shadow edges where the game's blurred static map reaches further than the traced edge. The Graphics menu's help, the README and docs/ray-tracing.md no longer say leaf shadows need the compute mesh mode. Not checked yet: the night (moon) and held items. Checks after the commit: the renderer builds, `tests/run_all.py` 540 passed, 18 failed, the same 18 as main aa95d35 on this PC.
A cascade draw whose vertex stage places its triangles by a rule the scene cannot read (the Lost Woods' falling leaves,
from particle storage buffers) is recorded again with its own vertex stage, the rasterizer off, and its clip positions
captured by VK_EXT_transform_feedback; rt_scene_mesh.comp turns them into world triangles (kCaster). RX_VK_RT_XFB=0 turns
it off. Also: a logged frame writes the SPIR-V of the cascades' left-out programs, the sun gate's log line names the sun's
direction, and the GI and reflection control files take clock=<hour> (menu_ask_cheat_action) for night tests.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
test(vk): fallback pipeline state: the fixture declares rt_xfb_vertex, which build_graphics now reads
Some checks failed
PR description / Description follows the template (pull_request_target) Successful in 5s
Website / Website on Cloudflare (pull_request_target) Has been skipped
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
Guide screenshots / Guide images and local UI source review (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
34cfe3f0fb
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Author
First-time contributor

Pushed 34cfe3f: every caster the game's sun cascades draw is now in the ray tracing structure in the areas checked (Kokiri Forest, the Hyrule Field gorge, Lake Hylia, the Lost Woods, inside the Deku Tree).

  • The Lost Woods' falling leaves are particles placed by their vertex stage from storage buffers. Their cascade draws are now recorded once more with their own vertex stage, the rasterizer off, and the positions captured by VK_EXT_transform_feedback, then turned into world triangles every 4th frame. The status line's count of cascade draws left out there went from 5.5 a frame to none; the same particle captured from two cascades lands at the same world position. RX_VK_RT_XFB=0 turns it off, and a device without the extension goes on without it.
  • The GI and reflection control files take clock=<hour> (a test aid for night runs, through the Cheats page's clock action). At 22:00 the traced sun shadows follow the moon's cascades and GI brightens by 12-22% with nothing darker.
  • Reflections: Hyrule Field's river and the Market's shop windows added to what has been seen.
  • tests/test_fallback_pipeline_state.py's fixture declares the new variable build_graphics reads.

Checks: tests/run_all.py on Windows, the same failures as main aa95d35 (machine-specific) plus the two that fail under load here (test_dev_packs, test_finish_output); the renderer builds with 0 failures. Still WIP: the measurements are taken once at the end.

Pushed 34cfe3f: every caster the game's sun cascades draw is now in the ray tracing structure in the areas checked (Kokiri Forest, the Hyrule Field gorge, Lake Hylia, the Lost Woods, inside the Deku Tree). - The Lost Woods' falling leaves are particles placed by their vertex stage from storage buffers. Their cascade draws are now recorded once more with their own vertex stage, the rasterizer off, and the positions captured by `VK_EXT_transform_feedback`, then turned into world triangles every 4th frame. The status line's count of cascade draws left out there went from 5.5 a frame to none; the same particle captured from two cascades lands at the same world position. `RX_VK_RT_XFB=0` turns it off, and a device without the extension goes on without it. - The GI and reflection control files take `clock=<hour>` (a test aid for night runs, through the Cheats page's clock action). At 22:00 the traced sun shadows follow the moon's cascades and GI brightens by 12-22% with nothing darker. - Reflections: Hyrule Field's river and the Market's shop windows added to what has been seen. - `tests/test_fallback_pipeline_state.py`'s fixture declares the new variable `build_graphics` reads. Checks: `tests/run_all.py` on Windows, the same failures as main aa95d35 (machine-specific) plus the two that fail under load here (`test_dev_packs`, `test_finish_output`); the renderer builds with 0 failures. Still WIP: the measurements are taken once at the end.
fix(vk): rt sun: the gate keeps the game's shadow where the game shows no sunlight and the rays would light the picture
Some checks failed
PR description / Description follows the template (pull_request_target) Successful in 4s
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
Guide screenshots / Guide images and local UI source review (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
51e66ed9da
Inside the Temple of Time the game's mask keeps the sun out wholly and the structure has no roof over the hall: the
traced shadow left 40-42 % of the picture lit and the floor burnt white, since the gate took no reading under 5 % sunlit.
Now the traced sunlight over a twentieth of the picture more than the game's reads as 150 % and the game's values stay.
A Kakariko house, Link's house and the Bombchu Bowling Alley are as with the rays off. Also test switches for the sun's
direction (RX_VK_RT_SUN_TILT, RX_VK_RT_SUN_TURN; RX_VK_RT_LIFT may be negative), and the docs' gate defaults corrected.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Author
First-time contributor

Pushed 51e66ed: a fix to the sun gate for interiors.

  • Inside the Temple of Time the game's light mask keeps the sun out wholly, but the structure has no roof over the hall yet: the traced shadow left 40-42% of the picture lit and the floor burnt white. The gate took no reading where under 5% of the game's picture is sunlit, so the traced value was written. Now, there, traced sunlight over a twentieth of the picture more than the game's reads as 150% and the game's own values stay. Checked in the game: the temple with the rays on is the game's picture again; Link's house, a Kakariko house and the Bombchu Bowling Alley look as with the rays off. The hall's shell in the structure is the real fix and is being looked at.
  • Test switches for the sun's direction (RX_VK_RT_SUN_TILT, RX_VK_RT_SUN_TURN), used to show that the remaining band at Lake Hylia is the game's cascade edge, not a wrong direction.
  • docs/ray-tracing.md: the gate's interior rule, and the gate's default thresholds in the switch table corrected (0.25, 0.4, 1.15, 1.25).

Checks: the same as the last push (main's failures plus the two that fail under load here); the renderer builds with 0 failures.

Pushed 51e66ed: a fix to the sun gate for interiors. - Inside the Temple of Time the game's light mask keeps the sun out wholly, but the structure has no roof over the hall yet: the traced shadow left 40-42% of the picture lit and the floor burnt white. The gate took no reading where under 5% of the game's picture is sunlit, so the traced value was written. Now, there, traced sunlight over a twentieth of the picture more than the game's reads as 150% and the game's own values stay. Checked in the game: the temple with the rays on is the game's picture again; Link's house, a Kakariko house and the Bombchu Bowling Alley look as with the rays off. The hall's shell in the structure is the real fix and is being looked at. - Test switches for the sun's direction (`RX_VK_RT_SUN_TILT`, `RX_VK_RT_SUN_TURN`), used to show that the remaining band at Lake Hylia is the game's cascade edge, not a wrong direction. - docs/ray-tracing.md: the gate's interior rule, and the gate's default thresholds in the switch table corrected (0.25, 0.4, 1.15, 1.25). Checks: the same as the last push (main's failures plus the two that fail under load here); the renderer builds with 0 failures.
feat(vk): rt scene: static models the camera has drawn stay as casters out of view (interior roofs); a capture that did not run is counted
Some checks failed
PR description / Description follows the template (pull_request_target) Successful in 5s
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
Guide screenshots / Guide images and local UI source review (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
da8301011b
Indoors no sun cascade draws the walls and roof, so the Temple of Time's vault left the structure whenever the camera
looked level and the sun's rays reached the floor (40 % of the picture open to the sun, 0.2 % now). A static model the
pre-pass has drawn at one place for eight frames stays in the top level as a caster when it is not drawn; it is let go
when its memory is rewritten, its bottom level is freed, a loading screen passes or the camera jumps 30 m.
RX_VK_RT_REMEMBER=0 turns it off. Also: a transform feedback capture that could not run (its program not in the cache
yet, on the first visit) is counted among the cascades' left-out draws with the reason, and retried every 180 frames.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Author
First-time contributor

Pushed da83010: interiors keep their roofs in the structure, and the caster count is honest on a first visit.

  • Indoors no sun cascade draws the walls and roof, and the camera's pass draws them only while in view, so the Temple of Time's vault left the structure whenever the camera looked level: 40% of the picture was open to the sun. A static model the camera's pass has drawn at one place for eight frames now stays in the top level as a caster on the frames it is not drawn. It is let go when its memory is rewritten, its bottom level is freed, a loading screen passes or the camera jumps 30 m (so the previous area's models, at the same coordinates, are not kept). Inside the hall the open share is 0.2%, agreement with the game's depth 99.98%; Kokiri Forest is unchanged. RX_VK_RT_REMEMBER=0 turns it off. The gate fix of the last push stays as the safety net.
  • A transform feedback capture that cannot run (on the first visit to an area its program is not in the program cache yet, as with the Market's particles) is now counted among the cascades' left-out draws, with the reason, and retried every 180 frames.
  • docs/ray-tracing.md: both, and the coverage sweep: over 17 areas in the native mode no sun cascade draw is left out after the first visit, and the structure agrees with the game's depth on 88% to 99.9% of the screen.

Checks: as before (main's failures plus the two that fail under load here); the renderer builds with 0 failures.

Pushed da83010: interiors keep their roofs in the structure, and the caster count is honest on a first visit. - Indoors no sun cascade draws the walls and roof, and the camera's pass draws them only while in view, so the Temple of Time's vault left the structure whenever the camera looked level: 40% of the picture was open to the sun. A static model the camera's pass has drawn at one place for eight frames now stays in the top level as a caster on the frames it is not drawn. It is let go when its memory is rewritten, its bottom level is freed, a loading screen passes or the camera jumps 30 m (so the previous area's models, at the same coordinates, are not kept). Inside the hall the open share is 0.2%, agreement with the game's depth 99.98%; Kokiri Forest is unchanged. `RX_VK_RT_REMEMBER=0` turns it off. The gate fix of the last push stays as the safety net. - A transform feedback capture that cannot run (on the first visit to an area its program is not in the program cache yet, as with the Market's particles) is now counted among the cascades' left-out draws, with the reason, and retried every 180 frames. - docs/ray-tracing.md: both, and the coverage sweep: over 17 areas in the native mode no sun cascade draw is left out after the first visit, and the structure agrees with the game's depth on 88% to 99.9% of the screen. Checks: as before (main's failures plus the two that fail under load here); the renderer builds with 0 failures.
program_cache_save hands each translated program's SPIR-V to rt::scene_program_translated, which keeps the vertex
stages of the programs transform feedback would capture (at most 512) and makes the capturing module at the program's
first capture. Programs loaded from the cache file still go through the background scan. Lost Woods with
RX_VK_NO_PROGRAM_CACHE=1: 4 of 4 capturing stages made from memory, no cascade draw left out.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
test(vk): program cache fixtures stub rt::on and rt::scene_program_translated, which program_cache_save now calls
All checks were successful
PR description / Description follows the template (pull_request_target) Successful in 5s
2a46f56f52
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Author
First-time contributor

Pushed dd2361b and 1d7f2ce: the particles cast on an area's first visit.

  • The transform feedback capture's vertex stage was made only from the program cache file, so on an area's first visit (the Market's particles) it waited until the cache had saved the program. program_cache_save now hands each translated program's SPIR-V to rt::scene_program_translated, which keeps the vertex stages of the programs that would be captured (at most 512) and makes the capturing module at the first capture. Lost Woods with RX_VK_NO_PROGRAM_CACHE=1 (every program translated in the run): 4 of 4 stages made from memory, no cascade draw left out.
  • The program cache checks' fixtures stub the two new calls.

Known open, being worked on: static-map shadows whose casters are out of the camera's view (a mound by Link's house in Kokiri, a cliff over Kakariko's terraces) are lost with the traced shadow in the static map's place; the fix is capturing the static shadow map's casters into the structure.

Checks: as before (main's failures plus the two that fail under load here); the renderer builds with 0 failures.

Pushed dd2361b and 1d7f2ce: the particles cast on an area's first visit. - The transform feedback capture's vertex stage was made only from the program cache file, so on an area's first visit (the Market's particles) it waited until the cache had saved the program. `program_cache_save` now hands each translated program's SPIR-V to `rt::scene_program_translated`, which keeps the vertex stages of the programs that would be captured (at most 512) and makes the capturing module at the first capture. Lost Woods with `RX_VK_NO_PROGRAM_CACHE=1` (every program translated in the run): 4 of 4 stages made from memory, no cascade draw left out. - The program cache checks' fixtures stub the two new calls. Known open, being worked on: static-map shadows whose casters are out of the camera's view (a mound by Link's house in Kokiri, a cliff over Kakariko's terraces) are lost with the traced shadow in the static map's place; the fix is capturing the static shadow map's casters into the structure. Checks: as before (main's failures plus the two that fail under load here); the renderer builds with 0 failures.
Author
First-time contributor

Screenshots, same spot and frame, the feature off (left) and on (right), 4K on an RTX 5090, one part on at a time, from the parts' development builds (this PR's code; the sun shadow ones also carry the static shadow map's casters, still in testing). AO and reflections follow.

Sun shadows (RX_VK_RT=2 against 0): each clover leaf, grass blade and fence slat casts its own cut shadow where the game's maps give soft patches.

Sun shadows, Kakariko's gate: off left, on right

Sun shadows, Kakariko's fence: off left, on right

GI (RX_VK_RT=4 against 0): light bounced from lamps, doorways and lava into what the game leaves near black.

GI, a Kakariko house: off left, on right

GI, Link's house: off left, on right

GI, Dodongo's Cavern: off left, on right

Screenshots, same spot and frame, the feature off (left) and on (right), 4K on an RTX 5090, one part on at a time, from the parts' development builds (this PR's code; the sun shadow ones also carry the static shadow map's casters, still in testing). AO and reflections follow. **Sun shadows** (`RX_VK_RT=2` against 0): each clover leaf, grass blade and fence slat casts its own cut shadow where the game's maps give soft patches. ![Sun shadows, Kakariko's gate: off left, on right](https://git.magicbean.dev/attachments/df1860c1-0485-4337-8d43-0f0632241b11) ![Sun shadows, Kakariko's fence: off left, on right](https://git.magicbean.dev/attachments/9376dd86-34d3-417c-89cf-dc850181d063) **GI** (`RX_VK_RT=4` against 0): light bounced from lamps, doorways and lava into what the game leaves near black. ![GI, a Kakariko house: off left, on right](https://git.magicbean.dev/attachments/4d697f53-ecab-4dfa-81ed-4fed83a7e2a4) ![GI, Link's house: off left, on right](https://git.magicbean.dev/attachments/5ef7dee5-51b7-4f95-80a7-4af325efccf3) ![GI, Dodongo's Cavern: off left, on right](https://git.magicbean.dev/attachments/fbbc8221-5675-47c9-bb21-57b42a412ea4)
HumanBean force-pushed feat/ray-tracing from 2a46f56f52
All checks were successful
PR description / Description follows the template (pull_request_target) Successful in 5s
to f8ddebbc6e
Some checks failed
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been skipped
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been skipped
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been skipped
Third-party parts / The same as upstream (pull_request) Has been skipped
Website / Website on Cloudflare (pull_request) Has been skipped
CI / Conventional Commit title (pull_request) Successful in 3s
CI / Workflow lint (actionlint) (pull_request) Successful in 5s
Guide screenshots / Guide images and local UI source review (pull_request) Failing after 4s
Third-party parts / As their notes say (pull_request) Successful in 8s
Website / Website on Cloudflare (pull_request_target) Has been skipped
PR description / Description follows the template (pull_request_target) Successful in 4s
2026-11-15 18:45:06 +00:00
Compare
Owner

Rebased onto main @ bbe6fdf2. No tests were run here; the test boxes stay yours. No conflicts.

Rebased onto `main` @ bbe6fdf2. No tests were run here; the test boxes stay yours. No conflicts.
Author
First-time contributor

Pushed 1cef082, aae9b5e, 4c8b00d and 3add916 on top of HumanBean's rebase (thanks). Update from an in-game test session:

  • Sun shadows on plants a few metres off. The sun ray's start offset grows with view depth; at the old settings it was 3 to 12 cm at 10 m, more than the gaps between a fern's leaves, so plants past a few metres lost their own shadows. RX_VK_RT_SHADOW_BIAS and RX_VK_RT_SHADOW_SLOPE now default to 1 and 1 (were 2 and 3). Kokiri spawn, one frame, texels the game shadows but the rays lit, 6 to 20 m: 4.0 % before, 1.1 % after; 20 to 60 m: 5.3 % to 1.6 %. No acne on Kakariko's walls, steps and rocks or on Kokiri's ground.
  • Reflections: no screen-space hits. A reflection hit is now lit from the acceleration structure alone, so nothing that exists only on screen (Navi's glow, particles) shows up in water, and a hit no longer changes as it leaves the screen. RX_VK_RT_REFL_SCREEN=1 brings the screen-space hits back for comparison.
  • New Graphics row: Reflections: max roughness (Low, Medium, High, Max), under the Ray tracing rows. It sets how rough a surface may be and still reflect the scene; Medium is the previous default, and it applies without a restart.

After the rebase onto main, the checks show 18 failures on this PC, all of which fail on main as well, test_vk_occlusion_queries among them (its wiring check looks for the recording-end barrier in maybe_split, which moved to split_part). test_linux_pressure, new on main, needed this PR's ray tracing stubs (3add916).

Two corrections to earlier comments: the commit that stubbed the program cache fixtures is 2a46f56 (f8ddebb after the rebase), not 1d7f2ce; and for Lake Hylia only the sun's elevation was checked, not its full direction.

Pushed 1cef082, aae9b5e, 4c8b00d and 3add916 on top of HumanBean's rebase (thanks). Update from an in-game test session: - **Sun shadows on plants a few metres off.** The sun ray's start offset grows with view depth; at the old settings it was 3 to 12 cm at 10 m, more than the gaps between a fern's leaves, so plants past a few metres lost their own shadows. `RX_VK_RT_SHADOW_BIAS` and `RX_VK_RT_SHADOW_SLOPE` now default to 1 and 1 (were 2 and 3). Kokiri spawn, one frame, texels the game shadows but the rays lit, 6 to 20 m: 4.0 % before, 1.1 % after; 20 to 60 m: 5.3 % to 1.6 %. No acne on Kakariko's walls, steps and rocks or on Kokiri's ground. - **Reflections: no screen-space hits.** A reflection hit is now lit from the acceleration structure alone, so nothing that exists only on screen (Navi's glow, particles) shows up in water, and a hit no longer changes as it leaves the screen. `RX_VK_RT_REFL_SCREEN=1` brings the screen-space hits back for comparison. - **New Graphics row: Reflections: max roughness** (Low, Medium, High, Max), under the Ray tracing rows. It sets how rough a surface may be and still reflect the scene; Medium is the previous default, and it applies without a restart. After the rebase onto main, the checks show 18 failures on this PC, all of which fail on main as well, `test_vk_occlusion_queries` among them (its wiring check looks for the recording-end barrier in `maybe_split`, which moved to `split_part`). `test_linux_pressure`, new on main, needed this PR's ray tracing stubs (3add916). Two corrections to earlier comments: the commit that stubbed the program cache fixtures is 2a46f56 (f8ddebb after the rebase), not 1d7f2ce; and for Lake Hylia only the sun's elevation was checked, not its full direction.
The start offset grows with the view depth; at 2 and 3 it was 3-12 cm at 10 m, more than the gaps between a fern's leaves, so plants past a few metres lost their own shadows. Kokiri spawn, one frame, lost / added shadow against the game 6-20 m: 4.0 / 2.9 % -> 1.1 / 4.4 %; 20-60 m: 5.3 / 8.3 -> 1.6 / 9.5 %. No acne on Kakariko's walls, steps and rocks or Kokiri's ground.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Screen-space hits (a hit's colour from the frame before's picture, and the depth march) are off unless RX_VK_RT_REFL_SCREEN=1: every hit is lit from the structure alone, so nothing that exists only on screen (Navi's glow, particles) shows in a reflection, and a hit no longer changes as it leaves the screen. The picture still sets the light level of a hit lit flat.

The Graphics tab gains Reflections: max roughness under the Ray tracing rows (Low, Medium, High, Max: ordinary surfaces 0.2 / 0.35 / 0.5 / 1, metal and glass 0.45 / 0.65 / 0.8 / 1), applied at once; Medium is the old default.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
test(vk): the Linux memory pressure fixture stubs the ray tracing hooks the program cache calls
Some checks failed
PR description / Description follows the template (pull_request_target) Successful in 4s
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
Guide screenshots / Guide images and local UI source review (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
3add916dfd
Co-Authored-By: Claude Opus 5.5 <[email protected]>
fix(vk): rt gi: a hit within 15 cm of its ray's start counts for nothing (RX_VK_RT_GI_SELF), so Link's hair is no longer lit orange in specks
Some checks failed
PR description / Description follows the template (pull_request_target) Successful in 5s
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
Guide screenshots / Guide images and local UI source review (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
a1a6cbcace
The rays of a clump (hair cards, a fern's fronds) end on the clump a few centimetres off and brought back its own sunlit colour; over a dimmer region that drove the hair's ambient scale towards its cap in specks, worst close to the camera. Such a hit now counts for neither light nor cover, fading in by twice the distance, so a clump keeps the game's ambient and a corner's bounce past 15 cm stays. Kokiri spawn: GI's overall lift +1.5 luma levels instead of +2.2.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
feat(vk): rt AO deepened in creases and corners (RX_VK_RT_AO_CONTACT 1.5), the depth march weighs 0.3, no foliage in the AO's rays; the sun gate opens again where the game and the rays agree on next to no sunlight
Some checks failed
PR description / Description follows the template (pull_request_target) Successful in 5s
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
Guide screenshots / Guide images and local UI source review (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
e9518463f5
The written AO takes o + 1.5 o^2 of the traced occlusion: a crease or the floor under a table read 0.49 traced where the game's SSAO has 0.30-0.38, while open walls and lightly covered ground already matched, and strength or radius darkened those too. With the march at 0.3 and the foliage out of the AO's rays (the grass came out twice as dark as the SSAO), a Kakariko house where the SSAO is under 0.5 / 0.5-0.8 / over 0.95 reads 0.27 / 0.56 / 0.98 (SSAO 0.34 / 0.68 / 0.99; before 0.49 / 0.70 / 0.98).

The sun gate opens again where the game and the rays agree on next to no sunlight (under 5 % sunlit in the game's picture, the traced within 5 % of it): a gate that closed on the way into the Temple of Time, before its vault was in the structure, no longer stays closed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Author
First-time contributor

Pushed a1a6cbc and e951846, more from the same in-game test:

  • GI: hair no longer lit orange in specks. GI rays starting on Link's hair cards ended on the next card a few centimetres away and brought back the hair's own sunlit colour; against a dimmer region that pushed the hair's ambient scale toward its cap, in specks, worst close to the camera. A GI hit within 15 cm of its ray's start (fading in by 30 cm) now counts for neither light nor cover (RX_VK_RT_GI_SELF), so a clump keeps the game's ambient and a corner's bounce past 15 cm stays. GI's overall lift at the Kokiri spawn is +1.5 luma levels instead of +2.2.
  • AO deepened in creases and corners. The written AO takes o + 1.5 o^2 of the traced occlusion (RX_VK_RT_AO_CONTACT), the depth march's hit weighs 0.3, and the AO's rays leave the foliage out. Where the game's SSAO is under 0.5 in a Kakariko house, the traced AO now reads 0.27 (SSAO 0.34, before 0.49); open walls and lightly covered ground stay as they were.
  • Sun gate. It opens again where the game and the rays agree on next to no sunlight, so a gate that closed on the way into the Temple of Time (before its vault was in the structure) no longer stays closed.

Checks: 18 failures on this PC, the same set as main.

Pushed a1a6cbc and e951846, more from the same in-game test: - **GI: hair no longer lit orange in specks.** GI rays starting on Link's hair cards ended on the next card a few centimetres away and brought back the hair's own sunlit colour; against a dimmer region that pushed the hair's ambient scale toward its cap, in specks, worst close to the camera. A GI hit within 15 cm of its ray's start (fading in by 30 cm) now counts for neither light nor cover (`RX_VK_RT_GI_SELF`), so a clump keeps the game's ambient and a corner's bounce past 15 cm stays. GI's overall lift at the Kokiri spawn is +1.5 luma levels instead of +2.2. - **AO deepened in creases and corners.** The written AO takes `o + 1.5 o^2` of the traced occlusion (`RX_VK_RT_AO_CONTACT`), the depth march's hit weighs 0.3, and the AO's rays leave the foliage out. Where the game's SSAO is under 0.5 in a Kakariko house, the traced AO now reads 0.27 (SSAO 0.34, before 0.49); open walls and lightly covered ground stay as they were. - **Sun gate.** It opens again where the game and the rays agree on next to no sunlight, so a gate that closed on the way into the Temple of Time (before its vault was in the structure) no longer stays closed. Checks: 18 failures on this PC, the same set as main.
Author
First-time contributor

AO and reflection screenshots, same spot and frame, the feature off (left) and on (right), 4K on an RTX 5090, cropped at 2x, from the parts' development builds (this PR's code: AO with the contact term of e951846, reflections with no screen-space hits and the max roughness row at Medium).

AO (RX_VK_RT=9, AO and reflections, the AO switched off and on in the same frame): under the bedside table, behind its legs and where the bed meets the floor, the traced AO shades what the game's SSAO leaves light.

AO, a Kakariko house: off left, on right

The occlusion buffers of one frame (not the final picture), the game's SSAO left and the traced AO right: the game's is grainy, haloed round the table and fades out with distance; the traced one is clean and holds at any distance.

AO buffers, a Kakariko house: the game's SSAO left, traced right

AO buffers, the Temple of Time's door: the game's SSAO left, traced right

Reflections (RX_VK_RT=9, the reflections switched off and on in the same frame): water takes what is really around it instead of the game's fixed environment picture.

Reflections, Gerudo Valley's stream: off left, on right

Reflections, Zora's River in shade: off left, on right

AO and reflection screenshots, same spot and frame, the feature off (left) and on (right), 4K on an RTX 5090, cropped at 2x, from the parts' development builds (this PR's code: AO with the contact term of e951846, reflections with no screen-space hits and the max roughness row at Medium). **AO** (`RX_VK_RT=9`, AO and reflections, the AO switched off and on in the same frame): under the bedside table, behind its legs and where the bed meets the floor, the traced AO shades what the game's SSAO leaves light. ![AO, a Kakariko house: off left, on right](https://git.magicbean.dev/attachments/fa9a855b-dfe9-434f-a13e-c78bdfcdee0b) The occlusion buffers of one frame (not the final picture), the game's SSAO left and the traced AO right: the game's is grainy, haloed round the table and fades out with distance; the traced one is clean and holds at any distance. ![AO buffers, a Kakariko house: the game's SSAO left, traced right](https://git.magicbean.dev/attachments/cf6c1328-d0ed-4c56-b021-6305d11f0f6f) ![AO buffers, the Temple of Time's door: the game's SSAO left, traced right](https://git.magicbean.dev/attachments/f7decdee-aa67-44ff-81ba-0b690b40097d) **Reflections** (`RX_VK_RT=9`, the reflections switched off and on in the same frame): water takes what is really around it instead of the game's fixed environment picture. ![Reflections, Gerudo Valley's stream: off left, on right](https://git.magicbean.dev/attachments/d439e774-d466-4c42-9f89-9aac26a6f4f7) ![Reflections, Zora's River in shade: off left, on right](https://git.magicbean.dev/attachments/68026231-d79d-4744-a7a9-875591b2ce06)
The game draws its 12288 x 12288 static shadow map (D16) once, while an area loads: some 2000 to 3600 depth-only
draws in a frame or two, with no scene yet, so the cascades' rule ("no scene this frame: a cascade of nothing we
trace") left them all out, and what the camera never shows and no cascade reaches was in no top level (the mound's
shade by Link's house, the cliff's across Kakariko's terraces: mask's lost shadow). They are now noted as the
cascades' draws are (models by their object block, the height-field patches) and kept in a set of the area's own,
placed every frame as kBlocker / kCaster like a cascade's draw, a caster once by its geometry and place. The set
is let go when the map is drawn again after a pause (another area). Their mesh draws (24 to 56 a batch) are not
captured. RX_VK_RT_STATIC_MAP=0: not taken. The status line says the batch: its draws, the casters kept.
Kakariko: 1966 draws, 1830 casters kept (109 terrain patches), none left out but 24 mesh draws. Kokiri: 3629
draws, 3560 kept. Kokiri spawn: agreement with the game's depth unchanged (89.4 %), 4561 instances a frame
(1197 without), 116 MB of bottom levels (43).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The map's 24 to 56 task/mesh draws a batch (trunks, rocks: solid, no leaf cards among them) were not taken. They
come once, in a loading frame where no top level is built and their count is not known to the CPU, so they
cannot use the frame's arena: after the fallback's stages ran for the capture (as a native mesh draw's do),
rt_scene_mesh.comp reserves the draw's room in a pool that lasts the area (192 MB, RX_VK_RT_STATIC_MESH_MB) and
writes its triangles there, by the map's own camera; rt_scene_omm.comp its opacity states, a card's. The place
and the triangles taken go to the draw's count slot; scene_tlas builds the bottom level once that is read back
and keeps its instance (0x80; cards 0x88) every frame. Let go with the area's other static casters when the map
is drawn again. RX_VK_RT_STATIC_MESH=0: not taken. The batch's status line counts them.
Kokiri: 56 asked, 56 captured, 56 built, 231665 triangles; Kakariko: 24, 24, 22 built (two empty), 46378.
Agreement with the game's depth unchanged at both.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A skinned draw's object is found by the mean of its bones' positions, not by the order of the draws, so an object the game
culls no longer hands its bottom level to the next. An object drawn on 8 frames or more keeps its last pose in the top level
while the camera does not draw it; let go of when its place is in view within 40 m and the game has not drawn it for 3
frames, when another object of its geometry drawn this frame stands within 0.5 m, on a loading gap or a 30 m camera jump.
The same object drawn again by another pass (within 25 cm) is placed once. RX_VK_RT_REMEMBER_SKINNED=0: off.

The camera's static models are remembered also when a cascade placed the same model at that place first (the cascades draw
before the camera's pass, so many were never remembered).

A logged frame (RX_VK_RT_SCENE_LOG, debug file "log") lists every placed instance, the remembered models and the skinned
objects.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
rt::scene_materials has two blocks of 4096 records: record 4096 + slot is the material's emission (rgb linear, in the
albedo's scale; a 1 when known to glow), zero until written. The game has no emissive texture: its glow (read from the
translated fragment stages of c012b5595725b5f1, 9357fdc112e91bf3, 700c26a16fa2a79d) is a light inside the object added
last, E = c5[106] * M * G * C: C = c5[4j+32..34] (j = c5[78]); G = falloff * c5[75] / clamp(c5[72], .01, 1)^2, the falloff
the mean over the geometry's vertices of min(1, (c5[72] / d)^2), d to the glow's point c5[56..58], N.L a half; M the red
channel of material texture k = c5[79] (0-5 at c2+0x20 + 8k, 6 at 0x68; none where that is a screen buffer). The family:
constant buffer 5 indexed at run time (used size 65536). shaders/rt_scene_emission.comp writes the mask's mean times the
colour, again on a 10 % change (flicker), every 8 frames at most. Each glowing geometry has its own slot. RX_VK_RT_EMISSION=0
off, RX_VK_RT_EMISSION_GAIN scales. Debug view tlase.

A geometry at a place is placed once also within 2 cm (rotation to 1/256, 27 cells): a cascade's copy and the camera's no
longer both stand when their 1 mm rounding fell apart. RX_VK_RT_NEAR_DEDUPE=0: off.
Checked by the mask part with and without the 2 cm dedupe: one-frame lost shadow at the Kokiri spawn 1.8 / 1.8 %,
Kakariko gate 1.5 / 1.4 %; the characters' own shadow reproduced 96 / 94 % with it, 91 / 87 % without.
shaders/rt_scene_build.sh makes rt_scene_emission's header too. docs/ray-tracing.md: the emission block, the 2 cm
dedupe, their switches, the tlase view.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
feat(vk): rt reflections: a hit's own light from the scene's emission block, and hits right by the ray's start fade
Some checks failed
PR description / Description follows the template (pull_request_target) Successful in 5s
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
Guide screenshots / Guide images and local UI source review (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
6f19017d7c
A hit lit flat now adds its material's emission where the scene's second material block has one (RX_VK_RT_REFL_GLOW, 1), so the Kokiri door lanterns reflect in the stream the same on screen and off. At 4x the lanterns' flicker breaks into orange specks on the ripples, so 1 stays. A top level's hit within 0.1 m plus 0.004 m a metre of distance of the ray's start fades to the game's lookup (RX_VK_RT_REFL_NEAR, RX_VK_RT_REFL_NEAR_FAR): a grazing ray's own floor rims and seams, lit flat, would draw streaks.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Author
First-time contributor

Pushed 655adcf, 068650c, 5df3d0f, f51b339, 4ebfcbc and 6f19017:

  • The static sun shadow map's casters stay in the structure for the area. The game draws its 12288 static shadow map once when an area loads; its draws (including the mesh-shader plants, 068650c) are now captured then and kept, so what casts the game's far, static shadows also casts the traced one, wherever the camera looks. Switches: RX_VK_RT_STATIC_MAP, RX_VK_RT_STATIC_MESH, RX_VK_RT_STATIC_MESH_MB.
  • Skinned objects stay in the structure out of view (the tree house's red lights, signs, characters), in their last drawn pose (RX_VK_RT_REMEMBER_SKINNED), so they keep casting and reflecting after the camera turns away. With the static models already kept (the Know-It-All brothers' door lanterns are static cutout models), this answers the in-game report that the lanterns vanished from the river's reflection as they left the screen.
  • Emission (4ebfcbc, 6f19017). The game has no emissive texture: its lanterns glow through a light inside the object (c5[106] times a mask texture's red channel and a falloff). The scene now keeps that as a second block of material records, per geometry, and a reflection hit adds it, so the Kokiri door lanterns reflect in the stream the same whether they are on screen or not (RX_VK_RT_EMISSION_GAIN and RX_VK_RT_REFL_GLOW, both 1; at 4 the lanterns' flicker breaks into orange specks on the ripples). Placements of one geometry within 2 cm are placed once (RX_VK_RT_NEAR_DEDUPE=0 turns it off): the duplicate instances at three test spots go from 83 / 116 / 130 to 44 / 73 / 81, with the one-frame lost sun shadow unchanged (Kokiri spawn 1.8 % either way, Kakariko gate 1.5 / 1.4 %).
  • A reflection hit right by its ray's start (0.1 m, plus 0.004 m a metre of distance) fades to the game's lookup, so a grazing ray doesn't draw a floor's own rims and seams.
  • 068650c also adds gpu/vk/shaders/rt_scene_build.sh, which regenerates every rt_scene SPIR-V header (byte for byte the committed ones), and gives the static pool its own push fields.

The static map's casters and the out-of-view skinned objects, on the parts' development branch, ran once under GPU-assisted validation on this PC: no out-of-bounds, invalid-address or device-lost report.

Pushed 655adcf, 068650c, 5df3d0f, f51b339, 4ebfcbc and 6f19017: - **The static sun shadow map's casters stay in the structure for the area.** The game draws its 12288 static shadow map once when an area loads; its draws (including the mesh-shader plants, `068650c`) are now captured then and kept, so what casts the game's far, static shadows also casts the traced one, wherever the camera looks. Switches: `RX_VK_RT_STATIC_MAP`, `RX_VK_RT_STATIC_MESH`, `RX_VK_RT_STATIC_MESH_MB`. - **Skinned objects stay in the structure out of view** (the tree house's red lights, signs, characters), in their last drawn pose (`RX_VK_RT_REMEMBER_SKINNED`), so they keep casting and reflecting after the camera turns away. With the static models already kept (the Know-It-All brothers' door lanterns are static cutout models), this answers the in-game report that the lanterns vanished from the river's reflection as they left the screen. - **Emission** (`4ebfcbc`, `6f19017`). The game has no emissive texture: its lanterns glow through a light inside the object (`c5[106]` times a mask texture's red channel and a falloff). The scene now keeps that as a second block of material records, per geometry, and a reflection hit adds it, so the Kokiri door lanterns reflect in the stream the same whether they are on screen or not (`RX_VK_RT_EMISSION_GAIN` and `RX_VK_RT_REFL_GLOW`, both 1; at 4 the lanterns' flicker breaks into orange specks on the ripples). Placements of one geometry within 2 cm are placed once (`RX_VK_RT_NEAR_DEDUPE=0` turns it off): the duplicate instances at three test spots go from 83 / 116 / 130 to 44 / 73 / 81, with the one-frame lost sun shadow unchanged (Kokiri spawn 1.8 % either way, Kakariko gate 1.5 / 1.4 %). - A reflection hit right by its ray's start (0.1 m, plus 0.004 m a metre of distance) fades to the game's lookup, so a grazing ray doesn't draw a floor's own rims and seams. - `068650c` also adds `gpu/vk/shaders/rt_scene_build.sh`, which regenerates every `rt_scene` SPIR-V header (byte for byte the committed ones), and gives the static pool its own push fields. The static map's casters and the out-of-view skinned objects, on the parts' development branch, ran once under GPU-assisted validation on this PC: no out-of-bounds, invalid-address or device-lost report.
perf(vk): rt reflections: the material-F0 class widens only at High and Max, so cloth stops tracing at Medium
Some checks failed
PR description / Description follows the template (pull_request_target) Successful in 4s
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
Guide screenshots / Guide images and local UI source review (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
5821699f56
The class of programs with a material F0 is armour and glass but also cloth (banners, bunting, tunics), which traced up to roughness 0.65 with 2 rays for nothing visible. At Low and Medium its cutoff is now the others' (0.2, 0.35); High widens it to 0.65, Max to 1. Market gate, the GPU pass time a frame: off 2.99 ms, the old Medium 6.28, the new 4.78 (a second run 6.30 / 4.79); no local difference in the picture.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Author
First-time contributor

Pushed 5821699: the reflections' material-F0 class (armour and glass, but also cloth: banners, bunting, tunics) no longer traces up to roughness 0.65 with 2 rays at Medium. At Low and Medium its cutoff is now the same as everything else's (0.2, 0.35); High widens it to 0.65 and Max to 1, so rough metal still reflects there. At the Market gate the GPU pass time goes from 6.28 ms a frame to 4.78 (off: 2.99; a second run 6.30 / 4.79), with no local difference in the picture.

Pushed 5821699: the reflections' material-`F0` class (armour and glass, but also cloth: banners, bunting, tunics) no longer traces up to roughness 0.65 with 2 rays at Medium. At Low and Medium its cutoff is now the same as everything else's (0.2, 0.35); High widens it to 0.65 and Max to 1, so rough metal still reflects there. At the Market gate the GPU pass time goes from 6.28 ms a frame to 4.78 (off: 2.99; a second run 6.30 / 4.79), with no local difference in the picture.
feat(vk): rt sun: the traced shadow takes the game's place at every distance (RX_VK_RT_SUN_FADE 0)
Some checks failed
PR description / Description follows the template (pull_request_target) Successful in 4s
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
Guide screenshots / Guide images and local UI source review (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
500a01a912
The traced sun shadow handed back to the game's own value from 60 to 120 m of view depth. With the user's rule that it replaces the game's everywhere in view, it no longer does. Of the texels past 60 m, the share the rays shadow and the game lights: Lake Hylia 43 % (far cliffs under the fog: the final picture looks the same), Kokiri 13 %, Kakariko 6 %, the castle gate's field 5 %, Gerudo Valley 1 %; no stray caster, and the castle, hedges and canyon walls agree with the game. RX_VK_RT_SUN_FADE=60 brings the handover back.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Author
First-time contributor

Pushed 500a01a: the traced sun shadow now takes the game's place at every distance. It used to hand back to the game's own value from 60 to 120 m of view depth (RX_VK_RT_SUN_FADE, now 0 by default; 60 brings the handover back). Past the game's own shadow, which ends near 120 m, the rays shadow far cliffs the game shows lit; under the fog this doesn't show in the final picture. Of the texels past 60 m, the share the rays shadow and the game lights: Lake Hylia 43 %, Kokiri 13 %, Kakariko 6 %, the castle gate's field 5 %, Gerudo Valley 1 %. No stray caster was found: the castle, hedges and canyon walls agree with the game.

Pushed 500a01a: the traced sun shadow now takes the game's place at every distance. It used to hand back to the game's own value from 60 to 120 m of view depth (`RX_VK_RT_SUN_FADE`, now 0 by default; 60 brings the handover back). Past the game's own shadow, which ends near 120 m, the rays shadow far cliffs the game shows lit; under the fog this doesn't show in the final picture. Of the texels past 60 m, the share the rays shadow and the game lights: Lake Hylia 43 %, Kokiri 13 %, Kakariko 6 %, the castle gate's field 5 %, Gerudo Valley 1 %. No stray caster was found: the castle, hedges and canyon walls agree with the game.
The 2 cm dedupe keys the rotation to 1/256, so a card the wind turns (program f2999864d78ae1d3, a 6-index quad) stood twice:
as the static shadow map captured it while the area loaded and as drawn now, 0.002 to 0.024 apart. An instance not drawn
this frame now also checks the frame's placements of its geometry in the 27 cells round it, regardless of the key, and
is left out when every rotation term is within 0.05 (crossed cards of one geometry stay apart). The frame's own draws
come first. RX_VK_RT_NEAR_DEDUPE=0 turns both off.

A logged frame's "rt scene placed:" lines also give the geometry's hash, vertex and index buffers, base vertex and
rotation.
Kokiri spawn, one logged frame: duplicates within 2 cm of the same program and index count 47 -> 35 a frame; same
geometry 30 -> 0 (the rest are other geometries of equal index count: a model's parts, the lanterns' cards).
Agreement with the game's depth 89.1 % (89.2 to 89.6 % in the runs before: within the run-to-run spread).
docs/ray-tracing.md: the dedupe's paragraph.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Mask's run (PR 727 renderer, RX_VK_RT=15, Kokiri, teleport 3) lost the device in the Market's first frame, past the last
checkpoint (a draw), in the unmarked scene and ray-tracing work. Kokiri's static shadow map casters (3560) were still kept
there: their set goes only when the next static map is drawn, and the Market's had not come. Each frame a kept note whose
vertex or index stream was written since its bottom level was built was built again from the note's addresses, which now
held the Market's data: its words read as indices with Kokiri's count and vertex bound, past the vertices (undefined in an
acceleration structure build; a fault). The clean run's teleport to Kakariko had about 19 statics left by then.

A static shadow map's caster or a carried draw (not drawn this frame) now carries the memory generation and frame it was
noted in. When its streams were written since: noted before the camera's last scene ahead of a loading screen, it is let go
(a static one erased); noted since (the area's own, streaming in), its indices are read on the CPU first and it is let go when
one reaches past its vertices or they do not read, otherwise built again as before and not read again until written again.
The log names the first 8 and counts them a frame (the first 20 frames).

Not yet run: the diagnostic run (solo, GPU-assisted validation, mask's recipe) waits for the lead.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
fix(vk-rt): transform feedback capture of particles off by default (RX_VK_RT_XFB=1 turns it on) until the Market's device lost is understood
Some checks failed
PR description / Description follows the template (pull_request_target) Successful in 17s
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
Guide screenshots / Guide images and local UI source review (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
1173c39426
A normal run of scene-port (Kokiri, teleport to Kakariko, teleport to the Market) lost the device in the Market about 20
frames into play, in the frame of the run's first transform feedback capture: two sun-cascade particle draws
(1c8ada05a80b2ca1, 7773a9a770c712f4, 30 indices, 1 and 2 instances), their capturing vertex stages made from the SPIR-V in
memory, translated in that run; the checkpoints stop right before the first of them (runs\prscene-1116-020703). The same
route with RX_VK_RT_XFB=0 ran clean through both teleports and 75 s in the Market (runs\prscene-1116-021244). The capture's
writes and reads are bounded as far as the code shows; the patched vertex stage is the suspect. The extension is not asked
for either while the switch is off. The Lost Woods' falling leaves are out of the structure meanwhile.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Author
First-time contributor

Pushed ba1c755, e512c96 and 1173c39. Two of these fix device losts found in testing tonight; the RT rows are off by default, so nothing changes for anyone who hasn't turned them on.

  • Device lost after an area change (e512c96). The static shadow map's casters, kept for the area since 655adcf, were rebuilt every frame from the guest memory they were captured from whenever that memory had been written since. After a teleport that memory holds the next area's data, so the bottom levels were built from another area's bytes as indices (past maxVertex): white blown-out ground, holes in a character, and on two runs a GPU page fault (VK_ERROR_DEVICE_LOST) at the next area's first frames. A kept note that wasn't drawn this frame is now never rebuilt from rewritten streams: one noted before the last loading screen is let go, and one of the current area has its indices checked on the CPU against its vertices first, and is let go if any reaches past them. Kokiri -> Kakariko -> Market in one run: 2844 and 122 stale casters let go at the arrivals, no corruption, no device lost.
  • Transform feedback capture off by default (1173c39). A further run lost the device at the Market at the first draws taken by transform feedback (cascade particle draws, their capturing vertex stage made from SPIR-V in memory). The same route with the capture off ran clean, so it is off by default until the cause is found (RX_VK_RT_XFB=1 turns it on for testing). Particles such as the Lost Woods' falling leaves are out of the structure meanwhile.
  • Duplicate placements (ba1c755). An instance kept from the static map or remembered from an earlier frame is not placed again where the same geometry is drawn this frame within 2 cm and 0.05 of rotation: the same-geometry duplicates at the Kokiri spawn go from 30 to 0 a frame, with the one-frame lost sun shadow unchanged (1.7 % at the Kokiri spawn, 1.4 % at the Kakariko gate).
Pushed ba1c755, e512c96 and 1173c39. Two of these fix device losts found in testing tonight; the RT rows are off by default, so nothing changes for anyone who hasn't turned them on. - **Device lost after an area change (e512c96).** The static shadow map's casters, kept for the area since 655adcf, were rebuilt every frame from the guest memory they were captured from whenever that memory had been written since. After a teleport that memory holds the next area's data, so the bottom levels were built from another area's bytes as indices (past `maxVertex`): white blown-out ground, holes in a character, and on two runs a GPU page fault (VK_ERROR_DEVICE_LOST) at the next area's first frames. A kept note that wasn't drawn this frame is now never rebuilt from rewritten streams: one noted before the last loading screen is let go, and one of the current area has its indices checked on the CPU against its vertices first, and is let go if any reaches past them. Kokiri -> Kakariko -> Market in one run: 2844 and 122 stale casters let go at the arrivals, no corruption, no device lost. - **Transform feedback capture off by default (1173c39).** A further run lost the device at the Market at the first draws taken by transform feedback (cascade particle draws, their capturing vertex stage made from SPIR-V in memory). The same route with the capture off ran clean, so it is off by default until the cause is found (`RX_VK_RT_XFB=1` turns it on for testing). Particles such as the Lost Woods' falling leaves are out of the structure meanwhile. - **Duplicate placements (ba1c755).** An instance kept from the static map or remembered from an earlier frame is not placed again where the same geometry is drawn this frame within 2 cm and 0.05 of rotation: the same-geometry duplicates at the Kokiri spawn go from 30 to 0 a frame, with the one-frame lost sun shadow unchanged (1.7 % at the Kokiri spawn, 1.4 % at the Kakariko gate).
The approach comes from PR 815 by JayDeGoodz; the code is our own. The game's SSAO (a generate and four blurs, compute, writing an R8 storage image half the scene's size before the combine: 171c34b219c9c1a5, de8569e5db7cab73, bf75a6300919b337 in Kokiri) is found by what it does, and its dispatches are left out (mask_ssao_stand_in) from the frame after the traced AO first went into its image. Before the combine draw (mask_before_draw) the AO alone runs its own trace / temporal / a-trous chain (parts[1]) and rt_ao_ssao.comp averages it down into that image, deepening deep occlusion (o + AO_CONTACT o^2) as rt_ao_apply.comp does in the mask, so the combine's upsample and blend take it as the game's. The sun part stays after the combine; AO_INTO_SSAO=0 brings back the write over the mask's r.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The approach comes from PR 815 by JayDeGoodz; the code is our own. The row's On becomes four steps (vk_menu.cpp tx_ao_quality; the INI key stays): Ultra is the look so far, AO_RAYS (2) at the scene's size; High halves the rays; Medium traces the early pass (the AO into the game's SSAO image) at half the scene's size each way, the image's own size; Low does both; Off leaves the game's own SSAO running. vk_rt_mask.cpp ao_quality_of reads opts.rt_ao every frame, so moving between the steps applies at once; Off and on stays a restart (rt::mode). RX_VK_RT_AO_QUALITY=<0-4> or AO_QUALITY in the tune file hold a step; with RX_VK_RT turning the AO on and the row at Off, Ultra. The AO shaders take the pass's size from size_frame and the depth texel under a pass texel from extra3.w (depth_texel; extra3.z stays the AO's contact term). README's option table and docs/ray-tracing.md (The AO in the game's SSAO image) say so.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The Ray-traced ambient occlusion row was Off / On, and its On (1) traced every pixel with all its rays: the Ultra step (4) now, where 1 is Low. With the key unchanged, everyone who had the AO on would have moved to Low without a word. menu_init now loads a file from before options_version 7 with its 1 as 4, and save() writes options_version 7, so the move happens once and a Low chosen later stays Low. Off stays Off.

tests/test_ao_steps_saved.py compiles menu_init's line and runs it for each version and step, then checks save()'s version and the row's names.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The scene builds bottom levels from the game's vertex and index buffers where they are, and a pool's mirror may be a
sparse buffer. Those were made with kUsage, without ACCELERATION_STRUCTURE_BUILD_INPUT_READ_ONLY, which GPU-assisted
validation reported on every such build. pool_usage() is kUsage plus that bit when the device traces with RX_VK_RT on
(rt::scene_buffer_usage), as the other pools and the dense mirrors already have; without RT nothing changes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
For the Market's device lost on the first transform feedback capture: the patched vertex stages are the suspect, and they
exist only in a running game (translated in that run, or read from the cache file by the background scan). With
RX_VK_RT_XFB=2 both paths patch as before, write xfb-<id>-in.spv and xfb-<id>-out.spv into RX_VK_RT_XFB_DUMP and stop
there: no module, no pipeline, no capture draw (the draw is dropped as when no stage is found). For spirv-val offline.
xfb_mode() reads the switch once for the note, the extension and both patch paths.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The cache scan asked a stage it had written for the test again 180 frames on, as one it could not find, so the dump and its log lines came back every few seconds. A stage written for the test now waits as long as one translated in the run (frame + 100000).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
rt_xfb_capture runs right after the game's indexed draw, inside draw()'s OccGuard, and scene_xfb_end ends the render pass to turn the captured positions into triangles (a fill, a compute dispatch, barriers). The game's occlusion query begun for that draw stayed active across vkCmdEndRendering and that work, and ~OccGuard ended it outside the pass it began in (VUID-vkCmdEndRendering-None-06999, VUID-vkCmdEndQuery-None-07007). OccGuard::end() now ends it right after the game's draw, counting that draw alone; with RX_VK_DRAW_STATS's own query running, the capture is left out (scene_xfb_drop).

xfb_note also leaves out a program with a tessellation or geometry stage: the Xfb execution mode belongs to the last stage before the rasterizer, and only the vertex stage is patched.

The capture stays off by default (RX_VK_RT_XFB=0) until a run proves the Market's device lost gone.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
test(vk): the AO's write into the game's SSAO image in the drawn page map's writers, and the roughness row's override read as values
Some checks failed
PR description / Description follows the template (pull_request_target) Successful in 4s
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
Guide screenshots / Guide images and local UI source review (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
d16c17e048
The AO into the SSAO image (2f3f348) notes the image's page map with a reason of its own; it needs no ParLock since the parallel replay is off while ray tracing runs. The Reflections: max roughness row checked RX_VK_RT_REFL_ROUGH and RX_VK_RT_REFL_METAL_ROUGH by getenv alone, which test_env_on reads as set-means-on switches; they are now read as values.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Author
First-time contributor

Pushed 2f3f348, 44d9788, 83b1760, 8d674ef, 6d6c25f, a96fd3e, 531f118 and d16c17e. AO first (2f3f348, 44d9788, 83b1760): the traced AO now goes into the game's own SSAO image, and the game's SSAO dispatches (a generate and four blurs) are left out, so their cost goes away and the game's combine upsamples and blends the traced AO as its own. The approach comes from #815 by JayDeGoodz (thanks); the code is our own. RX_VK_RT_AO_INTO_SSAO=0 brings back the previous write over the light mask's AO channel. The Ray-traced ambient occlusion row now has quality steps: Off, Low (half size, 1 ray), Medium (half size, 2 rays), High (full size, 1 ray), Ultra (full size, 2 rays, the previous On).

Measured at 1280x720 scene size on an RTX 5090 (one report each, so differences under ~0.1 ms are noise): Kokiri spawn, ms a frame in all, old path 12.82, Ultra 11.32, Low 11.28, AO off (the game's SSAO) 11.25; Kakariko's entrance, old path 10.43, Ultra 10.52, Low 10.38, off 10.36. The pictures match the old path apart from moving things. One run under GPU-assisted validation with four Kokiri -> Kakariko teleports: only the known messages, no device lost.

An options file saved with the previous Off/On row loads its On as Ultra once (options_version 7, 83b1760; tests/test_ao_steps_saved.py), so nobody's AO quietly drops to Low.

The rest:

  • 8d674ef: the sparse pool mirrors are made with pool_usage(), which adds ACCELERATION_STRUCTURE_BUILD_INPUT_READ_ONLY when ray tracing is supported (validation reported VUID 03673 for bottom levels built from them).
  • 531f118: a particle draw's occlusion query now ends before its transform feedback capture, which ends the pass and records compute work; before, the query ended outside the pass it began in (VUID-vkCmdEndRendering-None-06999). It is a real spec violation but not the whole cause: a validation run with the capture on still lost the device, and showed the capture's commands recorded from another thread into a command buffer that holds neither its pass nor its pipeline (a pending capture shared between the replay and recorder threads). The capture stays off by default while that is fixed.
  • 6d6c25f, a96fd3e: RX_VK_RT_XFB=2, a test mode that writes the capturing vertex stages' SPIR-V and never draws with them (the dumped stages pass spirv-val with the translator's layout options; the patch only adds the TransformFeedback capability, the Xfb mode and the position's Offset / XfbBuffer / XfbStride).
  • d16c17e: the AO's write into the SSAO image is listed in tests/test_drawn_page_map.py, and the roughness row's override switches are read as values (tests/test_env_on.py).
Pushed 2f3f348, 44d9788, 83b1760, 8d674ef, 6d6c25f, a96fd3e, 531f118 and d16c17e. AO first (2f3f348, 44d9788, 83b1760): the traced AO now goes into the game's own SSAO image, and the game's SSAO dispatches (a generate and four blurs) are left out, so their cost goes away and the game's combine upsamples and blends the traced AO as its own. The approach comes from https://git.magicbean.dev/MagicBeanDev/Longshot/pulls/815 by JayDeGoodz (thanks); the code is our own. `RX_VK_RT_AO_INTO_SSAO=0` brings back the previous write over the light mask's AO channel. The Ray-traced ambient occlusion row now has quality steps: Off, Low (half size, 1 ray), Medium (half size, 2 rays), High (full size, 1 ray), Ultra (full size, 2 rays, the previous On). Measured at 1280x720 scene size on an RTX 5090 (one report each, so differences under ~0.1 ms are noise): Kokiri spawn, ms a frame in all, old path 12.82, Ultra 11.32, Low 11.28, AO off (the game's SSAO) 11.25; Kakariko's entrance, old path 10.43, Ultra 10.52, Low 10.38, off 10.36. The pictures match the old path apart from moving things. One run under GPU-assisted validation with four Kokiri -> Kakariko teleports: only the known messages, no device lost. An options file saved with the previous Off/On row loads its On as Ultra once (`options_version` 7, 83b1760; `tests/test_ao_steps_saved.py`), so nobody's AO quietly drops to Low. The rest: - 8d674ef: the sparse pool mirrors are made with `pool_usage()`, which adds `ACCELERATION_STRUCTURE_BUILD_INPUT_READ_ONLY` when ray tracing is supported (validation reported VUID 03673 for bottom levels built from them). - 531f118: a particle draw's occlusion query now ends before its transform feedback capture, which ends the pass and records compute work; before, the query ended outside the pass it began in (VUID-vkCmdEndRendering-None-06999). It is a real spec violation but not the whole cause: a validation run with the capture on still lost the device, and showed the capture's commands recorded from another thread into a command buffer that holds neither its pass nor its pipeline (a pending capture shared between the replay and recorder threads). The capture stays off by default while that is fixed. - 6d6c25f, a96fd3e: `RX_VK_RT_XFB=2`, a test mode that writes the capturing vertex stages' SPIR-V and never draws with them (the dumped stages pass `spirv-val` with the translator's layout options; the patch only adds the TransformFeedback capability, the Xfb mode and the position's Offset / XfbBuffer / XfbStride). - d16c17e: the AO's write into the SSAO image is listed in `tests/test_drawn_page_map.py`, and the roughness row's override switches are read as values (`tests/test_env_on.py`).
The capture's vkCmdBindTransformFeedbackBuffersEXT, vkCmdBeginTransformFeedbackEXT and vkCmdEndTransformFeedbackEXT are called through pointers vk_rt_scene.cpp loads itself (RT_LOAD), not through vk_work.h. With RX_VK_RECORDER=thread (Threaded rendering: Auto) the pass's begin, the capture pipeline's bind and the draw were still packets in the recorder's ring, so these calls reached cmd first, outside the pass and with another pipeline bound, from the replay thread while the recorder thread used the same pool. A core-validation run (RX_VK_RT_XFB=1, Market, 11-16) showed VUID-vkCmdBeginTransformFeedbackEXT-None-04128, vkCmdBegin/EndTransformFeedbackEXT-renderpass, vkCmdBindPipeline-None-02323 and UNASSIGNED-Threading-MultipleThreads-Write before the device was lost. Each call now follows boundary(B_DIRECT), as the acceleration structure and micromap builds do; tests/test_recorder_sync.py checks them with as_build and mm_build.

The pending capture (xfb_note's, taken by scene_xfb_wanted, begun and ended around the draw's repeat) is now thread-local like xfb_wanted, so with RX_VK_PARALLEL's workers one worker's note is never begun by another's draw.

Capture stays off by default (RX_VK_RT_XFB=0) until a validation run shows it clean.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A batch of the static shadow map's draws after a pause of 30 frames let the whole set go as another area's. The game also draws the map again in part without leaving the area: the Market's 1572 casters were let go for 3, then 3, then 33 (37 kept), Kakariko's 1830 for 289 (164 kept), so most of the area's static shadows left the scene a few seconds after it loaded. Such a batch is another area's now only past a loading screen (gap_from after the batch before, as the teleport fix reads it); otherwise its casters join the set (static_keys keep each caster once) and its mesh draws are not captured again (their keys count draws, not geometry: they would be in the pool twice). Past 25000 casters the set starts again as before. A new area's batch also lets the pooled mesh draws go when the casters were all let go before it (their streams written).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
fix(vk-rt): the static shadow map's batch line says what a part drawn again added, not the area's first batch's mesh counts
Some checks failed
PR description / Description follows the template (pull_request_target) Successful in 15s
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
Guide screenshots / Guide images and local UI source review (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
9f05136e46
On a batch merged into the area's set (drawn again in part) the "last batch" line showed the mesh counters of the area's first batch (asked, captured), which a merged batch never touches. It now says so: the batch's draws, its mesh draws (not captured again) and the casters it added, then the area's built mesh draws and casters kept.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Author
First-time contributor

Pushed 9a818a6, 90228f4, de654af and 9f05136.

  • 90228f4: the static shadow map drawn again in part (the Market and Kakariko redraw a few to a few dozen of its draws now and then, with no loading screen) adds its casters to the area's set instead of replacing it; the same caster is kept once, and the part's mesh draws are not taken again. Only a map drawn after a loading screen replaces the set, and past 25000 casters it starts again. Over a stress run Kokiri -> Kakariko -> Market -> Kakariko -> Market (transform feedback off): the Market keeps 1572 to 1600 casters (37 before, after its 1572 -> 3 -> 3 -> 33 redraws), Kakariko 1830 to 2000 (164 before); each loading screen still lets the area before go. No device lost.
  • 9a818a6: the cause of the transform feedback capture's device lost. With threaded rendering (RX_VK_RECORDER=thread) every recorded call is a packet the recorder thread runs later, but the capture's bind, begin and end went through their extension pointers straight into the command buffer from the replay thread, ahead of the queued pass begin, the capturing pipeline's bind and the draw, while the recorder was using the pool. That matches every message of the validation run. They now wait for the recorder first (boundary(B_DIRECT), as the structure and micromap builds already do; tests/test_recorder_sync.py checks them), and a capture asked for is the asking thread's own. Built, not yet run with the capture on: RX_VK_RT_XFB stays off by default until a validation run with it on has passed.
  • de654af: docs for both. 9f05136: the static map's batch line in the log says what a part drawn again added.

Checks: the same 18 failures as main.

Pushed 9a818a6, 90228f4, de654af and 9f05136. - 90228f4: the static shadow map drawn again in part (the Market and Kakariko redraw a few to a few dozen of its draws now and then, with no loading screen) adds its casters to the area's set instead of replacing it; the same caster is kept once, and the part's mesh draws are not taken again. Only a map drawn after a loading screen replaces the set, and past 25000 casters it starts again. Over a stress run Kokiri -> Kakariko -> Market -> Kakariko -> Market (transform feedback off): the Market keeps 1572 to 1600 casters (37 before, after its 1572 -> 3 -> 3 -> 33 redraws), Kakariko 1830 to 2000 (164 before); each loading screen still lets the area before go. No device lost. - 9a818a6: the cause of the transform feedback capture's device lost. With threaded rendering (`RX_VK_RECORDER=thread`) every recorded call is a packet the recorder thread runs later, but the capture's bind, begin and end went through their extension pointers straight into the command buffer from the replay thread, ahead of the queued pass begin, the capturing pipeline's bind and the draw, while the recorder was using the pool. That matches every message of the validation run. They now wait for the recorder first (`boundary(B_DIRECT)`, as the structure and micromap builds already do; `tests/test_recorder_sync.py` checks them), and a capture asked for is the asking thread's own. Built, not yet run with the capture on: `RX_VK_RT_XFB` stays off by default until a validation run with it on has passed. - de654af: docs for both. 9f05136: the static map's batch line in the log says what a part drawn again added. Checks: the same 18 failures as main.
The Market's casters, mostly let go by the stale-stream guard after the walk out through the gate, left some 40-60 behind in the next scene (the drawbridge), which draws no static shadow map: the Market's geometry where that area stands. Once a static noted before the gap was let go by its streams' writes (another area loaded) and no batch starts within 30 frames, the rest go too (statics_orphaned, let_statics_go shared with the batch's own let-go). A pause writes nothing and keeps the set; a batch during or after the loading screen is past it. The stale-stream guard itself is unchanged (it only counts). tests/test_rt_static_orphan.py checks the wiring and the decision.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
docs(vk-rt): a scene with no static shadow map of its own keeps none of the area before's casters
Some checks failed
PR description / Description follows the template (pull_request_target) Successful in 5s
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
Guide screenshots / Guide images and local UI source review (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
07a98b9a5e
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Author
First-time contributor

Pushed 2b38254 and 07a98b9. A scene that draws no static shadow map of its own (the drawbridge past the Market) kept the last few dozen casters of the area before, those whose memory the new scene had not rewritten, so they could shade a place they are not in. Now, 30 frames after a loading screen that let casters go with no new batch, those are let go too (tests/test_rt_static_orphan.py); a pause with no loading writes nothing and keeps the area's set, which the game does not draw again. The stale-stream guard is unchanged. Stress run Kokiri -> Market -> drawbridge -> Market (transform feedback off): Kokiri 3560, the Market 1556 then 1564 as parts were drawn again, the drawbridge 41 -> 0, the Market 1596 again; no device lost.

On 90228f4 (the static map drawn again in part), a walk in Kakariko now goes 1830 -> 1860 -> 1865 casters where the build before went 1830 -> 277 -> 243; one frame's area of lost shadow 1.1 % against 2.4 %. A moving-camera survey (Kokiri, Kakariko, the Market, Lake Hylia) found nothing to fix, and with the camera still the frame-to-frame luma change is no higher with ray tracing on (Kokiri 2.03 on, 2.07 off; the Market 0.66 on, 0.85 off; 0-255, shots ~0.3 s apart).

Checks: the same 18 failures as main.

Pushed 2b38254 and 07a98b9. A scene that draws no static shadow map of its own (the drawbridge past the Market) kept the last few dozen casters of the area before, those whose memory the new scene had not rewritten, so they could shade a place they are not in. Now, 30 frames after a loading screen that let casters go with no new batch, those are let go too (`tests/test_rt_static_orphan.py`); a pause with no loading writes nothing and keeps the area's set, which the game does not draw again. The stale-stream guard is unchanged. Stress run Kokiri -> Market -> drawbridge -> Market (transform feedback off): Kokiri 3560, the Market 1556 then 1564 as parts were drawn again, the drawbridge 41 -> 0, the Market 1596 again; no device lost. On 90228f4 (the static map drawn again in part), a walk in Kakariko now goes 1830 -> 1860 -> 1865 casters where the build before went 1830 -> 277 -> 243; one frame's area of lost shadow 1.1 % against 2.4 %. A moving-camera survey (Kokiri, Kakariko, the Market, Lake Hylia) found nothing to fix, and with the camera still the frame-to-frame luma change is no higher with ray tracing on (Kokiri 2.03 on, 2.07 off; the Market 0.66 on, 0.85 off; 0-255, shots ~0.3 s apart). Checks: the same 18 failures as main.
Author
First-time contributor

Pushed f7177fd: reflections share a ray in a 2 x 2 quad only when the pixel's vector is within two pixels' angle of the quad leader's (the pixel angle from the view rays' screen derivatives, so it holds at any size; on a rough surface also within half its blur lobe, 0.5 x roughness² x cone). The test before was vectors within 18 degrees, and rippled shallow water turns its vectors by a few degrees from one pixel to the next, so whole quads took one answer: blocky grey stair-step reflections of the rocks along the Kokiri stream's edge, reflections only. Same camera at that spot, switched live: RX_VK_RT_REFL_SHARE=3 (the old test) shows the tiles, the new default 2 is smooth and matches 0 (no sharing); at the Market gate 3, 2 and 0 look the same on the floor and the guard's armour. No device lost. Rippled smooth water now traces up to 4 times the rays it did there; the cost is being measured and will follow.

Checks: the same 18 failures as main.

Pushed f7177fd: reflections share a ray in a 2 x 2 quad only when the pixel's vector is within two pixels' angle of the quad leader's (the pixel angle from the view rays' screen derivatives, so it holds at any size; on a rough surface also within half its blur lobe, 0.5 x roughness² x cone). The test before was vectors within 18 degrees, and rippled shallow water turns its vectors by a few degrees from one pixel to the next, so whole quads took one answer: blocky grey stair-step reflections of the rocks along the Kokiri stream's edge, reflections only. Same camera at that spot, switched live: `RX_VK_RT_REFL_SHARE=3` (the old test) shows the tiles, the new default 2 is smooth and matches 0 (no sharing); at the Market gate 3, 2 and 0 look the same on the floor and the guard's armour. No device lost. Rippled smooth water now traces up to 4 times the rays it did there; the cost is being measured and will follow. Checks: the same 18 failures as main.
fix(vk-rt): reflections share a ray in a quad only when the vectors are within two pixels' angle
Some checks failed
PR description / Description follows the template (pull_request_target) Successful in 11s
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
Guide screenshots / Guide images and local UI source review (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
f7177fd0d2
The quad's pixels took the first pixel's answer whenever their vectors were within 18 degrees. Rippled shallow water turns its vectors by a few degrees from one pixel to the next, so whole quads showed one answer: a mosaic of 2 x 2 tiles of flat-lit hits and kept-picture colours along the Kokiri stream's edge. A pixel now takes the answer only when its vector is within two pixels' angle of the first pixel's (from the view rays' derivatives), or within half the lobe a rough surface blurs over. share=3 keeps the wide test for comparison.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Author
First-time contributor

The cost of f7177fd (reflections' quad sharing within two pixels' angle), at a 4K output with DLSS (scene 2560x1440), RTX 5090, Link standing in the Kokiri stream looking down so rippled traced water fills about 60 % of the picture (about the worst view there is): whole frame 13.58 / 13.58 ms with the old test (RX_VK_RT_REFL_SHARE=3) against 14.02 / 14.05 ms with the new one, +0.46 ms, all of it in the lit pass that holds the water. A limit of 4 pixels' angle would save 0.04 ms of that, 8 pixels 0.17 ms (one report), so the limit stays at 2. At 1280x720 the same spot costs +0.10 ms, and the Market gate shows nothing measurable.

The cost of f7177fd (reflections' quad sharing within two pixels' angle), at a 4K output with DLSS (scene 2560x1440), RTX 5090, Link standing in the Kokiri stream looking down so rippled traced water fills about 60 % of the picture (about the worst view there is): whole frame 13.58 / 13.58 ms with the old test (`RX_VK_RT_REFL_SHARE=3`) against 14.02 / 14.05 ms with the new one, +0.46 ms, all of it in the lit pass that holds the water. A limit of 4 pixels' angle would save 0.04 ms of that, 8 pixels 0.17 ms (one report), so the limit stays at 2. At 1280x720 the same spot costs +0.10 ms, and the Market gate shows nothing measurable.
Author
First-time contributor

Pushed e56b6d82: GI on hair cards that keep no history. In Dodongo's Cavern's dark south-west room, lit by the fairy alone, Link's fringe showed gold specks with GI on, a new set every frame, none with GI off: a hair texel's rays mostly end on the hair itself and count for nothing (RX_VK_RT_GI_SELF), so it is dark unless its one ray gets out and brings full light back, the cards fail the history's depth and normal tests every frame so nothing averages that out, and the upsample, finding none of the four half-size texels on the pixel's surface, normalised tiny weights and picked one almost at random. Now a pixel with under 3 frames of history takes the same-surface mean of this frame's rays (5 x 5, two apart, itself in; surfaces with history are as before, rt_gi_temporal.comp), and the upsample's texel weights have a 0.02 floor (rt_gi_upsample.comp). Same spot and camera, five GI off/on pairs a run: specks on the fringe (pixels 35 over their 7 x 7 median), on minus off, +100 before, -10 after; Kokiri's spawn and Kakariko's entrance look the same as before. One run under GPU-assisted validation: only the known messages.

Interiors with GI off and on and turning frames, nothing else found: Link's house, the Kokiri shop, the Know-It-All brothers' house, a Kakariko house's upper floor, Dodongo's Cavern's west and south-west rooms; Link's hair under his house's lamps is clean. GI's cost, RTX 5090, 1280x720 scene (4K output with DLSS), one report each (noise 0.1-0.3 ms): the traced passes +0.11 to +0.18 ms, the whole frame +0.12 (Lake Hylia) to +0.53 ms (Dodongo's hall); Kokiri +0.22, Kakariko +0.24, the Market +0.42, Death Mountain Trail +0.24, the interiors +0.18 to +0.32.

Checks: the same 18 failures as main.

Pushed e56b6d82: GI on hair cards that keep no history. In Dodongo's Cavern's dark south-west room, lit by the fairy alone, Link's fringe showed gold specks with GI on, a new set every frame, none with GI off: a hair texel's rays mostly end on the hair itself and count for nothing (`RX_VK_RT_GI_SELF`), so it is dark unless its one ray gets out and brings full light back, the cards fail the history's depth and normal tests every frame so nothing averages that out, and the upsample, finding none of the four half-size texels on the pixel's surface, normalised tiny weights and picked one almost at random. Now a pixel with under 3 frames of history takes the same-surface mean of this frame's rays (5 x 5, two apart, itself in; surfaces with history are as before, `rt_gi_temporal.comp`), and the upsample's texel weights have a 0.02 floor (`rt_gi_upsample.comp`). Same spot and camera, five GI off/on pairs a run: specks on the fringe (pixels 35 over their 7 x 7 median), on minus off, +100 before, -10 after; Kokiri's spawn and Kakariko's entrance look the same as before. One run under GPU-assisted validation: only the known messages. Interiors with GI off and on and turning frames, nothing else found: Link's house, the Kokiri shop, the Know-It-All brothers' house, a Kakariko house's upper floor, Dodongo's Cavern's west and south-west rooms; Link's hair under his house's lamps is clean. GI's cost, RTX 5090, 1280x720 scene (4K output with DLSS), one report each (noise 0.1-0.3 ms): the traced passes +0.11 to +0.18 ms, the whole frame +0.12 (Lake Hylia) to +0.53 ms (Dodongo's hall); Kokiri +0.22, Kakariko +0.24, the Market +0.42, Death Mountain Trail +0.24, the interiors +0.18 to +0.32. Checks: the same 18 failures as main.
fix(vk): rt gi: no bright specks on Link's hair where it keeps no history (a dark room by the fairy's light)
Some checks failed
PR description / Description follows the template (pull_request_target) Successful in 4s
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
Guide screenshots / Guide images and local UI source review (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
e56b6d8291
In Dodongo's Cavern, lit by the fairy, Link's hair still had gold specks with GI on, a new set each frame; with GI off it had none. The hair's rays mostly end on its own clump and count for nothing (RX_VK_RT_GI_SELF), so a hair texel is dark unless its one ray escapes to the room and brings back full light. The hair's cards fail the history's depth and normal tests every frame, so nothing averages that out, and the upsample, finding none of the four half-size texels on the pixel's surface, normalised their tiny weights and took one at random: the hair's dark or the face's or the wall's light.

- rt_gi_temporal.comp: a pixel with under 3 frames of history takes the mean of this frame's rays round it on the same surface (5 x 5 texels two apart, its own among them), so a speck is spread over its neighbours and light they share stays. A surface with history gathers its rays as before.
- rt_gi_upsample.comp: each texel's weight gets a floor of 0.02 besides its plane's nearness, so a pixel none of them fits blends them; at a character's edge against the far background the background weighs 2 % of the pixel's own surface.

Same spot and camera, five GI off / on pairs each: specks on the fringe (pixels 35 over their 7 x 7 median) on minus off +100 before (run-main's renderer), -10 after. Kokiri spawn and Kakariko's entrance look the same as before. A run under GPU-assisted validation is clean.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
fix(vk-rt): a reflection's flat-lit hit is no brighter than 1.5 times the kept picture around it
Some checks failed
PR description / Description follows the template (pull_request_target) Successful in 5s
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
Guide screenshots / Guide images and local UI source review (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
55fede0367
A top level's hit off the kept picture is lit flat by the whole picture's mean light. Under the Kokiri canopy that mean is the bright haze and light shafts, so sun-facing pebbles at the shallow stream edge, a few centimetres from the water, came out as white chips and silvery sheets beside the dim pebbles the picture shows. The hit is now bounded by 1.5 times the kept picture's brightness around its place (a coarse level), RX_VK_RT_REFL_BOUND or bound= in the control file (0: no bound). Sunlit places, where the picture around a hit is bright, are not changed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Author
First-time contributor

Pushed 55fede0: a reflection's hit lit flat (one the kept picture does not have) is no brighter than 1.5 times the kept picture's light around its place, read at a coarse level (RX_VK_RT_REFL_BOUND, 0: no bound). It was lit by the whole picture's mean, and under the Kokiri canopy's bright haze and light shafts a sun-facing pebble a few centimetres off the water came out about 2.5 times that: white chips, and silvery sheets over much of the shallow water, beside the dim pebbles the picture shows. Same camera at the stream's edge, switched live: 0 shows the chips and sheets, 3 leaves pale sheets, 2 is calmer, 1.5 matches the surroundings; at the Market gate 0 and 1.5 look the same on the street, the guard's armour and the gate door. No device lost. The description's list of tuning switches also gains the 15 that were missing.

Checks: the same 18 failures as main.

Pushed 55fede0: a reflection's hit lit flat (one the kept picture does not have) is no brighter than 1.5 times the kept picture's light around its place, read at a coarse level (`RX_VK_RT_REFL_BOUND`, 0: no bound). It was lit by the whole picture's mean, and under the Kokiri canopy's bright haze and light shafts a sun-facing pebble a few centimetres off the water came out about 2.5 times that: white chips, and silvery sheets over much of the shallow water, beside the dim pebbles the picture shows. Same camera at the stream's edge, switched live: 0 shows the chips and sheets, 3 leaves pale sheets, 2 is calmer, 1.5 matches the surroundings; at the Market gate 0 and 1.5 look the same on the street, the guard's armour and the gate door. No device lost. The description's list of tuning switches also gains the 15 that were missing. Checks: the same 18 failures as main.
Author
First-time contributor

Pushed 02fbf76: the Reflections: max roughness row's Medium step (the default) keeps the material-F0 class (armour, glass, water, cloth) tracing up to roughness 0.65, as before the row. 5821699 had dropped it to 0.35 at Medium to stop banners, bunting and tunics tracing for nothing visible, but the guards' plates take the ground only at 0.65 (hardly at 0.5, not at 0.35), so at the default their reflections were gone. It costs about 1.5 ms a frame at the Market's gate (the reflections' pass 6.28 ms against 4.78 at 0.35); Low still drops the class to 0.2, High and Max are as they were.

Checks: the same 18 failures as main.

Pushed 02fbf76: the Reflections: max roughness row's Medium step (the default) keeps the material-`F0` class (armour, glass, water, cloth) tracing up to roughness 0.65, as before the row. 5821699 had dropped it to 0.35 at Medium to stop banners, bunting and tunics tracing for nothing visible, but the guards' plates take the ground only at 0.65 (hardly at 0.5, not at 0.35), so at the default their reflections were gone. It costs about 1.5 ms a frame at the Market's gate (the reflections' pass 6.28 ms against 4.78 at 0.35); Low still drops the class to 0.2, High and Max are as they were. Checks: the same 18 failures as main.
fix(vk-rt): reflections' Medium step keeps armour and glass tracing up to roughness 0.65, so the guards' plates reflect by default
Some checks failed
PR description / Description follows the template (pull_request_target) Successful in 7s
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
Guide screenshots / Guide images and local UI source review (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
02fbf76c6c
The max roughness row's Medium step (the default) had dropped the material-F0 class (armour, glass, water, cloth) from 0.65 to 0.35 to stop cloth tracing for nothing, but the guards' plates take the ground only at 0.65 (hardly at 0.5, not at 0.35), so at the default their reflections were gone. Medium is 0.65 for the class again; it costs about 1.5 ms a frame at the Market's gate, where the bunting is. Low still drops it to 0.2.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
fix(vk-rt): a reflection's flat-lit hit keeps its own glow past the bound, so the Know-It-All brothers' lanterns show in the stream again
Some checks failed
PR description / Description follows the template (pull_request_target) Successful in 4s
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
Guide screenshots / Guide images and local UI source review (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
bb9279d32a
55fede0 bounded a flat-lit hit at 1.5 times the kept picture around it, but it bounded the hit's emission with its lit part, so a lantern reflected over dark water was cut to the water's brightness and disappeared. The bound now applies to the light the hit takes (albedo times ambient and sun); the emission is added after it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Author
First-time contributor

Pushed bb9279d: 55fede0's bound on a reflection's flat-lit hit (no brighter than 1.5 times the kept picture around it) also bounded the hit's own emission, so a lantern reflected over dark water was cut to the water's brightness and the Know-It-All brothers' lanterns were gone from the Kokiri stream (seen in play). The bound now applies to the light the hit takes (its albedo lit by the ambient and the sun), and the emission is added after it.

Checks: the same 18 failures as main.

Pushed bb9279d: 55fede0's bound on a reflection's flat-lit hit (no brighter than 1.5 times the kept picture around it) also bounded the hit's own emission, so a lantern reflected over dark water was cut to the water's brightness and the Know-It-All brothers' lanterns were gone from the Kokiri stream (seen in play). The bound now applies to the light the hit takes (its albedo lit by the ambient and the sun), and the emission is added after it. Checks: the same 18 failures as main.
A reflection's or GI's hit off the kept picture is lit with the material record, the mean of the lit draw's albedo texture. A rupee's gem texture is pale; its colour is the material block's first colour, c5[32..34] (program a5ab9e9efb5f0553: its Eden IR takes the albedo as saturate(texture x c5[32..34]); the blue one's 0.014 0.05 1, the green one's 0 0.29 0). Its record was the texture's grey-white, which the user saw in the Kokiri stream.

The record is now the mean times that tint for the programs known to take their albedo that way (material_tint; RX_VK_RT_TINT_PROGS, the rupees' by default; RX_VK_RT_TINT=0 for none). It is not taken from every program: the same words are added in ab82811383b384b5, read as integers in others, and hold 0 0 0 or pure 1 0 0 in many, so a blanket tint would recolour them. The green and the blue rupee share one model and texture, so a tinted record is kept by geometry and object block (tinted_material, object_material) and scene_tlas places an instance with it ahead of the geometry's own; a slot is a texture and tint. rt_scene_mean.comp takes the tint as a push constant (the layout's range 32 bytes). No device-address reads added.

RX_VK_RT_MAT_LOG=<lines> (a test): each small lit geometry's program, textures, attributes and material block, once.

Checked at the Kokiri stream (RX_VK_RT_DEBUG=tlasm, the records as hits show them): the rupee grey-white with RX_VK_RT_TINT=0, green with the fix; the Market's material view the same off and on but for what moves (1.3 % of pixels). tests/test_rt_material_tint.py checks the wiring.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
docs(vk-rt): the rupees' tint in their material records (RX_VK_RT_TINT, RX_VK_RT_TINT_PROGS)
All checks were successful
PR description / Description follows the template (pull_request_target) Successful in 5s
68f4e54fc4
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Author
First-time contributor

Pushed b5b51c0 and 68f4e54: a rupee's material record carries its colour. In play the green rupee by the Kokiri stream reflected as a grey-white shape. Its program (a5ab9e9efb5f0553) takes its albedo as saturate(texture * c5[32..34]) (green 0 0.29 0, blue 0.014 0.05 1), and its record was the mean of the pale gem texture alone, which reflections and GI read for a hit the kept picture does not have. For the programs listed in RX_VK_RT_TINT_PROGS (the rupees' by default; RX_VK_RT_TINT=0 none) the record is now the mean times that tint, one record per geometry and object block so a green and a blue rupee of one geometry keep their own (tests/test_rt_material_tint.py). It is not read for every program, because the same words are integers or other values elsewhere. In RX_VK_RT_DEBUG=tlasm (the records as hits use them) the rupee goes from grey-white to green; the Market differs on 1.3 % of pixels, all moving things. No device-address reads added; no device lost in 14 runs. Hearts and other drops are not checked yet (none reachable in this save).

Checks: the same 18 failures as main.

Pushed b5b51c0 and 68f4e54: a rupee's material record carries its colour. In play the green rupee by the Kokiri stream reflected as a grey-white shape. Its program (`a5ab9e9efb5f0553`) takes its albedo as `saturate(texture * c5[32..34])` (green 0 0.29 0, blue 0.014 0.05 1), and its record was the mean of the pale gem texture alone, which reflections and GI read for a hit the kept picture does not have. For the programs listed in `RX_VK_RT_TINT_PROGS` (the rupees' by default; `RX_VK_RT_TINT=0` none) the record is now the mean times that tint, one record per geometry and object block so a green and a blue rupee of one geometry keep their own (`tests/test_rt_material_tint.py`). It is not read for every program, because the same words are integers or other values elsewhere. In `RX_VK_RT_DEBUG=tlasm` (the records as hits use them) the rupee goes from grey-white to green; the Market differs on 1.3 % of pixels, all moving things. No device-address reads added; no device lost in 14 runs. Hearts and other drops are not checked yet (none reachable in this save). Checks: the same 18 failures as main.
Author
First-time contributor

Pushed b4207e3 and bec545f: a reflection's hit on a material that lights itself takes its colour from the kept picture where its place was drawn at its depth (the screen hits' test), and is lit flat only off the picture. Seen in play: with screen-space hits off (the default) every top-level hit was lit flat, so the rupee came out dark green (its record is the tint times the gem's mean; its program draws lighting times the tint plus a texture times 30, times c5[106]) and the Know-It-All brothers' lanterns a fraction of what the game draws. Self-lit means the emissions' block has w > 0 for the record: 1 a glow, as before, 2 a tinted program's own shading (rt_scene_mean.comp marks tinted records). RX_VK_RT_REFL_OWN=0 lights them flat as before. The hit-kind view shows kept-picture hits only with it on; the Market's gate and the Kokiri stream's white-chip spot are unchanged apart from moving things; no device lost.

Also from today: a solo core-validation run with RX_VK_RT_XFB=1 on this branch's 68f4e54 (Kokiri -> Market) passed: no device lost, none of the transform feedback VUIDs from the run that lost it (04128, the render pass ones, 02323, the threading write, 06999), two capturing stages made at the Market. A normal pair with it off and on lost nothing either. It stays off by default for now.

Checks: the same 18 failures as main.

Pushed b4207e3 and bec545f: a reflection's hit on a material that lights itself takes its colour from the kept picture where its place was drawn at its depth (the screen hits' test), and is lit flat only off the picture. Seen in play: with screen-space hits off (the default) every top-level hit was lit flat, so the rupee came out dark green (its record is the tint times the gem's mean; its program draws lighting times the tint plus a texture times 30, times `c5[106]`) and the Know-It-All brothers' lanterns a fraction of what the game draws. Self-lit means the emissions' block has w > 0 for the record: 1 a glow, as before, 2 a tinted program's own shading (`rt_scene_mean.comp` marks tinted records). `RX_VK_RT_REFL_OWN=0` lights them flat as before. The hit-kind view shows kept-picture hits only with it on; the Market's gate and the Kokiri stream's white-chip spot are unchanged apart from moving things; no device lost. Also from today: a solo core-validation run with `RX_VK_RT_XFB=1` on this branch's 68f4e54 (Kokiri -> Market) passed: no device lost, none of the transform feedback VUIDs from the run that lost it (04128, the render pass ones, 02323, the threading write, 06999), two capturing stages made at the Market. A normal pair with it off and on lost nothing either. It stays off by default for now. Checks: the same 18 failures as main.
With screen-space hits off (the default) every top level's hit was lit flat: the mean albedo times the picture's light level, plus the emission record. A rupee's tinted record (0 0.29 0 times the pale gem's mean) came out dark green beside the bright rupee above it: its program (a5ab9e9efb5f0553) shades it far past its albedo lit flat (lighting times the tint, plus a texture times 30, scaled by c5[106]). A lantern's glass took its emission record times the picture's level, a fraction of the lantern the game draws.

Now a top level's hit whose material lights itself takes the kept picture's colour where the hit is on it at the depth it has (rt_refl_screen, the same test the screen-space hits use), and is lit flat as before off it. Self-lit is told by the emissions' block (the materials' second 4096 records) by the same record: w 1 for a glow (written by rt_scene_emission.comp, as before), and now w 2 for a tinted record, which rt_scene_mean.comp marks 0 0 0 2 when its push constant's w is 2 (the dispatch passes 2 for a tinted job; its descriptor covers both blocks). RX_VK_RT_REFL_OWN=0, or own=0 in RX_VK_RT_REFL_CTL, keeps the old flat lighting; rf.ambient.w carries the switch.

Checked on run-reflpr (the user's options, scene 2560x1440, RX_VK_RT=15), live own=1/own=0: the hit-kind view (RX_VK_RT_DEBUG=reflh) shows kept-picture hits only with own=1 (the water at Link's feet reflecting him, whose program family has a glow record); the Market gate the same but for what moves; the white-chip spot at the Know-It-All stream calm with own on and off (bound 0 still shows the sheets). RX_VK_RT_DEBUG=tlase shows the Know-It-All lanterns in the structure, glowing. Not seen: a lantern's or the rupee's own reflection; the reachable cameras do not see them in water. tests/test_rt_material_tint.py checks the mark.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
docs(vk-rt): a self-lit hit's colour from the kept picture (RX_VK_RT_REFL_OWN)
Some checks failed
PR description / Description follows the template (pull_request_target) Successful in 6s
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
Guide screenshots / Guide images and local UI source review (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
bec545f6b5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
emission_note took any draw of the lantern family as a light. Link (and, per refl, the Know-It-All house's trunk) carry intensity, power, radius and colour all exactly 1, and got a grey 0.5 record that tlase shows white and that the self-lit reflection path took as self-lit. Such a block now writes none. RX_VK_RT_EMISSION_DEFAULTS=1 takes them as before.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
docs(vk-rt): no glow record for a program whose glow words are all defaults (RX_VK_RT_EMISSION_DEFAULTS)
Some checks failed
PR description / Description follows the template (pull_request_target) Successful in 5s
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
Guide screenshots / Guide images and local UI source review (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
f70c348d21
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Author
First-time contributor

Pushed 63d5eb9 and f70c348: a material block whose glow words are all their defaults (intensity, power, radius c5[72] and colour exactly 1) writes no glow record. Link's tunic, arms and boots carried a grey 0.5 glow (seen in RX_VK_RT_DEBUG=tlase), so their reflections off the picture got white added and, with b4207e3, counted as self-lit. The lanterns' radius is 0.09 to 0.12 and their power is not 1, so they keep theirs; in tlase at the Know-It-All brothers' house Link goes from white to his own colours and the lanterns glow as before (tests/test_rt_emission_defaults.py; RX_VK_RT_EMISSION_DEFAULTS=1 brings the old records back). No device lost. Link's hat and the river still show in tlase from another record, not looked at yet.

Also checked today: the falling leaves at Kokiri cast no shadow with ray tracing off either; the game draws them into the lit picture after the lighting, with no cascade draw, so taking them in would be a new caster, not a fix.

Checks: the same 18 failures as main.

Pushed 63d5eb9 and f70c348: a material block whose glow words are all their defaults (intensity, power, radius `c5[72]` and colour exactly 1) writes no glow record. Link's tunic, arms and boots carried a grey 0.5 glow (seen in `RX_VK_RT_DEBUG=tlase`), so their reflections off the picture got white added and, with b4207e3, counted as self-lit. The lanterns' radius is 0.09 to 0.12 and their power is not 1, so they keep theirs; in tlase at the Know-It-All brothers' house Link goes from white to his own colours and the lanterns glow as before (`tests/test_rt_emission_defaults.py`; `RX_VK_RT_EMISSION_DEFAULTS=1` brings the old records back). No device lost. Link's hat and the river still show in tlase from another record, not looked at yet. Also checked today: the falling leaves at Kokiri cast no shadow with ray tracing off either; the game draws them into the lit picture after the lighting, with no cascade draw, so taking them in would be a new caster, not a fix. Checks: the same 18 failures as main.
The rupees' program (a5ab9e9efb5f0553) adds c5[106] x (30 x a sphere map's colour + a small glow) to its lit sum. Off the kept picture a reflection's hit on a rupee was its albedo lit flat, dark green, since its emission record was 0 0 0 2. tinted_sheen now queues an emission job over the program's second sRGB material texture (RX_VK_RT_TINT_SHEEN=<c2 offset> names another, 0 none) in rt_scene_emission.comp's new colour mode: rgb mean x 30 x c5[106], w 2. rt_scene_mean.comp leaves a record already marked.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The rupees' program (a5ab9e9efb5f0553) has no environment lookup for its shine: it adds c5[106] x 30 x a sphere map, a texture looked up by the view-space normal. rt_refl_spirv.h now finds such a lookup (a 2D sample whose red, green and blue are each multiplied by the float 30: 2 of 1,545 programs in a cache) and calls rt_refl_sheen after it with the texel and the map's mean (its last level). One mirror ray off the facet; the scene's middle light comes out as the map's mean, so the gem is as bright on the whole as before (within 3 % over a close rupee); a miss keeps the game's texel. Cost within the timing's noise. RX_VK_RT_REFL_SHEEN (gain, 0 the game's map), _TINT, _SHARE; ctl sheen=, sheentint=, sheenshare=.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
docs(vk-rt): a gem's sphere map traced (RX_VK_RT_REFL_SHEEN)
Some checks failed
PR description / Description follows the template (pull_request_target) Successful in 4s
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
Guide screenshots / Guide images and local UI source review (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
97242ceeb6
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Author
First-time contributor

Pushed e4e1e01, e1fb065, e50af55 and 97242ce: rupees.

  • e50af55: a gem's sphere map is traced. The rupees' program (a5ab9e9efb5f0553, and e2bb45349c57c184 with the same pattern) adds c5[106] x 30 x a grey sphere map looked up by the view-space normal: a fixed highlight. rt_refl_spirv.h finds a 2D sample whose r, g and b are each multiplied by 30 and calls rt_refl_sheen() after it: one mirror ray off the facet (the normal from the position's derivatives, no cone) through the reflections' own lookup, its light mapped so the scene's middle light gives the map's mean; a miss keeps the game's texel. Native crops close up: the facets show the cliff, the ground and the sky; the gem's mean luma 0.590 -> 0.574 and 0.509 -> 0.508; 17.90 ms a frame against 17.84 ms (noise, a gem is a few thousand pixels); the Market's gate differs in 0 pixels. The patched modules pass spirv-val. RX_VK_RT_REFL_SHEEN is the gain (0: the game's map), with _TINT and _SHARE.
  • e4e1e01: a tinted program's emission record is its own light (c5[106] x 30 x its sphere map's mean, the texture found as the second sRGB 2D one, RX_VK_RT_TINT_SHEEN to name another or 0 for none), so a rupee's reflection off the picture is lit about as it is on it rather than dark green. It shows once a spinning rupee stays in the structure off the screen, which is being worked on.

Checks: the same 18 failures as main.

Pushed e4e1e01, e1fb065, e50af55 and 97242ce: rupees. - e50af55: a gem's sphere map is traced. The rupees' program (`a5ab9e9efb5f0553`, and `e2bb45349c57c184` with the same pattern) adds `c5[106] x 30 x` a grey sphere map looked up by the view-space normal: a fixed highlight. `rt_refl_spirv.h` finds a 2D sample whose r, g and b are each multiplied by 30 and calls `rt_refl_sheen()` after it: one mirror ray off the facet (the normal from the position's derivatives, no cone) through the reflections' own lookup, its light mapped so the scene's middle light gives the map's mean; a miss keeps the game's texel. Native crops close up: the facets show the cliff, the ground and the sky; the gem's mean luma 0.590 -> 0.574 and 0.509 -> 0.508; 17.90 ms a frame against 17.84 ms (noise, a gem is a few thousand pixels); the Market's gate differs in 0 pixels. The patched modules pass `spirv-val`. `RX_VK_RT_REFL_SHEEN` is the gain (0: the game's map), with `_TINT` and `_SHARE`. - e4e1e01: a tinted program's emission record is its own light (`c5[106] x 30 x` its sphere map's mean, the texture found as the second sRGB 2D one, `RX_VK_RT_TINT_SHEEN` to name another or 0 for none), so a rupee's reflection off the picture is lit about as it is on it rather than dark green. It shows once a spinning rupee stays in the structure off the screen, which is being worked on. Checks: the same 18 failures as main.
The game draws the falling leaves (program 5bea5f63bbd3d665, an instanced quad its vertex stage places from the game's particle buffers) over the lit scene, depth tested and not written, and in none of its sun cascades: even with ray tracing off they have no shadow. Their scene draws are now captured by transform feedback each frame (leaf_note, xfb_note's family: the camera in uniform buffer 13) into an arena of their own, and placed in the next frame's top level, since they are drawn after this frame's is built. Their instances are kBlocker, which only the sun's rays take (the mask pass, GI's own ray toward the sun); reflections, AO and GI bounces do not. Each leaf quad gets one opacity micromap from its coordinates and texture alpha (rt_scene_cut.comp, level 5), and every captured triangle points at its quad's triangle through a 16-bit index stream (0, 1, 0, 1 ...).

RX_VK_RT_LEAF_PROGS=<keys> names the programs (5bea5f63bbd3d665 by default), =none none. Transform feedback is asked for at device creation when leaves are wanted as well as with RX_VK_RT_XFB; the cascades' capture stays behind RX_VK_RT_XFB. RX_VK_RT_LEAF_CUT=0: whole quads; RX_VK_RT_LEAF_CUT_LEVEL; RX_VK_RT_LEAF_MB (32); RX_VK_RT_LEAF_LOG=<keys>, a test: those programs' draws logged.

Kokiri spawn, one game at a time: core validation clean (no new VUIDs), no device lost in the A/B runs or in an RX_VK_RT_XFB=1 run Kokiri -> Market -> drawbridge -> Hyrule Field; about +0.2 ms GPU a frame at Kokiri, nothing at the Market. GPU-assisted validation did not reach the menu within the 15-minute slot with transform feedback on.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
docs(vk-rt): the falling leaves' shadows (RX_VK_RT_LEAF_PROGS)
Some checks failed
PR description / Description follows the template (pull_request_target) Successful in 6s
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
Guide screenshots / Guide images and local UI source review (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
41337ed694
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Author
First-time contributor

Pushed 41337ed6 718a2d02 : the falling leaves cast shadows. At Kokiri a single leaf drifting down cast none, with ray tracing off too: the game draws them (program 5bea5f63bbd3d665, an instanced quad its vertex stage places from the particle buffers by instance) after the lighting, with no cascade draw. Their draws are now captured by transform feedback every frame into an arena of their own (RX_VK_RT_LEAF_MB, 32 MB) and placed in the next frame's top level (they are drawn after it is built) as 0x40 kBlocker, which only the sun's rays take, so they shade the ground and do not show in reflections, AO or GI's bounces. Each leaf quad is cut by its texture's alpha through an opacity micromap rt_scene_cut.comp builds once (level 5), every captured triangle pointing at it through a 16-bit 0, 1, 0, 1 index stream, so the shadow has the leaf's shape. RX_VK_RT_LEAF_PROGS names the programs (that one by default, none for none); the transform feedback extension is asked for whenever leaves are wanted, while the cascades' capture stays behind RX_VK_RT_XFB. Native crops before/after: a leaf over sunlit stone, no shadow, then its leaf-shaped shadow beside it; the Market unchanged (no leaf draws there). GPU a frame at Kokiri 9.6-9.8 ms before, 9.8-10.0 after (+0.2). A core-validation run at Kokiri showed only the known messages; GPU-assisted validation with transform feedback on did not reach the menu in 13 min; a stress run with RX_VK_RT_XFB=1 as well (Kokiri -> Market -> drawbridge -> Hyrule Field) and every other run lost no device (tests/test_rt_leaf_casters.py).

Checks: the same 18 failures as main.

Pushed 41337ed6 718a2d02 : the falling leaves cast shadows. At Kokiri a single leaf drifting down cast none, with ray tracing off too: the game draws them (program `5bea5f63bbd3d665`, an instanced quad its vertex stage places from the particle buffers by instance) after the lighting, with no cascade draw. Their draws are now captured by transform feedback every frame into an arena of their own (`RX_VK_RT_LEAF_MB`, 32 MB) and placed in the next frame's top level (they are drawn after it is built) as `0x40` kBlocker, which only the sun's rays take, so they shade the ground and do not show in reflections, AO or GI's bounces. Each leaf quad is cut by its texture's alpha through an opacity micromap `rt_scene_cut.comp` builds once (level 5), every captured triangle pointing at it through a 16-bit 0, 1, 0, 1 index stream, so the shadow has the leaf's shape. `RX_VK_RT_LEAF_PROGS` names the programs (that one by default, `none` for none); the transform feedback extension is asked for whenever leaves are wanted, while the cascades' capture stays behind `RX_VK_RT_XFB`. Native crops before/after: a leaf over sunlit stone, no shadow, then its leaf-shaped shadow beside it; the Market unchanged (no leaf draws there). GPU a frame at Kokiri 9.6-9.8 ms before, 9.8-10.0 after (+0.2). A core-validation run at Kokiri showed only the known messages; GPU-assisted validation with transform feedback on did not reach the menu in 13 min; a stress run with `RX_VK_RT_XFB=1` as well (Kokiri -> Market -> drawbridge -> Hyrule Field) and every other run lost no device (`tests/test_rt_leaf_casters.py`). Checks: the same 18 failures as main.
feat(vk-rt): the cascades' transform feedback capture is on by default (RX_VK_RT_XFB=0 turns it off)
Some checks failed
PR description / Description follows the template (pull_request_target) Successful in 4s
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
Guide screenshots / Guide images and local UI source review (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
9033cf990d
It was off since the Market's device lost on 11-16. Its cause was found and fixed in 9a818a6 (the capture's calls reached the command buffer from the replay thread ahead of the recorder's queued pass and pipeline): a core-validation run with it on (Kokiri -> Market) showed none of that run's messages and lost nothing, and a stress run Kokiri -> Market -> drawbridge -> Hyrule Field with it and the falling leaves' capture lost nothing either.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Author
First-time contributor

Pushed 9033cf9: the cascades' transform feedback capture (particle draws only the sun's cascades draw, such as the Lost Woods' falling leaves) is on by default again; RX_VK_RT_XFB=0 turns it off. It was off after the Market's device lost; its cause was fixed in 9a818a6, a core-validation run with it on passed, and the stress run for the falling leaves (with it on) lost nothing.

Checks: the same 18 failures as main.

Pushed 9033cf9: the cascades' transform feedback capture (particle draws only the sun's cascades draw, such as the Lost Woods' falling leaves) is on by default again; `RX_VK_RT_XFB=0` turns it off. It was off after the Market's device lost; its cause was fixed in 9a818a6, a core-validation run with it on passed, and the stress run for the falling leaves (with it on) lost nothing. Checks: the same 18 failures as main.
fix(vk-rt): the falling leaves' micromaps start their data and triangle array at multiples of 256 bytes (VUID-vkCmdBuildMicromapsEXT-pInfos-07515)
Some checks failed
PR description / Description follows the template (pull_request_target) Successful in 5s
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
Guide screenshots / Guide images and local UI source review (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
36a42f87e7
Each leaf quad's micromap now takes its states from a 256-aligned start in the micromaps' arena and its triangle array from the next multiple of 256 after them, and the whole reservation is rounded to 256. Both addresses are checked on the CPU before the build is recorded, and an unaligned arena makes no leaf micromap. Core validation at the Kokiri spawn (prscene-1116-154520): the leaf micromap at data 0x1ec2584000, triangles 0x1ec2584100; the ten 07515 reports all name the existing cutout micromaps (the parked scene-omm-align2 issue), none of them a leaf's.

In place of the GPU-assisted run, which did not reach the menu with transform feedback on, the leaves' device-address use (no new shader code: rt_scene_cut.comp and rt_scene_mesh.comp as before):
- rt_scene_cut.comp over a leaf quad: count = 2 triangles (t < count); its 6 indices are read from the guest index stream mapped for prims * 3 * index size (guest_address checks the range); each vertex's coordinate is read only when its byte offset plus its size is within vbytes, the coordinate stream's mapped size from its offset; it writes 2 * 4^5 / 32 words of states and 2 triangle records, inside the 256-rounded reservation. It runs once a quad (LeafCut::built).
- rt_scene_mesh.comp over a leaf capture: writes e.cap corners (x 12 bytes) into the leaves' arena only after `leaf_arena_used + bytes <= leaf_arena_bytes` is checked, and reads the capture's records as for the cascades' captures.
- The 16-bit index stream is read only by the driver's bottom-level build, for prims <= kLeafIndexBytes / 2 (checked); it is filled once.
- The leaves' arena, the index stream, the micromaps' arena and each quad's micromap are made once and live to the device's end. A frame's captured triangles are read by the next frame's builds, recorded before that frame's own captures write the arena again, with full barriers between.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Author
First-time contributor

Pushed 36a42f87: the falling leaves' micromaps start their data and their triangle array at multiples of 256 bytes, checked on the CPU before the build is recorded (an arena not aligned makes no leaf micromap). A core-validation run at Kokiri shows the leaf micromap at data ...4000 and triangles ...4100, and its ten VUID 07515 reports all name the older cutout micromaps (their alignment is a separate change, not in this branch yet), none a leaf's. No device lost. The review that stands in for GPU-assisted validation (which did not reach the menu with transform feedback on) is in the commit body: no new shader code; the cut and the mesh capture write only inside their checked reservations, and every buffer they use lives until the device goes.

Checks: the same 18 failures as main.

Pushed 36a42f87: the falling leaves' micromaps start their data and their triangle array at multiples of 256 bytes, checked on the CPU before the build is recorded (an arena not aligned makes no leaf micromap). A core-validation run at Kokiri shows the leaf micromap at data ...4000 and triangles ...4100, and its ten VUID 07515 reports all name the older cutout micromaps (their alignment is a separate change, not in this branch yet), none a leaf's. No device lost. The review that stands in for GPU-assisted validation (which did not reach the menu with transform feedback on) is in the commit body: no new shader code; the cut and the mesh capture write only inside their checked reservations, and every buffer they use lives until the device goes. Checks: the same 18 failures as main.
First-time contributor

Tested on AMD under Windows, which the description lists as not tested: Radeon RX 9070 XT (16 GB), driver 26.11.1, Windows 11, from e9518463 to f70c348d, with FSR 4.1.2 at 1440p.

It works, in Kokiri Forest, the Deku Tree, the Market, the Temple of Time, Kakariko, Hyrule Field and Zora's Fountain, by day and at night, all four rows on. One thing to know about this card: the driver has no VK_EXT_opacity_micromap, so everything here ran the path without micromaps.

We are building on this branch (https://git.magicbean.dev/Drommedhar/Longshot/src/branch/feat/path-tracing, rebased onto yours as it moves; 75 commits, nearly all in files of our own). Take whatever is useful.

What we change in your code

Six changes of behaviour, each from something seen on this card:

  1. Distant characters cast sun shadows again. With everything traced, a character about 30 m away cast nothing on the ground while a planter beside her did. She is in the top level, filter and history off change nothing, and RX_VK_RT_CHANNELS=1353 brings the shadow back: channels_default puts the traced shadow into a alone, and the lit programs seem not to take a past the static map's range. We give g the traced shadow as well (3 where you have 7), at the price of the squared penumbra your note avoids. You may know a better way.
  2. The bottom levels' budget follows the video memory (768 MB up to 8 GB, an eighth above that, at most 4096). The Market wants about 1.2 GB here; at 768 thousands of bottom levels were let go and built again every 600 frames and shadow casters came and went with the camera.
  3. FULL is split into micromaps and position fetch. This card has only the second, so hits had no face normals; now they do.
  4. Cut-outs are tested in the rays where there are no micromaps (RX_VK_RT_ALPHA=1): the same opacity bits, baked, as a quick "may be covered" test in the ray query's candidate loop, and for a covered cell the game's own texture sampled at the hit, as an any-hit shader would (the sun's, the AO's and GI's rays; lamp shadows and the reflections' lookup keep the bits alone). In your ray shaders that is an #ifdef block and RT_PROCEED(q) in place of the loop; your generated headers are untouched, ours are extra ones.
  5. Terrain patches are open at the game's holes on that path. Without micromaps holes_note returns at once, so a patch is the full grid. Kakariko's ground lies below the height field, in holes, and by night the whole village was in shadow: its sun rays ended 8 to 15 m up on the back of a patch. We bake a patch's bits from the same map and test the texel at the hit (a hole where max(red, green) is over 0.5019). The sun term's mean in that view went from 72 to 131 of 255, and it now looks like the game's own.
  6. The kBlocker class is far only on that path: a sun ray whose receiver is within 50 m of the camera passes it (RX_VK_RT_BLOCKER_NEAR, 0 = as you have it). This one may matter to you on every device. The class holds the game's own low-detail shadow models, ordinary meshes the camera never draws, batched at the level's matrix, and in them a tree's leaf cards are solid polygons with no alpha anywhere. The game uses them where its static shadow map applies, far away; in the rays they are hit at every distance, so a tree's sun shadow near the camera is filled whatever the real leaves' alpha says. Measured at a pine in the Market by night (mean brightness of the shadow, the game's own about 84): 55 as it was, 62 with the texture test alone, 81 with both. Its price: a real object the camera has not drawn yet casts nothing onto receivers within that distance until it has been seen once. We found nothing that tells the shadow models from such objects: not the pass (the cascades draw them too, at times), not the vertex layout.

The rest of what we touch in your files is hook lines: a hidden state the parts ask (F8, below), one function each asks for its debug picture (F7), and calls into our files where a draw is noted, a lit draw is seen, a program's module is made and GI's added term is ready.

What we add

  • The game's lamp list for the passes (the layout is JayDeGoodz's, #815), and ray-traced shadows for those lamps: a fifth row (RX_VK_RT bit 16), a patch in the lit programs' light loop.
  • Lights from what glows. The list is short, and in the towns at night nearly every lantern and window is a glowing material with no lamp. We read a program's emission from its SPIR-V and make sphere and area lights of lantern bulbs, lantern glass and window panes (a batched draw split into its islands), kept in a world grid so that which lights reach a surface depends on the surface's place, not the camera's. One thing found on the way that your glow records may want: the glass of the Market's door lanterns (a1c74226a51fb7ce) and the window panes (f76f461080f8dc36, 3be28542db4ee637 in Kakariko) end in lit + emissive * c5[106] * c6[225]; c6[225] is the frame's emission scale, and no glow record is made for them.
  • Those lights in the picture (a sixth row, RX_VK_RT bit 32): a pass after the lit draws, at the fog's composite, with a shadow ray a light, the diffuse term and a GGX highlight. It needs what a forward renderer does not keep, so the lit programs now store it: guide buffers (shading normal with the normal map, roughness, albedo, F0) written by a SPIR-V patch like yours, as image stores; every guide in 77.8 % of the cache's lit stages. They are also what a denoiser or Ray Reconstruction will ask for.
  • Colours at hits (RX_VK_RT_HIT=1, pictures RX_VK_RT_DEBUG=hitc; not in GI's or the reflections' hits yet): a lit program's base colour read from its SPIR-V and folded per draw into a few steps a hit shader runs, with records for the ground and the mesh-shader cards too. Primary rays find the game's texture colour on 99.9 % of the screen in Kokiri Forest and the Market and 97 % in Hyrule Field.
  • For looking and tuning. F8 ("Ray tracing: show") flips between the game's own picture and the traced one. F7 ("Ray tracing: view") shows AO, sun shadows, the lamps' direct light, GI, reflections or a guide buffer alone. F4 to F6 step through and change look settings (the lights' strength, reach and warmth, your SUN_SOFT, FILTER and HISTORY, the AO's and GI's strength), saved with the options. And three diagnostics that found points 5 and 6: the biggest instances of the top level told, a list of geometry to leave out, and sun probes that name what a pixel's sun ray meets.

Still open on this card

  • Reflections in water show flat blobs (a pond in Hyrule Field, Zora's Fountain): a hit that was not on the kept picture is the instance's mean albedo lit flat, so a tree is a green patch. We are giving those hits the record's texture colour.
  • A tree's shadow is much better with points 4 and 6 and still looks off beside the game's own.
  • GI's light changes about 4.5 % a frame on a still camera (your RX_VK_RT_GI_STABLE counter, Kakariko by night; 4.2 % by day). Sixteen rays bring it to 3.2 %, the clamp, the feedback and a history of 64 or 128 frames change little: about 3 % is a floor that is not ray noise. A variance-guided filter of ours did no better and is not on the branch.
  • Cost, measured again on 16 Nov without a frame rate cap (1707x960 internal, AO Medium, every row on; GPU times from RX_VK_GPU_PROFILE). This point said before that the reflections were most of the frame in towns at night, 12 fps against 42. That was wrong: the pair was probably taken with the slower lookup of RX_VK_RT_VIEWS=1 linked in, and it does not hold for the ordinary build. The Market at night: 74.6 fps with ray tracing off (GPU 10.0 ms a frame), 33 to 38 with everything on (20 to 24 ms). The largest part of what is added there is ours: the lantern lights' pass, up to 7 ms, which we are cutting down. Yours: the mask part's rays 3.7 ms (AO at Ultra instead of Medium adds 1.3 to 1.5), GI's rays and filters about 1 ms, the scene's builds 0.9 ms. The reflections by the max roughness row: in the Market off 39.5 fps, Low 38.7, Medium 31.6, Max 27.6 (about 1, 6 and 11 ms in the lit passes); facing a pond in Hyrule Field by day, water over about a third of the picture, off 44.2 fps, Low 37 to 41, Medium 29.1, High 27.9, Max 20.8 (the lit passes 6.2 ms with them off, 8 to 10 at Low, 18.8 at Medium, 20.4 at High, 32.5 at Max). So they are cheap at Low and where little water is in view, and by far the largest cost above Low with water in view. On the CPU the renderer thread works 12.5 ms a frame there against 7.8 with ray tracing off (about 3 ms of it in the top level at 2,200 instances); by day in the Market it is the limit: about 10 ms a frame in the top level at 6,400 to 7,400 instances.
  • The transform feedback capture lost the device in the Market at 500a01a9, before you turned it off by default. We have not run it since: the repeated device losses took the PC down twice. We have the bisection's notes if they help.
  • A first start with the rows on took about 17 minutes building pipelines; later starts about 3.5.

Not tested: Linux, frame generation with the rows on.

Tested on AMD under Windows, which the description lists as not tested: Radeon RX 9070 XT (16 GB), driver 26.11.1, Windows 11, from e9518463 to f70c348d, with FSR 4.1.2 at 1440p. **It works**, in Kokiri Forest, the Deku Tree, the Market, the Temple of Time, Kakariko, Hyrule Field and Zora's Fountain, by day and at night, all four rows on. One thing to know about this card: the driver has no `VK_EXT_opacity_micromap`, so everything here ran the path without micromaps. We are building on this branch (https://git.magicbean.dev/Drommedhar/Longshot/src/branch/feat/path-tracing, rebased onto yours as it moves; 75 commits, nearly all in files of our own). Take whatever is useful. ### What we change in your code Six changes of behaviour, each from something seen on this card: 1. **Distant characters cast sun shadows again.** With everything traced, a character about 30 m away cast nothing on the ground while a planter beside her did. She is in the top level, filter and history off change nothing, and `RX_VK_RT_CHANNELS=1353` brings the shadow back: `channels_default` puts the traced shadow into a alone, and the lit programs seem not to take a past the static map's range. We give g the traced shadow as well (3 where you have 7), at the price of the squared penumbra your note avoids. You may know a better way. 2. **The bottom levels' budget follows the video memory** (768 MB up to 8 GB, an eighth above that, at most 4096). The Market wants about 1.2 GB here; at 768 thousands of bottom levels were let go and built again every 600 frames and shadow casters came and went with the camera. 3. **`FULL` is split into micromaps and position fetch.** This card has only the second, so hits had no face normals; now they do. 4. **Cut-outs are tested in the rays where there are no micromaps** (`RX_VK_RT_ALPHA=1`): the same opacity bits, baked, as a quick "may be covered" test in the ray query's candidate loop, and for a covered cell the game's own texture sampled at the hit, as an any-hit shader would (the sun's, the AO's and GI's rays; lamp shadows and the reflections' lookup keep the bits alone). In your ray shaders that is an `#ifdef` block and `RT_PROCEED(q)` in place of the loop; your generated headers are untouched, ours are extra ones. 5. **Terrain patches are open at the game's holes on that path.** Without micromaps `holes_note` returns at once, so a patch is the full grid. Kakariko's ground lies below the height field, in holes, and by night the whole village was in shadow: its sun rays ended 8 to 15 m up on the back of a patch. We bake a patch's bits from the same map and test the texel at the hit (a hole where `max(red, green)` is over 0.5019). The sun term's mean in that view went from 72 to 131 of 255, and it now looks like the game's own. 6. **The `kBlocker` class is far only on that path**: a sun ray whose receiver is within 50 m of the camera passes it (`RX_VK_RT_BLOCKER_NEAR`, 0 = as you have it). This one may matter to you on every device. The class holds the game's own low-detail shadow models, ordinary meshes the camera never draws, batched at the level's matrix, and in them a tree's leaf cards are solid polygons with no alpha anywhere. The game uses them where its static shadow map applies, far away; in the rays they are hit at every distance, so a tree's sun shadow near the camera is filled whatever the real leaves' alpha says. Measured at a pine in the Market by night (mean brightness of the shadow, the game's own about 84): 55 as it was, 62 with the texture test alone, 81 with both. Its price: a real object the camera has not drawn yet casts nothing onto receivers within that distance until it has been seen once. We found nothing that tells the shadow models from such objects: not the pass (the cascades draw them too, at times), not the vertex layout. The rest of what we touch in your files is hook lines: a hidden state the parts ask (F8, below), one function each asks for its debug picture (F7), and calls into our files where a draw is noted, a lit draw is seen, a program's module is made and GI's added term is ready. ### What we add - **The game's lamp list** for the passes (the layout is JayDeGoodz's, #815), and **ray-traced shadows for those lamps**: a fifth row (`RX_VK_RT` bit 16), a patch in the lit programs' light loop. - **Lights from what glows.** The list is short, and in the towns at night nearly every lantern and window is a glowing material with no lamp. We read a program's emission from its SPIR-V and make sphere and area lights of lantern bulbs, lantern glass and window panes (a batched draw split into its islands), kept in a world grid so that which lights reach a surface depends on the surface's place, not the camera's. One thing found on the way that your glow records may want: the glass of the Market's door lanterns (`a1c74226a51fb7ce`) and the window panes (`f76f461080f8dc36`, `3be28542db4ee637` in Kakariko) end in `lit + emissive * c5[106] * c6[225]`; `c6[225]` is the frame's emission scale, and no glow record is made for them. - **Those lights in the picture** (a sixth row, `RX_VK_RT` bit 32): a pass after the lit draws, at the fog's composite, with a shadow ray a light, the diffuse term and a GGX highlight. It needs what a forward renderer does not keep, so the lit programs now store it: **guide buffers** (shading normal with the normal map, roughness, albedo, F0) written by a SPIR-V patch like yours, as image stores; every guide in 77.8 % of the cache's lit stages. They are also what a denoiser or Ray Reconstruction will ask for. - **Colours at hits** (`RX_VK_RT_HIT=1`, pictures `RX_VK_RT_DEBUG=hitc`; not in GI's or the reflections' hits yet): a lit program's base colour read from its SPIR-V and folded per draw into a few steps a hit shader runs, with records for the ground and the mesh-shader cards too. Primary rays find the game's texture colour on 99.9 % of the screen in Kokiri Forest and the Market and 97 % in Hyrule Field. - **For looking and tuning.** F8 ("Ray tracing: show") flips between the game's own picture and the traced one. F7 ("Ray tracing: view") shows AO, sun shadows, the lamps' direct light, GI, reflections or a guide buffer alone. F4 to F6 step through and change look settings (the lights' strength, reach and warmth, your `SUN_SOFT`, `FILTER` and `HISTORY`, the AO's and GI's strength), saved with the options. And three diagnostics that found points 5 and 6: the biggest instances of the top level told, a list of geometry to leave out, and sun probes that name what a pixel's sun ray meets. ### Still open on this card - **Reflections in water show flat blobs** (a pond in Hyrule Field, Zora's Fountain): a hit that was not on the kept picture is the instance's mean albedo lit flat, so a tree is a green patch. We are giving those hits the record's texture colour. - **A tree's shadow** is much better with points 4 and 6 and still looks off beside the game's own. - **GI's light changes about 4.5 % a frame on a still camera** (your `RX_VK_RT_GI_STABLE` counter, Kakariko by night; 4.2 % by day). Sixteen rays bring it to 3.2 %, the clamp, the feedback and a history of 64 or 128 frames change little: about 3 % is a floor that is not ray noise. A variance-guided filter of ours did no better and is not on the branch. - **Cost, measured again on 16 Nov without a frame rate cap** (1707x960 internal, AO Medium, every row on; GPU times from `RX_VK_GPU_PROFILE`). *This point said before that the reflections were most of the frame in towns at night, 12 fps against 42. That was wrong: the pair was probably taken with the slower lookup of `RX_VK_RT_VIEWS=1` linked in, and it does not hold for the ordinary build.* The Market at night: 74.6 fps with ray tracing off (GPU 10.0 ms a frame), 33 to 38 with everything on (20 to 24 ms). The largest part of what is added there is ours: the lantern lights' pass, up to 7 ms, which we are cutting down. Yours: the mask part's rays 3.7 ms (AO at Ultra instead of Medium adds 1.3 to 1.5), GI's rays and filters about 1 ms, the scene's builds 0.9 ms. The reflections by the max roughness row: in the Market off 39.5 fps, Low 38.7, Medium 31.6, Max 27.6 (about 1, 6 and 11 ms in the lit passes); facing a pond in Hyrule Field by day, water over about a third of the picture, off 44.2 fps, Low 37 to 41, Medium 29.1, High 27.9, Max 20.8 (the lit passes 6.2 ms with them off, 8 to 10 at Low, 18.8 at Medium, 20.4 at High, 32.5 at Max). So they are cheap at Low and where little water is in view, and by far the largest cost above Low with water in view. On the CPU the renderer thread works 12.5 ms a frame there against 7.8 with ray tracing off (about 3 ms of it in the top level at 2,200 instances); by day in the Market it is the limit: about 10 ms a frame in the top level at 6,400 to 7,400 instances. - **The transform feedback capture** lost the device in the Market at 500a01a9, before you turned it off by default. We have not run it since: the repeated device losses took the PC down twice. We have the bisection's notes if they help. - **A first start with the rows on** took about 17 minutes building pipelines; later starts about 3.5. Not tested: Linux, frame generation with the rows on.
fix(vk-rt): a gem's mirror ray takes the normal its program looks the sphere map up by, so a spinning rupee's reflection no longer breaks into a flickering mosaic
Some checks failed
PR description / Description follows the template (pull_request_target) Successful in 5s
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
Guide screenshots / Guide images and local UI source review (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
94af255926
The traced sphere map (rt_refl_sheen) took the facet's normal from the neighbouring pixels' places (dFdx/dFdy), which jumps from one 2x2 quad to the next as the gem spins: the mosaic over a moving rupee. The map's coordinate is made as (fma(0.5 x, cos t, -0.5 y sin t) + 0.5, fma(-0.5 y, cos t, ...) + 0.5) from the program's view-space normal (its normal map in it), so the linker now hands each fma's first operand to rt_refl_sheen (rt_refl_in_normal), which turns it into the world by the camera's axes; where the coordinate is not made so, the facet's normal as before. RX_VK_RT_REFL_SHEEN_BITS / ctl sheenbits= (a test's: 1, 2 the normal's x, y turned over; 4 the facet's normal).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Author
First-time contributor

Pushed 94af2559: a rupee's traced gem took its mirror normal from the position's screen derivatives, which jump from one 2 x 2 quad to the next as the gem spins: in play its facets broke into a blocky speckle that changed every frame (over the gem 0.033 a frame of change in a recording, the background 0.002). The mirror ray now uses the normal the program itself looks its sphere map up by (the view-space normal, its normal map included, read from the two fmas that make the map's coordinate) turned into the world with the camera's axes; where that pattern is not found the old normal stays. Close crops of a blue rupee: the old normal shows the same mosaic as the recording, the new one clean reflections. A frame-to-frame number before/after could not be taken here (shots at 4K are not consecutive while the gem spins), so that check is left to a recording in play. Both gem programs' patched modules pass spirv-val.

Checks: the same 18 failures as main.

Pushed 94af2559: a rupee's traced gem took its mirror normal from the position's screen derivatives, which jump from one 2 x 2 quad to the next as the gem spins: in play its facets broke into a blocky speckle that changed every frame (over the gem 0.033 a frame of change in a recording, the background 0.002). The mirror ray now uses the normal the program itself looks its sphere map up by (the view-space normal, its normal map included, read from the two `fma`s that make the map's coordinate) turned into the world with the camera's axes; where that pattern is not found the old normal stays. Close crops of a blue rupee: the old normal shows the same mosaic as the recording, the new one clean reflections. A frame-to-frame number before/after could not be taken here (shots at 4K are not consecutive while the gem spins), so that check is left to a recording in play. Both gem programs' patched modules pass `spirv-val`. Checks: the same 18 failures as main.
RX_VK_RT_BLAS_MB defaulted to 768 on every card. In Castle Town's market
the scene wants about 1200 MB on a Radeon RX 9070 XT (15,000 bottom
levels), so thousands of them were let go and built again every few
seconds, and shadow casters came and went with the camera; with 3072 set
by hand the market held still.

The default is now 768 for a card with 8 GB or less (no room to spare
there: as before), and an eighth of the video memory above that, at most
4096: 1536 on 12 GB, 2048 on 16 GB. The switch, when set, wins as before.
The rule is in gpu/vk/rt_budget.h, and the scene logs the budget once.

Tests: tests/test_rt_budget.py (the rule's values, and that the scene
takes its default from it and still reads the switch). Not yet run in the
game with the default: the market was checked with RX_VK_RT_BLAS_MB=3072.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
(cherry picked from commit e257d5e4fa)
Without VK_EXT_opacity_micromap (AMD's Windows driver on a Radeon RX 9070
XT) the scene could only take a cut-out as a whole triangle, so the
reflections' and GI's rays left the cut classes out and the sun's rays
met solid cards. With RX_VK_RT_ALPHA=1 (off by default) the opacity bits
the micromap bake computes are baked anyway, kept in an arena with a
record per instance, and looked up in the ray query's candidate loop from
the hit's barycentrics; cut-out instances are no longer forced opaque.

- rt_hit_math.h, vk_rt_hit.cpp: the lookup (a barycentric point to its
  micro-triangle, the inverse of the micromap's order), the bake (the
  scene's own rt_scene_cut.comp, run as it is), the arena and the table.
- shaders/rt_alpha.glsl and nine new variants in headers of their own,
  made by rt_alpha_build.sh. The four ray shaders get an #ifdef ALPHA
  block each and RT_PROCEED in place of their loops; every variant that
  existed before compiles to the same bytes as before, so the committed
  headers are untouched. A loop passes at most 24 candidates over and
  then confirms the rest, so it always ends.
- FULL is split into OMM and FETCH: a GPU with position fetch but no
  micromaps now gets face normals at hits.

Covered: static cut-outs. Not yet: mesh-shader cards (grass, ferns, leaf
cards), terrain holes, skinned cut-outs, and programs whose coordinate
the cut rule does not read; alpha is taken at the texture's level 0 with
the fixed threshold.

In the game (Windows 11, RX 9070 XT, driver 26.11.1; seven runs, none lost
the device): in Kokiri Forest the structure agrees with the game's depth
on 85.9 to 86.05 % of the screen with the cut classes in (83.9 % as whole
triangles, 86.7 % with them left out); at Zora's Fountain the share of
water pixels whose reflection ray finds nothing falls from 26.8 to 23.9 %
and from 21.9 to 18.3 %; the cut class alone shows stems and blades with
their shapes; the sun's shadows in Kokiri show no visible change. GPU time
at Zora's Fountain with all four parts: 16.4 to 18.1 ms a frame (one run
each).

Tests: tests/test_rt_hit.py (the lookup by exhaustion for levels 3 to 5).

Co-Authored-By: Claude Fable 5.2 <[email protected]>
(cherry picked from commit 02c62e47f6)
The grass, ferns, flowers and leaf cards are most of the cut-out geometry
outdoors, and without opacity micromaps they were whole opaque quads in
the structure. With RX_VK_RT_ALPHA=1 their opacity bits are baked by the
scene's own rt_scene_omm.comp (the card build and the outline-only build)
into a range of the bits arena kept for each mesh draw, which lives as
long as its bottom level, not as long as the frame's capture arena. Mesh
instances with bits are no longer forced opaque and get a table record;
the candidate loop is the one the static cut-outs use.

In the game (Windows 11, RX 9070 XT, driver 26.11.1, Kokiri Forest; five
runs, none lost the device): the structure agrees with the game's depth
on 92.9 % of the screen (86.0 % with static cut-outs alone, 83.9 % with
whole triangles, 86.7 % with the cut classes left out), and the grass
blades and vine leaves show their shapes in the scene's debug picture.
GPU time with all four parts: 10.2 to 11.0 ms a frame (one run each). At
Zora's Fountain the share of water pixels whose reflection ray finds
nothing falls by about 3 points, as with static cut-outs alone. Whether
the sun's shadows of plants change visibly could not be told from two
runs' pictures.

Not covered: the static shadow map's pooled mesh draws (solid casters),
terrain holes, skinned cut-outs.

Tests: tests/test_rt_hit.py.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
(cherry picked from commit 96c1037cbf)
The scene's status line says "37.0 in the top level, 6.5 cut by a micromap": the 6.5 is the mesh draws captured this
frame that have cards (st_cards), not the instances with bits, so it cannot say which entries lack them. Every instance
placed is now tallied by its mask's class (opaque, cutout, skinned, cascade, foliage, late, blocker, caster) and, if it
has no bits, by the reason: not in the cut family, skinned, no texture yet, the frame's budget, arena full, not baked,
a mesh draw that is not cards, the static shadow map's. Every 600 frames (RX_VK_RT_ALPHA_CENSUS=1, off by default) a
`vk: rt alpha census:` line gives a frame's mean of each, and a second line the triangles and micro-triangles baked.
hit::cut and hit::mesh_bake say why they gave none.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
(cherry picked from commit 892d4ffbec)
The mesh cards' bits were baked at mesh_omm_level(), the micromaps' RX_VK_RT_OMM_LEVEL (default 3): 64 micro-triangles a
triangle, 8 cells to a side, for cards whose texture is a layer of a 128 x 128 or 256 x 256 array holding a cluster of
leaves (census-market-2). A sun shadow cut by that is a blob. They now have a level of their own,
RX_VK_RT_ALPHA_MESH_LEVEL (3 to 5, default 5; the Market's mesh draws are 35k triangles in room, 4.5 MB at level 5), and
when the arena has no room for a draw's bits at that level it takes the finest that fits instead of leaving the cards
whole. The static cut-outs stay at level 4 (RX_VK_RT_ALPHA_LEVEL, when set: for every draw) but a draw of up to 4096
triangles (a card, a bush) is baked at 5 while the arena is under 5/8 full; the frame's budget of triangles counts a
level-5 triangle as four. The arena's default is 128 MB (RX_VK_RT_ALPHA_MB) for that. rt_hit_math.h has the choice and
the weights, tested in tests/test_rt_hit.cpp.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
(cherry picked from commit e81c765c8c)
rt_alpha_solid confirmed every candidate past kAlphaCap (24) as solid so that the loop always ends. A sun ray runs 300 m
through the top level, and through a canopy of cards it meets dozens of triangles (each card two, the leaves' cards lying
over one another), most of them holes: past the 24th the ray was dark whatever the leaves were, which makes a soft blob of
the thick middle of a crown. 64 still bounds the loop. Not settled without a run: how many rays reach either cap.
Our ALPHA variant headers are made again (rt_alpha_build.sh, rt_hit_build.sh, rt_lamp_build.sh, rt_show_build.sh, glslang
16.6.0); no header of #727's differs from pr/727.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
(cherry picked from commit b8d52221de)
A skinned cut-out was never given bits: cut_note was skipped for it (`cutout && !n.skinned`) and cut_bits returned none for
n.skinned, so its instance was FORCE_OPAQUE and a ray hit the whole card. Its triangles and their texture coordinates do not
change with the pose, and its bottom level is built from the draw's own index buffer (the skin shader moves the vertices
only), so primitive i of the bottom level is triangle i of the draw: the bits baked for the draw serve every pose. cut_note
now runs for a skinned draw and cut_bits places the bits at the skinned instance, the kept skinned objects too
(RX_VK_RT_ALPHA_SKINNED=0: whole as before; the hit record's matrix of a skinned draw stays as it was). Not seen in a run:
whether every skinned cut-out program's coordinates are attribute 8 as cut_note reads them.
tests/test_rt_hit.py checks the new hooks and switches (census off by default, the mesh level, the level fallback, skinned),
and the docs' "Cut-outs without micromaps" says what has bits at what level and what has none.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
(cherry picked from commit 0b0798a849)
The bake of the mesh cards (level 5: 1024 texture lookups a triangle) ran at every capture of every draw, about 48,000
triangles a frame in the castle approach, +1.7 to +3 ms of GPU. Its input is the records' texture coordinates and layer
(the wind moves the cards' positions, not these), so rt_hit_uvhash.comp hashes them per capture, in the records' order (the
bits are by triangle number), and the last workgroup compares the hashes and the corner count with those of the bake the bits
stand from and writes the groups of the bake (vkCmdDispatchIndirect): none when the same. A new texture view, threshold,
shape, range or level forces a bake, and so does a check every 600 frames (a texture's pixels may change under a view). A
draw whose bits are baked again on most of 16 captures is churning (the culled set or the order the compute fallback writes
the records in changes from frame to frame: nothing to keep) and is baked at level 4. The census line gives captures
asked, baked (GPU's count, read back late), reused and the churning draws.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
(cherry picked from commit 33229e7f5f)
Drommedhar's cut-outs without micromaps (RX_VK_RT_ALPHA=1), pulled from their branch with their authorship, kept their headers as of #727's older sources; made again here with rt_alpha_build.sh. No other header changes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The hit records (RX_VK_RT_HIT, textured hits) stay in Drommedhar's #1151; this branch took their cut-outs without micromaps and not the records, so the check of a record's matrix goes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
feat(vk-rt): the Graphics tab's ray tracing section is marked Experimental
Some checks failed
PR description / Description follows the template (pull_request_target) Successful in 5s
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
Guide screenshots / Guide images and local UI source review (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
19f973b081
Its title is now "Ray tracing (Experimental)", in the menu, the README and docs/ray-tracing.md: the parts are new, off by default, and tested on few cards so far.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Author
First-time contributor

@Drommedhar thank you for this, and for the careful write-up on #1151. The base fixes are exactly what #727 needed, and the AMD numbers are the first we have from a card without opacity micromaps.

What I pulled into #727 (cherry-picked with -x, your authorship kept, so the commits stay yours):

Yours Here What
e257d5e4 6a30e8cb the bottom levels' budget follows the card's video memory (rt_budget.h)
02c62e47 57a44c3d cut-outs tested in the ray loop without micromaps (RX_VK_RT_ALPHA=1), and FULL split into micromaps and position fetch, so a card with fetch but no micromaps gets face normals
96c1037c cf41d9c1 mesh-shader cards cut in the ray loop too
892d4ffb 8a4845ff RX_VK_RT_ALPHA_CENSUS
e81c765c c6cab366 level 5 for the mesh cards and small cut-outs, 128 MB arena
b8d52221 af1a4bec 64 candidates before the rest count as solid
0b0798a8 f060b4b0 skinned cut-outs get bits
33229e7f de19b9bd a mesh draw's bits are kept, rebaked only when the cards' coordinates change

cdba9fe3 regenerates the ALPHA headers from this branch's sources (rt_alpha_build.sh, no other header changed). I dropped the lines that only your other work uses (the census and hit-record calls, the lamp and show variants). The full checks give the same 18 failures as main.

Not pulled, so still on your side in #1151:

  • da99df60, the exact test, and a7dab713, the terrain holes without micromaps. Both need the bindless table and the hit records. Textured hits stay off in #727 for now: they are what was running when this PC bugchecked, and I will only turn them on after a GPU-assisted validation pass. Once #727 lands, these two can come in with your textured hits.
  • The blocker rule (RX_VK_RT_BLOCKER_NEAR) clashes with something newer in #727. Since 718a2d02, Kokiri's falling leaves are captured by transform feedback and placed as kBlocker (0x40), so only the sun's rays meet them. With your rule, a leaf within 50 m of the camera would cast no shadow. I suggest giving the leaves a mask bit of their own before the rule lands. I can do that on #727 if you want to rebase onto it.
  • The game's lamp list and lamp shadows (bit 16), the lantern and pane lights with the guide buffers and DI (bit 32), hit colours, the recipe and roles, the emit census, the F4 to F8 views and look settings, and the diagnostics: all yours, on top of #727.
  • fe6dad1a, the traced sun shadow into the cascades' channel g, and the lantern and window glow scale from c6[225]. I'll measure both on an RTX 5090 with before and after pictures and report here. Our lantern reflections are missing today, so the second may well be the reason.

Your XFB device lost is fixed. 9a818a6 closes the capture with boundary(B_DIRECT) and keeps the pending capture thread-local. It passed a GPU-assisted validation run, and the capture has been on by default since 9033cf99.

I'm happy to run #1151 on the RTX 5090 (validation first, then pictures and GPU times) whenever it helps. Thanks again!

Two small things on #727's side. bdc61afd drops test_rt_hit.py's check of the hit record's matrix, since the records aren't here. 19f973b0 renames the Graphics tab's section to "Ray tracing (Experimental)". Next I'll rebase #727 on current main (it is 138 commits behind) and force-push it. That moves the base your branch stacks on (f70c348), so #1151 will need a rebase too, and I'll say here when it's done.

@Drommedhar thank you for this, and for the careful write-up on #1151. The base fixes are exactly what #727 needed, and the AMD numbers are the first we have from a card without opacity micromaps. **What I pulled into #727** (cherry-picked with `-x`, your authorship kept, so the commits stay yours): | Yours | Here | What | |---|---|---| | e257d5e4 | 6a30e8cb | the bottom levels' budget follows the card's video memory (`rt_budget.h`) | | 02c62e47 | 57a44c3d | cut-outs tested in the ray loop without micromaps (`RX_VK_RT_ALPHA=1`), and `FULL` split into micromaps and position fetch, so a card with fetch but no micromaps gets face normals | | 96c1037c | cf41d9c1 | mesh-shader cards cut in the ray loop too | | 892d4ffb | 8a4845ff | `RX_VK_RT_ALPHA_CENSUS` | | e81c765c | c6cab366 | level 5 for the mesh cards and small cut-outs, 128 MB arena | | b8d52221 | af1a4bec | 64 candidates before the rest count as solid | | 0b0798a8 | f060b4b0 | skinned cut-outs get bits | | 33229e7f | de19b9bd | a mesh draw's bits are kept, rebaked only when the cards' coordinates change | cdba9fe3 regenerates the ALPHA headers from this branch's sources (`rt_alpha_build.sh`, no other header changed). I dropped the lines that only your other work uses (the census and hit-record calls, the lamp and show variants). The full checks give the same 18 failures as main. **Not pulled, so still on your side in #1151:** - da99df60, the exact test, and a7dab713, the terrain holes without micromaps. Both need the bindless table and the hit records. Textured hits stay off in #727 for now: they are what was running when this PC bugchecked, and I will only turn them on after a GPU-assisted validation pass. Once #727 lands, these two can come in with your textured hits. - The blocker rule (`RX_VK_RT_BLOCKER_NEAR`) clashes with something newer in #727. Since 718a2d02, Kokiri's falling leaves are captured by transform feedback and placed as `kBlocker` (0x40), so only the sun's rays meet them. With your rule, a leaf within 50 m of the camera would cast no shadow. I suggest giving the leaves a mask bit of their own before the rule lands. I can do that on #727 if you want to rebase onto it. - The game's lamp list and lamp shadows (bit 16), the lantern and pane lights with the guide buffers and DI (bit 32), hit colours, the recipe and roles, the emit census, the F4 to F8 views and look settings, and the diagnostics: all yours, on top of #727. - fe6dad1a, the traced sun shadow into the cascades' channel g, and the lantern and window glow scale from `c6[225]`. I'll measure both on an RTX 5090 with before and after pictures and report here. Our lantern reflections are missing today, so the second may well be the reason. **Your XFB device lost is fixed.** 9a818a6 closes the capture with `boundary(B_DIRECT)` and keeps the pending capture thread-local. It passed a GPU-assisted validation run, and the capture has been on by default since 9033cf99. I'm happy to run #1151 on the RTX 5090 (validation first, then pictures and GPU times) whenever it helps. Thanks again! Two small things on #727's side. bdc61afd drops `test_rt_hit.py`'s check of the hit record's matrix, since the records aren't here. 19f973b0 renames the Graphics tab's section to "Ray tracing (Experimental)". Next I'll rebase #727 on current main (it is 138 commits behind) and force-push it. That moves the base your branch stacks on (f70c348), so #1151 will need a rebase too, and I'll say here when it's done.
winterelfeas force-pushed feat/ray-tracing from 19f973b081
Some checks failed
PR description / Description follows the template (pull_request_target) Successful in 5s
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
Guide screenshots / Guide images and local UI source review (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
to 515fe79454
Some checks failed
beanstalk/approval waiting for a BigBean's 👍 on the request
Website / Website on Cloudflare (pull_request_target) Has been skipped
PR description / Description follows the template (pull_request_target) Successful in 5s
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
Guide screenshots / Guide images and local UI source review (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
Website / Website on Cloudflare (pull_request) Has been cancelled
2026-11-16 17:57:34 +00:00
Compare
Author
First-time contributor

Rebased onto main 5c284721 (force-pushed, 515fe794). @Drommedhar this moves the base #1151 stacks on again, sorry for the churn.

Since the last push:

  • f3dfa041: the ray tracing parts' shaders go through main's new builtin_spv (RX_VK_SHADER_DIR), so test_builtin_spv.py passes.
  • 625dce16 (from the scene part): falling leaves keep their sun shadow as they land. A leaf is a two-sided card, and the back-face rule for rays starting under the solid world was passing a leaf's underside within 25 cm of the ground.
  • 515fe794: the AO's ALPHA variant made again.
  • Description: Drommedhar's RX 9070 XT run is now under Tested (with thanks), the two missing switches are in the flag list, and the run_all line compares against main in the same environment.

Still to come before ready: the main-against-PR measurements (running now on this PC, with GPU-assisted validation first), the docs/tested/ files, and a Linux build. There's no Linux here, so @Beanstalk please build this branch on Linux when the farm can.

Rebased onto main 5c284721 (force-pushed, 515fe794). @Drommedhar this moves the base #1151 stacks on again, sorry for the churn. Since the last push: - f3dfa041: the ray tracing parts' shaders go through main's new `builtin_spv` (`RX_VK_SHADER_DIR`), so `test_builtin_spv.py` passes. - 625dce16 (from the scene part): falling leaves keep their sun shadow as they land. A leaf is a two-sided card, and the back-face rule for rays starting under the solid world was passing a leaf's underside within 25 cm of the ground. - 515fe794: the AO's ALPHA variant made again. - Description: Drommedhar's RX 9070 XT run is now under Tested (with thanks), the two missing switches are in the flag list, and the run_all line compares against main in the same environment. Still to come before ready: the main-against-PR measurements (running now on this PC, with GPU-assisted validation first), the `docs/tested/` files, and a Linux build. There's no Linux here, so @Beanstalk please build this branch on Linux when the farm can.
Member

@winterelfeas only members of BigBeans can start the farm.

One of them can approve this request by reacting 👍 to it. This request was for 515fe79, and the PR has changed since (46c24c4), so a 👍 no longer approves it. Comment @Beanstalk again to ask for the new commit.

@winterelfeas only members of `BigBeans` can start the farm. ~~One of them can approve this request by reacting 👍 to it.~~ This request was for `515fe79`, and the PR has changed since (`46c24c4`), so a 👍 no longer approves it. Comment `@Beanstalk` again to ask for the new commit.
The section came with Drommedhar's commits and named their recipe switch (RX_VK_RT_HIT), which stays in their #1151.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Every micromap (the mesh draws' cards in the arena, the terrain patches' holes, the models' cuts, the static shadow map's pooled mesh draws) packed its states and its VkMicromapTriangleEXT array at 16 bytes; the build wants both at multiples of 256. The layout now comes from one set of helpers in vk_rt_scene.cpp (omm_align, omm_states_bytes, omm_triangles_at, omm_bytes), and the pooled draws' reservation (rt_scene_mesh.comp) and array (rt_scene_omm.comp) do the same sums. No MeshDraw field is added: the build finds a triangle array from its data's start with omm_triangles_at (a field put mid-struct by the first try, 8c3b113, took a brace list's 1 as an address and lost the device).

omm_build_ok looks at each build info before it is queued: data and triangle array non-zero and 256-aligned, stride 8. For the holes and cuts it is looked at before any of the draw's jobs are recorded; a draw that fails it is left out that frame (said once), as when there is no room. A micromaps' arena that is not 256-aligned turns the micromaps off (cards whole, as without the extension); a pool that is not leaves the pooled draws without cards.

tests/test_rt_omm_layout.py holds it: MeshDraw's members in order, every VkMicromapBuildInfoEXT made from its sType alone and filled field by field, omm_build_ok before every queued build, every triangle array address from omm_triangles_at, the shaders' sums; compiled, the helpers against a model of the shader's reservation over a grid of sizes, levels and fills; and broken copies of the text caught. It fails on the code before this commit.

Ported onto this branch after GPU-assisted validation reported 07515 in Kokiri (20 messages a run at least): the falling leaves' micromaps (36a42f87), which had their own 256-byte sums, now take the same helpers and omm_build_ok; Drommedhar's bits bake runs rt_scene_omm.comp without the pool's header bit, so its triangle array is its own scratch, unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The mesh-shader draws, the static shadow map's mesh draws and the transform-feedback draws each take a slot of the counts buffer (kMeshSlots, 1024). Slots were only ever handed out: let_statics_go and the idle eviction dropped the bottom levels but kept the slot (the eviction kept the entry too), so after about a thousand keys, which a few areas' static shadow maps reach, every later capture returned at once and the foliage left the top level for the rest of the session.

MeshSlots hands slots out and takes them back; a slot let go is given again once kMeshSlotQuiet (8) frames have passed, past the frames that may still write it or read it back. let_mesh_go drops an entry's bottom level and micromap and gives its slot back; let_statics_go and the idle eviction use it, and the eviction now erases an idle entry (a static shadow map's own keep theirs until the batch is let go). An entry is idle by the later of its bottom level's last placement and its last capture (MeshEntry::noted), so a draw captured after the top level and placed next frame is not taken for idle. A capture that finds no slot drops the entry it made.

tests/test_rt_mesh_slots.py checks the three captures and both let-gos from the source, and compiles MeshSlots over the cases (every slot once, reuse not before quiet, fifty areas of 300 draws never running out), with broken variants.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Where the device has no opacity micromaps (RX_VK_RT_ALPHA=1), the scene made an instance with baked bits FORCE_NO_OPAQUE and hit::place wrote its record; flush grew the instances' table to the frame's count. When the larger table could not be made, flush logged and returned without uploading, while the instances past the old capacity were already not opaque: the rays' any-hit loop read their records past the table.

place() now grows the table itself when an instance does not fit (grow_table: the old table let go when the frames that read it are done) and returns whether it kept the record; the scene sets FORCE_NO_OPAQUE from that, so an instance the table cannot hold has no bits that frame and stays opaque. flush writes at most the table's capacity of records. The failure is said once.

tests/test_rt_hit.py checks that the three placements take FORCE_NO_OPAQUE from place()'s answer, that place() refuses an instance past the table it cannot grow, and that flush writes no record past the table (both broken variants fail it).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
hit::tally is called for every instance of the top level every frame (three placements in vk_rt_scene.cpp) and took the alpha part's mutex each time only to count when RX_VK_RT_ALPHA_CENSUS=1. The census flag is now an atomic read before the lock: with the census off (the default) a placed instance costs one relaxed load.

tests/test_rt_hit.py checks the early return.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A one-program test switch: it logged that mesh program's draws forty times and was meant to place its instances under a mask of their own, but the mask was set after the instance was pushed into the top level's list, so it never took effect. Nothing documents or tests it, and RX_VK_RT_DEBUG=tlas with RX_VK_RT_DEBUG_FILE shows an instance's program and mask already. Removed rather than fixed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Each part makes its pipelines once and does not try again, so what a failed maker left behind stayed for the whole run:

- rt::hit's make_once made the bits (128 MB by default, up to 1 GB with RX_VK_RT_ALPHA_MB), the scratch and the instances' table in turn, and a later failure kept the earlier ones; make_pipeline's mesh-hash step kept its layout and 64 KB state buffer when the pipeline failed. unmake_all now destroys everything the part made when make_once fails.
- The scene's make_mesh kept the 96 MB triangle arena when the counts buffer failed; make_mean, make_omm, make_terrain, make_emission, make_ground and make_debug kept their pipeline layouts (and make_omm its arena, scratch and cut pipelines) when a later step failed. Each now destroys what it made; samplers others share stay.
- make_debug made the point sampler again over the one make_omm had made: it is now made once and shared.
- Every maker's push-descriptor set layout was needed only to make its pipeline layout and was never destroyed (scene: terrain, mean, emission, ground, omm, debug; GI's and the reflections' make_pipe). rt::TempSetLayout (vk_rt.h) destroys it when the maker returns. The parts' own set layouts that are bound later are unchanged.

rt::unmake (vk_rt.h) destroys a pipeline, pipeline layout, sampler or buffer and sets the handle back to none.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Several of the scene part's maps only grew over a session, keyed by guest addresses or geometry that change as areas stream:

- the terrain's strips (a host-visible buffer each),
- the leaves' cuts (a micromap, its buffer and a 200 KB index stream each),
- the materials by geometry,
- the glows' falloffs (keyed by the light's point to a millimetre),
- the capture's vertex modules,
- the skinned objects' keys (a vector per geometry, kept after its skins went),
- and vk_draw.cpp's capture pipelines (rt_xfb_pipeline's map, never destroyed).

Each entry now carries the last frame it was asked for or placed. prune_caches, run with the bottom levels' eviction every 64 presents, lets go of what was not asked for in RX_VK_RT_KEEP frames (900); the buffers and micromaps go through `later`, past the frames that may read them. rt_xfb_pipeline destroys a pipeline no capture used in 900 frames. The vertex modules are kept twice as long, so a module's handle cannot be made again while a pipeline keyed by it is still in the map. An entry let go is made again the next time a draw asks for it.

rt_xfb_pipeline still builds a new capture state's pipeline synchronously on the recording thread, under its own mutex. Its first eight builds now log how long they took, so the stall can be read from a run; it was not measured here (no game runs during the timing window).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
ensure_layout gave a lit program its ray tracing sets (1 for GI's term, then the reflection lookup's) only when rt::gi_set_layout() and rt::refl_set_layout() returned one. When either could not be made, the layout silently had the program's own set alone while its fragment module, already patched, still sampled set 1 or 2: every pipeline of that program was made against a layout its module does not match.

gi_patch_fragment and refl_patch_fragment now ask for their set layout first and patch nothing without it, said once. A program is never patched for a set its layout cannot have, so the mismatch cannot arise; ensure_layout logs once if it ever sees one.

rt::gi_present() was an empty function called every present: removed with its declaration and call.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The RT files' comments and the checks' docstrings named our own process instead of the reason: local results/ paths and scripts (vk_rt_gi.cpp, vk_rt_refl.cpp, rt_gi_spirv.h, rt_refl_spirv.h, the SPIR-V tests), private commit hashes that are not in this branch's history ("scene's 10230f9", "a736075", "a232c89"), session names ("mask's run", "mask's Market walk"), "the user's test" and bare dates and times (11-15, 11-16, 01:53) in vk_rt_scene.cpp, vk_rt_mask.cpp, the GI shaders and tests/test_rt_omm_layout.py and test_rt_static_orphan.py, "this driver" (vk_rt.h, vk_rt_scene.cpp: NVIDIA's, where it was measured) and "stage 1 of the design" (vk_rt_hit.h). Each now keeps what was seen and why it matters, or drops the reference.

xfb_note's comment said the capture was off by default since a device loss and RX_VK_RT_XFB=1 turned it on to test; it is on by default (xfb_mode, docs/ray-tracing.md), so the note goes.

Comments only: no code, and no shader's SPIR-V, changes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
docs/ray-tracing.md's switch table now lists RX_VK_RT_MESH=0 (no mesh-shader draws in the top level; the sun's shadow keeps the game's cascades for them) and RX_VK_RT_KEEP=<frames> (how long an unused bottom level, and now the scene's caches, is kept: 900); the bottom levels' paragraph names RX_VK_RT_KEEP too.

The GI paragraph said Kakariko is 2 / 8 m and RX_VK_RT_GI_AREA=<map> forces a row. Told by the light mask's combine, Kakariko does take Kokiri's row (2 / 8 m), but forced by name, KakarikoVillage was 3 / 10 m, an unmeasured row nothing else used. The row is now Kokiri's, the same either way, and the paragraph lists every forced row, Death Mountain Trail's included.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
RX_VK_RT_TERRAIN_MASK, RX_VK_RT_XFB_MASK, RX_VK_RT_SCENE_EARLY, RX_VK_RT_MAT_LOG, RX_VK_RT_LEAF_LOG and RX_VK_RT_XFB=2 with RX_VK_RT_XFB_DUMP were one-off investigation switches: no doc names them and no test uses them. RX_VK_RT_XFB keeps 0 (no capture) and 1 (the default).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Their clock=<hour> word asked the Cheats page's clock action through a new menu_ask_cheat_action, which went around cheats_on(): a debug file could change the game's state with cheats off. The word, the function and its docs go; a night test sets the hour from the Cheats page.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
fix(vk-rt): the makers' destroy helpers live in vk_rt_scene.cpp, not vk_rt.h
Some checks failed
beanstalk/approval changed since the request: ask again
PR description / Description follows the template (pull_request_target) Successful in 10s
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
Guide screenshots / Guide images and local UI source review (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
Website / Website on Cloudflare (pull_request) Has been cancelled
46c24c440a
test_recorder_sync.py holds that no header calls vkDestroy*: TempSetLayout's destructor and unmake() for pipelines, layouts and samplers are declared in vk_rt.h and defined after vk_work.h in vk_rt_scene.cpp.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
winterelfeas force-pushed feat/ray-tracing from 46c24c440a
Some checks failed
beanstalk/approval changed since the request: ask again
PR description / Description follows the template (pull_request_target) Successful in 10s
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
Guide screenshots / Guide images and local UI source review (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
Website / Website on Cloudflare (pull_request) Has been cancelled
to f5f3be39fa
Some checks failed
beanstalk/approval waiting for a BigBean's 👍 on the request
Website / Website on Cloudflare (pull_request_target) Has been skipped
PR description / Description follows the template (pull_request_target) Successful in 22s
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
Guide screenshots / Guide images and local UI source review (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
Website / Website on Cloudflare (pull_request) Has been cancelled
2026-11-16 22:02:30 +00:00
Compare
Author
First-time contributor

Measured, validated and rebased onto main 983d607b: the description's Measurements section has the numbers and a verdict. Everything is done from my side but the Linux build (the last unticked box), so this stays WIP only until the Test Farm has built it; reviews are welcome now.

Measurements (RTX 5090, Kokiri Forest, main against this PR, interleaved runs, medians):

  • With the rows off this PR costs nothing measurable. Both sides hold the 60 fps cap with the same GPU time a frame.
  • With all four rows on: 49.8 fps at 4K output with DLSS at 50%, and 32.3 fps at 4K DLAA.
  • Per part, in four places, on top of the structure itself (+1.0 to +2.3 ms):
    • AO costs about nothing, since it takes the game's SSAO's place.
    • Sun shadows +1.0 to +1.6 ms, GI up to +0.25 ms, reflections at Max +0.9 to +2.0 ms.
    • Video memory +1.1 to +1.5 GB.
  • Building the top level is CPU work on the render thread (1.2 to 5 ms a frame); moving it off is the next optimisation, in a later PR. Two docs/tested/ rows are added.

GPU-assisted validation (Kokiri Forest, all four rows on, with the opacity micromaps and with the path without them forced): no device lost, no out-of-bounds access, no invalid address. It found one issue in this PR: micromap data not 256-aligned. That's fixed (4171fade) and gone in its own run.

Since the last comment:

  • Review fixes:
    • mesh draws give their slots back;
    • the alpha table can't be read past its end;
    • failed makers free what they made, and the caches are pruned.
  • The control files' clock= (it went around cheats_on()) is removed, along with test switches nothing used.
  • Comments now give reasons, not our own process.

Device lost: one, in a run of this PR with the rows off, in a draw of the game's own program with no ray tracing in the frame (one nvlddmkm event 153). Nothing like it happened in the twenty-odd runs since. It's in the description.

@Beanstalk please build this branch on Linux and run the four Ray tracing rows as the Must be tested lines say. The Linux build is the one box I can't tick here.

Measured, validated and rebased onto main 983d607b: the description's Measurements section has the numbers and a verdict. Everything is done from my side but the Linux build (the last unticked box), so this stays WIP only until the Test Farm has built it; reviews are welcome now. **Measurements** (RTX 5090, Kokiri Forest, main against this PR, interleaved runs, medians): - With the rows off this PR costs nothing measurable. Both sides hold the 60 fps cap with the same GPU time a frame. - With all four rows on: 49.8 fps at 4K output with DLSS at 50%, and 32.3 fps at 4K DLAA. - Per part, in four places, on top of the structure itself (+1.0 to +2.3 ms): - AO costs about nothing, since it takes the game's SSAO's place. - Sun shadows +1.0 to +1.6 ms, GI up to +0.25 ms, reflections at Max +0.9 to +2.0 ms. - Video memory +1.1 to +1.5 GB. - Building the top level is CPU work on the render thread (1.2 to 5 ms a frame); moving it off is the next optimisation, in a later PR. Two `docs/tested/` rows are added. **GPU-assisted validation** (Kokiri Forest, all four rows on, with the opacity micromaps and with the path without them forced): no device lost, no out-of-bounds access, no invalid address. It found one issue in this PR: micromap data not 256-aligned. That's fixed (4171fade) and gone in its own run. **Since the last comment:** - Review fixes: - mesh draws give their slots back; - the alpha table can't be read past its end; - failed makers free what they made, and the caches are pruned. - The control files' `clock=` (it went around `cheats_on()`) is removed, along with test switches nothing used. - Comments now give reasons, not our own process. **Device lost:** one, in a run of this PR with the rows off, in a draw of the game's own program with no ray tracing in the frame (one nvlddmkm event 153). Nothing like it happened in the twenty-odd runs since. It's in the description. @Beanstalk please build this branch on Linux and run the four Ray tracing rows as the Must be tested lines say. The Linux build is the one box I can't tick here.
Member

@winterelfeas only members of BigBeans can start the farm.

One of them can approve this request by reacting 👍 to it or to this comment. This request was for f5f3be3, and the PR has changed since (a1ad9d9), so a 👍 no longer approves it. Comment @Beanstalk again to ask for the new commit.

@winterelfeas only members of `BigBeans` can start the farm. ~~One of them can approve this request by reacting 👍 to it or to this comment.~~ This request was for `f5f3be3`, and the PR has changed since (`a1ad9d9`), so a 👍 no longer approves it. Comment `@Beanstalk` again to ask for the new commit.
Owner

Awesome work! Can you please include screenshot of the settings?

Awesome work! Can you please include screenshot of the settings?
winterelfeas force-pushed feat/ray-tracing from f5f3be39fa
Some checks failed
beanstalk/approval waiting for a BigBean's 👍 on the request
Website / Website on Cloudflare (pull_request_target) Has been skipped
PR description / Description follows the template (pull_request_target) Successful in 22s
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
Guide screenshots / Guide images and local UI source review (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
Website / Website on Cloudflare (pull_request) Has been cancelled
to a1ad9d9b74
Some checks failed
Website / Website on Cloudflare (pull_request_target) Has been skipped
beanstalk/approval waiting for a BigBean's 👍 on the request
PR description / Description follows the template (pull_request_target) Successful in 4s
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
Guide screenshots / Guide images and local UI source review (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
Website / Website on Cloudflare (pull_request) Has been cancelled
2026-11-17 03:44:46 +00:00
Compare
Author
First-time contributor

Rebased onto main 54ef5ca3, with one speed fix and the switch table's rows. The description's Measurements, Testing and Screenshots are updated. It's still WIP only for the Linux build.

Since the last comment:

  • The sun gate's sums (cc5c18cf): the light mask's count of sunlit texels was 3 atomics per 8x8 group into host memory, over PCIe. They now go into a 16-byte device-local buffer, copied out once a frame; the CPU reads it as before.
    • The AO and sun shadows' "filter and write" span: 1.06 → 0.18 ms at the tester's settings, 4.31 → 0.70 ms at 4K DLAA.
    • Pictures and the gate's readings are unchanged; GPU-assisted validation is clean.
    • It's also the likely cause of the occasional 45 ms frames under load the earlier numbers mentioned.
  • The switch table (bd3ca8e6, for #1300): the 160 RX_VK_RT* switches each have a row in gpu/vk/switches.def. The light mask's tuning switches were read under a name built at run time; kNamed now names each one whole, so the check sees the reads.
  • New A/B against main 54ef5ca3 (RTX 5090, Kokiri Forest, interleaved, medians of 3, no device lost in 18 runs):
    • Rows off: the same as main at the 60 fps cap, with the same GPU time and video memory.
    • All four rows on: 51.9 fps at the tester's settings (4K output, DLSS at 50%) and 39.8 fps at 4K DLAA, against 49.8 and 32.3 before the fix.
    • The two docs/tested/ rows are replaced by this batch's.
  • Checks: run_all on Windows, 642 passed and 44 failed; main 54ef5ca3 fails the same 44 here (plus test_longshot_ctl's timeout). test_switch_table fails on main too, for RX_VK_PGO_FILE.

The Graphics tab's Ray tracing rows, as asked:

The Graphics tab: Ray tracing (Experimental)

Sun shadows, Kokiri Forest (off left, on right): leaf-over-leaf and stem shadows inside the plant, which the game's cascades don't resolve.

Sun shadows, Kokiri Forest: off left, on right

@Beanstalk please build this branch on Linux and run the four Ray tracing rows as the Must be tested lines say. The Linux build is the one box I can't tick here.

Rebased onto main 54ef5ca3, with one speed fix and the switch table's rows. The description's Measurements, Testing and Screenshots are updated. It's still WIP only for the Linux build. **Since the last comment:** - **The sun gate's sums** (cc5c18cf): the light mask's count of sunlit texels was 3 atomics per 8x8 group into host memory, over PCIe. They now go into a 16-byte device-local buffer, copied out once a frame; the CPU reads it as before. - The AO and sun shadows' "filter and write" span: 1.06 → 0.18 ms at the tester's settings, 4.31 → 0.70 ms at 4K DLAA. - Pictures and the gate's readings are unchanged; GPU-assisted validation is clean. - It's also the likely cause of the occasional 45 ms frames under load the earlier numbers mentioned. - **The switch table** (bd3ca8e6, for #1300): the 160 `RX_VK_RT*` switches each have a row in `gpu/vk/switches.def`. The light mask's tuning switches were read under a name built at run time; `kNamed` now names each one whole, so the check sees the reads. - **New A/B against main 54ef5ca3** (RTX 5090, Kokiri Forest, interleaved, medians of 3, no device lost in 18 runs): - Rows off: the same as main at the 60 fps cap, with the same GPU time and video memory. - All four rows on: 51.9 fps at the tester's settings (4K output, DLSS at 50%) and 39.8 fps at 4K DLAA, against 49.8 and 32.3 before the fix. - The two `docs/tested/` rows are replaced by this batch's. - **Checks:** `run_all` on Windows, 642 passed and 44 failed; main 54ef5ca3 fails the same 44 here (plus `test_longshot_ctl`'s timeout). `test_switch_table` fails on main too, for `RX_VK_PGO_FILE`. **The Graphics tab's Ray tracing rows**, as asked: ![The Graphics tab: Ray tracing (Experimental)](https://git.magicbean.dev/attachments/695472c3-273d-4812-90c7-ae5e843f1675) **Sun shadows, Kokiri Forest** (off left, on right): leaf-over-leaf and stem shadows inside the plant, which the game's cascades don't resolve. ![Sun shadows, Kokiri Forest: off left, on right](https://git.magicbean.dev/attachments/6d3d204e-947e-49c1-860d-5763100ad4b9) @Beanstalk please build this branch on Linux and run the four Ray tracing rows as the Must be tested lines say. The Linux build is the one box I can't tick here.
Member

@winterelfeas only members of BigBeans can start the farm.

One of them can approve this request by reacting 👍 to it or to this comment. This request was for a1ad9d9, and the PR has changed since (96cf669), so a 👍 no longer approves it. Comment @Beanstalk again to ask for the new commit.

@winterelfeas only members of `BigBeans` can start the farm. ~~One of them can approve this request by reacting 👍 to it or to this comment.~~ This request was for `a1ad9d9`, and the PR has changed since (`96cf669`), so a 👍 no longer approves it. Comment `@Beanstalk` again to ask for the new commit.
Author
First-time contributor

@HumanBean thanks! The settings screenshot is in the comment above (#727 (comment)) and at the top of the description's Screenshots: the Graphics tab's Ray tracing (Experimental) rows.

@HumanBean thanks! The settings screenshot is in the comment above (https://git.magicbean.dev/MagicBeanDev/Longshot/pulls/727#issuecomment-40421) and at the top of the description's Screenshots: the Graphics tab's Ray tracing (Experimental) rows.
winterelfeas changed title from WIP: feat(vk): ray-traced ambient occlusion, sun shadows, global illumination and reflections to feat(vk): ray-traced ambient occlusion, sun shadows, global illumination and reflections 2026-11-17 04:05:41 +00:00
winterelfeas changed title from feat(vk): ray-traced ambient occlusion, sun shadows, global illumination and reflections to WIP: feat(vk): ray-traced ambient occlusion, sun shadows, global illumination and reflections 2026-11-17 04:36:20 +00:00
winterelfeas force-pushed feat/ray-tracing from a1ad9d9b74
Some checks failed
Website / Website on Cloudflare (pull_request_target) Has been skipped
beanstalk/approval waiting for a BigBean's 👍 on the request
PR description / Description follows the template (pull_request_target) Successful in 4s
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
Guide screenshots / Guide images and local UI source review (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
Website / Website on Cloudflare (pull_request) Has been cancelled
to 96cf669b5a
Some checks failed
beanstalk/approval waiting for a BigBean's 👍 on the request
Website / Website on Cloudflare (pull_request_target) Has been skipped
PR description / Description follows the template (pull_request_target) Successful in 5s
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
Guide screenshots / Guide images and local UI source review (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
Website / Website on Cloudflare (pull_request) Has been cancelled
2026-11-17 05:19:27 +00:00
Compare
Author
First-time contributor

Rebased onto main 544229a2 (two commits, no conflict, no change of ours). run_all on Windows: 643 passed, 44 failed, the same 44 as main. The push reset the farm request, so again: @Beanstalk please build this branch on Linux and run the four Ray tracing rows as the Must be tested lines say.

Rebased onto main 544229a2 (two commits, no conflict, no change of ours). run_all on Windows: 643 passed, 44 failed, the same 44 as main. The push reset the farm request, so again: @Beanstalk please build this branch on Linux and run the four Ray tracing rows as the Must be tested lines say.
Member

@winterelfeas only members of BigBeans can start the farm.

One of them can approve this request by reacting 👍 to it or to this comment. This request was for 96cf669, and the PR has changed since (a88d251), so a 👍 no longer approves it. Comment @Beanstalk again to ask for the new commit.

@winterelfeas only members of `BigBeans` can start the farm. ~~One of them can approve this request by reacting 👍 to it or to this comment.~~ This request was for `96cf669`, and the PR has changed since (`a88d251`), so a 👍 no longer approves it. Comment `@Beanstalk` again to ask for the new commit.
winterelfeas force-pushed feat/ray-tracing from 96cf669b5a
Some checks failed
beanstalk/approval waiting for a BigBean's 👍 on the request
Website / Website on Cloudflare (pull_request_target) Has been skipped
PR description / Description follows the template (pull_request_target) Successful in 5s
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
Guide screenshots / Guide images and local UI source review (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
Website / Website on Cloudflare (pull_request) Has been cancelled
to a88d251e00
Some checks failed
PR description / Description follows the template (pull_request_target) Successful in 6s
beanstalk/approval waiting for a BigBean's 👍 on the request
Website / Website on Cloudflare (pull_request_target) Has been skipped
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
Guide screenshots / Guide images and local UI source review (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
Website / Website on Cloudflare (pull_request) Has been cancelled
2026-11-17 10:04:01 +00:00
Compare
Author
First-time contributor

Commit messages only, the code is byte for byte the same (same tree as 96cf669b): @JayDeGoodz is now a co-author (Co-Authored-By) of the two commits that carry his AO approach from #815, the traced AO into the game's own SSAO image and its quality steps, as he agreed on #815. One commit's author placeholder is corrected to mine. The push reset the farm request, so again: @Beanstalk please build this branch on Linux and run the four Ray tracing rows as the Must be tested lines say.

Commit messages only, the code is byte for byte the same (same tree as 96cf669b): @JayDeGoodz is now a co-author (Co-Authored-By) of the two commits that carry his AO approach from #815, the traced AO into the game's own SSAO image and its quality steps, as he agreed on #815. One commit's author placeholder is corrected to mine. The push reset the farm request, so again: @Beanstalk please build this branch on Linux and run the four Ray tracing rows as the Must be tested lines say.
Member

@winterelfeas only members of BigBeans can start the farm.

One of them can approve this request by reacting 👍 to it or to this comment. This request was for a88d251, and the PR has changed since (1327215), so a 👍 no longer approves it. Comment @Beanstalk again to ask for the new commit.

@winterelfeas only members of `BigBeans` can start the farm. ~~One of them can approve this request by reacting 👍 to it or to this comment.~~ This request was for `a88d251`, and the PR has changed since (`1327215`), so a 👍 no longer approves it. Comment `@Beanstalk` again to ask for the new commit.
fix(vk-rt): a captured draw's triangle with a corner parked off the view is left out of the scene
Some checks failed
beanstalk/approval changed since the request: ask again
PR description / Description follows the template (pull_request_target) Successful in 6s
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
Guide screenshots / Guide images and local UI source review (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
Website / Website on Cloudflare (pull_request) Has been cancelled
1327215a20
rt_scene_mesh.comp turned each captured corner (transform feedback: particles, Kokiri's falling leaves) into the world on its
own and only refused infinities and NaNs. A corner a vertex stage parks off the view (a dead particle, past the far plane)
unprojects to a finite place hundreds of metres away, and its triangle spans the area: every ray of the frame walks it, and
the sun's rays draw it as a huge shadow that comes and goes. With PR 227's Foliage distance at 125% in Kokiri Forest (the
leaves' area grows) the AO and sun rays went from 0.45 to 7.8 ms a frame and the game to 10 fps at one view.

Now the triangle is checked whole: an edge over 30 m (2 m for a falling leaf's draw, header bit 28) leaves it out. Measured
at that view (RTX 5090, 1080p headless, RX_VK_PASS_TIMING=2): 125% 10.7 -> 27 fps, AO and sun rays 7.8 -> 2.1 ms, the same as
with the leaves left out (RX_VK_RT_LEAF_PROGS=none); 100% unchanged (42 fps). What remains of 125%'s cost (0.46 -> 2.1 ms in
those rays) is not the leaves'.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The check of the commit before (an edge over 30 m leaves a triangle out) now covers every draw rt_scene_mesh.comp builds but the
static shadow map's pool, which is the world's own geometry. The mesh-shader foliage (Kokiri's bushes and flowers) parks the
instances it fades out at its distance off the view, and with PR 227's Foliage distance at 125% their triangles spanned the area as
the falling leaves' did: what was left of 125%'s cost after the leaves.

Measured at the same view (RTX 5090, 1080p headless, RX_VK_PASS_TIMING=2): Foliage distance 125% 27 -> 38.8 fps (100%: 40.1),
the AO and sun rays 2.1 -> 0.46 ms (100%: 0.44). The sun's picture shows the same casters at both settings.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
feat(vk-rt): RX_VK_RT_MESH_EDGE, the mesh triangles' edge check as a switch
Some checks are pending
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Blocked by required conditions
CI / Conventional Commit title (pull_request) Blocked by required conditions
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Blocked by required conditions
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Blocked by required conditions
CI / Workflow lint (actionlint) (pull_request) Blocked by required conditions
Guide screenshots / Guide images and local UI source review (pull_request) Blocked by required conditions
Third-party parts / As their notes say (pull_request) Blocked by required conditions
Third-party parts / The same as upstream (pull_request) Blocked by required conditions
Website / Website on Cloudflare (pull_request) Blocked by required conditions
beanstalk/approval waiting for a BigBean's 👍 on the request
Website / Website on Cloudflare (pull_request_target) Has been skipped
PR description / Description follows the template (pull_request_target) Successful in 8s
e7cc11df61
The longest edge rt_scene_mesh.comp keeps (30 m, a falling leaf's 2 m) is now a push constant: RX_VK_RT_MESH_EDGE=<metres>, 0 turns the check off. RX_VK_RT_MESH_EDGE_CTL=<file> is a test's live number over it, read every quarter second, logged when it changes.

Measured with it (Kokiri, Lost Woods, Sacred Forest Meadow, Hyrule Field, Kakariko; sun and AO views, live toggles so the camera stays put): at Foliage 100% the check off, 30, 8, 4, 2, 1 and even 0.05 m differ from each other no more than two shots with the check off do (wind sway). At 125%, by the Kokiri houses: off 13.7 fps with the huge shadows, 30 m 42 fps.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Author
First-time contributor

Pushed 1327215a, 94f6920f and e7cc11df: a fix for huge flickering sun shadows and a big slowdown at a raised Foliage distance, a graphics option from outside this PR (Kokiri Forest at 125%: 10.7 fps, against 42 at 100%).

Cause: rt_scene_mesh.comp unprojected each corner on its own. A corner the game parks off the view (a falling leaf out of its life, a faded mesh-shader foliage instance) came back at a finite but far place, so its triangle spanned the area: every ray traversed it (the rays' pass 0.45 to 7.8 ms) and the sun drew its shadow. Now a triangle's three corners are unprojected together and it is left out when an edge is longer than 30 m (2 m for a falling leaf's draw). The static shadow map's pool, the world's own geometry, is not checked. With the fix: 38.8 fps at 125% against 40.1 at 100%.

RX_VK_RT_MESH_EDGE=<m> (0: no check) and RX_VK_RT_MESH_EDGE_CTL=<file> (a live number, for tests) are in docs/ray-tracing.md and the description's Flags and settings. With them I checked for lost geometry: at Foliage 100%, in five areas, the sun and AO views differ no more than two shots of the same camera do, even with the limit down to 0.05 m. No tree or shadow goes missing. The game-free checks give the same results as before. The description's Testing has the details.

This is everything I have locally, so I'm asking for the Must-be-tested runs now:
@Beanstalk build and ray tracing rows on, Linux
@Beanstalk ray tracing rows on, Kokiri Forest and Lake Hylia, RDNA 2 or newer
@Beanstalk ray tracing rows on, Intel Arc

Pushed 1327215a, 94f6920f and e7cc11df: a fix for huge flickering sun shadows and a big slowdown at a raised Foliage distance, a graphics option from outside this PR (Kokiri Forest at 125%: 10.7 fps, against 42 at 100%). Cause: `rt_scene_mesh.comp` unprojected each corner on its own. A corner the game parks off the view (a falling leaf out of its life, a faded mesh-shader foliage instance) came back at a finite but far place, so its triangle spanned the area: every ray traversed it (the rays' pass 0.45 to 7.8 ms) and the sun drew its shadow. Now a triangle's three corners are unprojected together and it is left out when an edge is longer than 30 m (2 m for a falling leaf's draw). The static shadow map's pool, the world's own geometry, is not checked. With the fix: 38.8 fps at 125% against 40.1 at 100%. `RX_VK_RT_MESH_EDGE=<m>` (0: no check) and `RX_VK_RT_MESH_EDGE_CTL=<file>` (a live number, for tests) are in docs/ray-tracing.md and the description's Flags and settings. With them I checked for lost geometry: at Foliage 100%, in five areas, the sun and AO views differ no more than two shots of the same camera do, even with the limit down to 0.05 m. No tree or shadow goes missing. The game-free checks give the same results as before. The description's Testing has the details. This is everything I have locally, so I'm asking for the Must-be-tested runs now: @Beanstalk build and ray tracing rows on, Linux @Beanstalk ray tracing rows on, Kokiri Forest and Lake Hylia, RDNA 2 or newer @Beanstalk ray tracing rows on, Intel Arc
Member

@winterelfeas only members of BigBeans can start the farm. One of them can approve this request by reacting 👍 to it or to this comment.

@winterelfeas only members of `BigBeans` can start the farm. One of them can approve this request by reacting 👍 to it or to this comment.
Some checks are pending
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Blocked by required conditions
CI / Conventional Commit title (pull_request) Blocked by required conditions
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Blocked by required conditions
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Blocked by required conditions
CI / Workflow lint (actionlint) (pull_request) Blocked by required conditions
Guide screenshots / Guide images and local UI source review (pull_request) Blocked by required conditions
Third-party parts / As their notes say (pull_request) Blocked by required conditions
Third-party parts / The same as upstream (pull_request) Blocked by required conditions
Website / Website on Cloudflare (pull_request) Blocked by required conditions
beanstalk/approval waiting for a BigBean's 👍 on the request
Website / Website on Cloudflare (pull_request_target) Has been skipped
PR description / Description follows the template (pull_request_target) Successful in 8s
This pull request has changes conflicting with the target branch.
  • docs/development.md
  • gpu/vk/switches.def
Some workflows are waiting to be reviewed.
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u 'feat/ray-tracing:winterelfeas-feat/ray-tracing'
git switch 'winterelfeas-feat/ray-tracing'
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
4 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
MagicBeanDev/Longshot!727
No description provided.