diff options
| author | OreoFR <29048345+OreoFR@users.noreply.github.com> | 2026-11-25 09:37:42 +0100 |
|---|---|---|
| committer | OreoFR <29048345+OreoFR@users.noreply.github.com> | 2026-11-25 09:37:42 +0100 |
| commit | d763845349ec7f36669f4b2bfa67e40576b88c8a (patch) | |
| tree | f861e6e2442636ac474aba96e995da6aa403f298 /runtime/src/native_pso.h | |
| parent | 81f33de1cd307ac7cd7365724c55d27999888629 (diff) | |
d3d12: dual-source blending reads SV_Target1 at Location 0, Index 1 (RT-DUAL-SOURCE-BLEND)
A PSO whose blend state uses a SRC1 factor gets its fragment module's Location 1
colour output moved to Location 0 with Index 1, as Vulkan takes the second
source. Slot 57 native PSOs now map the SRC1 factors of state blob A.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'runtime/src/native_pso.h')
| -rw-r--r-- | runtime/src/native_pso.h | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/runtime/src/native_pso.h b/runtime/src/native_pso.h index abe2c52e1..5d117dba3 100644 --- a/runtime/src/native_pso.h +++ b/runtime/src/native_pso.h | |||
| @@ -196,10 +196,11 @@ struct TargetBlend { | |||
| 196 | }; | 196 | }; |
| 197 | 197 | ||
| 198 | // An RDNA2 blend factor (V_028780_BLEND_*, the gfx10 register header) as a D3D12_BLEND, or 0 for one this path does | 198 | // An RDNA2 blend factor (V_028780_BLEND_*, the gfx10 register header) as a D3D12_BLEND, or 0 for one this path does |
| 199 | // not take: BOTH_(INV_)SRC_ALPHA (11, 12; not on gfx10) and the dual-source SRC1 factors (15 to 18), whose second | 199 | // not take: BOTH_(INV_)SRC_ALPHA (11, 12; not on gfx10). The dual-source SRC1 factors (15 to 18) read the pixel |
| 200 | // pixel-shader output the translator does not declare. For an alpha factor, a colour factor names its alpha. | 200 | // shader's SV_Target1, which the Vulkan layer moves to Location 0, Index 1 (RT-DUAL-SOURCE-BLEND). For an alpha |
| 201 | // factor, a colour factor names its alpha. | ||
| 201 | inline std::uint8_t d3d12_blend_factor(std::uint32_t f, bool alpha) { | 202 | inline std::uint8_t d3d12_blend_factor(std::uint32_t f, bool alpha) { |
| 202 | static constexpr std::uint8_t colour[21] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 0, 0, 14, 15, 0, 0, 0, 0, 20, 21}; | 203 | static constexpr std::uint8_t colour[21] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 0, 0, 14, 15, 16, 17, 18, 19, 20, 21}; |
| 203 | if (f >= std::size(colour)) return 0; | 204 | if (f >= std::size(colour)) return 0; |
| 204 | if (alpha) { | 205 | if (alpha) { |
| 205 | switch (f) { | 206 | switch (f) { |
| @@ -207,6 +208,8 @@ inline std::uint8_t d3d12_blend_factor(std::uint32_t f, bool alpha) { | |||
| 207 | case 3: return 6; // ONE_MINUS_SRC_COLOR -> INV_SRC_ALPHA | 208 | case 3: return 6; // ONE_MINUS_SRC_COLOR -> INV_SRC_ALPHA |
| 208 | case 8: return 7; // DST_COLOR -> DEST_ALPHA | 209 | case 8: return 7; // DST_COLOR -> DEST_ALPHA |
| 209 | case 9: return 8; // ONE_MINUS_DST_COLOR -> INV_DEST_ALPHA | 210 | case 9: return 8; // ONE_MINUS_DST_COLOR -> INV_DEST_ALPHA |
| 211 | case 15: return 18; // SRC1_COLOR -> SRC1_ALPHA | ||
| 212 | case 16: return 19; // INV_SRC1_COLOR -> INV_SRC1_ALPHA | ||
| 210 | default: break; | 213 | default: break; |
| 211 | } | 214 | } |
| 212 | } | 215 | } |