Repository navigation
Conversation
…ffer view inits OnInitResourceView took two exclusive shard locks per view creation, plus a resource_view_handles insert. Engines that rewrite views in place on many threads serialize on the shard of a shared resource. - Read under the shared lock first and only take the exclusive lock to record a view handle that is not yet known (same result as before). - Add the opt-out use_d3d12_buffer_view_tracking (default true, OR-merged in SharedData). When every loaded module opts out, D3D12 buffer and acceleration structure views are not tracked; RenoDX never clones or upgrades D3D12 buffers. A live entry at a rewritten descriptor is retired through OnDestroyResourceView so the handle stops resolving to the previous resource. - OnAfterDestroy returns early when nothing is queued; MSVC std::set allocates its sentinel node on construction. OnDestroyResourceView moved above OnInitResourceView unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The deferred skinning jobs recreate three buffer SRVs per batch on every worker against one upload buffer. With full view tracking all workers serialized on one resource_infos shard (WPR, dm_forge with RT: about 10k SRW lock waits/s per thread, RenoDX on 18-39 % of thread samples). - use_resource_cloning_dx12_only: D3D12 clones are applied by descriptor copy at view creation. The generic descriptor, barrier, clear and render pass hooks return early on D3D12 but made ReShade resolve GPU addresses on every root CBV/SRV bind. - use_d3d12_buffer_view_tracking = false. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
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.
What changed
Two commits:
perf(utils::resource): avoid exclusive locks on repeated and D3D12 buffer view initsOnInitResourceViewnow reads the resource info under the shared lock. It only takes the exclusive lock to record a view handle that is not yet known. The result is the same as before; the old insert was a no-op in that case.utils::resource::use_d3d12_buffer_view_tracking, defaulttrue. It is OR-merged inSharedData, so tracking stays on as long as any loaded module wants it.CloneResourcereturns{0}for non-Vulkan buffers, and the create/init upgrade paths only handle textures.OnDestroyResourceView. The handle then stops resolving to the previous resource, and a clone view is cleaned up.OnAfterDestroyreturns early when nothing is queued. It runs after every in-place view rewrite, and MSVCstd::setallocates its sentinel node on construction.OnDestroyResourceViewmoved aboveOnInitResourceViewunchanged, so no forward declaration is needed.perf(darktide): use D3D12-only cloning and skip buffer view trackinguse_resource_cloning_dx12_only = true. Starfield and Infinity Nikki already use this with proxy + HDR10 + cloning. Every hook it unregisters returns early on D3D12. On D3D12 the clones are applied by descriptor copy at view creation, and that path stays registered.use_d3d12_buffer_view_tracking = false.Why
Darktide's deferred skinning job (
Darktide.exe 1.13.0at0x1407C9D30) recreates three buffer SRVs per batch on every worker. They target fixed CPU descriptors and one shared upload buffer.With full view tracking, every
CreateShaderResourceViewtook:resource_infosshard, plus aresource_view_handlesinsert,All workers serialized on that one shard. The renderer and main threads did too, because they help with jobs while waiting.
The
dx12_onlyswitch removes the registration ofpush_descriptors,update_descriptor_tables, barrier, clear and render-pass hooks, and a global per-drawcommand_actioncallback. On D3D12 these only make ReShade resolve GPU virtual addresses on root CBV/SRV binds and dispatch events into early-returning handlers. This part is a cleanup; the captures below do not show a measurable saving from it.Measurements
Setup: Windows Performance Recorder, 30 s captures, ray tracing on, DLSS-G, ReShade 6.8.0, Ryzen 9850X3D / RTX 5090.
Means over captures. Values are renderer / main / per worker thread.
How to read this:
register_resource_viewlock and are at the level of the no-RenoDX runs. These metrics are specific to RenoDX, and skinning still runs in every capture, so mission differences cannot explain the drop. The ranges are disjoint (Mann-Whitney p = 0.001).dx12_onlypart.b6b32f47plus these commits, built locally against the submodule's ReShade API 18 headers.Verification
darktidetarget builds in Release with MSVC 14.51; no new warnings.ReShade.log).r10g10b10a2_unormwith anhdr10_st2084effect runtime.dx12_onlyreturns before doing anything on D3D12. Untracked D3D12 buffer and acceleration-structure views were never modified by RenoDX.Unrelated observation
ReShade.logreportsutils::shader::PipelineShaderDetails(Failed to replace pipeline)for tonemapper0xB3F15364. This is independent of this PR: no shader or pipeline code changed. A likely cause is that the sharedtonemapper.hlslmaps this minimal-layout variant tob1/b2, while the original usesb0/b1;0x9347F823looks the same. This needs confirmation. After a failed build the replacement is retried on every bind. Only 2 of the 14 custom shader hashes were seen in that session.