Take out HAVE_EGL ifdefs in gfx_context_driver_t definition

This commit is contained in:
twinaphex 2015-04-10 05:58:08 +02:00
parent 133d7b7dd2
commit 3213baf452
14 changed files with 68 additions and 86 deletions

View File

@ -674,6 +674,8 @@ const gfx_ctx_driver_t gfx_ctx_apple = {
apple_gfx_ctx_input_driver,
apple_gfx_ctx_get_proc_address,
NULL,
NULL,
NULL,
"apple",
apple_gfx_ctx_bind_hw_render,
};

View File

@ -490,10 +490,8 @@ const gfx_ctx_driver_t gfx_ctx_android = {
android_gfx_ctx_swap_buffers,
android_gfx_ctx_input_driver,
android_gfx_ctx_get_proc_address,
#ifdef HAVE_EGL
NULL,
NULL,
#endif
NULL,
"android",
android_gfx_ctx_bind_hw_render,

View File

@ -464,10 +464,8 @@ const gfx_ctx_driver_t gfx_ctx_bbqnx = {
gfx_ctx_qnx_swap_buffers,
gfx_ctx_qnx_input_driver,
gfx_ctx_qnx_get_proc_address,
#ifdef HAVE_EGL
NULL,
NULL,
#endif
NULL,
"blackberry_qnx",
gfx_qnx_ctx_bind_hw_render,

View File

@ -519,10 +519,8 @@ const gfx_ctx_driver_t gfx_ctx_d3d = {
gfx_ctx_d3d_swap_buffers,
gfx_ctx_d3d_input_driver,
NULL,
#ifdef HAVE_EGL
NULL,
NULL,
#endif
gfx_ctx_d3d_show_mouse,
"d3d",
};

View File

@ -989,4 +989,3 @@ const gfx_ctx_driver_t gfx_ctx_drm_egl = {
"kms-egl",
gfx_ctx_drm_egl_bind_hw_render,
};

View File

@ -154,10 +154,8 @@ const gfx_ctx_driver_t gfx_ctx_null = {
gfx_ctx_null_swap_buffers,
gfx_ctx_null_input_driver,
NULL,
#ifdef HAVE_EGL
NULL,
NULL,
#endif
gfx_ctx_null_show_mouse,
"null",
gfx_ctx_null_bind_hw_render,

View File

@ -813,10 +813,8 @@ const gfx_ctx_driver_t gfx_ctx_glx = {
gfx_ctx_glx_swap_buffers,
gfx_ctx_glx_input_driver,
gfx_ctx_glx_get_proc_address,
#ifdef HAVE_EGL
NULL,
NULL,
#endif
gfx_ctx_glx_show_mouse,
"glx",

View File

@ -332,10 +332,8 @@ const gfx_ctx_driver_t gfx_ctx_mali_fbdev = {
gfx_ctx_mali_fbdev_swap_buffers,
gfx_ctx_mali_fbdev_input_driver,
gfx_ctx_mali_fbdev_get_proc_address,
#ifdef HAVE_EGL
NULL,
NULL,
#endif
NULL,
"mali-fbdev",
};

View File

@ -400,6 +400,8 @@ const gfx_ctx_driver_t gfx_ctx_ps3 = {
gfx_ctx_ps3_input_driver,
NULL,
NULL,
NULL,
NULL,
"ps3",
};

View File

@ -447,10 +447,8 @@ const gfx_ctx_driver_t gfx_ctx_sdl_gl =
sdl_ctx_swap_buffers,
sdl_ctx_input_driver,
sdl_ctx_get_proc_address,
#ifdef HAVE_EGL
NULL,
NULL,
#endif
sdl_ctx_show_mouse,
"sdl_gl",
NULL /* bind_hw_render */

View File

@ -315,10 +315,8 @@ const gfx_ctx_driver_t gfx_ctx_vivante_fbdev = {
gfx_ctx_vivante_swap_buffers,
gfx_ctx_vivante_input_driver,
gfx_ctx_vivante_get_proc_address,
#ifdef HAVE_EGL
NULL,
NULL,
#endif
NULL,
"vivante-fbdev",
};

View File

@ -716,10 +716,8 @@ const gfx_ctx_driver_t gfx_ctx_wgl = {
gfx_ctx_wgl_swap_buffers,
gfx_ctx_wgl_input_driver,
gfx_ctx_wgl_get_proc_address,
#ifdef HAVE_EGL
NULL,
NULL,
#endif
gfx_ctx_wgl_show_mouse,
"wgl",
gfx_ctx_wgl_bind_hw_render,

View File

@ -1,22 +1,22 @@
/* RetroArch - A frontend for libretro.
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
* Copyright (C) 2011-2015 - Daniel De Matteis
*
* RetroArch is free software: you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Found-
* ation, either version 3 of the License, or (at your option) any later version.
*
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with RetroArch.
* If not, see <http://www.gnu.org/licenses/>.
*/
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
* Copyright (C) 2011-2015 - Daniel De Matteis
*
* RetroArch is free software: you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Found-
* ation, either version 3 of the License, or (at your option) any later version.
*
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with RetroArch.
* If not, see <http://www.gnu.org/licenses/>.
*/
/* X/EGL context. Mostly used for testing GLES code paths.
* Should be its own file as it has lots of X11 stuff baked into it as well.
*/
* Should be its own file as it has lots of X11 stuff baked into it as well.
*/
#include "../../driver.h"
#include "../../runloop.h"
@ -84,7 +84,7 @@ static int egl_nul_handler(Display *dpy, XErrorEvent *event)
}
static void gfx_ctx_xegl_get_video_size(void *data,
unsigned *width, unsigned *height);
unsigned *width, unsigned *height);
static void gfx_ctx_xegl_destroy(void *data);
@ -139,7 +139,7 @@ static void gfx_ctx_xegl_swap_interval(void *data, unsigned interval)
void x_input_poll_wheel(void *data, XButtonEvent *event, bool latch);
static void gfx_ctx_xegl_check_window(void *data, bool *quit,
bool *resize, unsigned *width, unsigned *height, unsigned frame_count)
bool *resize, unsigned *width, unsigned *height, unsigned frame_count)
{
XEvent event;
unsigned new_width = *width;
@ -160,7 +160,7 @@ static void gfx_ctx_xegl_check_window(void *data, bool *quit,
while (XPending(g_dpy))
{
bool filter;
/* Can get events from older windows. Check this. */
XNextEvent(g_dpy, &event);
filter = XFilterEvent(&event, g_win);
@ -212,7 +212,7 @@ static void gfx_ctx_xegl_swap_buffers(void *data)
}
static void gfx_ctx_xegl_set_resize(void *data,
unsigned width, unsigned height)
unsigned width, unsigned height)
{
(void)data;
(void)width;
@ -234,7 +234,7 @@ static void gfx_ctx_xegl_update_window_title(void *data)
}
static void gfx_ctx_xegl_get_video_size(void *data,
unsigned *width, unsigned *height)
unsigned *width, unsigned *height)
{
(void)data;
@ -265,12 +265,12 @@ static void gfx_ctx_xegl_get_video_size(void *data,
}
#define XEGL_ATTRIBS_BASE \
EGL_SURFACE_TYPE, EGL_WINDOW_BIT, \
EGL_RED_SIZE, 1, \
EGL_GREEN_SIZE, 1, \
EGL_BLUE_SIZE, 1, \
EGL_ALPHA_SIZE, 0, \
EGL_DEPTH_SIZE, 0
EGL_SURFACE_TYPE, EGL_WINDOW_BIT, \
EGL_RED_SIZE, 1, \
EGL_GREEN_SIZE, 1, \
EGL_BLUE_SIZE, 1, \
EGL_ALPHA_SIZE, 0, \
EGL_DEPTH_SIZE, 0
static bool gfx_ctx_xegl_init(void *data)
{
@ -382,46 +382,46 @@ static EGLint *xegl_fill_attribs(EGLint *attr)
{
#ifdef EGL_KHR_create_context
case GFX_CTX_OPENGL_API:
{
unsigned version = g_major * 1000 + g_minor;
bool core = version >= 3001;
global_t *global = global_get_ptr();
bool debug = global->system.hw_render_callback.debug_context;
{
unsigned version = g_major * 1000 + g_minor;
bool core = version >= 3001;
global_t *global = global_get_ptr();
bool debug = global->system.hw_render_callback.debug_context;
#ifdef GL_DEBUG
debug = true;
debug = true;
#endif
if (core)
{
*attr++ = EGL_CONTEXT_MAJOR_VERSION_KHR;
*attr++ = g_major;
*attr++ = EGL_CONTEXT_MINOR_VERSION_KHR;
*attr++ = g_minor;
/* Technically, we don't have core/compat until 3.2.
* Version 3.1 is either compat or not depending
* on GL_ARB_compatibility.
*/
if (version >= 3002)
if (core)
{
*attr++ = EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR;
*attr++ = EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT_KHR;
*attr++ = EGL_CONTEXT_MAJOR_VERSION_KHR;
*attr++ = g_major;
*attr++ = EGL_CONTEXT_MINOR_VERSION_KHR;
*attr++ = g_minor;
/* Technically, we don't have core/compat until 3.2.
* Version 3.1 is either compat or not depending
* on GL_ARB_compatibility.
*/
if (version >= 3002)
{
*attr++ = EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR;
*attr++ = EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT_KHR;
}
}
}
if (debug)
{
*attr++ = EGL_CONTEXT_FLAGS_KHR;
*attr++ = EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR;
}
if (debug)
{
*attr++ = EGL_CONTEXT_FLAGS_KHR;
*attr++ = EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR;
}
break;
}
break;
}
#endif
case GFX_CTX_OPENGL_ES_API:
/* Same as EGL_CONTEXT_MAJOR_VERSION. */
/* Same as EGL_CONTEXT_MAJOR_VERSION. */
*attr++ = EGL_CONTEXT_CLIENT_VERSION;
*attr++ = g_major ? (EGLint)g_major : 2;
#ifdef EGL_KHR_create_context
@ -442,8 +442,8 @@ static EGLint *xegl_fill_attribs(EGLint *attr)
}
static bool gfx_ctx_xegl_set_video_mode(void *data,
unsigned width, unsigned height,
bool fullscreen)
unsigned width, unsigned height,
bool fullscreen)
{
EGLint egl_attribs[16];
EGLint *attr;
@ -704,12 +704,11 @@ static void gfx_ctx_xegl_destroy(void *data)
}
static void gfx_ctx_xegl_input_driver(void *data,
const input_driver_t **input, void **input_data)
const input_driver_t **input, void **input_data)
{
void *xinput;
void *xinput = input_x.init();
(void)data;
xinput = input_x.init();
*input = xinput ? &input_x : NULL;
*input_data = xinput;
@ -759,7 +758,7 @@ static gfx_ctx_proc_t gfx_ctx_xegl_get_proc_address(const char *symbol)
}
static bool gfx_ctx_xegl_bind_api(void *data,
enum gfx_ctx_api api, unsigned major, unsigned minor)
enum gfx_ctx_api api, unsigned major, unsigned minor)
{
(void)data;
@ -809,12 +808,13 @@ static void gfx_ctx_xegl_bind_hw_render(void *data, bool enable)
}
static bool gfx_ctx_xegl_get_metrics(void *data,
enum display_metric_types type, float *value)
enum display_metric_types type, float *value)
{
return x11_get_metrics(data, type, value);
}
const gfx_ctx_driver_t gfx_ctx_x_egl = {
const gfx_ctx_driver_t gfx_ctx_x_egl =
{
gfx_ctx_xegl_init,
gfx_ctx_xegl_destroy,
gfx_ctx_xegl_bind_api,
@ -841,4 +841,3 @@ const gfx_ctx_driver_t gfx_ctx_x_egl = {
"x-egl",
gfx_ctx_xegl_bind_hw_render,
};

View File

@ -127,7 +127,6 @@ typedef struct gfx_ctx_driver
* Does not take opaque, to avoid lots of ugly wrapper code. */
gfx_ctx_proc_t (*get_proc_address)(const char*);
#ifdef HAVE_EGL
/* 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*);
@ -139,7 +138,6 @@ typedef struct gfx_ctx_driver
bool (*write_egl_image)(void*, const void *frame, unsigned width,
unsigned height, unsigned pitch, bool rgb32,
unsigned index, void **image_handle);
#endif
/* Shows or hides mouse. Can be NULL if context doesn't
* have a concept of mouse pointer. */