(GL) Make EGL context file - have PSL1GHT build use eglGetProcAddress

- doesn't currently link
This commit is contained in:
Twinaphex 2012-09-14 11:07:50 +02:00
parent 2cf02a50b7
commit 3c8b967008
5 changed files with 170 additions and 5 deletions

View File

@ -38,7 +38,7 @@ endif
RSXGL_DEFINES = -D__RSX__ -DGL3_PROTOTYPES
SHARED_FLAGS := -DHAVE_FILEBROWSER $(RSXGL_DEFINES) -DHAVE_OPENGL -DHAVE_OPENGL_MODERN -DHAVE_GLSL -DHAVE_VID_CONTEXT -DHAVE_FBO -DHAVE_MOUSE -DHAVE_DEFAULT_RETROPAD_INPUT -DRARCH_CONSOLE -DHAVE_CONFIGFILE=1 -DHAVE_ZLIB -DHAVE_RARCH_MAIN_WRAP -DHAVE_GRIFFIN=1 -DPACKAGE_VERSION=\"0.9.7\" -Dmain=rarch_main -Wno-char-subscripts
SHARED_FLAGS := -DHAVE_FILEBROWSER $(RSXGL_DEFINES) -DHAVE_OPENGL -DHAVE_EGL -DHAVE_OPENGL_MODERN -DHAVE_GLSL -DHAVE_VID_CONTEXT -DHAVE_FBO -DHAVE_MOUSE -DHAVE_DEFAULT_RETROPAD_INPUT -DRARCH_CONSOLE -DHAVE_CONFIGFILE=1 -DHAVE_ZLIB -DHAVE_RARCH_MAIN_WRAP -DHAVE_GRIFFIN=1 -DPACKAGE_VERSION=\"0.9.7\" -Dmain=rarch_main -Wno-char-subscripts
CFLAGS += -std=gnu99 $(SHARED_FLAGS)
CXXFLAGS += $(SHARED_FLAGS)

View File

@ -87,10 +87,12 @@ VIDEO CONTEXT
#ifdef HAVE_VID_CONTEXT
#if defined(__CELLOS_LV2__)
#if defined(__CELLOS_LV2__) && !defined(__PSL1GHT__)
#include "../../gfx/context/ps3_ctx.c"
#elif defined(_XBOX)
#include "../../gfx/context/xdk_ctx.c"
#elif defined(HAVE_EGL)
#include "../../gfx/context/egl_ctx.c"
#else
#include "../../gfx/context/null_ctx.c"
#endif
@ -155,15 +157,17 @@ VIDEO DRIVER
FONTS
============================================================ */
#if defined(HAVE_OPENGL) || defined(HAVE_D3D8) || defined(HAVE_D3D9)
#if defined(__CELLOS_LV2__) && !defined(__PSL1GHT__)
#include "../../gfx/fonts/ps3_libdbgfont.c"
#elif defined(_XBOX1)
#include "../../gfx/fonts/xdk1_xfonts.c"
#elif defined(_XBOX360)
#include "../../gfx/fonts/xdk360_fonts.cpp"
#elif !defined(GEKKO)
#else
#include "../../gfx/fonts/null_fonts.c"
#endif
#endif
/*============================================================
INPUT

162
gfx/context/egl_ctx.c Normal file
View File

@ -0,0 +1,162 @@
/* RetroArch - A frontend for libretro.
* Copyright (C) 2010-2012 - Hans-Kristian Arntzen
* Copyright (C) 2011-2012 - 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 "../../driver.h"
#include "../gfx_context.h"
#include "../gl_common.h"
#include <stdint.h>
int gfx_ctx_check_resolution(unsigned resolution_id)
{
(void)resolution_id;
return 0;
}
unsigned gfx_ctx_get_resolution_width(unsigned resolution_id)
{
(void)resolution_id;
return 0;
}
unsigned gfx_ctx_get_resolution_height(unsigned resolution_id)
{
(void)resolution_id;
return 0;
}
float gfx_ctx_get_aspect_ratio(void)
{
return 4.0f / 3.0f;
}
void gfx_ctx_get_available_resolutions(void)
{}
void gfx_ctx_set_swap_interval(unsigned interval, bool inited)
{
(void)inited;
(void)interval;
}
void gfx_ctx_check_window(bool *quit,
bool *resize, unsigned *width, unsigned *height, unsigned frame_count)
{
(void)quit;
(void)resize;
(void)width;
(void)height;
(void)frame_count;
}
void gfx_ctx_swap_buffers(void)
{}
void gfx_ctx_clear(void)
{}
void gfx_ctx_set_blend(bool enable)
{}
void gfx_ctx_set_resize(unsigned width, unsigned height)
{
(void)width;
(void)height;
}
bool gfx_ctx_menu_init(void)
{}
void gfx_ctx_update_window_title(bool reset)
{
(void)reset;
}
void gfx_ctx_get_video_size(unsigned *width, unsigned *height)
{
(void)width;
(void)height;
}
bool gfx_ctx_init(void)
{
return true;
}
bool gfx_ctx_set_video_mode(
unsigned width, unsigned height,
unsigned bits, bool fullscreen)
{
(void)width;
(void)height;
(void)bits;
(void)fullscreen;
return true;
}
void gfx_ctx_destroy(void)
{}
void gfx_ctx_input_driver(const input_driver_t **input, void **input_data)
{
*input = NULL;
*input_data = NULL;
}
void gfx_ctx_set_filtering(unsigned index, bool set_smooth)
{
(void)index;
(void)set_smooth;
}
void gfx_ctx_set_fbo(bool enable)
{
(void)enable;
}
void gfx_ctx_apply_fbo_state_changes(unsigned mode)
{
(void)mode;
}
void gfx_ctx_set_projection(gl_t *gl, const struct gl_ortho *ortho, bool allow_rotate)
{
(void)gl;
(void)ortho;
(void)allow_rotate;
}
void gfx_ctx_set_aspect_ratio(void *data, unsigned aspectratio_index)
{
(void)data;
(void)aspectratio_index;
}
void gfx_ctx_set_overscan(void)
{}
// Enforce void (*)(void) as it's not really legal to cast void* to fn-pointer.
// POSIX allows this, but strict C99 doesn't.
gfx_ctx_proc_t gfx_ctx_get_proc_address(const char *symbol)
{
rarch_assert(sizeof(void*) == sizeof(void (*)(void)));
gfx_ctx_proc_t ret;
void *sym__ = eglGetProcAddress(symbol);
memcpy(&ret, &sym__, sizeof(void*));
return ret;
}

View File

@ -35,6 +35,7 @@
#include <GLES/glext.h>
#elif defined(HAVE_OPENGL_MODERN)
#include <EGL/egl.h>
#include <EGL/eglext.h>
#include <GL3/gl3.h>
#include <GL3/gl3ext.h>
#elif defined(HAVE_OPENGLES2)

View File

@ -898,7 +898,6 @@ static void gl_glsl_reset_attrib(void)
bool gl_glsl_init(const char *path)
{
#ifndef __PSL1GHT__
// Load shader functions.
LOAD_GL_SYM(CreateProgram);
LOAD_GL_SYM(UseProgram);
@ -941,7 +940,6 @@ bool gl_glsl_init(const char *path)
RARCH_ERR("GLSL shaders aren't supported by your OpenGL driver.\n");
return false;
}
#endif
#ifdef HAVE_XML
struct shader_program progs[MAX_PROGRAMS];