GUI: new osc renderer, part 23

speed hack
This commit is contained in:
tildearrow 2024-02-19 18:22:08 -05:00
parent d046713be4
commit 6cf570f85b
5 changed files with 16 additions and 0 deletions

View file

@ -615,6 +615,7 @@ void FurnaceGUI::drawDebug() {
ImGui::Text("audio: %dµs",lastProcTime); ImGui::Text("audio: %dµs",lastProcTime);
ImGui::Text("render: %.0fµs",(double)renderTimeDelta/perfFreq); ImGui::Text("render: %.0fµs",(double)renderTimeDelta/perfFreq);
ImGui::Text("draw: %.0fµs",(double)drawTimeDelta/perfFreq); ImGui::Text("draw: %.0fµs",(double)drawTimeDelta/perfFreq);
ImGui::Text("swap: %.0fµs",(double)swapTimeDelta/perfFreq);
ImGui::Text("layout: %.0fµs",(double)layoutTimeDelta/perfFreq); ImGui::Text("layout: %.0fµs",(double)layoutTimeDelta/perfFreq);
ImGui::Text("event: %.0fµs",(double)eventTimeDelta/perfFreq); ImGui::Text("event: %.0fµs",(double)eventTimeDelta/perfFreq);
ImGui::Separator(); ImGui::Separator();

View file

@ -6395,14 +6395,17 @@ bool FurnaceGUI::loop() {
} }
} }
drawTimeEnd=SDL_GetPerformanceCounter(); drawTimeEnd=SDL_GetPerformanceCounter();
swapTimeBegin=SDL_GetPerformanceCounter();
rend->present(); rend->present();
if (settings.renderClearPos) { if (settings.renderClearPos) {
rend->clear(uiColors[GUI_COLOR_BACKGROUND]); rend->clear(uiColors[GUI_COLOR_BACKGROUND]);
} }
swapTimeEnd=SDL_GetPerformanceCounter();
layoutTimeDelta=layoutTimeEnd-layoutTimeBegin; layoutTimeDelta=layoutTimeEnd-layoutTimeBegin;
renderTimeDelta=renderTimeEnd-renderTimeBegin; renderTimeDelta=renderTimeEnd-renderTimeBegin;
drawTimeDelta=drawTimeEnd-drawTimeBegin; drawTimeDelta=drawTimeEnd-drawTimeBegin;
swapTimeDelta=swapTimeEnd-swapTimeBegin;
eventTimeDelta=eventTimeEnd-eventTimeBegin; eventTimeDelta=eventTimeEnd-eventTimeBegin;
soloTimeout-=ImGui::GetIO().DeltaTime; soloTimeout-=ImGui::GetIO().DeltaTime;
@ -7595,6 +7598,9 @@ FurnaceGUI::FurnaceGUI():
drawTimeBegin(0), drawTimeBegin(0),
drawTimeEnd(0), drawTimeEnd(0),
drawTimeDelta(0), drawTimeDelta(0),
swapTimeBegin(0),
swapTimeEnd(0),
swapTimeDelta(0),
eventTimeBegin(0), eventTimeBegin(0),
eventTimeEnd(0), eventTimeEnd(0),
eventTimeDelta(0), eventTimeDelta(0),

View file

@ -2209,6 +2209,7 @@ class FurnaceGUI {
uint64_t layoutTimeBegin, layoutTimeEnd, layoutTimeDelta; uint64_t layoutTimeBegin, layoutTimeEnd, layoutTimeDelta;
uint64_t renderTimeBegin, renderTimeEnd, renderTimeDelta; uint64_t renderTimeBegin, renderTimeEnd, renderTimeDelta;
uint64_t drawTimeBegin, drawTimeEnd, drawTimeDelta; uint64_t drawTimeBegin, drawTimeEnd, drawTimeDelta;
uint64_t swapTimeBegin, swapTimeEnd, swapTimeDelta;
uint64_t eventTimeBegin, eventTimeEnd, eventTimeDelta; uint64_t eventTimeBegin, eventTimeEnd, eventTimeDelta;
FurnaceGUIPerfMetric perfMetrics[64]; FurnaceGUIPerfMetric perfMetrics[64];

View file

@ -382,6 +382,10 @@ void FurnaceGUI::drawOsc() {
if (ImGui::IsItemClicked(ImGuiMouseButton_Right)) { if (ImGui::IsItemClicked(ImGuiMouseButton_Right)) {
oscZoomSlider=!oscZoomSlider; oscZoomSlider=!oscZoomSlider;
} }
if (mobileUI && ImGui::IsItemHovered() && CHECK_LONG_HOLD) {
oscZoomSlider=!oscZoomSlider;
NOTIFY_LONG_HOLD;
}
} }
if (settings.oscTakesEntireWindow) { if (settings.oscTakesEntireWindow) {
ImGui::PopStyleVar(3); ImGui::PopStyleVar(3);

View file

@ -114,6 +114,8 @@ const char* sh_oscRender_srcF=
" if (val>valmax) valmax=val;\n" " if (val>valmax) valmax=val;\n"
" if (val<valmin) valmin=val;\n" " if (val<valmin) valmin=val;\n"
" }\n" " }\n"
" if ((fur_fragCoord.y-uLineWidth)>valmax*uResolution.y*0.5) discard;\n"
" if ((fur_fragCoord.y+uLineWidth)<valmin*uResolution.y*0.5) discard;\n"
" float slope=abs(valmax-valmin)*uResolution.y*0.5;\n" " float slope=abs(valmax-valmin)*uResolution.y*0.5;\n"
" float slopeDiv=min(uAdvance,(uAdvance/slope));\n" " float slopeDiv=min(uAdvance,(uAdvance/slope));\n"
" float xRight=uv.x+((uLineWidth)/uResolution.x);\n" " float xRight=uv.x+((uLineWidth)/uResolution.x);\n"
@ -175,6 +177,8 @@ const char* sh_oscRender_srcF=
" if (val>valmax) valmax=val;\n" " if (val>valmax) valmax=val;\n"
" if (val<valmin) valmin=val;\n" " if (val<valmin) valmin=val;\n"
" }\n" " }\n"
" if ((fur_fragCoord.y-uLineWidth)>valmax*uResolution.y*0.5) discard;\n"
" if ((fur_fragCoord.y+uLineWidth)<valmin*uResolution.y*0.5) discard;\n"
" float slope=abs(valmax-valmin)*uResolution.y*0.5;\n" " float slope=abs(valmax-valmin)*uResolution.y*0.5;\n"
" float slopeDiv=min(uAdvance,(uAdvance/slope));\n" " float slopeDiv=min(uAdvance,(uAdvance/slope));\n"
" float xRight=uv.x+((uLineWidth)/uResolution.x);\n" " float xRight=uv.x+((uLineWidth)/uResolution.x);\n"