diff --git a/renderdoc/driver/d3d11/d3d11_context.cpp b/renderdoc/driver/d3d11/d3d11_context.cpp index 103117204..f4c229acc 100644 --- a/renderdoc/driver/d3d11/d3d11_context.cpp +++ b/renderdoc/driver/d3d11/d3d11_context.cpp @@ -90,6 +90,8 @@ WrappedID3D11DeviceContext::WrappedID3D11DeviceContext(WrappedID3D11Device *real NullCBCounts[i] = 4096; } + m_Type = m_pRealContext->GetType(); + D3D11_FEATURE_DATA_D3D11_OPTIONS features; RDCEraseEl(features); HRESULT hr = S_OK; @@ -176,7 +178,7 @@ WrappedID3D11DeviceContext::WrappedID3D11DeviceContext(WrappedID3D11Device *real m_DeferredSavedState = NULL; m_DoStateVerify = IsCaptureMode(m_State); - if(!context || context->GetType() == D3D11_DEVICE_CONTEXT_IMMEDIATE) + if(!context || GetType() == D3D11_DEVICE_CONTEXT_IMMEDIATE) { m_CurrentPipelineState->SetImmediatePipeline(m_pDevice); @@ -203,7 +205,7 @@ WrappedID3D11DeviceContext::~WrappedID3D11DeviceContext() if(m_ContextRecord) m_ContextRecord->Delete(m_pDevice->GetResourceManager()); - if(m_pRealContext && m_pRealContext->GetType() != D3D11_DEVICE_CONTEXT_IMMEDIATE) + if(m_pRealContext && GetType() != D3D11_DEVICE_CONTEXT_IMMEDIATE) m_pDevice->RemoveDeferredContext(this); for(auto it = m_StreamOutCounters.begin(); it != m_StreamOutCounters.end(); ++it) @@ -416,7 +418,7 @@ bool WrappedID3D11DeviceContext::Serialise_BeginCaptureFrame(SerialiserType &ser void WrappedID3D11DeviceContext::MarkResourceReferenced(ResourceId id, FrameRefType refType) { - if(m_pRealContext->GetType() == D3D11_DEVICE_CONTEXT_IMMEDIATE) + if(GetType() == D3D11_DEVICE_CONTEXT_IMMEDIATE) { m_pDevice->GetResourceManager()->MarkResourceFrameReferenced(id, refType); } @@ -440,7 +442,7 @@ void WrappedID3D11DeviceContext::MarkResourceReferenced(ResourceId id, FrameRefT void WrappedID3D11DeviceContext::MarkDirtyResource(ResourceId id) { - if(m_pRealContext->GetType() == D3D11_DEVICE_CONTEXT_IMMEDIATE) + if(GetType() == D3D11_DEVICE_CONTEXT_IMMEDIATE) { m_pDevice->GetResourceManager()->MarkDirtyResource(id); } diff --git a/renderdoc/driver/d3d11/d3d11_context.h b/renderdoc/driver/d3d11/d3d11_context.h index ac08f7192..f97ec46ce 100644 --- a/renderdoc/driver/d3d11/d3d11_context.h +++ b/renderdoc/driver/d3d11/d3d11_context.h @@ -145,6 +145,7 @@ private: WrappedID3D11VideoContext2 m_WrappedVideo; + D3D11_DEVICE_CONTEXT_TYPE m_Type; bool m_NeedUpdateSubWorkaround; WriteSerialiser m_ScratchSerialiser; diff --git a/renderdoc/driver/d3d11/d3d11_context_wrap.cpp b/renderdoc/driver/d3d11/d3d11_context_wrap.cpp index f34a8ea8a..07e4b04e1 100644 --- a/renderdoc/driver/d3d11/d3d11_context_wrap.cpp +++ b/renderdoc/driver/d3d11/d3d11_context_wrap.cpp @@ -7145,7 +7145,7 @@ void WrappedID3D11DeviceContext::GetPredication(ID3D11Predicate **ppPredicate, B D3D11_DEVICE_CONTEXT_TYPE WrappedID3D11DeviceContext::GetType() { - return m_pRealContext->GetType(); + return m_Type; } UINT WrappedID3D11DeviceContext::GetContextFlags() @@ -7609,7 +7609,7 @@ HRESULT WrappedID3D11DeviceContext::Map(ID3D11Resource *pResource, UINT Subresou directMap = true; if((!directMap && MapType == D3D11_MAP_WRITE_NO_OVERWRITE && !IsActiveCapturing(m_State)) || - m_pRealContext->GetType() == D3D11_DEVICE_CONTEXT_DEFERRED) + GetType() == D3D11_DEVICE_CONTEXT_DEFERRED) { directMap = true; m_HighTrafficResources.insert(id); @@ -7619,8 +7619,8 @@ HRESULT WrappedID3D11DeviceContext::Map(ID3D11Resource *pResource, UINT Subresou if(directMap && IsBackgroundCapturing(m_State)) { - return m_pRealContext->Map(m_pDevice->GetResourceManager()->UnwrapResource(pResource), - Subresource, MapType, MapFlags, pMappedResource); + ID3D11Resource *unwrapped = m_pDevice->GetResourceManager()->UnwrapResource(pResource); + return m_pRealContext->Map(unwrapped, Subresource, MapType, MapFlags, pMappedResource); } // can't promise no-overwrite as we're going to blat the whole buffer!