Skip to content

test(agc): export the front-face bits through a uint target as uint - #7746

Merged
oneandonlydean merged 2 commits into
boykopovar:mainfrom
YossiYad:fix/front-face-all-bits-uint-target
Oct 20, 2026
Merged

oneandonlydean merged 2 commits into
boykopovar:mainfrom
YossiYad:fix/front-face-all-bits-uint-target

Conversation

@YossiYad

@YossiYad YossiYad commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

What

Refs #7703.

agc_driver_front_face_all_bits binds a VK_FORMAT_R32_UINT color target but drives the pixel export through targetOutputMode[0] = 1 (SPI_SHADER_32_R) with uintExport left clear, so the recompiler declares out_mrt_0 as float4. Writing a float output to an unsigned-integer attachment is undefined in Vulkan: the Khronos validation layer reports Undefined-Value-ShaderFragmentOutputMismatch on every driver, and MoltenVK's Metal compiler refuses the pipeline (#7703). Desktop drivers keep the raw bits, so the behavioural check still passed and the mismatch went unseen in CI behaviour.

The test now exports through mode 7 with uintExport set, the path a real unsigned-integer target uses: the recompiler declares out_mrt_0 as uint4 and the raw front-face bits reach the R32_UINT attachment as an unsigned integer. The pixel program exports component 0 only, so the readback values are unchanged. Test-only change; no driver source is touched.

I also recorded in docs/dev/debt/libSceAgcDriver.md that the export-format check in State.cpp refuses a UINT16_ABGR export into a non-integer target but not the reverse, so a float export into an integer target is the same mismatch at the driver level. DecodeColorBuffer maps a number format of 4 to R32_UINT from the color buffer alone, so the combination is representable; which export format a title pairs with a 32-bit integer target is not measured, so I left the recompiler as is rather than change it speculatively here.

Tested

Linux (Fedora 44, GCC, Ninja, -DBUILD_TESTING=ON), RX 7700 XT (RADV NAVI32, Mesa), based on main 4ffb0cd12b:

  • Khronos validation (VK_LAYER_KHRONOS_validation 1.4.34): on main the test prints two Undefined-Value-ShaderFragmentOutputMismatch warnings, one per draw, reporting a FLOAT output into VK_FORMAT_R32_UINT; with this change both are gone. The 8 pre-existing VUID-VkGraphicsPipelineCreateInfo-pLibraries-06681 errors are unrelated to color formats and are unchanged before and after.
  • agc_driver_front_face_all_bits: passes 3 of 3 (--repeat until-fail:3) with and without the change; the readback values (0x3f800000/0xbf800000 without all-bits, 0xffffffff/0 with it) are identical.
  • tools/check_conventions.py --base upstream/main and tools/pr_overlap.py --base main (no overlap) pass.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw; no silent stubs added
  • No notes, investigation .md files or images added to the repository
  • No new third-party code
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Unblocks: none (test validity)
  • GPUs tested: AMD RX 7700 XT (RADV)
  • AI-assisted: yes

