Rename egl image buffer functions

This commit is contained in:
twinaphex 2015-04-10 09:02:24 +02:00
parent 0fc92790b3
commit 8082f17e2e
5 changed files with 26 additions and 18 deletions

View File

@ -1195,8 +1195,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() &&
ctx && ctx->init_egl_image_buffer
&& ctx->init_egl_image_buffer(gl, video);
gfx_ctx_image_buffer_init(gl, video);
#else
(void)video;
#endif
@ -1281,7 +1280,7 @@ static INLINE void gl_copy_frame(gl_t *gl, const void *frame,
if (gl->egl_images)
{
EGLImageKHR img = 0;
bool new_egl = gfx_ctx_write_egl_image(gl,
bool new_egl = gfx_ctx_image_buffer_write(gl,
frame, width, height, pitch, (gl->base_size == 4),
gl->tex_index, &img);

View File

@ -159,7 +159,7 @@ static void *vg_init(const video_info_t *video, const input_driver_t **input, vo
}
}
if (vg_query_extension("KHR_EGL_image") && ctx->init_egl_image_buffer(vg, video))
if (vg_query_extension("KHR_EGL_image") && gfx_ctx_image_buffer_init(vg, video))
{
pvgCreateEGLImageTargetKHR = (PFNVGCREATEEGLIMAGETARGETKHRPROC)ctx->get_proc_address("vgCreateEGLImageTargetKHR");
@ -344,8 +344,7 @@ static void vg_copy_frame(void *data, const void *frame, unsigned width, unsigne
if (vg->mEglImageBuf)
{
EGLImageKHR img = 0;
const gfx_ctx_driver_t *ctx = gfx_ctx_get_ptr();
bool new_egl = ctx->write_egl_image(vg,
bool new_egl = gfx_ctx_image_buffer_write(vg,
frame, width, height, pitch, (vg->mTexType == VG_sXRGB_8888), 0, &img);
rarch_assert(img != EGL_NO_IMAGE_KHR);
@ -370,10 +369,10 @@ static void vg_copy_frame(void *data, const void *frame, unsigned width, unsigne
static bool vg_frame(void *data, const void *frame, unsigned width, unsigned height, unsigned pitch, const char *msg)
{
vg_t *vg = (vg_t*)data;
RARCH_PERFORMANCE_INIT(vg_fr);
RARCH_PERFORMANCE_START(vg_fr);
vg_t *vg = (vg_t*)data;
const gfx_ctx_driver_t *ctx = gfx_ctx_get_ptr();
if (width != vg->mRenderWidth || height != vg->mRenderHeight || vg->should_resize)
{

View File

@ -498,7 +498,7 @@ static float gfx_ctx_vc_translate_aspect(void *data,
return (float)width / height;
}
static bool gfx_ctx_vc_init_egl_image_buffer(void *data,
static bool gfx_ctx_vc_image_buffer_init(void *data,
const video_info_t *video)
{
EGLBoolean result;
@ -572,7 +572,7 @@ fail:
return false;
}
static bool gfx_ctx_vc_write_egl_image(void *data, const void *frame, unsigned width,
static bool gfx_ctx_vc_image_buffer_write(void *data, const void *frame, unsigned width,
unsigned height, unsigned pitch, bool rgb32, unsigned index, void **image_handle)
{
bool ret = false;
@ -654,8 +654,8 @@ const gfx_ctx_driver_t gfx_ctx_videocore = {
gfx_ctx_vc_swap_buffers,
gfx_ctx_vc_input_driver,
gfx_ctx_vc_get_proc_address,
gfx_ctx_vc_init_egl_image_buffer,
gfx_ctx_vc_write_egl_image,
gfx_ctx_vc_image_buffer_init,
gfx_ctx_vc_image_buffer_write,
NULL,
"videocore",
gfx_ctx_vc_bind_hw_render,

View File

@ -144,13 +144,21 @@ bool gfx_ctx_get_metrics(enum display_metric_types type, float *value)
value);
}
bool gfx_ctx_write_egl_image(void *data, const void *frame, unsigned width,
bool gfx_ctx_image_buffer_init(void *data, const video_info_t* info)
{
const gfx_ctx_driver_t *ctx = gfx_ctx_get_ptr();
if (!ctx)
return false;
return ctx->image_buffer_init(data, info);
}
bool gfx_ctx_image_buffer_write(void *data, const void *frame, unsigned width,
unsigned height, unsigned pitch, bool rgb32,
unsigned index, void **image_handle)
{
const gfx_ctx_driver_t *ctx = gfx_ctx_get_ptr();
if (ctx && ctx->write_egl_image)
return ctx->write_egl_image(data, frame, width, height, pitch,
if (ctx && ctx->image_buffer_write)
return ctx->image_buffer_write(data, frame, width, height, pitch,
rgb32, index, image_handle);
return false;
}

View File

@ -129,13 +129,13 @@ typedef struct gfx_ctx_driver
/* Returns true if this context supports EGLImage buffers for
* screen drawing and was initalized correctly. */
bool (*init_egl_image_buffer)(void*, const video_info_t*);
bool (*image_buffer_init)(void*, const video_info_t*);
/* Writes the frame to the EGLImage and sets image_handle to it.
* Returns true if a new image handle is created.
* Always returns true the first time it's called for a new index.
* The graphics core must handle a change in the handle correctly. */
bool (*write_egl_image)(void*, const void *frame, unsigned width,
bool (*image_buffer_write)(void*, const void *frame, unsigned width,
unsigned height, unsigned pitch, bool rgb32,
unsigned index, void **image_handle);
@ -213,7 +213,9 @@ void gfx_ctx_swap_buffers(void *data);
bool gfx_ctx_focus(void *data);
bool gfx_ctx_write_egl_image(void *data, const void *frame,
bool gfx_ctx_image_buffer_init(void *data, const video_info_t *info);
bool gfx_ctx_image_buffer_write(void *data, const void *frame,
unsigned width, unsigned height, unsigned pitch, bool rgb32,
unsigned index, void **image_handle);