Vulkan pipeline cache: alpha blend factor not remapped for COLOR-family factors (D3D12 parity bug)
`VulkanPipelineCache::WritePipelineRenderTargetDescription` in `src/xenia/gpu/vulkan/vulkan_pipeline_cache.cc` uses the same `kBlendFactorMap` table for both the color and alpha blend factors:
```cpp render_target_out.src_alpha_blend_factor = kBlendFactorMap[uint32_t(blend_control.alpha_srcblend)]; render_target_out.dst_alpha_blend_factor = kBlendFactorMap[uint32_t(blend_control.alpha_destblend)]; ```
The D3D12 backend (`src/xenia/gpu/d3d12/pipeline_cache.cc`) instead uses a dedicated `kBlendFactorAlphaMap` for the alpha channel, which remaps the `_COLOR`-family factor indices (4/5 `SRC_COLOR`/`INV_SRC_COLOR`, 8/9 `DEST_COLOR`/`INV_DEST_COLOR`) to their `_ALPHA` equivalents before use:
```cpp /* 4 / PipelineBlendFactor::kSrcAlpha, // vs. kSrcColor in the color-channel map / 5 / PipelineBlendFactor::kInvSrcAlpha, / 8 / PipelineBlendFactor::kDestAlpha, // vs. kDestColor in the color-channel map / 9 */ PipelineBlendFactor::kInvDestAlpha, ```
Since alpha is a scalar, hardware treats a `_COLOR` blend factor requested for the alpha slot as its `_ALPHA` equivalent - the D3D12 path models this correctly, but the Vulkan path does not.
Effect: any render target whose `RB_BLENDCONTROL.alpha_srcblend` or `alpha_destblend` selects one of the `*_COLOR` variants (register values 4, 5, 8, 9) will get the wrong alpha blend factor under the Vulkan backend, while the D3D12 backend renders it correctly. This can manifest as incorrect transparency/blending results, or wrong alpha values propagated into a render target's alpha channel when it's later read as data (e.g. as a mask).
Suggested fix: add a `kBlendFactorAlphaMap` table to the Vulkan pipeline cache mirroring the D3D12 one (adjusted for Vulkan's `PipelineBlendFactor` enum member names - `kSrcAlpha`/`kOneMinusSrcAlpha`/`kDstAlpha`/`kOneMinusDstAlpha`/`kConstantAlpha`/`kOneMinusConstantAlpha`/`kSrcAlphaSaturate`), and use it for the `alpha_srcblend`/`alpha_destblend` lookups instead of the color map.
Source: xenia-project/xenia