mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-01-19 05:52:11 +01:00
[dxvk] Make number of queued submissions available to DXVK
This commit is contained in:
parent
217399926d
commit
cfe99368fb
@ -334,6 +334,17 @@ namespace dxvk {
|
|||||||
m_submissionLock.unlock();
|
m_submissionLock.unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Number of pending submissions
|
||||||
|
*
|
||||||
|
* A return value of 0 indicates
|
||||||
|
* that the GPU is currently idle.
|
||||||
|
* \returns Pending submission count
|
||||||
|
*/
|
||||||
|
uint32_t pendingSubmissions() const {
|
||||||
|
return m_submissionQueue.pendingSubmissions();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Waits until the device becomes idle
|
* \brief Waits until the device becomes idle
|
||||||
*
|
*
|
||||||
|
@ -27,6 +27,7 @@ namespace dxvk {
|
|||||||
return m_entries.size() < MaxNumQueuedCommandBuffers;
|
return m_entries.size() < MaxNumQueuedCommandBuffers;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
m_submits += 1;
|
||||||
m_entries.push(cmdList);
|
m_entries.push(cmdList);
|
||||||
m_condOnAdd.notify_one();
|
m_condOnAdd.notify_one();
|
||||||
}
|
}
|
||||||
@ -65,6 +66,8 @@ namespace dxvk {
|
|||||||
"DxvkSubmissionQueue: Failed to sync fence: ",
|
"DxvkSubmissionQueue: Failed to sync fence: ",
|
||||||
status));
|
status));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_submits -= 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,8 +14,6 @@ namespace dxvk {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Submission queue
|
* \brief Submission queue
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
class DxvkSubmissionQueue {
|
class DxvkSubmissionQueue {
|
||||||
|
|
||||||
@ -24,6 +22,27 @@ namespace dxvk {
|
|||||||
DxvkSubmissionQueue(DxvkDevice* device);
|
DxvkSubmissionQueue(DxvkDevice* device);
|
||||||
~DxvkSubmissionQueue();
|
~DxvkSubmissionQueue();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Number of pending submissions
|
||||||
|
*
|
||||||
|
* A return value of 0 indicates
|
||||||
|
* that the GPU is currently idle.
|
||||||
|
* \returns Pending submission count
|
||||||
|
*/
|
||||||
|
uint32_t pendingSubmissions() const {
|
||||||
|
return m_submits.load();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Submits a command list
|
||||||
|
*
|
||||||
|
* Submits a command list to the queue thread.
|
||||||
|
* This thread will wait for the command list
|
||||||
|
* to finish executing on the GPU and signal
|
||||||
|
* any queries and events that are used by
|
||||||
|
* the command list in question.
|
||||||
|
* \param [in] cmdList The command list
|
||||||
|
*/
|
||||||
void submit(const Rc<DxvkCommandList>& cmdList);
|
void submit(const Rc<DxvkCommandList>& cmdList);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -31,6 +50,7 @@ namespace dxvk {
|
|||||||
DxvkDevice* m_device;
|
DxvkDevice* m_device;
|
||||||
|
|
||||||
std::atomic<bool> m_stopped = { false };
|
std::atomic<bool> m_stopped = { false };
|
||||||
|
std::atomic<uint32_t> m_submits = { 0u };
|
||||||
|
|
||||||
std::mutex m_mutex;
|
std::mutex m_mutex;
|
||||||
std::condition_variable m_condOnAdd;
|
std::condition_variable m_condOnAdd;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user