software renderer, part F
This commit is contained in:
parent
823876a5c6
commit
c5a811f58e
2
extern/imgui_software_renderer/imgui_sw.cpp
vendored
2
extern/imgui_software_renderer/imgui_sw.cpp
vendored
|
@ -147,7 +147,7 @@ inline ImU32 color_convert_float4_to_u32(const ImVec4 &in)
|
|||
// TODO: make it 32-bit or else
|
||||
|
||||
using Int = int32_t;
|
||||
const Int kFixedBias = 256;
|
||||
const Int kFixedBias = 1;
|
||||
|
||||
struct Point
|
||||
{
|
||||
|
|
|
@ -6296,6 +6296,17 @@ bool FurnaceGUI::loop() {
|
|||
}
|
||||
#endif
|
||||
|
||||
if (settings.displayRenderTime) {
|
||||
String renderTime=fmt::sprintf("%.0fµs",ImGui::GetIO().DeltaTime*1000000.0);
|
||||
String renderTime2=fmt::sprintf("%.1f FPS",1.0/ImGui::GetIO().DeltaTime);
|
||||
ImDrawList* dl=ImGui::GetForegroundDrawList();
|
||||
ImVec2 markPos=ImVec2(canvasW-ImGui::CalcTextSize(renderTime.c_str()).x-60.0*dpiScale,4.0*dpiScale);
|
||||
ImVec2 markPos2=ImVec2(canvasW-ImGui::CalcTextSize(renderTime2.c_str()).x-160.0*dpiScale,4.0*dpiScale);
|
||||
|
||||
dl->AddText(markPos,0xffffffff,renderTime.c_str());
|
||||
dl->AddText(markPos2,0xffffffff,renderTime2.c_str());
|
||||
}
|
||||
|
||||
layoutTimeEnd=SDL_GetPerformanceCounter();
|
||||
|
||||
// backup trigger
|
||||
|
|
|
@ -1842,6 +1842,7 @@ class FurnaceGUI {
|
|||
int cursorWheelStep;
|
||||
int vsync;
|
||||
int frameRateLimit;
|
||||
int displayRenderTime;
|
||||
unsigned int maxUndoSteps;
|
||||
String mainFontPath;
|
||||
String headFontPath;
|
||||
|
@ -2073,6 +2074,7 @@ class FurnaceGUI {
|
|||
cursorWheelStep(0),
|
||||
vsync(1),
|
||||
frameRateLimit(60),
|
||||
displayRenderTime(0),
|
||||
maxUndoSteps(100),
|
||||
mainFontPath(""),
|
||||
headFontPath(""),
|
||||
|
|
|
@ -216,15 +216,23 @@ void FurnaceGUI::drawOsc() {
|
|||
ImU32 guideColor=ImGui::GetColorU32(uiColors[GUI_COLOR_OSC_GUIDE]);
|
||||
ImGui::ItemSize(size,style.FramePadding.y);
|
||||
if (ImGui::ItemAdd(rect,ImGui::GetID("wsDisplay"))) {
|
||||
dl->AddRectFilledMultiColor(
|
||||
inRect.Min,
|
||||
inRect.Max,
|
||||
ImGui::GetColorU32(uiColors[GUI_COLOR_OSC_BG1]),
|
||||
ImGui::GetColorU32(uiColors[GUI_COLOR_OSC_BG2]),
|
||||
ImGui::GetColorU32(uiColors[GUI_COLOR_OSC_BG4]),
|
||||
ImGui::GetColorU32(uiColors[GUI_COLOR_OSC_BG3]),
|
||||
settings.oscRoundedCorners?(8.0f*dpiScale):0.0f
|
||||
);
|
||||
if (safeMode || renderBackend==GUI_BACKEND_SOFTWARE) {
|
||||
dl->AddRectFilled(
|
||||
inRect.Min,
|
||||
inRect.Max,
|
||||
ImGui::GetColorU32(uiColors[GUI_COLOR_OSC_BG4])
|
||||
);
|
||||
} else {
|
||||
dl->AddRectFilledMultiColor(
|
||||
inRect.Min,
|
||||
inRect.Max,
|
||||
ImGui::GetColorU32(uiColors[GUI_COLOR_OSC_BG1]),
|
||||
ImGui::GetColorU32(uiColors[GUI_COLOR_OSC_BG2]),
|
||||
ImGui::GetColorU32(uiColors[GUI_COLOR_OSC_BG4]),
|
||||
ImGui::GetColorU32(uiColors[GUI_COLOR_OSC_BG3]),
|
||||
settings.oscRoundedCorners?(8.0f*dpiScale):0.0f
|
||||
);
|
||||
}
|
||||
|
||||
dl->AddLine(
|
||||
ImLerp(rect.Min,rect.Max,ImVec2(0.0f,0.5f)),
|
||||
|
@ -367,7 +375,7 @@ void FurnaceGUI::drawOsc() {
|
|||
dl->Flags=prevFlags;
|
||||
|
||||
if (settings.oscBorder) {
|
||||
dl->AddRect(inRect.Min,inRect.Max,borderColor,settings.oscRoundedCorners?(8.0f*dpiScale):0.0f,0,1.5f*dpiScale);
|
||||
dl->AddRect(inRect.Min,inRect.Max,borderColor,(settings.oscRoundedCorners && !(safeMode || renderBackend==GUI_BACKEND_SOFTWARE))?(8.0f*dpiScale):0.0f,0,1.5f*dpiScale);
|
||||
}
|
||||
}
|
||||
if (oscZoomSlider && ImGui::IsItemHovered()) {
|
||||
|
|
|
@ -476,6 +476,12 @@ void FurnaceGUI::drawSettings() {
|
|||
ImGui::SetTooltip("only applies when VSync is disabled.");
|
||||
}
|
||||
|
||||
bool displayRenderTimeB=settings.displayRenderTime;
|
||||
if (ImGui::Checkbox("Display render time",&displayRenderTimeB)) {
|
||||
settings.displayRenderTime=displayRenderTimeB;
|
||||
settingsChanged=true;
|
||||
}
|
||||
|
||||
bool renderClearPosB=settings.renderClearPos;
|
||||
if (ImGui::Checkbox("Late render clear",&renderClearPosB)) {
|
||||
settings.renderClearPos=renderClearPosB;
|
||||
|
@ -4006,6 +4012,7 @@ void FurnaceGUI::readConfig(DivConfig& conf, FurnaceGUISettingGroups groups) {
|
|||
|
||||
settings.vsync=conf.getInt("vsync",1);
|
||||
settings.frameRateLimit=conf.getInt("frameRateLimit",100);
|
||||
settings.displayRenderTime=conf.getInt("displayRenderTime",0);
|
||||
|
||||
settings.chanOscThreads=conf.getInt("chanOscThreads",0);
|
||||
settings.renderPoolThreads=conf.getInt("renderPoolThreads",0);
|
||||
|
@ -4512,6 +4519,7 @@ void FurnaceGUI::readConfig(DivConfig& conf, FurnaceGUISettingGroups groups) {
|
|||
clampSetting(settings.cursorWheelStep,0,1);
|
||||
clampSetting(settings.vsync,0,4);
|
||||
clampSetting(settings.frameRateLimit,0,1000);
|
||||
clampSetting(settings.displayRenderTime,0,1);
|
||||
|
||||
if (settings.exportLoops<0.0) settings.exportLoops=0.0;
|
||||
if (settings.exportFadeOut<0.0) settings.exportFadeOut=0.0;
|
||||
|
@ -4537,6 +4545,7 @@ void FurnaceGUI::writeConfig(DivConfig& conf, FurnaceGUISettingGroups groups) {
|
|||
|
||||
conf.set("vsync",settings.vsync);
|
||||
conf.set("frameRateLimit",settings.frameRateLimit);
|
||||
conf.set("displayRenderTime",settings.displayRenderTime);
|
||||
|
||||
conf.set("chanOscThreads",settings.chanOscThreads);
|
||||
conf.set("renderPoolThreads",settings.renderPoolThreads);
|
||||
|
@ -5531,6 +5540,10 @@ void FurnaceGUI::applyUISettings(bool updateFonts) {
|
|||
sty.FrameRounding=0.0f;
|
||||
sty.GrabRounding=0.0f;
|
||||
sty.FrameShading=0.0f;
|
||||
sty.TabRounding=0.0f;
|
||||
sty.ScrollbarRounding=0.0f;
|
||||
sty.ChildRounding=0.0f;
|
||||
sty.PopupRounding=0.0f;
|
||||
sty.AntiAliasedLines=false;
|
||||
sty.AntiAliasedLinesUseTex=false;
|
||||
sty.AntiAliasedFill=false;
|
||||
|
|
Loading…
Reference in a new issue