Create GFX_CTL_PROC_ADDRESS_GET

This commit is contained in:
twinaphex 2016-02-13 22:02:49 +01:00
parent 39bc6c1e9e
commit f94e9c532e
4 changed files with 25 additions and 12 deletions

View File

@ -3307,7 +3307,13 @@ static uintptr_t gl_get_current_framebuffer(void *data)
static retro_proc_address_t gl_get_proc_address(void *data, const char *sym)
{
return gfx_ctx_get_proc_address(sym);
gfx_ctx_proc_address_t proc_address;
proc_address.sym = sym;
gfx_ctx_ctl(GFX_CTL_PROC_ADDRESS_GET, &proc_address);
return proc_address.addr;
}
static void gl_set_aspect_ratio(void *data, unsigned aspect_ratio_idx)

View File

@ -177,7 +177,13 @@ static void *vg_init(const video_info_t *video, const input_driver_t **input, vo
if (vg_query_extension("KHR_EGL_image") && gfx_ctx_ctl(GFX_CTL_IMAGE_BUFFER_INIT, video))
{
pvgCreateEGLImageTargetKHR = (PFNVGCREATEEGLIMAGETARGETKHRPROC)gfx_ctx_get_proc_address("vgCreateEGLImageTargetKHR");
gfx_ctx_proc_address_t proc_address;
proc_address.sym = "vgCreateEGLImageTargetKHR";
gfx_ctx_ctl(GFX_CTL_PROC_ADDRESS_GET, &proc_address);
pvgCreateEGLImageTargetKHR = (PFNVGCREATEEGLIMAGETARGETKHRPROC)proc_address.addr;
if (pvgCreateEGLImageTargetKHR)
{

View File

@ -132,10 +132,6 @@ bool gfx_ctx_image_buffer_write(const void *frame, unsigned width,
rgb32, index, image_handle);
}
retro_proc_address_t gfx_ctx_get_proc_address(const char *sym)
{
return current_video_context->get_proc_address(sym);
}
bool gfx_ctx_suppress_screensaver(bool enable)
{
@ -434,6 +430,15 @@ bool gfx_ctx_ctl(enum gfx_ctx_ctl_state state, void *data)
current_video_context->swap_interval(video_context_data, *interval);
}
break;
case GFX_CTL_PROC_ADDRESS_GET:
{
gfx_ctx_proc_address_t *proc = (gfx_ctx_proc_address_t*)data;
if (!current_video_context || !current_video_context->get_proc_address)
return false;
proc->addr = current_video_context->get_proc_address(proc->sym);
}
break;
case GFX_CTL_NONE:
default:
break;

View File

@ -72,7 +72,8 @@ enum gfx_ctx_ctl_state
/* Finds previous driver in graphics context driver array. */
GFX_CTL_FIND_PREV_DRIVER,
GFX_CTL_GET_VIDEO_OUTPUT_SIZE,
GFX_CTL_SWAP_INTERVAL
GFX_CTL_SWAP_INTERVAL,
GFX_CTL_PROC_ADDRESS_GET
};
typedef void (*gfx_ctx_proc_t)(void);
@ -251,18 +252,15 @@ extern const gfx_ctx_driver_t gfx_ctx_null;
**/
const gfx_ctx_driver_t *gfx_ctx_init_first(void *data, const char *ident,
enum gfx_ctx_api api, unsigned major, unsigned minor, bool hw_render_ctx);
bool gfx_ctx_get_metrics(enum display_metric_types type, float *value);
void gfx_ctx_translate_aspect(float *aspect,
unsigned width, unsigned height);
bool gfx_ctx_set_video_mode(unsigned width, unsigned height,
bool fullscreen);
bool gfx_ctx_image_buffer_write(const void *frame,
unsigned width, unsigned height, unsigned pitch, bool rgb32,
unsigned index, void **image_handle);
@ -278,8 +276,6 @@ const char *gfx_ctx_get_ident(void);
void gfx_ctx_input_driver(
const input_driver_t **input, void **input_data);
retro_proc_address_t gfx_ctx_get_proc_address(const char *sym);
bool gfx_ctx_ctl(enum gfx_ctx_ctl_state state, void *data);
#ifdef __cplusplus