mirror of
https://github.com/libretro/RetroArch
synced 2025-01-26 09:35:21 +00:00
Clean up ugly inline stuff. :\
This commit is contained in:
parent
36d9adbc0f
commit
2f858b7948
@ -15,6 +15,7 @@ HAVE_RSOUND = 1
|
|||||||
HAVE_DYLIB = 1
|
HAVE_DYLIB = 1
|
||||||
HAVE_NETPLAY = 1
|
HAVE_NETPLAY = 1
|
||||||
HAVE_FBO = 1
|
HAVE_FBO = 1
|
||||||
|
HAVE_CG = 0
|
||||||
libsnes ?= -lsnes
|
libsnes ?= -lsnes
|
||||||
|
|
||||||
LIBS = -lm
|
LIBS = -lm
|
||||||
@ -38,6 +39,12 @@ ifeq ($(HAVE_SDL), 1)
|
|||||||
DEFINES += $(SDL_CFLAGS) -DHAVE_SDL
|
DEFINES += $(SDL_CFLAGS) -DHAVE_SDL
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifeq ($(HAVE_CG), 1)
|
||||||
|
OBJ += gfx/shader_cg.o
|
||||||
|
LIBS += -lcg -lcgGL
|
||||||
|
DEFINES += -DHAVE_CG
|
||||||
|
endif
|
||||||
|
|
||||||
ifeq ($(HAVE_XAUDIO), 1)
|
ifeq ($(HAVE_XAUDIO), 1)
|
||||||
OBJ += audio/xaudio.o
|
OBJ += audio/xaudio.o
|
||||||
DEFINES += -DHAVE_XAUDIO
|
DEFINES += -DHAVE_XAUDIO
|
||||||
|
@ -15,6 +15,7 @@ HAVE_RSOUND = 0
|
|||||||
HAVE_DYLIB = 1
|
HAVE_DYLIB = 1
|
||||||
HAVE_NETPLAY = 1
|
HAVE_NETPLAY = 1
|
||||||
HAVE_FBO = 1
|
HAVE_FBO = 1
|
||||||
|
HAVE_CG = 0
|
||||||
libsnes ?= -lsnes
|
libsnes ?= -lsnes
|
||||||
|
|
||||||
LIBS = -lm
|
LIBS = -lm
|
||||||
@ -38,6 +39,12 @@ ifeq ($(HAVE_SDL), 1)
|
|||||||
DEFINES += $(SDL_CFLAGS) -DHAVE_SDL
|
DEFINES += $(SDL_CFLAGS) -DHAVE_SDL
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifeq ($(HAVE_CG), 1)
|
||||||
|
OBJ += gfx/shader_cg.o
|
||||||
|
LIBS += -lcg -lcgGL
|
||||||
|
DEFINES += -DHAVE_CG
|
||||||
|
endif
|
||||||
|
|
||||||
ifeq ($(HAVE_XAUDIO), 1)
|
ifeq ($(HAVE_XAUDIO), 1)
|
||||||
OBJ += audio/xaudio.o
|
OBJ += audio/xaudio.o
|
||||||
DEFINES += -DHAVE_XAUDIO
|
DEFINES += -DHAVE_XAUDIO
|
||||||
|
30
gfx/gl.c
30
gfx/gl.c
@ -103,6 +103,22 @@ static bool load_fbo_proc(void) { return true; }
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(HAVE_XML) && defined(_WIN32)
|
||||||
|
PFNGLCLIENTACTIVETEXTUREPROC pglClientActiveTexture = NULL;
|
||||||
|
PFNGLACTIVETEXTUREPROC pglActiveTexture = NULL;
|
||||||
|
static inline bool load_gl_proc(void)
|
||||||
|
{
|
||||||
|
LOAD_SYM(glClientActiveTexture);
|
||||||
|
LOAD_SYM(glActiveTexture);
|
||||||
|
|
||||||
|
return pglClientActiveTexture && pglActiveTexture;
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
#define pglClientActiveTexture glClientActiveTexture
|
||||||
|
#define pglActiveTexture glActiveTexture
|
||||||
|
static inline bool load_gl_proc(void) { return true; }
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#define MAX_SHADERS 16
|
#define MAX_SHADERS 16
|
||||||
|
|
||||||
@ -929,10 +945,22 @@ static void* gl_init(const video_info_t *video, const input_driver_t **input, vo
|
|||||||
if (attr <= 0)
|
if (attr <= 0)
|
||||||
SSNES_WARN("GL double buffer has not been enabled!\n");
|
SSNES_WARN("GL double buffer has not been enabled!\n");
|
||||||
|
|
||||||
|
#if defined(HAVE_XML) && defined(_WIN32)
|
||||||
|
// Win32 GL lib doesn't have some functions needed for XML shaders.
|
||||||
|
// Need to load dynamically :(
|
||||||
|
if (!load_gl_proc())
|
||||||
|
{
|
||||||
|
SDL_QuitSubSystem(SDL_INIT_VIDEO);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
gl_t *gl = calloc(1, sizeof(gl_t));
|
gl_t *gl = calloc(1, sizeof(gl_t));
|
||||||
if (!gl)
|
if (!gl)
|
||||||
|
{
|
||||||
|
SDL_QuitSubSystem(SDL_INIT_VIDEO);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
gl->full_x = full_x;
|
gl->full_x = full_x;
|
||||||
gl->full_y = full_y;
|
gl->full_y = full_y;
|
||||||
@ -1012,8 +1040,6 @@ static void* gl_init(const video_info_t *video, const input_driver_t **input, vo
|
|||||||
|
|
||||||
#ifdef HAVE_XML
|
#ifdef HAVE_XML
|
||||||
// For texture images.
|
// For texture images.
|
||||||
// Win32 GL lib doesn't have this. Just remacro for other platforms.
|
|
||||||
load_gl_proc();
|
|
||||||
pglClientActiveTexture(GL_TEXTURE1);
|
pglClientActiveTexture(GL_TEXTURE1);
|
||||||
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
|
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||||
glTexCoordPointer(2, GL_FLOAT, 2 * sizeof(GLfloat), tex_coords);
|
glTexCoordPointer(2, GL_FLOAT, 2 * sizeof(GLfloat), tex_coords);
|
||||||
|
@ -34,10 +34,6 @@
|
|||||||
#include <GL/glext.h>
|
#include <GL/glext.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define NO_SDL_GLEXT
|
|
||||||
#include "SDL.h"
|
|
||||||
#include "SDL_opengl.h"
|
|
||||||
|
|
||||||
static inline bool gl_check_error(void)
|
static inline bool gl_check_error(void)
|
||||||
{
|
{
|
||||||
int error = glGetError();
|
int error = glGetError();
|
||||||
@ -103,23 +99,12 @@ struct gl_fbo_scale
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Windows ... <_<
|
// Windows ... <_<
|
||||||
#ifdef HAVE_XML
|
#if defined(HAVE_XML) && defined(_WIN32)
|
||||||
#ifdef _WIN32
|
extern PFNGLCLIENTACTIVETEXTUREPROC pglClientActiveTexture;
|
||||||
static PFNGLCLIENTACTIVETEXTUREPROC pglClientActiveTexture = NULL;
|
extern PFNGLACTIVETEXTUREPROC pglActiveTexture;
|
||||||
static PFNGLACTIVETEXTUREPROC pglActiveTexture = NULL;
|
|
||||||
#define LOAD_SYM(sym) if (!p##sym) p##sym = ((void*)SDL_GL_GetProcAddress(#sym))
|
|
||||||
static void load_gl_proc(void)
|
|
||||||
{
|
|
||||||
LOAD_SYM(glClientActiveTexture);
|
|
||||||
LOAD_SYM(glActiveTexture);
|
|
||||||
|
|
||||||
assert(pglClientActiveTexture && pglActiveTexture);
|
|
||||||
}
|
|
||||||
#else
|
#else
|
||||||
#define pglClientActiveTexture glClientActiveTexture
|
#define pglClientActiveTexture glClientActiveTexture
|
||||||
#define pglActiveTexture glActiveTexture
|
#define pglActiveTexture glActiveTexture
|
||||||
#define load_gl_proc()
|
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -330,12 +330,8 @@ static bool get_texture_image(const char *shader_path, xmlNodePtr ptr)
|
|||||||
|
|
||||||
glGenTextures(1, &gl_teximage[gl_teximage_cnt]);
|
glGenTextures(1, &gl_teximage[gl_teximage_cnt]);
|
||||||
|
|
||||||
// Win32 GL lib doesn't have this. Just remacro for other platforms.
|
|
||||||
load_gl_proc();
|
|
||||||
pglActiveTexture(GL_TEXTURE0 + gl_teximage_cnt + 1);
|
pglActiveTexture(GL_TEXTURE0 + gl_teximage_cnt + 1);
|
||||||
|
|
||||||
glBindTexture(GL_TEXTURE_2D, gl_teximage[gl_teximage_cnt]);
|
glBindTexture(GL_TEXTURE_2D, gl_teximage[gl_teximage_cnt]);
|
||||||
|
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_BORDER);
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_BORDER);
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_BORDER);
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_BORDER);
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, linear ? GL_LINEAR : GL_NEAREST);
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, linear ? GL_LINEAR : GL_NEAREST);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user