*Shrug* windows. Works at least ... :D

This commit is contained in:
Themaister 2011-05-18 22:11:34 +02:00
parent 9473b392df
commit 36d9adbc0f
8 changed files with 53 additions and 8 deletions

View File

@ -2,7 +2,7 @@ include config.mk
TARGET = ssnes tools/ssnes-joyconfig
OBJ = ssnes.o file.o driver.o settings.o dynamic.o message.o rewind.o movie.o autosave.o gfx/gfx_common.o ups.o strl.o screenshot.o gfx/image.o
OBJ = ssnes.o file.o driver.o settings.o dynamic.o message.o rewind.o movie.o autosave.o gfx/gfx_common.o ups.o strl.o screenshot.o
JOYCONFIG_OBJ = tools/ssnes-joyconfig.o conf/config_file.o
HEADERS = $(wildcard */*.h) $(wildcard *.h)
@ -92,7 +92,7 @@ ifeq ($(HAVE_CG), 1)
endif
ifeq ($(HAVE_XML), 1)
OBJ += gfx/shader_glsl.o sha256.o cheats.o
OBJ += gfx/shader_glsl.o gfx/image.o sha256.o cheats.o
LIBS += $(XML_LIBS)
DEFINES += $(XML_CFLAGS)
endif

View File

@ -50,7 +50,7 @@ ifeq ($(HAVE_RSOUND), 1)
endif
ifeq ($(HAVE_XML), 1)
OBJ += gfx/shader_glsl.o sha256.o cheats.o
OBJ += gfx/shader_glsl.o gfx/image.o sha256.o cheats.o
DEFINES += $(XML_CFLAGS) -DHAVE_XML
LIBS += -lxml2
endif

View File

@ -50,7 +50,7 @@ ifeq ($(HAVE_RSOUND), 1)
endif
ifeq ($(HAVE_XML), 1)
OBJ += gfx/shader_glsl.o sha256.o cheats.o
OBJ += gfx/shader_glsl.o gfx/image.o sha256.o cheats.o
DEFINES += $(XML_CFLAGS) -DHAVE_XML -DLIBXML_STATIC
LIBS += -lxml2 -lz -lws2_32
endif

View File

@ -80,6 +80,12 @@ static const bool _xml_supp = true;
static const bool _xml_supp = false;
#endif
#ifdef HAVE_IMLIB
static const bool _imlib_supp = true;
#else
static const bool _imlib_supp = false;
#endif
#ifdef HAVE_FBO
static const bool _fbo_supp = true;
#else

View File

@ -103,6 +103,7 @@ static bool load_fbo_proc(void) { return true; }
#endif
#endif
#define MAX_SHADERS 16
typedef struct gl
@ -1009,11 +1010,15 @@ static void* gl_init(const video_info_t *video, const input_driver_t **input, vo
memcpy(gl->tex_coords, tex_coords, sizeof(tex_coords));
glTexCoordPointer(2, GL_FLOAT, 2 * sizeof(GLfloat), gl->tex_coords);
#ifdef HAVE_XML
// For texture images.
glClientActiveTexture(GL_TEXTURE1);
// Win32 GL lib doesn't have this. Just remacro for other platforms.
load_gl_proc();
pglClientActiveTexture(GL_TEXTURE1);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glTexCoordPointer(2, GL_FLOAT, 2 * sizeof(GLfloat), tex_coords);
glClientActiveTexture(GL_TEXTURE0);
pglClientActiveTexture(GL_TEXTURE0);
#endif
gl->tex_w = 256 * video->input_scale;
gl->tex_h = 256 * video->input_scale;

View File

@ -19,6 +19,11 @@
#define __GL_COMMON_H
#include "general.h"
#include <assert.h>
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#ifdef __APPLE__
#include <OpenGL/gl.h>
@ -29,6 +34,10 @@
#include <GL/glext.h>
#endif
#define NO_SDL_GLEXT
#include "SDL.h"
#include "SDL_opengl.h"
static inline bool gl_check_error(void)
{
int error = glGetError();
@ -93,4 +102,24 @@ struct gl_fbo_scale
bool valid;
};
// Windows ... <_<
#ifdef HAVE_XML
#ifdef _WIN32
static PFNGLCLIENTACTIVETEXTUREPROC pglClientActiveTexture = NULL;
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
#define pglClientActiveTexture glClientActiveTexture
#define pglActiveTexture glActiveTexture
#define load_gl_proc()
#endif
#endif
#endif

View File

@ -329,7 +329,11 @@ static bool get_texture_image(const char *shader_path, xmlNodePtr ptr)
strlcpy(gl_teximage_uniforms[gl_teximage_cnt], (const char*)id, sizeof(gl_teximage_uniforms[0]));
glGenTextures(1, &gl_teximage[gl_teximage_cnt]);
glActiveTexture(GL_TEXTURE0 + gl_teximage_cnt + 1);
// Win32 GL lib doesn't have this. Just remacro for other platforms.
load_gl_proc();
pglActiveTexture(GL_TEXTURE0 + gl_teximage_cnt + 1);
glBindTexture(GL_TEXTURE_2D, gl_teximage[gl_teximage_cnt]);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_BORDER);
@ -342,7 +346,7 @@ static bool get_texture_image(const char *shader_path, xmlNodePtr ptr)
glTexImage2D(GL_TEXTURE_2D,
0, GL_RGBA, img.width, img.height, 0, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8, img.pixels);
glActiveTexture(GL_TEXTURE0);
pglActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, 0);
free(img.pixels);

View File

@ -340,6 +340,7 @@ static void print_features(void)
_PSUPP(dylib, "External", "External filter and driver support");
_PSUPP(cg, "Cg", "Cg pixel shaders");
_PSUPP(xml, "XML", "bSNES XML pixel shaders");
_PSUPP(imlib, "Imlib2", "Imlib2 image loading");
_PSUPP(fbo, "FBO", "OpenGL render-to-texture (multi-pass shaders)");
_PSUPP(dynamic, "Dynamic", "Dynamic run-time loading of libsnes library");
_PSUPP(ffmpeg, "FFmpeg", "On-the-fly recording of gameplay with libavcodec");