[dxvk] Removed upper limit for CS chunks

Since we are synchronizing once per frame anyway, there is no need to
artificially limit the number of chunks in flight. Applications which
use deferred contexts and submit a large number of CS chunks through
command lists may benefit from this optimization.
This commit is contained in:
Philip Rebohle 2018-04-03 20:06:25 +02:00
parent 7de27d4fd8
commit 89c3b60640
2 changed files with 8 additions and 16 deletions

View File

@ -53,15 +53,9 @@ namespace dxvk {
void DxvkCsThread::dispatchChunk(Rc<DxvkCsChunk>&& chunk) {
std::unique_lock<std::mutex> lock(m_mutex);
m_chunksPending += 1;
m_chunksQueued.push(std::move(chunk));
if (m_chunksPending > MaxChunksInFlight) {
m_condOnSync.wait(lock, [this] {
return (m_chunksPending <= MaxChunksInFlight )
|| (m_stopped.load());
});
{ std::unique_lock<std::mutex> lock(m_mutex);
m_chunksQueued.push(std::move(chunk));
m_chunksPending += 1;
}
m_condOnAdd.notify_one();
@ -83,8 +77,10 @@ namespace dxvk {
while (!m_stopped.load()) {
{ std::unique_lock<std::mutex> lock(m_mutex);
if (chunk != nullptr) {
m_chunksPending -= 1;
m_condOnSync.notify_one();
if (--m_chunksPending == 0)
m_condOnSync.notify_one();
chunk = nullptr;
}
if (m_chunksQueued.size() == 0) {
@ -97,8 +93,6 @@ namespace dxvk {
if (m_chunksQueued.size() != 0) {
chunk = std::move(m_chunksQueued.front());
m_chunksQueued.pop();
} else {
chunk = nullptr;
}
}

View File

@ -166,9 +166,7 @@ namespace dxvk {
* commands on a DXVK context.
*/
class DxvkCsThread {
// Limit the number of chunks in the queue
// to prevent memory leaks, stuttering etc.
constexpr static uint32_t MaxChunksInFlight = 32;
public:
DxvkCsThread(const Rc<DxvkContext>& context);