Commit Graph
59 Commits
Author SHA1 Message Date
Emmanuele Bassi d8726f265e Add epoxy_glsl_version()
Epoxy should provide a function that returns the version of the GL
shading language in use, in the same vein as it allows to get the
version of GL.

Closes: #145
2018-02-23 19:58:36 +00:00
Emmanuele Bassi 1b54e263eb Merge pull request #136 from Lyude/pull/epoxy_ext_in_str
Expose epoxy_extension_in_string() in public headers
2017-10-19 11:11:28 +01:00
Lyude Paul 4bde48e12c Expose epoxy_extension_in_string() in public headers
The EGL_EXT_device_query extension introduces the
eglQueryDeviceStringEXT() function, which can be used with an
EGLDeviceEXT enumeration to receive an OpenGL extension string
containing all of the device extensions supported by it. From the
EGL_EXT_device_query spec's amendments to section "3.2 Devices" after
"3.1 Errors":

    const char *eglQueryDeviceStringEXT(EGLDeviceEXT device,
    				    EGLint name);

    returns a pointer to a static, zero-terminated string describing
    some aspect of the specified EGLDeviceEXT.  <name> must be
    EGL_EXTENSIONS.

Since OpenGL extension parsing is rather simple, and we could always run
into additional cases similar to this one in the future, we expose the
shared epoxy_extension_in_string() function in libepoxy's public headers
so that users can save themselves the hassle of having to write their
own extension parser.

Signed-off-by: Lyude Paul <[email protected]>
2017-08-24 14:50:19 -04:00
Adam Jackson 7ff061a944 Add epoxy_set_resolver_failure_handler()
Signed-off-by: Adam Jackson <[email protected]>
2017-07-14 12:53:02 -04:00
Emmanuele Bassi 2dafa2f1d3 Move epoxy_headers definition into include/epoxy
In order to properly depend on headers, both generated and provided, in
a separate directory, we need to refer to them using their path.

Generated headers already have their full path; for provided ones, we
can simply use the `files()` directive.

This change should allow using libepoxy as a Meson subproject.

Fixes: #115
2017-03-28 10:08:56 +01:00
Emmanuele Bassi 3fb4fea674 Add C++ guards around generated headers
Commit 0625a74d69 moved the C++ guards
after the inclusion of the generated headers, which was an unintended
behavioural change and now requires header guards around the inclusion
of Epoxy headers.

Fixes: #106
2017-03-03 14:41:15 +00:00
Emmanuele Bassi 3eaddbef62 Simplify the code generation rules for Meson
The code generation rules are explicitly built for each supported API
target, but they ought to be refactored since they are pretty much
identical.

In order to do that, we can store the arguments to the custom_target
rules inside an array and then iterate over each element.

This cuts down the complexity of the Meson build, and the chances of
getting something wrong due to duplication.
2017-03-01 12:36:00 +00:00
Emmanuele Bassi 89f9aa044f Remove the shebang from gen_dispatch.py
Instead of having Meson determine the invocator through the shebang
line we explicitly pass the script file to the Python interpreter.

This will allow us to either use Python3 or Python2, or whatever
Python.exe is available on Windows.
2017-02-15 14:09:01 +00:00
Emmanuele Bassi d35870f3b6 Update the symbol visibility rules under MSVC
For the Visual Studio C compiler we need to annotate our public symbols
with `__declspec(dllimport)` to ensure they are visible when dynamically
linking to Epoxy's DLL.

This is needed because under Windows we use a dispatch table, instead of
wrapper functions, thus the symbol visibility rules change. Compiling
with MingW will automatically add `__declspec(dllimport)` for us.

Thanks to Nirbheek Chauhan for the help in debugging the issue.

Fixes #104
2017-02-08 16:52:01 +00:00
Emmanuele Bassi 5c4a907687 Merge pull request #100 from centricular/fix-find_program
meson: Don't call find_program objects with python
2017-02-08 12:57:47 +00:00
Emmanuele Bassi 075172f485 Add epoxy_has_egl()
Similar to `epoxy_has_glx()`, but for the EGL windowing system API.
2017-02-03 16:19:30 +00:00
Emmanuele Bassi d94b9c28b5 Add epoxy_has_glx()
Libraries and applications that depend on Epoxy currently have no way to
safely degrade functionality if they are used on a platform without GLX
support; the only way to achieve that is to perform a symbol check
themselves, by essentially copying what Epoxy already does.

By exposing `epoxy_has_glx()`, those libraries and applications now have
the chance of querying Epoxy itself and gracefully handle failure.
2017-02-03 16:16:13 +00:00
Emmanuele Bassi 6af57b0745 Write the API reference
Now that we have Doxygen generating it, we should fill out the API
reference for Epoxy.
2017-02-03 11:13:30 +00:00
Emmanuele Bassi 6973dd5db3 Add a fallback for missing stdbool.h
Older versions of the Microsoft Visual C compiler do not support C99 and
do not have stdbool.h.

