mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-01-18 02:52:10 +01:00
[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:
parent
7de27d4fd8
commit
89c3b60640
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user