mirror of
https://github.com/libretro/RetroArch
synced 2025-01-30 03:32:46 +00:00
Start using video_driver_get_frame_count
This commit is contained in:
parent
5aeb906065
commit
9b9e65abf3
1
driver.c
1
driver.c
@ -390,7 +390,6 @@ void init_drivers(int flags)
|
||||
|
||||
if (flags & DRIVER_VIDEO)
|
||||
{
|
||||
runloop->frames.video.count = 0;
|
||||
runloop->measure_data.frame_time_samples_count = 0;
|
||||
|
||||
init_video();
|
||||
|
@ -972,6 +972,7 @@ static void gl_frame_fbo(gl_t *gl,
|
||||
GLfloat fbo_tex_coords[8] = {0.0f};
|
||||
runloop_t *runloop = rarch_main_get_ptr();
|
||||
global_t *global = global_get_ptr();
|
||||
uint64_t frame_count = video_driver_get_frame_count();
|
||||
|
||||
/* Render the rest of our passes. */
|
||||
gl->coords.tex_coord = fbo_tex_coords;
|
||||
@ -1011,7 +1012,7 @@ static void gl_frame_fbo(gl_t *gl,
|
||||
gl_set_viewport(gl, rect->img_width, rect->img_height, true, false);
|
||||
gl->shader->set_params(gl, prev_rect->img_width, prev_rect->img_height,
|
||||
prev_rect->width, prev_rect->height,
|
||||
gl->vp.width, gl->vp.height, runloop->frames.video.count,
|
||||
gl->vp.width, gl->vp.height, frame_count,
|
||||
tex_info, gl->prev_info, fbo_tex_info, fbo_tex_info_cnt);
|
||||
|
||||
gl->coords.vertices = 4;
|
||||
@ -1058,7 +1059,7 @@ static void gl_frame_fbo(gl_t *gl,
|
||||
gl->shader->set_params(gl,
|
||||
prev_rect->img_width, prev_rect->img_height,
|
||||
prev_rect->width, prev_rect->height,
|
||||
gl->vp.width, gl->vp.height, runloop->frames.video.count,
|
||||
gl->vp.width, gl->vp.height, frame_count,
|
||||
tex_info, gl->prev_info, fbo_tex_info, fbo_tex_info_cnt);
|
||||
|
||||
gl->coords.vertex = gl->vertex_ptr;
|
||||
@ -1489,6 +1490,7 @@ static bool gl_frame(void *data, const void *frame,
|
||||
driver_t *driver = driver_get_ptr();
|
||||
settings_t *settings = config_get_ptr();
|
||||
global_t *global = global_get_ptr();
|
||||
uint64_t frame_count = video_driver_get_frame_count();
|
||||
const struct font_renderer *font_driver = driver ? driver->font_osd_driver : NULL;
|
||||
|
||||
RARCH_PERFORMANCE_INIT(frame_run);
|
||||
@ -1597,7 +1599,7 @@ static bool gl_frame(void *data, const void *frame,
|
||||
gl->shader->set_params(gl, width, height,
|
||||
gl->tex_w, gl->tex_h,
|
||||
gl->vp.width, gl->vp.height,
|
||||
runloop->frames.video.count,
|
||||
frame_count,
|
||||
&gl->tex_info, gl->prev_info, NULL, 0);
|
||||
|
||||
gl->coords.vertices = 4;
|
||||
|
@ -237,8 +237,7 @@ bool gfx_ctx_check_window(void *data, bool *quit, bool *resize,
|
||||
{
|
||||
runloop_t *runloop = rarch_main_get_ptr();
|
||||
const gfx_ctx_driver_t *ctx = gfx_ctx_get_ptr();
|
||||
unsigned frame_count = runloop ?
|
||||
runloop->frames.video.count : 0;
|
||||
uint64_t frame_count = video_driver_get_frame_count();
|
||||
|
||||
if (!data)
|
||||
return false;
|
||||
|
@ -186,14 +186,15 @@ bool video_monitor_get_fps(char *buf, size_t size,
|
||||
retro_time_t new_time;
|
||||
static retro_time_t curr_time;
|
||||
static retro_time_t fps_time;
|
||||
runloop_t *runloop = rarch_main_get_ptr();
|
||||
global_t *global = global_get_ptr();
|
||||
uint64_t frame_count = video_driver_get_frame_count();
|
||||
runloop_t *runloop = rarch_main_get_ptr();
|
||||
global_t *global = global_get_ptr();
|
||||
|
||||
*buf = '\0';
|
||||
|
||||
new_time = rarch_get_time_usec();
|
||||
|
||||
if (runloop->frames.video.count)
|
||||
if (frame_count)
|
||||
{
|
||||
bool ret = false;
|
||||
unsigned write_index =
|
||||
@ -203,19 +204,19 @@ bool video_monitor_get_fps(char *buf, size_t size,
|
||||
new_time - fps_time;
|
||||
fps_time = new_time;
|
||||
|
||||
if ((runloop->frames.video.count % FPS_UPDATE_INTERVAL) == 0)
|
||||
if ((frame_count % FPS_UPDATE_INTERVAL) == 0)
|
||||
{
|
||||
last_fps = TIME_TO_FPS(curr_time, new_time, FPS_UPDATE_INTERVAL);
|
||||
curr_time = new_time;
|
||||
|
||||
snprintf(buf, size, "%s || FPS: %6.1f || Frames: %u",
|
||||
global->title_buf, last_fps, runloop->frames.video.count);
|
||||
snprintf(buf, size, "%s || FPS: %6.1f || Frames: %lu",
|
||||
global->title_buf, last_fps, frame_count);
|
||||
ret = true;
|
||||
}
|
||||
|
||||
if (buf_fps)
|
||||
snprintf(buf_fps, size_fps, "FPS: %6.1f || Frames: %u",
|
||||
last_fps, runloop->frames.video.count);
|
||||
snprintf(buf_fps, size_fps, "FPS: %6.1f || Frames: %lu",
|
||||
last_fps, frame_count);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -165,8 +165,6 @@ static void video_frame(const void *data, unsigned width,
|
||||
|
||||
if (!video_driver_frame(data, width, height, pitch, msg))
|
||||
driver->video_active = false;
|
||||
|
||||
runloop->frames.video.count++;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -294,7 +294,8 @@ static void glui_render_menu_list(runloop_t *runloop,
|
||||
uint32_t hover_color)
|
||||
{
|
||||
size_t i = 0;
|
||||
global_t *global = global_get_ptr();
|
||||
uint64_t frame_count = video_driver_get_frame_count();
|
||||
global_t *global = global_get_ptr();
|
||||
|
||||
if (!menu_display_update_pending())
|
||||
return;
|
||||
@ -313,9 +314,9 @@ static void glui_render_menu_list(runloop_t *runloop,
|
||||
selected = menu_list_entry_is_currently_selected(&entry);
|
||||
|
||||
menu_animation_ticker_line(entry_title_buf, glui->ticker_limit,
|
||||
runloop->frames.video.count / 100, entry.path, selected);
|
||||
frame_count / 100, entry.path, selected);
|
||||
menu_animation_ticker_line(type_str_buf, glui->ticker_limit,
|
||||
runloop->frames.video.count / 100, entry.value, selected);
|
||||
frame_count / 100, entry.value, selected);
|
||||
|
||||
strlcpy(message, entry_title_buf, sizeof(message));
|
||||
|
||||
@ -340,6 +341,7 @@ static void glui_frame(void)
|
||||
glui_handle_t *glui = NULL;
|
||||
const char *core_name = NULL;
|
||||
const char *core_version = NULL;
|
||||
const struct font_renderer *font_driver = NULL;
|
||||
driver_t *driver = driver_get_ptr();
|
||||
menu_handle_t *menu = menu_driver_get_ptr();
|
||||
settings_t *settings = config_get_ptr();
|
||||
@ -351,7 +353,7 @@ static void glui_frame(void)
|
||||
settings->menu.title_color);
|
||||
runloop_t *runloop = rarch_main_get_ptr();
|
||||
global_t *global = global_get_ptr();
|
||||
const struct font_renderer *font_driver = NULL;
|
||||
uint64_t frame_count = video_driver_get_frame_count();
|
||||
|
||||
if (!menu || !menu->userdata)
|
||||
return;
|
||||
@ -399,7 +401,7 @@ static void glui_frame(void)
|
||||
menu->header_height, 0.2, 0.2, 0.2, 1);
|
||||
|
||||
menu_animation_ticker_line(title_buf, glui->ticker_limit,
|
||||
runloop->frames.video.count / 100, title, true);
|
||||
frame_count / 100, title, true);
|
||||
glui_blit_line(global->video_data.width / 2, 0, title_buf,
|
||||
title_color, TEXT_ALIGN_CENTER);
|
||||
|
||||
|
@ -366,6 +366,7 @@ static void rgui_render(void)
|
||||
driver_t *driver = driver_get_ptr();
|
||||
global_t *global = global_get_ptr();
|
||||
settings_t *settings = config_get_ptr();
|
||||
uint64_t frame_count = video_driver_get_frame_count();
|
||||
|
||||
(void)driver;
|
||||
|
||||
@ -437,7 +438,7 @@ static void rgui_render(void)
|
||||
get_title(label, dir, menu_type, title, sizeof(title));
|
||||
|
||||
menu_animation_ticker_line(title_buf, RGUI_TERM_WIDTH - 10,
|
||||
runloop->frames.video.count / RGUI_TERM_START_X, title, true);
|
||||
frame_count / RGUI_TERM_START_X, title, true);
|
||||
|
||||
hover_color = HOVER_COLOR(settings);
|
||||
normal_color = NORMAL_COLOR(settings);
|
||||
@ -500,9 +501,9 @@ static void rgui_render(void)
|
||||
continue;
|
||||
|
||||
menu_animation_ticker_line(entry_title_buf, RGUI_TERM_WIDTH - (entry.spacing + 1 + 2),
|
||||
runloop->frames.video.count / RGUI_TERM_START_X, entry.path, selected);
|
||||
frame_count / RGUI_TERM_START_X, entry.path, selected);
|
||||
menu_animation_ticker_line(type_str_buf, entry.spacing,
|
||||
runloop->frames.video.count / RGUI_TERM_START_X,
|
||||
frame_count / RGUI_TERM_START_X,
|
||||
entry.value, selected);
|
||||
|
||||
snprintf(message, sizeof(message), "%c %-*.*s %-*s",
|
||||
|
@ -978,6 +978,7 @@ static void xmb_draw_items(xmb_handle_t *xmb, gl_t *gl,
|
||||
xmb_node_t *core_node = NULL;
|
||||
size_t end = 0;
|
||||
global_t *global = global_get_ptr();
|
||||
uint64_t frame_count = video_driver_get_frame_count();
|
||||
|
||||
if (!list || !list->size)
|
||||
return;
|
||||
@ -1050,7 +1051,7 @@ static void xmb_draw_items(xmb_handle_t *xmb, gl_t *gl,
|
||||
|
||||
|
||||
menu_animation_ticker_line(name, 35,
|
||||
runloop->frames.video.count / 20, entry.path,
|
||||
frame_count / 20, entry.path,
|
||||
(i == current));
|
||||
|
||||
xmb_draw_text(menu, xmb, name,
|
||||
@ -1060,7 +1061,7 @@ static void xmb_draw_items(xmb_handle_t *xmb, gl_t *gl,
|
||||
1, node->label_alpha, TEXT_ALIGN_LEFT);
|
||||
|
||||
menu_animation_ticker_line(value, 35,
|
||||
runloop->frames.video.count / 20, entry.value,
|
||||
frame_count / 20, entry.value,
|
||||
(i == current));
|
||||
|
||||
if(( strcmp(entry.value, "...")
|
||||
|
@ -618,8 +618,9 @@ static INLINE int time_to_exit(event_cmd_state_t *cmd)
|
||||
bool shutdown_pressed = global->system.shutdown;
|
||||
bool video_alive = video_driver_is_alive();
|
||||
bool movie_end = (global->bsv.movie_end && global->bsv.eof_exit);
|
||||
uint64_t frame_count = video_driver_get_frame_count();
|
||||
bool frame_count_end = (runloop->frames.video.max &&
|
||||
runloop->frames.video.count >= runloop->frames.video.max);
|
||||
frame_count >= runloop->frames.video.max);
|
||||
|
||||
if (shutdown_pressed || cmd->quit_key_pressed || frame_count_end || movie_end
|
||||
|| !video_alive)
|
||||
|
Loading…
x
Reference in New Issue
Block a user