fix(agc): enable independentBlend for color targets with different blend states #13006

Closed
brainiac91 wants to merge 1 commit from upstream-pr/13006 into main
brainiac91 commented 2026-10-29 21:00:31 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by brainiac91 on 2026-10-29T21:00:31Z.


What

Enables the independentBlend device feature and requires it where the driver really emits differing per-attachment blend states.

Pipeline::Pipeline has always passed a distinct VkPipelineColorBlendAttachmentState per color target: maskedState zeroes the write mask of targets the pixel shader has no output for, the second channel of an 8_8 target gets its own factors and ops, and the guest sets CB_BLENDn_CONTROL per render target. The feature was never enabled, so each of those pipelines broke VUID-VkPipelineColorBlendStateCreateInfo-pAttachments-00605.

VulkanDevice now enables independentBlend from available and records it next to dualSrcBlend and logicOp, and the feature log line reports it. Pipeline.cpp compares the attachment vector and, when the entries differ, requires the feature instead of creating a pipeline the spec forbids; the alternate-component-order second-channel pipeline gets the same check, since its attachments differ independently of the first channel.

Tested

Windows 11, NVIDIA RTX 5060 Ti 16 GB, driver 617.14, WinLibs GCC 15.2.0, Release, BUILD_TESTING=ON. No title run.

Paired runs of agc_driver_prepared_exports and agc_driver_srgb8_color_target from the same machine and GPU with VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation (Vulkan SDK 1.4.363), ANYPS5_REQUIRE_VULKAN=1 and ANYPS5_NO_SHADER_CACHE=1. Neither log contains was not found but was requested by env var VK_INSTANCE_LAYERS.

  • main: 14 + 4 = 18 VUID-VkPipelineColorBlendStateCreateInfo-pAttachments-00605, the count #11990 reports.
  • This change: no VUID- line in either log, and both tests pass.

