GUI: add option for late clear

This commit is contained in:
tildearrow 2023-06-08 04:15:57 -05:00
parent 32c300ff41
commit 402c520276
3 changed files with 19 additions and 1 deletions

View File

@ -5803,7 +5803,9 @@ bool FurnaceGUI::loop() {
}
}
rend->clear(uiColors[GUI_COLOR_BACKGROUND]);
if (!settings.renderClearPos) {
rend->clear(uiColors[GUI_COLOR_BACKGROUND]);
}
renderTimeBegin=SDL_GetPerformanceCounter();
ImGui::Render();
renderTimeEnd=SDL_GetPerformanceCounter();
@ -5821,6 +5823,9 @@ bool FurnaceGUI::loop() {
}
}
rend->present();
if (settings.renderClearPos) {
rend->clear(uiColors[GUI_COLOR_BACKGROUND]);
}
layoutTimeDelta=layoutTimeEnd-layoutTimeBegin;
renderTimeDelta=renderTimeEnd-renderTimeBegin;

View File

@ -1495,6 +1495,7 @@ class FurnaceGUI {
int orderButtonPos;
int compress;
int newPatternFormat;
int renderClearPos;
unsigned int maxUndoSteps;
String mainFontPath;
String patFontPath;
@ -1643,6 +1644,7 @@ class FurnaceGUI {
orderButtonPos(2),
compress(1),
newPatternFormat(1),
renderClearPos(0),
maxUndoSteps(100),
mainFontPath(""),
patFontPath(""),

View File

@ -626,6 +626,14 @@ void FurnaceGUI::drawSettings() {
ImGui::SetTooltip("saves power by lowering the frame rate to 2fps when idle.\nmay cause issues under Mesa drivers!");
}
bool renderClearPosB=settings.renderClearPos;
if (ImGui::Checkbox("Late render clear",&renderClearPosB)) {
settings.renderClearPos=renderClearPosB;
}
if (ImGui::IsItemHovered()) {
ImGui::SetTooltip("calls rend->clear() after rend->present(). might reduce UI latency by one frame in some drivers.");
}
#ifndef IS_MOBILE
bool noThreadedInputB=settings.noThreadedInput;
if (ImGui::Checkbox("Disable threaded input (restart after changing!)",&noThreadedInputB)) {
@ -2728,6 +2736,7 @@ void FurnaceGUI::syncSettings() {
settings.compress=e->getConfInt("compress",1);
settings.newPatternFormat=e->getConfInt("newPatternFormat",1);
settings.renderBackend=e->getConfString("renderBackend","SDL");
settings.renderClearPos=e->getConfInt("renderClearPos",0);
clampSetting(settings.mainFontSize,2,96);
clampSetting(settings.patFontSize,2,96);
@ -2850,6 +2859,7 @@ void FurnaceGUI::syncSettings() {
clampSetting(settings.orderButtonPos,0,2);
clampSetting(settings.compress,0,1);
clampSetting(settings.newPatternFormat,0,1);
clampSetting(settings.renderClearPos,0,1);
if (settings.exportLoops<0.0) settings.exportLoops=0.0;
if (settings.exportFadeOut<0.0) settings.exportFadeOut=0.0;
@ -3068,6 +3078,7 @@ void FurnaceGUI::commitSettings() {
e->setConf("compress",settings.compress);
e->setConf("newPatternFormat",settings.newPatternFormat);
e->setConf("renderBackend",settings.renderBackend);
e->setConf("renderClearPos",settings.renderClearPos);
// colors
for (int i=0; i<GUI_COLOR_MAX; i++) {