Move frame_count to g_runloop

This commit is contained in:
twinaphex 2015-03-07 13:14:04 +01:00
parent 795ef467ac
commit d11006e041
22 changed files with 47 additions and 39 deletions

View File

@ -307,7 +307,7 @@ void init_drivers(int flags)
if (flags & DRIVER_VIDEO)
{
g_extern.frame_count = 0;
g_runloop.frames.video.count = 0;
init_video();

View File

@ -454,6 +454,15 @@ struct runloop
} db;
#endif
struct
{
struct
{
unsigned count;
unsigned max;
} video;
} frames;
nbio_handle_t nbio;
msg_queue_t *msg_queue;
};
@ -711,8 +720,6 @@ struct global
size_t pitch;
} frame_cache;
unsigned frame_count;
unsigned max_frames;
char title_buf[64];

View File

@ -406,7 +406,7 @@ static bool d3d_alive(void *data)
if (d3d->ctx_driver && d3d->ctx_driver->check_window)
d3d->ctx_driver->check_window(d3d, &quit, &resize,
&d3d->screen_width, &d3d->screen_height, g_extern.frame_count);
&d3d->screen_width, &d3d->screen_height, g_runloop.frames.video.count);
if (quit)
d3d->quitting = quit;

View File

@ -138,7 +138,7 @@ static void renderchain_render_pass(void *data, const void *frame, unsigned widt
d3d_draw_primitive(d3dr, D3DPT_TRIANGLESTRIP, 0, 2);
g_extern.frame_count++;
g_runloop.frames.video.count++;
renderchain_set_mvp(d3d, d3d->screen_width, d3d->screen_height, d3d->dev_rotation);
}
@ -222,7 +222,7 @@ static void renderchain_set_vertices(void *data, unsigned pass, unsigned width,
d3d->shader->use(d3d, pass);
if (d3d->shader->set_params)
d3d->shader->set_params(d3d, width, height, d3d->tex_w, d3d->tex_h, d3d->screen_width,
d3d->screen_height, g_extern.frame_count,
d3d->screen_height, g_runloop.frames.video.count,
NULL, NULL, NULL, 0);
}
#endif

View File

@ -1461,7 +1461,7 @@ static bool exynos_gfx_frame(void *data, const void *frame, unsigned width,
if (exynos_flip(vid->data, page) != 0)
goto fail;
g_extern.frame_count++;
g_runloop.frames.video.count++;
return true;

View File

@ -996,7 +996,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, g_extern.frame_count,
gl->vp.width, gl->vp.height, g_runloop.frames.video.count,
tex_info, gl->prev_info, fbo_tex_info, fbo_tex_info_cnt);
gl->coords.vertices = 4;
@ -1043,7 +1043,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, g_extern.frame_count,
gl->vp.width, gl->vp.height, g_runloop.frames.video.count,
tex_info, gl->prev_info, fbo_tex_info, fbo_tex_info_cnt);
gl->coords.vertex = gl->vertex_ptr;
@ -1569,7 +1569,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,
g_extern.frame_count,
g_runloop.frames.video.count,
&gl->tex_info, gl->prev_info, NULL, 0);
gl->coords.vertices = 4;
@ -1649,7 +1649,6 @@ static bool gl_frame(void *data, const void *frame,
}
gl->ctx_driver->swap_buffers(gl);
g_extern.frame_count++;
#ifdef HAVE_GL_SYNC
if (g_settings.video.hard_sync && gl->have_sync)
@ -1682,6 +1681,8 @@ static bool gl_frame(void *data, const void *frame,
context_bind_hw_render(gl, true);
g_runloop.frames.video.count++;
return true;
}
@ -2435,7 +2436,7 @@ static bool gl_alive(void *data)
gl->ctx_driver->check_window(gl, &quit,
&resize, &gl->win_width, &gl->win_height,
g_extern.frame_count);
g_runloop.frames.video.count);
if (quit)
gl->quitting = true;

View File

