mirror of https://github.com/xemu-project/xemu.git
Switch from GLEW to epoxy
This commit is contained in:
parent
0523deaa93
commit
0f190369d3
|
@ -41,7 +41,7 @@ addons:
|
|||
- sparse
|
||||
- uuid-dev
|
||||
- libsdl2-dev
|
||||
- libglew-dev
|
||||
- libepoxy-dev
|
||||
|
||||
git:
|
||||
# we want to do this ourselves
|
||||
|
@ -49,7 +49,7 @@ git:
|
|||
|
||||
before_install:
|
||||
- if [ "$TRAVIS_OS_NAME" == "osx" ]; then brew update ; fi
|
||||
- if [ "$TRAVIS_OS_NAME" == "osx" ]; then brew install libffi gettext glib pixman pkg-config autoconf pixman sdl2 glew; fi
|
||||
- if [ "$TRAVIS_OS_NAME" == "osx" ]; then brew install libffi gettext glib pixman pkg-config autoconf pixman sdl2 libepoxy; fi
|
||||
|
||||
script:
|
||||
- if [ "$TRAVIS_OS_NAME" == "osx" ]; then ./build_macos.sh ; fi
|
||||
|
|
|
@ -24,9 +24,9 @@ bash -xlc "pacman --noconfirm -S --needed automake-wrapper"
|
|||
bash -xlc "pacman --noconfirm -S --needed mingw-w64-x86_64-libtool"
|
||||
bash -xlc "pacman --noconfirm -S --needed mingw-w64-x86_64-pkg-config"
|
||||
bash -xlc "pacman --noconfirm -S --needed mingw-w64-x86_64-glib2"
|
||||
bash -xlc "pacman --noconfirm -S --needed mingw-w64-x86_64-glew"
|
||||
bash -xlc "pacman --noconfirm -S --needed mingw-w64-x86_64-SDL2"
|
||||
bash -xlc "pacman --noconfirm -S --needed mingw-w64-x86_64-pixman"
|
||||
bash -xlc "pacman --noconfirm -S --needed mingw-w64-x86_64-libepoxy"
|
||||
|
||||
rem Invoke subsequent bash in the build tree
|
||||
cd %APPVEYOR_BUILD_FOLDER%
|
||||
|
|
|
@ -848,7 +848,7 @@ if test "$mingw32" = "yes" ; then
|
|||
QEMU_CFLAGS="-D__USE_MINGW_ANSI_STDIO=1 $QEMU_CFLAGS"
|
||||
# MinGW needs -mthreads for TLS and macro _MT.
|
||||
QEMU_CFLAGS="-mthreads $QEMU_CFLAGS"
|
||||
LIBS="-lwinmm -lws2_32 -liphlpapi -lopengl32 -lglew32 -lgdi32 $LIBS"
|
||||
LIBS="-lwinmm -lws2_32 -liphlpapi -lopengl32 -lepoxy -lgdi32 $LIBS"
|
||||
write_c_skeleton;
|
||||
if compile_prog "" "-liberty" ; then
|
||||
LIBS="-liberty $LIBS"
|
||||
|
@ -2948,7 +2948,7 @@ fi
|
|||
|
||||
# Xbox hack to include ogl framework
|
||||
if test "$darwin" = "yes" ; then
|
||||
sdl_libs="$sdl_libs -framework OpenGL"
|
||||
sdl_libs="$sdl_libs -framework OpenGL -lepoxy"
|
||||
# cat > $TMPC << EOF
|
||||
# #include <OpenGL/gl.h>
|
||||
# #include <OpenGL/CGLTypes.h>
|
||||
|
@ -2958,7 +2958,7 @@ if test "$darwin" = "yes" ; then
|
|||
fi
|
||||
|
||||
if test "$linux" = "yes" ; then
|
||||
sdl_libs="$sdl_libs -lGLEW -lGLU -lGL"
|
||||
sdl_libs="$sdl_libs -lepoxy -lGLU -lGL"
|
||||
fi
|
||||
|
||||
##########################################
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
obj-y += gloffscreen_common.o glextensions.o
|
||||
obj-y += gloffscreen_common.o
|
||||
obj-$(CONFIG_WIN32) += gloffscreen_wgl.o
|
||||
obj-$(CONFIG_DARWIN) += gloffscreen_cgl.o
|
||||
obj-$(CONFIG_LINUX) += gloffscreen_glx.o
|
||||
|
|
|
@ -1,46 +0,0 @@
|
|||
/*
|
||||
* QEMU OpenGL extensions
|
||||
*
|
||||
* Copyright (c) 2015 espes
|
||||
*
|
||||
* This program 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 Foundation; either version 2 or
|
||||
* (at your option) version 3 of the License.
|
||||
*
|
||||
* This program 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 this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "gloffscreen.h"
|
||||
#include "glextensions.h"
|
||||
|
||||
#ifdef __APPLE__
|
||||
void (*glFrameTerminatorGREMEDY)(void);
|
||||
|
||||
void (*glDebugMessageInsert) (GLenum source, GLenum type, GLuint id,
|
||||
GLenum severity, GLsizei length,
|
||||
const GLchar *buf);
|
||||
void (*glPushDebugGroup)(GLenum source, GLuint id, GLsizei length,
|
||||
const GLchar *message);
|
||||
void (*glPopDebugGroup)(void);
|
||||
void (*glObjectLabel)(GLenum identifier, GLuint name, GLsizei length,
|
||||
const GLchar *label);
|
||||
|
||||
#endif
|
||||
|
||||
void glextensions_init(void)
|
||||
{
|
||||
#ifdef __APPLE__
|
||||
glFrameTerminatorGREMEDY =
|
||||
glo_get_extension_proc("glFrameTerminatorGREMEDY");
|
||||
glDebugMessageInsert = glo_get_extension_proc("glDebugMessageInsert");
|
||||
glPushDebugGroup = glo_get_extension_proc("glPushDebugGroup");
|
||||
glPopDebugGroup = glo_get_extension_proc("glPopDebugGroup");
|
||||
glObjectLabel = glo_get_extension_proc("glObjectLabel");
|
||||
#endif
|
||||
}
|
|
@ -1,44 +0,0 @@
|
|||
/*
|
||||
* QEMU OpenGL extensions
|
||||
*
|
||||
* Copyright (c) 2015 espes
|
||||
*
|
||||
* This program 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 Foundation; either version 2 or
|
||||
* (at your option) version 3 of the License.
|
||||
*
|
||||
* This program 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 this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef GLEXTEENSIONS_H_
|
||||
#define GLEXTEENSIONS_H_
|
||||
|
||||
#ifdef __APPLE__
|
||||
#include "gloffscreen.h"
|
||||
extern void (*glFrameTerminatorGREMEDY)(void);
|
||||
|
||||
#define GL_DEBUG_SOURCE_APPLICATION 0x824A
|
||||
#define GL_DEBUG_TYPE_MARKER 0x8268
|
||||
#define GL_DEBUG_SEVERITY_NOTIFICATION 0x826B
|
||||
#define GL_DEBUG_OUTPUT 0x92E0
|
||||
|
||||
extern void (*glDebugMessageInsert) (GLenum source, GLenum type, GLuint id,
|
||||
GLenum severity, GLsizei length,
|
||||
const GLchar *buf);
|
||||
extern void (*glPushDebugGroup)(GLenum source, GLuint id, GLsizei length,
|
||||
const GLchar *message);
|
||||
extern void (*glPopDebugGroup)(void);
|
||||
extern void (*glObjectLabel)(GLenum identifier, GLuint name, GLsizei length,
|
||||
const GLchar *label);
|
||||
|
||||
#endif
|
||||
|
||||
void glextensions_init(void);
|
||||
|
||||
#endif
|
|
@ -31,20 +31,16 @@
|
|||
|
||||
#include <stdbool.h>
|
||||
|
||||
#include <epoxy/gl.h>
|
||||
|
||||
#if defined(__APPLE__) /* macOS-Specific GL Includes */
|
||||
#include <OpenGL/OpenGL.h>
|
||||
#include <OpenGL/gl3.h>
|
||||
#include <OpenGL/glext.h>
|
||||
#elif defined(_WIN32) /* Windows-Specific GL Includes */
|
||||
#include <GL/glew.h>
|
||||
#include <GL/wglew.h>
|
||||
#include <GL/gl.h>
|
||||
#include <GL/wglext.h>
|
||||
#include <epoxy/wgl.h>
|
||||
#else /* Assume GLX */
|
||||
#include <GL/glew.h>
|
||||
#include <GL/glx.h>
|
||||
#include <GL/glxext.h>
|
||||
#include <GL/gl.h>
|
||||
#include <epoxy/glx.h>
|
||||
#endif
|
||||
|
||||
/* Used to hold data for the OpenGL context */
|
||||
|
@ -56,7 +52,6 @@ void glo_set_current(GloContext *context);
|
|||
|
||||
/* Check GL Extensions */
|
||||
bool glo_check_extension(const char* ext_name);
|
||||
void* glo_get_extension_proc(const char* extProc);
|
||||
|
||||
/* Create an OpenGL context */
|
||||
GloContext *glo_context_create(void);
|
||||
|
|
|
@ -77,15 +77,7 @@ void glo_readpixels(GLenum gl_format, GLenum gl_type,
|
|||
glPixelStorei(GL_PACK_ALIGNMENT, pa);
|
||||
}
|
||||
|
||||
|
||||
bool glo_check_extension(const char* ext_name)
|
||||
{
|
||||
int i;
|
||||
int num_extensions = GL_NUM_EXTENSIONS;
|
||||
for (i=0; i<num_extensions; i++) {
|
||||
const char* ext = (const char*)glGetStringi(GL_EXTENSIONS, i);
|
||||
if (!ext) break;
|
||||
if (strcmp(ext, ext_name) == 0) return true;
|
||||
}
|
||||
return false;
|
||||
return epoxy_has_gl_extension(ext_name);
|
||||
}
|
||||
|
|
|
@ -105,28 +105,13 @@ GloContext *glo_context_create(void)
|
|||
if (context->glx_context == NULL) return NULL;
|
||||
glo_set_current(context);
|
||||
|
||||
if (!initialized) {
|
||||
/* Initialize glew */
|
||||
glewExperimental = GL_TRUE;
|
||||
if (GLEW_OK != glewInit()) {
|
||||
/* GLEW failed! */
|
||||
fprintf(stderr,"GLEW init failed.\n");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
/* Get rid of GLEW errors */
|
||||
while(glGetError() != GL_NO_ERROR);
|
||||
}
|
||||
/* Get rid of possible errors from within GL wrapper or glo */
|
||||
while(glGetError() != GL_NO_ERROR);
|
||||
|
||||
initialized = true;
|
||||
return context;
|
||||
}
|
||||
|
||||
void* glo_get_extension_proc(const char* ext_proc)
|
||||
{
|
||||
return glXGetProcAddress((const GLubyte *)ext_proc);
|
||||
}
|
||||
|
||||
/* Set current context */
|
||||
void glo_set_current(GloContext *context)
|
||||
{
|
||||
|
|
|
@ -126,15 +126,9 @@ static void glo_init(void) {
|
|||
}
|
||||
wglMakeCurrent(glo.hDC, glo.hContext);
|
||||
|
||||
/* Initialize glew */
|
||||
if (glewInit() != GLEW_OK) {
|
||||
fprintf(stderr, "Glew init failed.\n");
|
||||
abort();
|
||||
}
|
||||
|
||||
if (!WGLEW_ARB_create_context
|
||||
|| !WGLEW_ARB_pixel_format
|
||||
|| !WGLEW_ARB_pbuffer) {
|
||||
if (!epoxy_has_wgl_extension(glo.hDC, "ARB_create_context")
|
||||
|| !epoxy_has_wgl_extension(glo.hDC, "ARB_pixel_format")
|
||||
|| !epoxy_has_wgl_extension(glo.hDC, "ARB_pbuffer")) {
|
||||
fprintf(stderr, "Unable to load the required WGL extensions\n");
|
||||
abort();
|
||||
}
|
||||
|
@ -187,8 +181,9 @@ GloContext *glo_context_create(void) {
|
|||
}
|
||||
|
||||
/* Set current context */
|
||||
void glo_set_current(GloContext *context) {
|
||||
|
||||
void glo_set_current(GloContext *context)
|
||||
{
|
||||
epoxy_handle_external_wglMakeCurrent();
|
||||
if (context == NULL) {
|
||||
wglMakeCurrent(NULL, NULL);
|
||||
} else {
|
||||
|
|
|
@ -40,7 +40,6 @@
|
|||
#include "nv2a_int.h"
|
||||
|
||||
#include "gl/gloffscreen.h"
|
||||
#include "gl/glextensions.h"
|
||||
|
||||
#define USE_TEXTURE_CACHE
|
||||
|
||||
|
|
|
@ -29,6 +29,14 @@
|
|||
#include "nv2a_debug.h"
|
||||
#include "gl/glextensions.h"
|
||||
|
||||
|
||||
void gl_debug_initialize(void)
|
||||
{
|
||||
if (glo_check_extension("GL_KHR_debug")) {
|
||||
glEnable(GL_DEBUG_OUTPUT);
|
||||
}
|
||||
}
|
||||
|
||||
void gl_debug_message(bool cc, const char *fmt, ...)
|
||||
{
|
||||
size_t n;
|
||||
|
|
|
@ -2641,11 +2641,9 @@ void pgraph_init(NV2AState *d)
|
|||
assert(pg->gl_context);
|
||||
|
||||
#ifdef DEBUG_NV2A_GL
|
||||
glEnable(GL_DEBUG_OUTPUT);
|
||||
gl_debug_initialize();
|
||||
#endif
|
||||
|
||||
glextensions_init();
|
||||
|
||||
/* DXT textures */
|
||||
assert(glo_check_extension("GL_EXT_texture_compression_s3tc"));
|
||||
/* Internal RGB565 texture format */
|
||||
|
|
Loading…
Reference in New Issue