Skip to content

Commit de37b4d

Browse files
committed
disp/vulkan_sdl3: Use generic FPS counter
port of 5df5014 from vulkan_sdl2
1 parent 1cf11e0 commit de37b4d

1 file changed

Lines changed: 3 additions & 19 deletions

File tree

src/video_display/vulkan/vulkan_sdl3.cpp

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -178,9 +178,6 @@ struct state_vulkan_sdl3 {
178178

179179
Uint32 sdl_user_new_message_event;
180180

181-
chrono::steady_clock::time_point time{};
182-
uint64_t frames = 0;
183-
184181
bool deinterlace = false;
185182
bool fullscreen = false;
186183
bool keep_aspect = false;
@@ -429,7 +426,6 @@ void display_vulkan_run(void* state) {
429426
auto* s = static_cast<state_vulkan_sdl3*>(state);
430427
assert(s->magic == magic_vulkan_sdl3);
431428

432-
s->time = chrono::steady_clock::now();
433429
while (!s->should_exit) {
434430
process_events(*s);
435431
if(s->show_cursor == state_vulkan_sdl3::SC_AUTOHIDE
@@ -440,21 +436,9 @@ void display_vulkan_run(void* state) {
440436
s->cursor_is_shown = false;
441437
}
442438
try {
443-
bool displayed = s->vulkan->display_queued_image();
444-
if (displayed) {
445-
s->frames++;
446-
}
447-
}
448-
catch (std::exception& e) { log_and_exit_uv(e); break; }
449-
auto now = chrono::steady_clock::now();
450-
double seconds = chrono::duration<double>{ now - s->time }.count();
451-
if (seconds > 5) {
452-
display_print_fps(MOD_NAME, seconds, (int) s->frames,
453-
s->current_desc.fps);
454-
455-
s->time = now;
456-
s->frames = 0;
439+
s->vulkan->display_queued_image();
457440
}
441+
catch (std::exception& e) { log_and_exit_uv(e); break; }
458442
}
459443
SDL_CHECK(SDL_HideWindow(s->window));
460444

@@ -1106,7 +1090,7 @@ const video_display_info display_vulkan_info = {
11061090
display_vulkan_get_property,
11071091
display_vulkan_put_audio_frame,
11081092
display_vulkan_reconfigure_audio,
1109-
DISPLAY_NO_GENERIC_FPS_INDICATOR,
1093+
MOD_NAME,
11101094
};
11111095

11121096
} // namespace

0 commit comments

Comments
 (0)