Repository navigation
fix(agc): keep texture images inside their extent's mip chain - #6280
fdfawef324 wants to merge 6 commits into
Conversation
|
Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.
Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.
|
|
Additional Windows data point from a Demon's Souls PPSA01341 investigation:
Vulkan validation was actually loaded in the focused baseline/candidate logs; neither contained VUID errors (the regression wrapper intercepted the invalid create on the baseline). No console-equivalence, Linux, macOS, other-GPU or existing-PR-head test is claimed. AI-assisted (Codex). |
…n their extent allows) at 5fb9380 FormatVersion 44 (main + boykopovar#6280 = 37, ours 43).
|
Cross-test on Windows with current The merge. I merged head
Tests. Title. On plain The overview character's face, which is noise on
|
|
Another Demon's Souls (PPSA01341) case this PR covers, from a local branch. During resource loading, before the first scene, the Vulkan validation layer reported Our local fix took the same approach as this PR: one helper clamps the level count from the actual extent and image type for the sampled, sRGB-expansion, copy and storage-texture images. Views and min-LOD map the excess guest levels to the last physical level, transfers, barriers and tracking use the physical count, and write-back keeps the bytes of the excess guest levels. With it the VUID was gone in that run. We won't open a separate PR, since this one covers those paths. If a regression case would help: a 2D storage texture of 4x1 with four guest levels. AI-assisted: yes (Claude Code) |
|
Another Demon's Souls (PPSA01341 01.007.000) case this PR covers, in a different scene: the device loss of #10634, which reproduces on Windows in a renderer-only scene built from tutorial (m08) assets. Capping the sampled image at its extent's mip chain, as this PR does, removes it. Setup: Windows 11 Pro 10.0.26200, Ryzen 7 5800X3D, RTX 4070 (NVIDIA 610.88), WinLibs GCC 15.2.0, Release. The game was relinked with On I tested a local equivalent of this PR's sampled-texture part, not this PR's head, which conflicts with current
The 0dbf9fb builds also carry a frame-capture diagnostic that does nothing unless capturing. Without the cap the device was lost in 6 of 8 runs; with it, in 0 of 3. In the capped runs the log shows which images the cap cut (guest levels -> levels the extent holds): In the uncapped runs these arrays are built just before the fault. In one AI-assisted: yes (Claude Code) |
|
Still needed on current Earlier in the same run the layer flagged 28x1 images with 9 and 11 levels, 20x1 with 10, 8x1 with 11 and 4x1 with 11. A local test-only clamp of the sampled |


What
A guest texture descriptor can name more mip levels than Vulkan permits for its extent. Cap sampled, storage and expanded-copy images at the physical chain; bound their allocations, views, uploads, blits, barriers, clears and write-back. Extra-level storage views and attachments remain refused; #7085 supplies separate backing in a follow-up.
Demon's Souls PPSA01342 originally lost the device after a 28x1 BC3 array declared ten levels while the extent held five. The private integration fault pointed to the first byte beyond that image. This is historical diagnosis; it is not a fresh title run on the final rebase.
For the decoded views exercised here (
MAX_MIP = LAST_LEVEL),image_get_resinforetains the guest level count and returns 1x1 spatial extents for extra levels within that count. AtLOD >= count, it zeros every extent/layer component and retains the count. The emitter selects a valid physical query LOD before asking Vulkan, including for LOD 31 / UINT_MAX. Single-level descriptors with an unrepresented base refuse texel loads and LOD queries; pure size queries remain valid. Repacked storage-to-sampled copies use the same allocation/view cap.The rebase preserves #6054's uploadImage path and passes physical
geometry.imageLevels/copyLevelsthrough sRGB image creation, blits, views and refresh. It retains main'sConvertedSampleRequiredalongsideViewLevelsPastChain/LevelsPastChain, and keepsconvertedSamplesandlevelUsesin the cache encoder, decoder and nonzero round-trip fixture. Final cache format:41;ImageResourceguard:40.The existing decoder still clamps raw
LAST_LEVELtoMAX_MIPwhenBASE_LEVEL <= MAX_MIP. The reported 28x1 LAST_LEVEL=9 / MAX_MIP=0 count of ten remains a discrepancy; this change does not fix it. A CPU LAST9/MAX6 control pins that unchanged decode. Samples/gathers past the chain still clamp to represented data, with console behavior unverified. There is no local PS5 or 3D/cube resinfo hardware claim.External evidence is attributed, not counted as our own testing:
Tested
Windows Server 2025 (10.0.26100), WinLibs MinGW-w64 GCC 15.2.0, Release. Final publication candidate
0e1f2ab53b596a4d33ec8426097bda2c05b82068on main676d423968a1a8fcc79c6247020ce22090a8e0d4.Seven selected Release/O3 targets complete; the final restored incremental build took 14.06 seconds. Four CPU/mock CTests passed without skips in 14.91 seconds: agc_shader_bindless, agc_shader_memory, agc_shader_disk_cache and agc_driver_graphics. Two precise current-source controls failed at the intended single-unrepresented-base admission and repacked mip-5-of-5 copy assertions. Source was restored, rebuilt and retested. Conventions pass against the pinned base and later main
72a3d9f2a49d; its clean merge was checked separately from this 676-based execution.The recording mock checks ordinary and beyond-chain sampled/upload/storage sRGB expansion and repacked-copy allocation, view and copy bounds. Device query fixtures cover shortened and ordinary five-level views, single-level base 7 / last 7, 2D/2D-array layouts, LOD=count/count+1/31/UINT_MAX, and uniform/mixed lanes. The inherited llvmpipe mixed-LOD exclusion remains; no Mesa-version cutoff is newly claimed.
Current-head device checks passed 5/5 registrations / four executables without skips in 4.35 seconds on the RTX 3060, sequentially in the managed slot. Required cases: image_levels_past_chain, image_sample_lod_clamp, image_srgb_load, image_srgb_sample_copy and forced sRGB-copy. The frozen naturally dirty query control at this same source head exited 1 in 0.90 seconds and reproduced both expected errors (LOD10 width1 instead of0; LOD5 width28 instead of0), with actual RTX/Vulkan initialization. The checker requires both diagnostics; this is an expected regression failure, separate from the five passing production cases. Device skips/exit77 are not passes. The selective control removes only the zero-extent selection, retaining the safe physical query LOD and guest count; count-boundary mismatches must be observed to count it as a meaningful red.
Runtime hashes were verified before and after; ANYPS5_REQUIRE_VULKAN=1 was set. No fresh title, FPS, console-equivalence or playability result is claimed by this update.
Shared-source coordination is pending: #7550 codec order and #7579 eligibility-line order propose this PR first, with both changes retained by the later rebase. Those proposals are not agreements, so the verified update remains a draft. #7085 already declares this PR as a prerequisite; its depth/layer/level argument order must be reconciled by meaning. There is no additional standalone build dependency or combined-runtime claim.
Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)Co-Authored-By: Codex noreply@openai.com