mirror of https://github.com/adamdruppe/arsd.git
ketmar fixes for compiling into .a lib
This commit is contained in:
parent
c5a62eb725
commit
31e86b22cc
|
@ -7576,12 +7576,10 @@ version(X11) {
|
||||||
version(without_opengl) {}
|
version(without_opengl) {}
|
||||||
else {
|
else {
|
||||||
if(opengl == OpenGlOptions.yes) {
|
if(opengl == OpenGlOptions.yes) {
|
||||||
glxInitOtherFunctions(); // load some OpenGL functions; it doesn't hurt to call this repeatedly
|
|
||||||
|
|
||||||
GLXFBConfig fbconf = null;
|
GLXFBConfig fbconf = null;
|
||||||
XVisualInfo* vi = null;
|
XVisualInfo* vi = null;
|
||||||
bool useLegacy = false;
|
bool useLegacy = false;
|
||||||
if (sdpyOpenGLContextVersion != 0 && glXCreateContextAttribsARB !is null) {
|
if (sdpyOpenGLContextVersion != 0 && glXCreateContextAttribsARB_present()) {
|
||||||
int[23] visualAttribs = [
|
int[23] visualAttribs = [
|
||||||
GLX_X_RENDERABLE , 1/*True*/,
|
GLX_X_RENDERABLE , 1/*True*/,
|
||||||
GLX_DRAWABLE_TYPE, GLX_WINDOW_BIT,
|
GLX_DRAWABLE_TYPE, GLX_WINDOW_BIT,
|
||||||
|
@ -10996,26 +10994,39 @@ extern(System) nothrow @nogc {
|
||||||
alias glXSwapIntervalEXT = void function (Display* dpy, /*GLXDrawable*/Drawable drawable, int interval);
|
alias glXSwapIntervalEXT = void function (Display* dpy, /*GLXDrawable*/Drawable drawable, int interval);
|
||||||
private __gshared glXSwapIntervalEXT _glx_swapInterval_fn = null;
|
private __gshared glXSwapIntervalEXT _glx_swapInterval_fn = null;
|
||||||
|
|
||||||
alias glXCreateContextAttribsARB_fna = GLXContext function (Display *dpy, GLXFBConfig config, GLXContext share_context, /*Bool*/int direct, const(int)* attrib_list);
|
//k8: ugly code to prevent warnings when sdpy is compiled into .a
|
||||||
__gshared glXCreateContextAttribsARB_fna glXCreateContextAttribsARB = null; // this made public so we don't have to get it again and again; it will become valid after window creation
|
extern(System) {
|
||||||
|
alias glXCreateContextAttribsARB_fna = GLXContext function (Display *dpy, GLXFBConfig config, GLXContext share_context, /*Bool*/int direct, const(int)* attrib_list);
|
||||||
|
}
|
||||||
|
private __gshared /*glXCreateContextAttribsARB_fna*/void* glXCreateContextAttribsARBFn = cast(void*)1; //HACK!
|
||||||
|
|
||||||
void glxInitOtherFunctions () {
|
// this made public so we don't have to get it again and again
|
||||||
if (glXCreateContextAttribsARB is null) {
|
public bool glXCreateContextAttribsARB_present () {
|
||||||
glXCreateContextAttribsARB = cast(glXCreateContextAttribsARB_fna)glGetProcAddress("glXCreateContextAttribsARB");
|
if (glXCreateContextAttribsARBFn is cast(void*)1) {
|
||||||
|
// get it
|
||||||
|
glXCreateContextAttribsARBFn = cast(void*)glGetProcAddress("glXCreateContextAttribsARB");
|
||||||
|
//{ import core.stdc.stdio; printf("checking glXCreateContextAttribsARB: %shere\n", (glXCreateContextAttribsARBFn !is null ? "".ptr : "not ".ptr)); }
|
||||||
}
|
}
|
||||||
|
return (glXCreateContextAttribsARBFn !is null);
|
||||||
|
}
|
||||||
|
|
||||||
|
// this made public so we don't have to get it again and again
|
||||||
|
public GLXContext glXCreateContextAttribsARB (Display *dpy, GLXFBConfig config, GLXContext share_context, /*Bool*/int direct, const(int)* attrib_list) {
|
||||||
|
if (!glXCreateContextAttribsARB_present()) assert(0, "glXCreateContextAttribsARB is not present");
|
||||||
|
return (cast(glXCreateContextAttribsARB_fna)glXCreateContextAttribsARBFn)(dpy, config, share_context, direct, attrib_list);
|
||||||
}
|
}
|
||||||
|
|
||||||
void glxSetVSync (Display* dpy, /*GLXDrawable*/Drawable drawable, bool wait) {
|
void glxSetVSync (Display* dpy, /*GLXDrawable*/Drawable drawable, bool wait) {
|
||||||
if (cast(void*)_glx_swapInterval_fn is cast(void*)1) return;
|
if (cast(void*)_glx_swapInterval_fn is cast(void*)1) return;
|
||||||
if (_glx_swapInterval_fn is null) {
|
if (_glx_swapInterval_fn is null) {
|
||||||
_glx_swapInterval_fn = cast(glXSwapIntervalEXT)glXGetProcAddress("glXSwapIntervalEXT");
|
_glx_swapInterval_fn = cast(glXSwapIntervalEXT)glXGetProcAddress("glXSwapIntervalEXT");
|
||||||
if (_glx_swapInterval_fn is null) {
|
if (_glx_swapInterval_fn is null) {
|
||||||
_glx_swapInterval_fn = cast(glXSwapIntervalEXT)1;
|
_glx_swapInterval_fn = cast(glXSwapIntervalEXT)1;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
version(sdddd) { import std.stdio; writeln("glXSwapIntervalEXT found!"); }
|
version(sdddd) { import std.stdio; writeln("glXSwapIntervalEXT found!"); }
|
||||||
}
|
}
|
||||||
_glx_swapInterval_fn(dpy, drawable, (wait ? 1 : 0));
|
_glx_swapInterval_fn(dpy, drawable, (wait ? 1 : 0));
|
||||||
}
|
}
|
||||||
} else version(Windows) {
|
} else version(Windows) {
|
||||||
enum GL_TRUE = 1;
|
enum GL_TRUE = 1;
|
||||||
|
|
Loading…
Reference in New Issue