From 03e00ea12d3590485018e86419fa8422183299c0 Mon Sep 17 00:00:00 2001 From: baldurk Date: Mon, 16 Sep 2019 17:27:41 +0100 Subject: [PATCH] If there are no UAVs bound, don't try to set invalid UAVStartSlot --- renderdoc/driver/d3d11/d3d11_renderstate.cpp | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/renderdoc/driver/d3d11/d3d11_renderstate.cpp b/renderdoc/driver/d3d11/d3d11_renderstate.cpp index 3b15ba800..20cf6fce6 100644 --- a/renderdoc/driver/d3d11/d3d11_renderstate.cpp +++ b/renderdoc/driver/d3d11/d3d11_renderstate.cpp @@ -539,15 +539,24 @@ void D3D11RenderState::ApplyState(WrappedID3D11DeviceContext *context) const context->OMSetDepthStencilState(OM.DepthStencilState, OM.StencRef); if(context->IsFL11_1()) + { context->OMSetRenderTargetsAndUnorderedAccessViews( RDCMIN(OM.UAVStartSlot, (UINT)D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT), OM.RenderTargets, OM.DepthView, OM.UAVStartSlot, D3D11_1_UAV_SLOT_COUNT - OM.UAVStartSlot, OM.UAVs, UAV_keepcounts); + } else - context->OMSetRenderTargetsAndUnorderedAccessViews( - RDCMIN(OM.UAVStartSlot, (UINT)D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT), OM.RenderTargets, - OM.DepthView, OM.UAVStartSlot, D3D11_PS_CS_UAV_REGISTER_COUNT - OM.UAVStartSlot, OM.UAVs, - UAV_keepcounts); + { + if(OM.UAVStartSlot == D3D11_PS_CS_UAV_REGISTER_COUNT) + context->OMSetRenderTargets( + RDCMIN(OM.UAVStartSlot, (UINT)D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT), OM.RenderTargets, + OM.DepthView); + else + context->OMSetRenderTargetsAndUnorderedAccessViews( + RDCMIN(OM.UAVStartSlot, (UINT)D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT), OM.RenderTargets, + OM.DepthView, OM.UAVStartSlot, D3D11_PS_CS_UAV_REGISTER_COUNT - OM.UAVStartSlot, OM.UAVs, + UAV_keepcounts); + } context->SetPredication(Predicate, PredicateValue); }