...so that the generated code are buildable by pre-2013 Visual Studio.
The main thing that this does is that we avoid named initializers, but
instead initialize the structs in old-school C89 way.
The generated code may not look that robust, but since this is generated
code, I think this is not that much an issue; when the Khronos registry gets
updated, all that is needed is that the code gets re-generated, and we have the
items in the right order.
Since our provider enums are small, we can store them as bytes or
shorts if we just let the compiler know that it's OK. Saves 20kb in
the compiled library.
According to the OpenGL ES standard, "glGetString(GL_VERSION)" should
return a string starting with "OpenGL ES". However, PowerVR's OpenGL
ES implementation (and perhaps others) don't comply with the standard
here. If our context happend to be bound using EGL, then we can just
ask EGL what kind of context it was, avoiding the glGetString() check.
Don't mark epoxy_conservative_gl_version() for export, as it is meant
to be a private API to be used within libepoxy only.
Reviewed-by: Eric Anholt <eric@anholt.net>
This updates the script to generate code that is buildable by Visual Studio
2013 by:
-Using a macro to define the compiler-specific way to do noinline for a
function, and use it when needed.
-Avoid using empty arrays and structs as that is a C99 feature that will
likely be never support on Visual Studio as it is now an optional feature
of C11.
Without this, we got code generation that was dependent on the
original ordering in the hash table, and thus non-reproducible builds.
Based on a commit by Stephan Kulow, but retaining the sorting by
function name first (that way all providers with the same name appear
next to each other like before, and also happens to ensure that core
names tend to appear before non-core names)
This has been tested with both OpenGL and OpenGL ES on Android.
We can't use dlsym on Android to get all the function pointers since Android's libGLES* libraries are just shim libraries that pass everything through
to the real vendor specific libraries.
Due to this we must grab function pointers entirely through eglGetProcAddress instead of dlsym.
Fixes failure of the X Server with glamor using desktop GL on EGL, and
the associated testcase in the tree. This was clearly just
copy-and-paste failure on my part in
b251e3ae33.
This increases the size of the library, but avoids some of the
concerns that have been brought up with the library silently switching
you from glWhateverEXT() to glWhatever() if there might be slight
behavior differences between the two that hadn't been identified. The
downside is that it means we can't share the resolver functions among aliases.
Now that it's split out from epoxy_get_core_proc_address(),
the particular symbols we were testing for before calling
GetCurrentContext() didn't make much sense, plus we were leaking
dlerror()s still.
This fixes crashes on ARM's Mali drivers, where desktop GL isn't
supported, and epoxy didn't notice the error and tried to dlsym() on
libGL.so.1.
An alternative would have been to look at the response from
eglQueryAPI() first, but that would have meant that we still need to
BindAPI in the case that eglQueryAPI returns something like VG or CL,
and so we needed to handle these errors regardless.
Fixes#22
One of the problems with krhplatform.h (besides it being a terrible
idea in the first place) is that it's not present on many systems at
all, including apple, win32, and linux before late 2009.
So, unless we introduce the first ./configure dependency to the core
library build, we really do need to define these standard types to
their standard values. But if we allow khrplatform.h inclusion as
well, we'll get long-vs-int redefinition warnings on 32-bit. So, we
have to completely replicate the header, which is a thing we've done
for everything else except for eglplatform.h.
A testcase will be used to make sure that our types don't drift from
the system khrplatform.h types, if it even exists.
Fixes#17
This is a lot shorter to type, and still gets the dependencies to work
(tested with touch src/dispatch_common.c; make check, and touch
src/egl_common.c; make check).