more multi-thread fixes
don't use static on acquire() don't yield at all run fillBuf() on thread fix option tooltip as it introduces some overhead
This commit is contained in:
parent
64669e4d9b
commit
1a520dbf3e
|
@ -80,7 +80,7 @@ const char** DivPlatformAmiga::getRegisterSheet() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void DivPlatformAmiga::acquire(short** buf, size_t len) {
|
void DivPlatformAmiga::acquire(short** buf, size_t len) {
|
||||||
static int outL, outR, output;
|
thread_local int outL, outR, output;
|
||||||
for (size_t h=0; h<len; h++) {
|
for (size_t h=0; h<len; h++) {
|
||||||
bool hsync=bypassLimits;
|
bool hsync=bypassLimits;
|
||||||
outL=0;
|
outL=0;
|
||||||
|
|
|
@ -52,7 +52,7 @@ const char** DivPlatformArcade::getRegisterSheet() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void DivPlatformArcade::acquire_nuked(short** buf, size_t len) {
|
void DivPlatformArcade::acquire_nuked(short** buf, size_t len) {
|
||||||
static int o[2];
|
thread_local int o[2];
|
||||||
|
|
||||||
for (size_t h=0; h<len; h++) {
|
for (size_t h=0; h<len; h++) {
|
||||||
for (int i=0; i<8; i++) {
|
for (int i=0; i<8; i++) {
|
||||||
|
@ -92,7 +92,7 @@ void DivPlatformArcade::acquire_nuked(short** buf, size_t len) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void DivPlatformArcade::acquire_ymfm(short** buf, size_t len) {
|
void DivPlatformArcade::acquire_ymfm(short** buf, size_t len) {
|
||||||
static int os[2];
|
thread_local int os[2];
|
||||||
|
|
||||||
ymfm::ym2151::fm_engine* fme=fm_ymfm->debug_engine();
|
ymfm::ym2151::fm_engine* fme=fm_ymfm->debug_engine();
|
||||||
|
|
||||||
|
|
|
@ -132,8 +132,8 @@ void DivPlatformGenesis::processDAC(int iRate) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void DivPlatformGenesis::acquire_nuked(short** buf, size_t len) {
|
void DivPlatformGenesis::acquire_nuked(short** buf, size_t len) {
|
||||||
static short o[2];
|
thread_local short o[2];
|
||||||
static int os[2];
|
thread_local int os[2];
|
||||||
|
|
||||||
for (size_t h=0; h<len; h++) {
|
for (size_t h=0; h<len; h++) {
|
||||||
processDAC(rate);
|
processDAC(rate);
|
||||||
|
@ -213,7 +213,7 @@ void DivPlatformGenesis::acquire_nuked(short** buf, size_t len) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void DivPlatformGenesis::acquire_ymfm(short** buf, size_t len) {
|
void DivPlatformGenesis::acquire_ymfm(short** buf, size_t len) {
|
||||||
static int os[2];
|
thread_local int os[2];
|
||||||
|
|
||||||
ymfm::ym2612::fm_engine* fme=fm_ymfm->debug_engine();
|
ymfm::ym2612::fm_engine* fme=fm_ymfm->debug_engine();
|
||||||
|
|
||||||
|
|
|
@ -160,9 +160,9 @@ const int orderedOpsL[4]={
|
||||||
#define ADDR_LR_FB_ALG 0xc0
|
#define ADDR_LR_FB_ALG 0xc0
|
||||||
|
|
||||||
void DivPlatformOPL::acquire_nuked(short** buf, size_t len) {
|
void DivPlatformOPL::acquire_nuked(short** buf, size_t len) {
|
||||||
static short o[4];
|
thread_local short o[4];
|
||||||
static int os[4];
|
thread_local int os[4];
|
||||||
static ymfm::ymfm_output<2> aOut;
|
thread_local ymfm::ymfm_output<2> aOut;
|
||||||
|
|
||||||
for (size_t h=0; h<len; h++) {
|
for (size_t h=0; h<len; h++) {
|
||||||
os[0]=0; os[1]=0; os[2]=0; os[3]=0;
|
os[0]=0; os[1]=0; os[2]=0; os[3]=0;
|
||||||
|
|
|
@ -43,8 +43,8 @@ const unsigned char visMapOPLL[9]={
|
||||||
};
|
};
|
||||||
|
|
||||||
void DivPlatformOPLL::acquire_nuked(short** buf, size_t len) {
|
void DivPlatformOPLL::acquire_nuked(short** buf, size_t len) {
|
||||||
static int o[2];
|
thread_local int o[2];
|
||||||
static int os;
|
thread_local int os;
|
||||||
|
|
||||||
for (size_t h=0; h<len; h++) {
|
for (size_t h=0; h<len; h++) {
|
||||||
os=0;
|
os=0;
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
#define chWrite(c,a,v) rWrite(((c)<<3)+(a),v)
|
#define chWrite(c,a,v) rWrite(((c)<<3)+(a),v)
|
||||||
|
|
||||||
void DivPlatformSegaPCM::acquire(short** buf, size_t len) {
|
void DivPlatformSegaPCM::acquire(short** buf, size_t len) {
|
||||||
static int os[2];
|
thread_local int os[2];
|
||||||
|
|
||||||
for (size_t h=0; h<len; h++) {
|
for (size_t h=0; h<len; h++) {
|
||||||
while (!writes.empty()) {
|
while (!writes.empty()) {
|
||||||
|
|
|
@ -58,7 +58,7 @@ const char** DivPlatformTX81Z::getRegisterSheet() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void DivPlatformTX81Z::acquire(short** buf, size_t len) {
|
void DivPlatformTX81Z::acquire(short** buf, size_t len) {
|
||||||
static int os[2];
|
thread_local int os[2];
|
||||||
|
|
||||||
ymfm::ym2414::fm_engine* fme=fm_ymfm->debug_engine();
|
ymfm::ym2414::fm_engine* fme=fm_ymfm->debug_engine();
|
||||||
|
|
||||||
|
|
|
@ -165,8 +165,8 @@ void DivPlatformYM2203::acquire(short** buf, size_t len) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void DivPlatformYM2203::acquire_combo(short** buf, size_t len) {
|
void DivPlatformYM2203::acquire_combo(short** buf, size_t len) {
|
||||||
static int os;
|
thread_local int os;
|
||||||
static short ignored[2];
|
thread_local short ignored[2];
|
||||||
|
|
||||||
for (size_t h=0; h<len; h++) {
|
for (size_t h=0; h<len; h++) {
|
||||||
// AY -> OPN
|
// AY -> OPN
|
||||||
|
@ -241,7 +241,7 @@ void DivPlatformYM2203::acquire_combo(short** buf, size_t len) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void DivPlatformYM2203::acquire_ymfm(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();
|
ymfm::ym2203::fm_engine* fme=fm->debug_fm_engine();
|
||||||
|
|
||||||
|
|
|
@ -306,8 +306,8 @@ void DivPlatformYM2608::acquire(short** buf, size_t len) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void DivPlatformYM2608::acquire_combo(short** buf, size_t len) {
|
void DivPlatformYM2608::acquire_combo(short** buf, size_t len) {
|
||||||
static int os[2];
|
thread_local int os[2];
|
||||||
static short ignored[2];
|
thread_local short ignored[2];
|
||||||
|
|
||||||
ymfm::ssg_engine* ssge=fm->debug_ssg_engine();
|
ymfm::ssg_engine* ssge=fm->debug_ssg_engine();
|
||||||
ymfm::adpcm_a_engine* aae=fm->debug_adpcm_a_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) {
|
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::ym2608::fm_engine* fme=fm->debug_fm_engine();
|
||||||
ymfm::ssg_engine* ssge=fm->debug_ssg_engine();
|
ymfm::ssg_engine* ssge=fm->debug_ssg_engine();
|
||||||
|
|
|
@ -241,8 +241,8 @@ void DivPlatformYM2610::acquire(short** buf, size_t len) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void DivPlatformYM2610::acquire_combo(short** buf, size_t len) {
|
void DivPlatformYM2610::acquire_combo(short** buf, size_t len) {
|
||||||
static int os[2];
|
thread_local int os[2];
|
||||||
static short ignored[2];
|
thread_local short ignored[2];
|
||||||
|
|
||||||
ymfm::ssg_engine* ssge=fm->debug_ssg_engine();
|
ymfm::ssg_engine* ssge=fm->debug_ssg_engine();
|
||||||
ymfm::adpcm_a_engine* aae=fm->debug_adpcm_a_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) {
|
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::ym2610::fm_engine* fme=fm->debug_fm_engine();
|
||||||
ymfm::ssg_engine* ssge=fm->debug_ssg_engine();
|
ymfm::ssg_engine* ssge=fm->debug_ssg_engine();
|
||||||
|
|
|
@ -305,8 +305,8 @@ void DivPlatformYM2610B::acquire(short** buf, size_t len) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void DivPlatformYM2610B::acquire_combo(short** buf, size_t len) {
|
void DivPlatformYM2610B::acquire_combo(short** buf, size_t len) {
|
||||||
static int os[2];
|
thread_local int os[2];
|
||||||
static short ignored[2];
|
thread_local short ignored[2];
|
||||||
|
|
||||||
ymfm::ssg_engine* ssge=fm->debug_ssg_engine();
|
ymfm::ssg_engine* ssge=fm->debug_ssg_engine();
|
||||||
ymfm::adpcm_a_engine* aae=fm->debug_adpcm_a_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) {
|
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::ym2610b::fm_engine* fme=fm->debug_fm_engine();
|
||||||
ymfm::ssg_engine* ssge=fm->debug_ssg_engine();
|
ymfm::ssg_engine* ssge=fm->debug_ssg_engine();
|
||||||
|
|
|
@ -2115,8 +2115,12 @@ void DivEngine::nextBuf(float** in, float** out, int inChans, int outChans, unsi
|
||||||
logW("%d: size<lastAvail! %d<%d",i,size,disCont[i].lastAvail);
|
logW("%d: size<lastAvail! %d<%d",i,size,disCont[i].lastAvail);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
disCont[i].fillBuf(disCont[i].runtotal,disCont[i].lastAvail,size-disCont[i].lastAvail);
|
renderPool->push([](void* d) {
|
||||||
|
DivDispatchContainer* dc=(DivDispatchContainer*)d;
|
||||||
|
dc->fillBuf(dc->runtotal,dc->lastAvail,dc->size-dc->lastAvail);
|
||||||
|
},&disCont[i]);
|
||||||
}
|
}
|
||||||
|
renderPool->wait();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (metroBufLen<size || metroBuf==NULL) {
|
if (metroBufLen<size || metroBuf==NULL) {
|
||||||
|
|
|
@ -41,7 +41,7 @@ void DivWorkThread::run() {
|
||||||
if (setFuckingPromise) {
|
if (setFuckingPromise) {
|
||||||
parent->notify.set_value();
|
parent->notify.set_value();
|
||||||
setFuckingPromise=false;
|
setFuckingPromise=false;
|
||||||
std::this_thread::yield();
|
//std::this_thread::yield();
|
||||||
}
|
}
|
||||||
if (terminate) {
|
if (terminate) {
|
||||||
break;
|
break;
|
||||||
|
@ -153,7 +153,7 @@ void DivWorkPool::wait() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
std::this_thread::yield();
|
//std::this_thread::yield();
|
||||||
|
|
||||||
// wait
|
// wait
|
||||||
future.wait();
|
future.wait();
|
||||||
|
|
|
@ -902,7 +902,7 @@ void FurnaceGUI::drawSettings() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (ImGui::IsItemHovered()) {
|
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) {
|
if (renderPoolThreadsB) {
|
||||||
|
|
Loading…
Reference in a new issue