From 8082f17e2e9d5bbee0187dd47cd48d282e1fe2ab Mon Sep 17 00:00:00 2001 From: twinaphex Date: Fri, 10 Apr 2015 09:02:24 +0200 Subject: [PATCH] Rename egl image buffer functions --- gfx/drivers/gl.c | 5 ++--- gfx/drivers/vg.c | 9 ++++----- gfx/drivers_context/vc_egl_ctx.c | 8 ++++---- gfx/video_context_driver.c | 14 +++++++++++--- gfx/video_context_driver.h | 8 +++++--- 5 files changed, 26 insertions(+), 18 deletions(-) diff --git a/gfx/drivers/gl.c b/gfx/drivers/gl.c index 9a042c11f2..af37ee0b40 100644 --- a/gfx/drivers/gl.c +++ b/gfx/drivers/gl.c @@ -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); diff --git a/gfx/drivers/vg.c b/gfx/drivers/vg.c index 266c284015..894c2de784 100644 --- a/gfx/drivers/vg.c +++ b/gfx/drivers/vg.c @@ -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) { diff --git a/gfx/drivers_context/vc_egl_ctx.c b/gfx/drivers_context/vc_egl_ctx.c index 50eacf68e3..38a3996e2e 100644 --- a/gfx/drivers_context/vc_egl_ctx.c +++ b/gfx/drivers_context/vc_egl_ctx.c @@ -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, diff --git a/gfx/video_context_driver.c b/gfx/video_context_driver.c index 8d15a93559..aa3a26e38e 100644 --- a/gfx/video_context_driver.c +++ b/gfx/video_context_driver.c @@ -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; } diff --git a/gfx/video_context_driver.h b/gfx/video_context_driver.h index 8b54dfc3e2..651b9c3e8f 100644 --- a/gfx/video_context_driver.h +++ b/gfx/video_context_driver.h @@ -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);