mirror of
https://github.com/libretro/RetroArch
synced 2025-03-01 07:13:35 +00:00
Overlay works in thread_video.
This commit is contained in:
parent
cfd0984d92
commit
2cd60e0551
@ -32,6 +32,15 @@ enum thread_cmd
|
|||||||
CMD_READ_VIEWPORT,
|
CMD_READ_VIEWPORT,
|
||||||
CMD_SET_NONBLOCK,
|
CMD_SET_NONBLOCK,
|
||||||
|
|
||||||
|
#ifdef HAVE_OVERLAY
|
||||||
|
CMD_OVERLAY_ENABLE,
|
||||||
|
CMD_OVERLAY_LOAD,
|
||||||
|
CMD_OVERLAY_TEX_GEOM,
|
||||||
|
CMD_OVERLAY_VERTEX_GEOM,
|
||||||
|
CMD_OVERLAY_FULL_SCREEN,
|
||||||
|
CMD_OVERLAY_SET_ALPHA,
|
||||||
|
#endif
|
||||||
|
|
||||||
CMD_DUMMY = INT_MAX
|
CMD_DUMMY = INT_MAX
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -44,6 +53,7 @@ typedef struct thread_video
|
|||||||
|
|
||||||
video_info_t info;
|
video_info_t info;
|
||||||
const video_driver_t *driver;
|
const video_driver_t *driver;
|
||||||
|
const video_overlay_interface_t *overlay;
|
||||||
void *driver_data;
|
void *driver_data;
|
||||||
const input_driver_t **input;
|
const input_driver_t **input;
|
||||||
void **input_data;
|
void **input_data;
|
||||||
@ -57,6 +67,7 @@ typedef struct thread_video
|
|||||||
{
|
{
|
||||||
bool b;
|
bool b;
|
||||||
int i;
|
int i;
|
||||||
|
float f;
|
||||||
const char *str;
|
const char *str;
|
||||||
void *v;
|
void *v;
|
||||||
|
|
||||||
@ -66,6 +77,18 @@ typedef struct thread_video
|
|||||||
const char *path;
|
const char *path;
|
||||||
unsigned index;
|
unsigned index;
|
||||||
} set_shader;
|
} set_shader;
|
||||||
|
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
float x, y, w, h;
|
||||||
|
} rect;
|
||||||
|
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
const uint32_t *data;
|
||||||
|
unsigned width;
|
||||||
|
unsigned height;
|
||||||
|
} image;
|
||||||
} cmd_data;
|
} cmd_data;
|
||||||
|
|
||||||
struct rarch_viewport vp;
|
struct rarch_viewport vp;
|
||||||
@ -178,6 +201,49 @@ static void thread_loop(void *data)
|
|||||||
thread_reply(thr, CMD_ALIVE);
|
thread_reply(thr, CMD_ALIVE);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
#ifdef HAVE_OVERLAY
|
||||||
|
case CMD_OVERLAY_ENABLE:
|
||||||
|
thr->overlay->enable(thr->driver_data, thr->cmd_data.b);
|
||||||
|
thread_reply(thr, CMD_OVERLAY_ENABLE);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case CMD_OVERLAY_LOAD:
|
||||||
|
thr->cmd_data.b = thr->overlay->load(thr->driver_data,
|
||||||
|
thr->cmd_data.image.data,
|
||||||
|
thr->cmd_data.image.width,
|
||||||
|
thr->cmd_data.image.height);
|
||||||
|
thread_reply(thr, CMD_OVERLAY_LOAD);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case CMD_OVERLAY_TEX_GEOM:
|
||||||
|
thr->overlay->tex_geom(thr->driver_data,
|
||||||
|
thr->cmd_data.rect.x,
|
||||||
|
thr->cmd_data.rect.y,
|
||||||
|
thr->cmd_data.rect.w,
|
||||||
|
thr->cmd_data.rect.h);
|
||||||
|
thread_reply(thr, CMD_OVERLAY_TEX_GEOM);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case CMD_OVERLAY_VERTEX_GEOM:
|
||||||
|
thr->overlay->vertex_geom(thr->driver_data,
|
||||||
|
thr->cmd_data.rect.x,
|
||||||
|
thr->cmd_data.rect.y,
|
||||||
|
thr->cmd_data.rect.w,
|
||||||
|
thr->cmd_data.rect.h);
|
||||||
|
thread_reply(thr, CMD_OVERLAY_VERTEX_GEOM);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case CMD_OVERLAY_FULL_SCREEN:
|
||||||
|
thr->overlay->full_screen(thr->driver_data, thr->cmd_data.b);
|
||||||
|
thread_reply(thr, CMD_OVERLAY_FULL_SCREEN);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case CMD_OVERLAY_SET_ALPHA:
|
||||||
|
thr->overlay->set_alpha(thr->driver_data, thr->cmd_data.f);
|
||||||
|
thread_reply(thr, CMD_OVERLAY_SET_ALPHA);
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
|
||||||
default:
|
default:
|
||||||
thread_reply(thr, thr->send_cmd);
|
thread_reply(thr, thr->send_cmd);
|
||||||
break;
|
break;
|
||||||
@ -390,47 +456,59 @@ static void thread_free(void *data)
|
|||||||
#ifdef HAVE_OVERLAY
|
#ifdef HAVE_OVERLAY
|
||||||
static void thread_overlay_enable(void *data, bool state)
|
static void thread_overlay_enable(void *data, bool state)
|
||||||
{
|
{
|
||||||
(void)data;
|
thread_video_t *thr = (thread_video_t*)data;
|
||||||
(void)state;
|
thr->cmd_data.b = state;
|
||||||
|
thread_send_cmd(thr, CMD_OVERLAY_ENABLE);
|
||||||
|
thread_wait_reply(thr, CMD_OVERLAY_ENABLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool thread_overlay_load(void *data, const uint32_t *image, unsigned width, unsigned height)
|
static bool thread_overlay_load(void *data, const uint32_t *image, unsigned width, unsigned height)
|
||||||
{
|
{
|
||||||
(void)data;
|
thread_video_t *thr = (thread_video_t*)data;
|
||||||
(void)image;
|
thr->cmd_data.image.data = image;
|
||||||
(void)width;
|
thr->cmd_data.image.width = width;
|
||||||
(void)height;
|
thr->cmd_data.image.height = height;
|
||||||
return false;
|
thread_send_cmd(thr, CMD_OVERLAY_LOAD);
|
||||||
|
thread_wait_reply(thr, CMD_OVERLAY_LOAD);
|
||||||
|
return thr->cmd_data.b;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void thread_overlay_tex_geom(void *data, float x, float y, float w, float h)
|
static void thread_overlay_tex_geom(void *data, float x, float y, float w, float h)
|
||||||
{
|
{
|
||||||
(void)data;
|
thread_video_t *thr = (thread_video_t*)data;
|
||||||
(void)x;
|
thr->cmd_data.rect.x = x;
|
||||||
(void)y;
|
thr->cmd_data.rect.y = y;
|
||||||
(void)w;
|
thr->cmd_data.rect.w = w;
|
||||||
(void)h;
|
thr->cmd_data.rect.h = h;
|
||||||
|
thread_send_cmd(thr, CMD_OVERLAY_TEX_GEOM);
|
||||||
|
thread_wait_reply(thr, CMD_OVERLAY_TEX_GEOM);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void thread_overlay_vertex_geom(void *data, float x, float y, float w, float h)
|
static void thread_overlay_vertex_geom(void *data, float x, float y, float w, float h)
|
||||||
{
|
{
|
||||||
(void)data;
|
thread_video_t *thr = (thread_video_t*)data;
|
||||||
(void)x;
|
thr->cmd_data.rect.x = x;
|
||||||
(void)y;
|
thr->cmd_data.rect.y = y;
|
||||||
(void)w;
|
thr->cmd_data.rect.w = w;
|
||||||
(void)h;
|
thr->cmd_data.rect.h = h;
|
||||||
|
thread_send_cmd(thr, CMD_OVERLAY_VERTEX_GEOM);
|
||||||
|
thread_wait_reply(thr, CMD_OVERLAY_VERTEX_GEOM);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void thread_overlay_full_screen(void *data, bool enable)
|
static void thread_overlay_full_screen(void *data, bool enable)
|
||||||
{
|
{
|
||||||
(void)data;
|
thread_video_t *thr = (thread_video_t*)data;
|
||||||
(void)enable;
|
thr->cmd_data.b = enable;
|
||||||
|
thread_send_cmd(thr, CMD_OVERLAY_FULL_SCREEN);
|
||||||
|
thread_wait_reply(thr, CMD_OVERLAY_FULL_SCREEN);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void thread_overlay_set_alpha(void *data, float mod)
|
static void thread_overlay_set_alpha(void *data, float mod)
|
||||||
{
|
{
|
||||||
(void)data;
|
thread_video_t *thr = (thread_video_t*)data;
|
||||||
(void)mod;
|
thr->cmd_data.f = mod;
|
||||||
|
thread_send_cmd(thr, CMD_OVERLAY_SET_ALPHA);
|
||||||
|
thread_wait_reply(thr, CMD_OVERLAY_SET_ALPHA);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const video_overlay_interface_t thread_overlay = {
|
static const video_overlay_interface_t thread_overlay = {
|
||||||
@ -444,8 +522,9 @@ static const video_overlay_interface_t thread_overlay = {
|
|||||||
|
|
||||||
static void thread_get_overlay_interface(void *data, const video_overlay_interface_t **iface)
|
static void thread_get_overlay_interface(void *data, const video_overlay_interface_t **iface)
|
||||||
{
|
{
|
||||||
(void)data;
|
thread_video_t *thr = (thread_video_t*)data;
|
||||||
*iface = &thread_overlay;
|
*iface = &thread_overlay;
|
||||||
|
thr->driver->overlay_interface(thr->driver_data, &thr->overlay);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user