Cleanups
This commit is contained in:
parent
2026401cc0
commit
88c68f479a
|
@ -64,7 +64,8 @@ static void *menu_display_d3d_get_default_mvp(void)
|
||||||
#ifdef _XBOX
|
#ifdef _XBOX
|
||||||
return NULL; /* TODO/FIXME */
|
return NULL; /* TODO/FIXME */
|
||||||
#else
|
#else
|
||||||
D3DXMatrixOrthoOffCenterLH(&ortho, 0, d3d->final_viewport.Width, 0, d3d->final_viewport.Height, 0, 1);
|
D3DXMatrixOrthoOffCenterLH(&ortho, 0,
|
||||||
|
d3d->final_viewport.Width, 0, d3d->final_viewport.Height, 0, 1);
|
||||||
D3DXMatrixTranspose(&mvp, &ortho);
|
D3DXMatrixTranspose(&mvp, &ortho);
|
||||||
memcpy(default_mvp.data, (FLOAT*)mvp, sizeof(default_mvp.data));
|
memcpy(default_mvp.data, (FLOAT*)mvp, sizeof(default_mvp.data));
|
||||||
|
|
||||||
|
@ -72,7 +73,8 @@ static void *menu_display_d3d_get_default_mvp(void)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static unsigned menu_display_prim_to_d3d_enum(enum menu_display_prim_type prim_type)
|
static unsigned menu_display_prim_to_d3d_enum(
|
||||||
|
enum menu_display_prim_type prim_type)
|
||||||
{
|
{
|
||||||
switch (prim_type)
|
switch (prim_type)
|
||||||
{
|
{
|
||||||
|
@ -107,15 +109,18 @@ static void menu_display_d3d_blend_end(void)
|
||||||
d3d_disable_blend_func(d3d->dev);
|
d3d_disable_blend_func(d3d->dev);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void menu_display_d3d_draw(menu_display_ctx_draw_t *draw)
|
static void menu_display_d3d_draw(void *data)
|
||||||
{
|
{
|
||||||
D3DVIEWPORT vp = {0};
|
D3DVIEWPORT vp = {0};
|
||||||
d3d_video_t *d3d = d3d_get_ptr();
|
math_matrix_4x4 *mat = NULL;
|
||||||
math_matrix_4x4 *mat = draw ? (math_matrix_4x4*)draw->matrix_data : NULL;
|
d3d_video_t *d3d = d3d_get_ptr();
|
||||||
|
menu_display_ctx_draw_t *draw = (menu_display_ctx_draw_t*)data;
|
||||||
|
|
||||||
if (!d3d || !draw)
|
if (!d3d || !draw)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
mat = (math_matrix_4x4*)draw->matrix_data;
|
||||||
|
|
||||||
/* TODO - edge case */
|
/* TODO - edge case */
|
||||||
if (draw->height <= 0)
|
if (draw->height <= 0)
|
||||||
draw->height = 1;
|
draw->height = 1;
|
||||||
|
@ -145,21 +150,23 @@ static void menu_display_d3d_draw(menu_display_ctx_draw_t *draw)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
d3d_draw_primitive(d3d->dev, (D3DPRIMITIVETYPE)
|
d3d_draw_primitive(d3d->dev, (D3DPRIMITIVETYPE)
|
||||||
menu_display_prim_to_d3d_enum(draw->prim_type), 0, draw->coords->vertices);
|
menu_display_prim_to_d3d_enum(draw->prim_type),
|
||||||
|
0, draw->coords->vertices);
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
gl->coords.color = gl->white_color_ptr;
|
gl->coords.color = gl->white_color_ptr;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static void menu_display_d3d_draw_bg(menu_display_ctx_draw_t *draw)
|
static void menu_display_d3d_draw_bg(void *data)
|
||||||
{
|
{
|
||||||
struct gfx_coords coords;
|
struct gfx_coords coords;
|
||||||
const float *new_vertex = NULL;
|
const float *new_vertex = NULL;
|
||||||
const float *new_tex_coord = NULL;
|
const float *new_tex_coord = NULL;
|
||||||
global_t *global = global_get_ptr();
|
global_t *global = global_get_ptr();
|
||||||
settings_t *settings = config_get_ptr();
|
settings_t *settings = config_get_ptr();
|
||||||
d3d_video_t *d3d = d3d_get_ptr();
|
d3d_video_t *d3d = d3d_get_ptr();
|
||||||
|
menu_display_ctx_draw_t *draw = (menu_display_ctx_draw_t*)data;
|
||||||
|
|
||||||
if (!d3d || !draw)
|
if (!d3d || !draw)
|
||||||
return;
|
return;
|
||||||
|
@ -182,14 +189,18 @@ static void menu_display_d3d_draw_bg(menu_display_ctx_draw_t *draw)
|
||||||
|
|
||||||
menu_display_ctl(MENU_DISPLAY_CTL_SET_VIEWPORT, NULL);
|
menu_display_ctl(MENU_DISPLAY_CTL_SET_VIEWPORT, NULL);
|
||||||
|
|
||||||
if ((settings->menu.pause_libretro
|
if (
|
||||||
|| !rarch_ctl(RARCH_CTL_IS_INITED, NULL) || rarch_ctl(RARCH_CTL_IS_DUMMY_CORE, NULL))
|
( settings->menu.pause_libretro
|
||||||
|
|| !rarch_ctl(RARCH_CTL_IS_INITED, NULL)
|
||||||
|
|| rarch_ctl(RARCH_CTL_IS_DUMMY_CORE, NULL)
|
||||||
|
)
|
||||||
&& !draw->force_transparency && draw->texture)
|
&& !draw->force_transparency && draw->texture)
|
||||||
coords.color = (const float*)draw->color2;
|
coords.color = (const float*)draw->color2;
|
||||||
|
|
||||||
draw->x = 0;
|
draw->x = 0;
|
||||||
draw->y = 0;
|
draw->y = 0;
|
||||||
draw->matrix_data = (math_matrix_4x4*)menu_display_d3d_get_default_mvp();
|
draw->matrix_data = (math_matrix_4x4*)
|
||||||
|
menu_display_d3d_get_default_mvp();
|
||||||
|
|
||||||
menu_display_d3d_draw(draw);
|
menu_display_d3d_draw(draw);
|
||||||
|
|
||||||
|
@ -208,10 +219,22 @@ static void menu_display_d3d_restore_clear_color(void)
|
||||||
d3d_clear(d3d->dev, 0, NULL, D3DCLEAR_TARGET, clear_color, 0, 0);
|
d3d_clear(d3d->dev, 0, NULL, D3DCLEAR_TARGET, clear_color, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void menu_display_d3d_clear_color(float r, float g, float b, float a)
|
static void menu_display_d3d_clear_color(void *data)
|
||||||
{
|
{
|
||||||
d3d_video_t *d3d = d3d_get_ptr();
|
DWORD clear_color = 0;
|
||||||
DWORD clear_color = D3DCOLOR_ARGB(BYTE_CLAMP(a * 255.0f), BYTE_CLAMP(r * 255.0f), BYTE_CLAMP(g * 255.0f), BYTE_CLAMP(b * 255.0f));
|
d3d_video_t *d3d = d3d_get_ptr();
|
||||||
|
menu_display_ctx_clearcolor_t *clearcolor =
|
||||||
|
(menu_display_ctx_clearcolor_t*)data;
|
||||||
|
|
||||||
|
if (!d3d || !clearcolor)
|
||||||
|
return;
|
||||||
|
|
||||||
|
clear_color = D3DCOLOR_ARGB(
|
||||||
|
BYTE_CLAMP(clearcolor->a * 255.0f), /* A */
|
||||||
|
BYTE_CLAMP(clearcolor->r * 255.0f), /* R */
|
||||||
|
BYTE_CLAMP(clearcolor->g * 255.0f), /* G */
|
||||||
|
BYTE_CLAMP(clearcolor->b * 255.0f) /* B */
|
||||||
|
);
|
||||||
|
|
||||||
d3d_clear(d3d->dev, 0, NULL, D3DCLEAR_TARGET, clear_color, 0, 0);
|
d3d_clear(d3d->dev, 0, NULL, D3DCLEAR_TARGET, clear_color, 0, 0);
|
||||||
}
|
}
|
||||||
|
@ -222,8 +245,8 @@ static const float *menu_display_d3d_get_tex_coords(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool menu_display_d3d_font_init_first(
|
static bool menu_display_d3d_font_init_first(
|
||||||
void **font_handle, void *video_data, const char *font_path,
|
void **font_handle, void *video_data,
|
||||||
float font_size)
|
const char *font_path, float font_size)
|
||||||
{
|
{
|
||||||
return font_driver_init_first(NULL, font_handle, video_data,
|
return font_driver_init_first(NULL, font_handle, video_data,
|
||||||
font_path, font_size, true, FONT_DRIVER_RENDER_DIRECT3D_API);
|
font_path, font_size, true, FONT_DRIVER_RENDER_DIRECT3D_API);
|
||||||
|
|
|
@ -86,10 +86,11 @@ static void menu_display_gl_blend_end(void)
|
||||||
glDisable(GL_BLEND);
|
glDisable(GL_BLEND);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void menu_display_gl_draw(menu_display_ctx_draw_t *draw)
|
static void menu_display_gl_draw(void *data)
|
||||||
{
|
{
|
||||||
gl_t *gl = gl_get_ptr();
|
gl_t *gl = gl_get_ptr();
|
||||||
math_matrix_4x4 *mat = NULL;
|
math_matrix_4x4 *mat = NULL;
|
||||||
|
menu_display_ctx_draw_t *draw = (menu_display_ctx_draw_t*)data;
|
||||||
|
|
||||||
if (!gl || !draw)
|
if (!gl || !draw)
|
||||||
return;
|
return;
|
||||||
|
@ -121,13 +122,14 @@ static void menu_display_gl_draw(menu_display_ctx_draw_t *draw)
|
||||||
gl->coords.color = gl->white_color_ptr;
|
gl->coords.color = gl->white_color_ptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void menu_display_gl_draw_bg(menu_display_ctx_draw_t *draw)
|
static void menu_display_gl_draw_bg(void *data)
|
||||||
{
|
{
|
||||||
struct gfx_coords coords;
|
struct gfx_coords coords;
|
||||||
const GLfloat *new_vertex = NULL;
|
const GLfloat *new_vertex = NULL;
|
||||||
const GLfloat *new_tex_coord = NULL;
|
const GLfloat *new_tex_coord = NULL;
|
||||||
settings_t *settings = config_get_ptr();
|
settings_t *settings = config_get_ptr();
|
||||||
gl_t *gl = gl_get_ptr();
|
gl_t *gl = gl_get_ptr();
|
||||||
|
menu_display_ctx_draw_t *draw = (menu_display_ctx_draw_t*)data;
|
||||||
|
|
||||||
if (!gl || !draw)
|
if (!gl || !draw)
|
||||||
return;
|
return;
|
||||||
|
@ -175,9 +177,13 @@ static void menu_display_gl_restore_clear_color(void)
|
||||||
glClearColor(0.0f, 0.0f, 0.0f, 0.00f);
|
glClearColor(0.0f, 0.0f, 0.0f, 0.00f);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void menu_display_gl_clear_color(float r, float g, float b, float a)
|
static void menu_display_gl_clear_color(void *data)
|
||||||
{
|
{
|
||||||
glClearColor(r, g, b, a);
|
menu_display_ctx_clearcolor_t *clearcolor = (menu_display_ctx_clearcolor_t*)data;
|
||||||
|
if (!clearcolor)
|
||||||
|
return;
|
||||||
|
|
||||||
|
glClearColor(clearcolor->r, clearcolor->g, clearcolor->b, clearcolor->a);
|
||||||
glClear(GL_COLOR_BUFFER_BIT);
|
glClear(GL_COLOR_BUFFER_BIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -37,22 +37,23 @@ static void menu_display_null_blend_end(void)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
static void menu_display_null_draw(menu_display_ctx_draw_t *draw)
|
static void menu_display_null_draw(void *data)
|
||||||
{
|
{
|
||||||
(void)draw;
|
(void)data;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void menu_display_null_draw_bg(menu_display_ctx_draw_t *draw)
|
static void menu_display_null_draw_bg(void *data)
|
||||||
{
|
{
|
||||||
(void)draw;
|
(void)data;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void menu_display_null_restore_clear_color(void)
|
static void menu_display_null_restore_clear_color(void)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
static void menu_display_null_clear_color(float r, float g, float b, float a)
|
static void menu_display_null_clear_color(void *data)
|
||||||
{
|
{
|
||||||
|
(void)data;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const float *menu_display_null_get_tex_coords(void)
|
static const float *menu_display_null_get_tex_coords(void)
|
||||||
|
@ -62,8 +63,8 @@ static const float *menu_display_null_get_tex_coords(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool menu_display_null_font_init_first(
|
static bool menu_display_null_font_init_first(
|
||||||
void **font_handle, void *video_data, const char *font_path,
|
void **font_handle, void *video_data,
|
||||||
float font_size)
|
const char *font_path, float font_size)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -442,29 +442,24 @@ bool menu_display_ctl(enum menu_display_ctl_state state, void *data)
|
||||||
break;
|
break;
|
||||||
case MENU_DISPLAY_CTL_CLEAR_COLOR:
|
case MENU_DISPLAY_CTL_CLEAR_COLOR:
|
||||||
{
|
{
|
||||||
menu_display_ctx_clearcolor_t *clearcolor =
|
if (!menu_disp || !menu_disp->clear_color)
|
||||||
(menu_display_ctx_clearcolor_t*)data;
|
|
||||||
if (!menu_disp || !menu_disp->clear_color || !clearcolor)
|
|
||||||
return false;
|
return false;
|
||||||
menu_disp->clear_color(clearcolor->r,
|
menu_disp->clear_color(data);
|
||||||
clearcolor->g, clearcolor->b, clearcolor->a);
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case MENU_DISPLAY_CTL_DRAW:
|
case MENU_DISPLAY_CTL_DRAW:
|
||||||
{
|
{
|
||||||
menu_display_ctx_draw_t *draw = (menu_display_ctx_draw_t*)data;
|
|
||||||
if (!menu_disp || !menu_disp->draw)
|
if (!menu_disp || !menu_disp->draw)
|
||||||
return false;
|
return false;
|
||||||
menu_disp->draw(draw);
|
menu_disp->draw(data);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case MENU_DISPLAY_CTL_DRAW_BG:
|
case MENU_DISPLAY_CTL_DRAW_BG:
|
||||||
{
|
{
|
||||||
menu_display_ctx_draw_t *draw = (menu_display_ctx_draw_t*)data;
|
|
||||||
if (!menu_disp || !menu_disp->draw_bg)
|
if (!menu_disp || !menu_disp->draw_bg)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
menu_disp->draw_bg(draw);
|
menu_disp->draw_bg(data);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case MENU_DISPLAY_CTL_ROTATE_Z:
|
case MENU_DISPLAY_CTL_ROTATE_Z:
|
||||||
|
|
|
@ -147,19 +147,17 @@ typedef struct menu_display_ctx_datetime
|
||||||
|
|
||||||
typedef struct menu_display_ctx_driver
|
typedef struct menu_display_ctx_driver
|
||||||
{
|
{
|
||||||
void (*draw)(menu_display_ctx_draw_t *draw);
|
void (*draw)(void *data);
|
||||||
void (*draw_bg)(menu_display_ctx_draw_t *draw);
|
void (*draw_bg)(void *data);
|
||||||
void (*blend_begin)(void);
|
void (*blend_begin)(void);
|
||||||
void (*blend_end)(void);
|
void (*blend_end)(void);
|
||||||
void (*restore_clear_color)(void);
|
void (*restore_clear_color)(void);
|
||||||
|
void (*clear_color)(void *data);
|
||||||
void (*clear_color)(float r, float g, float b, float a);
|
|
||||||
|
|
||||||
void *(*get_default_mvp)(void);
|
void *(*get_default_mvp)(void);
|
||||||
const float *(*get_tex_coords)(void);
|
const float *(*get_tex_coords)(void);
|
||||||
bool (*font_init_first)(
|
bool (*font_init_first)(
|
||||||
void **font_handle, void *video_data, const char *font_path,
|
void **font_handle, void *video_data,
|
||||||
float font_size);
|
const char *font_path, float font_size);
|
||||||
enum menu_display_driver_type type;
|
enum menu_display_driver_type type;
|
||||||
const char *ident;
|
const char *ident;
|
||||||
} menu_display_ctx_driver_t;
|
} menu_display_ctx_driver_t;
|
||||||
|
|
Loading…
Reference in New Issue