d3d12/fsr: fix typeless depth SRVs, PrepareV2 barriers, and launcher texture-room cap (D3D12-FSR-FRAMEGEN-DEPTH-AND-ROOM) #3206
Open
github-bot
wants to merge 4 commits from
github-bot/gh-3206 into main
AGit
pull from: github-bot/gh-3206
merge into: github:main
github:main
github:perf/darner-title-priority-ceiling
github:gh-readonly-queue/main/pr-3311-b5c45b663dbc5a9c3532bb3f307e5f81b32faefa
github:gh-readonly-queue/main/pr-3088-af22e7847ff5808f72d1a1881c24be2fafd20b54
github:gh-readonly-queue/main/pr-3123-7f3fa026a94c6646e89244f28e1ce22290361867
github:gh-readonly-queue/main/pr-3354-637baa0b77ba47222e7280b17c1a59c6a1781d57
github:gh-readonly-queue/main/pr-3365-d7a0e0196a43834813014b4bd3aa5502a8263b14
github:gh-readonly-queue/main/pr-3361-5dfe8bbd05ed12fb2f2e1718d9af77a7c5f46fd8
github:gh-readonly-queue/main/pr-3366-8da9148204e9d12c585efa9ac2b7cc1ab08c7682
github:fix/runtime-test-conservative-fixtures
github:ci/shard-semantic-linux
github:docs/fg-limit-fps-switch
github:fix/runtime-test-fixture-paths
github:fix/runtime-test-fixture-readers
github:fix/read-file-hard-link
github:fix/book-slot-heap-never-read
github:fix/depth-resolve-spv-path
github:fix/indirect-unused-batched
github:gh-pr/3358/base
github:fix/xmem-refusal-diagnostics
github:gh-pr/3357/base
github:ci/shorten-ci-time
github:fix/alias-later-queued-submissions
github:claude/gallant-sagan-aamatr
github:gh-pr/3342/base
github:gh-pr/3341/base
github:d3d12/agility-sdk-621
github:gh-pr/3293/base
github:gh-pr/3319/base
github:gh-pr/3318/base
github:gh-pr/3315/base
github:gh-pr/3313/base
github:gh-pr/3314/base
github:claude/fervent-curie-m19lnr
github:gh-pr/3216/base
github:gh-pr/3272/base
github:gh-pr/3276/base
github:gh-pr/3279/base
github:gh-pr/3257/base
github:gh-pr/3258/base
github:gh-pr/3271/base
github:codex/skip-no-hit-ray-passes
github:gh-pr/3230/base
github:gh-pr/3266/base
github:gh-pr/3247/base
github:gh-pr/3246/base
github:gh-pr/3244/base
github:claude/sharp-sagan-1jqnp3
github:t3/preserve-fsr-sdk-restart-path
github:t3/propagate-host-failure-hresult
github:t3/launcher-custom-parameters
github:t3/series-x-2160-startup
github:codex/d3d12-uncapped-simulation
github:ci/less-to-run
github:perf/native-compute-shader-forms
github:claude/blissful-franklin-ukp7ag
github:codex/full-precompile-default
github:gh-pr/3166/base
github:gh-pr/3148/base
github:gh-pr/3138/base
github:gh-pr/3106/base
github:gh-pr/3057/base
github:gh-pr/2756/base
github:gh-pr/2812/base
github:gh-pr/3032/base
github:gh-pr/2992/base
github:notes/card-time-and-plant-flicker
github:gh-pr/2986/base
github:gh-pr/3000/base
github:gh-pr/2966/base
github:gh-pr/2924/base
github:gh-pr/726/base
github:gh-pr/2761/base
github:gh-pr/2663/base
github:gh-pr/2861/base
github:gh-pr/2862/base
github:gh-pr/2820/base
github:gh-pr/2811/base
github:gh-pr/2803/base
github:rt-call-trace
github:gh-pr/2802/base
github:gh-pr/2766/base
github:perf/ahead-split
github:gh-pr/2589/base
github:gh-pr/2699/base
github:gh-pr/2696/base
github:docs/readme-runtime-proposal
github:gh-pr/1346/base
github:codex/coord-claim-check-20261124-7e48
No reviewers
Labels
Clear labels
accessibility
Barrier affecting people with disabilities
area: ci
.github/ workflows and settings
area: d3d12
The D3D12 runtime in d3d12/ (Rust: leonida.exe and its crates)
area: docs
Documentation
area: launcher
The launcher (launcher/)
area: runtime (legacy)
The earlier Vulkan runtime in runtime/
area: shader translator
The shader translator (leonida-shader, tools/rdna2spirv) and its tests
area: tools
tools/ and scripts/
area: viewer
The map viewer (viewer/)
bug
Something isn't working
dependencies
Pull requests that update a dependency file
documentation
Improvements or additions to documentation
duplicate
This issue or pull request already exists
enhancement
New feature or request
good first issue
Good for newcomers
help wanted
Extra attention is needed
invalid
This doesn't seem right
missing claim
Needs a claim in #14
needs in-game run
Changes the code a frame runs through: needs the 300 s in-game gate (docs/game_gate.md)
needs rebase
Conflicts with the base branch: rebase it on main
needs-triage
Needs maintainer evaluation before the next triage state
question
Further information is requested
ready-for-agent
Fully specified and ready for an AFK agent
submodules
Pull requests that update submodules code
wontfix
This will not be worked on
No labels
accessibility
area: ci
area: d3d12
area: docs
area: launcher
area: runtime (legacy)
area: shader translator
area: tools
area: viewer
bug
dependencies
documentation
duplicate
enhancement
good first issue
help wanted
invalid
missing claim
needs in-game run
needs rebase
needs-triage
question
ready-for-agent
submodules
wontfix
Milestone
Clear milestone
No items
No milestone
Assignees
Clear assignees
No assignees
1 participant
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
github/ubiquitarianism--leonida!3206
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-3206"
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?
@zmasi on GitHub · 2026-12-02 19:17 UTC · original
zmasi:fix/d3d12-fsr-framegen-depth-and-room→main· +660 −25 · 3 files · 4 commits · openClaimed in the coordination issue as:
D3D12-FSR-FRAMEGEN-DEPTH-AND-ROOM(#2570)Addresses #3173 (does not close it until verified in-game on Series S and Series X: fixes typeless depth resource descriptors and SRV formats in
fsr.rs, adds explicitPrepareV2NON_PIXEL_SHADER_RESOURCEbarriers +DEPTH_READstate mapping, and removes the launcher's double-countedLEONIDA_TEXTURE_ROOM_PERCENT=80cap).What and why
Fixes three defects when
LEONIDA_FSR_FRAMEGEN=1(-FsrFrameGenorFSR 3 FRAME GEN 2Xin the F1 menu) is active (#3173):LEONIDA_TEXTURE_ROOM_PERCENT = '80'double-counted FSR 3 VRAM and starved bindless & tiled world textures (d3d12/scripts/play-nvidia.ps1):fsr::swap_chainandfsr::create_contextallocate FidelityFX's~1.5-2.0 GBup front on the first frame, so those bytes are already included in DXGIQueryVideoMemoryInfo(LOCAL).CurrentUsage(usedinresource::room). Because FidelityFX allocates directly onID3D12DeviceoutsideHOST_TEXTURES[1], its memory also stacks on top oftargets_room_kept()(3,072 MB),LEONIDA_WINDOWS_BAR_MB(3,072 MBon< 48 GBRAM PCs),shadow::card_for, and precompiled pipelines.LEONIDA_TEXTURE_ROOM_PERCENTfrom90to80subtracted an additional10%ofbudgetafter FSR's allocations were already counted inused, trippingresource::room()tofalseright above the2 GiBfloor (resource::texture_floor_bytes) instead of the5-7.3 GBneeded in the open world. Unmade bindless textures (draw.rsheap_textures) and unmappedon_demandreserved mip tiles (texture.rs) read(0, 0, 0, 0)on D3D12 — turning opaque surfaces black (rgb = 0) and discarding alpha-tested foliage/leaves (alpha = 0 < cutoff).80%override leavesroom_percent()at its90%default (matching-FrameGen), while explicit-More @{ LEONIDA_TEXTURE_ROOM_PERCENT = '...' }overrides continue to pass through.fsr::Resource::texturemissed Leonida's typeless depth buffers (d3d12/crates/leonida-gpu/src/fsr.rs):resource.rscreates every shader-readable host depth target as typeless (D32_FLOAT_S8X24_UINT->R32G8X24_TYPELESS,D32_FLOAT->R32_TYPELESS,D24_UNORM_S8_UINT->R24G8_TYPELESS,D16_UNORM->R16_TYPELESS) withD3D12_RESOURCE_FLAG_ALLOW_DEPTH_STENCIL.Resource::texturepreviously checkeddesc.Formatonly against typedD16_UNORM | D32_FLOAT | D24_UNORM_S8_UINT | D32_FLOAT_S8X24_UINT, leavingusage = 0(missingUSAGE_DEPTHTARGETandUSAGE_STENCILTARGET) and leavingR32_TYPELESS/R16_TYPELESSas typelesssurface_formatvalues (37/34). WithoutUSAGE_DEPTHTARGET | USAGE_STENCILTARGETand typed surface formats, FidelityFX's DX12 backend selects invalid SRV formats (DXGI_FORMAT_R32_FLOATon 2-planeR32G8X24_TYPELESS, or raw typeless formats onR32_TYPELESS/R16_TYPELESS) inPrepareV2.Resource::texturenow checksD3D12_RESOURCE_FLAG_ALLOW_DEPTH_STENCILalongside typed depth formats, setsUSAGE_DEPTHTARGET(plusUSAGE_STENCILTARGETonD24_UNORM_S8_UINT | R24G8_TYPELESS | D32_FLOAT_S8X24_UINT | R32G8X24_TYPELESS), and maps depth-flaggedR32_TYPELESS -> R32_FLOAT (28)andR16_TYPELESS -> R16_UNORM (23)to matchffxApiGetResourceDX12.PrepareV2NON_PIXEL_SHADER_RESOURCEbarriers andDEPTH_READstate mapping (d3d12/crates/leonida-gpu/src/fsr.rs):PresentinDEPTH_READ(0x20) orDEPTH_READ | NON_PIXEL_SHADER_RESOURCE | PIXEL_SHADER_RESOURCE(0xE0).ffx_statepreviously mappedDEPTH_READtoSTATE_DEPTH_ATTACHMENT(which FidelityFX maps back to exclusiveD3D12_RESOURCE_STATE_DEPTH_WRITE,0x10), producing illegal0xD0(DEPTH_WRITE | *_SHADER_RESOURCE) barriers or leavingdepthinDEPTH_WRITEon the GPU whileHostTexture::statestill recordedDEPTH_READ.before_presentnow transitionsinputs.depth.0andinputs.motion.0onlisttoD3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE(0x40) beforeffxDispatch(DISPATCH_PREPARE_V2), passesSTATE_COMPUTE_READtoPrepareV2, and restoresinputs.depth.1andinputs.motion.1immediately afterffxDispatch(whether or not the dispatch succeeded).ffx_statealso mapsDEPTH_READtoSTATE_COMPUTE_READ | STATE_PIXEL_READrather thanSTATE_DEPTH_ATTACHMENT.Tested
ea43e2cc1ontoorigin/main45dc41f95):python -I scripts/red_green.py HEAD --base 45dc41f95 --no-fetch --mutate(fsr::+tests/test_win_launchers.py):verdict: red then green, all 4 new/updated tests (3Rustfsr::tests+1PythonWinLaunchersTests) gored -> green, every code hunk caught under--mutate.x86_64-pc-windows-msvc):cargo test -p leonida-gpu [--features diagnostics] --lib --target x86_64-pc-windows-msvc fsr:::5 passed, 0 failedin both default anddiagnosticsbuilds (verifiesCreateShaderResourceViewacross all 4 typeless depth formats,ffx_stateon0x20/0xE0, and real D3D12 command-list + queue execution ofbefore_presentPrepareV2barriers on both succeeding and failing dispatches).cargo clippy -p leonida-gpu [--features diagnostics] --all-targets --no-deps --target x86_64-pc-windows-msvc:0warnings infsr.rs.python -I tests/test_win_launchers.py(7/7 OK),python -I tests/test_play_nvidia_menu_choice.py(16/16 OK),python -I tools/d3d12_switches.py --check d3d12/docs/switches.md(rc=0),python -I tests/test_d3d12_switches.py(20/20 OK),python -I scripts/check_no_game_data.py(rc=0), andpython -I tests/test_text_write_line_endings.py(3/3 OK).git merge-tree --write-treeclean (rc=0) againstorigin/main,#3111, and#3104.GPUs tested: NVIDIA GeForce RTX 3090 24 GB, driver 610.88, Windows 11 Pro
10.0.26200(D3D12 SRV and command-list barrier unit tests; no retail title run).AI-assisted: yes — authored with Gemini 4 Carbon (High) and independently audited in a read-only review pass by Gemini 4 Neon (XHigh) (
opus-systems-critic).Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed (n/a: no translator rule changed).@icdmkg2 on GitHub · 2026-12-02 20:22 UTC · original
Third-party Windows verification of #3206 (
D3D12-FSR-FRAMEGEN-DEPTH-AND-ROOM) on head137c231a5137c231a5d0e494169ac67fdf2ed83cc1e6ff6bdmerged cleanly (git merge --no-ff) ontoorigin/mainb41763227.621.24(32.0.16.2124), AMD Ryzen 7 H 260 w/ Radeon 780M, 32 GB RAM, Windows 1110.0.26300.9974,rustc 1.98.1.Results (MEASURED)
python -I scripts/check_no_game_data.py(all 3 touched files)0python -I tools/d3d12_switches.py --check d3d12/docs/switches.md0LEONIDA_ADAPTER=5060python -I scripts/red_green.py 3206 --mutate0(verdict: red then green) —4tests went red → green (fsr::tests::{before_present_transitions_depth_and_motion_for_prepare_and_restores_states, states_and_formats, typeless_depth_resources_carry_depth_stencil_usage_and_valid_srv_formats}+test_win_launchers.py::test_fsr_framegen_leaves_default_texture_room_and_honors_override);708pass on both,0failures. (--mutate:fsr.rs:709andfsr.rs:888caught; the other 5 Rust sub-hunks were reportednot caughtdue tored_green.pyrunning the Python target test even when Rust fails to compile, not missing coverage.)LEONIDA_ADAPTER=5060+LEONIDA_D3D12_DEBUG=1cargo test -p leonida-gpu --features diagnostics --locked --lib -- fsr::5 passed, 0 failed(D3D12 Debug Layer clean across typeless depth SRVs andPrepareV2pre/postNON_PIXEL_SHADER_RESOURCEbarriers)LEONIDA_D3D12_WARP=1+LEONIDA_D3D12_DEBUG=1(samefsr::command,--features diagnostics)5 passed, 0 failedReview notes (READ IN CODE)
fsr.rsResource::texture: checksALLOW_DEPTH_STENCILalongside typed depth formats, setsUSAGE_DEPTHTARGET(+USAGE_STENCILTARGETforD24_UNORM_S8_UINT/R24G8_TYPELESS/D32_FLOAT_S8X24_UINT/R32G8X24_TYPELESS), and maps depth-flaggedR32_TYPELESS/R16_TYPELESSwhile preserving non-depthR32_TYPELESSUAVs (37).fsr.rsbefore_present: deduplicates barrier whenmotion == depthand restores both states unconditionally whetherPrepareV2dispatch succeeds or fails.d3d12/docs/switches.md:561still marksLEONIDA_TEXTURE_ROOM_PERCENTwithL = yesandleonida-gpu/resource.rs +1becaused3d12/scripts/play-nvidia.ps1was the only launcher assignment;tools/d3d12_switches.py --checkonly checks switch name presence so CI stays green, though regeneratingswitches.mdwould keep theLcolumn exact.AI-assisted: Gemini 4 Neon (High) via Antigravity (test execution, diff review, and write-up).
@ThatAppleFanboy on GitHub · 2026-12-02 21:02 UTC · original · approved these changes
The fix works perfectly on rtx3080
@ThatAppleFanboy on GitHub · 2026-12-02 21:30 UTC · original · approved these changes
Works
@fiestorra on GitHub · 2026-12-02 21:57 UTC · original
VERIFY-3206 — Windows nativo: dos de los tres tests nuevos pasan; el tercero necesita un escritorio y no lo hay aquí
(this PR)b41763227= currentmainmain—merge-treeclean,git merge --no-ffcleanRan
The failure is environmental, and I traced it to the line:
HRESULT(0x887A0022)isDXGI_ERROR_NOT_CURRENTLY_AVAILABLE, and line 1388 isA composition swap chain needs a composition-capable session, and this machine has none (
CopyFromScreen: The handle is invalid; it is the same reasonborderless_from_the_start_stays_shown_when_framed_againfails onmain). So this test cannot pass here, and it will not tell you whether the barrier code is right — but note that GitHub's Windows runners are headless too, so if CI runs this test it will fail there for the same reason. That is worth checking before merge, and aCreateSwapChainForCompositionthat is allowed to fail with a skip would make the test say what it means on machines that cannot build one.What the two passing tests do say: the typeless depth resources now carry
D3D12_RESOURCE_USAGE_DEPTH_STENCILand validate as the right SRV formats, and the depth/back-buffer flags come out right — the part of the change that does not need a present.What I could not test
before_presenttransitions depth and motion and restores the states) and it has no verification from this machine.Written with an AI assistant.
@MoonEyes on GitHub · 2026-12-02 22:00 UTC · original
This pull request touches the render path, so it needs an in-game run before it can be merged: unit tests and CI do not catch rendering regressions (a device loss after an earlier merge is why this gate exists).
Could you, or anyone with a working setup, post a run report on the current head merged onto current
main:mainSHA it was merged onto;mainalone for comparison, if you can.Please do not attach logs or screenshots that show game content. If a run on this exact head is already posted, a link to it in a reply is enough.
AI-assisted (Claude Code).
@zmasi on GitHub · 2026-12-02 22:26 UTC · original
Thanks @fiestorra for catching that
CreateSwapChainForCompositionDXGI_ERROR_NOT_CURRENTLY_AVAILABLE(0x887A0022) failure on headless Session-0 setups!Since
before_presentonly forwardsswap_chain.as_raw()intoConfigureFrameGeneration.swap_chainand makes zero COM calls on it,d024194b38(merged with currentorigin/main,#[cfg(test)]only — zero production code change) replacesCreateSwapChainForCompositioninbefore_present_transitions_depth_and_motion_for_prepare_and_restores_stateswith a minimal COM-shapedStubSwapChainwhile keeping the full real D3D12 command-list, GPU queue, and fence barrier validation intact (5/5fsr::tests passing without needing a desktop compositor).@lixonik on GitHub · 2026-12-02 22:41 UTC · original
RUN (in game, RTX 5070 12 GB, 315 s in-world gate) -- PASS on head
137c231a5(merged cleanly viagit merge --no-ffontomain8877be372).Build & Unit Checks (Windows 10 x64, RTX 5070 12 GB, driver 595.79)
python -I scripts/check_no_game_data.py-> PASSpython -I tests/test_win_launchers.py-> OKcargo test -p leonida-gpu --lib --locked fsr::-> 5 passed, 0 failedcargo build --profile diag --features "diagnostics,dlss,mimalloc" --locked-> PASSLive In-Game Gate (
-SeriesS -NoFrameGen, standard DLSS path -- non-FSR-FG regression gate)137c231a5on8877be372)315 s(451.5 s)65(5,233)0/027.1 fps(36.9 ms)21.5/27.9main(8877be372)315 s(441.9 s)63(4,338)0/027.9 fps(35.8 ms)26.1/29.6LEONIDA_FIDELITYFX_DIR) were not present on this host, so liveLEONIDA_FSR_FRAMEGEN=1/PrepareV2dispatch itself was not exercised in-game; thefsr::unit tests (5/5),tests/test_win_launchers.py, and this 315 s DLSS world run confirm clean compilation, launcher behavior, and zero regressions on the non-FSR-FG path.AI-assisted: yes (Antigravity -- Gemini 4 Neon).
@MoonEyes on GitHub · 2026-12-03 00:02 UTC · original
RUN (in game, batch of nine pull requests), each head merged with
git merge --no-ffonto main81efe4566, in one build: #313674bd1bcd4, #315653c3100ce, #3206d024194b3, #3248efd21d867, #3256e7aad1d4c, #32623643c2879, #2851b83b0b375, #312589bf1d328, #2642164506d01. RTX 4060 8 GB, driver 610.88, Windows 11. Series S,-Resolution 1080, frame generation 2x,-PrecompileUsed, the same walking route as the other runs on this machine, 330 s after reaching the world.For reference, the same machine and route rendered 13.3 to 17.2 fps on other batches in the last day. These fps are a check that nothing fell over, not a measurement of a gain.
Verdict: PASS for the in-game gate (300 s or more in the world, no device loss) for this batch, on the heads listed above. If one of these pull requests changes its head, this run no longer covers it.
Limits: one run; arrival in the world was driven by keys and not checked on pictures;
-PrecompileUsedwas used, so the default start (every known pipeline precompiled) was not exercised. The precompile before the world took 619 s, against 157 s for the previous batch; the shader-side changes in this batch (#3156, #3262) probably left the pipeline cache cold (not checked). Switches that are off by default (for example #2851'sLEONIDA_TITLE_MEMORY_SCALE, #3136's timeline attribution) were not turned on: this run covers their default path only. #2642 targets Wine and was run on Windows only.AI-assisted (Claude Code).
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.