diff --git a/src/engine/platform/amiga.cpp b/src/engine/platform/amiga.cpp index c97624c54..a4e279dad 100644 --- a/src/engine/platform/amiga.cpp +++ b/src/engine/platform/amiga.cpp @@ -80,7 +80,7 @@ const char** DivPlatformAmiga::getRegisterSheet() { } void DivPlatformAmiga::acquire(short** buf, size_t len) { - static int outL, outR, output; + thread_local int outL, outR, output; for (size_t h=0; hdebug_engine(); diff --git a/src/engine/platform/genesis.cpp b/src/engine/platform/genesis.cpp index 1564fa0cc..4973a323d 100644 --- a/src/engine/platform/genesis.cpp +++ b/src/engine/platform/genesis.cpp @@ -132,8 +132,8 @@ void DivPlatformGenesis::processDAC(int iRate) { } void DivPlatformGenesis::acquire_nuked(short** buf, size_t len) { - static short o[2]; - static int os[2]; + thread_local short o[2]; + thread_local int os[2]; for (size_t h=0; hdebug_engine(); diff --git a/src/engine/platform/opl.cpp b/src/engine/platform/opl.cpp index dff366d32..44e9b3b14 100644 --- a/src/engine/platform/opl.cpp +++ b/src/engine/platform/opl.cpp @@ -160,9 +160,9 @@ const int orderedOpsL[4]={ #define ADDR_LR_FB_ALG 0xc0 void DivPlatformOPL::acquire_nuked(short** buf, size_t len) { - static short o[4]; - static int os[4]; - static ymfm::ymfm_output<2> aOut; + thread_local short o[4]; + thread_local int os[4]; + thread_local ymfm::ymfm_output<2> aOut; for (size_t h=0; hdebug_engine(); diff --git a/src/engine/platform/ym2203.cpp b/src/engine/platform/ym2203.cpp index 2e805f3cd..53d2cfe06 100644 --- a/src/engine/platform/ym2203.cpp +++ b/src/engine/platform/ym2203.cpp @@ -165,8 +165,8 @@ void DivPlatformYM2203::acquire(short** buf, size_t len) { } void DivPlatformYM2203::acquire_combo(short** buf, size_t len) { - static int os; - static short ignored[2]; + thread_local int os; + thread_local short ignored[2]; for (size_t h=0; h OPN @@ -241,7 +241,7 @@ void DivPlatformYM2203::acquire_combo(short** buf, size_t len) { } void DivPlatformYM2203::acquire_ymfm(short** buf, size_t len) { - static int os; + thread_local int os; ymfm::ym2203::fm_engine* fme=fm->debug_fm_engine(); diff --git a/src/engine/platform/ym2608.cpp b/src/engine/platform/ym2608.cpp index dcab9dd5f..743cfab46 100644 --- a/src/engine/platform/ym2608.cpp +++ b/src/engine/platform/ym2608.cpp @@ -306,8 +306,8 @@ void DivPlatformYM2608::acquire(short** buf, size_t len) { } void DivPlatformYM2608::acquire_combo(short** buf, size_t len) { - static int os[2]; - static short ignored[2]; + thread_local int os[2]; + thread_local short ignored[2]; ymfm::ssg_engine* ssge=fm->debug_ssg_engine(); ymfm::adpcm_a_engine* aae=fm->debug_adpcm_a_engine(); @@ -419,7 +419,7 @@ void DivPlatformYM2608::acquire_combo(short** buf, size_t len) { } void DivPlatformYM2608::acquire_ymfm(short** buf, size_t len) { - static int os[2]; + thread_local int os[2]; ymfm::ym2608::fm_engine* fme=fm->debug_fm_engine(); ymfm::ssg_engine* ssge=fm->debug_ssg_engine(); diff --git a/src/engine/platform/ym2610.cpp b/src/engine/platform/ym2610.cpp index 8b9295d9f..173d882a6 100644 --- a/src/engine/platform/ym2610.cpp +++ b/src/engine/platform/ym2610.cpp @@ -241,8 +241,8 @@ void DivPlatformYM2610::acquire(short** buf, size_t len) { } void DivPlatformYM2610::acquire_combo(short** buf, size_t len) { - static int os[2]; - static short ignored[2]; + thread_local int os[2]; + thread_local short ignored[2]; ymfm::ssg_engine* ssge=fm->debug_ssg_engine(); ymfm::adpcm_a_engine* aae=fm->debug_adpcm_a_engine(); @@ -350,7 +350,7 @@ void DivPlatformYM2610::acquire_combo(short** buf, size_t len) { } void DivPlatformYM2610::acquire_ymfm(short** buf, size_t len) { - static int os[2]; + thread_local int os[2]; ymfm::ym2610::fm_engine* fme=fm->debug_fm_engine(); ymfm::ssg_engine* ssge=fm->debug_ssg_engine(); diff --git a/src/engine/platform/ym2610b.cpp b/src/engine/platform/ym2610b.cpp index 7369265f9..4f00a7761 100644 --- a/src/engine/platform/ym2610b.cpp +++ b/src/engine/platform/ym2610b.cpp @@ -305,8 +305,8 @@ void DivPlatformYM2610B::acquire(short** buf, size_t len) { } void DivPlatformYM2610B::acquire_combo(short** buf, size_t len) { - static int os[2]; - static short ignored[2]; + thread_local int os[2]; + thread_local short ignored[2]; ymfm::ssg_engine* ssge=fm->debug_ssg_engine(); ymfm::adpcm_a_engine* aae=fm->debug_adpcm_a_engine(); @@ -418,7 +418,7 @@ void DivPlatformYM2610B::acquire_combo(short** buf, size_t len) { } void DivPlatformYM2610B::acquire_ymfm(short** buf, size_t len) { - static int os[2]; + thread_local int os[2]; ymfm::ym2610b::fm_engine* fme=fm->debug_fm_engine(); ymfm::ssg_engine* ssge=fm->debug_ssg_engine(); diff --git a/src/engine/playback.cpp b/src/engine/playback.cpp index 1cb7b62d8..7582c9efb 100644 --- a/src/engine/playback.cpp +++ b/src/engine/playback.cpp @@ -2115,8 +2115,12 @@ void DivEngine::nextBuf(float** in, float** out, int inChans, int outChans, unsi logW("%d: sizepush([](void* d) { + DivDispatchContainer* dc=(DivDispatchContainer*)d; + dc->fillBuf(dc->runtotal,dc->lastAvail,dc->size-dc->lastAvail); + },&disCont[i]); } + renderPool->wait(); } if (metroBufLennotify.set_value(); setFuckingPromise=false; - std::this_thread::yield(); + //std::this_thread::yield(); } if (terminate) { break; @@ -153,7 +153,7 @@ void DivWorkPool::wait() { } } } - std::this_thread::yield(); + //std::this_thread::yield(); // wait future.wait(); diff --git a/src/gui/settings.cpp b/src/gui/settings.cpp index 9d1cc14b1..5d49c021e 100644 --- a/src/gui/settings.cpp +++ b/src/gui/settings.cpp @@ -902,7 +902,7 @@ void FurnaceGUI::drawSettings() { } } if (ImGui::IsItemHovered()) { - ImGui::SetTooltip("runs chip emulation on separate threads.\nmay increase performance on multi-core CPUs.\n\nwarnings:\n- experimental! currently broken/not working well.\n- only useful on multi-chip songs."); + ImGui::SetTooltip("runs chip emulation on separate threads.\nmay increase performance when using heavy emulation cores.\n\nwarnings:\n- experimental!\n- only useful on multi-chip songs."); } if (renderPoolThreadsB) {