mirror of
https://github.com/citra-emu/citra.git
synced 2025-02-18 17:10:09 +00:00
fix dispatching
This commit is contained in:
parent
502f0c991b
commit
e258faf0f0
@ -424,16 +424,15 @@ static void WritePicaReg(u32 id, u32 value, u32 mask) {
|
|||||||
auto& thread_pool = Common::ThreadPool::GetPool();
|
auto& thread_pool = Common::ThreadPool::GetPool();
|
||||||
std::vector<std::future<void>> futures;
|
std::vector<std::future<void>> futures;
|
||||||
|
|
||||||
constexpr unsigned int MIN_VERTICES_PER_THREAD = 20;
|
constexpr unsigned int MIN_VERTICES_PER_THREAD = 10;
|
||||||
unsigned int num_threads = regs.pipeline.num_vertices / MIN_VERTICES_PER_THREAD +
|
unsigned int vs_threads = regs.pipeline.num_vertices / MIN_VERTICES_PER_THREAD;
|
||||||
(regs.pipeline.num_vertices % MIN_VERTICES_PER_THREAD != 0);
|
vs_threads = std::min(vs_threads, std::thread::hardware_concurrency() - 1);
|
||||||
num_threads = std::min(num_threads, std::thread::hardware_concurrency() - 1);
|
|
||||||
|
|
||||||
if (num_threads <= 1) {
|
if (!vs_threads) {
|
||||||
VSUnitLoop(0, std::integral_constant<u32, 1>{});
|
VSUnitLoop(0, std::integral_constant<u32, 1>{});
|
||||||
} else {
|
} else {
|
||||||
for (unsigned int thread_id = 0; thread_id < num_threads; ++thread_id) {
|
for (unsigned int thread_id = 0; thread_id < vs_threads; ++thread_id) {
|
||||||
futures.emplace_back(thread_pool.push(VSUnitLoop, thread_id, num_threads));
|
futures.emplace_back(thread_pool.push(VSUnitLoop, thread_id, vs_threads));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -447,7 +446,7 @@ static void WritePicaReg(u32 id, u32 value, u32 mask) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Synchronize threads
|
// Synchronize threads
|
||||||
if (num_threads != 1) {
|
if (vs_threads) {
|
||||||
while (cached_vertex.batch.load(std::memory_order_acquire) != batch_id) {
|
while (cached_vertex.batch.load(std::memory_order_acquire) != batch_id) {
|
||||||
std::this_thread::yield();
|
std::this_thread::yield();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user