mirror of
https://github.com/doitsujin/dxvk.git
synced 2024-12-11 01:24:12 +01:00
[dxvk] Remove command dispatch methods from CS thread
This was bad design. The user of this API should record commands into a chunk manually and decude what to do with it once it's full.
This commit is contained in:
parent
0b426a0942
commit
0789c5f10d
@ -25,9 +25,7 @@ namespace dxvk {
|
||||
|
||||
|
||||
DxvkCsThread::DxvkCsThread(const Rc<DxvkContext>& context)
|
||||
: m_context(context),
|
||||
m_curChunk(new DxvkCsChunk()),
|
||||
m_thread([this] { threadFunc(); }) {
|
||||
: m_context(context), m_thread([this] { threadFunc(); }) {
|
||||
|
||||
}
|
||||
|
||||
@ -44,19 +42,13 @@ namespace dxvk {
|
||||
|
||||
void DxvkCsThread::dispatchChunk(Rc<DxvkCsChunk>&& chunk) {
|
||||
{ std::unique_lock<std::mutex> lock(m_mutex);
|
||||
m_chunks.push(std::move(m_curChunk));
|
||||
m_chunks.push(std::move(chunk));
|
||||
}
|
||||
|
||||
m_condOnAdd.notify_one();
|
||||
}
|
||||
|
||||
|
||||
void DxvkCsThread::flush() {
|
||||
dispatchChunk(std::move(m_curChunk));
|
||||
m_curChunk = new DxvkCsChunk();
|
||||
}
|
||||
|
||||
|
||||
void DxvkCsThread::synchronize() {
|
||||
std::unique_lock<std::mutex> lock(m_mutex);
|
||||
|
||||
|
@ -134,19 +134,6 @@ namespace dxvk {
|
||||
DxvkCsThread(const Rc<DxvkContext>& context);
|
||||
~DxvkCsThread();
|
||||
|
||||
/**
|
||||
* \brief Dispatches a new command
|
||||
*
|
||||
* Adds the command to the current chunk and
|
||||
* dispatches the chunk in case it is full.
|
||||
* \param [in] command The command
|
||||
*/
|
||||
template<typename T>
|
||||
void dispatch(T&& command) {
|
||||
while (!m_curChunk->push(command))
|
||||
this->flush();
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Dispatches an entire chunk
|
||||
*
|
||||
@ -156,15 +143,6 @@ namespace dxvk {
|
||||
*/
|
||||
void dispatchChunk(Rc<DxvkCsChunk>&& chunk);
|
||||
|
||||
/**
|
||||
* \brief Dispatches current chunk
|
||||
*
|
||||
* Adds the current chunk to the dispatch
|
||||
* queue and makes an empty chunk current.
|
||||
* Call this before \ref synchronize.
|
||||
*/
|
||||
void flush();
|
||||
|
||||
/**
|
||||
* \brief Synchronizes with the thread
|
||||
*
|
||||
@ -179,17 +157,12 @@ namespace dxvk {
|
||||
|
||||
const Rc<DxvkContext> m_context;
|
||||
|
||||
// Chunk that is being recorded
|
||||
Rc<DxvkCsChunk> m_curChunk;
|
||||
|
||||
// Chunks that are executing
|
||||
std::atomic<bool> m_stopped = { false };
|
||||
std::mutex m_mutex;
|
||||
std::condition_variable m_condOnAdd;
|
||||
std::condition_variable m_condOnSync;
|
||||
std::queue<Rc<DxvkCsChunk>> m_chunks;
|
||||
|
||||
std::thread m_thread;
|
||||
std::thread m_thread;
|
||||
|
||||
void threadFunc();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user