1
0
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:
Philip Rebohle 2018-06-04 23:24:42 +02:00
parent 217399926d
commit cfe99368fb
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99
3 changed files with 36 additions and 2 deletions

View File

@ -333,6 +333,17 @@ namespace dxvk {
void unlockSubmission() { void unlockSubmission() {
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

View File

@ -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;
} }
} }
} }

View File

@ -14,8 +14,6 @@ namespace dxvk {
/** /**
* \brief Submission queue * \brief Submission queue
*
*
*/ */
class DxvkSubmissionQueue { class DxvkSubmissionQueue {
@ -23,7 +21,28 @@ 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;