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("render: %.0fµs",(double)renderTimeDelta/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("event: %.0fµs",(double)eventTimeDelta/perfFreq);
ImGui::Separator();

View file

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

View file

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

View file

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

View file

@ -114,6 +114,8 @@ const char* sh_oscRender_srcF=
" if (val>valmax) valmax=val;\n"
" if (val<valmin) valmin=val;\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 slopeDiv=min(uAdvance,(uAdvance/slope));\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<valmin) valmin=val;\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 slopeDiv=min(uAdvance,(uAdvance/slope));\n"
" float xRight=uv.x+((uLineWidth)/uResolution.x);\n"