Repository navigation
Lower add-on dispatch cost, fix depth detection and depth flicker - #12
Merged
Merged
Conversation
Enables VK_EXT_external_memory_host when available so add-ons can share frames with another process through mapped memory, the only transport a Wine/Proton process can use with a native one. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Adds VK_IMAGE_USAGE_TRANSFER_DST_BIT alongside the usage ReShade already requests, so add-ons can copy results back into the back buffer. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The glad loader sends names containing "Properties" to vkGetInstanceProcAddr, which returned a function that crashed vkCreateDevice for this device-level entry point. Exclude it like the "Handle" functions. Co-Authored-By: Claude Opus 5.5 <[email protected]>
find_addon runs for every add-on callback of every event, and dladdr1 takes the loader lock each time. _dl_find_object is lock-free. Needs glibc 2.35.
Draws that test with always/equal or have unresolved dynamic depth state set the unknown bit, and the exact match then discarded every vote. UI and sky draws made detection fail in most games. Unknown evidence now abstains; contradicting evidence still blocks the vote.
fc8ce90 clears the selected view when the previous depth-stencil is untracked, but the following check skips creating a view if the revived backup texture is unchanged. A game that alternates between two depth buffers (RPCS3) ended every second frame without a view and rebound the effects on every frame. Carry the previous view over in that case.
TheForgotten69
added a commit
that referenced
this pull request
Oct 12, 2026
* vulkan: import host memory as buffers with resource_flags::shared_host Enables VK_EXT_external_memory_host when available so add-ons can share frames with another process through mapped memory, the only transport a Wine/Proton process can use with a native one. * vulkan: allow copies into swap chain images Adds VK_IMAGE_USAGE_TRANSFER_DST_BIT alongside the usage ReShade already requests, so add-ons can copy results back into the back buffer. * vulkan: load vkGetMemoryHostPointerPropertiesEXT through the device The glad loader sends names containing "Properties" to vkGetInstanceProcAddr, which returned a function that crashed vkCreateDevice for this device-level entry point. Exclude it like the "Handle" functions. * linux: look up add-on modules with _dl_find_object find_addon runs for every add-on callback of every event, and dladdr1 takes the loader lock each time. _dl_find_object is lock-free. Needs glibc 2.35. * depth: let unknown compare ops abstain in reversed depth detection Draws that test with always/equal or have unresolved dynamic depth state set the unknown bit, and the exact match then discarded every vote. UI and sky draws made detection fail in most games. Unknown evidence now abstains; contradicting evidence still blocks the vote. * depth: keep the shader resource view when the backup texture is reused fc8ce90 clears the selected view when the previous depth-stencil is untracked, but the following check skips creating a view if the revived backup texture is unchanged. A game that alternates between two depth buffers (RPCS3) ended every second frame without a view and rebound the effects on every frame. Carry the previous view over in that case.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Three fixes found while profiling the Vulkan layer.
Add-on dispatch (
linux: look up add-on modules with _dl_find_object)The built-in Generic Depth add-on means every event goes through
find_addon, which calleddladdr1and took the loader lock for each callback._dl_find_objectis lock-free. Needs glibc 2.35 (CI has 2.38). vkcube with 4 effects, add-ons off: ReShade's app-thread overhead goes from about 892k to 299k instructions per frame and from about 40 to 29 us.Reversed depth detection (
depth: let unknown compare ops abstain ...)Any draw with an always/equal test or unresolved dynamic depth state set the unknown bit, and the exact match then dropped every vote. UI and sky draws were enough to stop detection. In Suzerain it never decided and gave up after 600 frames; now it picks reversed after 120 frames. Contradicting evidence still blocks the vote. Tests extended.
Depth flicker (
depth: keep the shader resource view when the backup texture is reused)fc8ce90 clears the selected view when the previous depth-stencil is untracked, but the next check skips creating one if the revived backup texture is unchanged. A game that alternates between two depth buffers (RPCS3) ended every second frame without a view and rebound the effects every frame. Over 300 frames in inFamous: 150 null views and 300 runtime updates before, 0 and 1 after. Upstream has the same code.
Tested in vkcube, Suzerain (Proton) and RPCS3 (inFamous). Linux portability tests pass.