mirror of
https://github.com/libretro/RetroArch
synced 2025-02-22 21:40:40 +00:00
Add gfx/common/egl_common.c
This commit is contained in:
parent
943d4f5858
commit
50f8634902
@ -661,6 +661,10 @@ ifeq ($(HAVE_GL_CONTEXT), 1)
|
|||||||
DEFINES += -DHAVE_GLSL
|
DEFINES += -DHAVE_GLSL
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifeq ($(HAVE_EGL), 1)
|
||||||
|
OBJ += gfx/common/egl_common.o
|
||||||
|
endif
|
||||||
|
|
||||||
ifeq ($(HAVE_SDL2), 1)
|
ifeq ($(HAVE_SDL2), 1)
|
||||||
HAVE_SDL=0
|
HAVE_SDL=0
|
||||||
endif
|
endif
|
||||||
|
48
gfx/common/egl_common.c
Normal file
48
gfx/common/egl_common.c
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
/* RetroArch - A frontend for libretro.
|
||||||
|
* 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/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <retro_log.h>
|
||||||
|
|
||||||
|
#include "egl_common.h"
|
||||||
|
|
||||||
|
void egl_report_error(void)
|
||||||
|
{
|
||||||
|
EGLint error = eglGetError();
|
||||||
|
const char *str = NULL;
|
||||||
|
switch (error)
|
||||||
|
{
|
||||||
|
case EGL_SUCCESS:
|
||||||
|
str = "EGL_SUCCESS";
|
||||||
|
break;
|
||||||
|
|
||||||
|
case EGL_BAD_DISPLAY:
|
||||||
|
str = "EGL_BAD_DISPLAY";
|
||||||
|
break;
|
||||||
|
|
||||||
|
case EGL_BAD_SURFACE:
|
||||||
|
str = "EGL_BAD_SURFACE";
|
||||||
|
break;
|
||||||
|
|
||||||
|
case EGL_BAD_CONTEXT:
|
||||||
|
str = "EGL_BAD_CONTEXT";
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
str = "Unknown";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
RARCH_ERR("[EGL]: #0x%x, %s\n", (unsigned)error, str);
|
||||||
|
}
|
24
gfx/common/egl_common.h
Normal file
24
gfx/common/egl_common.h
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
/* RetroArch - A frontend for libretro.
|
||||||
|
* 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/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __EGL_COMMON_H
|
||||||
|
#define __EGL_COMMON_H
|
||||||
|
|
||||||
|
#include <EGL/egl.h>
|
||||||
|
#include <EGL/eglext.h>
|
||||||
|
|
||||||
|
void egl_report_error(void);
|
||||||
|
|
||||||
|
#endif
|
@ -499,8 +499,7 @@ static float gfx_ctx_vc_translate_aspect(void *data,
|
|||||||
/* Check for SD televisions: they should always be 4:3. */
|
/* Check for SD televisions: they should always be 4:3. */
|
||||||
if ((width == 640 || width == 720) && (height == 480 || height == 576))
|
if ((width == 640 || width == 720) && (height == 480 || height == 576))
|
||||||
return 4.0f / 3.0f;
|
return 4.0f / 3.0f;
|
||||||
else
|
return (float)width / height;
|
||||||
return (float)width / height;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool gfx_ctx_vc_image_buffer_init(void *data,
|
static bool gfx_ctx_vc_image_buffer_init(void *data,
|
||||||
|
@ -18,9 +18,6 @@
|
|||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#include <EGL/egl.h>
|
|
||||||
#include <EGL/eglext.h>
|
|
||||||
|
|
||||||
#include <wayland-client.h>
|
#include <wayland-client.h>
|
||||||
#include <wayland-egl.h>
|
#include <wayland-egl.h>
|
||||||
|
|
||||||
@ -28,6 +25,7 @@
|
|||||||
#include "../../general.h"
|
#include "../../general.h"
|
||||||
#include "../../runloop.h"
|
#include "../../runloop.h"
|
||||||
#include "../video_monitor.h"
|
#include "../video_monitor.h"
|
||||||
|
#include "../common/egl_common.h"
|
||||||
#include "../common/gl_common.h"
|
#include "../common/gl_common.h"
|
||||||
|
|
||||||
typedef struct gfx_ctx_wayland_data
|
typedef struct gfx_ctx_wayland_data
|
||||||
@ -206,37 +204,6 @@ static void gfx_ctx_wl_destroy_resources(gfx_ctx_wayland_data_t *wl)
|
|||||||
wl->g_height = 0;
|
wl->g_height = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void egl_report_error(void)
|
|
||||||
{
|
|
||||||
EGLint error = eglGetError();
|
|
||||||
const char *str = NULL;
|
|
||||||
|
|
||||||
switch (error)
|
|
||||||
{
|
|
||||||
case EGL_SUCCESS:
|
|
||||||
str = "EGL_SUCCESS";
|
|
||||||
break;
|
|
||||||
|
|
||||||
case EGL_BAD_DISPLAY:
|
|
||||||
str = "EGL_BAD_DISPLAY";
|
|
||||||
break;
|
|
||||||
|
|
||||||
case EGL_BAD_SURFACE:
|
|
||||||
str = "EGL_BAD_SURFACE";
|
|
||||||
break;
|
|
||||||
|
|
||||||
case EGL_BAD_CONTEXT:
|
|
||||||
str = "EGL_BAD_CONTEXT";
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
str = "Unknown";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
RARCH_ERR("[Wayland/EGL]: #0x%x, %s\n", (unsigned)error, str);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void gfx_ctx_wl_swap_interval(void *data, unsigned interval)
|
static void gfx_ctx_wl_swap_interval(void *data, unsigned interval)
|
||||||
{
|
{
|
||||||
driver_t *driver = driver_get_ptr();
|
driver_t *driver = driver_get_ptr();
|
||||||
|
@ -14,17 +14,13 @@
|
|||||||
* If not, see <http://www.gnu.org/licenses/>.
|
* If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* X/EGL context. Mostly used for testing GLES code paths.
|
/* 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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
|
|
||||||
#include <EGL/egl.h>
|
|
||||||
#include <EGL/eglext.h>
|
|
||||||
|
|
||||||
#include "../../driver.h"
|
#include "../../driver.h"
|
||||||
|
#include "../common/egl_common.h"
|
||||||
#include "../common/gl_common.h"
|
#include "../common/gl_common.h"
|
||||||
#include "../common/x11_common.h"
|
#include "../common/x11_common.h"
|
||||||
|
|
||||||
@ -66,36 +62,6 @@ static int egl_nul_handler(Display *dpy, XErrorEvent *event)
|
|||||||
|
|
||||||
static void gfx_ctx_xegl_destroy(void *data);
|
static void gfx_ctx_xegl_destroy(void *data);
|
||||||
|
|
||||||
static void egl_report_error(void)
|
|
||||||
{
|
|
||||||
EGLint error = eglGetError();
|
|
||||||
const char *str = NULL;
|
|
||||||
switch (error)
|
|
||||||
{
|
|
||||||
case EGL_SUCCESS:
|
|
||||||
str = "EGL_SUCCESS";
|
|
||||||
break;
|
|
||||||
|
|
||||||
case EGL_BAD_DISPLAY:
|
|
||||||
str = "EGL_BAD_DISPLAY";
|
|
||||||
break;
|
|
||||||
|
|
||||||
case EGL_BAD_SURFACE:
|
|
||||||
str = "EGL_BAD_SURFACE";
|
|
||||||
break;
|
|
||||||
|
|
||||||
case EGL_BAD_CONTEXT:
|
|
||||||
str = "EGL_BAD_CONTEXT";
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
str = "Unknown";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
RARCH_ERR("[X/EGL]: #0x%x, %s\n", (unsigned)error, str);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void gfx_ctx_xegl_swap_interval(void *data, unsigned interval)
|
static void gfx_ctx_xegl_swap_interval(void *data, unsigned interval)
|
||||||
{
|
{
|
||||||
(void)data;
|
(void)data;
|
||||||
|
@ -139,6 +139,10 @@ VIDEO CONTEXT
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(HAVE_EGL)
|
||||||
|
#include "../gfx/common/egl_common.c"
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(HAVE_X11)
|
#if defined(HAVE_X11)
|
||||||
#include "../gfx/common/x11_common.c"
|
#include "../gfx/common/x11_common.c"
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user