Repository navigation
Conversation
A T# or a color target may name more mip levels than its extent halves into. On RDNA a level's extent is max(1, extent >> level), so the levels past floor(log2(max(width, height, depth))) + 1 are more 1x1 levels with texels of their own in guest memory. A Vulkan image cannot have them (VUID-VkImageCreateInfo-mipLevels-00947), but the sampled texture upload, its block and depth copies and the storage image created their images with the descriptor's level count and copied every guest level into them. Demon's Souls (PPSA01342) samples 28x1 and 4x1 BC3 and BC7 arrays through T#s of 8 to 11 levels, among them a 28x1 BC3 array of 256 layers and 10 levels whose extent holds 5. NVIDIA (RTX 3060, 591.86) sizes a 28x1 BC3 image of 10 levels like one of 5 (0xc00 bytes a layer), so the copies of levels 5-9 wrote past the image's memory. Each of the title's seven device losses followed the creation of such a texture; in the run with the address log, VK_EXT_device_fault reported a write fault at the first byte past that image. SurfaceGeometry::imageLevels is the descriptor's level count, at most FullMipChainLevels of the extent. Sampled textures and their block and depth copies create, transition and copy only those levels, and their views keep the base level, the level count and the minimum LOD inside them: a view of levels past the chain reads the image's last level. Storage images hold the same levels. Their uploads, write-backs, clears, barriers and copy regions cover only those levels, so the guest bytes of the levels past the chain are neither read into the image nor written back. A storage view or a color attachment of a level past the chain throws, and so does creating a storage image for such a level. A fill or a buffer copy over such a surface is no longer turned into a clear or an image copy (FillClear and CopyFrom refuse it), since that would leave the levels past the chain unchanged, and the surface is tracked per layer: a 64 KiB unit of it may hold only those levels, which no slice window moves. docs/dev/debt/libSceAgcDriver.md records the levels that are not represented. Test: agc_driver_graphics (tests/TextureMipChain.cpp) runs the sampled upload of the 28x1 BC3 10-level array, a 4x1 11-level one and two full chains, and a 28x1 RGBA8 storage surface of 10 levels (upload, views, a color target, a fill, a buffer copy and a write-back) and a full 64x32 storage chain, through a recording mock device. It checks that every image, copy, barrier, clear and view stays inside the levels the extent can hold and that the accesses past them throw or are refused. On main it fails with "28x1 BC3 with 10 levels: the image was created with 10 mip levels, more than its 28x1 extent can hold (5)"; with only the sampled texture part it fails with "a 28x1 storage image of 10 guest levels must keep the 5 levels its extent has, not 10". Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The previous commit gives a sampled view of a T# whose levels reach past its extent's full mip chain only the levels of that chain. Shader accesses that see the level count then diverged from the T#: image_get_resinfo returned the view's count (5 for the 28x1 T# of levels 0-9 that Demon's Souls samples, 1 for its levels 7-9) instead of LAST_LEVEL - BASE_LEVEL + 1, and its sizes at those LODs came from an out-of-range OpImageQuerySizeLod. image_get_resinfo adds the levels the view lacks to OpImageQueryLevels and returns 1 for the width, height and depth at a LOD the view does not hold. Both follow query_levels and lower_query_size in Mesa's src/amd/common/nir/ac_nir_lower_resinfo.c, which derive them from the descriptor: LAST_LEVEL - BASE_LEVEL + 1 and max(1, extent >> (BASE_LEVEL + lod)); every level past the chain is 1x1. The count comes from ResourceMaterializer::LevelsPastChain, which repeats the driver's view rule, as a pipeline specialization constant (LevelsPastViewBase) or, for registration modules, in bits 22-25 of the runtime image metadata flags. The tracker records which image accesses observe levels (ImageResource::levelUses), which moves the shader disk cache format to 37. MIMG BY2/BY4 and PCK2/PCK4 loads stay as they are: on hardware they return zero at every level narrower than their N texels, so a level the view lacks reads zero either way. image_load_mip and image_get_lod, an image_load through a T# whose base level lies past the chain, and image_get_resinfo through an image table cannot be exact (the texels of those levels are not represented, and a table does not carry the missing count), so such a descriptor is refused: the draw or dispatch throws, an image table entry faults. docs/dev/debt/shader.md records it. Test: agc_driver_image_levels_past_chain (tests/execution/ ImageLevelsPastChain.cpp) runs on the device: image_get_resinfo of a 28x1 2D and 2D-array T# of levels 0-9 at LODs 0-9 and of levels 7-9, image_load_mip and image_load at base level 7 refused, image_sample_l of levels 0-4 and image_load at base level 0 reading the uploaded texels, and an image_store to level 0 of a 28x1 R32_UINT surface of 10 levels (linear and R64KBX) changing only that level's 28 texels in guest memory. Without this commit it fails with "image_get_resinfo of a 28x1 2D T# of levels 0-9 at LOD 0: the level count is 5, expected 10" and the two loads run. agc_driver_graphics (tests/TextureMipChain.cpp) checks that LevelsPastChain matches the driver's view for seven T#s, the specialization constant and the metadata bits, and which accesses are refused; its range check also covers array layers now. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
agc_driver_image_levels_past_chain sent each of its 32 invocations another LOD (tid % levels) in one image_get_resinfo dispatch. On lavapipe the 28x1 2D and 2D-array T#s of levels 0-9 failed at LOD 1 with a width of 28 instead of 14 (boykopovar#6280), although the module is right: OpImageQuerySizeLod takes any integer LOD per invocation. Mesa's llvmpipe up to 25.2 answers the size query of a vector of invocations at the LOD of its first one (lp_build_size_query_soa in src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c, "FIXME: this needs to honor per-element lod"), which bc56ec7ce032 (gallivm: Implement txs with divergent explicit lod) removed in 25.3.0. Applied to the emitted instructions, that behaviour gives exactly these two failures and passes the levels 7-9 case, where every width is 1. Every LOD of the T# now gets a dispatch of its own, with the same expected width, height, layer count and level count. The dispatch with a different LOD per invocation still runs on every device but llvmpipe, which prints that it skips it. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Keep out-of-range queries on a valid Vulkan LOD, zero their extent and layer results, and retain the guest level count. Cover shortened and ordinary views, a single unrepresented base level, and capped sRGB copy paths. Preserve the active refusal for loads whose single base mip is not represented. Co-Authored-By: Codex <noreply@openai.com>
Keep the repacked image, its view and refresh regions inside the levels allocated for the source extent. Exercise ordinary and unrepresented guest base levels through the recording mock device. Co-Authored-By: Codex <noreply@openai.com>
Set the recording device's compute group-count limits so the repack refresh control reaches its recorded copy bounds. Qualify the existing raw LAST_LEVEL/MAX_MIP query discrepancy without changing decode behavior. Co-Authored-By: Codex <noreply@openai.com>
…base-extra-mip-maina700-20261020
…p-extra-mip-maina700-20261020
…base-extra-mip-main903c-20261020
…p-extra-mip-main903c-20261020
…p-extra-mip-main7c-20261020 # Conflicts: # core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
…base-extra-mip-main7c-20261020 # Conflicts: # core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp # docs/dev/debt/shader.md
Address the ordinary-image clear regression reported by @aKazm1 in boykopovar#7085 (issuecomment-7182946593). Preserve the Vulkan subresource ranges for images whose guest levels fit the physical chain.
# Conflicts: # core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp # core/shader/recompiler/ShaderDiskCache.hpp
…codex/sweep-7085-20261128
…eep-7085-20261128
|
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.
|
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
Back admitted guest mip levels beyond the physical chain with separate 1x1x1 storage images, preserving guest offsets, layers, barriers, ownership and accounting. Uploads, attachment/storage views, ClearMip, mirror publication and readback use the selected backing. Sparse uploads retain the final physical mip exposed by the view. Unsupported sampled consumers and extra-level whole-surface optimizations still refuse. boykopovar#6280/boykopovar#22724 remain prerequisites; original author and maintainer history is retained. Shader cache format remains 111.
Sonic Unleashed Recompiled (PPSA99902, boykopovar#4443) needs the extra attachments in boykopovar#7066. Historical main stop:
AGC graphics: a color target of mip level 10 of a 512x256x1 surface of 12 levels is not implemented: a Vulkan image of that extent holds 10 levels, and the 1x1 levels past floor(log2(max extent)) + 1 are not represented.Tested
1 December: head 7f1810d, frozen main 7d3d015. Resolved the Texture.hpp declaration conflict with main's boykopovar#18185 D16S8/raw storage formats work, retaining the extended factory/constructor declarations and all extra-mip helpers. Both sources build full native libraries/relinker and selected real fixtures; ordinary/profiling Graphics suites pass. 68/68 focused execution CTests pass across physical RTX 5080/AMD Radeon Graphics: 62 diagnostic-clean, six with exactly main's existing depth-plane warnings. Main passes 66/66; 52 matching processes have identical diagnostics, with 16 extra capabilities absent on main. Added D16 conversion/sampling/descriptor lifetime and normalized/float packed-store checks cover the directly overlapping main behavior. No new VUIDs/skips, actual device/layer insertion verified, required Vulkan/cache-off/Khronos 1.4.363; GPU processes below 30 seconds. BY extra-base compiler/refusals pass separately on both devices without dispatching the unsupported load. Pins, commands, executable hashes and complete logs.
The previously fixed ClearMip sibling-generation bug remains covered: the 30 November old-code control fails on both GPUs when CPU writes to a sibling are collected before the clear. Fix 8a8f467 refreshes the admitted texture before publishing broader generation state. Final-source mirror-before-writeback and complete guest/padding/guard comparisons pass for 4x2/5-level and 1x1/3-level layouts. Seven relevant backing/barrier/readback/ClearMip functions are unchanged by this merge, so the historical fault control retains its pin rather than being rerun unnecessarily.
The source-only no-blocking-findings review is COMMENTED, not full approval; the older formal change request remains for reviewer reconciliation. The upload/readback source audit and earlier external CI qualification retain their b5c5978 pins and are not represented as CI of this new head. #28176 now inherits that parent and reports Intel Iris Xe tests including the sibling regression, with additional external RX 6700 XT results; credited external child evidence, not our local qualification. Its separate sampled-load capability tracks boykopovar#27616. The SAROS report retains its local wait-patching qualification.
Conventions/template and whitespace pass. Earlier layer/placement, sparse/BY, and ClearMip controls keep their original pins. No fresh game/FPS, Linux/full-CTest, analyzer-clean, cache-executable or console-equivalence claim. Quarantined executables remain unbuilt/unrun.
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)Summary by CodeRabbit