mirror of
https://github.com/tildearrow/furnace.git
synced 2025-01-03 06:01:29 +00:00
GUI: add option to select render backend
This commit is contained in:
parent
e32a8dda8f
commit
c665326b2d
3 changed files with 39 additions and 1 deletions
|
@ -5488,10 +5488,32 @@ bool FurnaceGUI::init() {
|
|||
}
|
||||
#endif
|
||||
|
||||
int numDrivers=SDL_GetNumRenderDrivers();
|
||||
if (numDrivers<0) {
|
||||
logW("could not list render drivers! %s",SDL_GetError());
|
||||
} else {
|
||||
SDL_RendererInfo ri;
|
||||
for (int i=0; i<numDrivers; i++) {
|
||||
int r=SDL_GetRenderDriverInfo(i,&ri);
|
||||
if (r!=0) continue;
|
||||
availRenderDrivers.push_back(String(ri.name));
|
||||
}
|
||||
}
|
||||
|
||||
if (!settings.renderDriver.empty()) {
|
||||
SDL_SetHint(SDL_HINT_RENDER_DRIVER,settings.renderDriver.c_str());
|
||||
}
|
||||
|
||||
sdlRend=SDL_CreateRenderer(sdlWin,-1,SDL_RENDERER_ACCELERATED|SDL_RENDERER_PRESENTVSYNC|SDL_RENDERER_TARGETTEXTURE);
|
||||
|
||||
if (sdlRend==NULL) {
|
||||
lastError=fmt::sprintf("could not init renderer! %s",SDL_GetError());
|
||||
if (!settings.renderDriver.empty()) {
|
||||
settings.renderDriver="";
|
||||
e->setConf("renderDriver","");
|
||||
e->saveConf();
|
||||
lastError=fmt::sprintf("\r\nthe render driver has been set to a safe value. please restart Furnace.");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -1105,7 +1105,7 @@ class FurnaceGUI {
|
|||
std::vector<FurnaceGUISysDef> newSongSearchResults;
|
||||
std::deque<String> recentFile;
|
||||
std::vector<DivInstrumentType> makeInsTypeList;
|
||||
|
||||
std::vector<String> availRenderDrivers;
|
||||
|
||||
bool quit, warnQuit, willCommit, edit, modified, displayError, displayExporting, vgmExportLoop, zsmExportLoop, vgmExportPatternHints;
|
||||
bool vgmExportDirectStream, displayInsTypeList;
|
||||
|
@ -1307,6 +1307,7 @@ class FurnaceGUI {
|
|||
String midiInDevice;
|
||||
String midiOutDevice;
|
||||
String c163Name;
|
||||
String renderDriver;
|
||||
String initialSysName;
|
||||
String noteOffLabel;
|
||||
String noteRelLabel;
|
||||
|
@ -1443,6 +1444,7 @@ class FurnaceGUI {
|
|||
midiInDevice(""),
|
||||
midiOutDevice(""),
|
||||
c163Name(""),
|
||||
renderDriver(""),
|
||||
initialSysName("Sega Genesis/Mega Drive"),
|
||||
noteOffLabel("OFF"),
|
||||
noteRelLabel("==="),
|
||||
|
|
|
@ -1207,6 +1207,18 @@ void FurnaceGUI::drawSettings() {
|
|||
ImVec2 settingsViewSize=ImGui::GetContentRegionAvail();
|
||||
settingsViewSize.y-=ImGui::GetFrameHeight()+ImGui::GetStyle().WindowPadding.y;
|
||||
if (ImGui::BeginChild("SettingsView",settingsViewSize)) {
|
||||
if (ImGui::BeginCombo("Render driver",settings.renderDriver.empty()?"Automatic":settings.renderDriver.c_str())) {
|
||||
if (ImGui::Selectable("Automatic",settings.renderDriver.empty())) {
|
||||
settings.renderDriver="";
|
||||
}
|
||||
for (String& i: availRenderDrivers) {
|
||||
if (ImGui::Selectable(i.c_str(),i==settings.renderDriver)) {
|
||||
settings.renderDriver=i;
|
||||
}
|
||||
}
|
||||
ImGui::EndCombo();
|
||||
}
|
||||
|
||||
bool dpiScaleAuto=(settings.dpiScale<0.5f);
|
||||
if (ImGui::Checkbox("Automatic UI scaling factor",&dpiScaleAuto)) {
|
||||
if (dpiScaleAuto) {
|
||||
|
@ -2447,6 +2459,7 @@ void FurnaceGUI::syncSettings() {
|
|||
settings.midiInDevice=e->getConfString("midiInDevice","");
|
||||
settings.midiOutDevice=e->getConfString("midiOutDevice","");
|
||||
settings.c163Name=e->getConfString("c163Name",DIV_C163_DEFAULT_NAME);
|
||||
settings.renderDriver=e->getConfString("renderDriver","");
|
||||
settings.audioQuality=e->getConfInt("audioQuality",0);
|
||||
settings.audioBufSize=e->getConfInt("audioBufSize",1024);
|
||||
settings.audioRate=e->getConfInt("audioRate",44100);
|
||||
|
@ -2762,6 +2775,7 @@ void FurnaceGUI::commitSettings() {
|
|||
e->setConf("midiInDevice",settings.midiInDevice);
|
||||
e->setConf("midiOutDevice",settings.midiOutDevice);
|
||||
e->setConf("c163Name",settings.c163Name);
|
||||
e->setConf("renderDriver",settings.renderDriver);
|
||||
e->setConf("audioQuality",settings.audioQuality);
|
||||
e->setConf("audioBufSize",settings.audioBufSize);
|
||||
e->setConf("audioRate",settings.audioRate);
|
||||
|
|
Loading…
Reference in a new issue