mirror of
https://github.com/doitsujin/dxvk.git
synced 2024-12-12 13:08:50 +01:00
[d3d11] Determine pending commands based on sequence number
We get this for free and this allows us to query how many CS chunks have been emitted since the last flush.
This commit is contained in:
parent
0ac247c89c
commit
f952418958
@ -170,7 +170,7 @@ namespace dxvk {
|
||||
|
||||
D3D10DeviceLock lock = LockContext();
|
||||
|
||||
if (m_csIsBusy || !m_csChunk->empty()) {
|
||||
if (GetPendingCsChunks()) {
|
||||
// Add commands to flush the threaded
|
||||
// context, then flush the command list
|
||||
EmitCs([] (DxvkContext* ctx) {
|
||||
@ -181,7 +181,7 @@ namespace dxvk {
|
||||
|
||||
// Reset flush timer used for implicit flushes
|
||||
m_lastFlush = dxvk::high_resolution_clock::now();
|
||||
m_csIsBusy = false;
|
||||
m_flushSeqNum = m_csSeqNum;
|
||||
}
|
||||
}
|
||||
|
||||
@ -257,10 +257,6 @@ namespace dxvk {
|
||||
RestoreCommandListState();
|
||||
else
|
||||
ResetContextState();
|
||||
|
||||
// Mark CS thread as busy so that subsequent
|
||||
// flush operations get executed correctly.
|
||||
m_csIsBusy = true;
|
||||
}
|
||||
|
||||
|
||||
@ -833,7 +829,6 @@ namespace dxvk {
|
||||
|
||||
void D3D11ImmediateContext::EmitCsChunk(DxvkCsChunkRef&& chunk) {
|
||||
m_csSeqNum = m_csThread.dispatchChunk(std::move(chunk));
|
||||
m_csIsBusy = true;
|
||||
}
|
||||
|
||||
|
||||
@ -864,6 +859,11 @@ namespace dxvk {
|
||||
}
|
||||
|
||||
|
||||
uint64_t D3D11ImmediateContext::GetPendingCsChunks() {
|
||||
return GetCurrentSequenceNumber() - m_flushSeqNum;
|
||||
}
|
||||
|
||||
|
||||
void D3D11ImmediateContext::FlushImplicit(BOOL StrongHint) {
|
||||
// Flush only if the GPU is about to go idle, in
|
||||
// order to keep the number of submissions low.
|
||||
|
@ -88,7 +88,6 @@ namespace dxvk {
|
||||
|
||||
DxvkCsThread m_csThread;
|
||||
uint64_t m_csSeqNum = 0ull;
|
||||
bool m_csIsBusy = false;
|
||||
|
||||
Rc<sync::CallbackFence> m_eventSignal;
|
||||
uint64_t m_eventCount = 0ull;
|
||||
@ -96,6 +95,9 @@ namespace dxvk {
|
||||
|
||||
VkDeviceSize m_maxImplicitDiscardSize = 0ull;
|
||||
|
||||
uint64_t m_flushSeqNum = 0ull;
|
||||
|
||||
|
||||
dxvk::high_resolution_clock::time_point m_lastFlush
|
||||
= dxvk::high_resolution_clock::now();
|
||||
|
||||
@ -158,6 +160,8 @@ namespace dxvk {
|
||||
|
||||
uint64_t GetCurrentSequenceNumber();
|
||||
|
||||
uint64_t GetPendingCsChunks();
|
||||
|
||||
void FlushImplicit(BOOL StrongHint);
|
||||
|
||||
void SignalEvent(HANDLE hEvent);
|
||||
|
Loading…
Reference in New Issue
Block a user