mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-11-14 09:50:06 +00:00
Cache D3D11 buffers being read-only to speed up bound-for-write checks
This commit is contained in:
2 files changed
+16
No files matched your search
@@ -1292,6 +1292,9 @@ bool D3D11RenderState::IsBoundForWrite(ID3D11Buffer *buffer)
|
||||
if(buffer == NULL)
|
||||
return false;
|
||||
|
||||
if(((WrappedID3D11Buffer *)buffer)->ReadOnly())
|
||||
return false;
|
||||
|
||||
return IsRangeBoundForWrite(ResourceRange(buffer));
|
||||
}
|
||||
|
||||
|
||||
@@ -440,6 +440,8 @@ public:
|
||||
|
||||
class WrappedID3D11Buffer : public WrappedResource11<ID3D11Buffer, D3D11_BUFFER_DESC>
|
||||
{
|
||||
bool m_ReadOnly = false;
|
||||
|
||||
public:
|
||||
struct BufferEntry
|
||||
{
|
||||
@@ -464,6 +466,15 @@ public:
|
||||
RDCASSERT(m_BufferList.find(GetResourceID()) == m_BufferList.end());
|
||||
m_BufferList[GetResourceID()] = BufferEntry(this, byteLength);
|
||||
}
|
||||
|
||||
if(real)
|
||||
{
|
||||
D3D11_BUFFER_DESC desc = {};
|
||||
real->GetDesc(&desc);
|
||||
|
||||
m_ReadOnly = ((desc.BindFlags & (D3D11_BIND_UNORDERED_ACCESS | D3D11_BIND_STREAM_OUTPUT |
|
||||
D3D11_BIND_RENDER_TARGET | D3D11_BIND_DEPTH_STENCIL)) == 0);
|
||||
}
|
||||
}
|
||||
|
||||
virtual ~WrappedID3D11Buffer()
|
||||
@@ -484,6 +495,8 @@ public:
|
||||
if(pResourceDimension)
|
||||
*pResourceDimension = D3D11_RESOURCE_DIMENSION_BUFFER;
|
||||
}
|
||||
|
||||
bool ReadOnly() { return m_ReadOnly; }
|
||||
};
|
||||
|
||||
template <typename NestedType, typename DescType, typename NestedType1>
|
||||
|
||||
Reference in new issue
Block a user