Eric Anholt
c4214a39f4
win32: Reset all dispatch tables to re-resolve on any wglMakeCurrent.
2013-12-17 14:12:14 -08:00
Eric Anholt
8dcd1512db
Drop the PLATFORM_HAS_EGL check in epoxy_egl_dlsym().
...
If you accidentally call it on a non-egl platform, better to get an
informative error message.
2013-12-17 12:11:05 -08:00
Eric Anholt
5112b477c2
win32: Move dynamic symbol loading to do_dlsym().
...
This should help get us better error handling when we accidentally
call the wrong loader path.
2013-12-17 12:11:05 -08:00
Eric Anholt
417927e2eb
win32: Start wrapping the 1.0 wgl functions.
...
I want to have a chance to intercept wglMakeCurrent for WGL's
context-dependent function pointer handling.
2013-12-17 12:11:05 -08:00
Eric Anholt
9a7be0784f
win32: Use thread local storage to get us a dispatch table per thread.
2013-12-17 12:11:05 -08:00
Eric Anholt
8022cda75d
Don't forget to tell our users that the epoxy GL functions are __dllimport.
...
This lets the compiler generate faster function calls (call through
function pointer, instead of call into a linker-generated stub func
containing jump to function pointer).
2013-12-17 12:10:34 -08:00
Eric Anholt
920543faa4
Add and clean up some more comments in the python.
...
Fixes #8
2013-12-16 10:43:29 -08:00
Eric Anholt
7a8553f799
Update python comments about aliases.
2013-12-16 10:43:25 -08:00
Eric Anholt
bf628d9cf3
Add support for lower-priority aliases of functions.
...
For example, on desktop 2.1 GL on Apple, there's no glBindVertexArray,
but there is glBindVertexArrayAPPLE, and as far as a caller is
concerned, the APPLE variant should be able to stand in for the
core/ARB version. Similarly for trying to do FBOs on an old Mesa
implementation that didn't have ARB_fbo yet, but did have EXT_fbo.
2013-12-16 09:33:33 -08:00
Eric Anholt
972989b4ce
Fix copyrights on the Makefile.ams.
...
When initially writing the Makefiles, I started from a Makefile.am
that had ajax's copyright instead of an Intel one. The only line I
can see that's left from the original Makefile.am is "pkgconfigdir" in
the root Makefile.am.
2013-12-16 09:20:25 -08:00
Eric Anholt
21f4346af0
Update header comments about how the implementation works.
2013-12-16 09:18:58 -08:00
Eric Anholt
fa7aa87bc0
Drop the inconsistent use of #pragma once.
...
Apparently it's not totally portable, and the #ifdefs work fine (and
equivalently to the pragma, on some compilers).
2013-12-16 09:14:31 -08:00
Eric Anholt
c92fcc852f
Fix testsuite build on OS X.
...
There's no linker flag of this name in the normal clang, presumably
beause the linker feature doesn't exist.
2013-12-16 08:27:55 -08:00
Eric Anholt
c24afd8a9e
Fix printout of missing versions/extensions.
...
Not sure how I misplaced the \n in the previous fix.
2013-12-15 22:43:47 -08:00
Eric Anholt
8f42fd3fe4
Fix declaration of glBegin/End_unwrapped.
...
On non-win32, it was declaring a new function pointer variable on
every #include, and OS X's linker got angry.
2013-12-15 22:43:47 -08:00
Eric Anholt
26880549bc
Fix loading of extension functions on OS X.
...
For a non-GLX application, at least, we need to pull our extensions
using dlsym, not glXGetProcAddress(). The symptom was a segfault in
glXGetProcAddress().
2013-12-15 22:41:01 -08:00
Eric Anholt
28c2dcb99b
Use a non-inlined helper for the simple case of a single provider.
...
This reduces the built size by another 37k.
2013-12-15 20:16:01 -08:00
Eric Anholt
c4f582b532
Reuse the same string table in one more place.
...
Saves another 53k on disk, no relocations.
2013-12-15 20:16:01 -08:00
Eric Anholt
39ccf7089b
Use offsets into a string table to reduce the binary size.
...
Saves 54k on disk and 3700 relocations.
2013-12-15 20:16:01 -08:00
Eric Anholt
982e39f188
Move the #defines into the main generated header.
...
I initially thought I was going to have two sets of defines you chose
from using #include, but that never ended up being necessary.
2013-12-15 20:16:01 -08:00
Eric Anholt
3d2a2b3c80
Abandon ifuncs and go with the traditional global function pointers.
...
In addition to the failing testcase, there were a couple of
regressions in piglit's attribs test: one from glBegin_unwrapped vs
glBegin confusion in the __asm__ directives we were generating, and
one where the function pointers apparently were just getting mixed up
at application runtime.
2013-12-15 20:15:51 -08:00
Eric Anholt
e58e98feee
Fix the behavior of glx_shared_znow if it doesn't die at startup.
...
We're sharing the source file with glx_static, but we don't want to
SKIP due to not being statically linked.
2013-12-13 17:00:56 -08:00
Eric Anholt
5c4f73fa7f
Add a test showing a way that our ifuncs are broken.
2013-12-13 13:01:22 -08:00
Eric Anholt
acd3b38d6e
Relink tests when the library changes.
...
For the dynamically-linked tests, it wasn't a big deal because the
updated library was always picked up. But for glx_static, we were
actually testing stale code.
2013-12-13 12:30:14 -08:00
Eric Anholt
10c611a3f1
Add a check that we've made it into the C runtime when doing dlopen().
...
This should give us a more informative failure mode than the one
mentioned in the README.
2013-12-13 12:30:14 -08:00
Eric Anholt
03e9537331
Fix infinite loop in extension detection when the needle is a substring.
...
We could keep examining the same ptr value over and over.
2013-12-12 17:17:17 -08:00
Eric Anholt
cb647a0853
Fix loading of EGL 1.1+ entrypoints.
2013-12-12 17:17:17 -08:00
Eric Anholt
dd6feb7b00
Include epoxy/gl.h instead of epoxy/gl_generated.h from egl_generated.h
...
This gets us the safety check for including GL/gl.h before epoxy/gl.h
2013-12-12 13:12:19 -08:00
Eric Anholt
46e036419c
Include epoxy/gl.h from epoxy/glx.h.
...
This gives us consistency with GL/glx.h's include of GL/gl.h.
2013-12-12 13:00:01 -08:00
Eric Anholt
59edbacf7d
Remove a bad alias of glGetAttachedShaders.
...
On OS X, GLhandleARB is void *, which is of different size than GLuint
on 64-bit. Because of this, the implementation of
glGetAttachedObjectsARB must be different from glGetAttachedShaders,
since the pointers/ints are packed the output memory.
2013-12-12 11:47:28 -08:00
Eric Anholt
0cfb0a044b
Fix most GLhandleARB warnings on OS X with a big comment in our code.
2013-12-12 11:39:34 -08:00
Eric Anholt
8d8334c350
Use the right library name for GLX on OS X.
2013-12-12 10:58:55 -08:00
Eric Anholt
d6e4e9ac4c
Fix the build of the headerguards test on OS X.
2013-12-11 17:18:28 -08:00
Eric Anholt
d82c5c33a6
Fix the path to the GL library on OS X.
2013-12-11 17:18:28 -08:00
Eric Anholt
34d7b3d872
Fix signedness warning on OS X build of the testsuite.
2013-12-11 17:18:28 -08:00
Eric Anholt
708c31a406
Disable EGL on OS X.
...
It doesn't exist. There's EAGL, but that's not something we're
covering.
2013-12-11 17:18:28 -08:00
Eric Anholt
940438fae3
Use X11_CFLAGS during the build so we find the right xlib headers.
...
We don't need x11_libs, because we don't directly call any xlib
functions. We're just passing xlib types around.
2013-12-11 17:18:28 -08:00
Eric Anholt
847ba1acdf
Add an appropriate error message if libX11 is missing.
2013-12-11 17:18:28 -08:00
Eric Anholt
6c0e0423f6
Add build instructions to the readme.
2013-12-11 17:18:28 -08:00
Eric Anholt
57280133e6
Update the README for WGL support.
2013-12-11 15:20:10 -08:00
Eric Anholt
6e8977a177
Link the library with -Bsymbolic.
...
We don't want anybody to accidentally override the library's internal
usage of epoxy_has_gl_extension() or similar public interfaces.
2013-12-11 15:16:10 -08:00
Eric Anholt
1e443b2daf
Use ifuncs on Linux to avoid dispatch table overhead.
...
These tell the linker to generate GNU_IFUNC relocs that rewrite the
PLT entries in the user's address space to point to our resolved GL
function, so there's no extra function pointer. It also, as a bonus,
cuts 400k out of the library.
This requires a toolchain from 2010 or so. Unfortunately, it's going
to take a bit more investigation to find out what specific bits are
required.
Fixes #4
2013-12-11 15:03:58 -08:00
Eric Anholt
6553c08752
Fix compiler warning in glx_static.
2013-12-11 14:58:33 -08:00
Eric Anholt
22ce76fe0b
Make glx_static report skip if it was built non-static.
...
It won't have that symbol, unless it happens to be linked against the
full library.
2013-12-11 14:35:46 -08:00
Eric Anholt
2206e6e302
Add a testcase for trying to use libepoxy as a static library.
...
Note that it will only actually link statically against epoxy if
you've set --enable-static.
2013-12-11 13:49:08 -08:00
Eric Anholt
85dc3821fe
Move the unwrapped logic to function setup.
...
I'm going to want the same stuff for ifuncs.
2013-12-11 13:15:39 -08:00
Eric Anholt
8a56585dcb
Make func.alias_name always have the name of our alias.
...
The "None" for "we're not an alias of anything else" wasn't actually
simplifying things.
2013-12-11 12:58:43 -08:00
Eric Anholt
f843d63da2
Reduce the overhead of the dispatch table usage.
...
We now initialize our dispatch table with function pointers that go
and do the rewrite, then we never have to check for a NULL table entry
again. On my 64-bit build, epoxy_glClear() drops from 83 bytes to 14,
while the total library size only goes up by 5%.
This also paves the way for fixing our dispatch table management using
TLS on windows.
2013-12-10 17:19:38 -08:00
Eric Anholt
ca14052cfe
Add a test for basic functionality on win32.
2013-12-10 14:19:01 -08:00
Eric Anholt
1d746bfeb2
Add dispatch generation for wgl.
...
This is very poorly tested at this point, but survives a simple testcase.
2013-12-10 14:13:22 -08:00