mirror of
https://github.com/libretro/RetroArch
synced 2025-02-20 15:40:44 +00:00
Add 'draw_pipeline to menu/drivers_display
This commit is contained in:
parent
54c0ca4bf5
commit
68265f6c52
@ -712,7 +712,8 @@ static void mui_draw_bg(menu_display_ctx_draw_t *draw)
|
||||
menu_display_ctl(MENU_DISPLAY_CTL_BLEND_BEGIN, NULL);
|
||||
draw->x = 0;
|
||||
draw->y = 0;
|
||||
menu_display_ctl(MENU_DISPLAY_CTL_DRAW_BG, draw);
|
||||
menu_display_ctl(MENU_DISPLAY_CTL_DRAW_BG, draw);
|
||||
menu_display_ctl(MENU_DISPLAY_CTL_DRAW, draw);
|
||||
menu_display_ctl(MENU_DISPLAY_CTL_BLEND_END, NULL);
|
||||
}
|
||||
|
||||
|
@ -1926,6 +1926,8 @@ static void xmb_draw_bg(
|
||||
menu_display_ctl(MENU_DISPLAY_CTL_DRAW_BG, &draw);
|
||||
}
|
||||
|
||||
menu_display_ctl(MENU_DISPLAY_CTL_DRAW, &draw);
|
||||
|
||||
menu_display_ctl(MENU_DISPLAY_CTL_BLEND_END, NULL);
|
||||
}
|
||||
|
||||
|
@ -978,7 +978,8 @@ static void zarch_frame(void *data)
|
||||
menu_display_ctl(MENU_DISPLAY_CTL_BLEND_BEGIN, NULL);
|
||||
draw.x = 0;
|
||||
draw.y = 0;
|
||||
menu_display_ctl(MENU_DISPLAY_CTL_DRAW_BG, &draw);
|
||||
menu_display_ctl(MENU_DISPLAY_CTL_DRAW_BG, &draw);
|
||||
menu_display_ctl(MENU_DISPLAY_CTL_DRAW, &draw);
|
||||
menu_display_ctl(MENU_DISPLAY_CTL_BLEND_END, NULL);
|
||||
|
||||
zui->rendering = false;
|
||||
|
@ -177,6 +177,49 @@ static void menu_display_d3d_draw(void *data)
|
||||
0, draw->coords->vertices);
|
||||
}
|
||||
|
||||
static void menu_display_d3d_draw_pipeline(void *data)
|
||||
{
|
||||
#if defined(HAVE_HLSL) || defined(HAVE_CG)
|
||||
video_shader_ctx_info_t shader_info;
|
||||
menu_display_ctx_draw_t *draw = (menu_display_ctx_draw_t*)data;
|
||||
struct uniform_info uniform_param = {0};
|
||||
static float t = 0;
|
||||
gfx_coord_array_t *ca = NULL;
|
||||
|
||||
menu_display_ctl(MENU_DISPLAY_CTL_COORDS_ARRAY_GET, &ca);
|
||||
|
||||
draw->x = 0;
|
||||
draw->y = 0;
|
||||
draw->coords = (struct gfx_coords*)(&ca->coords);
|
||||
draw->matrix_data = NULL;
|
||||
|
||||
switch (draw->pipeline.id)
|
||||
{
|
||||
case VIDEO_SHADER_MENU:
|
||||
case VIDEO_SHADER_MENU_SEC:
|
||||
shader_info.data = NULL;
|
||||
shader_info.idx = draw->pipeline.id;
|
||||
shader_info.set_active = true;
|
||||
|
||||
video_shader_driver_ctl(SHADER_CTL_USE, &shader_info);
|
||||
|
||||
t += 0.01;
|
||||
|
||||
uniform_param.enabled = true;
|
||||
uniform_param.lookup.enable = true;
|
||||
uniform_param.lookup.add_prefix = true;
|
||||
uniform_param.lookup.idx = VIDEO_SHADER_MENU;
|
||||
uniform_param.lookup.type = SHADER_PROGRAM_VERTEX;
|
||||
uniform_param.type = UNIFORM_1F;
|
||||
uniform_param.lookup.ident = "time";
|
||||
uniform_param.result.f.v0 = t;
|
||||
|
||||
video_shader_driver_ctl(SHADER_CTL_SET_PARAMETER, &uniform_param);
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
static void menu_display_d3d_restore_clear_color(void)
|
||||
{
|
||||
d3d_video_t *d3d = (d3d_video_t*)video_driver_get_ptr(false);
|
||||
@ -213,6 +256,7 @@ static bool menu_display_d3d_font_init_first(
|
||||
|
||||
menu_display_ctx_driver_t menu_display_ctx_d3d = {
|
||||
menu_display_d3d_draw,
|
||||
menu_display_d3d_draw_pipeline,
|
||||
menu_display_d3d_viewport,
|
||||
menu_display_d3d_blend_begin,
|
||||
menu_display_d3d_blend_end,
|
||||
|
@ -151,6 +151,49 @@ static void menu_display_gl_draw(void *data)
|
||||
gl->coords.color = gl->white_color_ptr;
|
||||
}
|
||||
|
||||
static void menu_display_gl_draw_pipeline(void *data)
|
||||
{
|
||||
#if defined(HAVE_GLSL) || defined(HAVE_CG)
|
||||
video_shader_ctx_info_t shader_info;
|
||||
menu_display_ctx_draw_t *draw = (menu_display_ctx_draw_t*)data;
|
||||
struct uniform_info uniform_param = {0};
|
||||
static float t = 0;
|
||||
gfx_coord_array_t *ca = NULL;
|
||||
|
||||
menu_display_ctl(MENU_DISPLAY_CTL_COORDS_ARRAY_GET, &ca);
|
||||
|
||||
draw->x = 0;
|
||||
draw->y = 0;
|
||||
draw->coords = (struct gfx_coords*)(&ca->coords);
|
||||
draw->matrix_data = NULL;
|
||||
|
||||
switch (draw->pipeline.id)
|
||||
{
|
||||
case VIDEO_SHADER_MENU:
|
||||
case VIDEO_SHADER_MENU_SEC:
|
||||
shader_info.data = NULL;
|
||||
shader_info.idx = draw->pipeline.id;
|
||||
shader_info.set_active = true;
|
||||
|
||||
video_shader_driver_ctl(SHADER_CTL_USE, &shader_info);
|
||||
|
||||
t += 0.01;
|
||||
|
||||
uniform_param.enabled = true;
|
||||
uniform_param.lookup.enable = true;
|
||||
uniform_param.lookup.add_prefix = true;
|
||||
uniform_param.lookup.idx = VIDEO_SHADER_MENU;
|
||||
uniform_param.lookup.type = SHADER_PROGRAM_VERTEX;
|
||||
uniform_param.type = UNIFORM_1F;
|
||||
uniform_param.lookup.ident = "time";
|
||||
uniform_param.result.f.v0 = t;
|
||||
|
||||
video_shader_driver_ctl(SHADER_CTL_SET_PARAMETER, &uniform_param);
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
static void menu_display_gl_restore_clear_color(void)
|
||||
{
|
||||
glClearColor(0.0f, 0.0f, 0.0f, 0.00f);
|
||||
@ -176,6 +219,7 @@ static bool menu_display_gl_font_init_first(
|
||||
|
||||
menu_display_ctx_driver_t menu_display_ctx_gl = {
|
||||
menu_display_gl_draw,
|
||||
menu_display_gl_draw_pipeline,
|
||||
menu_display_gl_viewport,
|
||||
menu_display_gl_blend_begin,
|
||||
menu_display_gl_blend_end,
|
||||
|
@ -42,6 +42,11 @@ static void menu_display_null_draw(void *data)
|
||||
(void)data;
|
||||
}
|
||||
|
||||
static void menu_display_null_draw_pipeline(void *data)
|
||||
{
|
||||
(void)data;
|
||||
}
|
||||
|
||||
static void menu_display_null_viewport(void *data)
|
||||
{
|
||||
(void)data;
|
||||
@ -77,6 +82,7 @@ static const float *menu_display_null_get_default_tex_coords(void)
|
||||
|
||||
menu_display_ctx_driver_t menu_display_ctx_null = {
|
||||
menu_display_null_draw,
|
||||
menu_display_null_draw_pipeline,
|
||||
menu_display_null_viewport,
|
||||
menu_display_null_blend_begin,
|
||||
menu_display_null_blend_end,
|
||||
|
@ -77,6 +77,20 @@ static void menu_display_vk_viewport(void *data)
|
||||
vk->vk_vp.maxDepth = 1.0f;
|
||||
}
|
||||
|
||||
static void menu_display_vk_draw_pipeline(void *data)
|
||||
{
|
||||
menu_display_ctx_draw_t *draw = (menu_display_ctx_draw_t*)data;
|
||||
vk_t *vk = (vk_t*)video_driver_get_ptr(false);
|
||||
|
||||
if (!vk || !draw)
|
||||
return;
|
||||
|
||||
(void)draw;
|
||||
(void)vk;
|
||||
|
||||
/* TODO/FIXME - to implement */
|
||||
}
|
||||
|
||||
static void menu_display_vk_draw(void *data)
|
||||
{
|
||||
unsigned i;
|
||||
@ -193,6 +207,7 @@ static bool menu_display_vk_font_init_first(
|
||||
|
||||
menu_display_ctx_driver_t menu_display_ctx_vulkan = {
|
||||
menu_display_vk_draw,
|
||||
menu_display_vk_draw_pipeline,
|
||||
menu_display_vk_viewport,
|
||||
menu_display_vk_blend_begin,
|
||||
menu_display_vk_blend_end,
|
||||
|
@ -486,6 +486,14 @@ bool menu_display_ctl(enum menu_display_ctl_state state, void *data)
|
||||
menu_disp->draw(draw);
|
||||
}
|
||||
break;
|
||||
case MENU_DISPLAY_CTL_DRAW_PIPELINE:
|
||||
{
|
||||
menu_display_ctx_draw_t *draw = (menu_display_ctx_draw_t*)data;
|
||||
if (!menu_disp || !draw || !menu_disp->draw_pipeline)
|
||||
return false;
|
||||
menu_disp->draw_pipeline(draw);
|
||||
}
|
||||
break;
|
||||
case MENU_DISPLAY_CTL_DRAW_BG:
|
||||
{
|
||||
struct gfx_coords coords;
|
||||
@ -515,8 +523,6 @@ bool menu_display_ctl(enum menu_display_ctl_state state, void *data)
|
||||
draw->texture = menu_display_white_texture;
|
||||
|
||||
draw->matrix_data = (math_matrix_4x4*)menu_disp->get_default_mvp();
|
||||
|
||||
menu_display_ctl(MENU_DISPLAY_CTL_DRAW, draw);
|
||||
}
|
||||
break;
|
||||
case MENU_DISPLAY_CTL_DRAW_GRADIENT:
|
||||
@ -528,51 +534,7 @@ bool menu_display_ctl(enum menu_display_ctl_state state, void *data)
|
||||
draw->y = 0;
|
||||
|
||||
menu_display_ctl(MENU_DISPLAY_CTL_DRAW_BG, draw);
|
||||
}
|
||||
break;
|
||||
case MENU_DISPLAY_CTL_DRAW_PIPELINE:
|
||||
{
|
||||
menu_display_ctx_draw_t *draw = (menu_display_ctx_draw_t*)data;
|
||||
struct uniform_info uniform_param = {0};
|
||||
static float t = 0;
|
||||
video_shader_ctx_info_t shader_info;
|
||||
gfx_coord_array_t *ca = NULL;
|
||||
|
||||
menu_display_ctl(MENU_DISPLAY_CTL_COORDS_ARRAY_GET, &ca);
|
||||
|
||||
draw->x = 0;
|
||||
draw->y = 0;
|
||||
draw->coords = (struct gfx_coords*)(&ca->coords);
|
||||
draw->matrix_data = NULL;
|
||||
|
||||
#if defined(HAVE_GLSL) || defined(HAVE_CG) || defined(HAVE_HLSL)
|
||||
switch (draw->pipeline.id)
|
||||
{
|
||||
case VIDEO_SHADER_MENU:
|
||||
case VIDEO_SHADER_MENU_SEC:
|
||||
shader_info.data = NULL;
|
||||
shader_info.idx = draw->pipeline.id;
|
||||
shader_info.set_active = true;
|
||||
|
||||
video_shader_driver_ctl(SHADER_CTL_USE, &shader_info);
|
||||
|
||||
t += 0.01;
|
||||
|
||||
uniform_param.enabled = true;
|
||||
uniform_param.lookup.enable = true;
|
||||
uniform_param.lookup.add_prefix = true;
|
||||
uniform_param.lookup.idx = VIDEO_SHADER_MENU;
|
||||
uniform_param.lookup.type = SHADER_PROGRAM_VERTEX;
|
||||
uniform_param.type = UNIFORM_1F;
|
||||
uniform_param.lookup.ident = "time";
|
||||
uniform_param.result.f.v0 = t;
|
||||
|
||||
video_shader_driver_ctl(SHADER_CTL_SET_PARAMETER, &uniform_param);
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
menu_display_ctl(MENU_DISPLAY_CTL_DRAW, draw);
|
||||
menu_display_ctl(MENU_DISPLAY_CTL_DRAW, draw);
|
||||
}
|
||||
break;
|
||||
case MENU_DISPLAY_CTL_ROTATE_Z:
|
||||
|
@ -152,6 +152,7 @@ typedef struct menu_display_ctx_datetime
|
||||
typedef struct menu_display_ctx_driver
|
||||
{
|
||||
void (*draw)(void *data);
|
||||
void (*draw_pipeline)(void *data);
|
||||
void (*viewport)(void *data);
|
||||
void (*blend_begin)(void);
|
||||
void (*blend_end)(void);
|
||||
|
Loading…
x
Reference in New Issue
Block a user