mirror of
https://github.com/EduApps-CDG/OpenDX
synced 2024-12-30 09:45:37 +01:00
Reduces command submission overhead by reusing fence objects instead of creating new ones for each submission. Improves error reporting in case the submission cannot be complete.
45 lines
791 B
C++
45 lines
791 B
C++
#pragma once
|
|
|
|
#include <condition_variable>
|
|
#include <mutex>
|
|
#include <queue>
|
|
#include <thread>
|
|
|
|
#include "dxvk_cmdlist.h"
|
|
#include "dxvk_sync.h"
|
|
|
|
namespace dxvk {
|
|
|
|
class DxvkDevice;
|
|
|
|
/**
|
|
* \brief Submission queue
|
|
*
|
|
*
|
|
*/
|
|
class DxvkSubmissionQueue {
|
|
|
|
public:
|
|
|
|
DxvkSubmissionQueue(DxvkDevice* device);
|
|
~DxvkSubmissionQueue();
|
|
|
|
void submit(const Rc<DxvkCommandList>& cmdList);
|
|
|
|
private:
|
|
|
|
DxvkDevice* m_device;
|
|
|
|
std::atomic<bool> m_stopped = { false };
|
|
|
|
std::mutex m_mutex;
|
|
std::condition_variable m_condOnAdd;
|
|
std::condition_variable m_condOnTake;
|
|
std::queue<Rc<DxvkCommandList>> m_entries;
|
|
std::thread m_thread;
|
|
|
|
void threadFunc();
|
|
|
|
};
|
|
|
|
} |