mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-12 21:10:42 +00:00
Cache D3D11 context type to avoid needing to fetch from real object
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
@@ -145,6 +145,7 @@ private:
|
||||
|
||||
WrappedID3D11VideoContext2 m_WrappedVideo;
|
||||
|
||||
D3D11_DEVICE_CONTEXT_TYPE m_Type;
|
||||
bool m_NeedUpdateSubWorkaround;
|
||||
|
||||
WriteSerialiser m_ScratchSerialiser;
|
||||
|
||||
@@ -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!
|
||||
|
||||
Reference in New Issue
Block a user