mirror of
https://github.com/doitsujin/dxvk.git
synced 2024-12-05 01:24:14 +01:00
[d3d11] Consider empty CS chunks when tracking resources
Avoids deadlocks if we track multiple resources and flush in between.
This commit is contained in:
parent
9af3dce304
commit
17a1b0ad44
@ -734,7 +734,8 @@ namespace dxvk {
|
||||
void D3D11ImmediateContext::TrackTextureSequenceNumber(
|
||||
D3D11CommonTexture* pResource,
|
||||
UINT Subresource) {
|
||||
pResource->TrackSequenceNumber(Subresource, m_csSeqNum + 1);
|
||||
uint64_t sequenceNumber = GetCurrentSequenceNumber();
|
||||
pResource->TrackSequenceNumber(Subresource, sequenceNumber);
|
||||
|
||||
FlushImplicit(TRUE);
|
||||
}
|
||||
@ -742,12 +743,21 @@ namespace dxvk {
|
||||
|
||||
void D3D11ImmediateContext::TrackBufferSequenceNumber(
|
||||
D3D11Buffer* pResource) {
|
||||
pResource->TrackSequenceNumber(m_csSeqNum + 1);
|
||||
uint64_t sequenceNumber = GetCurrentSequenceNumber();
|
||||
pResource->TrackSequenceNumber(sequenceNumber);
|
||||
|
||||
FlushImplicit(TRUE);
|
||||
}
|
||||
|
||||
|
||||
uint64_t D3D11ImmediateContext::GetCurrentSequenceNumber() {
|
||||
// We do not flush empty chunks, so if we are tracking a resource
|
||||
// immediately after a flush, we need to use the sequence number
|
||||
// of the previously submitted chunk to prevent deadlocks.
|
||||
return m_csChunk->empty() ? m_csSeqNum : m_csSeqNum + 1;
|
||||
}
|
||||
|
||||
|
||||
void D3D11ImmediateContext::FlushImplicit(BOOL StrongHint) {
|
||||
// Flush only if the GPU is about to go idle, in
|
||||
// order to keep the number of submissions low.
|
||||
|
@ -174,6 +174,8 @@ namespace dxvk {
|
||||
void TrackBufferSequenceNumber(
|
||||
D3D11Buffer* pResource);
|
||||
|
||||
uint64_t GetCurrentSequenceNumber();
|
||||
|
||||
void FlushImplicit(BOOL StrongHint);
|
||||
|
||||
void SignalEvent(HANDLE hEvent);
|
||||
|
Loading…
Reference in New Issue
Block a user