@github-actions github-actions Bot added the fix error Closes an issue (Fixes #N) label Oct 19, 2026
@github-actions

github-actions Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

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.

Pull request Conflicting files (lines on main) Same exports Same new files
PR 4449 docs/dev/debt/libSceAgcDriver.md L213
PR 6959 docs/dev/debt/libSceAgcDriver.md L213
PR 7618 docs/dev/debt/libSceAgcDriver.md L213
PR 8099 docs/dev/debt/libSceAgcDriver.md L213

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.

Pull request Shared files not compared
PR 2434 docs/dev/debt/libSceAgcDriver.md
PR 4448 docs/dev/debt/libSceAgcDriver.md
PR 5058 docs/dev/debt/libSceAgcDriver.md
PR 5499 docs/dev/debt/libSceAgcDriver.md
PR 5925 docs/dev/debt/libSceAgcDriver.md
PR 6146 docs/dev/debt/libSceAgcDriver.md
PR 6194 docs/dev/debt/libSceAgcDriver.md
PR 6223 docs/dev/debt/libSceAgcDriver.md
PR 6235 core/libs/prx/libSceAgcDriver/tests/execution/FrontFaceAllBits.cpp
PR 6273 docs/dev/debt/libSceAgcDriver.md
PR 6280 docs/dev/debt/libSceAgcDriver.md
PR 6300 docs/dev/debt/libSceAgcDriver.md
PR 6412 docs/dev/debt/libSceAgcDriver.md
PR 6481 docs/dev/debt/libSceAgcDriver.md
PR 6548 docs/dev/debt/libSceAgcDriver.md
PR 6549 docs/dev/debt/libSceAgcDriver.md
PR 6612 docs/dev/debt/libSceAgcDriver.md
PR 6636 docs/dev/debt/libSceAgcDriver.md
PR 6683 docs/dev/debt/libSceAgcDriver.md
PR 6727 docs/dev/debt/libSceAgcDriver.md
PR 6808 docs/dev/debt/libSceAgcDriver.md
PR 6867 docs/dev/debt/libSceAgcDriver.md
PR 6868 docs/dev/debt/libSceAgcDriver.md
PR 6926 docs/dev/debt/libSceAgcDriver.md
PR 6946 docs/dev/debt/libSceAgcDriver.md
PR 6947 docs/dev/debt/libSceAgcDriver.md
PR 6977 docs/dev/debt/libSceAgcDriver.md
PR 7085 docs/dev/debt/libSceAgcDriver.md
PR 7256 docs/dev/debt/libSceAgcDriver.md
PR 7332 core/libs/prx/libSceAgcDriver/tests/execution/FrontFaceAllBits.cpp
docs/dev/debt/libSceAgcDriver.md
PR 7446 docs/dev/debt/libSceAgcDriver.md
PR 7449 docs/dev/debt/libSceAgcDriver.md
PR 7505 docs/dev/debt/libSceAgcDriver.md
PR 7604 docs/dev/debt/libSceAgcDriver.md
PR 7642 docs/dev/debt/libSceAgcDriver.md
PR 7800 docs/dev/debt/libSceAgcDriver.md
PR 7844 docs/dev/debt/libSceAgcDriver.md
PR 7862 docs/dev/debt/libSceAgcDriver.md
PR 7927 docs/dev/debt/libSceAgcDriver.md
PR 8014 docs/dev/debt/libSceAgcDriver.md

@oneandonlydean oneandonlydean self-assigned this Oct 19, 2026
@oneandonlydean

Copy link
Copy Markdown
Collaborator

Thanks, the test change looks right: with mode 7 and a uint export, the readback is raw dwords, so the all-bits checks still catch a real regression.

One small request: could you change "Fixes #7703" to "Refs #7703" in the description? This PR fixes the test, but the issue's follow-up case (a mode 1 export to a 32-bit UINT target still producing float4, State.cpp:1275) is still open in the driver, and your debt bullet records that. "Fixes" would close the issue on merge.

@github-actions github-actions Bot added docs agc libSceAgc* labels Oct 19, 2026

@jotitadev jotitadev left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apple GPU / MoltenVK run. This fixes the Metal side of #7703: agc_driver_front_face_all_bits was one of the base ^agc failures on Apple, and with this PR it passes. The full ^agc suite loses that failure and gains nothing from this PR.

Machine: Apple M2 Max, macOS 27.2, x86-64 build under Rosetta. Drivers: MoltenVK 1.4.2 (Vulkan SDK 1.4.363.0) and MoltenVK main + SPIRV-Cross #2704. Head 3aded24, PR diff applied cleanly.

Tested: the tree is main a373e85 + mugurc's macOS series (ci/macos-series-2) + the PRs needed to build on macOS (#6667, #6668, #7524, #6969, and two files of #7332), not plain main (it doesn't build on macOS yet). Applied together in the same build: #7371, #7535, #7684, #7746 and #7759, plus a test-only patch that lets nine AGC fixtures load the Vulkan loader on macOS (branch jotitadev:fix/agc-tests-vulkan-loader-macos). Base on that tree: 40 ^agc failures with MoltenVK 1.4.2 and 26 with MoltenVK main + #2704, plus agc_driver_pooled_buffer_range and agc_performance_overlay, which only run because of the loader patch.

  • With the PR: agc_driver_front_face_all_bits passes 3 of 3 on both drivers.
  • With only FrontFaceAllBits.cpp reverted, it fails on both drivers. MoltenVK rejects the pipeline with output of type float4 is not compatible with a MTLPixelFormatR32Uint color attachment, the error from #7703.
  • Full ^agc suite with the stack: the base failures minus agc_driver_front_face_all_bits on both drivers. The one new failure in that run, agc_driver_native_depth_clears, comes from #7371 / #7233 in the same build (it passes again with #7371 reverted). Nothing from this PR.

GPUs tested: Apple M2 Max (MoltenVK 1.4.2; MoltenVK main + SPIRV-Cross #2704)

Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.

@YossiYad

Copy link
Copy Markdown
Contributor Author

@oneandonlydean done, the description now says "Refs #7703", so the issue stays open for the mode 1 export into a 32-bit UINT target.

@jotitadev thanks for the MoltenVK run, good to have the Metal side confirmed.

@github-actions github-actions Bot removed the fix error Closes an issue (Fixes #N) label Oct 19, 2026
@savvaniss

Copy link
Copy Markdown
Contributor

AMD and Intel Windows data: agc_driver_front_face_all_bits passes with this PR's mode 7 uintExport path on the proprietary drivers of an AMD RX 9070 XT and an Intel UHD 770.

Windows 11 Pro 26300, WinLibs GCC 15.2.0 r7, Release, every execution test built, ANYPS5_NO_SHADER_CACHE=1, serial CTest. Intel UHD Graphics 770 (8086:a780), driver 32.0.101.7088. AMD Radeon RX 9070 XT (1002:7550), driver 32.0.31041.1004, with VkCache emptied first. This head 3aded24f4 merged into main 85029a00f.

Tests, ×3 UHD 770 RX 9070 XT
This head: agc_driver_front_face_all_bits passes passes

The change only touches the test, so there is no separate run without it; main's version of the test also passes on both GPUs, in one full-suite run each. These runs had no validation layer, so they don't check the Undefined-Value-ShaderFragmentOutputMismatch warnings, only that the uint export keeps the readback the test expects on these two drivers.

AI-assisted: yes (Claude Code)

@github-actions github-actions Bot added the needs rebase Conflicts with main, rebase needed label Oct 19, 2026
@YossiYad
YossiYad force-pushed the fix/front-face-all-bits-uint-target branch from 3aded24 to 3bdd430 Compare October 19, 2026 21:17
@YossiYad

Copy link
Copy Markdown
Contributor Author

Rebased onto current main (head 3bdd430a3, main bf2c63f85). The only conflict was the debt bullet, where main added three entries at the same spot in docs/dev/debt/libSceAgcDriver.md; I kept them and put this one after them. The test change is unchanged, and agc_driver_front_face_all_bits passes 3 of 3 on RADV.

@savvaniss thanks for the RX 9070 XT and UHD 770 runs on the Windows drivers.

@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Oct 19, 2026
@oneandonlydean
oneandonlydean merged commit b5813c0 into boykopovar:main Oct 20, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agc libSceAgc* docs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants