upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/runtime/src
diff options
context:
space:
mode:
authorOreoFR <29048345+OreoFR@users.noreply.github.com>2026-11-25 09:02:38 +0100
committerOreoFR <29048345+OreoFR@users.noreply.github.com>2026-11-25 09:02:38 +0100
commit4e7b764dbc04fbd5343fb6c99224a8b0bec9ae9c (patch)
tree01ea1a85724da251036ff3767e131d7d7914d618 /runtime/src
parent2f44380590e9471cb44b15818ad2c2c422a2af21 (diff)
d3d12_xs: integer render targets keep blending off in slot 57 native PSOs (RT-SLOT57-BLEND-STATE)
A library pipeline enables MAX on an R8_UINT target; the colour block bypasses blending there, and D3D12 refuses the PSO. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'runtime/src')
-rw-r--r--runtime/src/native_pso.h22
1 files changed, 19 insertions, 3 deletions
diff --git a/runtime/src/native_pso.h b/runtime/src/native_pso.h
index 37460a21e..abe2c52e1 100644
--- a/runtime/src/native_pso.h
+++ b/runtime/src/native_pso.h
@@ -242,12 +242,28 @@ inline std::optional<TargetBlend> d3d12_target_blend(std::uint32_t cb_blend, std
242 return t; 242 return t;
243} 243}
244 244
245// A DXGI_FORMAT with UINT or SINT channels. The colour block does not blend those (RDNA2 bypasses blending for integer
246// targets), and D3D12 refuses a PSO that enables blending on one.
247inline bool dxgi_integer_format(std::uint32_t f) {
248 switch (f) {
249 case 3: case 4: case 7: case 8: case 12: case 14: case 17: case 18: case 25: case 30: case 32: case 36:
250 case 38: case 42: case 43: case 50: case 52: case 57: case 59: case 62: case 64:
251 return true;
252 default:
253 return false;
254 }
255}
256
245// The targets 0..count-1 of `r` in D3D12 terms, or empty when one of them cannot be expressed: the pipeline then keeps 257// The targets 0..count-1 of `r` in D3D12 terms, or empty when one of them cannot be expressed: the pipeline then keeps
246// the defaults (blending off, every component written) for all of its targets, as before blob A was read. 258// the defaults (blending off, every component written) for all of its targets, as before blob A was read. A target
247inline std::optional<std::array<TargetBlend, 8>> d3d12_blend(const BlendRegisters& r, unsigned count) { 259// with an integer format (`formats`, DXGI values) keeps its write mask and has blending off, as on the console.
260inline std::optional<std::array<TargetBlend, 8>> d3d12_blend(const BlendRegisters& r, unsigned count,
261 const std::array<std::uint8_t, 8>& formats = {}) {
248 std::array<TargetBlend, 8> out{}; 262 std::array<TargetBlend, 8> out{};
249 for (unsigned i = 0; i < count && i < out.size(); ++i) { 263 for (unsigned i = 0; i < count && i < out.size(); ++i) {
250 const auto t = d3d12_target_blend(r.blend[i], r.target_mask >> (4 * i)); 264 const std::uint32_t mask = r.target_mask >> (4 * i);
265 const auto t = dxgi_integer_format(formats[i]) ? d3d12_target_blend(r.blend[i] & ~(1u << 30), mask)
266 : d3d12_target_blend(r.blend[i], mask);
251 if (!t) return std::nullopt; 267 if (!t) return std::nullopt;
252 out[i] = *t; 268 out[i] = *t;
253 } 269 }