Merge pull request #2546 from heuripedes/master

Fixes
This commit is contained in:
Twinaphex 2015-12-09 06:35:19 +01:00
commit fa58ff0348
6 changed files with 42 additions and 28 deletions

View File

@ -224,7 +224,7 @@ bool egl_init_context(void *data, NativeDisplayType display,
return true;
}
bool egl_create_context(void *data, EGLint *egl_attribs)
bool egl_create_context(void *data, const EGLint *egl_attribs)
{
egl_ctx_data_t *egl = (egl_ctx_data_t*)data;
egl->ctx = eglCreateContext(egl->dpy, egl->config, EGL_NO_CONTEXT,

View File

@ -88,7 +88,7 @@ bool egl_init_context(void *data, NativeDisplayType display,
EGLint *major, EGLint *minor,
EGLint *n, const EGLint *attrib_ptr);
bool egl_create_context(void *data, EGLint *egl_attribs);
bool egl_create_context(void *data, const EGLint *egl_attribs);
bool egl_create_surface(void *data, NativeWindowType native_window);

View File

@ -174,7 +174,7 @@ void d3d_make_d3dpp(void *data,
unsigned width = 0;
unsigned height = 0;
gfx_ctx_get_video_size(d3d, &width, &height);
gfx_ctx_get_video_size(&width, &height);
video_driver_set_size(&width, &height);
#endif
video_driver_get_size(&d3dpp->BackBufferWidth, &d3dpp->BackBufferHeight);
@ -589,7 +589,7 @@ static bool d3d_construct(d3d_video_t *d3d,
(int)(mon_rect.right - mon_rect.left),
(int)(mon_rect.bottom - mon_rect.top));
#else
gfx_ctx_get_video_size(d3d, &full_x, &full_y);
gfx_ctx_get_video_size(&full_x, &full_y);
#endif
{
unsigned new_width = info->fullscreen ? full_x : info->width;
@ -825,7 +825,7 @@ static void d3d_free(void *data)
#endif
#ifdef _XBOX
gfx_ctx_free(d3d);
gfx_ctx_free();
#else
#ifdef HAVE_MENU

View File

@ -68,7 +68,7 @@ static PFNVGCREATEEGLIMAGETARGETKHRPROC pvgCreateEGLImageTargetKHR;
static void vg_set_nonblock_state(void *data, bool state)
{
gfx_ctx_swap_interval(data, state ? 0 : 1);
gfx_ctx_swap_interval(state ? 0 : 1);
}
static INLINE bool vg_query_extension(const char *ext)
@ -100,15 +100,15 @@ static void *vg_init(const video_info_t *video, const input_driver_t **input, vo
gfx_ctx_set(ctx);
gfx_ctx_get_video_size(vg, &temp_width, &temp_height);
gfx_ctx_get_video_size(&temp_width, &temp_height);
RARCH_LOG("Detecting screen resolution %ux%u.\n", temp_width, temp_height);
if (temp_width != 0 && temp_height != 0)
video_driver_set_size(&temp_width, &temp_height);
gfx_ctx_swap_interval(vg, video->vsync ? 1 : 0);
gfx_ctx_swap_interval(video->vsync ? 1 : 0);
gfx_ctx_update_window_title(vg);
gfx_ctx_update_window_title();
vg->mTexType = video->rgb32 ? VG_sXRGB_8888 : VG_sRGB_565;
vg->keep_aspect = video->force_aspect;
@ -123,14 +123,14 @@ static void *vg_init(const video_info_t *video, const input_driver_t **input, vo
win_height = temp_height;
}
if (!gfx_ctx_set_video_mode(vg, win_width, win_height, video->fullscreen))
if (!gfx_ctx_set_video_mode(win_width, win_height, video->fullscreen))
goto error;
video_driver_get_size(&temp_width, &temp_height);
temp_width = 0;
temp_height = 0;
gfx_ctx_get_video_size(vg, &temp_width, &temp_height);
gfx_ctx_get_video_size(&temp_width, &temp_height);
vg->should_resize = true;
if (temp_width != 0 && temp_height != 0)
@ -143,7 +143,7 @@ static void *vg_init(const video_info_t *video, const input_driver_t **input, vo
vg->mScreenAspect = (float)temp_width / temp_height;
gfx_ctx_translate_aspect(vg, &vg->mScreenAspect, temp_width, temp_height);
gfx_ctx_translate_aspect(&vg->mScreenAspect, temp_width, temp_height);
vgSetfv(VG_CLEAR_COLOR, 4, clearColor);
@ -152,7 +152,7 @@ static void *vg_init(const video_info_t *video, const input_driver_t **input, vo
video->smooth ? VG_IMAGE_QUALITY_BETTER : VG_IMAGE_QUALITY_NONANTIALIASED);
vg_set_nonblock_state(vg, !video->vsync);
gfx_ctx_input_driver(vg, input, input_data);
gfx_ctx_input_driver(input, input_data);
if (settings->video.font_enable && font_renderer_create_default(&vg->font_driver, &vg->mFontRenderer,
*settings->video.font_path ? settings->video.font_path : NULL, settings->video.font_size))
@ -176,7 +176,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(vg, video))
if (vg_query_extension("KHR_EGL_image") && gfx_ctx_image_buffer_init(video))
{
pvgCreateEGLImageTargetKHR = (PFNVGCREATEEGLIMAGETARGETKHRPROC)gfx_ctx_get_proc_address("vgCreateEGLImageTargetKHR");
@ -219,7 +219,7 @@ static void vg_free(void *data)
vgDestroyPaint(vg->mPaintBg);
}
gfx_ctx_free(vg);
gfx_ctx_free();
free(vg);
}
@ -285,7 +285,7 @@ static void vg_copy_frame(void *data, const void *frame,
if (vg->mEglImageBuf)
{
EGLImageKHR img = 0;
bool new_egl = gfx_ctx_image_buffer_write(vg,
bool new_egl = gfx_ctx_image_buffer_write(
frame, width, height, pitch, (vg->mTexType == VG_sXRGB_8888), 0, &img);
retro_assert(img != EGL_NO_IMAGE_KHR);
@ -352,11 +352,11 @@ static bool vg_frame(void *data, const void *frame,
vg_draw_message(vg, msg);
#endif
gfx_ctx_update_window_title(vg);
gfx_ctx_update_window_title();
retro_perf_stop(&vg_fr);
gfx_ctx_swap_buffers(vg);
gfx_ctx_swap_buffers();
return true;
}
@ -367,7 +367,7 @@ static bool vg_alive(void *data)
unsigned temp_width = 0, temp_height = 0;
vg_t *vg = (vg_t*)data;
gfx_ctx_check_window(data, &quit,
gfx_ctx_check_window(&quit,
&vg->should_resize, &temp_width, &temp_height);
if (temp_width != 0 && temp_height != 0)
@ -378,17 +378,17 @@ static bool vg_alive(void *data)
static bool vg_focus(void *data)
{
return gfx_ctx_focus(data);
return gfx_ctx_focus();
}
static bool vg_suppress_screensaver(void *data, bool enable)
{
return gfx_ctx_suppress_screensaver(data, enable);
return gfx_ctx_suppress_screensaver(enable);
}
static bool vg_has_windowed(void *data)
{
return gfx_ctx_has_windowed(data);
return gfx_ctx_has_windowed();
}
static bool vg_set_shader(void *data,

View File

@ -69,19 +69,26 @@ static void *android_gfx_ctx_init(void *video_driver)
if (!egl_get_native_visual_id(egl, &format))
goto error;
slock_lock(android_app->mutex);
if (!android_app->window)
goto unlock_error;
ANativeWindow_setBuffersGeometry(android_app->window, 0, 0, format);
if (!egl_create_context(egl, context_attributes))
{
egl_report_error();
goto error;
goto unlock_error;
}
if (!egl_create_surface(egl, android_app->window))
goto error;
goto unlock_error;
slock_unlock(android_app->mutex);
return egl;
unlock_error:
slock_unlock(android_app->mutex);
error:
if (egl)
{
@ -185,10 +192,15 @@ static bool android_gfx_ctx_bind_api(void *data,
static bool android_gfx_ctx_has_focus(void *data)
{
struct android_app *android_app = (struct android_app*)g_android;
bool focused;
if (!android_app)
return true;
return (android_app->unfocused == true ) ? false : true;
slock_lock(android_app->mutex);
focused = !android_app->unfocused;
slock_unlock(android_app->mutex);
return focused;
}
static bool android_gfx_ctx_suppress_screensaver(void *data, bool enable)

View File

@ -282,11 +282,13 @@ static bool gfx_ctx_vc_set_video_mode(void *data,
unsigned width, unsigned height,
bool fullscreen)
{
vc_ctx_data_t *vc = (vc_ctx_data_t*)data;
if (g_egl_inited)
return false;
egl_install_sighandlers();
egl_set_swap_interval(data, g_interval);
egl_set_swap_interval(data, vc->egl.interval);
g_egl_inited = true;
@ -537,7 +539,7 @@ static bool gfx_ctx_vc_image_buffer_write(void *data, const void *frame, unsigne
vc->res,
vc->res,
VG_IMAGE_QUALITY_NONANTIALIASED);
eglBuffer[index] = peglCreateImageKHR(
vc->eglBuffer[index] = peglCreateImageKHR(
vc->egl.dpy,
vc->eglimage_ctx,
EGL_VG_PARENT_IMAGE_KHR,