From 9e6ca9f649509494e8b50fd6cd9568310aec0140 Mon Sep 17 00:00:00 2001 From: baldurk Date: Tue, 11 Nov 2025 13:29:16 +0000 Subject: [PATCH] Disable logic ops for shader out and primitive ID PSOs --- renderdoc/driver/d3d12/d3d12_pixelhistory.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/renderdoc/driver/d3d12/d3d12_pixelhistory.cpp b/renderdoc/driver/d3d12/d3d12_pixelhistory.cpp index 25a6b179b..4a13fa774 100644 --- a/renderdoc/driver/d3d12/d3d12_pixelhistory.cpp +++ b/renderdoc/driver/d3d12/d3d12_pixelhistory.cpp @@ -2378,11 +2378,18 @@ struct D3D12PixelHistoryPerFragmentCallback : D3D12PixelHistoryCallback // In order to have different write masks per render target, we need to switch to independent // blend if not already in use. - if(!pipeDesc.BlendState.IndependentBlendEnable) + if(!pipeDesc.BlendState.IndependentBlendEnable && pipeDesc.RTVFormats.NumRenderTargets > 1) { pipeDesc.BlendState.IndependentBlendEnable = TRUE; for(uint32_t i = 1; i < D3D12_SIMULTANEOUS_RENDER_TARGET_COUNT; ++i) + { pipeDesc.BlendState.RenderTarget[i] = pipeDesc.BlendState.RenderTarget[0]; + // Can't do this with logic ops as we can't used indepedent blend - would need an alternate + // solution to mask other targets (format as UNKNOWN maybe?) + // D3D12 ERROR: ID3D12Device::CreateBlendState: LogicOpEnable and IndependentBlendEnable + // cannot both be set to true. + RDCASSERT(!pipeDesc.BlendState.RenderTarget[0].LogicOpEnable); + } } // Mask out writes to targets which aren't the pixel history color target @@ -2440,6 +2447,7 @@ struct D3D12PixelHistoryPerFragmentCallback : D3D12PixelHistoryCallback for(uint32_t i = 0; i < D3D12_SIMULTANEOUS_RENDER_TARGET_COUNT; ++i) { pipeDesc.BlendState.RenderTarget[i].BlendEnable = FALSE; + pipeDesc.BlendState.RenderTarget[i].LogicOpEnable = FALSE; } {