Create RARCH_DISPLAY_CTL_SET_STUB_FRAME/UNSET_STUB_FRAME

This commit is contained in:
twinaphex 2015-12-07 21:16:15 +01:00
parent 1e522f4035
commit 9736713279
2 changed files with 22 additions and 8 deletions

View File

@ -91,7 +91,7 @@ static enum rarch_display_type video_driver_display_type;
static uint64_t video_driver_frame_count;
static void *video_driver_data;
static const video_driver_t *current_video;
static video_driver_t *current_video;
/* Interface for "poking". */
static const video_poke_interface_t *video_driver_poke;
@ -247,7 +247,7 @@ static bool find_video_driver(void)
if (frontend_driver_has_get_video_driver_func())
{
current_video = frontend_driver_get_video_driver();
current_video = (video_driver_t*)frontend_driver_get_video_driver();
if (current_video)
return true;
@ -256,7 +256,7 @@ static bool find_video_driver(void)
i = find_driver_index("video_driver", settings->video.driver);
if (i >= 0)
current_video = (const video_driver_t*)video_driver_find_handle(i);
current_video = (video_driver_t*)video_driver_find_handle(i);
else
{
unsigned d;
@ -267,7 +267,7 @@ static bool find_video_driver(void)
RARCH_LOG_OUTPUT("\t%s\n", video_driver_find_ident(d));
RARCH_WARN("Going to default to first video driver...\n");
current_video = (const video_driver_t*)video_driver_find_handle(0);
current_video = (video_driver_t*)video_driver_find_handle(0);
if (!current_video)
retro_fail(1, "find_video_driver()");
@ -704,7 +704,7 @@ static bool init_video(void)
/* Can't do hardware rendering with threaded driver currently. */
RARCH_LOG("Starting threaded video driver ...\n");
if (!rarch_threaded_video_init(&current_video, &video_driver_data,
if (!rarch_threaded_video_init((const video_driver_t**)&current_video, &video_driver_data,
input_get_double_ptr(), input_driver_get_data_ptr(),
current_video, &video))
{
@ -1385,6 +1385,7 @@ bool video_driver_ctl(enum rarch_display_ctl_state state, void *data)
static bool video_driver_use_rgba = false;
static bool video_driver_data_own = false;
static bool video_driver_active = false;
static video_driver_frame_t frame_bak = NULL;
/* If set during context deinit, the driver should keep
* graphics context alive to avoid having to reset all
* context state. */
@ -1407,6 +1408,15 @@ bool video_driver_ctl(enum rarch_display_ctl_state state, void *data)
video_driver_record_gpu_buffer = NULL;
current_video = NULL;
break;
case RARCH_DISPLAY_CTL_SET_STUB_FRAME:
frame_bak = current_video->frame;
current_video->frame = video_null.frame;
break;
case RARCH_DISPLAY_CTL_UNSET_STUB_FRAME:
if (frame_bak != NULL)
current_video->frame = frame_bak;
frame_bak = NULL;
break;
case RARCH_DISPLAY_CTL_SUPPORTS_RECORDING:
return settings->video.gpu_record && current_video->read_viewport;
case RARCH_DISPLAY_CTL_SUPPORTS_VIEWPORT_READ:

View File

@ -129,6 +129,8 @@ enum rarch_display_ctl_state
RARCH_DISPLAY_CTL_RESET_CUSTOM_VIEWPORT,
RARCH_DISPLAY_CTL_READ_VIEWPORT,
RARCH_DISPLAY_CTL_SET_NONBLOCK_STATE,
RARCH_DISPLAY_CTL_SET_STUB_FRAME,
RARCH_DISPLAY_CTL_UNSET_STUB_FRAME,
/* Renders the current video frame. */
RARCH_DISPLAY_CTL_CACHED_FRAME_RENDER,
RARCH_DISPLAY_CTL_CACHED_FRAME_HAS_VALID_FB,
@ -223,6 +225,10 @@ typedef struct video_viewport
unsigned full_height;
} video_viewport_t;
/* msg is for showing a message on the screen along with the video frame. */
typedef bool (*video_driver_frame_t)(void *data, const void *frame, unsigned width,
unsigned height, uint64_t frame_count, unsigned pitch, const char *msg);
typedef struct video_driver
{
/* Should the video driver act as an input driver as well?
@ -232,9 +238,7 @@ typedef struct video_driver
void *(*init)(const video_info_t *video, const input_driver_t **input,
void **input_data);
/* 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, uint64_t frame_count, unsigned pitch, const char *msg);
video_driver_frame_t frame;
/* Should we care about syncing to vblank? Fast forwarding. */
void (*set_nonblock_state)(void *data, bool toggle);