2012-09-24 23:26:22 +00:00
|
|
|
/* RetroArch - A frontend for libretro.
|
2014-01-01 00:50:59 +00:00
|
|
|
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
2012-09-24 23:26:22 +00:00
|
|
|
*
|
|
|
|
* 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/>.
|
|
|
|
*/
|
|
|
|
|
2013-07-18 00:26:01 +00:00
|
|
|
#include "../general.h"
|
2012-09-24 23:26:22 +00:00
|
|
|
#include "gfx_context.h"
|
2013-07-05 17:29:48 +00:00
|
|
|
#include "../general.h"
|
2012-09-28 21:34:19 +00:00
|
|
|
#include <string.h>
|
2012-09-24 23:26:22 +00:00
|
|
|
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include "../config.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
static const gfx_ctx_driver_t *gfx_ctx_drivers[] = {
|
|
|
|
#if defined(__CELLOS_LV2__)
|
|
|
|
&gfx_ctx_ps3,
|
|
|
|
#endif
|
2014-03-07 21:49:44 +00:00
|
|
|
#if defined(HAVE_WIN32_D3D9) || defined(_XBOX)
|
2014-01-18 17:43:07 +00:00
|
|
|
&gfx_ctx_d3d9,
|
|
|
|
#endif
|
2012-09-24 23:26:22 +00:00
|
|
|
#if defined(HAVE_VIDEOCORE)
|
|
|
|
&gfx_ctx_videocore,
|
|
|
|
#endif
|
2014-06-05 10:28:17 +00:00
|
|
|
#if defined(HAVE_MALI_FBDEV)
|
|
|
|
&gfx_ctx_mali_fbdev,
|
|
|
|
#endif
|
2012-09-30 09:26:26 +00:00
|
|
|
#if defined(_WIN32) && defined(HAVE_OPENGL)
|
|
|
|
&gfx_ctx_wgl,
|
|
|
|
#endif
|
2012-09-29 18:06:48 +00:00
|
|
|
#if defined(HAVE_X11) && defined(HAVE_OPENGL) && !defined(HAVE_OPENGLES)
|
2012-09-29 09:59:08 +00:00
|
|
|
&gfx_ctx_glx,
|
2012-09-24 23:26:22 +00:00
|
|
|
#endif
|
2012-09-29 09:59:08 +00:00
|
|
|
#if defined(HAVE_X11) && defined(HAVE_OPENGL) && defined(HAVE_EGL)
|
2012-09-24 23:26:22 +00:00
|
|
|
&gfx_ctx_x_egl,
|
|
|
|
#endif
|
|
|
|
#if defined(HAVE_KMS)
|
|
|
|
&gfx_ctx_drm_egl,
|
|
|
|
#endif
|
2012-10-08 22:11:11 +00:00
|
|
|
#if defined(ANDROID)
|
|
|
|
&gfx_ctx_android,
|
|
|
|
#endif
|
2014-05-20 00:48:11 +00:00
|
|
|
#if defined(__QNX__)
|
2013-02-26 00:19:03 +00:00
|
|
|
&gfx_ctx_bbqnx,
|
|
|
|
#endif
|
2013-07-07 17:05:05 +00:00
|
|
|
#if defined(IOS) || defined(OSX) //< Don't use __APPLE__ as it breaks basic SDL builds
|
2013-07-07 20:24:28 +00:00
|
|
|
&gfx_ctx_apple,
|
2013-02-06 14:54:15 +00:00
|
|
|
#endif
|
2013-07-18 00:26:01 +00:00
|
|
|
#ifdef EMSCRIPTEN
|
|
|
|
&gfx_ctx_emscripten,
|
|
|
|
#endif
|
2014-03-09 15:50:18 +00:00
|
|
|
NULL
|
2012-09-24 23:26:22 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
const gfx_ctx_driver_t *gfx_ctx_find_driver(const char *ident)
|
|
|
|
{
|
2013-10-22 13:08:17 +00:00
|
|
|
unsigned i;
|
|
|
|
for (i = 0; i < ARRAY_SIZE(gfx_ctx_drivers); i++)
|
2012-09-24 23:26:22 +00:00
|
|
|
{
|
|
|
|
if (strcmp(gfx_ctx_drivers[i]->ident, ident) == 0)
|
|
|
|
return gfx_ctx_drivers[i];
|
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2014-04-19 14:06:12 +00:00
|
|
|
const gfx_ctx_driver_t *gfx_ctx_init_first(void *data, enum gfx_ctx_api api, unsigned major, unsigned minor, bool hw_render_ctx)
|
2012-09-24 23:26:22 +00:00
|
|
|
{
|
2013-10-22 13:08:17 +00:00
|
|
|
unsigned i;
|
2014-03-09 15:50:18 +00:00
|
|
|
for (i = 0; gfx_ctx_drivers[i]; i++)
|
2012-09-24 23:26:22 +00:00
|
|
|
{
|
2014-03-09 15:50:18 +00:00
|
|
|
if (gfx_ctx_drivers[i]->bind_api(data, api, major, minor))
|
2012-09-24 23:26:22 +00:00
|
|
|
{
|
2014-04-19 14:06:12 +00:00
|
|
|
if (gfx_ctx_drivers[i]->bind_hw_render)
|
2014-04-19 14:37:39 +00:00
|
|
|
{
|
|
|
|
gfx_ctx_drivers[i]->bind_hw_render(data,
|
|
|
|
g_settings.video.shared_context && hw_render_ctx);
|
|
|
|
}
|
|
|
|
|
2014-03-09 15:50:18 +00:00
|
|
|
if (gfx_ctx_drivers[i]->init(data))
|
2012-09-24 23:26:22 +00:00
|
|
|
return gfx_ctx_drivers[i];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|