Additionally, Epoxy is pretty much C89 compliant, and stdbool.h is part
of C99.

We can add a simple fallback for MSVC, in case we end up getting built
with it.
2017-02-01 00:02:16 +00:00
Emmanuele Bassi 5bcc550a6c Merge branch 'symbol-visibility' 2017-01-31 18:09:34 +00:00
Nirbheek Chauhan d82bedc227 meson: Don't call find_program objects with python
On UNIX-like OSes, the OS will read the shebang and use the correct
interpreter, and on Windows, Meson will read the shebang and use the
correct interpreter.

Adding it manually will cause python to try to interpret python
2017-01-28 06:54:10 +05:30
Patrick Griffis 61dac912e6 build: Clean up some Meson usage 2017-01-27 19:13:48 -05:00
Emmanuele Bassi 7a06803465 Improve consistency of the symbol visibility
To avoid a symbols file on Windows, Epoxy annotates all the publicly
visible symbols directly in the source, but uses the default symbol
visibility everywhere else. This means that only some symbols are
annotated as `EPOXY_IMPORTEXPORT`, and generally only on Windows.
Additionally, Epoxy has a private 'PUBLIC' pre-processor macro for
internal use, which duplicates the `EPOXY_IMPORTEXPORT` but contains
more logic to detect GCC, in case we're building with GCC on Windows.

This would be enough, except that EGL is also available on Windows,
which means we'd have to annotate the exported `epoxy_*` API inside
epoxy/egl.h as well. At that point, though, we should probably avoid
any confusion, and adopt a single symbol visibility policy across the
board.

This requires some surgery of the generated and common dispatch sources,
but cuts down the overall complexity:

 - there is only one annotation, `EPOXY_PUBLIC`, used everywhere
 - the annotation detection is done at Epoxy configuration time
 - only annotated symbols are public, on every platform
 - annotated symbols are immediately visible from the header
2017-01-25 12:43:17 +00:00
Emmanuele Bassi 0625a74d69 Add common header
We're going to use this header to provide shared macros. Right now, we
can use it to replace the:

    #ifdef __cplusplus
    extern "C" {
    #endif

    …

    #ifdef __cplusplus
    }
    #endif

Stanzas for every installed header, with easier to read macros in the
same spirit of Cairo and GLib.
2017-01-25 12:43:17 +00:00
Emmanuele Bassi 59318edf64 build: Rework the build rules for generated files in Meson
Instead of using a generator and having to deal with tweaking the
inclusion paths, we can use a custom target rule, which will do the
right thing and put the generate files where we expect them to be.

Due to how Meson and Ninja work we need to be a bit more careful as to
how we deal with dependencies and generated files, especially since
Epoxy is built on the assumption that the only inclusion path for the
headers lies under the 'include' sub-directory.

First of all, we need to split the dispatch table generation into two
separate steps, one for the headers and one for the source files.

Additionally, we need to munge the paths of the non-generated headers
so that we reference them by their correct path.

These changes are necessary to ensure that Epoxy can be built on a
system without Epoxy installed already; the previous Meson-based build
system relied on the headers being installed in a system directory.
2017-01-25 12:36:20 +00:00
Bryan Kadzban f887dcf79b nVidia glx.h uses __glx_h__; define that too.
The code used to check this symbol, but commit 689abf4 replaced it with
GLX_H, presumably to work better with either Mesa or Khronos headers.
But nVidia's header use the older include guard. Add it as another
option.

Should fix the headerguards.c compile test when the system glx.h is from
nVidia's binary drivers.

Signed-off-by: Emmanuele Bassi <[email protected]>
2016-12-07 14:59:53 +00:00
Emmanuele Bassi 8dead45cb3 Revert all changes since 8bbc0d40
Most of the changes that happened after commit 8bbc0d40 broke epoxy
pretty much irreparably because of the CMake build and the attempt at
making libepoxy a static library that can be copy-pasted into another
project without generating files.

Since all the commits are entangled, and are full of unrelated changes,
we cannot simply do a localized set of reverts; instead, we need to hit
the reset button.

From this point forward, we're going to improve libepoxy's build while
attempting to keep the existing build system working. This may mean
reinstating the CMake build system at a later date.
2016-12-07 14:45:14 +00:00
Emmanuele Bassi d5dfe2bd96 build: Drop autogenerated autotools files from Git
These files should not be under revision control.

This commit partially reverts:

  * 06fd4a271a
  * 62e384129b
