(EGL) Call EGL common calls
This commit is contained in:
parent
d5cdfbb7ba
commit
6e0971fc61
|
@ -114,6 +114,22 @@ void egl_terminate(EGLDisplay dpy)
|
|||
eglTerminate(dpy);
|
||||
}
|
||||
|
||||
static bool egl_get_config_attrib(EGLDisplay dpy, EGLConfig config, EGLint attribute,
|
||||
EGLint *value)
|
||||
{
|
||||
return eglGetConfigAttrib(dpy, config, attribute, value);
|
||||
}
|
||||
|
||||
bool egl_initialize(EGLDisplay dpy, EGLint *major, EGLint *minor)
|
||||
{
|
||||
return eglInitialize(dpy, major, minor);
|
||||
}
|
||||
|
||||
bool egl_bind_api(EGLenum egl_api)
|
||||
{
|
||||
return eglBindAPI(egl_api);
|
||||
}
|
||||
|
||||
void egl_destroy(egl_ctx_data_t *egl)
|
||||
{
|
||||
if (egl->dpy)
|
||||
|
@ -282,8 +298,9 @@ static EGLDisplay get_egl_display(EGLenum platform, void *native)
|
|||
|
||||
RARCH_LOG("[EGL] Found EGL client version >= 1.5, trying eglGetPlatformDisplay\n");
|
||||
ptr_eglGetPlatformDisplay = (pfn_eglGetPlatformDisplay)
|
||||
eglGetProcAddress("eglGetPlatformDisplay");
|
||||
if (ptr_eglGetPlatformDisplay != NULL)
|
||||
egl_get_proc_address("eglGetPlatformDisplay");
|
||||
|
||||
if (ptr_eglGetPlatformDisplay)
|
||||
{
|
||||
EGLDisplay dpy = ptr_eglGetPlatformDisplay(platform, native, NULL);
|
||||
if (dpy != EGL_NO_DISPLAY)
|
||||
|
@ -299,8 +316,9 @@ static EGLDisplay get_egl_display(EGLenum platform, void *native)
|
|||
|
||||
RARCH_LOG("[EGL] Found EGL_EXT_platform_base, trying eglGetPlatformDisplayEXT\n");
|
||||
ptr_eglGetPlatformDisplayEXT = (PFNEGLGETPLATFORMDISPLAYEXTPROC)
|
||||
eglGetProcAddress("eglGetPlatformDisplayEXT");
|
||||
if (ptr_eglGetPlatformDisplayEXT != NULL)
|
||||
egl_get_proc_address("eglGetPlatformDisplayEXT");
|
||||
|
||||
if (ptr_eglGetPlatformDisplayEXT)
|
||||
{
|
||||
EGLDisplay dpy = ptr_eglGetPlatformDisplayEXT(platform, native, NULL);
|
||||
if (dpy != EGL_NO_DISPLAY)
|
||||
|
@ -317,15 +335,27 @@ static EGLDisplay get_egl_display(EGLenum platform, void *native)
|
|||
return eglGetDisplay((EGLNativeDisplayType) native);
|
||||
}
|
||||
|
||||
bool egl_get_native_visual_id(egl_ctx_data_t *egl, EGLint *value)
|
||||
{
|
||||
if (!egl_get_config_attrib(egl->dpy, egl->config,
|
||||
EGL_NATIVE_VISUAL_ID, value))
|
||||
{
|
||||
RARCH_ERR("[EGL]: egl_get_native_visual_id failed.\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool egl_default_accept_config_cb(void *display_data, EGLDisplay dpy, EGLConfig config)
|
||||
{
|
||||
/* Makes sure we have 8 bit color. */
|
||||
EGLint r, g, b;
|
||||
if (!eglGetConfigAttrib(dpy, config, EGL_RED_SIZE, &r))
|
||||
if (!egl_get_config_attrib(dpy, config, EGL_RED_SIZE, &r))
|
||||
return false;
|
||||
if (!eglGetConfigAttrib(dpy, config, EGL_GREEN_SIZE, &g))
|
||||
if (!egl_get_config_attrib(dpy, config, EGL_GREEN_SIZE, &g))
|
||||
return false;
|
||||
if (!eglGetConfigAttrib(dpy, config, EGL_BLUE_SIZE, &b))
|
||||
if (!egl_get_config_attrib(dpy, config, EGL_BLUE_SIZE, &b))
|
||||
return false;
|
||||
|
||||
if (r != 8 || g != 8 || b != 8)
|
||||
|
@ -386,10 +416,6 @@ bool egl_init_context_common(
|
|||
return true;
|
||||
}
|
||||
|
||||
bool egl_initialize(EGLDisplay dpy, EGLint *major, EGLint *minor)
|
||||
{
|
||||
return eglInitialize(dpy, major, minor);
|
||||
}
|
||||
|
||||
bool egl_init_context(egl_ctx_data_t *egl,
|
||||
EGLenum platform,
|
||||
|
@ -418,11 +444,6 @@ bool egl_init_context(egl_ctx_data_t *egl,
|
|||
display_data);
|
||||
}
|
||||
|
||||
bool egl_bind_api(EGLenum egl_api)
|
||||
{
|
||||
return eglBindAPI(egl_api);
|
||||
}
|
||||
|
||||
bool egl_create_context(egl_ctx_data_t *egl, const EGLint *egl_attribs)
|
||||
{
|
||||
EGLContext ctx = eglCreateContext(egl->dpy, egl->config, EGL_NO_CONTEXT,
|
||||
|
@ -468,18 +489,6 @@ bool egl_create_surface(egl_ctx_data_t *egl, void *native_window)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool egl_get_native_visual_id(egl_ctx_data_t *egl, EGLint *value)
|
||||
{
|
||||
if (!eglGetConfigAttrib(egl->dpy, egl->config,
|
||||
EGL_NATIVE_VISUAL_ID, value))
|
||||
{
|
||||
RARCH_ERR("[EGL]: egl_get_native_visual_id failed.\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool egl_has_config(egl_ctx_data_t *egl)
|
||||
{
|
||||
if (!egl->config)
|
||||
|
|
|
@ -78,10 +78,10 @@ void egl_report_error(void);
|
|||
|
||||
void egl_destroy(egl_ctx_data_t *egl);
|
||||
|
||||
void egl_terminate(EGLDisplay dpy);
|
||||
|
||||
gfx_ctx_proc_t egl_get_proc_address(const char *symbol);
|
||||
|
||||
void egl_terminate(EGLDisplay dpy);
|
||||
|
||||
void egl_bind_hw_render(egl_ctx_data_t *egl, bool enable);
|
||||
|
||||
void egl_swap_buffers(void *data);
|
||||
|
|
|
@ -508,17 +508,17 @@ static bool gbm_choose_xrgb8888_cb(void *display_data, EGLDisplay dpy, EGLConfig
|
|||
(void)display_data;
|
||||
|
||||
/* Makes sure we have 8 bit color. */
|
||||
if (!eglGetConfigAttrib(dpy, config, EGL_RED_SIZE, &r))
|
||||
if (!egl_get_config_attrib(dpy, config, EGL_RED_SIZE, &r))
|
||||
return false;
|
||||
if (!eglGetConfigAttrib(dpy, config, EGL_GREEN_SIZE, &g))
|
||||
if (!egl_get_config_attrib(dpy, config, EGL_GREEN_SIZE, &g))
|
||||
return false;
|
||||
if (!eglGetConfigAttrib(dpy, config, EGL_BLUE_SIZE, &b))
|
||||
if (!egl_get_config_attrib(dpy, config, EGL_BLUE_SIZE, &b))
|
||||
return false;
|
||||
|
||||
if (r != 8 || g != 8 || b != 8)
|
||||
return false;
|
||||
|
||||
if (!eglGetConfigAttrib(dpy, config, EGL_NATIVE_VISUAL_ID, &id))
|
||||
if (!egl_get_config_attrib(dpy, config, EGL_NATIVE_VISUAL_ID, &id))
|
||||
return false;
|
||||
|
||||
return id == GBM_FORMAT_XRGB8888;
|
||||
|
|
Loading…
Reference in New Issue