@ -1149,7 +1149,7 @@ static bool gx_frame(void *data, const void *frame,
VISetNextFrameBuffer(g_framebuf[g_current_framebuf]);
VIFlush();
g_extern.frame_count++;
g_runloop.frames.video.count++;
RARCH_PERFORMANCE_STOP(gx_frame);

View File

@ -1000,7 +1000,7 @@ static bool omap_gfx_frame(void *data, const void *frame, unsigned width,
if (msg)
omap_render_msg(vid, msg);
g_extern.frame_count++;
g_runloop.frames.video.count++;
return true;
}

View File

@ -527,7 +527,7 @@ static bool psp_frame(void *data, const void *frame,
#endif
psp->draw_buffer = FROM_GU_POINTER(sceGuSwapBuffers());
g_extern.frame_count++;
g_runloop.frames.video.count++;
RARCH_PERFORMANCE_INIT(psp_frame_run);

View File

@ -517,7 +517,7 @@ static bool sdl2_gfx_frame(void *data, const void *frame, unsigned width,
if (video_monitor_get_fps(buf, sizeof(buf), NULL, 0))
SDL_SetWindowTitle(vid->window, buf);
g_extern.frame_count++;
g_runloop.frames.video.count++;
return true;
}

View File

@ -376,7 +376,7 @@ static bool sdl_gfx_frame(void *data, const void *frame, unsigned width,
SDL_WM_SetCaption(buf, NULL);
SDL_Flip(vid->screen);
g_extern.frame_count++;
g_runloop.frames.video.count++;
return true;
}

View File

@ -409,7 +409,7 @@ static bool vg_alive(void *data)
vg->driver->check_window(vg, &quit,
&vg->should_resize, &vg->mScreenWidth, &vg->mScreenHeight,
g_extern.frame_count);
g_runloop.frames.video.count);
return !quit;
}

View File

@ -775,7 +775,7 @@ static bool xv_frame(void *data, const void *frame, unsigned width,
if (video_monitor_get_fps(buf, sizeof(buf), NULL, 0))
XStoreName(xv->display, xv->window, buf);
g_extern.frame_count++;
g_runloop.frames.video.count++;
return true;
}

View File

@ -149,7 +149,7 @@ static void gfx_ctx_d3d_update_title(void *data)
}
#ifndef _XBOX
g_extern.frame_count++;
g_runloop.frames.video.count++;
#endif
}

View File

@ -180,7 +180,7 @@ bool video_monitor_get_fps(char *buf, size_t size,
new_time = rarch_get_time_usec();
if (g_extern.frame_count)
if (g_runloop.frames.video.count)
{
bool ret = false;
unsigned write_index =
@ -190,19 +190,19 @@ bool video_monitor_get_fps(char *buf, size_t size,
new_time - fps_time;
fps_time = new_time;
if ((g_extern.frame_count % FPS_UPDATE_INTERVAL) == 0)
if ((g_runloop.frames.video.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",
g_extern.title_buf, last_fps, g_extern.frame_count);
g_extern.title_buf, last_fps, g_runloop.frames.video.count);
ret = true;
}
if (buf_fps)
snprintf(buf_fps, size_fps, "FPS: %6.1f || Frames: %u",
last_fps, g_extern.frame_count);
last_fps, g_runloop.frames.video.count);
return ret;
}

View File

@ -335,7 +335,7 @@ static void glui_frame(void)
get_title(label, dir, menu_type, title, sizeof(title));
menu_animation_ticker_line(title_buf, glui->term_width - 3,
g_extern.frame_count / glui->margin, title, true);
g_runloop.frames.video.count / glui->margin, title, true);
glui_blit_line(gl, glui->margin * 2, glui->margin + glui->line_height,
title_buf, true);
@ -402,9 +402,9 @@ static void glui_frame(void)
selected = (i == menu->navigation.selection_ptr);
menu_animation_ticker_line(entry_title_buf, glui->term_width - (w + 1 + 2),
g_extern.frame_count / glui->margin, path_buf, selected);
g_runloop.frames.video.count / glui->margin, path_buf, selected);
menu_animation_ticker_line(type_str_buf, w,
g_extern.frame_count / glui->margin, type_str, selected);
g_runloop.frames.video.count / glui->margin, type_str, selected);
strlcpy(message, entry_title_buf, sizeof(message));

View File