2016-11-07 20:20:04 +00:00
Bryan Kadzban 58610268fe nVidia glx.h uses __glx_h__; define that too.
The code used to check this symbol, but commit 689abf4 replaced it with
GLX_H, presumably to work better with either Mesa or Khronos headers.
But nVidia's header use the older include guard. Add it as another
option.

Should fix the headerguards.c compile test when the system glx.h is from
nVidia's binary drivers.
2016-09-06 22:28:39 -07:00
Yaron Cohen-Tal a4ead97cfd Make "epoxy_current_context_is_egl" visible. 2015-10-31 20:31:42 +02:00
Yaron Cohen-Tal 44d51f2844 Fix support for a static build of Epoxy. Add support building and running tests with CMake. Add support for linking with the static run-time library with MSVC. 2015-09-03 23:17:39 +03:00
Yaron Cohen-Tal 62e384129b Add some files to the repo so that it's possible to build without running "autogen.sh". 2015-08-26 22:08:16 +03:00
Yaron Cohen-Tal 06fd4a271a Add support for CMake (no support for building/running the tests yet). Fix support for Android. Add built-in support for building with EGL support (using "khrplatform.h" and "eglplatform.h" which are distributed together with Epoxy, and should work with any platform). 2015-08-26 19:41:51 +03:00
Yaron Cohen-Tal b527c5f01f Add new header file "common.h" to the installed files. 2015-07-19 20:59:13 +03:00
Yaron Cohen-Tal 90c6158d61 Unite defenitions "PUBLIC" and "EPOXY_IMPORTEXPORT" and add it where appropriate. Fix tests build errors. 2015-07-19 13:40:35 +03:00
Yaron Cohen-Tal 773dd02f59 Added makefiles to build with MSVC 2013, and fixed errors and warnings. 2015-07-18 17:39:12 +03:00
Chun-wei Fan d88c639e63 Fix public headers for building in Visual Studio
Ensure that we also have import/export decorations for the prototypes, as
Visual Studio does not like such decorations on the function definitions
without the prototypes decorated as well, when the function prototypes
exist.
2015-06-05 17:50:45 -07:00
Eric Anholt c7a91844de Don't forget to install the wgl headers.
Fixes #26
2014-05-13 12:36:43 -07:00
Eric Anholt 568533441f Move __stdcall into the parens for function pointer definitions.
MSVC 2010 appears to require that it be located there.
2014-04-10 13:37:47 -07:00
Eric Anholt e7d3088d71 win32: Add support for wglUseFontBitmaps().
Fixes #10.
2014-03-27 15:33:21 -07:00
Fredrik Höglund e20b3ce6c7 Fix EGLDisplay parameters in epoxy functions
EGLDisplay is typedefed as a pointer.
2014-02-12 00:56:57 +01:00
Eric Anholt 67a1ad4f6c Add limited support for the KHRONOS_* defines from khrplatform.h.
The only way these get used is when you choose to include epoxy/gl.h
but EGL/egl.h.  I'm not sure that's something I want to actually
support, but piglit happened to do so, and this gets things working.

There's not as much support here as in real khrplatform.h, but then
there's no EGL for windows.  And seriously, compilers support 64-bit
and float types, why would you even build this complexity?
2014-02-06 14:50:22 -08:00
Eric Anholt f10bff9bc0 Avoid polluting the compiler's namespace with our own stuff.
We can't completely avoid it, since gl's headers use these defines for
their header guards, and we really do need to stop the system GL
headers from doing anything.

Fixes #14
2014-01-22 01:00:56 -08:00
Eric Anholt 9bc909f5a7 win32: Convert the API to being based on function pointers, like Linux.
For performance, I want to be able to make single-context (well,
single-pixel-format-and-device) apps be able to directly call GL
functions through function pointers.  Bake that into the ABI now so I
can get a release out the door and fix this up later.

This also fixes the lack of __stdcall annotation on the
PFNWHATEVERPROC typedefs.
2013-12-17 15:08:02 -08:00
Eric Anholt 3ae4726cdb win32: Expose the dispatch table reset funtion in the public API.
Fixes #2.
2013-12-17 14:34:02 -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 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 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 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 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
Eric Anholt 0d7d26537d Conditionalize building GLX and EGL tests and headers.
Note that the generated code is still generated, they just aren't
built and installed.  The goal with that is that someone could take
the built .c and .h files and drop it into their own project, if they
want to avoid shared libs.
2013-12-06 15:50:01 -08:00
Eric Anholt 43acf7b021 Fix make distcheck.
Well, not quite.  One of the regression tests is failing with
GLXBadFBConfig in that build.  Not sure why.
2013-12-06 11:50:00 -08:00
Eric Anholt 08101c5145 Add some more defines that are present in normal gl.h 2013-12-06 11:38:41 -08:00