Add GFX_CTL_IMAGE_BUFFER_INIT

This commit is contained in:
twinaphex 2016-02-13 18:51:16 +01:00
parent ef6ef13143
commit 7c28ddbfc5
4 changed files with 8 additions and 11 deletions

View File

@ -1344,7 +1344,7 @@ static void gl_init_textures(gl_t *gl, const video_info_t *video)
#if defined(HAVE_EGL) && defined(HAVE_OPENGLES2)
/* Use regular textures if we use HW render. */
gl->egl_images = !gl->hw_render_use && gl_check_eglimage_proc() &&
gfx_ctx_image_buffer_init(video);
gfx_ctx_ctl(GFX_CTL_IMAGE_BUFFER_INIT, video);
#else
(void)video;
#endif

View File

@ -172,7 +172,7 @@ static void *vg_init(const video_info_t *video, const input_driver_t **input, vo
}
}
if (vg_query_extension("KHR_EGL_image") && gfx_ctx_image_buffer_init(video))
if (vg_query_extension("KHR_EGL_image") && gfx_ctx_ctl(GFX_CTL_IMAGE_BUFFER_INIT, video))
{
pvgCreateEGLImageTargetKHR = (PFNVGCREATEEGLIMAGETARGETKHRPROC)gfx_ctx_get_proc_address("vgCreateEGLImageTargetKHR");

View File

@ -128,12 +128,6 @@ bool gfx_ctx_get_metrics(enum display_metric_types type, float *value)
value);
}
bool gfx_ctx_image_buffer_init(const video_info_t* info)
{
if (!current_video_context || !current_video_context->image_buffer_init)
return false;
return current_video_context->image_buffer_init(video_context_data, info);
}
bool gfx_ctx_image_buffer_write(const void *frame, unsigned width,
unsigned height, unsigned pitch, bool rgb32,
@ -369,6 +363,10 @@ bool gfx_ctx_ctl(enum gfx_ctx_ctl_state state, void *data)
{
switch (state)
{
case GFX_CTL_IMAGE_BUFFER_INIT:
if (!current_video_context || !current_video_context->image_buffer_init)
return false;
return current_video_context->image_buffer_init(video_context_data, (const video_info_t*)data);
case GFX_CTL_GET_VIDEO_OUTPUT_PREV:
if (!current_video_context
|| !current_video_context->get_video_output_prev)

View File

@ -64,7 +64,8 @@ enum gfx_ctx_ctl_state
GFX_CTL_SET,
GFX_CTL_BIND_HW_RENDER,
GFX_CTL_GET_VIDEO_OUTPUT_PREV,
GFX_CTL_GET_VIDEO_OUTPUT_NEXT
GFX_CTL_GET_VIDEO_OUTPUT_NEXT,
GFX_CTL_IMAGE_BUFFER_INIT
};
typedef void (*gfx_ctx_proc_t)(void);
@ -222,8 +223,6 @@ void gfx_ctx_translate_aspect(float *aspect,
bool gfx_ctx_set_video_mode(unsigned width, unsigned height,
bool fullscreen);
bool gfx_ctx_image_buffer_init(const video_info_t *info);
bool gfx_ctx_image_buffer_write(const void *frame,
unsigned width, unsigned height, unsigned pitch, bool rgb32,
unsigned index, void **image_handle);