@ -354,7 +354,7 @@ static void rgui_render(void)
get_title(label, dir, menu_type, title, sizeof(title));
menu_animation_ticker_line(title_buf, RGUI_TERM_WIDTH - 3,
g_extern.frame_count / RGUI_TERM_START_X, title, true);
g_runloop.frames.video.count / RGUI_TERM_START_X, title, true);
blit_line(menu, RGUI_TERM_START_X + RGUI_TERM_START_X, RGUI_TERM_START_X, title_buf, true);
core_name = g_extern.menu.info.library_name;
@ -424,8 +424,8 @@ static void rgui_render(void)
continue;
menu_animation_ticker_line(entry_title_buf, RGUI_TERM_WIDTH - (w + 1 + 2),
g_extern.frame_count / RGUI_TERM_START_X, path_buf, selected);
menu_animation_ticker_line(type_str_buf, w, g_extern.frame_count / RGUI_TERM_START_X,
g_runloop.frames.video.count / RGUI_TERM_START_X, path_buf, selected);
menu_animation_ticker_line(type_str_buf, w, g_runloop.frames.video.count / RGUI_TERM_START_X,
type_str, selected);
snprintf(message, sizeof(message), "%c %-*.*s %-*s",

View File

@ -191,7 +191,7 @@ static void rmenu_render(void)
get_title(label, dir, menu_type, title, sizeof(title));
menu_animation_ticker_line(title_buf, RMENU_TERM_WIDTH,
g_extern.frame_count / 15, title, true);
g_runloop.frames.video.count / 15, title, true);
font_parms.x = POSITION_EDGE_MIN + POSITION_OFFSET;
font_parms.y = POSITION_EDGE_MIN + POSITION_RENDER_OFFSET
@ -258,8 +258,8 @@ static void rmenu_render(void)
selected = (i == menu->navigation.selection_ptr);
menu_animation_ticker_line(entry_title_buf, RMENU_TERM_WIDTH - (w + 1 + 2),
g_extern.frame_count / 15, path, selected);
menu_animation_ticker_line(type_str_buf, w, g_extern.frame_count / 15,
g_runloop.frames.video.count / 15, path, selected);
menu_animation_ticker_line(type_str_buf, w, g_runloop.frames.video.count / 15,
type_str, selected);
snprintf(message, sizeof(message), "%c %s",

View File

@ -569,7 +569,7 @@ static void rmenu_xui_render(void)
get_title(label, dir, menu_type, title, sizeof(title));
mbstowcs(strw_buffer, title, sizeof(strw_buffer) / sizeof(wchar_t));
XuiTextElementSetText(m_menutitle, strw_buffer);
menu_animation_ticker_line(title, RXUI_TERM_WIDTH - 3, g_extern.frame_count / 15, title, true);
menu_animation_ticker_line(title, RXUI_TERM_WIDTH - 3, g_runloop.frames.video.count / 15, title, true);
}
if (XuiHandleIsValid(m_menutitle))

View File

@ -1060,7 +1060,7 @@ static void xmb_draw_items(xmb_handle_t *xmb, gl_t *gl,
xmb_draw_icon(gl, xmb, icon, icon_x, icon_y, node->alpha, 0, node->zoom);
menu_animation_ticker_line(name, 35, g_extern.frame_count / 20, path_buf,
menu_animation_ticker_line(name, 35, g_runloop.frames.video.count / 20, path_buf,
(i == current));
xmb_draw_text(gl, xmb, name,
@ -1068,7 +1068,7 @@ static void xmb_draw_items(xmb_handle_t *xmb, gl_t *gl,
xmb->margins.screen.top + node->y + xmb->margins.label.top,
1, node->label_alpha, 0);
menu_animation_ticker_line(value, 35, g_extern.frame_count / 20, type_str,
menu_animation_ticker_line(value, 35, g_runloop.frames.video.count / 20, type_str,
(i == current));
if(( strcmp(type_str, "...")

View File

@ -652,7 +652,7 @@ static void parse_input(int argc, char *argv[])
break;
case 'm':
g_extern.max_frames = strtoul(optarg, NULL, 10);
g_runloop.frames.video.max = strtoul(optarg, NULL, 10);
break;
case 0:

View File

@ -647,8 +647,8 @@ static inline int time_to_exit(retro_input_t input)
if (
g_extern.system.shutdown
|| check_quit_key_func(input)
|| (g_extern.max_frames && g_extern.frame_count >=
g_extern.max_frames)
|| (g_runloop.frames.video.max &&
g_runloop.frames.video.count >= g_runloop.frames.video.max)
|| (g_extern.bsv.movie_end && g_extern.bsv.eof_exit)
|| !video_driver_is_alive()
)