From d6e1b012de19ff0d808ceb2255322cd1df9a3f99 Mon Sep 17 00:00:00 2001 From: baldurk Date: Tue, 7 Jul 2015 01:50:19 +0200 Subject: [PATCH] Check if we're running feature level 11.1, not if the 11.1 iface is up --- renderdoc/driver/d3d11/d3d11_analyse.cpp | 6 +++--- renderdoc/driver/d3d11/d3d11_context.cpp | 5 +++++ renderdoc/driver/d3d11/d3d11_context.h | 6 ++++++ renderdoc/driver/d3d11/d3d11_debug.cpp | 10 +++++----- renderdoc/driver/d3d11/d3d11_renderstate.cpp | 8 ++++---- 5 files changed, 23 insertions(+), 12 deletions(-) diff --git a/renderdoc/driver/d3d11/d3d11_analyse.cpp b/renderdoc/driver/d3d11/d3d11_analyse.cpp index e7852e2a6..b90c27871 100644 --- a/renderdoc/driver/d3d11/d3d11_analyse.cpp +++ b/renderdoc/driver/d3d11/d3d11_analyse.cpp @@ -3344,7 +3344,7 @@ void D3D11DebugManager::PixelHistoryCopyPixel(CopyPixelParams &p, uint32_t x, ui ID3D11RenderTargetView* prevRTVs[D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT] = {0}; ID3D11UnorderedAccessView* prevUAVs[D3D11_1_UAV_SLOT_COUNT] = {0}; ID3D11DepthStencilView *prevDSV = NULL; - const UINT numUAVs = m_WrappedContext->GetReal1() ? D3D11_1_UAV_SLOT_COUNT : D3D11_PS_CS_UAV_REGISTER_COUNT; + const UINT numUAVs = m_WrappedContext->IsFL11_1() ? D3D11_1_UAV_SLOT_COUNT : D3D11_PS_CS_UAV_REGISTER_COUNT; m_pImmediateContext->OMGetRenderTargetsAndUnorderedAccessViews(UAVStartSlot, prevRTVs, &prevDSV, UAVStartSlot, numUAVs-UAVStartSlot, prevUAVs); @@ -4336,7 +4336,7 @@ vector D3D11DebugManager::PixelHistory(uint32_t frameID, vect ID3D11RenderTargetView* prevRTVs[D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT] = {0}; ID3D11UnorderedAccessView* prevUAVs[D3D11_1_UAV_SLOT_COUNT] = {0}; ID3D11DepthStencilView *prevDSV = NULL; - const UINT numUAVs = m_WrappedContext->GetReal1() ? D3D11_1_UAV_SLOT_COUNT : D3D11_PS_CS_UAV_REGISTER_COUNT; + const UINT numUAVs = m_WrappedContext->IsFL11_1() ? D3D11_1_UAV_SLOT_COUNT : D3D11_PS_CS_UAV_REGISTER_COUNT; m_pImmediateContext->OMGetRenderTargetsAndUnorderedAccessViews(UAVStartSlot, prevRTVs, &prevDSV, UAVStartSlot, numUAVs-UAVStartSlot, prevUAVs); @@ -4461,7 +4461,7 @@ vector D3D11DebugManager::PixelHistory(uint32_t frameID, vect ID3D11RenderTargetView* curRTVs[D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT] = {0}; ID3D11UnorderedAccessView* curUAVs[D3D11_1_UAV_SLOT_COUNT] = {0}; ID3D11DepthStencilView *curDSV = NULL; - const UINT numUAVs = m_WrappedContext->GetReal1() ? D3D11_1_UAV_SLOT_COUNT : D3D11_PS_CS_UAV_REGISTER_COUNT; + const UINT numUAVs = m_WrappedContext->IsFL11_1() ? D3D11_1_UAV_SLOT_COUNT : D3D11_PS_CS_UAV_REGISTER_COUNT; m_pImmediateContext->OMGetRenderTargetsAndUnorderedAccessViews(UAVStartSlot, curRTVs, &curDSV, UAVStartSlot, numUAVs-UAVStartSlot, curUAVs); diff --git a/renderdoc/driver/d3d11/d3d11_context.cpp b/renderdoc/driver/d3d11/d3d11_context.cpp index 23a0c34de..484f98772 100644 --- a/renderdoc/driver/d3d11/d3d11_context.cpp +++ b/renderdoc/driver/d3d11/d3d11_context.cpp @@ -564,6 +564,11 @@ void WrappedID3D11DeviceContext::EndFrame() m_pDevice->GetResourceManager()->FlushPendingDirty(); } +bool WrappedID3D11DeviceContext::IsFL11_1() +{ + return m_pDevice->GetFeatureLevel() >= D3D_FEATURE_LEVEL_11_1; +} + void WrappedID3D11DeviceContext::ProcessChunk(uint64_t offset, D3D11ChunkType chunk, bool forceExecute) { if(chunk < FIRST_CONTEXT_CHUNK && !forceExecute) diff --git a/renderdoc/driver/d3d11/d3d11_context.h b/renderdoc/driver/d3d11/d3d11_context.h index 9d1d5a96e..06b5b1b8f 100644 --- a/renderdoc/driver/d3d11/d3d11_context.h +++ b/renderdoc/driver/d3d11/d3d11_context.h @@ -272,6 +272,12 @@ public: ID3D11DeviceContext1* GetReal1() { return m_pRealContext1; } ID3D11DeviceContext2* GetReal2() { return m_pRealContext2; } +#if defined(INCLUDE_D3D_11_1) + bool IsFL11_1(); +#else + bool IsFL11_1() { return false; } +#endif + void ProcessChunk(uint64_t offset, D3D11ChunkType chunk, bool forceExecute); void ReplayFakeContext(ResourceId id); void ReplayLog(LogState readType, uint32_t startEventID, uint32_t endEventID, bool partial); diff --git a/renderdoc/driver/d3d11/d3d11_debug.cpp b/renderdoc/driver/d3d11/d3d11_debug.cpp index 3db00a43f..e079a9b02 100644 --- a/renderdoc/driver/d3d11/d3d11_debug.cpp +++ b/renderdoc/driver/d3d11/d3d11_debug.cpp @@ -1944,7 +1944,7 @@ bool D3D11DebugManager::GetHistogram(ResourceId texid, uint32_t sliceFace, uint3 UINT UAV_keepcounts[D3D11_1_UAV_SLOT_COUNT]; memset(&UAV_keepcounts[0], 0xff, sizeof(UAV_keepcounts)); - const UINT numUAVs = m_WrappedContext->GetReal1() ? D3D11_1_UAV_SLOT_COUNT : D3D11_PS_CS_UAV_REGISTER_COUNT; + const UINT numUAVs = m_WrappedContext->IsFL11_1() ? D3D11_1_UAV_SLOT_COUNT : D3D11_PS_CS_UAV_REGISTER_COUNT; uavs[0] = m_DebugRender.histogramUAV; m_pImmediateContext->CSSetUnorderedAccessViews(0, numUAVs, uavs, UAV_keepcounts); @@ -2035,7 +2035,7 @@ bool D3D11DebugManager::GetMinMax(ResourceId texid, uint32_t sliceFace, uint32_t m_pImmediateContext->CSSetConstantBuffers(0, 1, &cbuf); ID3D11UnorderedAccessView *uavs[D3D11_1_UAV_SLOT_COUNT] = { NULL }; - const UINT numUAVs = m_WrappedContext->GetReal1() ? D3D11_1_UAV_SLOT_COUNT : D3D11_PS_CS_UAV_REGISTER_COUNT; + const UINT numUAVs = m_WrappedContext->IsFL11_1() ? D3D11_1_UAV_SLOT_COUNT : D3D11_PS_CS_UAV_REGISTER_COUNT; uavs[intIdx] = m_DebugRender.tileResultUAV[intIdx]; m_pImmediateContext->CSSetUnorderedAccessViews(0, numUAVs, uavs, NULL); @@ -2226,7 +2226,7 @@ void D3D11DebugManager::CopyArrayToTex2DMS(ID3D11Texture2D *destMS, ID3D11Textur m_pImmediateContext->CopyResource(srvResource, srcArray); ID3D11UnorderedAccessView *uavs[D3D11_1_UAV_SLOT_COUNT] = { NULL }; - const UINT numUAVs = m_WrappedContext->GetReal1() ? D3D11_1_UAV_SLOT_COUNT : D3D11_PS_CS_UAV_REGISTER_COUNT; + const UINT numUAVs = m_WrappedContext->IsFL11_1() ? D3D11_1_UAV_SLOT_COUNT : D3D11_PS_CS_UAV_REGISTER_COUNT; UINT uavCounts[D3D11_1_UAV_SLOT_COUNT]; memset(&uavCounts[0], 0xff, sizeof(uavCounts)); @@ -2515,7 +2515,7 @@ void D3D11DebugManager::CopyTex2DMSToArray(ID3D11Texture2D *destArray, ID3D11Tex ID3D11UnorderedAccessView *uavs[D3D11_1_UAV_SLOT_COUNT] = { NULL }; UINT uavCounts[D3D11_1_UAV_SLOT_COUNT]; memset(&uavCounts[0], 0xff, sizeof(uavCounts)); - const UINT numUAVs = m_WrappedContext->GetReal1() ? D3D11_1_UAV_SLOT_COUNT : D3D11_PS_CS_UAV_REGISTER_COUNT; + const UINT numUAVs = m_WrappedContext->IsFL11_1() ? D3D11_1_UAV_SLOT_COUNT : D3D11_PS_CS_UAV_REGISTER_COUNT; m_pImmediateContext->CSSetUnorderedAccessViews(0, numUAVs, uavs, uavCounts); @@ -3549,7 +3549,7 @@ bool D3D11DebugManager::RenderTexture(TextureDisplay cfg, bool blendAlpha) ID3D11UnorderedAccessView *NullUAVs[D3D11_1_UAV_SLOT_COUNT] = { 0 }; UINT UAV_keepcounts[D3D11_1_UAV_SLOT_COUNT]; memset(&UAV_keepcounts[0], 0xff, sizeof(UAV_keepcounts)); - const UINT numUAVs = m_WrappedContext->GetReal1() ? D3D11_1_UAV_SLOT_COUNT : D3D11_PS_CS_UAV_REGISTER_COUNT; + const UINT numUAVs = m_WrappedContext->IsFL11_1() ? D3D11_1_UAV_SLOT_COUNT : D3D11_PS_CS_UAV_REGISTER_COUNT; m_pImmediateContext->CSSetUnorderedAccessViews(0, numUAVs, NullUAVs, UAV_keepcounts); diff --git a/renderdoc/driver/d3d11/d3d11_renderstate.cpp b/renderdoc/driver/d3d11/d3d11_renderstate.cpp index e6ca62e85..31667f4b9 100644 --- a/renderdoc/driver/d3d11/d3d11_renderstate.cpp +++ b/renderdoc/driver/d3d11/d3d11_renderstate.cpp @@ -727,7 +727,7 @@ D3D11RenderState::D3D11RenderState(WrappedID3D11DeviceContext *context) // CS context->CSGetShaderResources(0, D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT, CS.SRVs); - if(context->GetReal1()) + if(context->IsFL11_1()) context->CSGetUnorderedAccessViews(0, D3D11_1_UAV_SLOT_COUNT, CSUAVs); else context->CSGetUnorderedAccessViews(0, D3D11_PS_CS_UAV_REGISTER_COUNT, CSUAVs); @@ -786,7 +786,7 @@ D3D11RenderState::D3D11RenderState(WrappedID3D11DeviceContext *context) } } - if(context->GetReal1()) + if(context->IsFL11_1()) context->OMGetRenderTargetsAndUnorderedAccessViews(OM.UAVStartSlot, OM.RenderTargets, &OM.DepthView, OM.UAVStartSlot, D3D11_1_UAV_SLOT_COUNT-OM.UAVStartSlot, OM.UAVs); @@ -845,7 +845,7 @@ void D3D11RenderState::ApplyState(WrappedID3D11DeviceContext *context) // CS context->CSSetShaderResources(0, D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT, CS.SRVs); context->CSSetSamplers(0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT, CS.Samplers); - if(context->GetReal1()) + if(context->IsFL11_1()) context->CSSetUnorderedAccessViews(0, D3D11_1_UAV_SLOT_COUNT, CSUAVs, UAV_keepcounts); else context->CSSetUnorderedAccessViews(0, D3D11_PS_CS_UAV_REGISTER_COUNT, CSUAVs, UAV_keepcounts); @@ -876,7 +876,7 @@ void D3D11RenderState::ApplyState(WrappedID3D11DeviceContext *context) context->OMSetBlendState(OM.BlendState, OM.BlendFactor, OM.SampleMask); context->OMSetDepthStencilState(OM.DepthStencilState, OM.StencRef); - if(context->GetReal1()) + 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);