runtime: cb_blend refuses CONSTANT_ALPHA in the alpha factor fields without AlphaBlendFactorSupported #2520

Closed
opened 2026-11-25 20:09:57 +00:00 by Asimmimx · 0 comments
Asimmimx commented 2026-11-25 20:09:57 +00:00 (Migrated from github.com)
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by Asimmimx on 2026-11-25T20:09:57Z.


Commit or build

main at 66da8c4f, dev preset.

Summary

When alpha_factor_supported is false, x2w_cb_blend::decode (src/startup_stubs/cb_blend.h) refuses CONSTANT_ALPHA (19) and ONE_MINUS_CONSTANT_ALPHA (20) in ALPHA_SRCBLEND / ALPHA_DESTBLEND. On the alpha channel these factors read the blend constant's alpha, which is also what CONSTANT_COLOR reads there. D3D12 expresses that as D3D12_BLEND_BLEND_FACTOR / D3D12_BLEND_INV_BLEND_FACTOR in SrcBlendAlpha / DestBlendAlpha on every device. Only the colour slots need D3D12_BLEND_ALPHA_FACTOR (OPTIONS13::AlphaBlendFactorSupported).

x2w_startup::state_block_blend, called from translation_for in d3d12_draw.inl for slot 57 pipelines, always passes false. A pipeline with such a word therefore loses its register blend state for all eight targets, and the draw falls back to the heuristic or unblended path.

Reproduction

A source-built program includes startup_stubs/state_block_blend.h and is built with cl /std:c++17 /EHsc /I src. It decodes CB_BLEND0_CONTROL = 0x74130504 (colour SRC_ALPHA, ADD, ONE_MINUS_SRC_ALPHA; alpha CONSTANT_ALPHA, ADD, ONE_MINUS_CONSTANT_ALPHA; separate alpha, enabled) directly, and again in a synthetic state block A at +0xD0.

Observed

CB_BLEND0_CONTROL 0x74130504, AlphaBlendFactorSupported=0: ok=0 reason=CONSTANT_ALPHA factor without alpha blend factor support
state_block_blend: used=0 refused_targets=0x1 reason=CONSTANT_ALPHA factor without alpha blend factor support

Expected

Accepted, with SrcBlendAlpha = BLEND_FACTOR and DestBlendAlpha = INV_BLEND_FACTOR.

Reference

  • Mesa src/amd/registers/gfx10.json BlendOp: 19 BLEND_CONSTANT_ALPHA, 20 BLEND_ONE_MINUS_CONSTANT_ALPHA.
  • D3D12_BLEND documentation: in the alpha fields BLEND_FACTOR uses the alpha component of the blend factor.
  • A source-built WARP draw: clear 0.5, PS alpha output 1.0, blend factor (0.1, 0.2, 0.3, 0.8). Alpha BLEND_FACTOR/INV_BLEND_FACTOR read back 0.9000, and so did ALPHA_FACTOR/INV_ALPHA_FACTOR. Expected 1·0.8 + 0.5·0.2 = 0.9.

Not established

  • Whether a title uses this form.
  • A full slot 57 draw with such a word, and any result on a physical adapter.

AI-assisted (Claude Code).

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6612799779 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/2528). Originally posted by [Asimmimx](https://github.com/Asimmimx) on 2026-11-25T20:09:57Z. --- ### Commit or build `main` at `66da8c4f`, dev preset. ### Summary When `alpha_factor_supported` is false, `x2w_cb_blend::decode` (`src/startup_stubs/cb_blend.h`) refuses `CONSTANT_ALPHA` (19) and `ONE_MINUS_CONSTANT_ALPHA` (20) in `ALPHA_SRCBLEND` / `ALPHA_DESTBLEND`. On the alpha channel these factors read the blend constant's alpha, which is also what `CONSTANT_COLOR` reads there. D3D12 expresses that as `D3D12_BLEND_BLEND_FACTOR` / `D3D12_BLEND_INV_BLEND_FACTOR` in `SrcBlendAlpha` / `DestBlendAlpha` on every device. Only the colour slots need `D3D12_BLEND_ALPHA_FACTOR` (`OPTIONS13::AlphaBlendFactorSupported`). `x2w_startup::state_block_blend`, called from `translation_for` in `d3d12_draw.inl` for slot 57 pipelines, always passes `false`. A pipeline with such a word therefore loses its register blend state for all eight targets, and the draw falls back to the heuristic or unblended path. ### Reproduction A source-built program includes `startup_stubs/state_block_blend.h` and is built with `cl /std:c++17 /EHsc /I src`. It decodes `CB_BLEND0_CONTROL` = `0x74130504` (colour `SRC_ALPHA, ADD, ONE_MINUS_SRC_ALPHA`; alpha `CONSTANT_ALPHA, ADD, ONE_MINUS_CONSTANT_ALPHA`; separate alpha, enabled) directly, and again in a synthetic state block A at `+0xD0`. ### Observed ``` CB_BLEND0_CONTROL 0x74130504, AlphaBlendFactorSupported=0: ok=0 reason=CONSTANT_ALPHA factor without alpha blend factor support state_block_blend: used=0 refused_targets=0x1 reason=CONSTANT_ALPHA factor without alpha blend factor support ``` ### Expected Accepted, with `SrcBlendAlpha = BLEND_FACTOR` and `DestBlendAlpha = INV_BLEND_FACTOR`. ### Reference - Mesa `src/amd/registers/gfx10.json` `BlendOp`: 19 `BLEND_CONSTANT_ALPHA`, 20 `BLEND_ONE_MINUS_CONSTANT_ALPHA`. - D3D12_BLEND documentation: in the alpha fields `BLEND_FACTOR` uses the alpha component of the blend factor. - A source-built WARP draw: clear 0.5, PS alpha output 1.0, blend factor (0.1, 0.2, 0.3, 0.8). Alpha `BLEND_FACTOR`/`INV_BLEND_FACTOR` read back 0.9000, and so did `ALPHA_FACTOR`/`INV_ALPHA_FACTOR`. Expected 1·0.8 + 0.5·0.2 = 0.9. ### Not established - Whether a title uses this form. - A full slot 57 draw with such a word, and any result on a physical adapter. AI-assisted (Claude Code).
Sign in to join this conversation.
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
R0Y00/Xbox2Windows#2520
No description provided.