The device log reports independentBlend=1 on this GPU, and agc_driver_address_passes passes too. tools/check_conventions.py --base origin/main passes.

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 (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: Fixes #11990
  • Unblocks: none
  • GPUs tested: AGC — NVIDIA GeForce RTX 5060 Ti 16 GB, driver 617.14, Windows 11, Vulkan validation layers 1.4.363; shader recompiler and VideoOut n/a
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5075455626 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/13006). Originally posted by [brainiac91](https://github.com/brainiac91) on 2026-10-29T21:00:31Z. --- ### What Enables the `independentBlend` device feature and requires it where the driver really emits differing per-attachment blend states. `Pipeline::Pipeline` has always passed a distinct `VkPipelineColorBlendAttachmentState` per color target: `maskedState` zeroes the write mask of targets the pixel shader has no output for, the second channel of an 8_8 target gets its own factors and ops, and the guest sets `CB_BLENDn_CONTROL` per render target. The feature was never enabled, so each of those pipelines broke `VUID-VkPipelineColorBlendStateCreateInfo-pAttachments-00605`. `VulkanDevice` now enables `independentBlend` from `available` and records it next to `dualSrcBlend` and `logicOp`, and the feature log line reports it. `Pipeline.cpp` compares the attachment vector and, when the entries differ, requires the feature instead of creating a pipeline the spec forbids; the alternate-component-order second-channel pipeline gets the same check, since its attachments differ independently of the first channel. ### Tested Windows 11, NVIDIA RTX 5060 Ti 16 GB, driver 617.14, WinLibs GCC 15.2.0, Release, `BUILD_TESTING=ON`. No title run. Paired runs of `agc_driver_prepared_exports` and `agc_driver_srgb8_color_target` from the same machine and GPU with `VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation` (Vulkan SDK 1.4.363), `ANYPS5_REQUIRE_VULKAN=1` and `ANYPS5_NO_SHADER_CACHE=1`. Neither log contains `was not found but was requested by env var VK_INSTANCE_LAYERS`. - `main`: 14 + 4 = 18 `VUID-VkPipelineColorBlendStateCreateInfo-pAttachments-00605`, the count #11990 reports. - This change: no `VUID-` line in either log, and both tests pass. The device log reports `independentBlend=1` on this GPU, and `agc_driver_address_passes` passes too. `tools/check_conventions.py --base origin/main` passes. ### Checklist - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Fixes: Fixes #11990 - [x] Unblocks: none - [x] GPUs tested: AGC — NVIDIA GeForce RTX 5060 Ti 16 GB, driver 617.14, Windows 11, Vulkan validation layers 1.4.363; shader recompiler and VideoOut n/a - [x] AI-assisted: yes
MarcZX10 commented 2026-10-29 21:46:35 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-29T21:46:35Z.

Review: CHANGES_REQUESTED


Reviewed — changes requested

The implementation looks technically sound, but this PR duplicates the still-open #6782 fix for the same validation error and does not acknowledge or coordinate with it.

What I ran

Reviewed head b9f5938118395b3a61e140e3a62c8707bf941b6d against current upstream main 52f212ec053f917455f2f87674ddb708dcc545d8; the merge preview is clean. I inspected the device feature enablement, pipeline checks, #11990, and open #6782. No local build or GPU tests were run.

git merge-tree --write-tree refs/remotes/upstream/main refs/review/pr-13006-head
git diff --check refs/remotes/upstream/main...refs/review/pr-13006-head
python3 tools/check_conventions.py --base upstream/main --head refs/review/pr-13006-head

Results

Check Result
Merge preview Clean
Diff check Passed (no output)
Repository conventions Passed
Hosted Windows workflow Passed
NVIDIA validation comparison Author reports the two focused tests pass without VUIDs on this head; not independently rerun
Duplicate/overlap review #6782 is open and changes the same device feature for the same #11990 VUID
Unedited local command output
merge-tree: c1602e03ed5a5aaa183af9596c19c472c5bb2949
diff-check: no output; exit status 0
check_conventions.py: All conventions checks passed.

Findings

Blocking

  • Open #6782 already enables independentBlend to fix the same #11990 validation error. Its current head 4433a62b3bf6248df830994a255701c72581cc95 requires and enables the feature in VulkanDevice.cpp; this PR adds a more compatible conditional-enable path and rejects differing pipeline attachments when the feature is unavailable. That distinction is useful, but both PRs implement the same fix and currently propose different device-compatibility policies. This PR's checklist says no other PR implements the same work.
  • The repository contribution rules say to check for an open PR implementing the same functions and to coordinate overlapping work with its author. Please coordinate with #6782's author and make clear which PR is authoritative (or how this one replaces/refines it), then update the checklist and related PR accordingly. See the rule at the reviewed main commit.

Non-blocking

  • The conditional feature enablement and pipeline guard are a useful compatibility improvement over requiring the feature on every device. The source and author-reported validation results otherwise support the change.

Sources

Not verified

I did not run the local C++ build, validation tests, or another GPU comparison. The author-reported Windows/NVIDIA evidence is not independently reproduced here.

To get this to a good state

Please coordinate the overlapping fix with #6782's author and update the checklist/PR relationship so maintainers can select one coherent implementation. I will recheck the same source and hosted results on the resulting head.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5705412697 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/13006#pullrequestreview-5705412697). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-29T21:46:35Z. **Review:** CHANGES_REQUESTED --- # Reviewed — changes requested The implementation looks technically sound, but this PR duplicates the still-open #6782 fix for the same validation error and does not acknowledge or coordinate with it. ## What I ran Reviewed head `b9f5938118395b3a61e140e3a62c8707bf941b6d` against current upstream `main` `52f212ec053f917455f2f87674ddb708dcc545d8`; the merge preview is clean. I inspected the device feature enablement, pipeline checks, #11990, and open #6782. No local build or GPU tests were run. ```sh git merge-tree --write-tree refs/remotes/upstream/main refs/review/pr-13006-head git diff --check refs/remotes/upstream/main...refs/review/pr-13006-head python3 tools/check_conventions.py --base upstream/main --head refs/review/pr-13006-head ``` ## Results | Check | Result | |---|---| | Merge preview | Clean | | Diff check | Passed (no output) | | Repository conventions | Passed | | Hosted Windows workflow | Passed | | NVIDIA validation comparison | Author reports the two focused tests pass without VUIDs on this head; not independently rerun | | Duplicate/overlap review | #6782 is open and changes the same device feature for the same #11990 VUID | <details> <summary>Unedited local command output</summary> ```text merge-tree: c1602e03ed5a5aaa183af9596c19c472c5bb2949 diff-check: no output; exit status 0 check_conventions.py: All conventions checks passed. ``` </details> ## Findings ### Blocking - Open #6782 already enables `independentBlend` to fix the same #11990 validation error. Its current head `4433a62b3bf6248df830994a255701c72581cc95` requires and enables the feature in `VulkanDevice.cpp`; this PR adds a more compatible conditional-enable path and rejects differing pipeline attachments when the feature is unavailable. That distinction is useful, but both PRs implement the same fix and currently propose different device-compatibility policies. This PR's checklist says no other PR implements the same work. - The repository contribution rules say to check for an open PR implementing the same functions and to coordinate overlapping work with its author. Please coordinate with #6782's author and make clear which PR is authoritative (or how this one replaces/refines it), then update the checklist and related PR accordingly. See [the rule at the reviewed main commit](https://github.com/boykopovar/AnyPS5/blob/52f212ec053f917455f2f87674ddb708dcc545d8/CONTRIBUTING.md#L59-L67). ### Non-blocking - The conditional feature enablement and pipeline guard are a useful compatibility improvement over requiring the feature on every device. The source and author-reported validation results otherwise support the change. ## Sources - [This PR's device feature and pipeline changes](https://github.com/boykopovar/AnyPS5/blob/b9f5938118395b3a61e140e3a62c8707bf941b6d/core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp) - [Existing #6782 feature change](https://github.com/boykopovar/AnyPS5/blob/4433a62b3bf6248df830994a255701c72581cc95/core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp) ## Not verified I did not run the local C++ build, validation tests, or another GPU comparison. The author-reported Windows/NVIDIA evidence is not independently reproduced here. ## To get this to a good state Please coordinate the overlapping fix with #6782's author and update the checklist/PR relationship so maintainers can select one coherent implementation. I will recheck the same source and hosted results on the resulting head.

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!13006
No description provided.