Merge miojo-recomp's experimental ray tracing into Longshot #2755
No reviewers
Labels
No labels
area/accessibility
area/audio
area/input
area/install
area/menu
area/mods
area/renderer
area/saves
area/tooling
area/upscaling
beanstalk: approved
beanstalk: failed
beanstalk: needs approval
beanstalk: running
beanstalk: tested
ci: approved
good first issue
gpu/amd
gpu/igpu
gpu/intel
gpu/nvidia
help wanted
kind
bug
kind
chore
kind
docs
kind
feature
kind
performance
kind
question
needs measurements
platform/linux
platform/macos
platform/steam-deck
platform/windows
preview
priority
critical
priority
high
priority
low
regression
risk
high
risk
low
risk
medium
status
blocked
status
confirmed
status
duplicate
status
invalid
status
needs-info
status
wontfix
ci: approved
No milestone
No project
No assignees
4 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Longshot!2755
Loading…
Reference in a new issue
No description provided.
Delete branch "vegitox3d/raytracing"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The scene as ray-tracing acceleration structures, and what traces against
it: the game's own occlusion pass traced against its geometry (ambient
occlusion), the sun's and the lamps' shadows traced into the game's shadow
mask, the game's ambient light by how much sky each place sees, and one
bounce of light off the surfaces in view.
miojo-recomp is a fork of Hookshot with this work; Longshot is Hookshot's
continuation, so the work is backported onto it rather than merged in one
piece: miojo's upstream was at v2.3.1 (2026-11-15) and this is built on
the nightly of 2026-11-28, two weeks newer. The RT sources come from
miojo's tip, which had already been adapted to that upstream.
What the port needed:
would not reach a compiled-in array used directly): the four RT shaders
go through it now.
is regenerated (glslang 11:16.6.0, the version the shipped headers carry),
the packed variant (r11f_g11f_b10f) with it: the packed one is built from
the same source and would have kept the old block.
menu's other rows are, with their keys in longshot_options.ini.
through options_path(), as the other rows are.
resets it (bound().reset()).
The traced rows need Ray tracing on and a temporal upscaler (DLSS or DLAA)
running: without one there is no pass for them to happen in.
Co-Authored-By: Claude Opus 5.5 [email protected]
Possibly related, for context:
Hi, thanks for the contribution. Do you have a source/license for this code?
@review
Recommendation: Request changes. The new effects silently fail on devices with smaller push-constant limits. The change also needs fixes for unsafe buffer handling and unmentioned diagnostic file writes before its visual and performance costs can be assessed.
Adds experimental ray-traced lighting and screen-space ambient occlusion to the graphics menu. It adds substantial per-draw and per-frame renderer work, a Windows run script, diagnostic switches, and new shaders; no comparative gameplay measurements are supplied.
Blocking (2): must change before merging.
gpu/vk/vk_rt.cpp:1672: The bounce-light and local-light passes are silently disabled when the device exposes fewer than 240 bytes of push constants. (more on the line) Do: Move the larger constants into a buffer or otherwise fit the supported device limit, and make unsupported effects unavailable with a clear explanation.gpu/vk/vk_rt.cpp:498: The vertex staging allocation does not include a position attribute that extends beyond the stride. (more on the line) Do: Validate the attribute range against the stride or allocate and read the full checked span, with overflow-safe arithmetic.Should fix (3): not blocking, but worth doing before merging.
gpu/vk/vk_draw.cpp:8765: The existing DLSS trace now writes guest uniform and storage buffers to files, an operation the pull request does not disclose. (more on the line) Do: Remove the buffer dumps from the ordinary trace, or make an explicitly documented diagnostic opt-in with a bounded destination and retention policy.gpu/vk/vk_rt.cpp:978: The frame marker is published before the two light-buffer addresses, without a coherent snapshot between threads. (more on the line) Do: Publish the addresses and frame together under the existing mutex, or use a properly synchronized snapshot with the frame published last.Testing before merging (2) (runs on the systems it can change; it doesn't hold the recommendation)
@fixdoes its part first: Avoid collecting and building the ray-tracing scene when no traced effect can run.)@fixdoes its part first: Keep the depth lifetime change separate from the RT feature so its platform coverage can be assessed independently.)@fixcan do L1, L2, L3, L4, L5, L6 and L7.Questions (1) (not confirmed from the code; they don't hold the recommendation)
Checks: Failing on this head, which is behind its base, where it passes:
PR description / Title and description (pull_request_target).@rebase(or@fix) brings it up to date and runs it again; not held against it. Still running: 10 checks.More: does it help, other systems, switches, what was read
Does it help: Unproven: no in-game result, screenshots, or before-and-after frame-time, FPS, RAM, or VRAM measurements are supplied for this head.
Other systems: The temporal preparation shader and depth lifetime checks also affect DLSS, DLAA, FSR 4, XeSS and frame-generation inputs with ray tracing off. The new passes depend on Vulkan ray-query features, push-constant limits, GPU synchronization and the lifetime of scene textures; no Windows, Linux, AMD, NVIDIA or Steam Deck runs are reported.
Switches: Adds RX_VK_RT, default off unless the saved row enables it; RX_VK_AO_DEBUG, RX_VK_DUMP_PROG, RX_VK_NO_AMBIENT, RX_VK_POKE, RX_VK_RT_AO_CONST, RX_VK_RT_AO_POST, RX_VK_RT_AO_WHY, RX_VK_RT_DEBUG, RX_VK_RT_FLIP, RX_VK_RT_LIGHT_LOG, RX_VK_RT_NO_MATERIALS and RX_VK_RT_WHY default off or unset. RX_VK_RT_AMBIENT_FAR defaults to 40, RX_VK_RT_BUILD_MS to 1, RX_VK_RT_LIGHT_K and RX_VK_RT_SUN_K to 1, RX_VK_RT_MODELS to 2048, RX_VK_RT_RADIUS to 1.5, RX_VK_RT_RAYS to 4, RX_VK_RT_REACH to 12 and RX_VK_RT_SKIN to 0.12. The table has entries, but no measurements justify the tuning defaults. The six new menu rows default to zero.
Reviewed:
ce144ea392against22d0d20098: Read the repository rules, PR template and standards, commit messages, menu module, RT interface and shader sources, and the principal renderer changes and surrounding call paths. Skimmed the large RT implementation, generated SPIR-V headers, lockfile and changed tests; the full changed renderer files and all generated words were not read in full. No review checklist file was present at the requested path.; nothing run (a code review).Checked and fine:
Testing: No commands that build, execute project code, or run tests were used. The supplied CI checks are still running; the description check is reported as affected by the branch being behind its base.
Overlaps and merge order: Not checked; network access is closed.
Automated code review by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.
@ -8721,0 +8762,4 @@const uint64_t size = s.ubo[1][u].size;std::vector<uint8_t> all((size_t)size);if (size < 512 || size > (1u << 20) || !memory_read_as_submitted(s.ubo[1][u].addr, all.data(), all.size())) continue;char name[64];L3 (should fix): The existing DLSS trace now writes guest uniform and storage buffers to files, an operation the pull request does not disclose.
When: With RX_VK_DLSS_TRACE enabled, a matching draw writes ubo and ssbo binary files in the working directory even when RX_VK_DUMP_PROG is unset. These contain submitted game data, and repeated traced frames create more files.
Do: Remove the buffer dumps from the ordinary trace, or make an explicitly documented diagnostic opt-in with a bounded destination and retention policy.
@ -0,0 +495,4 @@lo = 0;} else {if (lo < 0 || nv > 4000000 || (uint64_t)hi * d.stride + d.pos + psz > d.vsize) return false;raw.resize((size_t)(nv * d.stride));L2 (blocking): The vertex staging allocation does not include a position attribute that extends beyond the stride.
When: For an indexed draw whose position offset plus its size exceeds the stride, the vsize check can pass because the bound vertex buffer includes the trailing bytes, but raw is allocated as nv * stride. The subsequent read and conversion access beyond that allocation for the final vertex.
Do: Validate the attribute range against the stride or allocate and read the full checked span, with overflow-safe arithmetic.
@ -0,0 +975,4 @@void rt_note_local_lights(uint64_t lights, uint64_t frame_buffer) {Rt& r = rt();const uint64_t now = texture_frame_no();L4 (should fix): The frame marker is published before the two light-buffer addresses, without a coherent snapshot between threads.
When: If rt_frame observes the new local_frame after the exchange but before both address stores, it can read the previous frame's addresses, or one old and one new address, as the current light table and frame buffer.
Do: Publish the addresses and frame together under the existing mutex, or use a properly synchronized snapshot with the frame published last.
@ -0,0 +1669,4 @@float ao, radius, seed;int32_t rays;float gi, reach, skin;float lights;L1 (blocking): The bounce-light and local-light passes are silently disabled when the device exposes fewer than 240 bytes of push constants.
When: On a ray-query-capable device with a 128-byte push-constant limit, the menu permits Bounce light and Light shadows, but rt_frame returns before either pass is dispatched.
Do: Move the larger constants into a buffer or otherwise fit the supported device limit, and make unsupported effects unavailable with a clear explanation.
Closing as carried by #2966 (HumanBean), which takes this PR's ray tracing (its lamp shadows included) onto current main through the mod API. If something here is not in #2966, a PR on top of it is welcome, with the licence question from 11-28 answered.
🤖 Generated with Claude Code
Pull request closed