From 6e8218d0e0c1e37c9b203021291b9d37a612fbfc Mon Sep 17 00:00:00 2001 From: baldurk Date: Thu, 28 Jun 2018 18:24:31 +0100 Subject: [PATCH] When applying render state, don't assume UAVStartSlot == NumRTVs * On D3D11.1 the UAV slots can be greater than 8 which is the maximum value for NumRTVs. --- renderdoc/driver/d3d11/d3d11_renderstate.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/renderdoc/driver/d3d11/d3d11_renderstate.cpp b/renderdoc/driver/d3d11/d3d11_renderstate.cpp index 4b17611e0..d5631aa89 100644 --- a/renderdoc/driver/d3d11/d3d11_renderstate.cpp +++ b/renderdoc/driver/d3d11/d3d11_renderstate.cpp @@ -542,12 +542,14 @@ void D3D11RenderState::ApplyState(WrappedID3D11DeviceContext *context) if(context->IsFL11_1()) context->OMSetRenderTargetsAndUnorderedAccessViews( - OM.UAVStartSlot, OM.RenderTargets, OM.DepthView, OM.UAVStartSlot, - D3D11_1_UAV_SLOT_COUNT - OM.UAVStartSlot, OM.UAVs, UAV_keepcounts); + 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( - OM.UAVStartSlot, OM.RenderTargets, OM.DepthView, OM.UAVStartSlot, - D3D11_PS_CS_UAV_REGISTER_COUNT - OM.UAVStartSlot, OM.UAVs, UAV_keepcounts); + 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); }