Add RARCH_DISPLAY_CTL_READ_VIEWPORT

This commit is contained in:
twinaphex 2015-11-20 15:41:20 +01:00
parent d8eeed0a9e
commit 09dda14549
4 changed files with 13 additions and 14 deletions

View File

@ -716,16 +716,6 @@ bool video_driver_viewport_info(struct video_viewport *vp)
return false;
}
bool video_driver_read_viewport(uint8_t *buffer)
{
driver_t *driver = driver_get_ptr();
const video_driver_t *video = video_driver_ctx_get_ptr(driver);
if (video && video->read_viewport)
return video->read_viewport(driver->video_data,
buffer);
return false;
}
#ifdef HAVE_OVERLAY
bool video_driver_overlay_interface(const video_overlay_interface_t **iface)
@ -1181,6 +1171,16 @@ bool video_driver_ctl(enum rarch_display_ctl_state state, void *data)
switch (state)
{
case RARCH_DISPLAY_CTL_READ_VIEWPORT:
{
driver_t *driver = driver_get_ptr();
const video_driver_t *video = video_driver_ctx_get_ptr(driver);
if (video && video->read_viewport)
return video->read_viewport(driver->video_data,
(uint8_t*)data);
return false;
}
case RARCH_DISPLAY_CTL_CACHED_FRAME_HAS_VALID_FB:
if (!video_state.frame_cache.data)
return false;

View File

@ -225,6 +225,7 @@ enum rarch_display_ctl_state
RARCH_DISPLAY_CTL_FRAME_FILTER_IS_32BIT,
RARCH_DISPLAY_CTL_HAS_WINDOWED,
RARCH_DISPLAY_CTL_IS_FOCUSED,
RARCH_DISPLAY_CTL_READ_VIEWPORT,
/* Renders the current video frame. */
RARCH_DISPLAY_CTL_CACHED_FRAME_RENDER,
RARCH_DISPLAY_CTL_CACHED_FRAME_HAS_VALID_FB,
@ -316,8 +317,6 @@ void video_driver_set_texture_frame(const void *frame, bool rgb32,
bool video_driver_viewport_info(struct video_viewport *vp);
bool video_driver_read_viewport(uint8_t *buffer);
bool video_driver_set_shader(enum rarch_shader_type type,
const char *path);

View File

@ -205,7 +205,7 @@ void recording_dump_frame(const void *data, unsigned width,
/* Big bottleneck.
* Since we might need to do read-backs asynchronously,
* it might take 3-4 times before this returns true. */
if (!video_driver_read_viewport(global->record.gpu_buffer))
if (!video_driver_ctl(RARCH_DISPLAY_CTL_READ_VIEWPORT, global->record.gpu_buffer))
return;
ffemu_data.pitch = global->record.gpu_width * 3;

View File

@ -143,7 +143,7 @@ static bool take_screenshot_viewport(void)
if (!(buffer = (uint8_t*)malloc(vp.width * vp.height * 3)))
return false;
if (!video_driver_read_viewport(buffer))
if (!video_driver_ctl(RARCH_DISPLAY_CTL_READ_VIEWPORT, buffer))
goto done;
screenshot_dir = settings->screenshot_directory;