fix(agc): restrict sampled storage texture view usage #862
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/862"
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?
Imported from boykopovar/AnyPS5. Originally posted by lvmino97 on 2026-10-06T10:20:18Z.
What
Sampled sRGB views of storage textures inherit STORAGE usage from the backing image. This triggers VUID-VkImageViewCreateInfo-usage-02275 when the sRGB format does not support storage images.
Set VkImageViewUsageCreateInfo to SAMPLED for these views. Keep the minimum LOD chain and first-layer array views intact.
The recorder test checks both array views, checks that minimum LOD chaining preserves the usage restriction, and samples the selected layer to verify sRGB decoding.
Tested
Windows, Core Ultra 7 265K, RTX 5080, GCC 15.2.0.
5895ea72with this change.Found while testing Astro Bot PPSA21564 v01.007.000 with Vulkan validation. This fixes the view usage error; the separate device-loss failure remains. The full repository test suite was not run.
Checklist
Imported from boykopovar/AnyPS5. Originally posted by frankea on 2026-10-10T04:41:31Z.
Full Windows suite for this draft, since the description says it was not run. Head
bbcaad4bmerged onto currentmainc72d5ce1(clean); Windows 11 10.0.26200, RTX 4090 (NVIDIA 616.92), MinGW-w64 GCC 15.2.0 r7, Release,BUILD_TESTING=ON.agc_driver_recorderandagc_driver_graphics.video_out_flip_controlsexiting with0xc0000374. That is #2540, pre-existing: 2 of 40 direct runs crash the same way on this machine both with and without this PR.SDL_DIRECTINPUT_ENABLED=0was set for the run because of #1042.No title was run. Tested with AI assistance (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by Mouhand-Kaddo on 2026-10-10T10:22:35Z.
Additional platform validation on standalone PR head
bbcaad4b2f0fd8b91dd4430e520c86c1bacb147f:Linux: passed — Arch Linux in WSL2 (kernel 6.6.87.2), GCC 16.2.1 20260810; CMake 4.3.1 / Ninja.
Release /
BUILD_TESTING=ON: built the selected test targets; 1 CTest cases, 0 failures, 0 CTest skips.Tests:
agc_driver_graphics.Reproduce after building the test targets:
ctest --test-dir <build> --verbose --no-tests=error --timeout 30 -R "^(agc_driver_graphics|agc_pipeline_cache|agc_unchanged_cpu_stamps|agc_host_import_unmap|agc_recorder_kept_bytes)$".Vulkan: Mesa lavapipe 26.2.4 software Vulkan; no native Linux GPU/retail-title validation.
Internal limitation: write-watched guest-heap mirror subcases returned early because WSL userfaultfd async write protection is unavailable. The other graphics assertions ran; zero CTest skips does not include this internal early return.
Direct recorder executable: passed, including firstLayerViewTests sRGB usage assertions.
Imported from boykopovar/AnyPS5. Originally posted by milescoviello on 2026-10-18T02:21:38Z.
Title data for this PR from Super Meat Boy 3D (PPSA31162) under the Khronos validation layer (1.3.275). Linux 6.8, RTX 4070 Ti, NVIDIA 595.99.02, Release, 180 s with pad input, warm cache, one run per build.
The base is
main195d0d08a8plus three unrelated perf PRs of mine (#6917, #7288, #6179). The other build is the same plus this PR's headbbcaad4b2f, which merged cleanly.VUID-VkImageViewCreateInfo-usage-02275All 31 errors on the base are
R8G8B8A8_SRGBviews of a 3840x2160 storage image of guest format 130, created by theTexture ... viewed from storage image (vk=43)path. With the PR none are reported, although that run created more such textures. The other errors are the same in both runs:pAttachments-00605(independentBlend, #6782), pluspLibraries-06681andVkDeviceCreateInfo-pNext-pNext, which this older layer also reports onmain.Forspoken (PPSA03984) on
mainshows the same error once in 200 s.AI-assisted: yes (Claude Code)
Imported from boykopovar/AnyPS5. Originally posted by Amoenus on 2026-10-18T18:15:41Z.
2026-10-21 UTC baseline follow-up: unmodified literal main
e10b4d6190479edcabfe3f805169b76b18ffaaaa, without #6280 or our extra-mip change, still reports the same diagnostic.agc_driver_image_srgb_sample_copyreturns CTest success3/3 on each actual RTX5080 and Radeon Graphics, with oneVUID-VkImageViewCreateInfo-usage-02275validation error per process: six errors total. The forced-copy group passes3/3 per GPU with zero VUIDs/errors/warnings. Loaded Khronos1.4.363, required Vulkan, application shader cache/pipeline journal disabled, fresh serial processes,30s bounds, no skips/timeouts; same Windows11 Enterprise26200/drivers610.62 and32.0.21036.18 setup below.This is a fresh baseline-only observation, not a new run of your unchanged
bbcaad4b2fhead. The earlier exact-peer composition/fault comparison remains at its original source pins below. The current extra-mip qualification keeps this existing diagnostic explicit; its candidate results are still pending. AI-assisted: yes (Codex).Earlier peer-fix validation at its original pins
Independent confirmation of the constructor usage fix on both physical vendors.
Baseline 918ffdb509 is main218aa8f00b plus #6280/#6934 and our extra-mip proposal. The newly merged upstream
agc_driver_image_srgb_sample_copyfixture returns success3/3 on each GPU, but every process reports oneVUID-VkImageViewCreateInfo-usage-02275: its R8_SRGB sampled view inherits STORAGE usage. That is3 errors per vendor (6 VUID text occurrences per vendor because each diagnostic repeats the ID), not a clean pass. The forced-copy mode is already validation-clean before this patch.I merged your exact head
bbcaad4b2f0fd8b91dd4430e520c86c1bacb147f, preserving its original authorship and both changed files, into validation composition d1a9126a5b. No production adaptation was needed: its only production delta from918 is your3-line usage restriction.Full Windows relinker/library and affected fixture builds pass. The ordinary sRGB copy, forced-copy and existing
agc_sampled_storage_base_level_usagegroups each pass3/3 per physical GPU: 9 NVIDIA +9 AMD, plus3 CPU graphics passes. Actual device identity and Khronos1.4.363 loading are verified per GPU process; zero VUIDs, validation errors/warnings or skips. All processes fit30s. This validates the existing upstream base-level mode and R8 fixture; it does not claim execution of every Recorder.cpp case.Hardware: RTX5080
10de:2c02, driver610.62/32.0.16.1062; AMD Radeon(TM) Graphics1002:13c0, driver32.0.21036.18; Windows11 Enterprise26200, WinLibs GCC15.2r7. Source pins were frozen. Conventions pass against later main5057673804. These are composition/component results, not a standalone-head Linux or game-unblock claim. No duplicate issue or implementation PR is being opened.AI-assisted validation/report: yes (Codex).
Imported from boykopovar/AnyPS5. Originally posted by DavidAmsellem on 2026-10-19T14:20:50Z.
First AMD-on-Linux (RADV) data for this PR. Merged onto
mainc4708fa20(clean merge) and compared with the samemain, on the same machine.Linux Mint 22.3 (Ubuntu 24.04 base), kernel 7.0.0-38, GCC 13.3, Release. AMD Radeon RX 7900 XT (RADV NAVI31, gfx1100), Mesa 25.2.8. Khronos validation layer 1.3.275, confirmed loaded with
VK_LOADER_DEBUG=layer.ANYPS5_NO_SHADER_CACHE=1mainVUID-VkImageViewCreateInfo-usage-02275agc_sampled_storage_base_level_usageforR8G8B8A8_SRGB, also on lavapipe; 1 inagc_driver_image_srgb_sample_copyforR8_SRGB, on RADV only)agc_sampled_storage_base_level_usage,agc_driver_image_srgb_sample_copyThe only other
VUID-lines in these runs come from the old layer:VkDeviceCreateInfo-pNext-pNext, because it predatesVK_KHR_maintenance8, andVkGraphicsPipelineCreateInfo-pLibraries-06681. Their counts are identical with and without the PR (4 and 26). The PR adds no newVUID-.Full suite without the layer (
ANYPS5_REQUIRE_VULKAN=1 ctest -j8): 1631/1633 on bothmainand with this PR. The two failures are the same on both:agc_driver_image_table_vouched_lookups(#7766, fix in #7916) andagc_driver_guest_memory_lifetime(#7784).GPUs tested: AMD Radeon RX 7900 XT (RADV NAVI31, gfx1100), Mesa 25.2.8, Linux Mint 22.3 / kernel 7.0.0-38
AI-assisted: yes
Imported from boykopovar/AnyPS5. Originally posted by DavidSamir on 2026-10-21T13:41:00Z.
AMD Radeon 680M (Windows 11, AMD 32.0.21030.2001),
VK_LAYER_KHRONOS_validation(SDK 1.4.363),ANYPS5_REQUIRE_VULKAN=1,ANYPS5_NO_SHADER_CACHE=1.main2f161d4f3with and without this PR:main:agc_sampled_storage_base_level_usagelogsVUID-VkImageViewCreateInfo-usage-02275x2 (R8G8B8A8_SRGBview inheritingSTORAGE), andagc_driver_image_srgb_sample_copylogs it x1 (R8_SRGB).main: both tests pass, with 002275lines.AI-assisted: yes
Imported from boykopovar/AnyPS5. Originally posted by VicRaster on 2026-10-21T17:36:47Z.
Independent Windows GPU confirmation against the standalone PR head, rather than a merge onto newer main:
5895ea721a43f48547cc996aee0bb65b603622acbbcaad4b2f0fd8b91dd4430e520c86c1bacb147fThe paired runs used identical test executables and support libraries, changing only
libSceAgcDriver.prxbetween the two revisions.Verified fix: our synthetic RGBA8 storage-to-sRGB sampling test reports
VUID-VkImageViewCreateInfo-usage-02275once on the parent and zero times on the head. Two GPU stores, sampled decoding and surrounding-byte checks pass on both, so pixel checks alone would miss the parent's invalid view usage. Your added Recorder.cpp regression also fails on the parent withthe sRGB sampled view inherits unsupported storage usageand passes on the head.Follow-up: the three separate, pre-existing validation errors already have upstream fixes:
VUID-vkDestroyDevice-device-05137: traced to a retained host-import buffer and memory allocation surviving device teardown. Fixed by #1239: release host imports before the device is destroyed.VUID-vkBeginCommandBuffer-commandBuffer-00050: the old recorder fixture lacks the reset flag required for implicit command-buffer reset. Recorder.cpp's flag was added in #1308.VUID-vkCmdPipelineBarrier-srcAccessMask-02815: the old unit-shadow test combines HOST_WRITE access with an ALL_COMMANDS source stage lacking HOST. Fixed by #7723: name the host stage in the unit shadow tests' host-write barriers.The common recorder executable emits the same 10 command-buffer and 7 barrier messages with either original driver. Validation suppresses duplicates after 10 reports, so these are emitted-message counts, not total violation counts. The graphics mock suite passes on both.
Follow-up isolated controls confirmed each cause: the reset flag removes only the command-buffer errors, adding HOST removes only the barrier errors, and both together give a clean recorder pass. A minimal import probe identifies its exact buffer/memory handles in the teardown diagnostic; reconciling the import table removes that error. Backporting the existing host-import teardown cleanup also makes the original sRGB test validation-clean while preserving its pixel and guard checks.
All six GPU processes in the original paired comparison positively loaded Khronos validation 1.4.363 with
ANYPS5_REQUIRE_VULKAN=1,ANYPS5_NO_SHADER_CACHE=1andVK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation. The follow-up controls used the same required validation settings. Full stdout/stderr was checked; no missing-layer warnings or GPU skips.All three upstream corrections were confirmed by source and ancestry at main
950388bfd242c0939536d40ce8cc170d2bf069a1. The follow-up executions tested the old revision with isolated corrections; current main was not rebuilt in that investigation.This confirms the narrow sampled-view correction. The other diagnostics are older issues already addressed upstream, not regressions introduced by this PR. This is not a validation-clean full-suite or game-performance claim. No game was run.
AI-assisted testing and report: Codex.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-23T02:33:24Z.
Review: APPROVED
Reviewed — looks good
The change restricts storage-backed sampled image views to sampled usage, and the added recorder coverage checks sRGB decoding for both array views and with minimum LOD chaining.
What I ran
Reviewed head
bbcaad4b2f0fd8b91dd4430e520c86c1bacb147f. No commands or tests were run in this review; author-reported test results are not independently verified.Results
Findings
Blocking
None.
Non-blocking
None.
Not verified
The build, recorder and graphics tests,
git diff --check, and behavior on physical hardware were not verified here. Read:core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp(relevant ranges),core/libs/prx/libSceAgcDriver/tests/Recorder.cpp(relevant ranges), and the prepared description, commits, manifest, and diff. No changed files were excluded bymanifest.json.To get this to a good state
Nothing is required.
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.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.