mirror of https://github.com/stella-emu/stella.git
Added 'threads' commandline argument, to enable/disable multi-threading.
- Still TODO is expose this in the UI, but the infrastructure is there - For now, this defaults to off
This commit is contained in:
parent
f011006af1
commit
4f336eddeb
|
@ -24,6 +24,9 @@
|
|||
this, further optimized the TIA rendering code. Thanks to Thomas
|
||||
Jentzsch for the bulk of the work in this area.
|
||||
|
||||
* Added 'threads' commandline argument and associated UI item to
|
||||
enable/disable multi-threading.
|
||||
|
||||
* Updated CDF scheme to latest version from Spiceware. In addition,
|
||||
this scheme now supports versioning, so older and newer ROMs will
|
||||
continue to work.
|
||||
|
|
|
@ -35,22 +35,6 @@ void AtariNTSC::initialize(const Setup& setup, const uInt8* palette)
|
|||
{
|
||||
init(myImpl, setup);
|
||||
initializePalette(palette);
|
||||
|
||||
uInt32 systemThreads = std::thread::hardware_concurrency();
|
||||
if(systemThreads <= 1)
|
||||
{
|
||||
myWorkerThreads = 0;
|
||||
myTotalThreads = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
systemThreads = std::min(4u, systemThreads);
|
||||
|
||||
myWorkerThreads = systemThreads - 1;
|
||||
myTotalThreads = systemThreads;
|
||||
|
||||
myThreads = make_unique<std::thread[]>(myWorkerThreads);
|
||||
}
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
@ -82,6 +66,26 @@ void AtariNTSC::initializePalette(const uInt8* palette)
|
|||
}
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void AtariNTSC::enableThreading(bool enable)
|
||||
{
|
||||
uInt32 systemThreads = enable ? std::thread::hardware_concurrency() : 0;
|
||||
if(systemThreads <= 1)
|
||||
{
|
||||
myWorkerThreads = 0;
|
||||
myTotalThreads = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
systemThreads = std::min(4u, systemThreads);
|
||||
|
||||
myWorkerThreads = systemThreads - 1;
|
||||
myTotalThreads = systemThreads;
|
||||
|
||||
myThreads = make_unique<std::thread[]>(myWorkerThreads);
|
||||
}
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void AtariNTSC::render(const uInt8* atari_in, const uInt32 in_width, const uInt32 in_height,
|
||||
void* rgb_out, const uInt32 out_pitch, uInt32* rgb_in)
|
||||
|
|
|
@ -51,6 +51,9 @@ class AtariNTSC
|
|||
entry_size = 2 * 14,
|
||||
};
|
||||
|
||||
// By default, threading is turned off
|
||||
AtariNTSC() { enableThreading(false); }
|
||||
|
||||
// Image parameters, ranging from -1.0 to 1.0. Actual internal values shown
|
||||
// in parenthesis and should remain fairly stable in future versions.
|
||||
struct Setup
|
||||
|
@ -80,6 +83,9 @@ class AtariNTSC
|
|||
void initialize(const Setup& setup, const uInt8* palette);
|
||||
void initializePalette(const uInt8* palette);
|
||||
|
||||
// Set up threading
|
||||
void enableThreading(bool enable);
|
||||
|
||||
// Set phosphor palette, for use in Blargg + phosphor mode
|
||||
void setPhosphorPalette(uInt8 palette[256][256]) {
|
||||
memcpy(myPhosphorPalette, palette, 256 * 256);
|
||||
|
|
|
@ -120,6 +120,12 @@ class NTSCFilter
|
|||
myNTSC.render(src_buf, src_width, src_height, dest_buf, dest_pitch, prev_buf);
|
||||
}
|
||||
|
||||
// Enable threading for the NTSC rendering
|
||||
inline void enableThreading(bool enable)
|
||||
{
|
||||
myNTSC.enableThreading(enable);
|
||||
}
|
||||
|
||||
private:
|
||||
// Convert from atari_ntsc_setup_t values to equivalent adjustables
|
||||
void convertToAdjustable(Adjustable& adjustable,
|
||||
|
|
|
@ -139,6 +139,7 @@ Settings::Settings(OSystem& osystem)
|
|||
setInternal("avoxport", "");
|
||||
setInternal("stats", "false");
|
||||
setInternal("fastscbios", "true");
|
||||
setInternal("threads", "false");
|
||||
setExternal("romloadcount", "0");
|
||||
setExternal("maxres", "");
|
||||
|
||||
|
@ -424,6 +425,7 @@ void Settings::usage() const
|
|||
<< " -autoslot <1|0> Automatically switch to next save slot when state saving\n"
|
||||
<< " -stats <1|0> Overlay console info during emulation\n"
|
||||
<< " -fastscbios <1|0> Disable Supercharger BIOS progress loading bars\n"
|
||||
<< " -threads <1|0> Whether to using multi-threading during emulation\n"
|
||||
<< " -snapsavedir <path> The directory to save snapshot files to\n"
|
||||
<< " -snaploaddir <path> The directory to load snapshot files from\n"
|
||||
<< " -snapname <int|rom> Name snapshots according to internal database or ROM\n"
|
||||
|
|
|
@ -56,6 +56,9 @@ TIASurface::TIASurface(OSystem& system)
|
|||
myBaseTiaSurface = myFB.allocateSurface(kTIAW*2, kTIAH);
|
||||
|
||||
memset(myRGBFramebuffer, 0, AtariNTSC::outWidth(kTIAW) * kTIAH);
|
||||
|
||||
// Enable/disable threading in the NTSC TV effects renderer
|
||||
myNTSCFilter.enableThreading(myOSystem.settings().getBool("threads"));
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
|
Loading…
Reference in New Issue