Add set_rgui_texture interface to video_poke.
This commit is contained in:
parent
e741cc77c6
commit
63d946c69f
6
driver.h
6
driver.h
|
@ -234,12 +234,16 @@ typedef struct video_poke_interface
|
||||||
void (*set_filtering)(void *data, unsigned index, bool smooth);
|
void (*set_filtering)(void *data, unsigned index, bool smooth);
|
||||||
void (*set_fbo_state)(void *data, unsigned state);
|
void (*set_fbo_state)(void *data, unsigned state);
|
||||||
void (*set_aspect_ratio)(void *data, unsigned aspectratio_index);
|
void (*set_aspect_ratio)(void *data, unsigned aspectratio_index);
|
||||||
|
|
||||||
|
// Set to NULL if RGUI texture is not supposed to be rendered.
|
||||||
|
void (*set_rgui_texture)(void *data, const void *frame);
|
||||||
} video_poke_interface_t;
|
} video_poke_interface_t;
|
||||||
|
|
||||||
typedef struct video_driver
|
typedef struct video_driver
|
||||||
{
|
{
|
||||||
void *(*init)(const video_info_t *video, const input_driver_t **input, void **input_data);
|
void *(*init)(const video_info_t *video, const input_driver_t **input, void **input_data);
|
||||||
// Should the video driver act as an input driver as well? :) The video init might preinitialize an input driver to override the settings in case the video driver relies on input driver for event handling, e.g.
|
// Should the video driver act as an input driver as well? :)
|
||||||
|
// The video init might preinitialize an input driver to override the settings in case the video driver relies on input driver for event handling, e.g.
|
||||||
bool (*frame)(void *data, const void *frame, unsigned width, unsigned height, unsigned pitch, const char *msg); // msg is for showing a message on the screen along with the video frame.
|
bool (*frame)(void *data, const void *frame, unsigned width, unsigned height, unsigned pitch, const char *msg); // msg is for showing a message on the screen along with the video frame.
|
||||||
void (*set_nonblock_state)(void *data, bool toggle); // Should we care about syncing to vblank? Fast forwarding.
|
void (*set_nonblock_state)(void *data, bool toggle); // Should we care about syncing to vblank? Fast forwarding.
|
||||||
// Is the window still active?
|
// Is the window still active?
|
||||||
|
|
|
@ -1594,10 +1594,6 @@ RMENU API
|
||||||
|
|
||||||
void menu_init(void)
|
void menu_init(void)
|
||||||
{
|
{
|
||||||
DECLARE_DEVICE_PTR();
|
|
||||||
|
|
||||||
device_ptr->menu_data = (uint32_t *) menu_framebuf;
|
|
||||||
|
|
||||||
rgui = rgui_init("",
|
rgui = rgui_init("",
|
||||||
menu_framebuf, RGUI_WIDTH * sizeof(uint16_t),
|
menu_framebuf, RGUI_WIDTH * sizeof(uint16_t),
|
||||||
NULL, bitmap_bin, folder_cb, NULL);
|
NULL, bitmap_bin, folder_cb, NULL);
|
||||||
|
@ -1767,7 +1763,9 @@ bool menu_iterate(void)
|
||||||
input_entry_ret = rgui_iterate(rgui, action);
|
input_entry_ret = rgui_iterate(rgui, action);
|
||||||
|
|
||||||
// draw last frame for loading messages
|
// draw last frame for loading messages
|
||||||
|
driver.video_poke->set_rgui_texture(driver.video_data, menu_framebuf);
|
||||||
rarch_render_cached_frame();
|
rarch_render_cached_frame();
|
||||||
|
driver.video_poke->set_rgui_texture(driver.video_data, NULL);
|
||||||
|
|
||||||
input_process_ret = menu_input_process(NULL, NULL);
|
input_process_ret = menu_input_process(NULL, NULL);
|
||||||
|
|
||||||
|
|
15
gfx/gl.c
15
gfx/gl.c
|
@ -1270,7 +1270,7 @@ static inline void gl_draw_rgui(void *data)
|
||||||
// RGUI is always packed so pitch = width * bpp
|
// RGUI is always packed so pitch = width * bpp
|
||||||
glTexImage2D(GL_TEXTURE_2D,
|
glTexImage2D(GL_TEXTURE_2D,
|
||||||
0, GL_RGBA, RGUI_WIDTH, RGUI_HEIGHT, 0, GL_RGBA,
|
0, GL_RGBA, RGUI_WIDTH, RGUI_HEIGHT, 0, GL_RGBA,
|
||||||
GL_UNSIGNED_SHORT_4_4_4_4, gl->menu_data);
|
GL_UNSIGNED_SHORT_4_4_4_4, gl->rgui_data);
|
||||||
|
|
||||||
gl_shader_use_func(gl, 0);
|
gl_shader_use_func(gl, 0);
|
||||||
gl_shader_set_coords_func(gl, &gl->coords, &gl->mvp_no_rot);
|
gl_shader_set_coords_func(gl, &gl->coords, &gl->mvp_no_rot);
|
||||||
|
@ -1356,7 +1356,7 @@ static bool gl_frame(void *data, const void *frame, unsigned width, unsigned hei
|
||||||
gl_set_prev_texture(gl, &tex_info);
|
gl_set_prev_texture(gl, &tex_info);
|
||||||
|
|
||||||
#ifdef HAVE_RGUI
|
#ifdef HAVE_RGUI
|
||||||
if (lifecycle_mode_state & (1ULL << MODE_MENU_DRAW))
|
if (gl->rgui_data)
|
||||||
gl_draw_rgui(gl);
|
gl_draw_rgui(gl);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -2286,11 +2286,22 @@ static void gl_set_blend(void *data, bool enable)
|
||||||
glDisable(GL_BLEND);
|
glDisable(GL_BLEND);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_RGUI
|
||||||
|
static void gl_set_rgui_texture(void *data, const void *frame)
|
||||||
|
{
|
||||||
|
gl_t *gl = (gl_t*)data;
|
||||||
|
gl->rgui_data = frame;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static const video_poke_interface_t gl_poke_interface = {
|
static const video_poke_interface_t gl_poke_interface = {
|
||||||
gl_set_blend,
|
gl_set_blend,
|
||||||
gl_set_filtering,
|
gl_set_filtering,
|
||||||
gl_set_fbo_state,
|
gl_set_fbo_state,
|
||||||
gl_set_aspect_ratio,
|
gl_set_aspect_ratio,
|
||||||
|
#ifdef HAVE_RGUI
|
||||||
|
gl_set_rgui_texture,
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
static void gl_get_poke_interface(void *data, const video_poke_interface_t **iface)
|
static void gl_get_poke_interface(void *data, const video_poke_interface_t **iface)
|
||||||
|
|
|
@ -304,7 +304,7 @@ typedef struct gl
|
||||||
|
|
||||||
#ifdef HAVE_RGUI
|
#ifdef HAVE_RGUI
|
||||||
GLuint rgui_texture;
|
GLuint rgui_texture;
|
||||||
uint32_t *menu_data;
|
const void *rgui_data;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
} gl_t;
|
} gl_t;
|
||||||
|
|
|
@ -68,6 +68,10 @@ typedef struct thread_video
|
||||||
const input_driver_t **input;
|
const input_driver_t **input;
|
||||||
void **input_data;
|
void **input_data;
|
||||||
|
|
||||||
|
#ifdef HAVE_RGUI
|
||||||
|
const void *rgui_texture;
|
||||||
|
#endif
|
||||||
|
|
||||||
bool alive;
|
bool alive;
|
||||||
bool focus;
|
bool focus;
|
||||||
|
|
||||||
|
@ -292,6 +296,11 @@ static void thread_loop(void *data)
|
||||||
if (updated)
|
if (updated)
|
||||||
{
|
{
|
||||||
slock_lock(thr->frame.lock);
|
slock_lock(thr->frame.lock);
|
||||||
|
|
||||||
|
#ifdef HAVE_RGUI
|
||||||
|
thr->poke->set_rgui_texture(thr->driver_data, thr->rgui_texture);
|
||||||
|
#endif
|
||||||
|
|
||||||
bool ret = thr->driver->frame(thr->driver_data,
|
bool ret = thr->driver->frame(thr->driver_data,
|
||||||
thr->frame.buffer, thr->frame.width, thr->frame.height,
|
thr->frame.buffer, thr->frame.width, thr->frame.height,
|
||||||
thr->frame.pitch, *thr->frame.msg ? thr->frame.msg : NULL);
|
thr->frame.pitch, *thr->frame.msg ? thr->frame.msg : NULL);
|
||||||
|
@ -397,8 +406,7 @@ static bool thread_frame(void *data, const void *frame_,
|
||||||
// we'll want to block to avoid stepping menu
|
// we'll want to block to avoid stepping menu
|
||||||
// at crazy speeds.
|
// at crazy speeds.
|
||||||
#ifdef HAVE_RGUI
|
#ifdef HAVE_RGUI
|
||||||
uint64_t lifecycle_mode_state = g_extern.lifecycle_mode_state;
|
if (thr->rgui_texture)
|
||||||
if (lifecycle_mode_state & (1ULL << MODE_MENU_DRAW))
|
|
||||||
{
|
{
|
||||||
while (thr->frame.updated)
|
while (thr->frame.updated)
|
||||||
scond_wait(thr->cond_cmd, thr->lock);
|
scond_wait(thr->cond_cmd, thr->lock);
|
||||||
|
@ -619,11 +627,25 @@ static void thread_set_aspect_ratio(void *data, unsigned aspectratio_index)
|
||||||
thread_wait_reply(thr, CMD_POKE_SET_ASPECT_RATIO);
|
thread_wait_reply(thr, CMD_POKE_SET_ASPECT_RATIO);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_RGUI
|
||||||
|
static void thread_set_rgui_texture(void *data, const void *frame)
|
||||||
|
{
|
||||||
|
thread_video_t *thr = (thread_video_t*)data;
|
||||||
|
|
||||||
|
slock_lock(thr->frame.lock);
|
||||||
|
thr->rgui_texture = frame;
|
||||||
|
slock_unlock(thr->frame.lock);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static const video_poke_interface_t thread_poke = {
|
static const video_poke_interface_t thread_poke = {
|
||||||
thread_set_blend,
|
thread_set_blend,
|
||||||
thread_set_filtering,
|
thread_set_filtering,
|
||||||
thread_set_fbo_state,
|
thread_set_fbo_state,
|
||||||
thread_set_aspect_ratio,
|
thread_set_aspect_ratio,
|
||||||
|
#ifdef HAVE_RGUI
|
||||||
|
thread_set_rgui_texture,
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
static void thread_get_poke_interface(void *data, const video_poke_interface_t **iface)
|
static void thread_get_poke_interface(void *data, const video_poke_interface_t **iface)
|
||||||
|
|
|
@ -920,7 +920,7 @@ static bool gx_frame(void *data, const void *frame,
|
||||||
DCFlushRange(g_tex.data, height * (width << (gx->rgb32 ? 2 : 1)));
|
DCFlushRange(g_tex.data, height * (width << (gx->rgb32 ? 2 : 1)));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lifecycle_mode_state & (1ULL << MODE_MENU_DRAW))
|
if (gx->menu_data)
|
||||||
{
|
{
|
||||||
convert_texture16(gx->menu_data, menu_tex.data, RGUI_WIDTH, RGUI_HEIGHT, RGUI_WIDTH * 2);
|
convert_texture16(gx->menu_data, menu_tex.data, RGUI_WIDTH, RGUI_HEIGHT, RGUI_WIDTH * 2);
|
||||||
DCFlushRange(menu_tex.data, RGUI_WIDTH * RGUI_HEIGHT * 2);
|
DCFlushRange(menu_tex.data, RGUI_WIDTH * RGUI_HEIGHT * 2);
|
||||||
|
@ -1009,8 +1009,7 @@ static void gx_free(void *data)
|
||||||
|
|
||||||
static void gx_set_rotation(void *data, unsigned orientation)
|
static void gx_set_rotation(void *data, unsigned orientation)
|
||||||
{
|
{
|
||||||
(void)data;
|
gx_video_t *gx = (gx_video_t*)data;
|
||||||
gx_video_t *gx = (gx_video_t*)driver.video_data;
|
|
||||||
g_orientation = orientation;
|
g_orientation = orientation;
|
||||||
gx->should_resize = true;
|
gx->should_resize = true;
|
||||||
}
|
}
|
||||||
|
@ -1026,11 +1025,18 @@ static bool gx_set_shader(void *data, enum rarch_shader_type type, const char *p
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void gx_set_rgui_texture(void *data, const void *frame)
|
||||||
|
{
|
||||||
|
gx_video_t *gx = (gx_video_t*)data;
|
||||||
|
gx->menu_data = (uint32_t*)frame;
|
||||||
|
}
|
||||||
|
|
||||||
static const video_poke_interface_t gx_poke_interface = {
|
static const video_poke_interface_t gx_poke_interface = {
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
gx_set_aspect_ratio,
|
gx_set_aspect_ratio,
|
||||||
|
gx_set_rgui_texture,
|
||||||
};
|
};
|
||||||
|
|
||||||
static void gx_get_poke_interface(void *data, const video_poke_interface_t **iface)
|
static void gx_get_poke_interface(void *data, const video_poke_interface_t **iface)
|
||||||
|
|
|
@ -24,7 +24,7 @@ typedef struct gx_video
|
||||||
bool keep_aspect;
|
bool keep_aspect;
|
||||||
bool double_strike;
|
bool double_strike;
|
||||||
bool rgb32;
|
bool rgb32;
|
||||||
uint32_t *menu_data;
|
uint32_t *menu_data; // FIXME: Should be const uint16_t*.
|
||||||
unsigned win_width;
|
unsigned win_width;
|
||||||
unsigned win_height;
|
unsigned win_height;
|
||||||
unsigned scale;
|
unsigned scale;
|
||||||
|
|
Loading…
Reference in New Issue