fix(agc): match measured color comparison formats #8642
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/8642"
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 MarcZX10 on 2026-10-20T19:54:41Z.
What
image_sample_c*color comparisons currently emulate real comparisons for floating-sampled formats beyond what native GFX10 hardware does. The independent native measurements in #7934 report that, for GFX10 format codes 1–77, only code 7 (16_UNORM) and code 22 (32_FLOAT) perform comparisons; other tested codes return zero for every compare function. This change keeps those two formats on the native comparison path and lowers the other supported floating-sampled formats, including the previously special-cased 8-bit formats, to a constant-zero compare result. Scaled, integer and formats requiring converted sampling remain unsupported.The regression test updates the existing emulated color-compare cases and adds checks across representative GFX10 formats and compare functions. The PS5's gfx1013 behavior remains unverified. This PR depends on #8625 for the related array-layer, NaN and TRUNC_COORD corrections; the test-file overlap will be rebased after it lands.
Tested
git diff --check upstream/main...HEAD: passed.python3 tools/check_conventions.py --base upstream/main: passed.tools/check_compile.pywith the existing configured compile database: both changed translation units compile.agc_driver_emulated_color_compare; no test executable is available in the configured build directories and the shared filesystem has 24 MB free. The hosted PR build jobs were skipped by path filtering, and the manual build dispatch was denied by repository permissions.Checklist
main; no other open PR implements this measured format behavior (#8625 is related and listed as a dependency).mdfiles or images added to the repositoryImported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-20T20:15:51Z.
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.
core/libs/prx/libSceAgcDriver/tests/execution/EmulatedColorCompare.cppcore/shader/recompiler/Optimization/src/ResourceMaterializer.cppcore/libs/prx/libSceAgcDriver/Execution/include/VulkanDevice.hppcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/Execution/include/VulkanDevice.hppcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppdocs/dev/debt/shader.mdcore/shader/recompiler/Optimization/src/ResourceMaterializer.cppdocs/dev/debt/shader.mdcore/libs/prx/libSceAgcDriver/Execution/include/VulkanDevice.hppcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/Execution/include/VulkanDevice.hppcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/Execution/include/VulkanDevice.hppcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/Execution/include/VulkanDevice.hppcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppdocs/dev/debt/shader.mdcore/shader/recompiler/Optimization/src/ResourceMaterializer.cppdocs/dev/debt/shader.mdcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/shader/recompiler/Optimization/src/ResourceMaterializer.cppdocs/dev/debt/shader.mdcore/shader/recompiler/Optimization/src/ResourceMaterializer.cppdocs/dev/debt/shader.mdcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppdocs/dev/debt/shader.mddocs/dev/debt/shader.mdcore/libs/prx/libSceAgcDriver/Execution/include/VulkanDevice.hppcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/shader/recompiler/Optimization/src/ResourceMaterializer.cppcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/Execution/include/VulkanDevice.hppcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppdocs/dev/debt/shader.mdcore/shader/recompiler/Optimization/src/ResourceMaterializer.cppcore/libs/prx/libSceAgcDriver/Execution/include/VulkanDevice.hppcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/shader/recompiler/Optimization/src/ResourceMaterializer.cppcore/shader/recompiler/Optimization/src/ResourceMaterializer.cppdocs/dev/debt/shader.mdcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppdocs/dev/debt/shader.mdcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppdocs/dev/debt/shader.mdcore/libs/prx/libSceAgcDriver/Execution/include/VulkanDevice.hppcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/shader/recompiler/Optimization/src/ResourceMaterializer.cppdocs/dev/debt/shader.mdcore/libs/prx/libSceAgcDriver/Execution/include/VulkanDevice.hppcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/Execution/include/VulkanDevice.hppcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppImported from boykopovar/AnyPS5. Originally posted by DavidAmsellem on 2026-10-20T20:35:54Z.
RADV run of this PR, and one validation finding. Head
092a66773merged ontomainaa1b1bfce(clean merge; it doesn't merge on top of #8625 yet, so this is the PR on its own), built in full.AMD Radeon RX 7900 XT (RADV NAVI31, gfx1100), Mesa 25.2.8, Linux Mint 22.3 (Ubuntu 24.04 base), kernel 7.0.0-38, GCC 13.3, Release.
agc_driver_emulated_color_compareandagc_driver_emulated_color_compare_srgb_decode: pass 3 of 3 each withANYPS5_NO_SHADER_CACHE=1.ANYPS5_REQUIRE_VULKAN=1 ctest -j8) at98c27d0e7: 1733/1734, failing onlyagc_driver_guest_memory_lifetime(#7784), which fails onmaintoo. No ctest entry is added, skipped or removed.Validation: with the Khronos validation layer,
mainreports no VUID in these two tests, but with this PR each of them reports three, all for the same image:They come from format code
51uin the new loop inEmulatedColorCompare.cpp(the{1u, 2u, 8u, …, 77u}list), which maps toVK_FORMAT_A2B10G10R10_SNORM_PACK32. RADV doesn't support that format as an image at all. A standalone query on this machine gives:vkGetPhysicalDeviceImageFormatProperties2(2D, SAMPLED | TRANSFER_DST)0x00x0VK_ERROR_FORMAT_NOT_SUPPORTED0xd0810xd081VK_SUCCESSSo CI on lavapipe can't see it. The test still passes because the compare now returns zero without reading the texel, but it creates, uploads to and views an image the driver doesn't support. Skipping a format whose image format properties query fails, or using a different representative code in its place, would keep the case valid on RADV. The other 17 codes in the list produce no VUID here.
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 MarcZX10 on 2026-10-20T20:38:32Z.
Thanks for the RADV validation report. I removed format 51 from this execution-test loop because its mapped VK_FORMAT_A2B10G10R10_SNORM_PACK32 image is unsupported on RADV NAVI31; the comment records why. This avoids creating an invalid image on that device, though it means this particular format is no longer exercised by this test on devices that support it. Commit
ee2d9a4876is pushed to the existing PR branch.git diff --checkpasses; I have not run the Vulkan test locally in this environment. The PR checks are still pending.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-20T20:40:01Z.
Follow-up: I refined the fix so format 51 is still tested on devices that support its sampled 2D optimal-tiling image. The test now queries the exact image-format/usage combination and skips only that case when unsupported (as on RADV NAVI31). I pushed this as a second focused commit,
745ff15b80; the prior commit removes it unconditionally, and this follow-up restores supported-device coverage.git diff --checkandpython3 tools/check_conventions.py --base upstream/main --head HEADpass. I could not build or run the Vulkan test locally because the workspace has only about 900 MB free. Please rerun CI and the RADV validation case on the updated head.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-20T21:27:13Z.
Thanks for the RADV report and the validation-layer details. The unsupported format finding prompted a follow-up on the PR head (
745ff15b80): it now queries the exact sampled 2D optimal image/usage combination and skips format 51 only when that query reports unsupported, preserving coverage where supported. The current hosted workflow skipped the AGC runtime tests, so the RADV validation result on this updated head is still outstanding.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-20T21:56:37Z.
Overlap clarification for #8014: the shared
VulkanDevice.hpphunk is adjacent declarations only. This PR addsSupportsImageFormat(VkFormat, VkImageUsageFlags)for the format-51 test guard; #8014 addsBdaAtomicsUsable()andRasterOrderGroupUsable()for the pixel-interlock test. They have separate implementations and no dependency or duplicate behavior. If both land, the declarations in this header should simply be retained together.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-20T22:36:59Z.
Thanks for catching this with the Khronos layer. The current head
745ff15b80e897accd9ee18c563822dde00036c9now checksvkGetPhysicalDeviceImageFormatPropertiesfor the exact image usage before exercising format 51 and prints an explicit skip when unsupported, so this does not rely on the compare path returning zero to conceal an invalid image. The focused follow-up hosted run only ran policy checks; could you rerunagc_driver_emulated_color_comparewith validation on the new head to confirm the VUIDs are gone?Imported from boykopovar/AnyPS5. Originally posted by janzezno on 2026-10-20T23:04:31Z.
Run on AMD hardware, tested alone on
main(not stacked on #8625; the two conflict inEmulatedColorCompare.cpp).Host: Arch Linux, kernel 7.2.11, AMD Radeon RX 7900 GRE (RADV NAVI31), Mesa 26.2.5, GCC 16.2.1, Release,
BUILD_TESTING=ON.maine25333e39; PR head745ff15b80merged on top (clean merge).ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation ctest --test-dir build -R 'compare|denorm|f32|f16|f64|agc_shader_memory|agc_shader_disk_cache|request_serializer|dcc|storage|pm4|indirect' -Vmain: 137 of 137 pass. PR: 137 of 137 pass, includingagc_driver_emulated_color_compareandagc_driver_emulated_color_compare_srgb_decode.VUID-set and counts on both; none is new. The validation layer loaded in both runs.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-20T23:04:50Z.
Thanks for running the exact updated head on RADV with the validation layer and a main control. The 137/137 result on both sides, including both color-compare tests, and the unchanged VUID set/counts confirm that format 51 is skipped safely where unsupported without adding validation findings. This resolves my outstanding validation request for the current head.
Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-21T00:18:04Z.
Windows data point for
745ff15b80, merge-tree againstmain5b59fbc55clean: Windows 10.0.19045, MinGW-w64 GCC 15.2.0, Release.ctest -N -R '^agc_driver_emulated_color_compare$'lists exactly that one test;ctest --no-tests=error -R '^agc_driver_emulated_color_compare$'was run three times per tree. The test selected the NVIDIA GeForce RTX 4080 SUPER (an RX 6400 is also present, driver versions not recorded).core/shader/recompiler/Optimization/src/ResourceMaterializer.cpprestored tomain(the new test cases and theVulkanDevice::SupportsImageFormathelper kept, because the test needs it to build): fails 3 of 3 (ordinary test failure, not a crash).This is a run of the PR's code on an NVIDIA device, not gfx1013 data; the comparison semantics under test are the PR's own rules.
Not tested: PS5 gfx1013, other platforms, a title run,
agc_driver_emulated_color_compare_srgb_decode.AI-assisted (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-21T00:23:41Z.
Thanks for the Windows exact-head run. The RTX 4080 SUPER test passes 3/3 and the restored-main materializer control fails 3/3, so this adds useful independent evidence that the materializer change is necessary on that NVIDIA path. I am keeping the limits explicit: it does not establish gfx1013 behavior, PS5 behavior, or the separate sRGB-decode test, and no validation-layer result was included.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-21T00:51:57Z.
Thanks for the RADV validation and for identifying the unsupported format. The current head
745ff15b80now queries support for format 51 before creating the image and skips that case when the device does not support the required sampled/transfer-destination usage. I also checked the follow-up report on that head: 137/137 tests pass, and the validation VUID set is unchanged frommain. The PR does not claim PS5 gfx1013 validation.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-21T00:55:59Z.
Thanks for the exact-head runs on RADV and Windows/NVIDIA. I added the unsupported-format capability guard after the initial RADV report. The follow-up reports show 137/137 selected Linux tests passing with the validation VUID set unchanged from
main, and three Windows runs passing with a main-code negative control. The PR still does not claim PS5 gfx1013 validation.Imported from boykopovar/AnyPS5. Originally posted by thuanquang on 2026-10-21T04:39:42Z.
An AMD proprietary-driver run: RX 6700 XT (gfx1031), AMD Windows driver 32.0.21045.5002, Windows 11 26200, MinGW GCC 15.2.0 Release. I tested
main7ab4b2e56merged with this head745ff15b8(clean merge), without #8625.agc_driver_emulated_color_compareand_srgb_decode,agc_driver_depth_compare_copy,agc_driver_image_plane_compare_on_lineandagc_driver_image_one_dimensional_compare.ctest -Von the same 5: 0VUID-lines, the same as onmain. The layer was inserted in all 5 test processes.Not run: a red control. This PR's test file alone did not build on
mainhere, so this is the PR side only.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-21T04:42:54Z.
Thanks for the exact-head AMD proprietary-driver run. The 5 focused tests pass 3/3 with the validation layer loaded and no new VUIDs, which adds the Windows AMD coverage missing from the RADV and NVIDIA reports. The limitation is clear: there is no red control in this run, and it does not measure gfx1013/PS5 behavior.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-21T05:34:08Z.
Thanks for the AMD proprietary-driver run and the validation-layer check. The five targeted tests pass, with no new VUIDs on that setup; the missing red control means this is additional pass evidence rather than a direct before/after result.
Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-21T19:03:23Z.
Checked the format split against our earlier gfx1035 measurement (only 16_UNORM and 32_FLOAT compare; 8-bit UNORM/sRGB and 16_FLOAT return 0 for every function) and the gfx1031/gfx1036/gfx1100 sweeps in #7934, the zero-result tests against main's materializer (red there, per @xXPBSXx's control), and the RADV, NVIDIA and AMD Windows runs above; merged.
SpirvImageEmitter.cpp(UNORM/SNORM reference clamp, the compare chain) and the bilinear-cubeDISABLE_CUBE_WRAPthrow inResourceMaterializer.cppare unreachable and can be removed; #8625 edits that same code.