From 0789c5f10d6714746316f67c036c1c03f6c8845f Mon Sep 17 00:00:00 2001 From: Philip Rebohle Date: Sat, 20 Jan 2018 14:59:50 +0100 Subject: [PATCH] [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. --- src/dxvk/dxvk_cs.cpp | 12 ++---------- src/dxvk/dxvk_cs.h | 29 +---------------------------- 2 files changed, 3 insertions(+), 38 deletions(-) diff --git a/src/dxvk/dxvk_cs.cpp b/src/dxvk/dxvk_cs.cpp index ee6e17dc..041b4b84 100644 --- a/src/dxvk/dxvk_cs.cpp +++ b/src/dxvk/dxvk_cs.cpp @@ -25,9 +25,7 @@ namespace dxvk { DxvkCsThread::DxvkCsThread(const Rc& 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&& chunk) { { std::unique_lock 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 lock(m_mutex); diff --git a/src/dxvk/dxvk_cs.h b/src/dxvk/dxvk_cs.h index e74ddb4e..f906bb9b 100644 --- a/src/dxvk/dxvk_cs.h +++ b/src/dxvk/dxvk_cs.h @@ -134,19 +134,6 @@ namespace dxvk { DxvkCsThread(const Rc& 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 - 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&& 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 m_context; - // Chunk that is being recorded - Rc m_curChunk; - - // Chunks that are executing std::atomic m_stopped = { false }; std::mutex m_mutex; std::condition_variable m_condOnAdd; std::condition_variable m_condOnSync; std::queue> m_chunks; - - std::thread m_thread; + std::thread m_thread; void threadFunc();