Reduce calls to video_driver_get_ptr - set it once for

video_frame_info_t
This commit is contained in:
twinaphex 2018-02-16 17:19:55 +01:00
parent 1e2d8de9ca
commit 964e9db588
18 changed files with 161 additions and 109 deletions

View File

@ -2708,6 +2708,7 @@ void video_driver_build_info(video_frame_info_t *video_info)
video_info->cb_shader_use = video_driver_cb_shader_use; video_info->cb_shader_use = video_driver_cb_shader_use;
video_info->cb_set_mvp = video_driver_cb_shader_set_mvp; video_info->cb_set_mvp = video_driver_cb_shader_set_mvp;
video_info->userdata = video_driver_get_ptr(false);
#if 0 #if 0
video_info->cb_set_coords = video_driver_cb_set_coords; video_info->cb_set_coords = video_driver_cb_set_coords;
#endif #endif

View File

@ -476,6 +476,7 @@ typedef struct video_frame_info
void *context_data; void *context_data;
void *shader_data; void *shader_data;
void *userdata;
} video_frame_info_t; } video_frame_info_t;
typedef void (*update_window_title_cb)(void*, void*); typedef void (*update_window_title_cb)(void*, void*);

View File

@ -321,6 +321,7 @@ static void mui_context_reset_textures(mui_handle_t *mui)
} }
static void mui_draw_icon( static void mui_draw_icon(
video_frame_info_t *video_info,
unsigned icon_size, unsigned icon_size,
uintptr_t texture, uintptr_t texture,
float x, float y, float x, float y,
@ -333,7 +334,7 @@ static void mui_draw_icon(
struct video_coords coords; struct video_coords coords;
math_matrix_4x4 mymat; math_matrix_4x4 mymat;
menu_display_blend_begin(); menu_display_blend_begin(video_info);
rotate_draw.matrix = &mymat; rotate_draw.matrix = &mymat;
rotate_draw.rotation = rotation; rotate_draw.rotation = rotation;
@ -361,11 +362,13 @@ static void mui_draw_icon(
draw.pipeline.id = 0; draw.pipeline.id = 0;
menu_display_draw(&draw); menu_display_draw(&draw);
menu_display_blend_end(); menu_display_blend_end(video_info);
} }
/* Draw a single tab */ /* Draw a single tab */
static void mui_draw_tab(mui_handle_t *mui, static void mui_draw_tab(
mui_handle_t *mui,
video_frame_info_t *video_info,
unsigned i, unsigned i,
unsigned width, unsigned height, unsigned width, unsigned height,
float *tab_color, float *tab_color,
@ -392,7 +395,7 @@ static void mui_draw_tab(mui_handle_t *mui,
break; break;
} }
mui_draw_icon( mui_draw_icon(video_info,
mui->icon_size, mui->icon_size,
mui->textures.list[tab_icon], mui->textures.list[tab_icon],
width / (MUI_SYSTEM_TAB_END+1) * (i+0.5) - mui->icon_size/2, width / (MUI_SYSTEM_TAB_END+1) * (i+0.5) - mui->icon_size/2,
@ -427,7 +430,10 @@ static void mui_render_keyboard(mui_handle_t *mui,
1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00,
}; };
menu_display_draw_quad(0, height/2.0, width, height/2.0, menu_display_draw_quad(
video_info,
0,
height/2.0, width, height/2.0,
width, height, width, height,
&dark[0]); &dark[0]);
@ -445,7 +451,7 @@ static void mui_render_keyboard(mui_handle_t *mui,
if (i == id) if (i == id)
texture = mui->textures.list[MUI_TEXTURE_KEY_HOVER]; texture = mui->textures.list[MUI_TEXTURE_KEY_HOVER];
menu_display_blend_begin(); menu_display_blend_begin(video_info);
menu_display_draw_texture( menu_display_draw_texture(
width/2.0 - (11*ptr_width)/2.0 + (i % 11) * ptr_width, width/2.0 - (11*ptr_width)/2.0 + (i % 11) * ptr_width,
@ -495,7 +501,9 @@ static int mui_osk_ptr_at_pos(void *data, int x, int y,
} }
/* Draw the tabs background */ /* Draw the tabs background */
static void mui_draw_tab_begin(mui_handle_t *mui, static void mui_draw_tab_begin(
mui_handle_t *mui,
video_frame_info_t *video_info,
unsigned width, unsigned height, unsigned width, unsigned height,
float *tabs_bg_color, float *tabs_separator_color) float *tabs_bg_color, float *tabs_separator_color)
{ {
@ -504,13 +512,17 @@ static void mui_draw_tab_begin(mui_handle_t *mui,
mui->tabs_height = scale_factor / 3; mui->tabs_height = scale_factor / 3;
/* tabs background */ /* tabs background */
menu_display_draw_quad(0, height - mui->tabs_height, width, menu_display_draw_quad(
video_info,
0, height - mui->tabs_height, width,
mui->tabs_height, mui->tabs_height,
width, height, width, height,
tabs_bg_color); tabs_bg_color);
/* tabs separator */ /* tabs separator */
menu_display_draw_quad(0, height - mui->tabs_height, width, menu_display_draw_quad(
video_info,
0, height - mui->tabs_height, width,
1, 1,
width, height, width, height,
tabs_separator_color); tabs_separator_color);
@ -518,6 +530,7 @@ static void mui_draw_tab_begin(mui_handle_t *mui,
/* Draw the active tab */ /* Draw the active tab */
static void mui_draw_tab_end(mui_handle_t *mui, static void mui_draw_tab_end(mui_handle_t *mui,
video_frame_info_t *video_info,
unsigned width, unsigned height, unsigned width, unsigned height,
unsigned header_height, unsigned header_height,
float *active_tab_marker_color) float *active_tab_marker_color)
@ -526,6 +539,7 @@ static void mui_draw_tab_end(mui_handle_t *mui,
unsigned tab_width = width / (MUI_SYSTEM_TAB_END+1); unsigned tab_width = width / (MUI_SYSTEM_TAB_END+1);
menu_display_draw_quad( menu_display_draw_quad(
video_info,
(int)(mui->categories_selection_ptr * tab_width), (int)(mui->categories_selection_ptr * tab_width),
height - (header_height/16), height - (header_height/16),
tab_width, tab_width,
@ -536,6 +550,7 @@ static void mui_draw_tab_end(mui_handle_t *mui,
/* Draw the scrollbar */ /* Draw the scrollbar */
static void mui_draw_scrollbar(mui_handle_t *mui, static void mui_draw_scrollbar(mui_handle_t *mui,
video_frame_info_t *video_info,
unsigned width, unsigned height, float *coord_color) unsigned width, unsigned height, float *coord_color)
{ {
unsigned header_height = menu_display_get_header_height(); unsigned header_height = menu_display_get_header_height();
@ -556,6 +571,7 @@ static void mui_draw_scrollbar(mui_handle_t *mui,
scrollbar_height = mui->scrollbar_width; scrollbar_height = mui->scrollbar_width;
menu_display_draw_quad( menu_display_draw_quad(
video_info,
width - mui->scrollbar_width - scrollbar_margin, width - mui->scrollbar_width - scrollbar_margin,
header_height + y, header_height + y,
mui->scrollbar_width, mui->scrollbar_width,
@ -621,6 +637,7 @@ static void mui_render_messagebox(mui_handle_t *mui,
menu_display_set_alpha(body_bg_color, 1.0); menu_display_set_alpha(body_bg_color, 1.0);
menu_display_draw_quad( menu_display_draw_quad(
video_info,
x - longest_width / 2.0 - mui->margin * 2.0, x - longest_width / 2.0 - mui->margin * 2.0,
y - line_height / 2.0 - mui->margin * 2.0, y - line_height / 2.0 - mui->margin * 2.0,
longest_width + mui->margin * 4.0, longest_width + mui->margin * 4.0,
@ -810,7 +827,10 @@ static void mui_render(void *data, bool is_idle)
} }
/* Display an entry value on the right of the screen. */ /* Display an entry value on the right of the screen. */
static void mui_render_label_value(mui_handle_t *mui, mui_node_t *node, static void mui_render_label_value(
mui_handle_t *mui,
video_frame_info_t *video_info,
mui_node_t *node,
int i, int y, unsigned width, unsigned height, int i, int y, unsigned width, unsigned height,
uint64_t index, uint32_t color, bool selected, const char *label, uint64_t index, uint32_t color, bool selected, const char *label,
const char *value, float *label_color, const char *value, float *label_color,
@ -961,7 +981,7 @@ static void mui_render_label_value(mui_handle_t *mui, mui_node_t *node,
width, height, color, TEXT_ALIGN_RIGHT, 1.0f, false, 0); width, height, color, TEXT_ALIGN_RIGHT, 1.0f, false, 0);
if (texture_switch2) if (texture_switch2)
mui_draw_icon( mui_draw_icon(video_info,
mui->icon_size, mui->icon_size,
(uintptr_t)texture_switch2, (uintptr_t)texture_switch2,
0, 0,
@ -974,7 +994,7 @@ static void mui_render_label_value(mui_handle_t *mui, mui_node_t *node,
); );
if (texture_switch) if (texture_switch)
mui_draw_icon( mui_draw_icon(video_info,
mui->icon_size, mui->icon_size,
(uintptr_t)texture_switch, (uintptr_t)texture_switch,
width - mui->margin - mui->icon_size, width - mui->margin - mui->icon_size,
@ -1046,6 +1066,7 @@ static void mui_render_menu_list(
mui_render_label_value( mui_render_label_value(
mui, mui,
video_info,
node, node,
(int)i, (int)i,
y, y,
@ -1119,7 +1140,7 @@ static void mui_draw_bg(menu_display_ctx_draw_t *draw,
bool add_opacity = false; bool add_opacity = false;
float opacity_override = video_info->menu_wallpaper_opacity; float opacity_override = video_info->menu_wallpaper_opacity;
menu_display_blend_begin(); menu_display_blend_begin(video_info);
draw->x = 0; draw->x = 0;
draw->y = 0; draw->y = 0;
@ -1135,7 +1156,7 @@ static void mui_draw_bg(menu_display_ctx_draw_t *draw,
menu_display_draw_bg(draw, video_info, add_opacity, menu_display_draw_bg(draw, video_info, add_opacity,
opacity_override); opacity_override);
menu_display_draw(draw); menu_display_draw(draw);
menu_display_blend_end(); menu_display_blend_end(video_info);
} }
/* Main function of the menu driver. Takes care of drawing the header, the tabs, /* Main function of the menu driver. Takes care of drawing the header, the tabs,
@ -1488,6 +1509,7 @@ static void mui_frame(void *data, video_frame_info_t *video_info)
if (node) if (node)
menu_display_draw_quad( menu_display_draw_quad(
video_info,
0, 0,
header_height - mui->scroll_y + node->y, header_height - mui->scroll_y + node->y,
width, width,
@ -1524,6 +1546,7 @@ static void mui_frame(void *data, video_frame_info_t *video_info)
/* header */ /* header */
menu_display_draw_quad( menu_display_draw_quad(
video_info,
0, 0,
0, 0,
width, width,
@ -1537,15 +1560,22 @@ static void mui_frame(void *data, video_frame_info_t *video_info)
/* display tabs if depth equal one, if not hide them */ /* display tabs if depth equal one, if not hide them */
if (mui_list_get_size(mui, MENU_LIST_PLAIN) == 1) if (mui_list_get_size(mui, MENU_LIST_PLAIN) == 1)
{ {
mui_draw_tab_begin(mui, width, height, &footer_bg_color[0], &grey_bg[0]); mui_draw_tab_begin(mui,
video_info,
width, height, &footer_bg_color[0], &grey_bg[0]);
for (i = 0; i <= MUI_SYSTEM_TAB_END; i++) for (i = 0; i <= MUI_SYSTEM_TAB_END; i++)
mui_draw_tab(mui, i, width, height, &passive_tab_icon_color[0], &active_tab_marker_color[0]); mui_draw_tab(mui, video_info,
i, width, height,
&passive_tab_icon_color[0], &active_tab_marker_color[0]);
mui_draw_tab_end(mui, width, height, header_height, &active_tab_marker_color[0]); mui_draw_tab_end(mui,
video_info,
width, height, header_height, &active_tab_marker_color[0]);
} }
menu_display_draw_quad( menu_display_draw_quad(
video_info,
0, 0,
header_height, header_height,
width, width,
@ -1559,7 +1589,7 @@ static void mui_frame(void *data, video_frame_info_t *video_info)
if (menu_entries_ctl(MENU_ENTRIES_CTL_SHOW_BACK, NULL)) if (menu_entries_ctl(MENU_ENTRIES_CTL_SHOW_BACK, NULL))
{ {
title_margin = mui->icon_size; title_margin = mui->icon_size;
mui_draw_icon( mui_draw_icon(video_info,
mui->icon_size, mui->icon_size,
mui->textures.list[MUI_TEXTURE_BACK], mui->textures.list[MUI_TEXTURE_BACK],
0, 0,
@ -1614,14 +1644,15 @@ static void mui_frame(void *data, video_frame_info_t *video_info)
header_height / 2 + mui->font->size / 3, header_height / 2 + mui->font->size / 3,
width, height, font_header_color, TEXT_ALIGN_LEFT, 1.0f, false, 0); width, height, font_header_color, TEXT_ALIGN_LEFT, 1.0f, false, 0);
mui_draw_scrollbar(mui, width, height, &grey_bg[0]); mui_draw_scrollbar(mui, video_info, width, height, &grey_bg[0]);
if (menu_input_dialog_get_display_kb()) if (menu_input_dialog_get_display_kb())
{ {
const char *str = menu_input_dialog_get_buffer(); const char *str = menu_input_dialog_get_buffer();
const char *label = menu_input_dialog_get_label_buffer(); const char *label = menu_input_dialog_get_label_buffer();
menu_display_draw_quad(0, 0, width, height, width, height, &black_bg[0]); menu_display_draw_quad(video_info,
0, 0, width, height, width, height, &black_bg[0]);
snprintf(msg, sizeof(msg), "%s\n%s", label, str); snprintf(msg, sizeof(msg), "%s\n%s", label, str);
mui_render_messagebox(mui, video_info, mui_render_messagebox(mui, video_info,
@ -1630,7 +1661,8 @@ static void mui_frame(void *data, video_frame_info_t *video_info)
if (!string_is_empty(mui->box_message)) if (!string_is_empty(mui->box_message))
{ {
menu_display_draw_quad(0, 0, width, height, width, height, &black_bg[0]); menu_display_draw_quad(video_info,
0, 0, width, height, width, height, &black_bg[0]);
mui_render_messagebox(mui, video_info, mui_render_messagebox(mui, video_info,
mui->box_message, &body_bg_color[0], font_hover_color); mui->box_message, &body_bg_color[0], font_hover_color);
@ -1641,6 +1673,7 @@ static void mui_frame(void *data, video_frame_info_t *video_info)
if (mui->mouse_show) if (mui->mouse_show)
menu_display_draw_cursor( menu_display_draw_cursor(
video_info,
&white_bg[0], &white_bg[0],
mui->cursor_size, mui->cursor_size,
mui->textures.list[MUI_TEXTURE_POINTER], mui->textures.list[MUI_TEXTURE_POINTER],

View File

@ -797,7 +797,9 @@ static void xmb_render_keyboard(xmb_handle_t *xmb,
1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00,
}; };
menu_display_draw_quad(0, height/2.0, width, height/2.0, menu_display_draw_quad(
video_info,
0, height/2.0, width, height/2.0,
width, height, width, height,
&dark[0]); &dark[0]);
@ -815,7 +817,7 @@ static void xmb_render_keyboard(xmb_handle_t *xmb,
{ {
uintptr_t texture = xmb->textures.list[XMB_TEXTURE_KEY_HOVER]; uintptr_t texture = xmb->textures.list[XMB_TEXTURE_KEY_HOVER];
menu_display_blend_begin(); menu_display_blend_begin(video_info);
menu_display_draw_texture( menu_display_draw_texture(
width/2.0 - (11*ptr_width)/2.0 + (i % 11) * ptr_width, width/2.0 - (11*ptr_width)/2.0 + (i % 11) * ptr_width,
@ -825,7 +827,7 @@ static void xmb_render_keyboard(xmb_handle_t *xmb,
&white[0], &white[0],
texture); texture);
menu_display_blend_end(); menu_display_blend_end(video_info);
} }
menu_display_draw_text(xmb->font, grid[i], menu_display_draw_text(xmb->font, grid[i],
@ -911,7 +913,7 @@ static void xmb_render_messagebox_internal(
} }
} }
menu_display_blend_begin(); menu_display_blend_begin(video_info);
menu_display_draw_texture_slice( menu_display_draw_texture_slice(
x - longest_width/2 - xmb->margins_dialog, x - longest_width/2 - xmb->margins_dialog,
@ -2642,7 +2644,7 @@ static void xmb_draw_items(
xmb_calculate_visible_range(xmb, height, end, current, &first, &last); xmb_calculate_visible_range(xmb, height, end, current, &first, &last);
menu_display_blend_begin(); menu_display_blend_begin(video_info);
for (i = first; i <= last; i++) for (i = first; i <= last; i++)
{ {
@ -2663,7 +2665,7 @@ static void xmb_draw_items(
break; break;
} }
menu_display_blend_end(); menu_display_blend_end(video_info);
} }
static void xmb_render(void *data, bool is_idle) static void xmb_render(void *data, bool is_idle)
@ -2768,7 +2770,7 @@ static void xmb_draw_bg(
draw.pipeline.id = 0; draw.pipeline.id = 0;
draw.pipeline.active = xmb_shader_pipeline_active(video_info); draw.pipeline.active = xmb_shader_pipeline_active(video_info);
menu_display_blend_begin(); menu_display_blend_begin(video_info);
menu_display_set_viewport(video_info->width, video_info->height); menu_display_set_viewport(video_info->width, video_info->height);
#ifdef HAVE_SHADERPIPELINE #ifdef HAVE_SHADERPIPELINE
@ -2844,11 +2846,12 @@ static void xmb_draw_bg(
} }
menu_display_draw(&draw); menu_display_draw(&draw);
menu_display_blend_end(); menu_display_blend_end(video_info);
} }
static void xmb_draw_dark_layer( static void xmb_draw_dark_layer(
xmb_handle_t *xmb, xmb_handle_t *xmb,
video_frame_info_t *video_info,
unsigned width, unsigned width,
unsigned height) unsigned height)
{ {
@ -2879,9 +2882,9 @@ static void xmb_draw_dark_layer(
draw.prim_type = MENU_DISPLAY_PRIM_TRIANGLESTRIP; draw.prim_type = MENU_DISPLAY_PRIM_TRIANGLESTRIP;
draw.pipeline.id = 0; draw.pipeline.id = 0;
menu_display_blend_begin(); menu_display_blend_begin(video_info);
menu_display_draw(&draw); menu_display_draw(&draw);
menu_display_blend_end(); menu_display_blend_end(video_info);
} }
static void xmb_frame(void *data, video_frame_info_t *video_info) static void xmb_frame(void *data, video_frame_info_t *video_info)
@ -2972,7 +2975,7 @@ static void xmb_frame(void *data, video_frame_info_t *video_info)
rotate_draw.scale_enable = true; rotate_draw.scale_enable = true;
menu_display_rotate_z(&rotate_draw); menu_display_rotate_z(&rotate_draw);
menu_display_blend_begin(); menu_display_blend_begin(video_info);
if (xmb->savestate_thumbnail) if (xmb->savestate_thumbnail)
xmb_draw_thumbnail(menu_disp_info, xmb_draw_thumbnail(menu_disp_info,
@ -3125,7 +3128,7 @@ static void xmb_frame(void *data, video_frame_info_t *video_info)
&coord_white[0], &coord_white[0],
xmb->shadow_offset); xmb->shadow_offset);
menu_display_blend_begin(); menu_display_blend_begin(video_info);
/* Horizontal tab icons */ /* Horizontal tab icons */
for (i = 0; i <= xmb_list_get_size(xmb, MENU_LIST_HORIZONTAL) for (i = 0; i <= xmb_list_get_size(xmb, MENU_LIST_HORIZONTAL)
@ -3176,7 +3179,7 @@ static void xmb_frame(void *data, video_frame_info_t *video_info)
} }
} }
menu_display_blend_end(); menu_display_blend_end(video_info);
/* Vertical icons */ /* Vertical icons */
if (xmb) if (xmb)
@ -3234,9 +3237,9 @@ static void xmb_frame(void *data, video_frame_info_t *video_info)
if (render_background) if (render_background)
{ {
xmb_draw_dark_layer(xmb, width, height); xmb_draw_dark_layer(xmb, video_info, width, height);
xmb_render_messagebox_internal(menu_disp_info,
xmb_render_messagebox_internal(menu_disp_info, video_info, xmb, msg, &coord_white[0]); video_info, xmb, msg, &coord_white[0]);
} }
/* Cursor image */ /* Cursor image */
@ -3244,6 +3247,7 @@ static void xmb_frame(void *data, video_frame_info_t *video_info)
{ {
menu_display_set_alpha(coord_white, MIN(xmb->alpha, 1.00f)); menu_display_set_alpha(coord_white, MIN(xmb->alpha, 1.00f));
menu_display_draw_cursor( menu_display_draw_cursor(
video_info,
&coord_white[0], &coord_white[0],
xmb->cursor_size, xmb->cursor_size,
xmb->textures.list[XMB_TEXTURE_POINTER], xmb->textures.list[XMB_TEXTURE_POINTER],

View File

@ -30,11 +30,11 @@ static void *menu_display_caca_get_default_mvp(void)
return NULL; return NULL;
} }
static void menu_display_caca_blend_begin(void) static void menu_display_caca_blend_begin(video_frame_info_t *video_info)
{ {
} }
static void menu_display_caca_blend_end(void) static void menu_display_caca_blend_end(video_frame_info_t *video_info)
{ {
} }

View File

@ -43,12 +43,12 @@ static void *menu_display_ctr_get_default_mvp(void)
return NULL; return NULL;
} }
static void menu_display_ctr_blend_begin(void) static void menu_display_ctr_blend_begin(video_frame_info_t *video_info)
{ {
} }
static void menu_display_ctr_blend_end(void) static void menu_display_ctr_blend_end(video_frame_info_t *video_info)
{ {
} }

View File

@ -78,9 +78,10 @@ static INT32 menu_display_prim_to_d3d_enum(
return 0; return 0;
} }
static void menu_display_d3d_blend_begin(void) static void menu_display_d3d_blend_begin(video_frame_info_t *video_info)
{ {
d3d_video_t *d3d = (d3d_video_t*)video_driver_get_ptr(false); d3d_video_t *d3d = video_info ?
(d3d_video_t*)video_info->userdata : NULL;
if (!d3d) if (!d3d)
return; return;
@ -88,9 +89,10 @@ static void menu_display_d3d_blend_begin(void)
d3d_enable_blend_func(d3d->dev); d3d_enable_blend_func(d3d->dev);
} }
static void menu_display_d3d_blend_end(void) static void menu_display_d3d_blend_end(video_frame_info_t *video_info)
{ {
d3d_video_t *d3d = (d3d_video_t*)video_driver_get_ptr(false); d3d_video_t *d3d = video_info ?
(d3d_video_t*)video_info->userdata : NULL;
if (!d3d) if (!d3d)
return; return;

View File

@ -34,16 +34,18 @@ static const float* menu_display_d3d11_get_default_tex_coords(void) { return NUL
static void* menu_display_d3d11_get_default_mvp(void) { return NULL; } static void* menu_display_d3d11_get_default_mvp(void) { return NULL; }
static void menu_display_d3d11_blend_begin(void) static void menu_display_d3d11_blend_begin(video_frame_info_t *video_info)
{ {
d3d11_video_t* d3d11 = (d3d11_video_t*)video_driver_get_ptr(false); d3d11_video_t* d3d11 = video_info ? (d3d11_video_t*)video_info->userdata : NULL;
D3D11SetBlendState(d3d11->context, d3d11->blend_enable, NULL, D3D11_DEFAULT_SAMPLE_MASK); D3D11SetBlendState(d3d11->context,
d3d11->blend_enable, NULL, D3D11_DEFAULT_SAMPLE_MASK);
} }
static void menu_display_d3d11_blend_end(void) static void menu_display_d3d11_blend_end(video_frame_info_t *video_info)
{ {
d3d11_video_t* d3d11 = (d3d11_video_t*)video_driver_get_ptr(false); d3d11_video_t* d3d11 = video_info ? (d3d11_video_t*)video_info->userdata : NULL;
D3D11SetBlendState(d3d11->context, d3d11->blend_disable, NULL, D3D11_DEFAULT_SAMPLE_MASK); D3D11SetBlendState(d3d11->context,
d3d11->blend_disable, NULL, D3D11_DEFAULT_SAMPLE_MASK);
} }
static void menu_display_d3d11_viewport(void* data) {} static void menu_display_d3d11_viewport(void* data) {}

View File

@ -34,17 +34,17 @@ static const float* menu_display_d3d12_get_default_tex_coords(void) { return NUL
static void* menu_display_d3d12_get_default_mvp(void) { return NULL; } static void* menu_display_d3d12_get_default_mvp(void) { return NULL; }
static void menu_display_d3d12_blend_begin(void) static void menu_display_d3d12_blend_begin(video_frame_info_t *video_info)
{ {
d3d12_video_t* d3d12 = (d3d12_video_t*)video_driver_get_ptr(false); d3d12_video_t* d3d12 = video_info ? (d3d12_video_t*)video_info->userdata : NULL;
d3d12->sprites.pipe = d3d12->sprites.pipe_blend; d3d12->sprites.pipe = d3d12->sprites.pipe_blend;
D3D12SetPipelineState(d3d12->queue.cmd, d3d12->sprites.pipe); D3D12SetPipelineState(d3d12->queue.cmd, d3d12->sprites.pipe);
} }
static void menu_display_d3d12_blend_end(void) static void menu_display_d3d12_blend_end(video_frame_info_t *video_info)
{ {
d3d12_video_t* d3d12 = (d3d12_video_t*)video_driver_get_ptr(false); d3d12_video_t* d3d12 = video_info ? (d3d12_video_t*)video_info->userdata : NULL;
d3d12->sprites.pipe = d3d12->sprites.pipe_noblend; d3d12->sprites.pipe = d3d12->sprites.pipe_noblend;
D3D12SetPipelineState(d3d12->queue.cmd, d3d12->sprites.pipe); D3D12SetPipelineState(d3d12->queue.cmd, d3d12->sprites.pipe);

View File

@ -34,11 +34,11 @@ static void *menu_display_gdi_get_default_mvp(void)
return NULL; return NULL;
} }
static void menu_display_gdi_blend_begin(void) static void menu_display_gdi_blend_begin(video_frame_info_t *video_info)
{ {
} }
static void menu_display_gdi_blend_end(void) static void menu_display_gdi_blend_end(video_frame_info_t *video_info)
{ {
} }

View File

@ -77,7 +77,7 @@ static GLenum menu_display_prim_to_gl_enum(
return 0; return 0;
} }
static void menu_display_gl_blend_begin(void) static void menu_display_gl_blend_begin(video_frame_info_t *video_info)
{ {
video_shader_ctx_info_t shader_info; video_shader_ctx_info_t shader_info;
@ -91,7 +91,7 @@ static void menu_display_gl_blend_begin(void)
video_shader_driver_use(shader_info); video_shader_driver_use(shader_info);
} }
static void menu_display_gl_blend_end(void) static void menu_display_gl_blend_end(video_frame_info_t *video_info)
{ {
glDisable(GL_BLEND); glDisable(GL_BLEND);
} }

View File

@ -28,11 +28,11 @@ static void *menu_display_null_get_default_mvp(void)
return NULL; return NULL;
} }
static void menu_display_null_blend_begin(void) static void menu_display_null_blend_begin(video_frame_info_t *video_info)
{ {
} }
static void menu_display_null_blend_end(void) static void menu_display_null_blend_end(video_frame_info_t *video_info)
{ {
} }

View File

@ -30,11 +30,11 @@ static void *menu_display_vga_get_default_mvp(void)
return NULL; return NULL;
} }
static void menu_display_vga_blend_begin(void) static void menu_display_vga_blend_begin(video_frame_info_t *video_info)
{ {
} }
static void menu_display_vga_blend_end(void) static void menu_display_vga_blend_end(video_frame_info_t *video_info)
{ {
} }

View File

@ -82,12 +82,12 @@ static SceGxmPrimitiveType menu_display_prim_to_vita2d_enum(
} }
#endif #endif
static void menu_display_vita2d_blend_begin(void) static void menu_display_vita2d_blend_begin(video_frame_info_t *video_info)
{ {
} }
static void menu_display_vita2d_blend_end(void) static void menu_display_vita2d_blend_end(video_frame_info_t *video_info)
{ {
} }

View File

@ -306,15 +306,19 @@ static void menu_display_vk_clear_color(
vkCmdClearAttachments(vk->cmd, 1, &attachment, 1, &rect); vkCmdClearAttachments(vk->cmd, 1, &attachment, 1, &rect);
} }
static void menu_display_vk_blend_begin(void) static void menu_display_vk_blend_begin(video_frame_info_t *video_info)
{ {
vk_t *vk = (vk_t*)video_driver_get_ptr(false); vk_t *vk = video_info ? (vk_t*)video_info->userdata : NULL;
if (vk)
vk->display.blend = true; vk->display.blend = true;
} }
static void menu_display_vk_blend_end(void) static void menu_display_vk_blend_end(video_frame_info_t *video_info)
{ {
vk_t *vk = (vk_t*)video_driver_get_ptr(false); vk_t *vk = video_info ? (vk_t*)video_info->userdata : NULL;
if (vk)
vk->display.blend = false; vk->display.blend = false;
} }

View File

@ -44,12 +44,12 @@ static void *menu_display_wiiu_get_default_mvp(void)
return NULL; return NULL;
} }
static void menu_display_wiiu_blend_begin(void) static void menu_display_wiiu_blend_begin(video_frame_info_t *video_info)
{ {
} }
static void menu_display_wiiu_blend_end(void) static void menu_display_wiiu_blend_end(video_frame_info_t *video_info)
{ {
} }

View File

@ -303,17 +303,17 @@ void menu_display_timedate(menu_display_ctx_datetime_t *datetime)
} }
/* Begin blending operation */ /* Begin blending operation */
void menu_display_blend_begin(void) void menu_display_blend_begin(video_frame_info_t *video_info)
{ {
if (menu_disp && menu_disp->blend_begin) if (menu_disp && menu_disp->blend_begin)
menu_disp->blend_begin(); menu_disp->blend_begin(video_info);
} }
/* End blending operation */ /* End blending operation */
void menu_display_blend_end(void) void menu_display_blend_end(video_frame_info_t *video_info)
{ {
if (menu_disp && menu_disp->blend_end) if (menu_disp && menu_disp->blend_end)
menu_disp->blend_end(); menu_disp->blend_end(video_info);
} }
/* Teardown; deinitializes and frees all /* Teardown; deinitializes and frees all
@ -653,6 +653,7 @@ void menu_display_draw_gradient(menu_display_ctx_draw_t *draw,
} }
void menu_display_draw_quad( void menu_display_draw_quad(
video_frame_info_t *video_info,
int x, int y, unsigned w, unsigned h, int x, int y, unsigned w, unsigned h,
unsigned width, unsigned height, unsigned width, unsigned height,
float *color) float *color)
@ -667,7 +668,7 @@ void menu_display_draw_quad(
coords.color = color; coords.color = color;
if (menu_disp && menu_disp->blend_begin) if (menu_disp && menu_disp->blend_begin)
menu_disp->blend_begin(); menu_disp->blend_begin(video_info);
draw.x = x; draw.x = x;
draw.y = (int)height - y - (int)h; draw.y = (int)height - y - (int)h;
@ -684,7 +685,7 @@ void menu_display_draw_quad(
menu_display_draw(&draw); menu_display_draw(&draw);
if (menu_disp && menu_disp->blend_end) if (menu_disp && menu_disp->blend_end)
menu_disp->blend_end(); menu_disp->blend_end(video_info);
} }
void menu_display_draw_texture( void menu_display_draw_texture(
@ -1114,6 +1115,7 @@ void menu_display_allocate_white_texture(void)
* Draw a hardware cursor on top of the screen for the mouse. * Draw a hardware cursor on top of the screen for the mouse.
*/ */
void menu_display_draw_cursor( void menu_display_draw_cursor(
video_frame_info_t *video_info,
float *color, float cursor_size, uintptr_t texture, float *color, float cursor_size, uintptr_t texture,
float x, float y, unsigned width, unsigned height) float x, float y, unsigned width, unsigned height)
{ {
@ -1133,7 +1135,7 @@ void menu_display_draw_cursor(
coords.color = (const float*)color; coords.color = (const float*)color;
if (menu_disp && menu_disp->blend_begin) if (menu_disp && menu_disp->blend_begin)
menu_disp->blend_begin(); menu_disp->blend_begin(video_info);
draw.x = x - (cursor_size / 2); draw.x = x - (cursor_size / 2);
draw.y = (int)height - y - (cursor_size / 2); draw.y = (int)height - y - (cursor_size / 2);
@ -1148,7 +1150,7 @@ void menu_display_draw_cursor(
menu_display_draw(&draw); menu_display_draw(&draw);
if (menu_disp && menu_disp->blend_end) if (menu_disp && menu_disp->blend_end)
menu_disp->blend_end(); menu_disp->blend_end(video_info);
} }
static INLINE float menu_display_scalef(float val, static INLINE float menu_display_scalef(float val,

View File

@ -325,9 +325,9 @@ typedef struct menu_display_ctx_driver
void (*draw_pipeline)(void *data); void (*draw_pipeline)(void *data);
void (*viewport)(void *data); void (*viewport)(void *data);
/* Start blending operation. */ /* Start blending operation. */
void (*blend_begin)(void); void (*blend_begin)(video_frame_info_t *video_info);
/* Finish blending operation. */ /* Finish blending operation. */
void (*blend_end)(void); void (*blend_end)(video_frame_info_t *video_info);
/* Set the clear color back to its default values. */ /* Set the clear color back to its default values. */
void (*restore_clear_color)(void); void (*restore_clear_color)(void);
/* Set the color to be used when clearing the screen */ /* Set the color to be used when clearing the screen */
@ -641,8 +641,8 @@ void menu_navigation_set_selection(size_t val);
enum menu_toggle_reason menu_display_toggle_get_reason(void); enum menu_toggle_reason menu_display_toggle_get_reason(void);
void menu_display_toggle_set_reason(enum menu_toggle_reason reason); void menu_display_toggle_set_reason(enum menu_toggle_reason reason);
void menu_display_blend_begin(void); void menu_display_blend_begin(video_frame_info_t *video_info);
void menu_display_blend_end(void); void menu_display_blend_end(video_frame_info_t *video_info);
void menu_display_font_free(font_data_t *font); void menu_display_font_free(font_data_t *font);
@ -685,7 +685,9 @@ void menu_display_draw_bg(
void menu_display_draw_gradient( void menu_display_draw_gradient(
menu_display_ctx_draw_t *draw, menu_display_ctx_draw_t *draw,
video_frame_info_t *video_info); video_frame_info_t *video_info);
void menu_display_draw_quad(int x, int y, unsigned w, unsigned h, void menu_display_draw_quad(
video_frame_info_t *video_info,
int x, int y, unsigned w, unsigned h,
unsigned width, unsigned height, unsigned width, unsigned height,
float *color); float *color);
void menu_display_draw_texture(int x, int y, unsigned w, unsigned h, void menu_display_draw_texture(int x, int y, unsigned w, unsigned h,
@ -718,6 +720,7 @@ void menu_display_snow(int width, int height);
void menu_display_allocate_white_texture(void); void menu_display_allocate_white_texture(void);
void menu_display_draw_cursor( void menu_display_draw_cursor(
video_frame_info_t *video_info,
float *color, float cursor_size, uintptr_t texture, float *color, float cursor_size, uintptr_t texture,
float x, float y, unsigned width, unsigned height); float x, float y, unsigned width, unsigned height);