Moved Quartz SDL_GL_LoadLibrary() to SDL_loadso interface.
--HG-- extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%401192
This commit is contained in:
parent
5e5e820c40
commit
c154edb92f
3 changed files with 15 additions and 45 deletions
|
@ -166,63 +166,33 @@ void QZ_TearDownOpenGL (_THIS) {
|
||||||
|
|
||||||
|
|
||||||
/* SDL OpenGL functions */
|
/* SDL OpenGL functions */
|
||||||
|
static const char *DEFAULT_OPENGL_LIB_NAME =
|
||||||
|
"/System/Library/Frameworks/OpenGL.framework/Libraries/libGL.dylib";
|
||||||
|
|
||||||
int QZ_GL_LoadLibrary (_THIS, const char *location) {
|
int QZ_GL_LoadLibrary (_THIS, const char *location) {
|
||||||
CFURLRef bundleURL;
|
|
||||||
CFStringRef cfstr;
|
|
||||||
|
|
||||||
if ( gl_context != NULL ) {
|
if ( gl_context != NULL ) {
|
||||||
SDL_SetError("OpenGL context already created");
|
SDL_SetError("OpenGL context already created");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (opengl_bundle != NULL)
|
if (opengl_library != NULL)
|
||||||
CFRelease(opengl_bundle);
|
SDL_UnloadObject(opengl_library);
|
||||||
|
|
||||||
opengl_bundle = NULL;
|
|
||||||
this->gl_config.driver_loaded = 0;
|
|
||||||
|
|
||||||
if (location == NULL)
|
if (location == NULL)
|
||||||
location = "/System/Library/Frameworks/OpenGL.framework";
|
location = DEFAULT_OPENGL_LIB_NAME;
|
||||||
|
|
||||||
cfstr = CFStringCreateWithCString(kCFAllocatorDefault, location,
|
opengl_library = SDL_LoadObject(location);
|
||||||
kCFStringEncodingUTF8);
|
if (opengl_library != NULL) {
|
||||||
if (cfstr == NULL) {
|
|
||||||
SDL_OutOfMemory();
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
bundleURL = CFURLCreateWithFileSystemPath (kCFAllocatorDefault,
|
|
||||||
cfstr, kCFURLPOSIXPathStyle, true);
|
|
||||||
|
|
||||||
CFRelease(cfstr);
|
|
||||||
|
|
||||||
if (bundleURL == NULL) {
|
|
||||||
SDL_OutOfMemory();
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
opengl_bundle = CFBundleCreate (kCFAllocatorDefault, bundleURL);
|
|
||||||
|
|
||||||
CFRelease(bundleURL);
|
|
||||||
|
|
||||||
if (opengl_bundle != NULL) {
|
|
||||||
this->gl_config.driver_loaded = 1;
|
this->gl_config.driver_loaded = 1;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* not exactly descriptive, but okay... */
|
this->gl_config.driver_loaded = 0;
|
||||||
SDL_SetError("Could not load OpenGL library");
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void* QZ_GL_GetProcAddress (_THIS, const char *proc) {
|
void* QZ_GL_GetProcAddress (_THIS, const char *proc) {
|
||||||
CFStringRef funcName = CFStringCreateWithCString
|
return SDL_LoadFunction(opengl_library, proc);
|
||||||
(kCFAllocatorDefault, proc, kCFStringEncodingASCII);
|
|
||||||
|
|
||||||
void *func = CFBundleGetFunctionPointerForName(opengl_bundle, funcName);
|
|
||||||
CFRelease (funcName);
|
|
||||||
return func;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int QZ_GL_GetAttribute (_THIS, SDL_GLattr attrib, int* value) {
|
int QZ_GL_GetAttribute (_THIS, SDL_GLattr attrib, int* value) {
|
||||||
|
|
|
@ -64,6 +64,7 @@
|
||||||
#include "SDL_sysvideo.h"
|
#include "SDL_sysvideo.h"
|
||||||
#include "SDL_pixels_c.h"
|
#include "SDL_pixels_c.h"
|
||||||
#include "SDL_events_c.h"
|
#include "SDL_events_c.h"
|
||||||
|
#include "SDL_loadso.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
This is a workaround to directly access NSOpenGLContext's CGL context
|
This is a workaround to directly access NSOpenGLContext's CGL context
|
||||||
|
@ -117,7 +118,7 @@ typedef struct SDL_PrivateVideoData {
|
||||||
Sint16 yuv_width, yuv_height;
|
Sint16 yuv_width, yuv_height;
|
||||||
CGrafPtr yuv_port;
|
CGrafPtr yuv_port;
|
||||||
|
|
||||||
CFBundleRef opengl_bundle; /* dynamically loaded OpenGL library. */
|
void *opengl_library; /* dynamically loaded OpenGL library. */
|
||||||
} SDL_PrivateVideoData;
|
} SDL_PrivateVideoData;
|
||||||
|
|
||||||
#define _THIS SDL_VideoDevice *this
|
#define _THIS SDL_VideoDevice *this
|
||||||
|
@ -155,7 +156,7 @@ typedef struct SDL_PrivateVideoData {
|
||||||
#define current_buffer (this->hidden->current_buffer)
|
#define current_buffer (this->hidden->current_buffer)
|
||||||
#define quit_thread (this->hidden->quit_thread)
|
#define quit_thread (this->hidden->quit_thread)
|
||||||
#define system_version (this->hidden->system_version)
|
#define system_version (this->hidden->system_version)
|
||||||
#define opengl_bundle (this->hidden->opengl_bundle)
|
#define opengl_library (this->hidden->opengl_library)
|
||||||
|
|
||||||
/* grab states - the input is in one of these states */
|
/* grab states - the input is in one of these states */
|
||||||
enum {
|
enum {
|
||||||
|
|
|
@ -23,7 +23,6 @@
|
||||||
#include "SDL_QuartzVideo.h"
|
#include "SDL_QuartzVideo.h"
|
||||||
#include "SDL_QuartzWindow.h"
|
#include "SDL_QuartzWindow.h"
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Add methods to get at private members of NSScreen.
|
Add methods to get at private members of NSScreen.
|
||||||
Since there is a bug in Apple's screen switching code
|
Since there is a bug in Apple's screen switching code
|
||||||
|
@ -1495,9 +1494,9 @@ static void QZ_VideoQuit (_THIS) {
|
||||||
QZ_UnsetVideoMode (this);
|
QZ_UnsetVideoMode (this);
|
||||||
CGPaletteRelease (palette);
|
CGPaletteRelease (palette);
|
||||||
|
|
||||||
if (opengl_bundle) {
|
if (opengl_library) {
|
||||||
CFRelease(opengl_bundle);
|
SDL_UnloadObject(opengl_library);
|
||||||
opengl_bundle = NULL;
|
opengl_library = NULL;
|
||||||
}
|
}
|
||||||
this->gl_config.driver_loaded = 0;
|
this->gl_config.driver_loaded = 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue