Enforce local-over-WIP recipe policy: replace WIP shadows with symlinks
Per AGENTS.md policy: local recipes ALWAYS supersede WIP packages. Any WIP directory that shadows a local/recipes/ package is replaced with a symlink to the local version. Fixed shadows: bison, flex, m4, meson, ninja-build, libxcvt, qt6-sensors, libepoxy, mc — all now symlinked to local/recipes/. Added WIP-local enforcement to build-redbear.sh: auto-detects and fixes WIP shadows at build time.
This commit is contained in:
@@ -109,6 +109,26 @@ if [ -x "$PROJECT_ROOT/local/scripts/verify-overlay-integrity.sh" ] && [ -z "${R
|
||||
echo ""
|
||||
fi
|
||||
|
||||
# Per AGENTS.md: local recipes ALWAYS supersede WIP.
|
||||
# Any WIP directory that shadows a local/recipes/ package must be
|
||||
# replaced with a symlink to the local version.
|
||||
if [ -z "${REDBEAR_RELEASE:-}" ]; then
|
||||
echo ">>> Enforcing local-over-WIP recipe policy..."
|
||||
for local_recipe in "$PROJECT_ROOT"/local/recipes/*/*/; do
|
||||
pkg=$(basename "$local_recipe")
|
||||
[ ! -f "$local_recipe/recipe.toml" ] && continue
|
||||
while IFS= read -r -d '' wip_dir; do
|
||||
if [ ! -L "$wip_dir" ]; then
|
||||
wip_rel=$(realpath --relative-to="$(dirname "$wip_dir")" "$local_recipe")
|
||||
rm -rf "$wip_dir"
|
||||
ln -sf "$wip_rel" "$wip_dir"
|
||||
echo " WIP $pkg -> local ($wip_rel)"
|
||||
fi
|
||||
done < <(find "$PROJECT_ROOT"/recipes/wip -maxdepth 5 -name "$pkg" -type d -print0 2>/dev/null || true)
|
||||
done
|
||||
echo ""
|
||||
fi
|
||||
|
||||
stash_nested_repo_if_dirty() {
|
||||
local target_dir="$1"
|
||||
local label="$2"
|
||||
|
||||
+1
@@ -0,0 +1 @@
|
||||
../../../local/recipes/dev/meson
|
||||
@@ -1,5 +0,0 @@
|
||||
#TODO create a standalone script: https://github.com/mesonbuild/meson#creating-a-standalone-script
|
||||
[source]
|
||||
tar = "https://github.com/mesonbuild/meson/releases/download/1.3.0/meson-1.3.0.tar.gz"
|
||||
[build]
|
||||
template = "custom"
|
||||
@@ -0,0 +1 @@
|
||||
../../../local/recipes/dev/ninja-build
|
||||
@@ -1,7 +0,0 @@
|
||||
#TODO not compiled or tested
|
||||
# build instructions: https://github.com/ninja-build/ninja#building-ninja-itself
|
||||
[source]
|
||||
git = "https://github.com/ninja-build/ninja"
|
||||
rev = "v1.13.1"
|
||||
[build]
|
||||
template = "cmake"
|
||||
Symlink
+1
@@ -0,0 +1 @@
|
||||
../../../local/recipes/dev/bison
|
||||
@@ -1,5 +0,0 @@
|
||||
#TODO Compilation error
|
||||
[source]
|
||||
tar = "https://ftp.gnu.org/gnu/bison/bison-3.8.2.tar.xz"
|
||||
[build]
|
||||
template = "configure"
|
||||
Symlink
+1
@@ -0,0 +1 @@
|
||||
../../../local/recipes/dev/flex
|
||||
@@ -1,5 +0,0 @@
|
||||
#TODO configuration error
|
||||
[source]
|
||||
tar = "https://github.com/westes/flex/releases/download/v2.6.4/flex-2.6.4.tar.gz"
|
||||
[build]
|
||||
template = "configure"
|
||||
Symlink
+1
@@ -0,0 +1 @@
|
||||
../../../local/recipes/libs/libepoxy
|
||||
@@ -1,18 +0,0 @@
|
||||
[source]
|
||||
tar = "https://download.gnome.org/sources/libepoxy/1.5/libepoxy-1.5.10.tar.xz"
|
||||
blake3 = "0ccee9635115fe417cfc4bc33ffd160bf1e2852bd6c03816b4af771d59462f53"
|
||||
|
||||
[build]
|
||||
template = "custom"
|
||||
dependencies = [
|
||||
"libpthread-stubs",
|
||||
"mesa",
|
||||
"zlib",
|
||||
]
|
||||
script = """
|
||||
DYNAMIC_INIT
|
||||
cookbook_meson \
|
||||
-Degl=yes \
|
||||
-Dglx=no \
|
||||
-Dtests=false
|
||||
"""
|
||||
@@ -1,6 +0,0 @@
|
||||
((nil
|
||||
(indent-tabs-mode . nil)
|
||||
(tab-width . 8)
|
||||
(c-basic-offset . 4)
|
||||
)
|
||||
)
|
||||
@@ -1,22 +0,0 @@
|
||||
root = true
|
||||
|
||||
[*]
|
||||
charset = utf-8
|
||||
|
||||
[*.{c,h}]
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
end_of_line = lf
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = true
|
||||
|
||||
[.travis.yml]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
|
||||
[*.md]
|
||||
trim_trailing_whitespace = false
|
||||
|
||||
[meson.build]
|
||||
indent_style = space
|
||||
indent_size = 8
|
||||
@@ -1,32 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
dump_log_and_quit() {
|
||||
local exitcode=$1
|
||||
|
||||
cat meson-logs/testlog.txt
|
||||
|
||||
exit $exitcode
|
||||
}
|
||||
|
||||
# Start Xvfb
|
||||
XVFB_WHD=${XVFB_WHD:-1280x720x16}
|
||||
|
||||
Xvfb :99 -ac -screen 0 $XVFB_WHD -nolisten tcp &
|
||||
xvfb=$!
|
||||
|
||||
export DISPLAY=:99
|
||||
|
||||
srcdir=$( pwd )
|
||||
builddir=$( mktemp -d build_XXXXXX )
|
||||
|
||||
meson --prefix /usr "$@" $builddir $srcdir || exit $?
|
||||
|
||||
cd $builddir
|
||||
|
||||
ninja || exit $?
|
||||
meson test || dump_log_and_quit $?
|
||||
|
||||
cd ..
|
||||
|
||||
# Stop Xvfb
|
||||
kill -9 ${xvfb}
|
||||
@@ -1,27 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
dump_log_and_quit() {
|
||||
local exitcode=$1
|
||||
|
||||
cat meson-logs/testlog.txt
|
||||
|
||||
exit $exitcode
|
||||
}
|
||||
|
||||
export SDKROOT=$( xcodebuild -version -sdk macosx Path )
|
||||
export CPPFLAGS=-I/usr/local/include
|
||||
export LDFLAGS=-L/usr/local/lib
|
||||
export OBJC=$CC
|
||||
export PATH=$HOME/tools:$PATH
|
||||
|
||||
srcdir=$( pwd )
|
||||
builddir=$( mktemp -d build_XXXXXX )
|
||||
|
||||
meson ${BUILDOPTS} $builddir $srcdir || exit $?
|
||||
|
||||
cd $builddir
|
||||
|
||||
ninja || exit $?
|
||||
meson test || dump_log_and_quit $?
|
||||
|
||||
cd ..
|
||||
@@ -1,38 +0,0 @@
|
||||
name: Ubuntu
|
||||
on:
|
||||
push:
|
||||
branches-ignore:
|
||||
- debian
|
||||
- khronos-registry
|
||||
jobs:
|
||||
build:
|
||||
strategy:
|
||||
matrix:
|
||||
os:
|
||||
- ubuntu-18.04
|
||||
compiler:
|
||||
- gcc
|
||||
- clang
|
||||
build-opts:
|
||||
- ''
|
||||
- '-Dglx=no'
|
||||
- '-Degl=no'
|
||||
- '-Dx11=false'
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- run: >
|
||||
sudo apt-get update &&
|
||||
sudo apt-get install --no-install-recommends
|
||||
libgl1-mesa-dev
|
||||
libegl1-mesa-dev
|
||||
libgles2-mesa-dev
|
||||
libgl1-mesa-dri
|
||||
ninja-build
|
||||
- uses: actions/setup-python@v2
|
||||
with:
|
||||
python-version: 3.x
|
||||
- run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip3 install meson
|
||||
/bin/sh -c "CC=${{ matrix.compiler }} .github/scripts/epoxy-ci-linux.sh ${{ matrix.build-opts }}"
|
||||
@@ -1,26 +0,0 @@
|
||||
name: macOS
|
||||
on:
|
||||
push:
|
||||
branches-ignore:
|
||||
- debian
|
||||
- khronos-registry
|
||||
jobs:
|
||||
build:
|
||||
strategy:
|
||||
matrix:
|
||||
build-opts:
|
||||
- ''
|
||||
- '-Dglx=no'
|
||||
- '-Degl=no'
|
||||
- '-Dx11=false'
|
||||
runs-on: macos-10.15
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-python@v2
|
||||
with:
|
||||
python-version: 3.x
|
||||
- run: |
|
||||
brew install ninja
|
||||
python -m pip install --upgrade pip
|
||||
pip3 install meson
|
||||
/bin/sh -c "CC=clang .github/scripts/epoxy-ci-osx.sh ${{ matrix.build-opts }}"
|
||||
@@ -1,23 +0,0 @@
|
||||
name: MSVC Build
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ master ]
|
||||
pull_request:
|
||||
branches: [ master ]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: windows-latest
|
||||
env:
|
||||
PYTHONIOENCODING: "utf-8"
|
||||
steps:
|
||||
- uses: actions/checkout@master
|
||||
- uses: actions/setup-python@v1
|
||||
- uses: seanmiddleditch/gha-setup-vsdevenv@master
|
||||
- uses: BSFishy/meson-build@v1.0.1
|
||||
with:
|
||||
action: test
|
||||
directory: _build
|
||||
options: --verbose --fatal-meson-warnings
|
||||
meson-version: 0.54.3
|
||||
@@ -1,27 +0,0 @@
|
||||
name: MSYS2 Build
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ master ]
|
||||
pull_request:
|
||||
branches: [ master ]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: windows-latest
|
||||
defaults:
|
||||
run:
|
||||
shell: msys2 {0}
|
||||
env:
|
||||
PYTHONIOENCODING: "utf-8"
|
||||
steps:
|
||||
- uses: actions/checkout@master
|
||||
- uses: msys2/setup-msys2@v2
|
||||
with:
|
||||
msystem: MINGW64
|
||||
update: true
|
||||
install: base-devel git mingw-w64-x86_64-meson mingw-w64-x86_64-ninja mingw-w64-x86_64-pkg-config mingw-w64-x86_64-python3 mingw-w64-x86_64-python3-pip mingw-w64-x86_64-toolchain
|
||||
- name: Build
|
||||
run: |
|
||||
meson setup _build
|
||||
meson compile -C _build
|
||||
@@ -1,79 +0,0 @@
|
||||
#
|
||||
# X.Org module default exclusion patterns
|
||||
# The next section if for module specific patterns
|
||||
#
|
||||
# Do not edit the following section
|
||||
# GNU Build System (Autotools)
|
||||
aclocal.m4
|
||||
autom4te.cache/
|
||||
autoscan.log
|
||||
ChangeLog
|
||||
compile
|
||||
config.guess
|
||||
config.h
|
||||
config.h.in
|
||||
config.log
|
||||
config-ml.in
|
||||
config.py
|
||||
config.status
|
||||
config.status.lineno
|
||||
config.sub
|
||||
configure
|
||||
configure.scan
|
||||
depcomp
|
||||
.deps/
|
||||
INSTALL
|
||||
install-sh
|
||||
.libs/
|
||||
libtool
|
||||
libtool.m4
|
||||
ltmain.sh
|
||||
lt~obsolete.m4
|
||||
ltoptions.m4
|
||||
ltsugar.m4
|
||||
ltversion.m4
|
||||
Makefile
|
||||
Makefile.in
|
||||
mdate-sh
|
||||
missing
|
||||
mkinstalldirs
|
||||
*.pc
|
||||
py-compile
|
||||
stamp-h?
|
||||
symlink-tree
|
||||
texinfo.tex
|
||||
ylwrap
|
||||
src/sna/git_version.h
|
||||
src/sna/brw/brw_test
|
||||
|
||||
# Do not edit the following section
|
||||
# Edit Compile Debug Document Distribute
|
||||
*~
|
||||
*.[0-9]
|
||||
*.[0-9]x
|
||||
*.bak
|
||||
*.bin
|
||||
core
|
||||
*.dll
|
||||
*.exe
|
||||
*-ISO*.bdf
|
||||
*-JIS*.bdf
|
||||
*-KOI8*.bdf
|
||||
*.kld
|
||||
*.ko
|
||||
*.ko.cmd
|
||||
*.lai
|
||||
*.l[oa]
|
||||
*.[oa]
|
||||
*.obj
|
||||
*.so
|
||||
*.pcf.gz
|
||||
*.pdb
|
||||
*.tar.bz2
|
||||
*.tar.gz
|
||||
#
|
||||
# Add & Override patterns for gldispatch
|
||||
#
|
||||
# Edit the following section as needed
|
||||
# For example, !report.pc overrides *.pc. See 'man gitignore'
|
||||
#
|
||||
@@ -1,50 +0,0 @@
|
||||
The libepoxy project code is covered by the MIT license:
|
||||
|
||||
/*
|
||||
* Copyright © 2013-2014 Intel Corporation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
* IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
The generated code is derived from Khronos's xml files, which appear
|
||||
under the following license:
|
||||
|
||||
/*
|
||||
* Copyright (c) 2013 The Khronos Group Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and/or associated documentation files (the
|
||||
* "Materials"), to deal in the Materials without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Materials, and to
|
||||
* permit persons to whom the Materials are furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Materials.
|
||||
*
|
||||
* THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
* MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
|
||||
*/
|
||||
@@ -1,126 +0,0 @@
|
||||

|
||||

|
||||

|
||||

|
||||
[](https://opensource.org/licenses/MIT)
|
||||
|
||||
Epoxy is a library for handling OpenGL function pointer management for
|
||||
you.
|
||||
|
||||
It hides the complexity of `dlopen()`, `dlsym()`, `glXGetProcAddress()`,
|
||||
`eglGetProcAddress()`, etc. from the app developer, with very little
|
||||
knowledge needed on their part. They get to read GL specs and write
|
||||
code using undecorated function names like `glCompileShader()`.
|
||||
|
||||
Don't forget to check for your extensions or versions being present
|
||||
before you use them, just like before! We'll tell you what you forgot
|
||||
to check for instead of just segfaulting, though.
|
||||
|
||||
Features
|
||||
--------
|
||||
|
||||
* Automatically initializes as new GL functions are used.
|
||||
* GL 4.6 core and compatibility context support.
|
||||
* GLES 1/2/3 context support.
|
||||
* Knows about function aliases so (e.g.) `glBufferData()` can be
|
||||
used with `GL_ARB_vertex_buffer_object` implementations, along
|
||||
with GL 1.5+ implementations.
|
||||
* EGL, GLX, and WGL support.
|
||||
* Can be mixed with non-epoxy GL usage.
|
||||
|
||||
Building
|
||||
--------
|
||||
|
||||
```sh
|
||||
mkdir _build && cd _build
|
||||
meson
|
||||
ninja
|
||||
sudo ninja install
|
||||
```
|
||||
|
||||
Dependencies for Debian:
|
||||
|
||||
* meson
|
||||
* libegl1-mesa-dev
|
||||
|
||||
Dependencies for macOS (using MacPorts):
|
||||
|
||||
* pkgconfig
|
||||
* meson
|
||||
|
||||
The test suite has additional dependencies depending on the platform.
|
||||
(X11, EGL, a running X Server).
|
||||
|
||||
Switching your code to using epoxy
|
||||
----------------------------------
|
||||
|
||||
It should be as easy as replacing:
|
||||
|
||||
```cpp
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glx.h>
|
||||
#include <GL/glext.h>
|
||||
```
|
||||
|
||||
with:
|
||||
|
||||
```cpp
|
||||
#include <epoxy/gl.h>
|
||||
#include <epoxy/glx.h>
|
||||
```
|
||||
|
||||
As long as epoxy's headers appear first, you should be ready to go.
|
||||
Additionally, some new helpers become available, so you don't have to
|
||||
write them:
|
||||
|
||||
`int epoxy_gl_version()` returns the GL version:
|
||||
|
||||
* 12 for GL 1.2
|
||||
* 20 for GL 2.0
|
||||
* 44 for GL 4.4
|
||||
|
||||
`bool epoxy_has_gl_extension()` returns whether a GL extension is
|
||||
available (`GL_ARB_texture_buffer_object`, for example).
|
||||
|
||||
Note that this is not terribly fast, so keep it out of your hot paths,
|
||||
ok?
|
||||
|
||||
Why not use libGLEW?
|
||||
--------------------
|
||||
|
||||
GLEW has several issues:
|
||||
|
||||
* Doesn't know about aliases of functions (There are 5 providers of
|
||||
`glPointParameterfv()`, for example, and you don't want to have to
|
||||
choose which one to call when they're all the same).
|
||||
* Doesn't support OpenGL ES.
|
||||
* Has a hard-to-maintain parser of extension specification text
|
||||
instead of using the old .spec file or the new .xml.
|
||||
* Has significant startup time overhead when `glewInit()`
|
||||
autodetects the world.
|
||||
* User-visible multithreading support choice for win32.
|
||||
|
||||
The motivation for this project came out of previous use of libGLEW in
|
||||
[piglit](http://piglit.freedesktop.org/). Other GL dispatch code
|
||||
generation projects had similar failures. Ideally, piglit wants to be
|
||||
able to build a single binary for a test that can run on whatever
|
||||
context or window system it chooses, not based on link time choices.
|
||||
|
||||
We had to solve some of GLEW's problems for piglit and solving them
|
||||
meant replacing every single piece of GLEW, so we built
|
||||
piglit-dispatch from scratch. And since we wanted to reuse it in
|
||||
other GL-related projects, this is the result.
|
||||
|
||||
Known issues when running on Windows
|
||||
------------------------------------
|
||||
|
||||
The automatic per-context symbol resolution for win32 requires that
|
||||
epoxy knows when `wglMakeCurrent()` is called, because `wglGetProcAddress()`
|
||||
returns values depend on the context's device and pixel format. If
|
||||
`wglMakeCurrent()` is called from outside of epoxy (in a way that might
|
||||
change the device or pixel format), then epoxy needs to be notified of
|
||||
the change using the `epoxy_handle_external_wglMakeCurrent()` function.
|
||||
|
||||
The win32 `wglMakeCurrent()` variants are slower than they should be,
|
||||
because they should be caching the resolved dispatch tables instead of
|
||||
resetting an entire thread-local dispatch table every time.
|
||||
@@ -1,18 +0,0 @@
|
||||
[binaries]
|
||||
c = '/usr/bin/x86_64-w64-mingw32-gcc'
|
||||
cpp = '/usr/bin/x86_64-w64-mingw32-cpp'
|
||||
ar = '/usr/bin/x86_64-w64-mingw32-ar'
|
||||
strip = '/usr/bin/x86_64-w64-mingw32-strip'
|
||||
pkgconfig = '/usr/bin/x86_64-w64-mingw32-pkg-config'
|
||||
exe_wrapper = 'wine'
|
||||
|
||||
[properties]
|
||||
root = '/usr/x86_64-w64-mingw32/sys-root/mingw'
|
||||
c_args = [ '-pipe', '-Wp,-D_FORTIFY_SOURCE=2', '-fexceptions', '--param=ssp-buffer-size=4', '-I/usr/x86_64-w64-mingw32/sys-root/mingw/include' ]
|
||||
c_link_args = [ '-L/usr/x86_64-w64-mingw32/sys-root/mingw/lib' ]
|
||||
|
||||
[host_machine]
|
||||
system = 'windows'
|
||||
cpu_family = 'x86_64'
|
||||
cpu = 'x86_64'
|
||||
endian = 'little'
|
||||
@@ -1,241 +0,0 @@
|
||||
DOXYFILE_ENCODING = UTF-8
|
||||
PROJECT_NAME = @PACKAGE_NAME@
|
||||
PROJECT_NUMBER = @PACKAGE_VERSION@
|
||||
PROJECT_BRIEF =
|
||||
PROJECT_LOGO =
|
||||
OUTPUT_DIRECTORY = doc
|
||||
CREATE_SUBDIRS = NO
|
||||
ALLOW_UNICODE_NAMES = YES
|
||||
OUTPUT_LANGUAGE = English
|
||||
BRIEF_MEMBER_DESC = YES
|
||||
REPEAT_BRIEF = YES
|
||||
ABBREVIATE_BRIEF =
|
||||
ALWAYS_DETAILED_SEC = NO
|
||||
INLINE_INHERITED_MEMB = NO
|
||||
FULL_PATH_NAMES = YES
|
||||
STRIP_FROM_PATH = "@top_srcdir@/include" "@top_builddir@/include"
|
||||
|
||||
SHORT_NAMES = NO
|
||||
JAVADOC_AUTOBRIEF = YES
|
||||
QT_AUTOBRIEF = NO
|
||||
MULTILINE_CPP_IS_BRIEF = NO
|
||||
INHERIT_DOCS = YES
|
||||
SEPARATE_MEMBER_PAGES = NO
|
||||
TAB_SIZE = 8
|
||||
ALIASES = "newin{2}=\xrefitem since_\1_\2 \"Since @PACKAGE_NAME@ \1.\2\" \"New API in @PACKAGE_NAME@ \1.\2\""
|
||||
TCL_SUBST =
|
||||
OPTIMIZE_OUTPUT_FOR_C = YES
|
||||
OPTIMIZE_OUTPUT_JAVA = NO
|
||||
OPTIMIZE_FOR_FORTRAN = NO
|
||||
OPTIMIZE_OUTPUT_VHDL = NO
|
||||
EXTENSION_MAPPING =
|
||||
MARKDOWN_SUPPORT = YES
|
||||
AUTOLINK_SUPPORT = YES
|
||||
BUILTIN_STL_SUPPORT = NO
|
||||
CPP_CLI_SUPPORT = NO
|
||||
SIP_SUPPORT = NO
|
||||
IDL_PROPERTY_SUPPORT = NO
|
||||
DISTRIBUTE_GROUP_DOC = NO
|
||||
GROUP_NESTED_COMPOUNDS = NO
|
||||
SUBGROUPING = YES
|
||||
INLINE_GROUPED_CLASSES = NO
|
||||
INLINE_SIMPLE_STRUCTS = NO
|
||||
TYPEDEF_HIDES_STRUCT = NO
|
||||
LOOKUP_CACHE_SIZE = 0
|
||||
|
||||
EXTRACT_ALL = YES
|
||||
EXTRACT_PRIVATE = NO
|
||||
EXTRACT_PACKAGE = NO
|
||||
EXTRACT_STATIC = NO
|
||||
EXTRACT_LOCAL_CLASSES = NO
|
||||
EXTRACT_LOCAL_METHODS = NO
|
||||
EXTRACT_ANON_NSPACES = NO
|
||||
HIDE_UNDOC_MEMBERS = YES
|
||||
HIDE_UNDOC_CLASSES = YES
|
||||
HIDE_FRIEND_COMPOUNDS = YES
|
||||
HIDE_IN_BODY_DOCS = YES
|
||||
INTERNAL_DOCS = NO
|
||||
CASE_SENSE_NAMES = YES
|
||||
HIDE_SCOPE_NAMES = NO
|
||||
HIDE_COMPOUND_REFERENCE= NO
|
||||
SHOW_INCLUDE_FILES = YES
|
||||
SHOW_GROUPED_MEMB_INC = NO
|
||||
FORCE_LOCAL_INCLUDES = NO
|
||||
INLINE_INFO = YES
|
||||
SORT_MEMBER_DOCS = YES
|
||||
SORT_BRIEF_DOCS = NO
|
||||
SORT_MEMBERS_CTORS_1ST = YES
|
||||
SORT_GROUP_NAMES = YES
|
||||
SORT_BY_SCOPE_NAME = YES
|
||||
STRICT_PROTO_MATCHING = NO
|
||||
GENERATE_TODOLIST = YES
|
||||
GENERATE_TESTLIST = NO
|
||||
GENERATE_BUGLIST = YES
|
||||
GENERATE_DEPRECATEDLIST= YES
|
||||
ENABLED_SECTIONS =
|
||||
MAX_INITIALIZER_LINES = 2
|
||||
SHOW_USED_FILES = YES
|
||||
SHOW_FILES = YES
|
||||
SHOW_NAMESPACES = NO
|
||||
FILE_VERSION_FILTER =
|
||||
LAYOUT_FILE =
|
||||
CITE_BIB_FILES =
|
||||
|
||||
QUIET = YES
|
||||
WARNINGS = YES
|
||||
WARN_IF_UNDOCUMENTED = YES
|
||||
WARN_IF_DOC_ERROR = YES
|
||||
WARN_NO_PARAMDOC = YES
|
||||
WARN_AS_ERROR = NO
|
||||
WARN_FORMAT = "$file:$line: $text"
|
||||
WARN_LOGFILE = doc/doxygen.log
|
||||
|
||||
INPUT = "@top_srcdir@/include/epoxy" "@top_srcdir@/src"
|
||||
INPUT_ENCODING = UTF-8
|
||||
FILE_PATTERNS = "*.h" "*.c"
|
||||
RECURSIVE = NO
|
||||
EXCLUDE = "@top_srcdir@/src/gen_dispatch.py"
|
||||
EXCLUDE_SYMLINKS = YES
|
||||
EXCLUDE_PATTERNS =
|
||||
EXCLUDE_SYMBOLS = _* GLAPI* KHRONOS_* APIENTRY* GLX* wgl* EPOXY_CALLSPEC EPOXY_BEGIN_DECLS EPOXY_END_DECLS
|
||||
EXAMPLE_PATH =
|
||||
EXAMPLE_PATTERNS =
|
||||
EXAMPLE_RECURSIVE = NO
|
||||
IMAGE_PATH =
|
||||
INPUT_FILTER =
|
||||
FILTER_PATTERNS =
|
||||
FILTER_SOURCE_FILES = NO
|
||||
FILTER_SOURCE_PATTERNS =
|
||||
USE_MDFILE_AS_MAINPAGE =
|
||||
|
||||
SOURCE_BROWSER = NO
|
||||
INLINE_SOURCES = NO
|
||||
STRIP_CODE_COMMENTS = YES
|
||||
REFERENCED_BY_RELATION = NO
|
||||
REFERENCES_RELATION = NO
|
||||
REFERENCES_LINK_SOURCE = YES
|
||||
SOURCE_TOOLTIPS = YES
|
||||
USE_HTAGS = NO
|
||||
VERBATIM_HEADERS = NO
|
||||
|
||||
ALPHABETICAL_INDEX = YES
|
||||
COLS_IN_ALPHA_INDEX = 3
|
||||
IGNORE_PREFIX = "epoxy"
|
||||
|
||||
GENERATE_HTML = YES
|
||||
HTML_OUTPUT = html
|
||||
HTML_FILE_EXTENSION = .html
|
||||
HTML_HEADER =
|
||||
HTML_FOOTER =
|
||||
HTML_STYLESHEET =
|
||||
HTML_EXTRA_STYLESHEET =
|
||||
HTML_EXTRA_FILES =
|
||||
HTML_COLORSTYLE_HUE = 220
|
||||
HTML_COLORSTYLE_SAT = 100
|
||||
HTML_COLORSTYLE_GAMMA = 80
|
||||
HTML_TIMESTAMP = YES
|
||||
HTML_DYNAMIC_SECTIONS = NO
|
||||
HTML_INDEX_NUM_ENTRIES = 100
|
||||
GENERATE_DOCSET = NO
|
||||
DOCSET_FEEDNAME = "Doxygen generated docs"
|
||||
DOCSET_BUNDLE_ID = org.doxygen.Project
|
||||
DOCSET_PUBLISHER_ID = org.doxygen.Publisher
|
||||
DOCSET_PUBLISHER_NAME = Publisher
|
||||
GENERATE_HTMLHELP = NO
|
||||
CHM_FILE =
|
||||
HHC_LOCATION =
|
||||
GENERATE_CHI = NO
|
||||
CHM_INDEX_ENCODING =
|
||||
BINARY_TOC = NO
|
||||
TOC_EXPAND = NO
|
||||
GENERATE_QHP = NO
|
||||
QCH_FILE =
|
||||
QHP_NAMESPACE =
|
||||
QHP_VIRTUAL_FOLDER = doc
|
||||
QHP_CUST_FILTER_NAME =
|
||||
QHP_CUST_FILTER_ATTRS =
|
||||
QHP_SECT_FILTER_ATTRS =
|
||||
QHG_LOCATION =
|
||||
GENERATE_ECLIPSEHELP = NO
|
||||
ECLIPSE_DOC_ID = org.doxygen.Project
|
||||
DISABLE_INDEX = NO
|
||||
GENERATE_TREEVIEW = NO
|
||||
ENUM_VALUES_PER_LINE = 1
|
||||
TREEVIEW_WIDTH = 250
|
||||
EXT_LINKS_IN_WINDOW = NO
|
||||
FORMULA_FONTSIZE = 10
|
||||
FORMULA_TRANSPARENT = YES
|
||||
USE_MATHJAX = NO
|
||||
MATHJAX_FORMAT = HTML-CSS
|
||||
MATHJAX_RELPATH = http://cdn.mathjax.org/mathjax/latest
|
||||
MATHJAX_EXTENSIONS =
|
||||
MATHJAX_CODEFILE =
|
||||
SEARCHENGINE = NO
|
||||
SERVER_BASED_SEARCH = NO
|
||||
EXTERNAL_SEARCH = NO
|
||||
SEARCHENGINE_URL =
|
||||
SEARCHDATA_FILE =
|
||||
EXTERNAL_SEARCH_ID =
|
||||
EXTRA_SEARCH_MAPPINGS =
|
||||
|
||||
GENERATE_LATEX = NO
|
||||
GENERATE_RTF = NO
|
||||
GENERATE_MAN = NO
|
||||
GENERATE_XML = NO
|
||||
GENERATE_DOCBOOK = NO
|
||||
GENERATE_AUTOGEN_DEF = NO
|
||||
GENERATE_PERLMOD = NO
|
||||
|
||||
ENABLE_PREPROCESSING = YES
|
||||
MACRO_EXPANSION = YES
|
||||
EXPAND_ONLY_PREDEF = YES
|
||||
SEARCH_INCLUDES = YES
|
||||
INCLUDE_PATH = "@top_srcdir@/include" \
|
||||
"@top_builddir@/include"
|
||||
INCLUDE_FILE_PATTERNS = *.h
|
||||
PREDEFINED = DOXYGEN_SHOULD_SKIP_THIS \
|
||||
"EPOXY_BEGIN_DECLS=" \
|
||||
"EPOXY_END_DECLS=" \
|
||||
"EPOXY_PUBLIC="
|
||||
EXPAND_AS_DEFINED =
|
||||
SKIP_FUNCTION_MACROS = YES
|
||||
|
||||
ALLEXTERNALS = NO
|
||||
EXTERNAL_GROUPS = NO
|
||||
EXTERNAL_PAGES = NO
|
||||
|
||||
HAVE_DOT = @HAVE_DOT@
|
||||
CLASS_DIAGRAMS = NO
|
||||
MSCGEN_PATH =
|
||||
DIA_PATH =
|
||||
HIDE_UNDOC_RELATIONS = NO
|
||||
DOT_NUM_THREADS = 0
|
||||
DOT_FONTNAME = Sans
|
||||
DOT_FONTSIZE = 10
|
||||
DOT_FONTPATH =
|
||||
CLASS_GRAPH = NO
|
||||
COLLABORATION_GRAPH = YES
|
||||
GROUP_GRAPHS = YES
|
||||
UML_LOOK = NO
|
||||
UML_LIMIT_NUM_FIELDS = 10
|
||||
TEMPLATE_RELATIONS = NO
|
||||
INCLUDE_GRAPH = NO
|
||||
INCLUDED_BY_GRAPH = NO
|
||||
CALL_GRAPH = NO
|
||||
CALLER_GRAPH = NO
|
||||
GRAPHICAL_HIERARCHY = YES
|
||||
DIRECTORY_GRAPH = YES
|
||||
DOT_IMAGE_FORMAT = png
|
||||
INTERACTIVE_SVG = NO
|
||||
DOT_PATH =
|
||||
DOTFILE_DIRS =
|
||||
MSCFILE_DIRS =
|
||||
DIAFILE_DIRS =
|
||||
PLANTUML_JAR_PATH =
|
||||
PLANTUML_INCLUDE_PATH =
|
||||
DOT_GRAPH_MAX_NODES = 50
|
||||
MAX_DOT_GRAPH_DEPTH = 0
|
||||
DOT_TRANSPARENT = NO
|
||||
DOT_MULTI_TARGETS = YES
|
||||
GENERATE_LEGEND = YES
|
||||
DOT_CLEANUP = YES
|
||||
@@ -1,25 +0,0 @@
|
||||
doxyfile_conf = configuration_data()
|
||||
doxyfile_conf.set('PACKAGE_NAME', meson.project_name())
|
||||
doxyfile_conf.set('PACKAGE_VERSION', meson.project_version())
|
||||
doxyfile_conf.set('top_srcdir', meson.source_root())
|
||||
doxyfile_conf.set('top_builddir', meson.build_root())
|
||||
|
||||
if find_program('dot', required: false).found()
|
||||
doxyfile_conf.set('HAVE_DOT', 'YES')
|
||||
else
|
||||
doxyfile_conf.set('HAVE_DOT', 'NO')
|
||||
endif
|
||||
|
||||
doxyfile = configure_file(input: 'Doxyfile.in',
|
||||
output: 'Doxyfile',
|
||||
configuration: doxyfile_conf,
|
||||
install: false)
|
||||
|
||||
docdir = join_paths(epoxy_datadir, 'doc')
|
||||
|
||||
html_target = custom_target('epoxy-docs',
|
||||
input: [ doxyfile ],
|
||||
output: [ 'html' ],
|
||||
command: [ doxygen, doxyfile ],
|
||||
install: true,
|
||||
install_dir: join_paths(docdir, 'epoxy'))
|
||||
@@ -1,63 +0,0 @@
|
||||
/*
|
||||
* Copyright 2017 Emmanuele Bassi
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
* IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/** @file common.h
|
||||
*
|
||||
* A common header file, used to define macros and shared symbols.
|
||||
*/
|
||||
|
||||
#ifndef EPOXY_COMMON_H
|
||||
#define EPOXY_COMMON_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
# define EPOXY_BEGIN_DECLS extern "C" {
|
||||
# define EPOXY_END_DECLS }
|
||||
#else
|
||||
# define EPOXY_BEGIN_DECLS
|
||||
# define EPOXY_END_DECLS
|
||||
#endif
|
||||
|
||||
#ifndef EPOXY_PUBLIC
|
||||
# if defined(_MSC_VER)
|
||||
# define EPOXY_PUBLIC __declspec(dllimport) extern
|
||||
# else
|
||||
# define EPOXY_PUBLIC extern
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER) && !defined(__bool_true_false_are_defined) && (_MSC_VER < 1800)
|
||||
typedef unsigned char bool;
|
||||
# define false 0
|
||||
# define true 1
|
||||
#else
|
||||
# include <stdbool.h>
|
||||
#endif
|
||||
|
||||
EPOXY_BEGIN_DECLS
|
||||
|
||||
EPOXY_PUBLIC bool epoxy_extension_in_string(const char *extension_list,
|
||||
const char *ext);
|
||||
|
||||
EPOXY_END_DECLS
|
||||
|
||||
#endif /* EPOXY_COMMON_H */
|
||||
@@ -1,54 +0,0 @@
|
||||
/*
|
||||
* Copyright © 2013 Intel Corporation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
* IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/** @file egl.h
|
||||
*
|
||||
* Provides an implementation of an EGL dispatch layer using global
|
||||
* function pointers
|
||||
*
|
||||
* You should include `<epoxy/egl.h>` instead of `<EGL/egl.h>`.
|
||||
*/
|
||||
|
||||
#ifndef EPOXY_EGL_H
|
||||
#define EPOXY_EGL_H
|
||||
|
||||
#include "epoxy/common.h"
|
||||
|
||||
#if defined(__egl_h_) || defined(__eglext_h_)
|
||||
#error epoxy/egl.h must be included before (or in place of) GL/egl.h
|
||||
#else
|
||||
#define __egl_h_
|
||||
#define __eglext_h_
|
||||
#endif
|
||||
|
||||
EPOXY_BEGIN_DECLS
|
||||
|
||||
#include "epoxy/egl_generated.h"
|
||||
|
||||
EPOXY_PUBLIC bool epoxy_has_egl_extension(EGLDisplay dpy, const char *extension);
|
||||
EPOXY_PUBLIC int epoxy_egl_version(EGLDisplay dpy);
|
||||
EPOXY_PUBLIC bool epoxy_has_egl(void);
|
||||
|
||||
EPOXY_END_DECLS
|
||||
|
||||
#endif /* EPOXY_EGL_H */
|
||||
@@ -1,112 +0,0 @@
|
||||
/*
|
||||
* Copyright © 2013 Intel Corporation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
* IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/** @file gl.h
|
||||
*
|
||||
* Provides an implementation of a GL dispatch layer using either
|
||||
* global function pointers or a hidden vtable.
|
||||
*
|
||||
* You should include `<epoxy/gl.h>` instead of `<GL/gl.h>` and `<GL/glext.h>`.
|
||||
*/
|
||||
|
||||
#ifndef EPOXY_GL_H
|
||||
#define EPOXY_GL_H
|
||||
|
||||
#include "epoxy/common.h"
|
||||
|
||||
#if defined(__gl_h_) || defined(__glext_h_)
|
||||
#error epoxy/gl.h must be included before (or in place of) GL/gl.h
|
||||
#else
|
||||
#define __gl_h_
|
||||
#define __glext_h_
|
||||
#endif
|
||||
|
||||
#define KHRONOS_SUPPORT_INT64 1
|
||||
#define KHRONOS_SUPPORT_FLOAT 1
|
||||
#define KHRONOS_APIATTRIBUTES
|
||||
|
||||
#ifndef _WIN32
|
||||
/* APIENTRY and GLAPIENTRY are not used on Linux or Mac. */
|
||||
#define APIENTRY
|
||||
#define GLAPIENTRY
|
||||
#define EPOXY_CALLSPEC
|
||||
#define GLAPI
|
||||
#define KHRONOS_APIENTRY
|
||||
#define KHRONOS_APICALL
|
||||
|
||||
#else
|
||||
#ifndef APIENTRY
|
||||
#define APIENTRY __stdcall
|
||||
#endif
|
||||
|
||||
#ifndef GLAPIENTRY
|
||||
#define GLAPIENTRY APIENTRY
|
||||
#endif
|
||||
|
||||
#ifndef EPOXY_CALLSPEC
|
||||
#define EPOXY_CALLSPEC __stdcall
|
||||
#endif
|
||||
|
||||
#ifndef GLAPI
|
||||
#define GLAPI extern
|
||||
#endif
|
||||
|
||||
#define KHRONOS_APIENTRY __stdcall
|
||||
#define KHRONOS_APICALL __declspec(dllimport) __stdcall
|
||||
|
||||
#endif /* _WIN32 */
|
||||
|
||||
#ifndef APIENTRYP
|
||||
#define APIENTRYP APIENTRY *
|
||||
#endif
|
||||
|
||||
#ifndef GLAPIENTRYP
|
||||
#define GLAPIENTRYP GLAPIENTRY *
|
||||
#endif
|
||||
|
||||
EPOXY_BEGIN_DECLS
|
||||
|
||||
#include "epoxy/gl_generated.h"
|
||||
|
||||
EPOXY_PUBLIC bool epoxy_has_gl_extension(const char *extension);
|
||||
EPOXY_PUBLIC bool epoxy_is_desktop_gl(void);
|
||||
EPOXY_PUBLIC int epoxy_gl_version(void);
|
||||
EPOXY_PUBLIC int epoxy_glsl_version(void);
|
||||
|
||||
/*
|
||||
* the type of the stub function that the failure handler must return;
|
||||
* this function will be called on subsequent calls to the same bogus
|
||||
* function name
|
||||
*/
|
||||
typedef void (*epoxy_resolver_stub_t)(void);
|
||||
|
||||
/* the type of the failure handler itself */
|
||||
typedef epoxy_resolver_stub_t
|
||||
(*epoxy_resolver_failure_handler_t)(const char *name);
|
||||
|
||||
EPOXY_PUBLIC epoxy_resolver_failure_handler_t
|
||||
epoxy_set_resolver_failure_handler(epoxy_resolver_failure_handler_t handler);
|
||||
|
||||
EPOXY_END_DECLS
|
||||
|
||||
#endif /* EPOXY_GL_H */
|
||||
@@ -1,57 +0,0 @@
|
||||
/*
|
||||
* Copyright © 2013 Intel Corporation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
* IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/** @file glx.h
|
||||
*
|
||||
* Provides an implementation of a GLX dispatch layer using global
|
||||
* function pointers.
|
||||
*
|
||||
* You should include `<epoxy/glx.h>` instead of `<GL/glx.h>`.
|
||||
*/
|
||||
|
||||
#ifndef EPOXY_GLX_H
|
||||
#define EPOXY_GLX_H
|
||||
|
||||
#include <epoxy/gl.h>
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xutil.h>
|
||||
|
||||
#if defined(GLX_H) || defined(__glxext_h_)
|
||||
#error epoxy/glx.h must be included before (or in place of) GL/glx.h
|
||||
#else
|
||||
#define GLX_H
|
||||
#define __glx_h__
|
||||
#define __glxext_h_
|
||||
#endif
|
||||
|
||||
EPOXY_BEGIN_DECLS
|
||||
|
||||
#include "epoxy/glx_generated.h"
|
||||
|
||||
EPOXY_PUBLIC bool epoxy_has_glx_extension(Display *dpy, int screen, const char *extension);
|
||||
EPOXY_PUBLIC int epoxy_glx_version(Display *dpy, int screen);
|
||||
EPOXY_PUBLIC bool epoxy_has_glx(Display *dpy);
|
||||
|
||||
EPOXY_END_DECLS
|
||||
|
||||
#endif /* EPOXY_GLX_H */
|
||||
@@ -1,43 +0,0 @@
|
||||
headers = [ 'common.h' ]
|
||||
|
||||
# GL is always generated
|
||||
generated_headers = [ [ 'gl.h', 'gl_generated.h', gl_registry ] ]
|
||||
|
||||
if build_egl
|
||||
generated_headers += [ [ 'egl.h', 'egl_generated.h', egl_registry ] ]
|
||||
endif
|
||||
|
||||
if build_glx
|
||||
generated_headers += [ [ 'glx.h', 'glx_generated.h', glx_registry ] ]
|
||||
endif
|
||||
|
||||
if build_wgl
|
||||
generated_headers += [ [ 'wgl.h', 'wgl_generated.h', wgl_registry ] ]
|
||||
endif
|
||||
|
||||
gen_headers = []
|
||||
|
||||
foreach g: generated_headers
|
||||
header = g[0]
|
||||
gen_header = g[1]
|
||||
registry = g[2]
|
||||
generated = custom_target(gen_header,
|
||||
input: registry,
|
||||
output: [ gen_header ],
|
||||
command: [
|
||||
gen_dispatch_py,
|
||||
'--header',
|
||||
'--no-source',
|
||||
'--outputdir=@OUTDIR@',
|
||||
'@INPUT@',
|
||||
],
|
||||
install: true,
|
||||
install_dir: join_paths(epoxy_includedir, 'epoxy'))
|
||||
|
||||
gen_headers += [ generated ]
|
||||
headers += [ header ]
|
||||
endforeach
|
||||
|
||||
epoxy_headers = files(headers) + gen_headers
|
||||
|
||||
install_headers(headers, subdir: 'epoxy')
|
||||
@@ -1,61 +0,0 @@
|
||||
/*
|
||||
* Copyright © 2013 Intel Corporation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
* IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/** @file wgl.h
|
||||
*
|
||||
* Provides an implementation of a WGL dispatch layer using a hidden
|
||||
* vtable.
|
||||
*/
|
||||
|
||||
#ifndef EPOXY_WGL_H
|
||||
#define EPOXY_WGL_H
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
#include "epoxy/common.h"
|
||||
|
||||
#undef wglUseFontBitmaps
|
||||
#undef wglUseFontOutlines
|
||||
|
||||
#if defined(__wglxext_h_)
|
||||
#error epoxy/wgl.h must be included before (or in place of) wgl.h
|
||||
#else
|
||||
#define __wglxext_h_
|
||||
#endif
|
||||
|
||||
#ifdef UNICODE
|
||||
#define wglUseFontBitmaps wglUseFontBitmapsW
|
||||
#else
|
||||
#define wglUseFontBitmaps wglUseFontBitmapsA
|
||||
#endif
|
||||
|
||||
EPOXY_BEGIN_DECLS
|
||||
|
||||
#include "epoxy/wgl_generated.h"
|
||||
|
||||
EPOXY_PUBLIC bool epoxy_has_wgl_extension(HDC hdc, const char *extension);
|
||||
EPOXY_PUBLIC void epoxy_handle_external_wglMakeCurrent(void);
|
||||
|
||||
EPOXY_END_DECLS
|
||||
|
||||
#endif /* EPOXY_WGL_H */
|
||||
@@ -1,229 +0,0 @@
|
||||
project('libepoxy', 'c', version: '1.5.10',
|
||||
default_options: [
|
||||
'buildtype=debugoptimized',
|
||||
'c_std=gnu99',
|
||||
'warning_level=1',
|
||||
],
|
||||
license: 'MIT',
|
||||
meson_version: '>= 0.54.0')
|
||||
|
||||
epoxy_version = meson.project_version().split('.')
|
||||
epoxy_major_version = epoxy_version[0].to_int()
|
||||
epoxy_minor_version = epoxy_version[1].to_int()
|
||||
epoxy_micro_version = epoxy_version[2].to_int()
|
||||
|
||||
epoxy_prefix = get_option('prefix')
|
||||
epoxy_libdir = join_paths(epoxy_prefix, get_option('libdir'))
|
||||
epoxy_datadir = join_paths(epoxy_prefix, get_option('datadir'))
|
||||
epoxy_includedir = join_paths(epoxy_prefix, get_option('includedir'))
|
||||
|
||||
cc = meson.get_compiler('c')
|
||||
host_system = host_machine.system()
|
||||
|
||||
conf = configuration_data()
|
||||
conf.set_quoted('PACKAGE_NAME', meson.project_name())
|
||||
conf.set_quoted('PACKAGE_VERSION', meson.project_version())
|
||||
conf.set_quoted('PACKAGE_STRING', '@0@-@1@'.format(meson.project_name(), meson.project_version()))
|
||||
conf.set_quoted('PACKAGE_DATADIR', join_paths(get_option('prefix'), get_option('datadir')))
|
||||
conf.set_quoted('PACKAGE_LIBDIR', join_paths(get_option('prefix'), get_option('libdir')))
|
||||
conf.set_quoted('PACKAGE_LOCALEDIR', join_paths(get_option('prefix'), get_option('datadir'), 'locale'))
|
||||
conf.set_quoted('PACKAGE_LIBEXECDIR', join_paths(get_option('prefix'), get_option('libexecdir')))
|
||||
conf.set('HAVE_KHRPLATFORM_H', cc.has_header('KHR/khrplatform.h'))
|
||||
|
||||
# GLX can be used on different platforms, so we expose a
|
||||
# configure time switch to enable or disable it; in case
|
||||
# the "auto" default value is set, we only enable GLX
|
||||
# support on Linux and Unix
|
||||
enable_glx = get_option('glx')
|
||||
if enable_glx == 'auto'
|
||||
build_glx = not ['windows', 'darwin', 'android', 'haiku'].contains(host_system)
|
||||
else
|
||||
build_glx = enable_glx == 'yes'
|
||||
endif
|
||||
|
||||
enable_egl = get_option('egl')
|
||||
if enable_egl == 'auto'
|
||||
build_egl = not ['windows', 'darwin'].contains(host_system)
|
||||
else
|
||||
build_egl = enable_egl == 'yes'
|
||||
endif
|
||||
|
||||
enable_x11 = get_option('x11')
|
||||
if not enable_x11
|
||||
if enable_glx == 'yes'
|
||||
error('GLX support is explicitly enabled, but X11 was disabled')
|
||||
endif
|
||||
build_glx = false
|
||||
endif
|
||||
|
||||
# The remaining platform specific API for GL/GLES are enabled
|
||||
# depending on the platform we're building for
|
||||
if host_system == 'windows'
|
||||
build_wgl = true
|
||||
has_znow = true
|
||||
elif host_system == 'darwin'
|
||||
build_wgl = false
|
||||
has_znow = false
|
||||
else
|
||||
build_wgl = false
|
||||
has_znow = true
|
||||
endif
|
||||
|
||||
conf.set10('ENABLE_GLX', build_glx)
|
||||
conf.set10('ENABLE_EGL', build_egl)
|
||||
conf.set10('ENABLE_X11', enable_x11)
|
||||
|
||||
# Compiler flags, taken from the Xorg macros
|
||||
if cc.get_id() == 'msvc'
|
||||
# Compiler options taken from msvc_recommended_pragmas.h
|
||||
# in GLib, based on _Win32_Programming_ by Rector and Newcomer
|
||||
test_cflags = [
|
||||
'-we4002', # too many actual parameters for macro
|
||||
'-we4003', # not enough actual parameters for macro
|
||||
'-w14010', # single-line comment contains line-continuation character
|
||||
'-we4013', # 'function' undefined; assuming extern returning int
|
||||
'-w14016', # no function return type; using int as default
|
||||
'-we4020', # too many actual parameters
|
||||
'-we4021', # too few actual parameters
|
||||
'-we4027', # function declared without formal parameter list
|
||||
'-we4029', # declared formal parameter list different from definition
|
||||
'-we4033', # 'function' must return a value
|
||||
'-we4035', # 'function' : no return value
|
||||
'-we4045', # array bounds overflow
|
||||
'-we4047', # different levels of indirection
|
||||
'-we4049', # terminating line number emission
|
||||
'-we4053', # an expression of type void was used as an operand
|
||||
'-we4071', # no function prototype given
|
||||
'-we4819', # the file contains a character that cannot be represented in the current code page
|
||||
'/utf-8', # Set the input and exec encoding to utf-8, like is the default with GCC
|
||||
]
|
||||
elif cc.get_id() == 'gcc' or cc.get_id() == 'clang'
|
||||
test_cflags = [
|
||||
'-Wpointer-arith',
|
||||
'-Wmissing-declarations',
|
||||
'-Wformat=2',
|
||||
'-Wstrict-prototypes',
|
||||
'-Wmissing-prototypes',
|
||||
'-Wnested-externs',
|
||||
'-Wbad-function-cast',
|
||||
'-Wold-style-definition',
|
||||
'-Wdeclaration-after-statement',
|
||||
'-Wunused',
|
||||
'-Wuninitialized',
|
||||
'-Wshadow',
|
||||
'-Wmissing-noreturn',
|
||||
'-Wmissing-format-attribute',
|
||||
'-Wredundant-decls',
|
||||
'-Wlogical-op',
|
||||
'-Werror=implicit',
|
||||
'-Werror=nonnull',
|
||||
'-Werror=init-self',
|
||||
'-Werror=main',
|
||||
'-Werror=missing-braces',
|
||||
'-Werror=sequence-point',
|
||||
'-Werror=return-type',
|
||||
'-Werror=trigraphs',
|
||||
'-Werror=array-bounds',
|
||||
'-Werror=write-strings',
|
||||
'-Werror=address',
|
||||
'-Werror=int-to-pointer-cast',
|
||||
'-Werror=pointer-to-int-cast',
|
||||
'-fno-strict-aliasing',
|
||||
'-Wno-int-conversion',
|
||||
]
|
||||
else
|
||||
test_cflags = []
|
||||
endif
|
||||
|
||||
common_cflags = cc.get_supported_arguments(test_cflags)
|
||||
|
||||
libtype = get_option('default_library')
|
||||
|
||||
# Visibility compiler flags; we only use this for shared libraries
|
||||
visibility_cflags = []
|
||||
if libtype == 'shared'
|
||||
if host_system == 'windows'
|
||||
conf.set('DLL_EXPORT', true)
|
||||
conf.set('EPOXY_PUBLIC', '__declspec(dllexport) extern')
|
||||
if cc.get_id() != 'msvc'
|
||||
visibility_cflags += [ '-fvisibility=hidden' ]
|
||||
endif
|
||||
else
|
||||
conf.set('EPOXY_PUBLIC', '__attribute__((visibility("default"))) extern')
|
||||
visibility_cflags += [ '-fvisibility=hidden' ]
|
||||
endif
|
||||
endif
|
||||
|
||||
# The inline keyword is available only for C++ in MSVC.
|
||||
# So we need to use Microsoft specific __inline.
|
||||
if host_system == 'windows'
|
||||
if cc.get_id() == 'msvc'
|
||||
conf.set('inline', '__inline')
|
||||
endif
|
||||
endif
|
||||
|
||||
# Dependencies
|
||||
dl_dep = cc.find_library('dl', required: false)
|
||||
gl_dep = dependency('gl', required: false)
|
||||
egl_dep = dependency('egl', required: false)
|
||||
elg_headers_dep = egl_dep.partial_dependency(compile_args: true, includes: true)
|
||||
|
||||
# Optional dependencies for tests
|
||||
x11_dep = dependency('x11', required: false)
|
||||
x11_headers_dep = x11_dep.partial_dependency(compile_args: true, includes: true)
|
||||
|
||||
# GLES v2 and v1 may have pkg-config files, courtesy of downstream
|
||||
# packagers; let's check those first, and fall back to find_library()
|
||||
# if we fail
|
||||
gles2_dep = dependency('glesv2', required: false)
|
||||
if not gles2_dep.found()
|
||||
gles2_dep = cc.find_library('libGLESv2', required: false)
|
||||
endif
|
||||
|
||||
gles1_dep = dependency('glesv1_cm', required: false)
|
||||
if not gles1_dep.found()
|
||||
gles1_dep = cc.find_library('libGLESv1_CM', required: false)
|
||||
endif
|
||||
|
||||
# On windows, the DLL has to have all of its functions
|
||||
# resolved at link time, so we have to link directly against
|
||||
# opengl32. But that's the only GL provider, anyway.
|
||||
if host_system == 'windows'
|
||||
opengl32_dep = cc.find_library('opengl32', required: true)
|
||||
|
||||
# When building against static libraries, we need to control
|
||||
# the order of the dependencies, and gdi32 provides symbols
|
||||
# needed when using opengl32, like SetPixelFormat and
|
||||
# ChoosePixelFormat. This is mostly a workaround for older
|
||||
# versions of Meson.
|
||||
gdi32_dep = cc.find_library('gdi32', required: true)
|
||||
endif
|
||||
|
||||
# Generates the dispatch tables
|
||||
gen_dispatch_py = find_program('src/gen_dispatch.py')
|
||||
|
||||
gl_registry = files('registry/gl.xml')
|
||||
egl_registry = files('registry/egl.xml')
|
||||
glx_registry = files('registry/glx.xml')
|
||||
wgl_registry = files('registry/wgl.xml')
|
||||
|
||||
libepoxy_inc = [
|
||||
include_directories('include'),
|
||||
include_directories('src'),
|
||||
]
|
||||
|
||||
subdir('include/epoxy')
|
||||
subdir('src')
|
||||
|
||||
if get_option('tests')
|
||||
subdir('test')
|
||||
endif
|
||||
|
||||
if get_option('docs')
|
||||
doxygen = find_program('doxygen', required: false)
|
||||
if doxygen.found()
|
||||
subdir('doc')
|
||||
else
|
||||
message('Documentation disabled without doxygen')
|
||||
endif
|
||||
endif
|
||||
@@ -1,21 +0,0 @@
|
||||
option('docs',
|
||||
type: 'boolean', value: false,
|
||||
description: 'Enable generating the Epoxy API reference (depends on Doxygen)')
|
||||
option('glx',
|
||||
type: 'combo',
|
||||
choices: [ 'auto', 'yes', 'no' ],
|
||||
value: 'auto',
|
||||
description: 'Enable GLX support')
|
||||
option('egl',
|
||||
type: 'combo',
|
||||
choices: [ 'auto', 'yes', 'no' ],
|
||||
value: 'auto',
|
||||
description: 'Enable EGL support')
|
||||
option('x11',
|
||||
type: 'boolean',
|
||||
value: true,
|
||||
description: 'Enable X11 support (GLX or EGL-X11)')
|
||||
option('tests',
|
||||
type: 'boolean',
|
||||
value: true,
|
||||
description: 'Build the test suite')
|
||||
@@ -1,13 +0,0 @@
|
||||
## Updating the registry XML
|
||||
|
||||
In order to update the registry XML files and retain the history you cannot
|
||||
simply download the files the [Khronos website](https://khronos.org/registry/OpenGL/index_gl.php)
|
||||
and copy them into this directory. You should follow these steps, instead:
|
||||
|
||||
1. check out the `khronos-registry` branch
|
||||
2. download the XML files from the Khronos repository
|
||||
3. copy them under the `registry` directory
|
||||
4. check the result for consistency and commit it
|
||||
5. check out the `master` branch and merge the `khronos-registry` branch
|
||||
into it with the appropriate commit message
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,926 +0,0 @@
|
||||
/*
|
||||
* Copyright © 2013-2014 Intel Corporation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
* IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \mainpage Epoxy
|
||||
*
|
||||
* \section intro_sec Introduction
|
||||
*
|
||||
* Epoxy is a library for handling OpenGL function pointer management for
|
||||
* you.
|
||||
*
|
||||
* It hides the complexity of `dlopen()`, `dlsym()`, `glXGetProcAddress()`,
|
||||
* `eglGetProcAddress()`, etc. from the app developer, with very little
|
||||
* knowledge needed on their part. They get to read GL specs and write
|
||||
* code using undecorated function names like `glCompileShader()`.
|
||||
*
|
||||
* Don't forget to check for your extensions or versions being present
|
||||
* before you use them, just like before! We'll tell you what you forgot
|
||||
* to check for instead of just segfaulting, though.
|
||||
*
|
||||
* \section features_sec Features
|
||||
*
|
||||
* - Automatically initializes as new GL functions are used.
|
||||
* - GL 4.6 core and compatibility context support.
|
||||
* - GLES 1/2/3 context support.
|
||||
* - Knows about function aliases so (e.g.) `glBufferData()` can be
|
||||
* used with `GL_ARB_vertex_buffer_object` implementations, along
|
||||
* with GL 1.5+ implementations.
|
||||
* - EGL, GLX, and WGL support.
|
||||
* - Can be mixed with non-epoxy GL usage.
|
||||
*
|
||||
* \section using_sec Using Epoxy
|
||||
*
|
||||
* Using Epoxy should be as easy as replacing:
|
||||
*
|
||||
* ```cpp
|
||||
* #include <GL/gl.h>
|
||||
* #include <GL/glx.h>
|
||||
* #include <GL/glext.h>
|
||||
* ```
|
||||
*
|
||||
* with:
|
||||
*
|
||||
* ```cpp
|
||||
* #include <epoxy/gl.h>
|
||||
* #include <epoxy/glx.h>
|
||||
* ```
|
||||
*
|
||||
* \subsection using_include_sec Headers
|
||||
*
|
||||
* Epoxy comes with the following public headers:
|
||||
*
|
||||
* - `epoxy/gl.h` - For GL API
|
||||
* - `epoxy/egl.h` - For EGL API
|
||||
* - `epoxy/glx.h` - For GLX API
|
||||
* - `epoxy/wgl.h` - For WGL API
|
||||
*
|
||||
* \section links_sec Additional links
|
||||
*
|
||||
* The latest version of the Epoxy code is available on [GitHub](https://github.com/anholt/libepoxy).
|
||||
*
|
||||
* For bug reports and enhancements, please use the [Issues](https://github.com/anholt/libepoxy/issues)
|
||||
* link.
|
||||
*
|
||||
* The scope of this API reference does not include the documentation for
|
||||
* OpenGL and OpenGL ES. For more information on those programming interfaces
|
||||
* please visit:
|
||||
*
|
||||
* - [Khronos](https://www.khronos.org/)
|
||||
* - [OpenGL page on Khronos.org](https://www.khronos.org/opengl/)
|
||||
* - [OpenGL ES page on Khronos.org](https://www.khronos.org/opengles/)
|
||||
* - [docs.GL](http://docs.gl/)
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file dispatch_common.c
|
||||
*
|
||||
* @brief Implements common code shared by the generated GL/EGL/GLX dispatch code.
|
||||
*
|
||||
* A collection of some important specs on getting GL function pointers.
|
||||
*
|
||||
* From the linux GL ABI (http://www.opengl.org/registry/ABI/):
|
||||
*
|
||||
* "3.4. The libraries must export all OpenGL 1.2, GLU 1.3, GLX 1.3, and
|
||||
* ARB_multitexture entry points statically.
|
||||
*
|
||||
* 3.5. Because non-ARB extensions vary so widely and are constantly
|
||||
* increasing in number, it's infeasible to require that they all be
|
||||
* supported, and extensions can always be added to hardware drivers
|
||||
* after the base link libraries are released. These drivers are
|
||||
* dynamically loaded by libGL, so extensions not in the base
|
||||
* library must also be obtained dynamically.
|
||||
*
|
||||
* 3.6. To perform the dynamic query, libGL also must export an entry
|
||||
* point called
|
||||
*
|
||||
* void (*glXGetProcAddressARB(const GLubyte *))();
|
||||
*
|
||||
* The full specification of this function is available separately. It
|
||||
* takes the string name of a GL or GLX entry point and returns a pointer
|
||||
* to a function implementing that entry point. It is functionally
|
||||
* identical to the wglGetProcAddress query defined by the Windows OpenGL
|
||||
* library, except that the function pointers returned are context
|
||||
* independent, unlike the WGL query."
|
||||
*
|
||||
* From the EGL 1.4 spec:
|
||||
*
|
||||
* "Client API function pointers returned by eglGetProcAddress are
|
||||
* independent of the display and the currently bound client API context,
|
||||
* and may be used by any client API context which supports the extension.
|
||||
*
|
||||
* eglGetProcAddress may be queried for all of the following functions:
|
||||
*
|
||||
* • All EGL and client API extension functions supported by the
|
||||
* implementation (whether those extensions are supported by the current
|
||||
* client API context or not). This includes any mandatory OpenGL ES
|
||||
* extensions.
|
||||
*
|
||||
* eglGetProcAddress may not be queried for core (non-extension) functions
|
||||
* in EGL or client APIs 20 .
|
||||
*
|
||||
* For functions that are queryable with eglGetProcAddress,
|
||||
* implementations may choose to also export those functions statically
|
||||
* from the object libraries im- plementing those functions. However,
|
||||
* portable clients cannot rely on this behavior.
|
||||
*
|
||||
* From the GLX 1.4 spec:
|
||||
*
|
||||
* "glXGetProcAddress may be queried for all of the following functions:
|
||||
*
|
||||
* • All GL and GLX extension functions supported by the implementation
|
||||
* (whether those extensions are supported by the current context or
|
||||
* not).
|
||||
*
|
||||
* • All core (non-extension) functions in GL and GLX from version 1.0 up
|
||||
* to and including the versions of those specifications supported by
|
||||
* the implementation, as determined by glGetString(GL VERSION) and
|
||||
* glXQueryVersion queries."
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdlib.h>
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#else
|
||||
#include <dlfcn.h>
|
||||
#include <err.h>
|
||||
#include <pthread.h>
|
||||
#endif
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "dispatch_common.h"
|
||||
|
||||
#if defined(__APPLE__)
|
||||
#define GLX_LIB "/opt/X11/lib/libGL.1.dylib"
|
||||
#define OPENGL_LIB "/System/Library/Frameworks/OpenGL.framework/Versions/Current/OpenGL"
|
||||
#define GLES1_LIB "libGLESv1_CM.so"
|
||||
#define GLES2_LIB "libGLESv2.so"
|
||||
#elif defined(__ANDROID__)
|
||||
#define GLX_LIB "libGLESv2.so"
|
||||
#define EGL_LIB "libEGL.so"
|
||||
#define GLES1_LIB "libGLESv1_CM.so"
|
||||
#define GLES2_LIB "libGLESv2.so"
|
||||
#elif defined(_WIN32)
|
||||
#define EGL_LIB "libEGL.dll"
|
||||
#define GLES1_LIB "libGLES_CM.dll"
|
||||
#define GLES2_LIB "libGLESv2.dll"
|
||||
#define OPENGL_LIB "OPENGL32"
|
||||
#else
|
||||
#define GLVND_GLX_LIB "libGLX.so.1"
|
||||
#define GLX_LIB "libGL.so.1"
|
||||
#define EGL_LIB "libEGL.so.1"
|
||||
#define GLES1_LIB "libGLESv1_CM.so.1"
|
||||
#define GLES2_LIB "libGLESv2.so.2"
|
||||
#define OPENGL_LIB "libOpenGL.so.0"
|
||||
#endif
|
||||
|
||||
#ifdef __GNUC__
|
||||
#define CONSTRUCT(_func) static void _func (void) __attribute__((constructor));
|
||||
#define DESTRUCT(_func) static void _func (void) __attribute__((destructor));
|
||||
#elif defined (_MSC_VER) && (_MSC_VER >= 1500)
|
||||
#define CONSTRUCT(_func) \
|
||||
static void _func(void); \
|
||||
static int _func ## _wrapper(void) { _func(); return 0; } \
|
||||
__pragma(section(".CRT$XCU",read)) \
|
||||
__declspec(allocate(".CRT$XCU")) static int (* _array ## _func)(void) = _func ## _wrapper;
|
||||
|
||||
#define DESTRUCT(_func) \
|
||||
static void _func(void); \
|
||||
static int _func ## _constructor(void) { atexit (_func); return 0; } \
|
||||
__pragma(section(".CRT$XCU",read)) \
|
||||
__declspec(allocate(".CRT$XCU")) static int (* _array ## _func)(void) = _func ## _constructor;
|
||||
|
||||
#else
|
||||
#error "You will need constructor support for your compiler"
|
||||
#endif
|
||||
|
||||
struct api {
|
||||
#ifndef _WIN32
|
||||
/*
|
||||
* Locking for making sure we don't double-dlopen().
|
||||
*/
|
||||
pthread_mutex_t mutex;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* dlopen() return value for the GLX API. This is libGLX.so.1 if the
|
||||
* runtime is glvnd-enabled, else libGL.so.1
|
||||
*/
|
||||
void *glx_handle;
|
||||
|
||||
/*
|
||||
* dlopen() return value for the desktop GL library.
|
||||
*
|
||||
* On Windows this is OPENGL32. On OSX this is classic libGL. On Linux
|
||||
* this is either libOpenGL (if the runtime is glvnd-enabled) or
|
||||
* classic libGL.so.1
|
||||
*/
|
||||
void *gl_handle;
|
||||
|
||||
/* dlopen() return value for libEGL.so.1 */
|
||||
void *egl_handle;
|
||||
|
||||
/* dlopen() return value for libGLESv1_CM.so.1 */
|
||||
void *gles1_handle;
|
||||
|
||||
/* dlopen() return value for libGLESv2.so.2 */
|
||||
void *gles2_handle;
|
||||
|
||||
/*
|
||||
* This value gets incremented when any thread is in
|
||||
* glBegin()/glEnd() called through epoxy.
|
||||
*
|
||||
* We're not guaranteed to be called through our wrapper, so the
|
||||
* conservative paths also try to handle the failure cases they'll
|
||||
* see if begin_count didn't reflect reality. It's also a bit of
|
||||
* a bug that the conservative paths might return success because
|
||||
* some other thread was in epoxy glBegin/glEnd while our thread
|
||||
* is trying to resolve, but given that it's basically just for
|
||||
* informative error messages, we shouldn't need to care.
|
||||
*/
|
||||
long begin_count;
|
||||
};
|
||||
|
||||
static struct api api = {0};
|
||||
|
||||
static bool library_initialized;
|
||||
|
||||
static bool epoxy_current_context_is_glx(void);
|
||||
|
||||
#if PLATFORM_HAS_EGL
|
||||
static EGLenum
|
||||
epoxy_egl_get_current_gl_context_api(void);
|
||||
#endif
|
||||
|
||||
CONSTRUCT (library_init)
|
||||
|
||||
static void
|
||||
library_init(void)
|
||||
{
|
||||
library_initialized = true;
|
||||
}
|
||||
|
||||
static bool
|
||||
get_dlopen_handle(void **handle, const char *lib_name, bool exit_on_fail, bool load)
|
||||
{
|
||||
if (*handle)
|
||||
return true;
|
||||
|
||||
if (!library_initialized) {
|
||||
fputs("Attempting to dlopen() while in the dynamic linker.\n", stderr);
|
||||
abort();
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
*handle = LoadLibraryA(lib_name);
|
||||
#else
|
||||
pthread_mutex_lock(&api.mutex);
|
||||
if (!*handle) {
|
||||
int flags = RTLD_LAZY | RTLD_LOCAL;
|
||||
if (!load)
|
||||
flags |= RTLD_NOLOAD;
|
||||
|
||||
*handle = dlopen(lib_name, flags);
|
||||
if (!*handle) {
|
||||
if (exit_on_fail) {
|
||||
fprintf(stderr, "Couldn't open %s: %s\n", lib_name, dlerror());
|
||||
abort();
|
||||
} else {
|
||||
(void)dlerror();
|
||||
}
|
||||
}
|
||||
}
|
||||
pthread_mutex_unlock(&api.mutex);
|
||||
#endif
|
||||
|
||||
return *handle != NULL;
|
||||
}
|
||||
|
||||
static void *
|
||||
do_dlsym(void **handle, const char *name, bool exit_on_fail)
|
||||
{
|
||||
void *result;
|
||||
const char *error = "";
|
||||
|
||||
#ifdef _WIN32
|
||||
result = GetProcAddress(*handle, name);
|
||||
#else
|
||||
result = dlsym(*handle, name);
|
||||
if (!result)
|
||||
error = dlerror();
|
||||
#endif
|
||||
if (!result && exit_on_fail) {
|
||||
fprintf(stderr, "%s() not found: %s\n", name, error);
|
||||
abort();
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Checks whether we're using OpenGL or OpenGL ES
|
||||
*
|
||||
* @return `true` if we're using OpenGL
|
||||
*/
|
||||
bool
|
||||
epoxy_is_desktop_gl(void)
|
||||
{
|
||||
const char *es_prefix = "OpenGL ES";
|
||||
const char *version;
|
||||
|
||||
#if PLATFORM_HAS_EGL
|
||||
/* PowerVR's OpenGL ES implementation (and perhaps other) don't
|
||||
* comply with the standard, which states that
|
||||
* "glGetString(GL_VERSION)" should return a string starting with
|
||||
* "OpenGL ES". Therefore, to distinguish desktop OpenGL from
|
||||
* OpenGL ES, we must also check the context type through EGL (we
|
||||
* can do that as PowerVR is only usable through EGL).
|
||||
*/
|
||||
if (!epoxy_current_context_is_glx()) {
|
||||
switch (epoxy_egl_get_current_gl_context_api()) {
|
||||
case EGL_OPENGL_API: return true;
|
||||
case EGL_OPENGL_ES_API: return false;
|
||||
case EGL_NONE:
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (api.begin_count)
|
||||
return true;
|
||||
|
||||
version = (const char *)glGetString(GL_VERSION);
|
||||
|
||||
/* If we didn't get a version back, there are only two things that
|
||||
* could have happened: either malloc failure (which basically
|
||||
* doesn't exist), or we were called within a glBegin()/glEnd().
|
||||
* Assume the second, which only exists for desktop GL.
|
||||
*/
|
||||
if (!version)
|
||||
return true;
|
||||
|
||||
return strncmp(es_prefix, version, strlen(es_prefix));
|
||||
}
|
||||
|
||||
static int
|
||||
epoxy_internal_gl_version(GLenum version_string, int error_version, int factor)
|
||||
{
|
||||
const char *version = (const char *)glGetString(version_string);
|
||||
GLint major, minor;
|
||||
int scanf_count;
|
||||
|
||||
if (!version)
|
||||
return error_version;
|
||||
|
||||
/* skip to version number */
|
||||
while (!isdigit(*version) && *version != '\0')
|
||||
version++;
|
||||
|
||||
/* Interpret version number */
|
||||
scanf_count = sscanf(version, "%i.%i", &major, &minor);
|
||||
if (scanf_count != 2) {
|
||||
fprintf(stderr, "Unable to interpret GL_VERSION string: %s\n",
|
||||
version);
|
||||
abort();
|
||||
}
|
||||
|
||||
return factor * major + minor;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Returns the version of OpenGL we are using
|
||||
*
|
||||
* The version is encoded as:
|
||||
*
|
||||
* ```
|
||||
*
|
||||
* version = major * 10 + minor
|
||||
*
|
||||
* ```
|
||||
*
|
||||
* So it can be easily used for version comparisons.
|
||||
*
|
||||
* @return The encoded version of OpenGL we are using
|
||||
*/
|
||||
int
|
||||
epoxy_gl_version(void)
|
||||
{
|
||||
return epoxy_internal_gl_version(GL_VERSION, 0, 10);
|
||||
}
|
||||
|
||||
int
|
||||
epoxy_conservative_gl_version(void)
|
||||
{
|
||||
if (api.begin_count)
|
||||
return 100;
|
||||
|
||||
return epoxy_internal_gl_version(GL_VERSION, 100, 10);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Returns the version of the GL Shading Language we are using
|
||||
*
|
||||
* The version is encoded as:
|
||||
*
|
||||
* ```
|
||||
*
|
||||
* version = major * 100 + minor
|
||||
*
|
||||
* ```
|
||||
*
|
||||
* So it can be easily used for version comparisons.
|
||||
*
|
||||
* @return The encoded version of the GL Shading Language we are using
|
||||
*/
|
||||
int
|
||||
epoxy_glsl_version(void)
|
||||
{
|
||||
if (epoxy_gl_version() >= 20 ||
|
||||
epoxy_has_gl_extension ("GL_ARB_shading_language_100"))
|
||||
return epoxy_internal_gl_version(GL_SHADING_LANGUAGE_VERSION, 0, 100);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Checks for the presence of an extension in an OpenGL extension string
|
||||
*
|
||||
* @param extension_list The string containing the list of extensions to check
|
||||
* @param ext The name of the GL extension
|
||||
* @return `true` if the extension is available'
|
||||
*
|
||||
* @note If you are looking to check whether a normal GL, EGL or GLX extension
|
||||
* is supported by the client, this probably isn't the function you want.
|
||||
*
|
||||
* Some parts of the spec for OpenGL and friends will return an OpenGL formatted
|
||||
* extension string that is separate from the usual extension strings for the
|
||||
* spec. This function provides easy parsing of those strings.
|
||||
*
|
||||
* @see epoxy_has_gl_extension()
|
||||
* @see epoxy_has_egl_extension()
|
||||
* @see epoxy_has_glx_extension()
|
||||
*/
|
||||
bool
|
||||
epoxy_extension_in_string(const char *extension_list, const char *ext)
|
||||
{
|
||||
const char *ptr = extension_list;
|
||||
int len;
|
||||
|
||||
if (!ext)
|
||||
return false;
|
||||
|
||||
len = strlen(ext);
|
||||
|
||||
if (extension_list == NULL || *extension_list == '\0')
|
||||
return false;
|
||||
|
||||
/* Make sure that don't just find an extension with our name as a prefix. */
|
||||
while (true) {
|
||||
ptr = strstr(ptr, ext);
|
||||
if (!ptr)
|
||||
return false;
|
||||
|
||||
if (ptr[len] == ' ' || ptr[len] == 0)
|
||||
return true;
|
||||
ptr += len;
|
||||
}
|
||||
}
|
||||
|
||||
static bool
|
||||
epoxy_internal_has_gl_extension(const char *ext, bool invalid_op_mode)
|
||||
{
|
||||
if (epoxy_gl_version() < 30) {
|
||||
const char *exts = (const char *)glGetString(GL_EXTENSIONS);
|
||||
if (!exts)
|
||||
return invalid_op_mode;
|
||||
return epoxy_extension_in_string(exts, ext);
|
||||
} else {
|
||||
int num_extensions;
|
||||
int i;
|
||||
|
||||
glGetIntegerv(GL_NUM_EXTENSIONS, &num_extensions);
|
||||
if (num_extensions == 0)
|
||||
return invalid_op_mode;
|
||||
|
||||
for (i = 0; i < num_extensions; i++) {
|
||||
const char *gl_ext = (const char *)glGetStringi(GL_EXTENSIONS, i);
|
||||
if (!gl_ext)
|
||||
return false;
|
||||
if (strcmp(ext, gl_ext) == 0)
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
epoxy_load_glx(bool exit_if_fails, bool load)
|
||||
{
|
||||
#if PLATFORM_HAS_GLX
|
||||
# ifdef GLVND_GLX_LIB
|
||||
/* prefer the glvnd library if it exists */
|
||||
if (!api.glx_handle)
|
||||
get_dlopen_handle(&api.glx_handle, GLVND_GLX_LIB, false, load);
|
||||
# endif
|
||||
if (!api.glx_handle)
|
||||
get_dlopen_handle(&api.glx_handle, GLX_LIB, exit_if_fails, load);
|
||||
#endif
|
||||
return api.glx_handle != NULL;
|
||||
}
|
||||
|
||||
void *
|
||||
epoxy_conservative_glx_dlsym(const char *name, bool exit_if_fails)
|
||||
{
|
||||
#if PLATFORM_HAS_GLX
|
||||
if (epoxy_load_glx(exit_if_fails, exit_if_fails))
|
||||
return do_dlsym(&api.glx_handle, name, exit_if_fails);
|
||||
#endif
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests whether the currently bound context is EGL or GLX, trying to
|
||||
* avoid loading libraries unless necessary.
|
||||
*/
|
||||
static bool
|
||||
epoxy_current_context_is_glx(void)
|
||||
{
|
||||
#if !PLATFORM_HAS_GLX
|
||||
return false;
|
||||
#else
|
||||
void *sym;
|
||||
|
||||
sym = epoxy_conservative_glx_dlsym("glXGetCurrentContext", false);
|
||||
if (sym) {
|
||||
if (glXGetCurrentContext())
|
||||
return true;
|
||||
} else {
|
||||
(void)dlerror();
|
||||
}
|
||||
|
||||
#if PLATFORM_HAS_EGL
|
||||
sym = epoxy_conservative_egl_dlsym("eglGetCurrentContext", false);
|
||||
if (sym) {
|
||||
if (epoxy_egl_get_current_gl_context_api() != EGL_NONE)
|
||||
return false;
|
||||
} else {
|
||||
(void)dlerror();
|
||||
}
|
||||
#endif /* PLATFORM_HAS_EGL */
|
||||
|
||||
return false;
|
||||
#endif /* PLATFORM_HAS_GLX */
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Returns true if the given GL extension is supported in the current context.
|
||||
*
|
||||
* @param ext The name of the GL extension
|
||||
* @return `true` if the extension is available
|
||||
*
|
||||
* @note that this function can't be called from within `glBegin()` and `glEnd()`.
|
||||
*
|
||||
* @see epoxy_has_egl_extension()
|
||||
* @see epoxy_has_glx_extension()
|
||||
*/
|
||||
bool
|
||||
epoxy_has_gl_extension(const char *ext)
|
||||
{
|
||||
return epoxy_internal_has_gl_extension(ext, false);
|
||||
}
|
||||
|
||||
bool
|
||||
epoxy_conservative_has_gl_extension(const char *ext)
|
||||
{
|
||||
if (api.begin_count)
|
||||
return true;
|
||||
|
||||
return epoxy_internal_has_gl_extension(ext, true);
|
||||
}
|
||||
|
||||
bool
|
||||
epoxy_load_egl(bool exit_if_fails, bool load)
|
||||
{
|
||||
#if PLATFORM_HAS_EGL
|
||||
return get_dlopen_handle(&api.egl_handle, EGL_LIB, exit_if_fails, load);
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
void *
|
||||
epoxy_conservative_egl_dlsym(const char *name, bool exit_if_fails)
|
||||
{
|
||||
#if PLATFORM_HAS_EGL
|
||||
if (epoxy_load_egl(exit_if_fails, exit_if_fails))
|
||||
return do_dlsym(&api.egl_handle, name, exit_if_fails);
|
||||
#endif
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void *
|
||||
epoxy_egl_dlsym(const char *name)
|
||||
{
|
||||
return epoxy_conservative_egl_dlsym(name, true);
|
||||
}
|
||||
|
||||
void *
|
||||
epoxy_glx_dlsym(const char *name)
|
||||
{
|
||||
return epoxy_conservative_glx_dlsym(name, true);
|
||||
}
|
||||
|
||||
static void
|
||||
epoxy_load_gl(void)
|
||||
{
|
||||
if (api.gl_handle)
|
||||
return;
|
||||
|
||||
#if defined(_WIN32) || defined(__APPLE__)
|
||||
get_dlopen_handle(&api.gl_handle, OPENGL_LIB, true, true);
|
||||
#else
|
||||
|
||||
// Prefer GLX_LIB over OPENGL_LIB to maintain existing behavior.
|
||||
// Using the inverse ordering OPENGL_LIB -> GLX_LIB, causes issues such as:
|
||||
// https://github.com/anholt/libepoxy/issues/240 (apitrace missing calls)
|
||||
// https://github.com/anholt/libepoxy/issues/252 (Xorg boot crash)
|
||||
get_dlopen_handle(&api.glx_handle, GLX_LIB, false, true);
|
||||
api.gl_handle = api.glx_handle;
|
||||
|
||||
#if defined(OPENGL_LIB)
|
||||
if (!api.gl_handle)
|
||||
get_dlopen_handle(&api.gl_handle, OPENGL_LIB, false, true);
|
||||
#endif
|
||||
|
||||
if (!api.gl_handle) {
|
||||
#if defined(OPENGL_LIB)
|
||||
fprintf(stderr, "Couldn't open %s or %s\n", GLX_LIB, OPENGL_LIB);
|
||||
#else
|
||||
fprintf(stderr, "Couldn't open %s\n", GLX_LIB);
|
||||
#endif
|
||||
abort();
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
void *
|
||||
epoxy_gl_dlsym(const char *name)
|
||||
{
|
||||
epoxy_load_gl();
|
||||
|
||||
return do_dlsym(&api.gl_handle, name, true);
|
||||
}
|
||||
|
||||
void *
|
||||
epoxy_gles1_dlsym(const char *name)
|
||||
{
|
||||
if (epoxy_current_context_is_glx()) {
|
||||
return epoxy_get_proc_address(name);
|
||||
} else {
|
||||
get_dlopen_handle(&api.gles1_handle, GLES1_LIB, true, true);
|
||||
return do_dlsym(&api.gles1_handle, name, true);
|
||||
}
|
||||
}
|
||||
|
||||
void *
|
||||
epoxy_gles2_dlsym(const char *name)
|
||||
{
|
||||
if (epoxy_current_context_is_glx()) {
|
||||
return epoxy_get_proc_address(name);
|
||||
} else {
|
||||
get_dlopen_handle(&api.gles2_handle, GLES2_LIB, true, true);
|
||||
return do_dlsym(&api.gles2_handle, name, true);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Does the appropriate dlsym() or eglGetProcAddress() for GLES3
|
||||
* functions.
|
||||
*
|
||||
* Mesa interpreted GLES as intending that the GLES3 functions were
|
||||
* available only through eglGetProcAddress() and not dlsym(), while
|
||||
* ARM's Mali drivers interpreted GLES as intending that GLES3
|
||||
* functions were available only through dlsym() and not
|
||||
* eglGetProcAddress(). Thanks, Khronos.
|
||||
*/
|
||||
void *
|
||||
epoxy_gles3_dlsym(const char *name)
|
||||
{
|
||||
if (epoxy_current_context_is_glx()) {
|
||||
return epoxy_get_proc_address(name);
|
||||
} else {
|
||||
if (get_dlopen_handle(&api.gles2_handle, GLES2_LIB, false, true)) {
|
||||
void *func = do_dlsym(&api.gles2_handle, name, false);
|
||||
|
||||
if (func)
|
||||
return func;
|
||||
}
|
||||
|
||||
return epoxy_get_proc_address(name);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs either the dlsym or glXGetProcAddress()-equivalent for
|
||||
* core functions in desktop GL.
|
||||
*/
|
||||
void *
|
||||
epoxy_get_core_proc_address(const char *name, int core_version)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
int core_symbol_support = 11;
|
||||
#elif defined(__ANDROID__)
|
||||
/**
|
||||
* All symbols must be resolved through eglGetProcAddress
|
||||
* on Android
|
||||
*/
|
||||
int core_symbol_support = 0;
|
||||
#else
|
||||
int core_symbol_support = 12;
|
||||
#endif
|
||||
|
||||
if (core_version <= core_symbol_support) {
|
||||
return epoxy_gl_dlsym(name);
|
||||
} else {
|
||||
return epoxy_get_proc_address(name);
|
||||
}
|
||||
}
|
||||
|
||||
#if PLATFORM_HAS_EGL
|
||||
static EGLenum
|
||||
epoxy_egl_get_current_gl_context_api(void)
|
||||
{
|
||||
EGLint curapi;
|
||||
|
||||
if (eglQueryContext(eglGetCurrentDisplay(), eglGetCurrentContext(),
|
||||
EGL_CONTEXT_CLIENT_TYPE, &curapi) == EGL_FALSE) {
|
||||
(void)eglGetError();
|
||||
return EGL_NONE;
|
||||
}
|
||||
|
||||
return (EGLenum) curapi;
|
||||
}
|
||||
#endif /* PLATFORM_HAS_EGL */
|
||||
|
||||
/**
|
||||
* Performs the dlsym() for the core GL 1.0 functions that we use for
|
||||
* determining version and extension support for deciding on dlsym
|
||||
* versus glXGetProcAddress() for all other functions.
|
||||
*
|
||||
* This needs to succeed on implementations without GLX (since
|
||||
* glGetString() and glGetIntegerv() are both in GLES1/2 as well, and
|
||||
* at call time we don't know for sure what API they're trying to use
|
||||
* without inspecting contexts ourselves).
|
||||
*/
|
||||
void *
|
||||
epoxy_get_bootstrap_proc_address(const char *name)
|
||||
{
|
||||
/* If we already have a library that links to libglapi loaded,
|
||||
* use that.
|
||||
*/
|
||||
#if PLATFORM_HAS_GLX
|
||||
if (api.glx_handle && glXGetCurrentContext())
|
||||
return epoxy_gl_dlsym(name);
|
||||
#endif
|
||||
|
||||
/* If epoxy hasn't loaded any API-specific library yet, try to
|
||||
* figure out what API the context is using and use that library,
|
||||
* since future calls will also use that API (this prevents a
|
||||
* non-X11 ES2 context from loading a bunch of X11 junk).
|
||||
*/
|
||||
#if PLATFORM_HAS_EGL
|
||||
get_dlopen_handle(&api.egl_handle, EGL_LIB, false, true);
|
||||
if (api.egl_handle) {
|
||||
int version = 0;
|
||||
switch (epoxy_egl_get_current_gl_context_api()) {
|
||||
case EGL_OPENGL_API:
|
||||
return epoxy_gl_dlsym(name);
|
||||
case EGL_OPENGL_ES_API:
|
||||
if (eglQueryContext(eglGetCurrentDisplay(),
|
||||
eglGetCurrentContext(),
|
||||
EGL_CONTEXT_CLIENT_VERSION,
|
||||
&version)) {
|
||||
if (version >= 2)
|
||||
return epoxy_gles2_dlsym(name);
|
||||
else
|
||||
return epoxy_gles1_dlsym(name);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif /* PLATFORM_HAS_EGL */
|
||||
|
||||
/* Fall back to GLX */
|
||||
return epoxy_gl_dlsym(name);
|
||||
}
|
||||
|
||||
void *
|
||||
epoxy_get_proc_address(const char *name)
|
||||
{
|
||||
#if PLATFORM_HAS_EGL
|
||||
GLenum egl_api = EGL_NONE;
|
||||
|
||||
if (!epoxy_current_context_is_glx())
|
||||
egl_api = epoxy_egl_get_current_gl_context_api();
|
||||
|
||||
switch (egl_api) {
|
||||
case EGL_OPENGL_API:
|
||||
case EGL_OPENGL_ES_API:
|
||||
return eglGetProcAddress(name);
|
||||
case EGL_NONE:
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(_WIN32)
|
||||
return wglGetProcAddress(name);
|
||||
#elif defined(__APPLE__)
|
||||
return epoxy_gl_dlsym(name);
|
||||
#elif PLATFORM_HAS_GLX
|
||||
if (epoxy_current_context_is_glx())
|
||||
return glXGetProcAddressARB((const GLubyte *)name);
|
||||
assert(0 && "Couldn't find current GLX or EGL context.\n");
|
||||
#endif
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
WRAPPER_VISIBILITY (void)
|
||||
WRAPPER(epoxy_glBegin)(GLenum primtype)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
InterlockedIncrement(&api.begin_count);
|
||||
#else
|
||||
pthread_mutex_lock(&api.mutex);
|
||||
api.begin_count++;
|
||||
pthread_mutex_unlock(&api.mutex);
|
||||
#endif
|
||||
|
||||
epoxy_glBegin_unwrapped(primtype);
|
||||
}
|
||||
|
||||
WRAPPER_VISIBILITY (void)
|
||||
WRAPPER(epoxy_glEnd)(void)
|
||||
{
|
||||
epoxy_glEnd_unwrapped();
|
||||
|
||||
#ifdef _WIN32
|
||||
InterlockedDecrement(&api.begin_count);
|
||||
#else
|
||||
pthread_mutex_lock(&api.mutex);
|
||||
api.begin_count--;
|
||||
pthread_mutex_unlock(&api.mutex);
|
||||
#endif
|
||||
}
|
||||
|
||||
PFNGLBEGINPROC epoxy_glBegin = epoxy_glBegin_wrapped;
|
||||
PFNGLENDPROC epoxy_glEnd = epoxy_glEnd_wrapped;
|
||||
|
||||
epoxy_resolver_failure_handler_t epoxy_resolver_failure_handler;
|
||||
|
||||
/**
|
||||
* Sets the function that will be called every time Epoxy fails to
|
||||
* resolve a symbol.
|
||||
*
|
||||
* @param handler The new handler function
|
||||
* @return The previous handler function
|
||||
*/
|
||||
epoxy_resolver_failure_handler_t
|
||||
epoxy_set_resolver_failure_handler(epoxy_resolver_failure_handler_t handler)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
return InterlockedExchangePointer((void**)&epoxy_resolver_failure_handler,
|
||||
handler);
|
||||
#else
|
||||
epoxy_resolver_failure_handler_t old;
|
||||
pthread_mutex_lock(&api.mutex);
|
||||
old = epoxy_resolver_failure_handler;
|
||||
epoxy_resolver_failure_handler = handler;
|
||||
pthread_mutex_unlock(&api.mutex);
|
||||
return old;
|
||||
#endif
|
||||
}
|
||||
@@ -1,206 +0,0 @@
|
||||
/*
|
||||
* Copyright © 2013 Intel Corporation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
* IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
#define PLATFORM_HAS_EGL ENABLE_EGL
|
||||
#define PLATFORM_HAS_GLX ENABLE_GLX
|
||||
#define PLATFORM_HAS_WGL 1
|
||||
#elif defined(__APPLE__)
|
||||
#define PLATFORM_HAS_EGL 0
|
||||
#define PLATFORM_HAS_GLX ENABLE_GLX
|
||||
#define PLATFORM_HAS_WGL 0
|
||||
#elif defined(ANDROID)
|
||||
#define PLATFORM_HAS_EGL ENABLE_EGL
|
||||
#define PLATFORM_HAS_GLX 0
|
||||
#define PLATFORM_HAS_WGL 0
|
||||
#else
|
||||
#define PLATFORM_HAS_EGL ENABLE_EGL
|
||||
#define PLATFORM_HAS_GLX ENABLE_GLX
|
||||
#define PLATFORM_HAS_WGL 0
|
||||
#endif
|
||||
|
||||
#include "epoxy/gl.h"
|
||||
#if PLATFORM_HAS_GLX
|
||||
#include "epoxy/glx.h"
|
||||
#endif
|
||||
#if PLATFORM_HAS_EGL
|
||||
# if !ENABLE_X11
|
||||
/* Disable including X11 headers if the X11 support was disabled at
|
||||
* configuration time
|
||||
*/
|
||||
# define EGL_NO_X11 1
|
||||
/* Older versions of Mesa use this symbol to achieve the same result
|
||||
* as EGL_NO_X11
|
||||
*/
|
||||
# define MESA_EGL_NO_X11_HEADERS 1
|
||||
# endif
|
||||
#include "epoxy/egl.h"
|
||||
#endif
|
||||
#if PLATFORM_HAS_WGL
|
||||
#include "epoxy/wgl.h"
|
||||
#endif
|
||||
|
||||
#if defined(__GNUC__)
|
||||
#define PACKED __attribute__((__packed__))
|
||||
#define ENDPACKED
|
||||
#elif defined (_MSC_VER)
|
||||
#define PACKED __pragma(pack(push,1))
|
||||
#define ENDPACKED __pragma(pack(pop))
|
||||
#else
|
||||
#define PACKED
|
||||
#define ENDPACKED
|
||||
#endif
|
||||
|
||||
/* On win32, we're going to need to keep a per-thread dispatch table,
|
||||
* since the function pointers depend on the device and pixel format
|
||||
* of the current context.
|
||||
*/
|
||||
#if defined(_WIN32)
|
||||
#define USING_DISPATCH_TABLE 1
|
||||
#else
|
||||
#define USING_DISPATCH_TABLE 0
|
||||
#endif
|
||||
|
||||
#define UNWRAPPED_PROTO(x) (GLAPIENTRY *x)
|
||||
#define WRAPPER_VISIBILITY(type) static type GLAPIENTRY
|
||||
#define WRAPPER(x) x ## _wrapped
|
||||
|
||||
#define GEN_GLOBAL_REWRITE_PTR(name, args, passthrough) \
|
||||
static void EPOXY_CALLSPEC \
|
||||
name##_global_rewrite_ptr args \
|
||||
{ \
|
||||
if (name == (void *)name##_global_rewrite_ptr) \
|
||||
name = (void *)name##_resolver(); \
|
||||
name passthrough; \
|
||||
}
|
||||
|
||||
#define GEN_GLOBAL_REWRITE_PTR_RET(ret, name, args, passthrough) \
|
||||
static ret EPOXY_CALLSPEC \
|
||||
name##_global_rewrite_ptr args \
|
||||
{ \
|
||||
if (name == (void *)name##_global_rewrite_ptr) \
|
||||
name = (void *)name##_resolver(); \
|
||||
return name passthrough; \
|
||||
}
|
||||
|
||||
#if USING_DISPATCH_TABLE
|
||||
#define GEN_DISPATCH_TABLE_REWRITE_PTR(name, args, passthrough) \
|
||||
static void EPOXY_CALLSPEC \
|
||||
name##_dispatch_table_rewrite_ptr args \
|
||||
{ \
|
||||
struct dispatch_table *dispatch_table = get_dispatch_table(); \
|
||||
\
|
||||
dispatch_table->name = (void *)name##_resolver(); \
|
||||
dispatch_table->name passthrough; \
|
||||
}
|
||||
|
||||
#define GEN_DISPATCH_TABLE_REWRITE_PTR_RET(ret, name, args, passthrough) \
|
||||
static ret EPOXY_CALLSPEC \
|
||||
name##_dispatch_table_rewrite_ptr args \
|
||||
{ \
|
||||
struct dispatch_table *dispatch_table = get_dispatch_table(); \
|
||||
\
|
||||
dispatch_table->name = (void *)name##_resolver(); \
|
||||
return dispatch_table->name passthrough; \
|
||||
}
|
||||
|
||||
#define GEN_DISPATCH_TABLE_THUNK(name, args, passthrough) \
|
||||
static void EPOXY_CALLSPEC \
|
||||
name##_dispatch_table_thunk args \
|
||||
{ \
|
||||
get_dispatch_table()->name passthrough; \
|
||||
}
|
||||
|
||||
#define GEN_DISPATCH_TABLE_THUNK_RET(ret, name, args, passthrough) \
|
||||
static ret EPOXY_CALLSPEC \
|
||||
name##_dispatch_table_thunk args \
|
||||
{ \
|
||||
return get_dispatch_table()->name passthrough; \
|
||||
}
|
||||
|
||||
#else
|
||||
#define GEN_DISPATCH_TABLE_REWRITE_PTR(name, args, passthrough)
|
||||
#define GEN_DISPATCH_TABLE_REWRITE_PTR_RET(ret, name, args, passthrough)
|
||||
#define GEN_DISPATCH_TABLE_THUNK(name, args, passthrough)
|
||||
#define GEN_DISPATCH_TABLE_THUNK_RET(ret, name, args, passthrough)
|
||||
#endif
|
||||
|
||||
#define GEN_THUNKS(name, args, passthrough) \
|
||||
GEN_GLOBAL_REWRITE_PTR(name, args, passthrough) \
|
||||
GEN_DISPATCH_TABLE_REWRITE_PTR(name, args, passthrough) \
|
||||
GEN_DISPATCH_TABLE_THUNK(name, args, passthrough)
|
||||
|
||||
#define GEN_THUNKS_RET(ret, name, args, passthrough) \
|
||||
GEN_GLOBAL_REWRITE_PTR_RET(ret, name, args, passthrough) \
|
||||
GEN_DISPATCH_TABLE_REWRITE_PTR_RET(ret, name, args, passthrough) \
|
||||
GEN_DISPATCH_TABLE_THUNK_RET(ret, name, args, passthrough)
|
||||
|
||||
void *epoxy_egl_dlsym(const char *name);
|
||||
void *epoxy_glx_dlsym(const char *name);
|
||||
void *epoxy_gl_dlsym(const char *name);
|
||||
void *epoxy_gles1_dlsym(const char *name);
|
||||
void *epoxy_gles2_dlsym(const char *name);
|
||||
void *epoxy_gles3_dlsym(const char *name);
|
||||
void *epoxy_get_proc_address(const char *name);
|
||||
void *epoxy_get_core_proc_address(const char *name, int core_version);
|
||||
void *epoxy_get_bootstrap_proc_address(const char *name);
|
||||
|
||||
int epoxy_conservative_gl_version(void);
|
||||
bool epoxy_conservative_has_gl_extension(const char *name);
|
||||
int epoxy_conservative_glx_version(void);
|
||||
bool epoxy_conservative_has_glx_extension(const char *name);
|
||||
int epoxy_conservative_egl_version(void);
|
||||
bool epoxy_conservative_has_egl_extension(const char *name);
|
||||
bool epoxy_conservative_has_wgl_extension(const char *name);
|
||||
void *epoxy_conservative_egl_dlsym(const char *name, bool exit_if_fails);
|
||||
void *epoxy_conservative_glx_dlsym(const char *name, bool exit_if_fails);
|
||||
|
||||
bool epoxy_load_glx(bool exit_if_fails, bool load);
|
||||
bool epoxy_load_egl(bool exit_if_fails, bool load);
|
||||
|
||||
#define glBegin_unwrapped epoxy_glBegin_unwrapped
|
||||
#define glEnd_unwrapped epoxy_glEnd_unwrapped
|
||||
extern void UNWRAPPED_PROTO(glBegin_unwrapped)(GLenum primtype);
|
||||
extern void UNWRAPPED_PROTO(glEnd_unwrapped)(void);
|
||||
|
||||
extern epoxy_resolver_failure_handler_t epoxy_resolver_failure_handler;
|
||||
|
||||
#if USING_DISPATCH_TABLE
|
||||
void gl_init_dispatch_table(void);
|
||||
void gl_switch_to_dispatch_table(void);
|
||||
void wgl_init_dispatch_table(void);
|
||||
void wgl_switch_to_dispatch_table(void);
|
||||
extern uint32_t gl_tls_index, gl_tls_size;
|
||||
extern uint32_t wgl_tls_index, wgl_tls_size;
|
||||
|
||||
#define wglMakeCurrent_unwrapped epoxy_wglMakeCurrent_unwrapped
|
||||
#define wglMakeContextCurrentARB_unwrapped epoxy_wglMakeContextCurrentARB_unwrapped
|
||||
#define wglMakeContextCurrentEXT_unwrapped epoxy_wglMakeContextCurrentEXT_unwrapped
|
||||
#define wglMakeAssociatedContextCurrentAMD_unwrapped epoxy_wglMakeAssociatedContextCurrentAMD_unwrapped
|
||||
extern BOOL UNWRAPPED_PROTO(wglMakeCurrent_unwrapped)(HDC hdc, HGLRC hglrc);
|
||||
extern BOOL UNWRAPPED_PROTO(wglMakeContextCurrentARB_unwrapped)(HDC hDrawDC, HDC hReadDC, HGLRC hglrc);
|
||||
extern BOOL UNWRAPPED_PROTO(wglMakeContextCurrentEXT_unwrapped)(HDC hDrawDC, HDC hReadDC, HGLRC hglrc);
|
||||
extern BOOL UNWRAPPED_PROTO(wglMakeAssociatedContextCurrentAMD_unwrapped)(HGLRC hglrc);
|
||||
#endif /* _WIN32_ */
|
||||
@@ -1,122 +0,0 @@
|
||||
/*
|
||||
* Copyright © 2013 Intel Corporation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
* IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "dispatch_common.h"
|
||||
|
||||
int
|
||||
epoxy_conservative_egl_version(void)
|
||||
{
|
||||
EGLDisplay dpy = eglGetCurrentDisplay();
|
||||
|
||||
if (!dpy)
|
||||
return 14;
|
||||
|
||||
return epoxy_egl_version(dpy);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Returns the version of OpenGL we are using
|
||||
*
|
||||
* The version is encoded as:
|
||||
*
|
||||
* ```
|
||||
*
|
||||
* version = major * 10 + minor
|
||||
*
|
||||
* ```
|
||||
*
|
||||
* So it can be easily used for version comparisons.
|
||||
*
|
||||
* @param The EGL display
|
||||
*
|
||||
* @return The encoded version of EGL we are using
|
||||
*
|
||||
* @see epoxy_gl_version()
|
||||
*/
|
||||
int
|
||||
epoxy_egl_version(EGLDisplay dpy)
|
||||
{
|
||||
int major, minor;
|
||||
const char *version_string;
|
||||
int ret;
|
||||
|
||||
version_string = eglQueryString(dpy, EGL_VERSION);
|
||||
if (!version_string)
|
||||
return 0;
|
||||
|
||||
ret = sscanf(version_string, "%d.%d", &major, &minor);
|
||||
assert(ret == 2);
|
||||
return major * 10 + minor;
|
||||
}
|
||||
|
||||
bool
|
||||
epoxy_conservative_has_egl_extension(const char *ext)
|
||||
{
|
||||
return epoxy_has_egl_extension(eglGetCurrentDisplay(), ext);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Returns true if the given EGL extension is supported in the current context.
|
||||
*
|
||||
* @param dpy The EGL display
|
||||
* @param extension The name of the EGL extension
|
||||
*
|
||||
* @return `true` if the extension is available
|
||||
*
|
||||
* @see epoxy_has_gl_extension()
|
||||
* @see epoxy_has_glx_extension()
|
||||
*/
|
||||
bool
|
||||
epoxy_has_egl_extension(EGLDisplay dpy, const char *ext)
|
||||
{
|
||||
return epoxy_extension_in_string(eglQueryString(dpy, EGL_EXTENSIONS), ext) || epoxy_extension_in_string(eglQueryString(NULL, EGL_EXTENSIONS), ext);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Checks whether EGL is available.
|
||||
*
|
||||
* @return `true` if EGL is available
|
||||
*
|
||||
* @newin{1,4}
|
||||
*/
|
||||
bool
|
||||
epoxy_has_egl(void)
|
||||
{
|
||||
#if !PLATFORM_HAS_EGL
|
||||
return false;
|
||||
#else
|
||||
if (epoxy_load_egl(false, true)) {
|
||||
EGLDisplay* (* pf_eglGetCurrentDisplay) (void);
|
||||
|
||||
pf_eglGetCurrentDisplay = epoxy_conservative_egl_dlsym("eglGetCurrentDisplay", false);
|
||||
if (pf_eglGetCurrentDisplay)
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
#endif /* PLATFORM_HAS_EGL */
|
||||
}
|
||||
@@ -1,172 +0,0 @@
|
||||
/*
|
||||
* Copyright © 2013 Intel Corporation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
* IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "dispatch_common.h"
|
||||
|
||||
/**
|
||||
* If we can determine the GLX version from the current context, then
|
||||
* return that, otherwise return a version that will just send us on
|
||||
* to dlsym() or get_proc_address().
|
||||
*/
|
||||
int
|
||||
epoxy_conservative_glx_version(void)
|
||||
{
|
||||
Display *dpy = glXGetCurrentDisplay();
|
||||
GLXContext ctx = glXGetCurrentContext();
|
||||
int screen;
|
||||
|
||||
if (!dpy || !ctx)
|
||||
return 14;
|
||||
|
||||
glXQueryContext(dpy, ctx, GLX_SCREEN, &screen);
|
||||
|
||||
return epoxy_glx_version(dpy, screen);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Returns the version of GLX we are using
|
||||
*
|
||||
* The version is encoded as:
|
||||
*
|
||||
* ```
|
||||
*
|
||||
* version = major * 10 + minor
|
||||
*
|
||||
* ```
|
||||
*
|
||||
* So it can be easily used for version comparisons.
|
||||
*
|
||||
* @param dpy The X11 display
|
||||
* @param screen The X11 screen
|
||||
*
|
||||
* @return The encoded version of GLX we are using
|
||||
*
|
||||
* @see epoxy_gl_version()
|
||||
*/
|
||||
int
|
||||
epoxy_glx_version(Display *dpy, int screen)
|
||||
{
|
||||
int server_major, server_minor;
|
||||
int client_major, client_minor;
|
||||
int server, client;
|
||||
const char *version_string;
|
||||
int ret;
|
||||
|
||||
version_string = glXQueryServerString(dpy, screen, GLX_VERSION);
|
||||
if (!version_string)
|
||||
return 0;
|
||||
|
||||
ret = sscanf(version_string, "%d.%d", &server_major, &server_minor);
|
||||
assert(ret == 2);
|
||||
server = server_major * 10 + server_minor;
|
||||
|
||||
version_string = glXGetClientString(dpy, GLX_VERSION);
|
||||
if (!version_string)
|
||||
return 0;
|
||||
|
||||
ret = sscanf(version_string, "%d.%d", &client_major, &client_minor);
|
||||
assert(ret == 2);
|
||||
client = client_major * 10 + client_minor;
|
||||
|
||||
if (client < server)
|
||||
return client;
|
||||
else
|
||||
return server;
|
||||
}
|
||||
|
||||
/**
|
||||
* If we can determine the GLX extension support from the current
|
||||
* context, then return that, otherwise give the answer that will just
|
||||
* send us on to get_proc_address().
|
||||
*/
|
||||
bool
|
||||
epoxy_conservative_has_glx_extension(const char *ext)
|
||||
{
|
||||
Display *dpy = glXGetCurrentDisplay();
|
||||
GLXContext ctx = glXGetCurrentContext();
|
||||
int screen;
|
||||
|
||||
if (!dpy || !ctx)
|
||||
return true;
|
||||
|
||||
glXQueryContext(dpy, ctx, GLX_SCREEN, &screen);
|
||||
|
||||
return epoxy_has_glx_extension(dpy, screen, ext);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Returns true if the given GLX extension is supported in the current context.
|
||||
*
|
||||
* @param dpy The X11 display
|
||||
* @param screen The X11 screen
|
||||
* @param extension The name of the GLX extension
|
||||
*
|
||||
* @return `true` if the extension is available
|
||||
*
|
||||
* @see epoxy_has_gl_extension()
|
||||
* @see epoxy_has_egl_extension()
|
||||
*/
|
||||
bool
|
||||
epoxy_has_glx_extension(Display *dpy, int screen, const char *ext)
|
||||
{
|
||||
/* No, you can't just use glXGetClientString or
|
||||
* glXGetServerString() here. Those each tell you about one half
|
||||
* of what's needed for an extension to be supported, and
|
||||
* glXQueryExtensionsString() is what gives you the intersection
|
||||
* of the two.
|
||||
*/
|
||||
return epoxy_extension_in_string(glXQueryExtensionsString(dpy, screen), ext);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Checks whether GLX is available.
|
||||
*
|
||||
* @param dpy The X11 display
|
||||
*
|
||||
* @return `true` if GLX is available
|
||||
*
|
||||
* @newin{1,4}
|
||||
*/
|
||||
bool
|
||||
epoxy_has_glx(Display *dpy)
|
||||
{
|
||||
#if !PLATFORM_HAS_GLX
|
||||
return false;
|
||||
#else
|
||||
if (epoxy_load_glx(false, true)) {
|
||||
Bool (* pf_glXQueryExtension) (Display *, int *, int *);
|
||||
int error_base, event_base;
|
||||
|
||||
pf_glXQueryExtension = epoxy_conservative_glx_dlsym("glXQueryExtension", false);
|
||||
if (pf_glXQueryExtension && pf_glXQueryExtension(dpy, &error_base, &event_base))
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
#endif /* !PLATFORM_HAS_GLX */
|
||||
}
|
||||
@@ -1,196 +0,0 @@
|
||||
/*
|
||||
* Copyright © 2013 Intel Corporation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
* IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "dispatch_common.h"
|
||||
|
||||
static bool first_context_current = false;
|
||||
static bool already_switched_to_dispatch_table = false;
|
||||
|
||||
/**
|
||||
* If we can determine the WGL extension support from the current
|
||||
* context, then return that, otherwise give the answer that will just
|
||||
* send us on to get_proc_address().
|
||||
*/
|
||||
bool
|
||||
epoxy_conservative_has_wgl_extension(const char *ext)
|
||||
{
|
||||
HDC hdc = wglGetCurrentDC();
|
||||
|
||||
if (!hdc)
|
||||
return true;
|
||||
|
||||
return epoxy_has_wgl_extension(hdc, ext);
|
||||
}
|
||||
|
||||
bool
|
||||
epoxy_has_wgl_extension(HDC hdc, const char *ext)
|
||||
{
|
||||
PFNWGLGETEXTENSIONSSTRINGARBPROC getext;
|
||||
|
||||
getext = (void *)wglGetProcAddress("wglGetExtensionsStringARB");
|
||||
if (!getext) {
|
||||
fputs("Implementation unexpectedly missing "
|
||||
"WGL_ARB_extensions_string. Probably a libepoxy bug.\n",
|
||||
stderr);
|
||||
return false;
|
||||
}
|
||||
|
||||
return epoxy_extension_in_string(getext(hdc), ext);
|
||||
}
|
||||
|
||||
/**
|
||||
* Does the work necessary to update the win32 per-thread dispatch
|
||||
* tables when wglMakeCurrent() is called.
|
||||
*
|
||||
* Right now, we use global function pointers until the second
|
||||
* MakeCurrent occurs, at which point we switch to dispatch tables.
|
||||
* This could be improved in the future to track a resolved dispatch
|
||||
* table per context and reuse it when the context is made current
|
||||
* again.
|
||||
*/
|
||||
void
|
||||
epoxy_handle_external_wglMakeCurrent(void)
|
||||
{
|
||||
if (!first_context_current) {
|
||||
first_context_current = true;
|
||||
} else {
|
||||
if (!already_switched_to_dispatch_table) {
|
||||
already_switched_to_dispatch_table = true;
|
||||
gl_switch_to_dispatch_table();
|
||||
wgl_switch_to_dispatch_table();
|
||||
}
|
||||
|
||||
gl_init_dispatch_table();
|
||||
wgl_init_dispatch_table();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This global symbol is apparently looked up by Windows when loading
|
||||
* a DLL, but it doesn't declare the prototype.
|
||||
*/
|
||||
BOOL WINAPI
|
||||
DllMain(HINSTANCE dll, DWORD reason, LPVOID reserved);
|
||||
|
||||
BOOL WINAPI
|
||||
DllMain(HINSTANCE dll, DWORD reason, LPVOID reserved)
|
||||
{
|
||||
void *data;
|
||||
|
||||
switch (reason) {
|
||||
case DLL_PROCESS_ATTACH:
|
||||
gl_tls_index = TlsAlloc();
|
||||
if (gl_tls_index == TLS_OUT_OF_INDEXES)
|
||||
return FALSE;
|
||||
wgl_tls_index = TlsAlloc();
|
||||
if (wgl_tls_index == TLS_OUT_OF_INDEXES)
|
||||
return FALSE;
|
||||
|
||||
first_context_current = false;
|
||||
|
||||
/* FALLTHROUGH */
|
||||
|
||||
case DLL_THREAD_ATTACH:
|
||||
data = LocalAlloc(LPTR, gl_tls_size);
|
||||
TlsSetValue(gl_tls_index, data);
|
||||
|
||||
data = LocalAlloc(LPTR, wgl_tls_size);
|
||||
TlsSetValue(wgl_tls_index, data);
|
||||
|
||||
break;
|
||||
|
||||
case DLL_THREAD_DETACH:
|
||||
case DLL_PROCESS_DETACH:
|
||||
data = TlsGetValue(gl_tls_index);
|
||||
LocalFree(data);
|
||||
|
||||
data = TlsGetValue(wgl_tls_index);
|
||||
LocalFree(data);
|
||||
|
||||
if (reason == DLL_PROCESS_DETACH) {
|
||||
TlsFree(gl_tls_index);
|
||||
TlsFree(wgl_tls_index);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
WRAPPER_VISIBILITY (BOOL)
|
||||
WRAPPER(epoxy_wglMakeCurrent)(HDC hdc, HGLRC hglrc)
|
||||
{
|
||||
BOOL ret = epoxy_wglMakeCurrent_unwrapped(hdc, hglrc);
|
||||
|
||||
epoxy_handle_external_wglMakeCurrent();
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
WRAPPER_VISIBILITY (BOOL)
|
||||
WRAPPER(epoxy_wglMakeContextCurrentARB)(HDC hDrawDC,
|
||||
HDC hReadDC,
|
||||
HGLRC hglrc)
|
||||
{
|
||||
BOOL ret = epoxy_wglMakeContextCurrentARB_unwrapped(hDrawDC, hReadDC,
|
||||
hglrc);
|
||||
|
||||
epoxy_handle_external_wglMakeCurrent();
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
WRAPPER_VISIBILITY (BOOL)
|
||||
WRAPPER(epoxy_wglMakeContextCurrentEXT)(HDC hDrawDC,
|
||||
HDC hReadDC,
|
||||
HGLRC hglrc)
|
||||
{
|
||||
BOOL ret = epoxy_wglMakeContextCurrentEXT_unwrapped(hDrawDC, hReadDC,
|
||||
hglrc);
|
||||
|
||||
epoxy_handle_external_wglMakeCurrent();
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
WRAPPER_VISIBILITY (BOOL)
|
||||
WRAPPER(epoxy_wglMakeAssociatedContextCurrentAMD)(HGLRC hglrc)
|
||||
{
|
||||
BOOL ret = epoxy_wglMakeAssociatedContextCurrentAMD_unwrapped(hglrc);
|
||||
|
||||
epoxy_handle_external_wglMakeCurrent();
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
PFNWGLMAKECURRENTPROC epoxy_wglMakeCurrent = epoxy_wglMakeCurrent_wrapped;
|
||||
PFNWGLMAKECONTEXTCURRENTEXTPROC epoxy_wglMakeContextCurrentEXT = epoxy_wglMakeContextCurrentEXT_wrapped;
|
||||
PFNWGLMAKECONTEXTCURRENTARBPROC epoxy_wglMakeContextCurrentARB = epoxy_wglMakeContextCurrentARB_wrapped;
|
||||
PFNWGLMAKEASSOCIATEDCONTEXTCURRENTAMDPROC epoxy_wglMakeAssociatedContextCurrentEXT = epoxy_wglMakeAssociatedContextCurrentAMD_wrapped;
|
||||
@@ -1,932 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Copyright © 2013 Intel Corporation
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a
|
||||
# copy of this software and associated documentation files (the "Software"),
|
||||
# to deal in the Software without restriction, including without limitation
|
||||
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
# and/or sell copies of the Software, and to permit persons to whom the
|
||||
# Software is furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice (including the next
|
||||
# paragraph) shall be included in all copies or substantial portions of the
|
||||
# Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
# IN THE SOFTWARE.
|
||||
|
||||
import sys
|
||||
import argparse
|
||||
import xml.etree.ElementTree as ET
|
||||
import re
|
||||
import os
|
||||
|
||||
class GLProvider(object):
|
||||
def __init__(self, condition, condition_name, loader, name):
|
||||
# C code for determining if this function is available.
|
||||
# (e.g. epoxy_is_desktop_gl() && epoxy_gl_version() >= 20
|
||||
self.condition = condition
|
||||
|
||||
# A string (possibly with spaces) describing the condition.
|
||||
self.condition_name = condition_name
|
||||
|
||||
# The loader for getting the symbol -- either dlsym or
|
||||
# getprocaddress. This is a python format string to generate
|
||||
# C code, given self.name.
|
||||
self.loader = loader
|
||||
|
||||
# The name of the function to be loaded (possibly an
|
||||
# ARB/EXT/whatever-decorated variant).
|
||||
self.name = name
|
||||
|
||||
# This is the C enum name we'll use for referring to this provider.
|
||||
self.enum = condition_name
|
||||
self.enum = self.enum.replace(' ', '_')
|
||||
self.enum = self.enum.replace('\\"', '')
|
||||
self.enum = self.enum.replace('.', '_')
|
||||
self.enum = "PROVIDER_" + self.enum
|
||||
|
||||
class GLFunction(object):
|
||||
def __init__(self, ret_type, name):
|
||||
self.name = name
|
||||
self.ptr_type = 'PFN' + name.upper() + 'PROC'
|
||||
self.ret_type = ret_type
|
||||
self.providers = {}
|
||||
self.args = []
|
||||
|
||||
# These are functions with hand-written wrapper code in
|
||||
# dispatch_common.c. Their dispatch entries are replaced with
|
||||
# non-public symbols with a "_unwrapped" suffix.
|
||||
wrapped_functions = {
|
||||
'glBegin',
|
||||
'glEnd',
|
||||
'wglMakeCurrent',
|
||||
'wglMakeContextCurrentEXT',
|
||||
'wglMakeContextCurrentARB',
|
||||
'wglMakeAssociatedContextCurrentAMD',
|
||||
}
|
||||
|
||||
if name in wrapped_functions:
|
||||
self.wrapped_name = name + '_unwrapped'
|
||||
self.public = ''
|
||||
else:
|
||||
self.wrapped_name = name
|
||||
self.public = 'EPOXY_PUBLIC '
|
||||
|
||||
# This is the string of C code for passing through the
|
||||
# arguments to the function.
|
||||
self.args_list = ''
|
||||
|
||||
# This is the string of C code for declaring the arguments
|
||||
# list.
|
||||
self.args_decl = 'void'
|
||||
|
||||
# This is the string name of the function that this is an
|
||||
# alias of, or self.name. This initially comes from the
|
||||
# registry, and may get updated if it turns out our alias is
|
||||
# itself an alias (for example glFramebufferTextureEXT ->
|
||||
# glFramebufferTextureARB -> glFramebufferTexture)
|
||||
self.alias_name = name
|
||||
|
||||
# After alias resolution, this is the function that this is an
|
||||
# alias of.
|
||||
self.alias_func = None
|
||||
|
||||
# For the root of an alias tree, this lists the functions that
|
||||
# are marked as aliases of it, so that it can write a resolver
|
||||
# for all of them.
|
||||
self.alias_exts = []
|
||||
|
||||
def add_arg(self, arg_type, arg_name):
|
||||
# Reword glDepthRange() arguments to avoid clashing with the
|
||||
# "near" and "far" keywords on win32.
|
||||
if arg_name == "near":
|
||||
arg_name = "hither"
|
||||
elif arg_name == "far":
|
||||
arg_name = "yon"
|
||||
|
||||
# Mac screwed up GLhandleARB and made it a void * instead of
|
||||
# uint32_t, despite it being specced as only necessarily 32
|
||||
# bits wide, causing portability problems all over. There are
|
||||
# prototype conflicts between things like
|
||||
# glAttachShader(GLuint program, GLuint shader) and
|
||||
# glAttachObjectARB(GLhandleARB container, GLhandleARB obj),
|
||||
# even though they are marked as aliases in the XML (and being
|
||||
# aliases in Mesa).
|
||||
#
|
||||
# We retain those aliases. In the x86_64 ABI, the first 6
|
||||
# args are stored in 64-bit registers, so the calls end up
|
||||
# being the same despite the different types. We just need to
|
||||
# add a cast to uintptr_t to shut up the compiler.
|
||||
if arg_type == 'GLhandleARB':
|
||||
assert len(self.args) < 6
|
||||
arg_list_name = '(uintptr_t)' + arg_name
|
||||
else:
|
||||
arg_list_name = arg_name
|
||||
|
||||
self.args.append((arg_type, arg_name))
|
||||
if self.args_decl == 'void':
|
||||
self.args_list = arg_list_name
|
||||
self.args_decl = arg_type + ' ' + arg_name
|
||||
else:
|
||||
self.args_list += ', ' + arg_list_name
|
||||
self.args_decl += ', ' + arg_type + ' ' + arg_name
|
||||
|
||||
def add_provider(self, condition, loader, condition_name):
|
||||
self.providers[condition_name] = GLProvider(condition, condition_name,
|
||||
loader, self.name)
|
||||
|
||||
def add_alias(self, ext):
|
||||
assert self.alias_func is None
|
||||
|
||||
self.alias_exts.append(ext)
|
||||
ext.alias_func = self
|
||||
|
||||
class Generator(object):
|
||||
def __init__(self, target):
|
||||
self.target = target
|
||||
self.enums = {}
|
||||
self.functions = {}
|
||||
self.sorted_functions = []
|
||||
self.enum_string_offset = {}
|
||||
self.max_enum_name_len = 1
|
||||
self.entrypoint_string_offset = {}
|
||||
self.copyright_comment = None
|
||||
self.typedefs = ''
|
||||
self.out_file = None
|
||||
|
||||
# GL versions named in the registry, which we should generate
|
||||
# #defines for.
|
||||
self.supported_versions = set()
|
||||
|
||||
# Extensions named in the registry, which we should generate
|
||||
# #defines for.
|
||||
self.supported_extensions = set()
|
||||
|
||||
# Dictionary mapping human-readable names of providers to a C
|
||||
# enum token that will be used to reference those names, to
|
||||
# reduce generated binary size.
|
||||
self.provider_enum = {}
|
||||
|
||||
# Dictionary mapping human-readable names of providers to C
|
||||
# code to detect if it's present.
|
||||
self.provider_condition = {}
|
||||
|
||||
# Dictionary mapping human-readable names of providers to
|
||||
# format strings for fetching the function pointer when
|
||||
# provided the name of the symbol to be requested.
|
||||
self.provider_loader = {}
|
||||
|
||||
def all_text_until_element_name(self, element, element_name):
|
||||
text = ''
|
||||
|
||||
if element.text is not None:
|
||||
text += element.text
|
||||
|
||||
for child in element:
|
||||
if child.tag == element_name:
|
||||
break
|
||||
if child.text:
|
||||
text += child.text
|
||||
if child.tail:
|
||||
text += child.tail
|
||||
return text
|
||||
|
||||
def out(self, text):
|
||||
self.out_file.write(text)
|
||||
|
||||
def outln(self, text):
|
||||
self.out_file.write(text + '\n')
|
||||
|
||||
def parse_typedefs(self, reg):
|
||||
for t in reg.findall('types/type'):
|
||||
if 'name' in t.attrib and t.attrib['name'] not in {'GLhandleARB'}:
|
||||
continue
|
||||
|
||||
# The gles1/gles2-specific types are redundant
|
||||
# declarations, and the different types used for them (int
|
||||
# vs int32_t) caused problems on win32 builds.
|
||||
api = t.get('api')
|
||||
if api:
|
||||
continue
|
||||
|
||||
if t.text is not None:
|
||||
self.typedefs += t.text
|
||||
|
||||
for child in t:
|
||||
if child.tag == 'apientry':
|
||||
self.typedefs += 'APIENTRY'
|
||||
if child.text:
|
||||
self.typedefs += child.text
|
||||
if child.tail:
|
||||
self.typedefs += child.tail
|
||||
self.typedefs += '\n'
|
||||
|
||||
def parse_enums(self, reg):
|
||||
for enum in reg.findall('enums/enum'):
|
||||
name = enum.get('name')
|
||||
|
||||
# wgl.xml's 0xwhatever definitions end up colliding with
|
||||
# wingdi.h's decimal definitions of these.
|
||||
if name in ['WGL_SWAP_OVERLAY', 'WGL_SWAP_UNDERLAY', 'WGL_SWAP_MAIN_PLANE']:
|
||||
continue
|
||||
|
||||
self.max_enum_name_len = max(self.max_enum_name_len, len(name))
|
||||
self.enums[name] = enum.get('value')
|
||||
|
||||
def get_function_return_type(self, proto):
|
||||
# Everything up to the start of the name element is the return type.
|
||||
return self.all_text_until_element_name(proto, 'name').strip()
|
||||
|
||||
def parse_function_definitions(self, reg):
|
||||
for command in reg.findall('commands/command'):
|
||||
proto = command.find('proto')
|
||||
name = proto.find('name').text
|
||||
ret_type = self.get_function_return_type(proto)
|
||||
|
||||
func = GLFunction(ret_type, name)
|
||||
|
||||
for arg in command.findall('param'):
|
||||
func.add_arg(self.all_text_until_element_name(arg, 'name').strip(),
|
||||
arg.find('name').text)
|
||||
|
||||
alias = command.find('alias')
|
||||
if alias is not None:
|
||||
# Note that some alias references appear before the
|
||||
# target command is defined (glAttachObjectARB() ->
|
||||
# glAttachShader(), for example).
|
||||
func.alias_name = alias.get('name')
|
||||
|
||||
self.functions[name] = func
|
||||
|
||||
def drop_weird_glx_functions(self):
|
||||
# Drop a few ancient SGIX GLX extensions that use types not defined
|
||||
# anywhere in Xlib. In glxext.h, they're protected by #ifdefs for the
|
||||
# headers that defined them.
|
||||
weird_functions = [name for name, func in self.functions.items()
|
||||
if 'VLServer' in func.args_decl
|
||||
or 'DMparams' in func.args_decl]
|
||||
|
||||
for name in weird_functions:
|
||||
del self.functions[name]
|
||||
|
||||
def resolve_aliases(self):
|
||||
for func in self.functions.values():
|
||||
# Find the root of the alias tree, and add ourselves to it.
|
||||
if func.alias_name != func.name:
|
||||
alias_func = func
|
||||
while alias_func.alias_name != alias_func.name:
|
||||
alias_func = self.functions[alias_func.alias_name]
|
||||
func.alias_name = alias_func.name
|
||||
func.alias_func = alias_func
|
||||
alias_func.alias_exts.append(func)
|
||||
|
||||
def prepare_provider_enum(self):
|
||||
self.provider_enum = {}
|
||||
|
||||
# We assume that for any given provider, all functions using
|
||||
# it will have the same loader. This lets us generate a
|
||||
# general C function for detecting conditions and calling the
|
||||
# dlsym/getprocaddress, and have our many resolver stubs just
|
||||
# call it with a table of values.
|
||||
for func in self.functions.values():
|
||||
for provider in func.providers.values():
|
||||
if provider.condition_name in self.provider_enum:
|
||||
assert self.provider_condition[provider.condition_name] == provider.condition
|
||||
assert self.provider_loader[provider.condition_name] == provider.loader
|
||||
continue
|
||||
|
||||
self.provider_enum[provider.condition_name] = provider.enum
|
||||
self.provider_condition[provider.condition_name] = provider.condition
|
||||
self.provider_loader[provider.condition_name] = provider.loader
|
||||
|
||||
def sort_functions(self):
|
||||
self.sorted_functions = sorted(self.functions.values(), key=lambda func: func.name)
|
||||
|
||||
def process_require_statements(self, feature, condition, loader, human_name):
|
||||
for command in feature.findall('require/command'):
|
||||
name = command.get('name')
|
||||
|
||||
# wgl.xml describes 6 functions in WGL 1.0 that are in
|
||||
# gdi32.dll instead of opengl32.dll, and we would need to
|
||||
# change up our symbol loading to support that. Just
|
||||
# don't wrap those functions.
|
||||
if self.target == 'wgl' and 'wgl' not in name:
|
||||
del self.functions[name]
|
||||
continue
|
||||
|
||||
func = self.functions[name]
|
||||
func.add_provider(condition, loader, human_name)
|
||||
|
||||
def parse_function_providers(self, reg):
|
||||
for feature in reg.findall('feature'):
|
||||
api = feature.get('api') # string gl, gles1, gles2, glx
|
||||
m = re.match(r'([0-9])\.([0-9])', feature.get('number'))
|
||||
version = int(m.group(1)) * 10 + int(m.group(2))
|
||||
|
||||
self.supported_versions.add(feature.get('name'))
|
||||
|
||||
if api == 'gl':
|
||||
human_name = 'Desktop OpenGL {0}'.format(feature.get('number'))
|
||||
condition = 'epoxy_is_desktop_gl()'
|
||||
|
||||
loader = 'epoxy_get_core_proc_address({0}, {1})'.format('{0}', version)
|
||||
if version >= 11:
|
||||
condition += ' && epoxy_conservative_gl_version() >= {0}'.format(version)
|
||||
elif api == 'gles2':
|
||||
human_name = 'OpenGL ES {0}'.format(feature.get('number'))
|
||||
condition = '!epoxy_is_desktop_gl() && epoxy_gl_version() >= {0}'.format(version)
|
||||
|
||||
if version <= 20:
|
||||
loader = 'epoxy_gles2_dlsym({0})'
|
||||
else:
|
||||
loader = 'epoxy_gles3_dlsym({0})'
|
||||
elif api == 'gles1':
|
||||
human_name = 'OpenGL ES 1.0'
|
||||
condition = '!epoxy_is_desktop_gl() && epoxy_gl_version() >= 10 && epoxy_gl_version() < 20'
|
||||
loader = 'epoxy_gles1_dlsym({0})'
|
||||
elif api == 'glx':
|
||||
human_name = 'GLX {0}'.format(version)
|
||||
# We could just always use GPA for loading everything
|
||||
# but glXGetProcAddress(), but dlsym() is a more
|
||||
# efficient lookup.
|
||||
if version > 13:
|
||||
condition = 'epoxy_conservative_glx_version() >= {0}'.format(version)
|
||||
loader = 'glXGetProcAddress((const GLubyte *){0})'
|
||||
else:
|
||||
condition = 'true'
|
||||
loader = 'epoxy_glx_dlsym({0})'
|
||||
elif api == 'egl':
|
||||
human_name = 'EGL {0}'.format(version)
|
||||
if version > 10:
|
||||
condition = 'epoxy_conservative_egl_version() >= {0}'.format(version)
|
||||
else:
|
||||
condition = 'true'
|
||||
# All EGL core entrypoints must be dlsym()ed out --
|
||||
# eglGetProcAdddress() will return NULL.
|
||||
loader = 'epoxy_egl_dlsym({0})'
|
||||
elif api == 'wgl':
|
||||
human_name = 'WGL {0}'.format(version)
|
||||
condition = 'true'
|
||||
loader = 'epoxy_gl_dlsym({0})'
|
||||
elif api == 'glsc2':
|
||||
continue
|
||||
else:
|
||||
sys.exit('unknown API: "{0}"'.format(api))
|
||||
|
||||
self.process_require_statements(feature, condition, loader, human_name)
|
||||
|
||||
for extension in reg.findall('extensions/extension'):
|
||||
extname = extension.get('name')
|
||||
cond_extname = "enum_string[enum_string_offsets[i]]"
|
||||
|
||||
self.supported_extensions.add(extname)
|
||||
|
||||
# 'supported' is a set of strings like gl, gles1, gles2,
|
||||
# or glx, which are separated by '|'
|
||||
apis = extension.get('supported').split('|')
|
||||
if 'glx' in apis:
|
||||
condition = 'epoxy_conservative_has_glx_extension(provider_name)'
|
||||
loader = 'glXGetProcAddress((const GLubyte *){0})'
|
||||
self.process_require_statements(extension, condition, loader, extname)
|
||||
if 'egl' in apis:
|
||||
condition = 'epoxy_conservative_has_egl_extension(provider_name)'
|
||||
loader = 'eglGetProcAddress({0})'
|
||||
self.process_require_statements(extension, condition, loader, extname)
|
||||
if 'wgl' in apis:
|
||||
condition = 'epoxy_conservative_has_wgl_extension(provider_name)'
|
||||
loader = 'wglGetProcAddress({0})'
|
||||
self.process_require_statements(extension, condition, loader, extname)
|
||||
if {'gl', 'gles1', 'gles2'}.intersection(apis):
|
||||
condition = 'epoxy_conservative_has_gl_extension(provider_name)'
|
||||
loader = 'epoxy_get_proc_address({0})'
|
||||
self.process_require_statements(extension, condition, loader, extname)
|
||||
|
||||
def fixup_bootstrap_function(self, name, loader):
|
||||
# We handle glGetString(), glGetIntegerv(), and
|
||||
# glXGetProcAddressARB() specially, because we need to use
|
||||
# them in the process of deciding on loaders for resolving,
|
||||
# and the naive code generation would result in their
|
||||
# resolvers calling their own resolvers.
|
||||
if name not in self.functions:
|
||||
return
|
||||
|
||||
func = self.functions[name]
|
||||
func.providers = {}
|
||||
func.add_provider('true', loader, 'always present')
|
||||
|
||||
def parse(self, xml_file):
|
||||
reg = ET.parse(xml_file)
|
||||
comment = reg.find('comment')
|
||||
if comment is not None:
|
||||
self.copyright_comment = comment.text
|
||||
else:
|
||||
self.copyright_comment = ''
|
||||
self.parse_typedefs(reg)
|
||||
self.parse_enums(reg)
|
||||
self.parse_function_definitions(reg)
|
||||
self.parse_function_providers(reg)
|
||||
|
||||
def write_copyright_comment_body(self):
|
||||
for line in self.copyright_comment.splitlines():
|
||||
if '-----' in line:
|
||||
break
|
||||
self.outln(' * ' + line)
|
||||
|
||||
def write_enums(self):
|
||||
for name in sorted(self.supported_versions):
|
||||
self.outln('#define {0} 1'.format(name))
|
||||
self.outln('')
|
||||
|
||||
for name in sorted(self.supported_extensions):
|
||||
self.outln('#define {0} 1'.format(name))
|
||||
self.outln('')
|
||||
|
||||
# We want to sort by enum number (which puts a bunch of things
|
||||
# in a logical order), then by name after that, so we do those
|
||||
# sorts in reverse. This is still way uglier than doing some
|
||||
# sort based on what version/extensions things are introduced
|
||||
# in, but we haven't paid any attention to those attributes
|
||||
# for enums yet.
|
||||
sorted_by_name = sorted(self.enums.keys())
|
||||
sorted_by_number = sorted(sorted_by_name, key=lambda name: self.enums[name])
|
||||
for name in sorted_by_number:
|
||||
self.outln('#define ' + name.ljust(self.max_enum_name_len + 3) + self.enums[name] + '')
|
||||
|
||||
def write_function_ptr_typedefs(self):
|
||||
for func in self.sorted_functions:
|
||||
self.outln('typedef {0} (GLAPIENTRY *{1})({2});'.format(func.ret_type,
|
||||
func.ptr_type,
|
||||
func.args_decl))
|
||||
|
||||
def write_header_header(self, out_file):
|
||||
self.close()
|
||||
self.out_file = open(out_file, 'w')
|
||||
|
||||
self.outln('/* GL dispatch header.')
|
||||
self.outln(' * This is code-generated from the GL API XML files from Khronos.')
|
||||
self.write_copyright_comment_body()
|
||||
self.outln(' */')
|
||||
self.outln('')
|
||||
|
||||
self.outln('#pragma once')
|
||||
|
||||
self.outln('#include <inttypes.h>')
|
||||
self.outln('#include <stddef.h>')
|
||||
self.outln('')
|
||||
|
||||
def write_header(self, out_file):
|
||||
self.write_header_header(out_file)
|
||||
|
||||
self.outln('#include "epoxy/common.h"')
|
||||
|
||||
if self.target != "gl":
|
||||
self.outln('#include "epoxy/gl.h"')
|
||||
if self.target == "egl":
|
||||
self.outln('#include "EGL/eglplatform.h"')
|
||||
# Account for older eglplatform.h, which doesn't define
|
||||
# the EGL_CAST macro.
|
||||
self.outln('#ifndef EGL_CAST')
|
||||
self.outln('#if defined(__cplusplus)')
|
||||
self.outln('#define EGL_CAST(type, value) (static_cast<type>(value))')
|
||||
self.outln('#else')
|
||||
self.outln('#define EGL_CAST(type, value) ((type) (value))')
|
||||
self.outln('#endif')
|
||||
self.outln('#endif')
|
||||
else:
|
||||
# Add some ridiculous inttypes.h redefinitions that are
|
||||
# from khrplatform.h and not included in the XML. We
|
||||
# don't directly include khrplatform.h because it's not
|
||||
# present on many systems, and coming up with #ifdefs to
|
||||
# decide when it's not present would be hard.
|
||||
self.outln('#define __khrplatform_h_ 1')
|
||||
self.outln('typedef int8_t khronos_int8_t;')
|
||||
self.outln('typedef int16_t khronos_int16_t;')
|
||||
self.outln('typedef int32_t khronos_int32_t;')
|
||||
self.outln('typedef int64_t khronos_int64_t;')
|
||||
self.outln('typedef uint8_t khronos_uint8_t;')
|
||||
self.outln('typedef uint16_t khronos_uint16_t;')
|
||||
self.outln('typedef uint32_t khronos_uint32_t;')
|
||||
self.outln('typedef uint64_t khronos_uint64_t;')
|
||||
self.outln('typedef float khronos_float_t;')
|
||||
self.outln('#ifdef _WIN64')
|
||||
self.outln('typedef signed long long int khronos_intptr_t;')
|
||||
self.outln('typedef unsigned long long int khronos_uintptr_t;')
|
||||
self.outln('typedef signed long long int khronos_ssize_t;')
|
||||
self.outln('typedef unsigned long long int khronos_usize_t;')
|
||||
self.outln('#else')
|
||||
self.outln('typedef signed long int khronos_intptr_t;')
|
||||
self.outln('typedef unsigned long int khronos_uintptr_t;')
|
||||
self.outln('typedef signed long int khronos_ssize_t;')
|
||||
self.outln('typedef unsigned long int khronos_usize_t;')
|
||||
self.outln('#endif')
|
||||
self.outln('typedef uint64_t khronos_utime_nanoseconds_t;')
|
||||
self.outln('typedef int64_t khronos_stime_nanoseconds_t;')
|
||||
self.outln('#define KHRONOS_MAX_ENUM 0x7FFFFFFF')
|
||||
self.outln('typedef enum {')
|
||||
self.outln(' KHRONOS_FALSE = 0,')
|
||||
self.outln(' KHRONOS_TRUE = 1,')
|
||||
self.outln(' KHRONOS_BOOLEAN_ENUM_FORCE_SIZE = KHRONOS_MAX_ENUM')
|
||||
self.outln('} khronos_boolean_enum_t;')
|
||||
|
||||
if self.target == "glx":
|
||||
self.outln('#include <X11/Xlib.h>')
|
||||
self.outln('#include <X11/Xutil.h>')
|
||||
|
||||
self.out(self.typedefs)
|
||||
self.outln('')
|
||||
self.write_enums()
|
||||
self.outln('')
|
||||
self.write_function_ptr_typedefs()
|
||||
|
||||
for func in self.sorted_functions:
|
||||
self.outln('EPOXY_PUBLIC {0} (EPOXY_CALLSPEC *epoxy_{1})({2});'.format(func.ret_type,
|
||||
func.name,
|
||||
func.args_decl))
|
||||
self.outln('')
|
||||
|
||||
for func in self.sorted_functions:
|
||||
self.outln('#define {0} epoxy_{0}'.format(func.name))
|
||||
|
||||
def write_function_ptr_resolver(self, func):
|
||||
self.outln('static {0}'.format(func.ptr_type))
|
||||
self.outln('epoxy_{0}_resolver(void)'.format(func.wrapped_name))
|
||||
self.outln('{')
|
||||
|
||||
providers = []
|
||||
# Make a local list of all the providers for this alias group
|
||||
alias_root = func
|
||||
if func.alias_func:
|
||||
alias_root = func.alias_func
|
||||
for provider in alias_root.providers.values():
|
||||
providers.append(provider)
|
||||
for alias_func in alias_root.alias_exts:
|
||||
for provider in alias_func.providers.values():
|
||||
providers.append(provider)
|
||||
|
||||
# Add some partial aliases of a few functions. These are ones
|
||||
# that aren't quite aliases, because of some trivial behavior
|
||||
# difference (like whether to produce an error for a
|
||||
# non-Genned name), but where we'd like to fall back to the
|
||||
# similar function if the proper one isn't present.
|
||||
half_aliases = {
|
||||
'glBindVertexArray' : 'glBindVertexArrayAPPLE',
|
||||
'glBindVertexArrayAPPLE' : 'glBindVertexArray',
|
||||
'glBindFramebuffer' : 'glBindFramebufferEXT',
|
||||
'glBindFramebufferEXT' : 'glBindFramebuffer',
|
||||
'glBindRenderbuffer' : 'glBindRenderbufferEXT',
|
||||
'glBindRenderbufferEXT' : 'glBindRenderbuffer',
|
||||
}
|
||||
if func.name in half_aliases:
|
||||
alias_func = self.functions[half_aliases[func.name]]
|
||||
for provider in alias_func.providers.values():
|
||||
providers.append(provider)
|
||||
|
||||
def provider_sort(provider):
|
||||
return (provider.name != func.name, provider.name, provider.enum)
|
||||
providers.sort(key=provider_sort)
|
||||
|
||||
if len(providers) != 1:
|
||||
self.outln(' static const enum {0}_provider providers[] = {{'.format(self.target))
|
||||
for provider in providers:
|
||||
self.outln(' {0},'.format(provider.enum))
|
||||
self.outln(' {0}_provider_terminator'.format(self.target))
|
||||
self.outln(' };')
|
||||
|
||||
self.outln(' static const uint32_t entrypoints[] = {')
|
||||
if len(providers) > 1:
|
||||
for provider in providers:
|
||||
self.outln(' {0} /* "{1}" */,'.format(self.entrypoint_string_offset[provider.name], provider.name))
|
||||
else:
|
||||
self.outln(' 0 /* None */,')
|
||||
self.outln(' };')
|
||||
|
||||
self.outln(' return {0}_provider_resolver(entrypoint_strings + {1} /* "{2}" */,'.format(self.target,
|
||||
self.entrypoint_string_offset[func.name],
|
||||
func.name))
|
||||
self.outln(' providers, entrypoints);')
|
||||
else:
|
||||
assert providers[0].name == func.name
|
||||
self.outln(' return {0}_single_resolver({1}, {2} /* {3} */);'.format(self.target,
|
||||
providers[0].enum,
|
||||
self.entrypoint_string_offset[func.name],
|
||||
func.name))
|
||||
self.outln('}')
|
||||
self.outln('')
|
||||
|
||||
def write_thunks(self, func):
|
||||
# Writes out the function that's initially plugged into the
|
||||
# global function pointer, which resolves, updates the global
|
||||
# function pointer, and calls down to it.
|
||||
#
|
||||
# It also writes out the actual initialized global function
|
||||
# pointer.
|
||||
if func.ret_type == 'void':
|
||||
self.outln('GEN_THUNKS({0}, ({1}), ({2}))'.format(func.wrapped_name,
|
||||
func.args_decl,
|
||||
func.args_list))
|
||||
else:
|
||||
self.outln('GEN_THUNKS_RET({0}, {1}, ({2}), ({3}))'.format(func.ret_type,
|
||||
func.wrapped_name,
|
||||
func.args_decl,
|
||||
func.args_list))
|
||||
|
||||
def write_function_pointer(self, func):
|
||||
self.outln('{0} epoxy_{1} = epoxy_{1}_global_rewrite_ptr;'.format(func.ptr_type, func.wrapped_name))
|
||||
self.outln('')
|
||||
|
||||
def write_provider_enums(self):
|
||||
# Writes the enum declaration for the list of providers
|
||||
# supported by gl_provider_resolver()
|
||||
|
||||
self.outln('')
|
||||
self.outln('enum {0}_provider {{'.format(self.target))
|
||||
|
||||
sorted_providers = sorted(self.provider_enum.keys())
|
||||
|
||||
# We always put a 0 enum first so that we can have a
|
||||
# terminator in our arrays
|
||||
self.outln(' {0}_provider_terminator = 0,'.format(self.target))
|
||||
|
||||
for human_name in sorted_providers:
|
||||
enum = self.provider_enum[human_name]
|
||||
self.outln(' {0},'.format(enum))
|
||||
self.outln('} PACKED;')
|
||||
self.outln('ENDPACKED')
|
||||
self.outln('')
|
||||
|
||||
def write_provider_enum_strings(self):
|
||||
# Writes the mapping from enums to the strings describing them
|
||||
# for epoxy_print_failure_reasons().
|
||||
|
||||
sorted_providers = sorted(self.provider_enum.keys())
|
||||
|
||||
offset = 0
|
||||
self.outln('static const char *enum_string =')
|
||||
for human_name in sorted_providers:
|
||||
self.outln(' "{0}\\0"'.format(human_name))
|
||||
self.enum_string_offset[human_name] = offset
|
||||
offset += len(human_name.replace('\\', '')) + 1
|
||||
self.outln(' ;')
|
||||
self.outln('')
|
||||
# We're using uint16_t for the offsets.
|
||||
assert offset < 65536
|
||||
|
||||
self.outln('static const uint16_t enum_string_offsets[] = {')
|
||||
self.outln(' -1, /* {0}_provider_terminator, unused */'.format(self.target))
|
||||
for human_name in sorted_providers:
|
||||
enum = self.provider_enum[human_name]
|
||||
self.outln(' {1}, /* {0} */'.format(human_name, self.enum_string_offset[human_name]))
|
||||
self.outln('};')
|
||||
self.outln('')
|
||||
|
||||
def write_entrypoint_strings(self):
|
||||
self.outln('static const char entrypoint_strings[] = {')
|
||||
offset = 0
|
||||
for func in self.sorted_functions:
|
||||
if func.name not in self.entrypoint_string_offset:
|
||||
self.entrypoint_string_offset[func.name] = offset
|
||||
offset += len(func.name) + 1
|
||||
for c in func.name:
|
||||
self.outln(" '{0}',".format(c))
|
||||
self.outln(' 0, // {0}'.format(func.name))
|
||||
self.outln(' 0 };')
|
||||
# We're using uint16_t for the offsets.
|
||||
#assert(offset < 65536)
|
||||
self.outln('')
|
||||
|
||||
def write_provider_resolver(self):
|
||||
self.outln('static void *{0}_provider_resolver(const char *name,'.format(self.target))
|
||||
self.outln(' const enum {0}_provider *providers,'.format(self.target))
|
||||
self.outln(' const uint32_t *entrypoints)')
|
||||
self.outln('{')
|
||||
self.outln(' int i;')
|
||||
|
||||
self.outln(' for (i = 0; providers[i] != {0}_provider_terminator; i++) {{'.format(self.target))
|
||||
self.outln(' const char *provider_name = enum_string + enum_string_offsets[providers[i]];')
|
||||
self.outln(' switch (providers[i]) {')
|
||||
self.outln('')
|
||||
|
||||
for human_name in sorted(self.provider_enum.keys()):
|
||||
enum = self.provider_enum[human_name]
|
||||
self.outln(' case {0}:'.format(enum))
|
||||
self.outln(' if ({0})'.format(self.provider_condition[human_name]))
|
||||
self.outln(' return {0};'.format(self.provider_loader[human_name]).format("entrypoint_strings + entrypoints[i]"))
|
||||
self.outln(' break;')
|
||||
|
||||
self.outln(' case {0}_provider_terminator:'.format(self.target))
|
||||
self.outln(' abort(); /* Not reached */')
|
||||
self.outln(' }')
|
||||
self.outln(' }')
|
||||
self.outln('')
|
||||
|
||||
self.outln(' if (epoxy_resolver_failure_handler)')
|
||||
self.outln(' return epoxy_resolver_failure_handler(name);')
|
||||
self.outln('')
|
||||
|
||||
# If the function isn't provided by any known extension, print
|
||||
# something useful for the poor application developer before
|
||||
# aborting. (In non-epoxy GL usage, the app developer would
|
||||
# call into some blank stub function and segfault).
|
||||
self.outln(' fprintf(stderr, "No provider of %s found. Requires one of:\\n", name);')
|
||||
self.outln(' for (i = 0; providers[i] != {0}_provider_terminator; i++) {{'.format(self.target))
|
||||
self.outln(' fprintf(stderr, " %s\\n", enum_string + enum_string_offsets[providers[i]]);')
|
||||
self.outln(' }')
|
||||
self.outln(' if (providers[0] == {0}_provider_terminator) {{'.format(self.target))
|
||||
self.outln(' fprintf(stderr, " No known providers. This is likely a bug "')
|
||||
self.outln(' "in libepoxy code generation\\n");')
|
||||
self.outln(' }')
|
||||
self.outln(' abort();')
|
||||
|
||||
self.outln('}')
|
||||
self.outln('')
|
||||
|
||||
single_resolver_proto = '{0}_single_resolver(enum {0}_provider provider, uint32_t entrypoint_offset)'.format(self.target)
|
||||
self.outln('EPOXY_NOINLINE static void *')
|
||||
self.outln('{0};'.format(single_resolver_proto))
|
||||
self.outln('')
|
||||
self.outln('static void *')
|
||||
self.outln('{0}'.format(single_resolver_proto))
|
||||
self.outln('{')
|
||||
self.outln(' enum {0}_provider providers[] = {{'.format(self.target))
|
||||
self.outln(' provider,')
|
||||
self.outln(' {0}_provider_terminator'.format(self.target))
|
||||
self.outln(' };')
|
||||
self.outln(' return {0}_provider_resolver(entrypoint_strings + entrypoint_offset,'.format(self.target))
|
||||
self.outln(' providers, &entrypoint_offset);')
|
||||
self.outln('}')
|
||||
self.outln('')
|
||||
|
||||
def write_source(self, f):
|
||||
self.close()
|
||||
self.out_file = open(f, 'w')
|
||||
|
||||
self.outln('/* GL dispatch code.')
|
||||
self.outln(' * This is code-generated from the GL API XML files from Khronos.')
|
||||
self.write_copyright_comment_body()
|
||||
self.outln(' */')
|
||||
self.outln('')
|
||||
self.outln('#include "config.h"')
|
||||
self.outln('')
|
||||
self.outln('#include <stdlib.h>')
|
||||
self.outln('#include <string.h>')
|
||||
self.outln('#include <stdio.h>')
|
||||
self.outln('')
|
||||
self.outln('#include "dispatch_common.h"')
|
||||
self.outln('#include "epoxy/{0}.h"'.format(self.target))
|
||||
self.outln('')
|
||||
self.outln('#ifdef __GNUC__')
|
||||
self.outln('#define EPOXY_NOINLINE __attribute__((noinline))')
|
||||
self.outln('#elif defined (_MSC_VER)')
|
||||
self.outln('#define EPOXY_NOINLINE __declspec(noinline)')
|
||||
self.outln('#endif')
|
||||
|
||||
self.outln('struct dispatch_table {')
|
||||
for func in self.sorted_functions:
|
||||
self.outln(' {0} epoxy_{1};'.format(func.ptr_type, func.wrapped_name))
|
||||
self.outln('};')
|
||||
self.outln('')
|
||||
|
||||
# Early declaration, so we can declare the real thing at the
|
||||
# bottom. (I want the function_ptr_resolver as the first
|
||||
# per-GL-call code, since it's the most interesting to see
|
||||
# when you search for the implementation of a call)
|
||||
self.outln('#if USING_DISPATCH_TABLE')
|
||||
self.outln('static inline struct dispatch_table *')
|
||||
self.outln('get_dispatch_table(void);')
|
||||
self.outln('')
|
||||
self.outln('#endif')
|
||||
|
||||
self.write_provider_enums()
|
||||
self.write_provider_enum_strings()
|
||||
self.write_entrypoint_strings()
|
||||
self.write_provider_resolver()
|
||||
|
||||
for func in self.sorted_functions:
|
||||
self.write_function_ptr_resolver(func)
|
||||
|
||||
for func in self.sorted_functions:
|
||||
self.write_thunks(func)
|
||||
self.outln('')
|
||||
|
||||
self.outln('#if USING_DISPATCH_TABLE')
|
||||
|
||||
self.outln('static struct dispatch_table resolver_table = {')
|
||||
for func in self.sorted_functions:
|
||||
self.outln(' epoxy_{0}_dispatch_table_rewrite_ptr, /* {0} */'.format(func.wrapped_name))
|
||||
self.outln('};')
|
||||
self.outln('')
|
||||
|
||||
self.outln('uint32_t {0}_tls_index;'.format(self.target))
|
||||
self.outln('uint32_t {0}_tls_size = sizeof(struct dispatch_table);'.format(self.target))
|
||||
self.outln('')
|
||||
|
||||
self.outln('static inline struct dispatch_table *')
|
||||
self.outln('get_dispatch_table(void)')
|
||||
self.outln('{')
|
||||
self.outln(' return TlsGetValue({0}_tls_index);'.format(self.target))
|
||||
self.outln('}')
|
||||
self.outln('')
|
||||
|
||||
self.outln('void')
|
||||
self.outln('{0}_init_dispatch_table(void)'.format(self.target))
|
||||
self.outln('{')
|
||||
self.outln(' struct dispatch_table *dispatch_table = get_dispatch_table();')
|
||||
self.outln(' memcpy(dispatch_table, &resolver_table, sizeof(resolver_table));')
|
||||
self.outln('}')
|
||||
self.outln('')
|
||||
|
||||
self.outln('void')
|
||||
self.outln('{0}_switch_to_dispatch_table(void)'.format(self.target))
|
||||
self.outln('{')
|
||||
|
||||
for func in self.sorted_functions:
|
||||
self.outln(' epoxy_{0} = epoxy_{0}_dispatch_table_thunk;'.format(func.wrapped_name))
|
||||
|
||||
self.outln('}')
|
||||
self.outln('')
|
||||
|
||||
self.outln('#endif /* !USING_DISPATCH_TABLE */')
|
||||
|
||||
for func in self.sorted_functions:
|
||||
self.write_function_pointer(func)
|
||||
|
||||
def close(self):
|
||||
if self.out_file:
|
||||
self.out_file.close()
|
||||
self.out_file = None
|
||||
|
||||
|
||||
argparser = argparse.ArgumentParser(description='Generate GL dispatch wrappers.')
|
||||
argparser.add_argument('files', metavar='file.xml', nargs='+', help='GL API XML files to be parsed')
|
||||
argparser.add_argument('--outputdir', metavar='dir', required=False, help='Destination directory for files (default to current dir)')
|
||||
argparser.add_argument('--includedir', metavar='dir', required=False, help='Destination directory for headers')
|
||||
argparser.add_argument('--srcdir', metavar='dir', required=False, help='Destination directory for source')
|
||||
argparser.add_argument('--source', dest='source', action='store_true', required=False, help='Generate the source file')
|
||||
argparser.add_argument('--no-source', dest='source', action='store_false', required=False, help='Do not generate the source file')
|
||||
argparser.add_argument('--header', dest='header', action='store_true', required=False, help='Generate the header file')
|
||||
argparser.add_argument('--no-header', dest='header', action='store_false', required=False, help='Do not generate the header file')
|
||||
args = argparser.parse_args()
|
||||
|
||||
if args.outputdir:
|
||||
outputdir = args.outputdir
|
||||
else:
|
||||
outputdir = os.getcwd()
|
||||
|
||||
if args.includedir:
|
||||
includedir = args.includedir
|
||||
else:
|
||||
includedir = outputdir
|
||||
|
||||
if args.srcdir:
|
||||
srcdir = args.srcdir
|
||||
else:
|
||||
srcdir = outputdir
|
||||
|
||||
build_source = args.source
|
||||
build_header = args.header
|
||||
|
||||
if not build_source and not build_header:
|
||||
build_source = True
|
||||
build_header = True
|
||||
|
||||
for f in args.files:
|
||||
name = os.path.basename(f).split('.xml')[0]
|
||||
generator = Generator(name)
|
||||
generator.parse(f)
|
||||
|
||||
generator.drop_weird_glx_functions()
|
||||
|
||||
# This is an ANSI vs Unicode function, handled specially by
|
||||
# include/epoxy/wgl.h
|
||||
if 'wglUseFontBitmaps' in generator.functions:
|
||||
del generator.functions['wglUseFontBitmaps']
|
||||
|
||||
generator.sort_functions()
|
||||
generator.resolve_aliases()
|
||||
generator.fixup_bootstrap_function('glGetString',
|
||||
'epoxy_get_bootstrap_proc_address({0})')
|
||||
generator.fixup_bootstrap_function('glGetIntegerv',
|
||||
'epoxy_get_bootstrap_proc_address({0})')
|
||||
|
||||
# While this is technically exposed as a GLX extension, it's
|
||||
# required to be present as a public symbol by the Linux OpenGL
|
||||
# ABI.
|
||||
generator.fixup_bootstrap_function('glXGetProcAddress',
|
||||
'epoxy_glx_dlsym({0})')
|
||||
|
||||
generator.prepare_provider_enum()
|
||||
|
||||
if build_header:
|
||||
generator.write_header(os.path.join(includedir, name + '_generated.h'))
|
||||
if build_source:
|
||||
generator.write_source(os.path.join(srcdir, name + '_generated_dispatch.c'))
|
||||
|
||||
generator.close()
|
||||
@@ -1,121 +0,0 @@
|
||||
# Configuration file
|
||||
configure_file(output: 'config.h', configuration: conf)
|
||||
|
||||
# List of generated sources:
|
||||
# - name of the generated file
|
||||
# - registry source file
|
||||
# - additional sources
|
||||
generated_sources = [
|
||||
[ 'gl_generated_dispatch.c', gl_registry, [ 'dispatch_common.c', 'dispatch_common.h' ] ]
|
||||
]
|
||||
|
||||
if build_egl
|
||||
generated_sources += [ [ 'egl_generated_dispatch.c', egl_registry, 'dispatch_egl.c' ] ]
|
||||
endif
|
||||
|
||||
if build_glx
|
||||
generated_sources += [ [ 'glx_generated_dispatch.c', glx_registry, 'dispatch_glx.c' ] ]
|
||||
endif
|
||||
|
||||
if build_wgl
|
||||
generated_sources += [ [ 'wgl_generated_dispatch.c', wgl_registry, 'dispatch_wgl.c' ] ]
|
||||
endif
|
||||
|
||||
gen_sources = [ ]
|
||||
sources = [ ]
|
||||
|
||||
foreach g: generated_sources
|
||||
gen_source = g[0]
|
||||
registry = g[1]
|
||||
source = g[2]
|
||||
|
||||
generated = custom_target(gen_source,
|
||||
input: registry,
|
||||
output: [ gen_source ],
|
||||
command: [
|
||||
gen_dispatch_py,
|
||||
'--source',
|
||||
'--no-header',
|
||||
'--outputdir=@OUTDIR@',
|
||||
'@INPUT@',
|
||||
])
|
||||
|
||||
gen_sources += [ generated ]
|
||||
sources += [ source ]
|
||||
endforeach
|
||||
|
||||
epoxy_sources = sources + gen_sources
|
||||
|
||||
common_ldflags = []
|
||||
|
||||
if host_system == 'linux' and cc.get_id() == 'gcc'
|
||||
common_ldflags += cc.get_supported_link_arguments([ '-Wl,-Bsymbolic-functions', '-Wl,-z,relro' ])
|
||||
endif
|
||||
|
||||
# Maintain compatibility with autotools; see: https://github.com/anholt/libepoxy/issues/108
|
||||
darwin_versions = [1, '1.0']
|
||||
|
||||
epoxy_deps = [ dl_dep, ]
|
||||
if host_system == 'windows'
|
||||
epoxy_deps += [ opengl32_dep, gdi32_dep ]
|
||||
endif
|
||||
if enable_x11
|
||||
epoxy_deps += [ x11_headers_dep, ]
|
||||
endif
|
||||
if build_egl
|
||||
epoxy_deps += [ elg_headers_dep, ]
|
||||
endif
|
||||
|
||||
libepoxy = library(
|
||||
'epoxy',
|
||||
sources: epoxy_sources + epoxy_headers,
|
||||
version: '0.0.0',
|
||||
darwin_versions: darwin_versions,
|
||||
install: true,
|
||||
dependencies: epoxy_deps,
|
||||
include_directories: libepoxy_inc,
|
||||
c_args: common_cflags + visibility_cflags,
|
||||
link_args: common_ldflags,
|
||||
)
|
||||
|
||||
epoxy_has_glx = build_glx ? '1' : '0'
|
||||
epoxy_has_egl = build_egl ? '1' : '0'
|
||||
epoxy_has_wgl = build_wgl ? '1' : '0'
|
||||
|
||||
libepoxy_dep = declare_dependency(
|
||||
link_with: libepoxy,
|
||||
include_directories: libepoxy_inc,
|
||||
dependencies: epoxy_deps,
|
||||
sources: epoxy_headers,
|
||||
variables: {
|
||||
'epoxy_has_glx': epoxy_has_glx,
|
||||
'epoxy_has_egl': epoxy_has_egl,
|
||||
'epoxy_has_wgl': epoxy_has_wgl,
|
||||
},
|
||||
)
|
||||
|
||||
# We don't want to add these dependencies to the library, as they are
|
||||
# not needed when building Epoxy; we do want to add them to the generated
|
||||
# pkg-config file, for consumers of Epoxy
|
||||
gl_reqs = []
|
||||
if gl_dep.found() and gl_dep.type_name() == 'pkgconfig'
|
||||
gl_reqs += 'gl'
|
||||
endif
|
||||
if build_egl and egl_dep.found() and egl_dep.type_name() == 'pkgconfig'
|
||||
gl_reqs += 'egl'
|
||||
endif
|
||||
|
||||
pkg = import('pkgconfig')
|
||||
pkg.generate(
|
||||
libraries: libepoxy,
|
||||
name: 'epoxy',
|
||||
description: 'GL dispatch library',
|
||||
version: meson.project_version(),
|
||||
variables: [
|
||||
'epoxy_has_glx=@0@'.format(epoxy_has_glx),
|
||||
'epoxy_has_egl=@0@'.format(epoxy_has_egl),
|
||||
'epoxy_has_wgl=@0@'.format(epoxy_has_wgl),
|
||||
],
|
||||
filebase: 'epoxy',
|
||||
requires_private: ' '.join(gl_reqs),
|
||||
)
|
||||
@@ -1,54 +0,0 @@
|
||||
/* This is a copy of the test used by HomeBrew's libepoxy recipe,
|
||||
* originally written by Mikko Lehtonen.
|
||||
*
|
||||
* The Homebrew recipe is released under the BSD 2-Clause license.
|
||||
*
|
||||
* Copyright (c) 2009-present, Homebrew contributors
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <epoxy/gl.h>
|
||||
#include <Carbon/Carbon.h>
|
||||
#include <OpenGL/OpenGL.h>
|
||||
#include <OpenGL/CGLTypes.h>
|
||||
#include <OpenGL/CGLCurrent.h>
|
||||
#include <OpenGL/CGLContext.h>
|
||||
|
||||
int
|
||||
main (void)
|
||||
{
|
||||
CGLPixelFormatAttribute attribs[] = {0};
|
||||
CGLPixelFormatObj pix;
|
||||
CGLContextObj ctx;
|
||||
int npix;
|
||||
|
||||
CGLChoosePixelFormat(attribs, &pix, &npix);
|
||||
CGLCreateContext(pix, (void *) 0, &ctx);
|
||||
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
|
||||
CGLReleaseContext(ctx);
|
||||
CGLReleasePixelFormat(pix);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -1,83 +0,0 @@
|
||||
/*
|
||||
* Copyright 2018 Emmanuele Bassi
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
* IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file cgl_epoxy_api.c
|
||||
*
|
||||
* Tests the Epoxy API using the CoreGraphics OpenGL framework.
|
||||
*/
|
||||
|
||||
#include <epoxy/gl.h>
|
||||
#include <Carbon/Carbon.h>
|
||||
#include <OpenGL/OpenGL.h>
|
||||
#include <OpenGL/CGLTypes.h>
|
||||
#include <OpenGL/CGLCurrent.h>
|
||||
#include <OpenGL/CGLContext.h>
|
||||
|
||||
int
|
||||
main (void)
|
||||
{
|
||||
CGLPixelFormatAttribute attribs[] = {0};
|
||||
CGLPixelFormatObj pix;
|
||||
CGLContextObj ctx;
|
||||
const char *string;
|
||||
bool pass = true;
|
||||
int npix;
|
||||
GLint shader;
|
||||
|
||||
CGLChoosePixelFormat(attribs, &pix, &npix);
|
||||
CGLCreateContext(pix, (void *) 0, &ctx);
|
||||
CGLSetCurrentContext(ctx);
|
||||
|
||||
if (!epoxy_is_desktop_gl()) {
|
||||
fputs("Claimed not to be desktop\n", stderr);
|
||||
pass = false;
|
||||
}
|
||||
|
||||
if (epoxy_gl_version() < 20) {
|
||||
fprintf(stderr, "Claimed to be GL version %d\n",
|
||||
epoxy_gl_version());
|
||||
pass = false;
|
||||
}
|
||||
|
||||
if (epoxy_glsl_version() < 100) {
|
||||
fprintf(stderr, "Claimed to have GLSL version %d\n",
|
||||
epoxy_glsl_version());
|
||||
pass = false;
|
||||
}
|
||||
|
||||
string = (const char *)glGetString(GL_VERSION);
|
||||
printf("GL version: %s - Epoxy: %d\n", string, epoxy_gl_version());
|
||||
|
||||
string = (const char *)glGetString(GL_SHADING_LANGUAGE_VERSION);
|
||||
printf("GLSL version: %s - Epoxy: %d\n", string, epoxy_glsl_version());
|
||||
|
||||
shader = glCreateShader(GL_FRAGMENT_SHADER);
|
||||
pass = glIsShader(shader);
|
||||
|
||||
CGLSetCurrentContext(NULL);
|
||||
CGLReleaseContext(ctx);
|
||||
CGLReleasePixelFormat(pix);
|
||||
|
||||
return pass != true;
|
||||
}
|
||||
@@ -1,325 +0,0 @@
|
||||
/* Copyright © 2013, Intel Corporation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/** @file dlwrap.c
|
||||
*
|
||||
* Implements a wrapper for dlopen() and dlsym() so that epoxy will
|
||||
* end up finding symbols from the testcases named
|
||||
* "override_EGL_eglWhatever()" or "override_GLES2_glWhatever()" or
|
||||
* "override_GL_glWhatever()" when it tries to dlopen() and dlsym()
|
||||
* the real GL or EGL functions in question.
|
||||
*
|
||||
* This lets us simulate some target systems in the test suite, or
|
||||
* just stub out GL functions so we can be sure of what's being
|
||||
* called.
|
||||
*/
|
||||
|
||||
/* dladdr is a glibc extension */
|
||||
#define _GNU_SOURCE
|
||||
#include <dlfcn.h>
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include "dlwrap.h"
|
||||
|
||||
#define STRNCMP_LITERAL(var, literal) \
|
||||
strncmp ((var), (literal), sizeof (literal) - 1)
|
||||
|
||||
#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof(arr[0]))
|
||||
|
||||
void *libfips_handle;
|
||||
|
||||
typedef void *(*fips_dlopen_t)(const char *filename, int flag);
|
||||
typedef void *(*fips_dlsym_t)(void *handle, const char *symbol);
|
||||
|
||||
void *override_EGL_eglGetProcAddress(const char *name);
|
||||
void *override_GL_glXGetProcAddress(const char *name);
|
||||
void *override_GL_glXGetProcAddressARB(const char *name);
|
||||
void __dlclose(void *handle);
|
||||
|
||||
static struct libwrap {
|
||||
const char *filename;
|
||||
const char *symbol_prefix;
|
||||
void *handle;
|
||||
} wrapped_libs[] = {
|
||||
{ "libGL.so", "GL", NULL },
|
||||
{ "libEGL.so", "EGL", NULL },
|
||||
{ "libGLESv2.so", "GLES2", NULL },
|
||||
{ "libOpenGL.so", "GL", NULL},
|
||||
};
|
||||
|
||||
/* Match 'filename' against an internal list of libraries for which
|
||||
* libfips has wrappers.
|
||||
*
|
||||
* Returns true and sets *index_ret if a match is found.
|
||||
* Returns false if no match is found. */
|
||||
static struct libwrap *
|
||||
find_wrapped_library(const char *filename)
|
||||
{
|
||||
unsigned i;
|
||||
|
||||
if (!filename)
|
||||
return NULL;
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(wrapped_libs); i++) {
|
||||
if (strncmp(wrapped_libs[i].filename, filename,
|
||||
strlen(wrapped_libs[i].filename)) == 0) {
|
||||
return &wrapped_libs[i];
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Many (most?) OpenGL programs dlopen libGL.so.1 rather than linking
|
||||
* against it directly, which means they would not be seeing our
|
||||
* wrapped GL symbols via LD_PRELOAD. So we catch the dlopen in a
|
||||
* wrapper here and redirect it to our library.
|
||||
*/
|
||||
void *
|
||||
dlopen(const char *filename, int flag)
|
||||
{
|
||||
void *ret;
|
||||
struct libwrap *wrap;
|
||||
|
||||
/* Before deciding whether to redirect this dlopen to our own
|
||||
* library, we call the real dlopen. This assures that any
|
||||
* expected side-effects from loading the intended library are
|
||||
* resolved. Below, we may still return a handle pointing to
|
||||
* our own library, and not what is opened here. */
|
||||
ret = dlwrap_real_dlopen(filename, flag);
|
||||
|
||||
/* If filename is not a wrapped library, just return real dlopen */
|
||||
wrap = find_wrapped_library(filename);
|
||||
if (!wrap)
|
||||
return ret;
|
||||
|
||||
wrap->handle = ret;
|
||||
|
||||
/* We use wrapped_libs as our handles to libraries. */
|
||||
return wrap;
|
||||
}
|
||||
|
||||
/**
|
||||
* Wraps dlclose to hide our faked handles from it.
|
||||
*/
|
||||
void
|
||||
__dlclose(void *handle)
|
||||
{
|
||||
struct libwrap *wrap = handle;
|
||||
|
||||
if (wrap < wrapped_libs ||
|
||||
wrap >= wrapped_libs + ARRAY_SIZE(wrapped_libs)) {
|
||||
void (*real_dlclose)(void *handle) = dlwrap_real_dlsym(RTLD_NEXT, "__dlclose");
|
||||
real_dlclose(handle);
|
||||
}
|
||||
}
|
||||
|
||||
void *
|
||||
dlwrap_real_dlopen(const char *filename, int flag)
|
||||
{
|
||||
static fips_dlopen_t real_dlopen = NULL;
|
||||
|
||||
if (!real_dlopen) {
|
||||
real_dlopen = (fips_dlopen_t) dlwrap_real_dlsym(RTLD_NEXT, "dlopen");
|
||||
if (!real_dlopen) {
|
||||
fputs("Error: Failed to find symbol for dlopen.\n", stderr);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
return real_dlopen(filename, flag);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the dlsym() on the application's namespace for
|
||||
* "override_<prefix>_<name>"
|
||||
*/
|
||||
static void *
|
||||
wrapped_dlsym(const char *prefix, const char *name)
|
||||
{
|
||||
char *wrap_name;
|
||||
void *symbol;
|
||||
|
||||
if (asprintf(&wrap_name, "override_%s_%s", prefix, name) < 0) {
|
||||
fputs("Error: Failed to allocate memory.\n", stderr);
|
||||
abort();
|
||||
}
|
||||
|
||||
symbol = dlwrap_real_dlsym(RTLD_DEFAULT, wrap_name);
|
||||
free(wrap_name);
|
||||
return symbol;
|
||||
}
|
||||
|
||||
/* Since we redirect dlopens of libGL.so and libEGL.so to libfips we
|
||||
* need to ensure that dlysm succeeds for all functions that might be
|
||||
* defined in the real, underlying libGL library. But we're far too
|
||||
* lazy to implement wrappers for function that would simply
|
||||
* pass-through, so instead we also wrap dlysm and arrange for it to
|
||||
* pass things through with RTLD_next if libfips does not have the
|
||||
* function desired. */
|
||||
void *
|
||||
dlsym(void *handle, const char *name)
|
||||
{
|
||||
struct libwrap *wrap = handle;
|
||||
|
||||
/* Make sure that handle is actually one of our wrapped libs. */
|
||||
if (wrap < wrapped_libs ||
|
||||
wrap >= wrapped_libs + ARRAY_SIZE(wrapped_libs)) {
|
||||
wrap = NULL;
|
||||
}
|
||||
|
||||
/* Failing that, anything specifically requested from the
|
||||
* libfips library should be redirected to a real GL
|
||||
* library. */
|
||||
|
||||
if (wrap) {
|
||||
void *symbol = wrapped_dlsym(wrap->symbol_prefix, name);
|
||||
if (symbol)
|
||||
return symbol;
|
||||
else
|
||||
return dlwrap_real_dlsym(wrap->handle, name);
|
||||
}
|
||||
|
||||
/* And anything else is some unrelated dlsym. Just pass it
|
||||
* through. (This also covers the cases of lookups with
|
||||
* special handles such as RTLD_DEFAULT or RTLD_NEXT.)
|
||||
*/
|
||||
return dlwrap_real_dlsym(handle, name);
|
||||
}
|
||||
|
||||
void *
|
||||
dlwrap_real_dlsym(void *handle, const char *name)
|
||||
{
|
||||
static fips_dlsym_t real_dlsym = NULL;
|
||||
|
||||
if (!real_dlsym) {
|
||||
/* FIXME: This brute-force, hard-coded searching for a versioned
|
||||
* symbol is really ugly. The only reason I'm doing this is because
|
||||
* I need some way to lookup the "dlsym" function in libdl, but
|
||||
* I can't use 'dlsym' to do it. So dlvsym works, but forces me
|
||||
* to guess what the right version is.
|
||||
*
|
||||
* Potential fixes here:
|
||||
*
|
||||
* 1. Use libelf to actually inspect libdl.so and
|
||||
* find the right version, (finding the right
|
||||
* libdl.so can be made easier with
|
||||
* dl_iterate_phdr).
|
||||
*
|
||||
* 2. Use libelf to find the offset of the 'dlsym'
|
||||
* symbol within libdl.so, (and then add this to
|
||||
* the base address at which libdl.so is loaded
|
||||
* as reported by dl_iterate_phdr).
|
||||
*
|
||||
* In the meantime, I'll just keep augmenting this
|
||||
* hard-coded version list as people report bugs. */
|
||||
const char *version[] = {
|
||||
"GLIBC_2.17",
|
||||
"GLIBC_2.4",
|
||||
"GLIBC_2.3",
|
||||
"GLIBC_2.2.5",
|
||||
"GLIBC_2.2",
|
||||
"GLIBC_2.0",
|
||||
"FBSD_1.0"
|
||||
};
|
||||
int num_versions = sizeof(version) / sizeof(version[0]);
|
||||
int i;
|
||||
for (i = 0; i < num_versions; i++) {
|
||||
real_dlsym = (fips_dlsym_t) dlvsym(RTLD_NEXT, "dlsym", version[i]);
|
||||
if (real_dlsym)
|
||||
break;
|
||||
}
|
||||
if (i == num_versions) {
|
||||
fputs("Internal error: Failed to find real dlsym\n", stderr);
|
||||
fputs("This may be a simple matter of fips not knowing about the version of GLIBC that\n"
|
||||
"your program is using. Current known versions are:\n\n\t",
|
||||
stderr);
|
||||
for (i = 0; i < num_versions; i++)
|
||||
fprintf(stderr, "%s ", version[i]);
|
||||
fputs("\n\nYou can inspect your version by first finding libdl.so.2:\n"
|
||||
"\n"
|
||||
"\tldd <your-program> | grep libdl.so\n"
|
||||
"\n"
|
||||
"And then inspecting the version attached to the dlsym symbol:\n"
|
||||
"\n"
|
||||
"\treadelf -s /path/to/libdl.so.2 | grep dlsym\n"
|
||||
"\n"
|
||||
"And finally, adding the version to dlwrap.c:dlwrap_real_dlsym.\n",
|
||||
stderr);
|
||||
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
return real_dlsym(handle, name);
|
||||
}
|
||||
|
||||
void *
|
||||
override_GL_glXGetProcAddress(const char *name)
|
||||
{
|
||||
void *symbol;
|
||||
|
||||
symbol = wrapped_dlsym("GL", name);
|
||||
if (symbol)
|
||||
return symbol;
|
||||
|
||||
return DEFER_TO_GL("libGL.so.1", override_GL_glXGetProcAddress,
|
||||
"glXGetProcAddress", (name));
|
||||
}
|
||||
|
||||
void *
|
||||
override_GL_glXGetProcAddressARB(const char *name)
|
||||
{
|
||||
void *symbol;
|
||||
|
||||
symbol = wrapped_dlsym("GL", name);
|
||||
if (symbol)
|
||||
return symbol;
|
||||
|
||||
return DEFER_TO_GL("libGL.so.1", override_GL_glXGetProcAddressARB,
|
||||
"glXGetProcAddressARB", (name));
|
||||
}
|
||||
|
||||
void *
|
||||
override_EGL_eglGetProcAddress(const char *name)
|
||||
{
|
||||
void *symbol;
|
||||
|
||||
if (!STRNCMP_LITERAL(name, "gl")) {
|
||||
symbol = wrapped_dlsym("GLES2", name);
|
||||
if (symbol)
|
||||
return symbol;
|
||||
}
|
||||
|
||||
if (!STRNCMP_LITERAL(name, "egl")) {
|
||||
symbol = wrapped_dlsym("EGL", name);
|
||||
if (symbol)
|
||||
return symbol;
|
||||
}
|
||||
|
||||
return DEFER_TO_GL("libEGL.so.1", override_EGL_eglGetProcAddress,
|
||||
"eglGetProcAddress", (name));
|
||||
}
|
||||
@@ -1,67 +0,0 @@
|
||||
/* Copyright © 2013, Intel Corporation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef DLWRAP_H
|
||||
#define DLWRAP_H
|
||||
|
||||
#define _GNU_SOURCE
|
||||
#include <dlfcn.h>
|
||||
|
||||
/* Call the *real* dlopen. We have our own wrapper for dlopen that, of
|
||||
* necessity must use claim the symbol 'dlopen'. So whenever anything
|
||||
* internal needs to call the real, underlying dlopen function, the
|
||||
* thing to call is dlwrap_real_dlopen.
|
||||
*/
|
||||
void *
|
||||
dlwrap_real_dlopen(const char *filename, int flag);
|
||||
|
||||
/* Perform a dlopen on the libfips library itself.
|
||||
*
|
||||
* Many places in fips need to lookup symbols within the libfips
|
||||
* library itself, (and not in any other library). This function
|
||||
* provides a reliable way to get a handle for performing such
|
||||
* lookups.
|
||||
*
|
||||
* The returned handle can be passed to dlwrap_real_dlsym for the
|
||||
* lookups. */
|
||||
void *
|
||||
dlwrap_dlopen_libfips(void);
|
||||
|
||||
/* Call the *real* dlsym. We have our own wrapper for dlsym that, of
|
||||
* necessity must use claim the symbol 'dlsym'. So whenever anything
|
||||
* internal needs to call the real, underlying dlysm function, the
|
||||
* thing to call is dlwrap_real_dlsym.
|
||||
*/
|
||||
void *
|
||||
dlwrap_real_dlsym(void *handle, const char *symbol);
|
||||
|
||||
#define DEFER_TO_GL(library, func, name, args) \
|
||||
({ \
|
||||
void *lib = dlwrap_real_dlopen(library, RTLD_LAZY | RTLD_LOCAL); \
|
||||
typeof(&func) real_func = dlwrap_real_dlsym(lib, name); \
|
||||
/* gcc extension -- func's return value is the return value of \
|
||||
* the statement. \
|
||||
*/ \
|
||||
real_func args; \
|
||||
})
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,54 +0,0 @@
|
||||
/*
|
||||
* Copyright © 2013 Intel Corporation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
* IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <err.h>
|
||||
#include <epoxy/egl.h>
|
||||
#include <X11/Xlib.h>
|
||||
#include "egl_common.h"
|
||||
|
||||
/**
|
||||
* Do whatever it takes to get us an EGL display for the system.
|
||||
*
|
||||
* This needs to be ported to other window systems.
|
||||
*/
|
||||
EGLDisplay *
|
||||
get_egl_display_or_skip(void)
|
||||
{
|
||||
Display *dpy = XOpenDisplay(NULL);
|
||||
EGLint major, minor;
|
||||
EGLDisplay *edpy;
|
||||
bool ok;
|
||||
|
||||
if (!dpy)
|
||||
errx(77, "couldn't open display\n");
|
||||
|
||||
edpy = eglGetDisplay(dpy);
|
||||
if (!edpy)
|
||||
errx(1, "Couldn't get EGL display for X11 Display.\n");
|
||||
|
||||
ok = eglInitialize(edpy, &major, &minor);
|
||||
if (!ok)
|
||||
errx(1, "eglInitialize() failed\n");
|
||||
|
||||
return edpy;
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
/*
|
||||
* Copyright © 2013 Intel Corporation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
* IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
EGLDisplay *
|
||||
get_egl_display_or_skip(void);
|
||||
@@ -1,148 +0,0 @@
|
||||
/*
|
||||
* Copyright 2018 Emmanuele Bassi
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
* IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file epoxy_api.c
|
||||
*
|
||||
* Tests the Epoxy API using EGL.
|
||||
*/
|
||||
|
||||
#ifdef __sun
|
||||
#define __EXTENSIONS__
|
||||
#else
|
||||
#define _GNU_SOURCE
|
||||
#endif
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <assert.h>
|
||||
#include <err.h>
|
||||
#include "epoxy/gl.h"
|
||||
#include "epoxy/egl.h"
|
||||
|
||||
#include "egl_common.h"
|
||||
|
||||
static bool
|
||||
make_egl_current_and_test(EGLDisplay *dpy, EGLContext ctx)
|
||||
{
|
||||
const char *string;
|
||||
GLuint shader;
|
||||
bool pass = true;
|
||||
|
||||
eglMakeCurrent(dpy, NULL, NULL, ctx);
|
||||
|
||||
if (!epoxy_is_desktop_gl()) {
|
||||
fputs("Claimed to be desktop\n", stderr);
|
||||
pass = false;
|
||||
}
|
||||
|
||||
if (epoxy_gl_version() < 20) {
|
||||
fprintf(stderr, "Claimed to be GL version %d\n",
|
||||
epoxy_gl_version());
|
||||
pass = false;
|
||||
}
|
||||
|
||||
if (epoxy_glsl_version() < 100) {
|
||||
fprintf(stderr, "Claimed to have GLSL version %d\n",
|
||||
epoxy_glsl_version());
|
||||
pass = false;
|
||||
}
|
||||
|
||||
string = (const char *)glGetString(GL_VERSION);
|
||||
printf("GL version: %s - Epoxy: %d\n", string, epoxy_gl_version());
|
||||
|
||||
string = (const char *)glGetString(GL_SHADING_LANGUAGE_VERSION);
|
||||
printf("GLSL version: %s - Epoxy: %d\n", string, epoxy_glsl_version());
|
||||
|
||||
shader = glCreateShader(GL_FRAGMENT_SHADER);
|
||||
pass = glIsShader(shader);
|
||||
|
||||
return pass;
|
||||
}
|
||||
|
||||
static void
|
||||
init_egl(EGLDisplay *dpy, EGLContext *out_ctx)
|
||||
{
|
||||
static const EGLint config_attribs[] = {
|
||||
EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
|
||||
EGL_RED_SIZE, 1,
|
||||
EGL_GREEN_SIZE, 1,
|
||||
EGL_BLUE_SIZE, 1,
|
||||
EGL_RENDERABLE_TYPE, EGL_OPENGL_BIT,
|
||||
EGL_NONE
|
||||
};
|
||||
static const EGLint context_attribs[] = {
|
||||
EGL_CONTEXT_CLIENT_VERSION, 2,
|
||||
EGL_NONE
|
||||
};
|
||||
EGLContext ctx;
|
||||
EGLConfig cfg;
|
||||
EGLint count;
|
||||
|
||||
if (!epoxy_has_egl_extension(dpy, "EGL_KHR_surfaceless_context"))
|
||||
errx(77, "Test requires EGL_KHR_surfaceless_context");
|
||||
|
||||
if (!eglBindAPI(EGL_OPENGL_API))
|
||||
errx(77, "Couldn't initialize EGL with desktop GL\n");
|
||||
|
||||
if (!eglChooseConfig(dpy, config_attribs, &cfg, 1, &count))
|
||||
errx(77, "Couldn't get an EGLConfig\n");
|
||||
|
||||
ctx = eglCreateContext(dpy, cfg, NULL, context_attribs);
|
||||
if (!ctx)
|
||||
errx(77, "Couldn't create a GL context\n");
|
||||
|
||||
*out_ctx = ctx;
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
bool pass = true;
|
||||
|
||||
EGLContext egl_ctx;
|
||||
EGLDisplay *dpy = get_egl_display_or_skip();
|
||||
const char *extensions = eglQueryString(dpy, EGL_EXTENSIONS);
|
||||
char *first_space;
|
||||
char *an_extension;
|
||||
|
||||
/* We don't have any extensions guaranteed by the ABI, so for the
|
||||
* touch test we just check if the first one is reported to be there.
|
||||
*/
|
||||
first_space = strstr(extensions, " ");
|
||||
if (first_space) {
|
||||
an_extension = strndup(extensions, first_space - extensions);
|
||||
} else {
|
||||
an_extension = strdup(extensions);
|
||||
}
|
||||
|
||||
if (!epoxy_extension_in_string(extensions, an_extension))
|
||||
errx(1, "Implementation reported absence of %s", an_extension);
|
||||
|
||||
free(an_extension);
|
||||
|
||||
init_egl(dpy, &egl_ctx);
|
||||
pass = make_egl_current_and_test(dpy, egl_ctx);
|
||||
|
||||
return pass != true;
|
||||
}
|
||||
@@ -1,130 +0,0 @@
|
||||
/*
|
||||
* Copyright © 2014 Intel Corporation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
* IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file egl_gl.c
|
||||
*
|
||||
* Tests that epoxy works with EGL using desktop OpenGL.
|
||||
*/
|
||||
|
||||
#define _GNU_SOURCE
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <assert.h>
|
||||
#include <err.h>
|
||||
#include <dlfcn.h>
|
||||
#include "epoxy/gl.h"
|
||||
#include "epoxy/egl.h"
|
||||
#include "epoxy/glx.h"
|
||||
|
||||
#include "egl_common.h"
|
||||
#include "glx_common.h"
|
||||
#include "dlwrap.h"
|
||||
|
||||
static bool
|
||||
make_egl_current_and_test(EGLDisplay *dpy, EGLContext ctx)
|
||||
{
|
||||
const char *string;
|
||||
GLuint shader;
|
||||
bool pass = true;
|
||||
|
||||
eglMakeCurrent(dpy, NULL, NULL, ctx);
|
||||
|
||||
if (!epoxy_is_desktop_gl()) {
|
||||
fputs("Claimed to be desktop\n", stderr);
|
||||
pass = false;
|
||||
}
|
||||
|
||||
if (epoxy_gl_version() < 20) {
|
||||
fprintf(stderr, "Claimed to be GL version %d\n",
|
||||
epoxy_gl_version());
|
||||
pass = false;
|
||||
}
|
||||
|
||||
string = (const char *)glGetString(GL_VERSION);
|
||||
printf("GL version: %s\n", string);
|
||||
|
||||
shader = glCreateShader(GL_FRAGMENT_SHADER);
|
||||
pass = glIsShader(shader);
|
||||
|
||||
return pass;
|
||||
}
|
||||
|
||||
static void
|
||||
init_egl(EGLDisplay **out_dpy, EGLContext *out_ctx)
|
||||
{
|
||||
EGLDisplay *dpy = get_egl_display_or_skip();
|
||||
static const EGLint config_attribs[] = {
|
||||
EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
|
||||
EGL_RED_SIZE, 1,
|
||||
EGL_GREEN_SIZE, 1,
|
||||
EGL_BLUE_SIZE, 1,
|
||||
EGL_RENDERABLE_TYPE, EGL_OPENGL_BIT,
|
||||
EGL_NONE
|
||||
};
|
||||
static const EGLint context_attribs[] = {
|
||||
EGL_CONTEXT_CLIENT_VERSION, 2,
|
||||
EGL_NONE
|
||||
};
|
||||
EGLContext ctx;
|
||||
EGLConfig cfg;
|
||||
EGLint count;
|
||||
|
||||
if (!epoxy_has_egl_extension(dpy, "EGL_KHR_surfaceless_context"))
|
||||
errx(77, "Test requires EGL_KHR_surfaceless_context");
|
||||
|
||||
if (!eglBindAPI(EGL_OPENGL_API))
|
||||
errx(77, "Couldn't initialize EGL with desktop GL\n");
|
||||
|
||||
if (!eglChooseConfig(dpy, config_attribs, &cfg, 1, &count))
|
||||
errx(77, "Couldn't get an EGLConfig\n");
|
||||
|
||||
ctx = eglCreateContext(dpy, cfg, NULL, context_attribs);
|
||||
if (!ctx)
|
||||
errx(77, "Couldn't create a GL context\n");
|
||||
|
||||
*out_dpy = dpy;
|
||||
*out_ctx = ctx;
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
bool pass = true;
|
||||
EGLDisplay *egl_dpy;
|
||||
EGLContext egl_ctx;
|
||||
|
||||
/* Force epoxy to have loaded both EGL and GLX libs already -- we
|
||||
* can't assume anything about symbol resolution based on having
|
||||
* EGL or GLX loaded.
|
||||
*/
|
||||
(void)glXGetCurrentContext();
|
||||
(void)eglGetCurrentContext();
|
||||
|
||||
init_egl(&egl_dpy, &egl_ctx);
|
||||
pass = make_egl_current_and_test(egl_dpy, egl_ctx) && pass;
|
||||
|
||||
return pass != true;
|
||||
}
|
||||
@@ -1,75 +0,0 @@
|
||||
/*
|
||||
* Copyright © 2013 Intel Corporation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
* IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file egl_has_extension_nocontext.c
|
||||
*
|
||||
* Catches a bug in early development where eglGetProcAddress() with
|
||||
* no context bound would fail out in dispatch.
|
||||
*/
|
||||
|
||||
#ifdef __sun
|
||||
#define __EXTENSIONS__
|
||||
#else
|
||||
#define _GNU_SOURCE
|
||||
#endif
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <assert.h>
|
||||
#include <err.h>
|
||||
#include "epoxy/gl.h"
|
||||
#include "epoxy/egl.h"
|
||||
|
||||
#include "egl_common.h"
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
bool pass = true;
|
||||
|
||||
EGLDisplay *dpy = get_egl_display_or_skip();
|
||||
const char *extensions = eglQueryString(dpy, EGL_EXTENSIONS);
|
||||
char *first_space;
|
||||
char *an_extension;
|
||||
|
||||
/* We don't have any extensions guaranteed by the ABI, so for the
|
||||
* touch test we just check if the first one is reported to be there.
|
||||
*/
|
||||
first_space = strstr(extensions, " ");
|
||||
if (first_space) {
|
||||
an_extension = strndup(extensions, first_space - extensions);
|
||||
} else {
|
||||
an_extension = strdup(extensions);
|
||||
}
|
||||
|
||||
if (!epoxy_has_egl_extension(dpy, an_extension))
|
||||
errx(1, "Implementation reported absence of %s", an_extension);
|
||||
|
||||
free(an_extension);
|
||||
|
||||
if (epoxy_has_egl_extension(dpy, "GLX_ARB_ham_sandwich"))
|
||||
errx(1, "Implementation reported presence of GLX_ARB_ham_sandwich");
|
||||
|
||||
return pass != true;
|
||||
}
|
||||
@@ -1,165 +0,0 @@
|
||||
/*
|
||||
* Copyright © 2014 Intel Corporation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
* IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file egl_without_glx.c
|
||||
*
|
||||
* Tries to test operation of the library on a GL stack with EGL and
|
||||
* GLES but no GLX or desktop GL (such as Arm's Mali GLES3 drivers).
|
||||
* This test is varied by the GLES_VERSION defined at compile time to
|
||||
* test either a GLES1-only or a GLES2-only system.
|
||||
*/
|
||||
|
||||
#define _GNU_SOURCE
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <assert.h>
|
||||
#include <err.h>
|
||||
#include <dlfcn.h>
|
||||
#include "epoxy/gl.h"
|
||||
#include "epoxy/egl.h"
|
||||
|
||||
#include "egl_common.h"
|
||||
|
||||
/**
|
||||
* Wraps the system dlopen(), which libepoxy will end up calling when
|
||||
* it tries to dlopen() the API libraries, and errors out the
|
||||
* libraries we're trying to simulate not being installed on the
|
||||
* system.
|
||||
*/
|
||||
void *
|
||||
dlopen(const char *filename, int flag)
|
||||
{
|
||||
void * (*dlopen_unwrapped)(const char *filename, int flag);
|
||||
|
||||
if (filename) {
|
||||
if (!strcmp(filename, "libGL.so.1"))
|
||||
return NULL;
|
||||
#if GLES_VERSION == 2
|
||||
if (!strcmp(filename, "libGLESv1_CM.so.1"))
|
||||
return NULL;
|
||||
#else
|
||||
if (!strcmp(filename, "libGLESv2.so.2"))
|
||||
return NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
dlopen_unwrapped = dlsym(RTLD_NEXT, "dlopen");
|
||||
assert(dlopen_unwrapped);
|
||||
|
||||
return dlopen_unwrapped(filename, flag);
|
||||
}
|
||||
|
||||
|
||||
static EGLenum last_api;
|
||||
static EGLenum extra_error = EGL_SUCCESS;
|
||||
|
||||
/**
|
||||
* Override of the real libEGL's eglBindAPI to simulate the target
|
||||
* system's eglBindAPI.
|
||||
*/
|
||||
static EGLBoolean
|
||||
override_eglBindAPI(EGLenum api)
|
||||
{
|
||||
void *egl = dlopen("libEGL.so.1", RTLD_LAZY | RTLD_LOCAL);
|
||||
EGLBoolean (*real_eglBindAPI)(EGLenum api) = dlsym(egl, "eglBindAPI");
|
||||
|
||||
last_api = api;
|
||||
|
||||
if (api == EGL_OPENGL_API) {
|
||||
extra_error = EGL_BAD_PARAMETER;
|
||||
return EGL_FALSE;
|
||||
}
|
||||
|
||||
assert(real_eglBindAPI);
|
||||
return real_eglBindAPI(api);
|
||||
}
|
||||
|
||||
/**
|
||||
* Override of the real libEGL's eglGetError() to feed back the error
|
||||
* that might have been generated by override_eglBindAPI().
|
||||
*/
|
||||
static EGLint
|
||||
override_eglGetError(void)
|
||||
{
|
||||
void *egl = dlopen("libEGL.so.1", RTLD_LAZY | RTLD_LOCAL);
|
||||
EGLint (*real_eglGetError)(void) = dlsym(egl, "eglGetError");
|
||||
|
||||
if (extra_error != EGL_SUCCESS) {
|
||||
EGLenum error = extra_error;
|
||||
extra_error = EGL_SUCCESS;
|
||||
return error;
|
||||
}
|
||||
|
||||
assert(real_eglGetError);
|
||||
return real_eglGetError();
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
bool pass = true;
|
||||
EGLDisplay *dpy = get_egl_display_or_skip();
|
||||
EGLint context_attribs[] = {
|
||||
EGL_CONTEXT_CLIENT_VERSION, GLES_VERSION,
|
||||
EGL_NONE
|
||||
};
|
||||
EGLConfig cfg;
|
||||
EGLint config_attribs[] = {
|
||||
EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
|
||||
EGL_RED_SIZE, 1,
|
||||
EGL_GREEN_SIZE, 1,
|
||||
EGL_BLUE_SIZE, 1,
|
||||
EGL_RENDERABLE_TYPE, EGL_OPENGL_BIT,
|
||||
EGL_NONE
|
||||
};
|
||||
EGLint count;
|
||||
EGLContext ctx;
|
||||
const unsigned char *string;
|
||||
|
||||
epoxy_eglBindAPI = override_eglBindAPI;
|
||||
epoxy_eglGetError = override_eglGetError;
|
||||
|
||||
if (!epoxy_has_egl_extension(dpy, "EGL_KHR_surfaceless_context"))
|
||||
errx(77, "Test requires EGL_KHR_surfaceless_context");
|
||||
|
||||
eglBindAPI(EGL_OPENGL_ES_API);
|
||||
|
||||
if (!eglChooseConfig(dpy, config_attribs, &cfg, 1, &count))
|
||||
errx(77, "Couldn't get an EGLConfig\n");
|
||||
|
||||
ctx = eglCreateContext(dpy, cfg, NULL, context_attribs);
|
||||
if (!ctx)
|
||||
errx(77, "Couldn't create a GLES%d context\n", GLES_VERSION);
|
||||
|
||||
eglMakeCurrent(dpy, NULL, NULL, ctx);
|
||||
|
||||
string = glGetString(GL_VERSION);
|
||||
printf("GL_VERSION: %s\n", string);
|
||||
|
||||
assert(eglGetError() == EGL_SUCCESS);
|
||||
|
||||
return pass != true;
|
||||
}
|
||||
@@ -1,91 +0,0 @@
|
||||
/*
|
||||
* Copyright © 2018 Broadcom
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
* IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <assert.h>
|
||||
#include "epoxy/gl.h"
|
||||
|
||||
GLenum mock_enum;
|
||||
const char *mock_gl_version;
|
||||
const char *mock_glsl_version;
|
||||
|
||||
static const GLubyte * EPOXY_CALLSPEC override_glGetString(GLenum name)
|
||||
{
|
||||
switch (name) {
|
||||
case GL_VERSION:
|
||||
return (GLubyte *)mock_gl_version;
|
||||
case GL_SHADING_LANGUAGE_VERSION:
|
||||
return (GLubyte *)mock_glsl_version;
|
||||
default:
|
||||
assert(!"unexpected glGetString() enum");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
static bool
|
||||
test_version(const char *gl_string, int gl_version,
|
||||
const char *glsl_string, int glsl_version)
|
||||
{
|
||||
int epoxy_version;
|
||||
|
||||
mock_gl_version = gl_string;
|
||||
mock_glsl_version = glsl_string;
|
||||
|
||||
epoxy_version = epoxy_gl_version();
|
||||
if (epoxy_version != gl_version) {
|
||||
fprintf(stderr,
|
||||
"glGetString(GL_VERSION) = \"%s\" returned epoxy_gl_version() "
|
||||
"%d instead of %d\n", gl_string, epoxy_version, gl_version);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
epoxy_version = epoxy_glsl_version();
|
||||
if (epoxy_version != glsl_version) {
|
||||
fprintf(stderr,
|
||||
"glGetString() = \"%s\" returned epoxy_glsl_version() "
|
||||
"%d instead of %d\n", glsl_string, epoxy_version, glsl_version);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
bool pass = true;
|
||||
|
||||
epoxy_glGetString = override_glGetString;
|
||||
|
||||
pass = pass && test_version("3.0 Mesa 13.0.6", 30,
|
||||
"1.30", 130);
|
||||
pass = pass && test_version("OpenGL ES 2.0 Mesa 20.1.0-devel (git-4bb19a330e)", 20,
|
||||
"OpenGL ES GLSL ES 1.0.16", 100);
|
||||
pass = pass && test_version("OpenGL ES 3.2 Mesa 18.3.0-devel", 32,
|
||||
"OpenGL ES GLSL ES 3.20", 320);
|
||||
pass = pass && test_version("4.5.0 NVIDIA 384.130", 45,
|
||||
"4.50", 450);
|
||||
|
||||
return pass != true;
|
||||
}
|
||||
@@ -1,82 +0,0 @@
|
||||
/*
|
||||
* Copyright © 2013 Intel Corporation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
* IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file glx_gles2.c
|
||||
*
|
||||
* Catches a bug where a GLES2 context using
|
||||
* GLX_EXT_create_context_es2_profile would try to find the symbols in
|
||||
* libGLESv2.so.2 instead of libGL.so.1.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <assert.h>
|
||||
#include <err.h>
|
||||
#include "epoxy/gl.h"
|
||||
#include "epoxy/glx.h"
|
||||
#include <X11/Xlib.h>
|
||||
|
||||
#include "glx_common.h"
|
||||
|
||||
static Display *dpy;
|
||||
|
||||
static int last_call;
|
||||
|
||||
#define CORE_FUNC_VAL 100
|
||||
#define EXT_FUNC_VAL 101
|
||||
|
||||
void
|
||||
override_GL_glBindTexture(GLenum target);
|
||||
void
|
||||
override_GL_glBindTextureEXT(GLenum target);
|
||||
|
||||
void
|
||||
override_GL_glBindTexture(GLenum target)
|
||||
{
|
||||
last_call = CORE_FUNC_VAL;
|
||||
}
|
||||
|
||||
void
|
||||
override_GL_glBindTextureEXT(GLenum target)
|
||||
{
|
||||
last_call = EXT_FUNC_VAL;
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
bool pass = true;
|
||||
|
||||
dpy = get_display_or_skip();
|
||||
make_glx_context_current_or_skip(dpy);
|
||||
|
||||
if (!epoxy_has_gl_extension("GL_EXT_texture_object"))
|
||||
errx(77, "Test requires GL_EXT_texture_object");
|
||||
|
||||
glBindTexture(GL_TEXTURE_2D, 1);
|
||||
pass = pass && last_call == CORE_FUNC_VAL;
|
||||
glBindTextureEXT(GL_TEXTURE_2D, 1);
|
||||
pass = pass && last_call == EXT_FUNC_VAL;
|
||||
|
||||
return pass != true;
|
||||
}
|
||||
@@ -1,107 +0,0 @@
|
||||
/*
|
||||
* Copyright © 2013 Intel Corporation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
* IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <assert.h>
|
||||
#include "epoxy/gl.h"
|
||||
#include "epoxy/glx.h"
|
||||
#include <X11/Xlib.h>
|
||||
|
||||
#include "glx_common.h"
|
||||
|
||||
static Display *dpy;
|
||||
static bool has_argb2101010;
|
||||
|
||||
static bool
|
||||
test_with_epoxy(void)
|
||||
{
|
||||
glBegin(GL_TRIANGLES);
|
||||
{
|
||||
/* Hit a base entrypoint that won't call gl_version() */
|
||||
glVertex2f(0, 0);
|
||||
|
||||
/* Hit an entrypoint that will call probably call gl_version() */
|
||||
glMultiTexCoord4f(GL_TEXTURE0, 0.0, 0.0, 0.0, 0.0);
|
||||
|
||||
/* Hit an entrypoint that will probably call
|
||||
* epoxy_conservative_has_extension();
|
||||
*/
|
||||
if (has_argb2101010) {
|
||||
glTexCoordP4ui(GL_UNSIGNED_INT_2_10_10_10_REV, 0);
|
||||
}
|
||||
}
|
||||
glEnd();
|
||||
|
||||
/* No error should have been generated in the process. */
|
||||
return glGetError() == 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#undef glBegin
|
||||
#undef glEnd
|
||||
extern void glBegin(GLenum primtype);
|
||||
extern void glEnd(void);
|
||||
|
||||
static bool
|
||||
test_without_epoxy(void)
|
||||
{
|
||||
glBegin(GL_TRIANGLES);
|
||||
{
|
||||
/* Hit a base entrypoint that won't call gl_version() */
|
||||
glVertex4f(0, 0, 0, 0);
|
||||
|
||||
/* Hit an entrypoint that will call probably call gl_version() */
|
||||
glMultiTexCoord3f(GL_TEXTURE0, 0.0, 0.0, 0.0);
|
||||
|
||||
/* Hit an entrypoint that will probably call
|
||||
* epoxy_conservative_has_extension();
|
||||
*/
|
||||
if (has_argb2101010) {
|
||||
glTexCoordP3ui(GL_UNSIGNED_INT_2_10_10_10_REV, 0);
|
||||
}
|
||||
}
|
||||
glEnd();
|
||||
|
||||
/* We can't make any assertions about error presence this time
|
||||
* around. This test is just trying to catch segfaults.
|
||||
*/
|
||||
return true;
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
bool pass = true;
|
||||
|
||||
dpy = get_display_or_skip();
|
||||
make_glx_context_current_or_skip(dpy);
|
||||
|
||||
has_argb2101010 =
|
||||
epoxy_has_gl_extension("GL_ARB_vertex_type_2_10_10_10_rev");
|
||||
|
||||
pass = pass && test_with_epoxy();
|
||||
pass = pass && test_without_epoxy();
|
||||
|
||||
return pass != true;
|
||||
}
|
||||
@@ -1,129 +0,0 @@
|
||||
/*
|
||||
* Copyright © 2009, 2013 Intel Corporation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
* IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <X11/Xlib.h>
|
||||
#include "glx_common.h"
|
||||
|
||||
Display *
|
||||
get_display_or_skip(void)
|
||||
{
|
||||
Display *dpy = XOpenDisplay(NULL);
|
||||
|
||||
if (!dpy) {
|
||||
fputs("couldn't open display\n", stderr);
|
||||
exit(77);
|
||||
}
|
||||
|
||||
return dpy;
|
||||
}
|
||||
|
||||
XVisualInfo *
|
||||
get_glx_visual(Display *dpy)
|
||||
{
|
||||
XVisualInfo *visinfo;
|
||||
int attrib[] = {
|
||||
GLX_RGBA,
|
||||
GLX_RED_SIZE, 1,
|
||||
GLX_GREEN_SIZE, 1,
|
||||
GLX_BLUE_SIZE, 1,
|
||||
GLX_DOUBLEBUFFER,
|
||||
None
|
||||
};
|
||||
int screen = DefaultScreen(dpy);
|
||||
|
||||
visinfo = glXChooseVisual(dpy, screen, attrib);
|
||||
if (visinfo == NULL) {
|
||||
fputs("Couldn't get an RGBA, double-buffered visual\n", stderr);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
return visinfo;
|
||||
}
|
||||
|
||||
Window
|
||||
get_glx_window(Display *dpy, XVisualInfo *visinfo, bool map)
|
||||
{
|
||||
XSetWindowAttributes window_attr;
|
||||
unsigned long mask;
|
||||
int screen = DefaultScreen(dpy);
|
||||
Window root_win = RootWindow(dpy, screen);
|
||||
Window win;
|
||||
|
||||
window_attr.background_pixel = 0;
|
||||
window_attr.border_pixel = 0;
|
||||
window_attr.colormap = XCreateColormap(dpy, root_win,
|
||||
visinfo->visual, AllocNone);
|
||||
window_attr.event_mask = StructureNotifyMask | ExposureMask |
|
||||
KeyPressMask;
|
||||
mask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask;
|
||||
win = XCreateWindow(dpy, root_win, 0, 0,
|
||||
10, 10, /* width, height */
|
||||
0, visinfo->depth, InputOutput,
|
||||
visinfo->visual, mask, &window_attr);
|
||||
|
||||
return win;
|
||||
}
|
||||
|
||||
void
|
||||
make_glx_context_current_or_skip(Display *dpy)
|
||||
{
|
||||
GLXContext ctx;
|
||||
XVisualInfo *visinfo = get_glx_visual(dpy);
|
||||
Window win = get_glx_window(dpy, visinfo, false);
|
||||
|
||||
ctx = glXCreateContext(dpy, visinfo, False, True);
|
||||
if (ctx == None) {
|
||||
fputs("glXCreateContext failed\n", stderr);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
glXMakeCurrent(dpy, win, ctx);
|
||||
}
|
||||
|
||||
GLXFBConfig
|
||||
get_fbconfig_for_visinfo(Display *dpy, XVisualInfo *visinfo)
|
||||
{
|
||||
int i, nconfigs;
|
||||
GLXFBConfig ret = None, *configs;
|
||||
|
||||
configs = glXGetFBConfigs(dpy, visinfo->screen, &nconfigs);
|
||||
if (!configs)
|
||||
return None;
|
||||
|
||||
for (i = 0; i < nconfigs; i++) {
|
||||
int v;
|
||||
|
||||
if (glXGetFBConfigAttrib(dpy, configs[i], GLX_VISUAL_ID, &v))
|
||||
continue;
|
||||
|
||||
if (v == visinfo->visualid) {
|
||||
ret = configs[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
XFree(configs);
|
||||
return ret;
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
/*
|
||||
* Copyright © 2013 Intel Corporation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
* IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "epoxy/glx.h"
|
||||
|
||||
Display *
|
||||
get_display_or_skip(void);
|
||||
|
||||
void
|
||||
make_glx_context_current_or_skip(Display *dpy);
|
||||
|
||||
GLXFBConfig
|
||||
get_fbconfig_for_visinfo(Display *dpy, XVisualInfo *visinfo);
|
||||
|
||||
XVisualInfo *
|
||||
get_glx_visual(Display *dpy);
|
||||
|
||||
Window
|
||||
get_glx_window(Display *dpy, XVisualInfo *visinfo, bool map);
|
||||
@@ -1,118 +0,0 @@
|
||||
/*
|
||||
* Copyright © 2013 Intel Corporation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
* IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file glx_gles2.c
|
||||
*
|
||||
* Catches a bug where a GLES2 context using
|
||||
* GLX_EXT_create_context_es2_profile would try to find the symbols in
|
||||
* libGLESv2.so.2 instead of libGL.so.1.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <assert.h>
|
||||
#include <err.h>
|
||||
#include "epoxy/gl.h"
|
||||
#include "epoxy/glx.h"
|
||||
#include <X11/Xlib.h>
|
||||
|
||||
#include "glx_common.h"
|
||||
|
||||
static Display *dpy;
|
||||
|
||||
GLuint
|
||||
override_GLES2_glCreateShader(GLenum target);
|
||||
|
||||
GLuint
|
||||
override_GLES2_glCreateShader(GLenum target)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
override_GLES2_glGenQueries(GLsizei n, GLuint *ids);
|
||||
|
||||
void
|
||||
override_GLES2_glGenQueries(GLsizei n, GLuint *ids)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < n; i++)
|
||||
ids[i] = 0;
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
bool pass = true;
|
||||
XVisualInfo *vis;
|
||||
Window win;
|
||||
GLXContext ctx;
|
||||
GLXFBConfig config;
|
||||
int context_attribs[] = {
|
||||
GLX_CONTEXT_PROFILE_MASK_ARB, GLX_CONTEXT_ES2_PROFILE_BIT_EXT,
|
||||
GLX_CONTEXT_MAJOR_VERSION_ARB, 2,
|
||||
GLX_CONTEXT_MINOR_VERSION_ARB, 0,
|
||||
0
|
||||
};
|
||||
GLuint shader;
|
||||
|
||||
dpy = get_display_or_skip();
|
||||
|
||||
if (!epoxy_has_glx_extension(dpy, 0, "GLX_EXT_create_context_es2_profile"))
|
||||
errx(77, "Test requires GLX_EXT_create_context_es2_profile");
|
||||
|
||||
vis = get_glx_visual(dpy);
|
||||
config = get_fbconfig_for_visinfo(dpy, vis);
|
||||
win = get_glx_window(dpy, vis, false);
|
||||
|
||||
ctx = glXCreateContextAttribsARB(dpy, config, NULL, true,
|
||||
context_attribs);
|
||||
|
||||
glXMakeCurrent(dpy, win, ctx);
|
||||
|
||||
if (epoxy_is_desktop_gl()) {
|
||||
errx(1, "GLES2 context creation made a desktop context\n");
|
||||
}
|
||||
|
||||
if (epoxy_gl_version() < 20) {
|
||||
errx(1, "GLES2 context creation made a version %f context\n",
|
||||
epoxy_gl_version() / 10.0f);
|
||||
}
|
||||
|
||||
/* Test using an entrypoint that's in GLES2, but not the desktop GL ABI. */
|
||||
shader = glCreateShader(GL_FRAGMENT_SHADER);
|
||||
if (shader == 0)
|
||||
errx(1, "glCreateShader() failed\n");
|
||||
glDeleteShader(shader);
|
||||
|
||||
if (epoxy_gl_version() >= 30) {
|
||||
GLuint q = 0;
|
||||
|
||||
glGenQueries(1, &q);
|
||||
if (!q)
|
||||
errx(1, "glGenQueries() failed\n");
|
||||
glDeleteQueries(1, &q);
|
||||
}
|
||||
|
||||
return pass != true;
|
||||
}
|
||||
@@ -1,57 +0,0 @@
|
||||
/*
|
||||
* Copyright © 2013 Intel Corporation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
* IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file glx_glxgetprocaddress_nocontext.c
|
||||
*
|
||||
* Catches a bug in early development where glXGetProcAddress() with
|
||||
* no context bound would fail out in dispatch.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <assert.h>
|
||||
#include <err.h>
|
||||
#include "epoxy/gl.h"
|
||||
#include "epoxy/glx.h"
|
||||
#include <X11/Xlib.h>
|
||||
|
||||
#include "glx_common.h"
|
||||
|
||||
static Display *dpy;
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
bool pass = true;
|
||||
void *func;
|
||||
|
||||
dpy = get_display_or_skip();
|
||||
if (epoxy_glx_version(dpy, 0) < 14)
|
||||
errx(77, "GLX version 1.4 required for glXGetProcAddress().\n");
|
||||
|
||||
func = glXGetProcAddress((const GLubyte *)"glGetString");
|
||||
if (!func)
|
||||
errx(1, "glXGetProcAddress() returned NULL\n");
|
||||
|
||||
return pass != true;
|
||||
}
|
||||
@@ -1,56 +0,0 @@
|
||||
/*
|
||||
* Copyright © 2013 Intel Corporation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
* IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file glx_has_extension_nocontext.c
|
||||
*
|
||||
* Catches a bug in early development where glXGetProcAddress() with
|
||||
* no context bound would fail out in dispatch.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <assert.h>
|
||||
#include <err.h>
|
||||
#include "epoxy/gl.h"
|
||||
#include "epoxy/glx.h"
|
||||
#include <X11/Xlib.h>
|
||||
|
||||
#include "glx_common.h"
|
||||
|
||||
static Display *dpy;
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
bool pass = true;
|
||||
|
||||
dpy = get_display_or_skip();
|
||||
|
||||
if (!epoxy_has_glx_extension(dpy, 0, "GLX_ARB_get_proc_address"))
|
||||
errx(1, "Implementation reported absence of GLX_ARB_get_proc_address");
|
||||
|
||||
if (epoxy_has_glx_extension(dpy, 0, "GLX_ARB_ham_sandwich"))
|
||||
errx(1, "Implementation reported presence of GLX_ARB_ham_sandwich");
|
||||
|
||||
return pass != true;
|
||||
}
|
||||
@@ -1,123 +0,0 @@
|
||||
/*
|
||||
* Copyright © 2013 Intel Corporation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
* IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <assert.h>
|
||||
#include "epoxy/gl.h"
|
||||
#include "epoxy/glx.h"
|
||||
#include <X11/Xlib.h>
|
||||
|
||||
#include "glx_common.h"
|
||||
|
||||
static Display *dpy;
|
||||
|
||||
static bool
|
||||
test_gl_version(void)
|
||||
{
|
||||
int version = epoxy_gl_version();
|
||||
if (version < 12) {
|
||||
fprintf(stderr,
|
||||
"Reported GL version %d, should be at least 12\n",
|
||||
version);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool
|
||||
test_glx_version(void)
|
||||
{
|
||||
int version = epoxy_glx_version(dpy, 0);
|
||||
const char *version_string;
|
||||
int ret;
|
||||
int server_major, server_minor;
|
||||
int client_major, client_minor;
|
||||
int server, client, expected;
|
||||
|
||||
if (version < 13) {
|
||||
fprintf(stderr,
|
||||
"Reported GLX version %d, should be at least 13 "
|
||||
"according to Linux GL ABI\n",
|
||||
version);
|
||||
return false;
|
||||
}
|
||||
|
||||
version_string = glXQueryServerString(dpy, 0, GLX_VERSION);
|
||||
ret = sscanf(version_string, "%d.%d", &server_major, &server_minor);
|
||||
assert(ret == 2);
|
||||
server = server_major * 10 + server_minor;
|
||||
|
||||
version_string = glXGetClientString(dpy, GLX_VERSION);
|
||||
ret = sscanf(version_string, "%d.%d", &client_major, &client_minor);
|
||||
assert(ret == 2);
|
||||
client = client_major * 10 + client_minor;
|
||||
|
||||
if (client < server)
|
||||
expected = client;
|
||||
else
|
||||
expected = server;
|
||||
|
||||
if (version != expected) {
|
||||
fprintf(stderr,
|
||||
"Reported GLX version %d, should be %d (%s)\n",
|
||||
version, expected, version_string);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool
|
||||
test_glx_extension_supported(void)
|
||||
{
|
||||
if (!epoxy_has_glx_extension(dpy, 0, "GLX_ARB_get_proc_address")) {
|
||||
fputs("Incorrectly reported no support for GLX_ARB_get_proc_address "
|
||||
"(should always be present in Linux ABI)\n",
|
||||
stderr);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (epoxy_has_glx_extension(dpy, 0, "GLX_EXT_ham_sandwich")) {
|
||||
fputs("Incorrectly reported support for GLX_EXT_ham_sandwich\n",
|
||||
stderr);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
bool pass = true;
|
||||
|
||||
dpy = get_display_or_skip();
|
||||
make_glx_context_current_or_skip(dpy);
|
||||
|
||||
pass = test_gl_version() && pass;
|
||||
pass = test_glx_version() && pass;
|
||||
pass = test_glx_extension_supported() && pass;
|
||||
|
||||
return pass != true;
|
||||
}
|
||||
@@ -1,181 +0,0 @@
|
||||
/*
|
||||
* Copyright © 2013 Intel Corporation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
* IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <assert.h>
|
||||
#include <err.h>
|
||||
#include "epoxy/gl.h"
|
||||
#include "epoxy/glx.h"
|
||||
#include <X11/Xlib.h>
|
||||
|
||||
#include "glx_common.h"
|
||||
|
||||
static Display *dpy;
|
||||
|
||||
static bool
|
||||
test_has_extensions(void)
|
||||
{
|
||||
int num_extensions;
|
||||
|
||||
glGetIntegerv(GL_NUM_EXTENSIONS, &num_extensions);
|
||||
|
||||
for (int i = 0; i < num_extensions; i++) {
|
||||
char *ext = (char *)glGetStringi(GL_EXTENSIONS, i);
|
||||
|
||||
if (!epoxy_has_gl_extension(ext)) {
|
||||
fprintf(stderr, "GL implementation reported support for %s, "
|
||||
"but epoxy didn't\n", ext);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (epoxy_has_gl_extension("GL_ARB_ham_sandwich")) {
|
||||
fputs("epoxy implementation reported support for "
|
||||
"GL_ARB_ham_sandwich, but it shouldn't\n",
|
||||
stderr);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool
|
||||
test_gl_version(void)
|
||||
{
|
||||
int gl_version, epoxy_version;
|
||||
int major, minor;
|
||||
|
||||
glGetIntegerv(GL_MAJOR_VERSION, &major);
|
||||
glGetIntegerv(GL_MINOR_VERSION, &minor);
|
||||
gl_version = major * 10 + minor;
|
||||
|
||||
if (gl_version < 32) {
|
||||
fprintf(stderr,
|
||||
"Implementation reported GL version %d, should be at least 32\n",
|
||||
gl_version);
|
||||
return false;
|
||||
}
|
||||
|
||||
epoxy_version = epoxy_gl_version();
|
||||
if (epoxy_version != gl_version) {
|
||||
fprintf(stderr,
|
||||
"Epoxy reported GL version %d, should be %d\n",
|
||||
epoxy_version, gl_version);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool
|
||||
test_glx_version(void)
|
||||
{
|
||||
int version = epoxy_glx_version(dpy, 0);
|
||||
const char *version_string;
|
||||
int ret;
|
||||
int server_major, server_minor;
|
||||
int client_major, client_minor;
|
||||
int server, client, expected;
|
||||
|
||||
if (version < 13) {
|
||||
fprintf(stderr,
|
||||
"Reported GLX version %d, should be at least 13 "
|
||||
"according to Linux GL ABI\n",
|
||||
version);
|
||||
return false;
|
||||
}
|
||||
|
||||
version_string = glXQueryServerString(dpy, 0, GLX_VERSION);
|
||||
ret = sscanf(version_string, "%d.%d", &server_major, &server_minor);
|
||||
assert(ret == 2);
|
||||
server = server_major * 10 + server_minor;
|
||||
|
||||
version_string = glXGetClientString(dpy, GLX_VERSION);
|
||||
ret = sscanf(version_string, "%d.%d", &client_major, &client_minor);
|
||||
assert(ret == 2);
|
||||
client = client_major * 10 + client_minor;
|
||||
|
||||
if (client < server)
|
||||
expected = client;
|
||||
else
|
||||
expected = server;
|
||||
|
||||
if (version != expected) {
|
||||
fprintf(stderr,
|
||||
"Reported GLX version %d, should be %d (%s)\n",
|
||||
version, expected, version_string);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static int
|
||||
error_handler(Display *d, XErrorEvent *ev)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
bool pass = true;
|
||||
XVisualInfo *visinfo;
|
||||
Window win;
|
||||
GLXFBConfig config;
|
||||
static const int attribs[] = {
|
||||
GLX_CONTEXT_PROFILE_MASK_ARB,
|
||||
GLX_CONTEXT_CORE_PROFILE_BIT_ARB,
|
||||
GLX_CONTEXT_MAJOR_VERSION_ARB,
|
||||
3,
|
||||
GLX_CONTEXT_MINOR_VERSION_ARB,
|
||||
2,
|
||||
None
|
||||
};
|
||||
GLXContext ctx;
|
||||
int (*old_handler)(Display *, XErrorEvent *);
|
||||
|
||||
dpy = get_display_or_skip();
|
||||
|
||||
if (!epoxy_has_glx_extension(dpy, 0, "GLX_ARB_create_context_profile"))
|
||||
errx(77, "Test requires GLX_ARB_create_context_profile");
|
||||
|
||||
visinfo = get_glx_visual(dpy);
|
||||
win = get_glx_window(dpy, visinfo, false);
|
||||
config = get_fbconfig_for_visinfo(dpy, visinfo);
|
||||
|
||||
old_handler = XSetErrorHandler(error_handler);
|
||||
ctx = glXCreateContextAttribsARB(dpy, config, NULL, True, attribs);
|
||||
if (ctx == None)
|
||||
errx(77, "glXCreateContext failed");
|
||||
XSetErrorHandler(old_handler);
|
||||
|
||||
glXMakeCurrent(dpy, win, ctx);
|
||||
|
||||
pass = test_gl_version() && pass;
|
||||
pass = test_glx_version() && pass;
|
||||
pass = test_has_extensions() && pass;
|
||||
|
||||
return pass != true;
|
||||
}
|
||||
@@ -1,70 +0,0 @@
|
||||
/*
|
||||
* Copyright © 2013 Intel Corporation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
* IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file glx_static.c
|
||||
*
|
||||
* Simple touch-test of using epoxy when linked statically. On Linux,
|
||||
* the ifunc support we'd like to use has some significant behavior
|
||||
* changes depending on whether it's a static build or shared library
|
||||
* build.
|
||||
*
|
||||
* Note that if configured without --enable-static, this test will end
|
||||
* up dynamically linked anyway, defeating the test.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <assert.h>
|
||||
#include "epoxy/gl.h"
|
||||
#include "epoxy/glx.h"
|
||||
#include <X11/Xlib.h>
|
||||
#include <dlfcn.h>
|
||||
|
||||
#include "glx_common.h"
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
bool pass = true;
|
||||
int val;
|
||||
|
||||
#if NEEDS_TO_BE_STATIC
|
||||
if (dlsym(NULL, "epoxy_glCompileShader")) {
|
||||
fputs("glx_static requires epoxy built with --enable-static\n", stderr);
|
||||
return 77;
|
||||
}
|
||||
#endif
|
||||
|
||||
Display *dpy = get_display_or_skip();
|
||||
make_glx_context_current_or_skip(dpy);
|
||||
|
||||
glEnable(GL_LIGHTING);
|
||||
val = 0;
|
||||
glGetIntegerv(GL_LIGHTING, &val);
|
||||
if (!val) {
|
||||
fputs("Enabling GL_LIGHTING didn't stick.\n", stderr);
|
||||
pass = false;
|
||||
}
|
||||
|
||||
return pass != true;
|
||||
}
|
||||
@@ -1,60 +0,0 @@
|
||||
/*
|
||||
* Copyright © 2013 Intel Corporation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
* IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <epoxy/gl.h>
|
||||
|
||||
#ifdef BUILD_EGL
|
||||
#include <epoxy/egl.h>
|
||||
#include <epoxy/egl.h>
|
||||
#endif
|
||||
|
||||
#ifdef BUILD_GLX
|
||||
#include <epoxy/glx.h>
|
||||
#include <epoxy/glx.h>
|
||||
#endif
|
||||
|
||||
#ifdef BUILD_EGL
|
||||
#include <EGL/egl.h>
|
||||
#include <EGL/egl.h>
|
||||
#include <EGL/eglext.h>
|
||||
#include <EGL/eglext.h>
|
||||
#endif
|
||||
|
||||
#ifdef BUILD_GLX
|
||||
#ifdef __APPLE__
|
||||
#include <OpenGL/gl.h>
|
||||
#include <OpenGL/glext.h>
|
||||
#else
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glext.h>
|
||||
#endif
|
||||
#include <GL/glx.h>
|
||||
#include <GL/glxext.h>
|
||||
#endif
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
@@ -1,65 +0,0 @@
|
||||
/*
|
||||
* Copyright © 2014 Intel Corporation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
* IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "khronos_typedefs.h"
|
||||
#include "epoxy/gl.h"
|
||||
|
||||
#define COMPARE_SIZE(type) \
|
||||
do { \
|
||||
if (sizeof(type) != system_sizes[type ## _slot]) { \
|
||||
fprintf(stderr, "system %s is size %d, epoxy is %d\n", \
|
||||
#type, \
|
||||
(int)system_sizes[type ## _slot], \
|
||||
(int)sizeof(type)); \
|
||||
error = true; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
uint32_t system_sizes[khronos_typedef_count];
|
||||
bool error = false;
|
||||
|
||||
get_system_typedef_sizes(system_sizes);
|
||||
|
||||
COMPARE_SIZE(khronos_int8_t);
|
||||
COMPARE_SIZE(khronos_uint8_t);
|
||||
COMPARE_SIZE(khronos_int16_t);
|
||||
COMPARE_SIZE(khronos_uint16_t);
|
||||
COMPARE_SIZE(khronos_int32_t);
|
||||
COMPARE_SIZE(khronos_uint32_t);
|
||||
COMPARE_SIZE(khronos_int64_t);
|
||||
COMPARE_SIZE(khronos_uint64_t);
|
||||
COMPARE_SIZE(khronos_intptr_t);
|
||||
COMPARE_SIZE(khronos_uintptr_t);
|
||||
COMPARE_SIZE(khronos_ssize_t);
|
||||
COMPARE_SIZE(khronos_usize_t);
|
||||
COMPARE_SIZE(khronos_float_t);
|
||||
COMPARE_SIZE(khronos_utime_nanoseconds_t);
|
||||
COMPARE_SIZE(khronos_stime_nanoseconds_t);
|
||||
COMPARE_SIZE(khronos_boolean_enum_t);
|
||||
|
||||
return error;
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
/*
|
||||
* Copyright © 2014 Intel Corporation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
* IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
enum typedef_slot {
|
||||
khronos_int8_t_slot,
|
||||
khronos_uint8_t_slot,
|
||||
khronos_int16_t_slot,
|
||||
khronos_uint16_t_slot,
|
||||
khronos_int32_t_slot,
|
||||
khronos_uint32_t_slot,
|
||||
khronos_int64_t_slot,
|
||||
khronos_uint64_t_slot,
|
||||
khronos_intptr_t_slot,
|
||||
khronos_uintptr_t_slot,
|
||||
khronos_ssize_t_slot,
|
||||
khronos_usize_t_slot,
|
||||
khronos_float_t_slot,
|
||||
/* khrplatform.h claims it defines khronos_time_ns_t, but it doesn't. */
|
||||
khronos_utime_nanoseconds_t_slot,
|
||||
khronos_stime_nanoseconds_t_slot,
|
||||
khronos_boolean_enum_t_slot,
|
||||
khronos_typedef_count
|
||||
};
|
||||
|
||||
void get_system_typedef_sizes(uint32_t *sizes);
|
||||
@@ -1,69 +0,0 @@
|
||||
/*
|
||||
* Copyright © 2014 Intel Corporation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
* IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "config.h"
|
||||
#include "khronos_typedefs.h"
|
||||
|
||||
#ifdef HAVE_KHRPLATFORM_H
|
||||
|
||||
#include <KHR/khrplatform.h>
|
||||
|
||||
#define GET_SIZE(type) sizes[type ## _slot] = sizeof(type)
|
||||
|
||||
void
|
||||
get_system_typedef_sizes(uint32_t *sizes)
|
||||
{
|
||||
GET_SIZE(khronos_int8_t);
|
||||
GET_SIZE(khronos_uint8_t);
|
||||
GET_SIZE(khronos_int16_t);
|
||||
GET_SIZE(khronos_uint16_t);
|
||||
GET_SIZE(khronos_int32_t);
|
||||
GET_SIZE(khronos_uint32_t);
|
||||
GET_SIZE(khronos_int64_t);
|
||||
GET_SIZE(khronos_uint64_t);
|
||||
GET_SIZE(khronos_intptr_t);
|
||||
GET_SIZE(khronos_uintptr_t);
|
||||
GET_SIZE(khronos_ssize_t);
|
||||
GET_SIZE(khronos_usize_t);
|
||||
GET_SIZE(khronos_float_t);
|
||||
GET_SIZE(khronos_utime_nanoseconds_t);
|
||||
GET_SIZE(khronos_stime_nanoseconds_t);
|
||||
GET_SIZE(khronos_boolean_enum_t);
|
||||
}
|
||||
|
||||
#else /* !HAVE_KHRPLATFORM_H */
|
||||
|
||||
/* Don't care -- this is a conditional case in test code. */
|
||||
#pragma GCC diagnostic ignored "-Wsuggest-attribute=noreturn"
|
||||
|
||||
void
|
||||
get_system_typedef_sizes(uint32_t *sizes)
|
||||
{
|
||||
fputs("./configure failed to find khrplatform.h\n", stderr);
|
||||
exit(77);
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1,184 +0,0 @@
|
||||
dl_dep = cc.find_library('dl', required: false)
|
||||
has_dlvsym = cc.has_function('dlvsym', dependencies: dl_dep)
|
||||
|
||||
has_gles1 = gles1_dep.found()
|
||||
has_gles2 = gles2_dep.found()
|
||||
build_x11_tests = enable_x11 and x11_dep.found()
|
||||
|
||||
test_cflags = common_cflags
|
||||
if not has_dlvsym
|
||||
test_cflags += [
|
||||
'-D_XOPEN_SOURCE',
|
||||
'-D_POSIX_C_SOURCE=200809L',
|
||||
]
|
||||
endif
|
||||
|
||||
# Unconditionally built tests
|
||||
test('header_guards',
|
||||
executable('header guards', 'headerguards.c',
|
||||
c_args: common_cflags,
|
||||
dependencies: libepoxy_dep,
|
||||
include_directories: libepoxy_inc))
|
||||
test('misc_defines',
|
||||
executable('misc defines', 'miscdefines.c',
|
||||
c_args: common_cflags,
|
||||
dependencies: libepoxy_dep,
|
||||
include_directories: libepoxy_inc))
|
||||
test('khronos_typedefs',
|
||||
executable('khronos typedefs', [
|
||||
'khronos_typedefs.c',
|
||||
'khronos_typedefs.h',
|
||||
'khronos_typedefs_nonepoxy.c',
|
||||
],
|
||||
c_args: common_cflags,
|
||||
dependencies: libepoxy_dep,
|
||||
include_directories: libepoxy_inc))
|
||||
test('gl_version',
|
||||
executable('gl_version',
|
||||
'gl_version.c',
|
||||
c_args: common_cflags,
|
||||
dependencies: libepoxy_dep,
|
||||
include_directories: libepoxy_inc))
|
||||
|
||||
if build_egl and build_x11_tests
|
||||
egl_common_sources = [ 'egl_common.h', 'egl_common.c', ]
|
||||
egl_common_lib = static_library('egl_common',
|
||||
sources: egl_common_sources,
|
||||
dependencies: libepoxy_dep,
|
||||
include_directories: libepoxy_inc,
|
||||
c_args: common_cflags,
|
||||
install: false)
|
||||
|
||||
egl_tests = [
|
||||
[ 'egl_has_extension_nocontext', [], [ 'egl_has_extension_nocontext.c' ], true, ],
|
||||
[ 'egl_epoxy_api', [], [ 'egl_epoxy_api.c' ], true ],
|
||||
[ 'egl_gles1_without_glx', [ '-DGLES_VERSION=1', ], [ 'egl_without_glx.c' ], has_gles1, ],
|
||||
[ 'egl_gles2_without_glx', [ '-DGLES_VERSION=2', ], [ 'egl_without_glx.c' ], has_gles2, ],
|
||||
]
|
||||
|
||||
if build_glx
|
||||
egl_tests += [
|
||||
[ 'egl_gl', [], [ 'egl_gl.c' ], true, ],
|
||||
]
|
||||
endif
|
||||
|
||||
foreach test: egl_tests
|
||||
test_name = test[0]
|
||||
test_source = test[2]
|
||||
test_args = test[1]
|
||||
test_run = test[3]
|
||||
|
||||
if test_run
|
||||
test_bin = executable(test_name, test_source,
|
||||
c_args: test_cflags + test_args,
|
||||
include_directories: libepoxy_inc,
|
||||
dependencies: [ libepoxy_dep, x11_dep, egl_dep, dl_dep ],
|
||||
link_with: egl_common_lib,
|
||||
link_args: '-rdynamic')
|
||||
test(test_name, test_bin)
|
||||
endif
|
||||
endforeach
|
||||
endif
|
||||
|
||||
if build_glx and build_x11_tests
|
||||
glx_common_sources = [ 'glx_common.h', 'glx_common.c', ]
|
||||
glx_common_lib = static_library('glx_common',
|
||||
sources: glx_common_sources,
|
||||
dependencies: libepoxy_dep,
|
||||
include_directories: libepoxy_inc,
|
||||
c_args: common_cflags,
|
||||
install: false)
|
||||
|
||||
# glx_beginend links directly with the GL library, so we need to check it
|
||||
# separately
|
||||
test('glx_beginend', executable('glx_beginend', 'glx_beginend.c',
|
||||
c_args: test_cflags,
|
||||
include_directories: libepoxy_inc,
|
||||
dependencies: [ libepoxy_dep, x11_dep, gl_dep, dl_dep ],
|
||||
link_with: glx_common_lib))
|
||||
|
||||
glx_tests = [
|
||||
[ 'glx_public_api', [ 'glx_public_api.c' ], [], [], true ],
|
||||
[ 'glx_public_api_core', [ 'glx_public_api_core.c' ], [], [], true ],
|
||||
[ 'glx_glxgetprocaddress_nocontext', [ 'glx_glxgetprocaddress_nocontext.c' ], [], [], true ],
|
||||
[ 'glx_has_extension_nocontext', [ 'glx_has_extension_nocontext.c' ], [], [], true ],
|
||||
[ 'glx_static', [ 'glx_static.c' ], [ '-DNEEDS_TO_BE_STATIC'], [ '-static' ], libtype == 'static' ],
|
||||
[ 'glx_shared_znow', [ 'glx_static.c', ], [], [ '-Wl,-z,now' ], has_znow ],
|
||||
[ 'glx_alias_prefer_same_name', [ 'glx_alias_prefer_same_name.c', 'dlwrap.c', 'dlwrap.h' ], [], [ '-rdynamic' ], has_dlvsym ],
|
||||
[ 'glx_gles2', [ 'glx_gles2.c', 'dlwrap.c', 'dlwrap.h' ], [], [ '-rdynamic' ], has_dlvsym ],
|
||||
]
|
||||
|
||||
foreach test: glx_tests
|
||||
test_name = test[0]
|
||||
test_source = test[1]
|
||||
test_c_args = test[2]
|
||||
test_link_args = test[3]
|
||||
test_run = test[4]
|
||||
|
||||
if test_run
|
||||
test_bin = executable(test_name, test_source,
|
||||
c_args: test_cflags + test_c_args,
|
||||
include_directories: libepoxy_inc,
|
||||
dependencies: [ libepoxy_dep, x11_dep, dl_dep ],
|
||||
link_with: glx_common_lib,
|
||||
link_args: test_link_args)
|
||||
test(test_name, test_bin)
|
||||
endif
|
||||
endforeach
|
||||
endif
|
||||
|
||||
# WGL
|
||||
if build_wgl
|
||||
wgl_common_sources = [ 'wgl_common.h', 'wgl_common.c', ]
|
||||
wgl_common_lib = static_library('wgl_common',
|
||||
sources: wgl_common_sources,
|
||||
dependencies: libepoxy_dep,
|
||||
include_directories: libepoxy_inc,
|
||||
c_args: common_cflags,
|
||||
install: false)
|
||||
|
||||
wgl_tests = [
|
||||
[ 'wgl_core_and_exts', [ 'wgl_core_and_exts.c' ], [], ],
|
||||
[ 'wgl_per_context_funcptrs', [ 'wgl_per_context_funcptrs.c' ], [], ],
|
||||
[ 'wgl_usefontbitmaps', [ 'wgl_usefontbitmaps.c'], [], ],
|
||||
[ 'wgl_usefontbitmaps_unicode', [ 'wgl_usefontbitmaps.c' ], [ '-DUNICODE' ], ],
|
||||
]
|
||||
|
||||
foreach test: wgl_tests
|
||||
test_name = test[0]
|
||||
test_source = test[1]
|
||||
test_c_args = test[2]
|
||||
|
||||
test_bin = executable(test_name, test_source,
|
||||
c_args: test_cflags + test_c_args,
|
||||
include_directories: libepoxy_inc,
|
||||
dependencies: [ libepoxy_dep ],
|
||||
link_with: wgl_common_lib)
|
||||
|
||||
test(test_name, test_bin)
|
||||
endforeach
|
||||
endif
|
||||
|
||||
# Apple
|
||||
if host_machine.system().contains('darwin')
|
||||
opengl_dep = dependency('appleframeworks', modules: ['OpenGL', 'Carbon'], required: true)
|
||||
|
||||
cgl_tests = [
|
||||
[ 'cgl_core', [ 'cgl_core.c' ] ],
|
||||
[ 'cgl_epoxy_api', [ 'cgl_epoxy_api.c' ] ],
|
||||
]
|
||||
|
||||
foreach t: cgl_tests
|
||||
test_name = t[0]
|
||||
test_sources = t[1]
|
||||
|
||||
test(test_name,
|
||||
executable(
|
||||
test_name, test_sources,
|
||||
c_args: test_cflags,
|
||||
include_directories: libepoxy_inc,
|
||||
dependencies: [ libepoxy_dep, opengl_dep ],
|
||||
),
|
||||
)
|
||||
endforeach
|
||||
endif
|
||||
@@ -1,67 +0,0 @@
|
||||
/*
|
||||
* Copyright © 2013 Intel Corporation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
* IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <epoxy/gl.h>
|
||||
|
||||
#ifdef BUILD_EGL
|
||||
#include <epoxy/egl.h>
|
||||
#endif
|
||||
|
||||
#ifdef BUILD_GLX
|
||||
#include <epoxy/glx.h>
|
||||
#endif
|
||||
|
||||
#if GL_VERSION_3_2 != 1
|
||||
#error bad GL_VERSION_3_2
|
||||
#endif
|
||||
|
||||
#if GL_ARB_ES2_compatibility != 1
|
||||
#error bad GL_ARB_ES2_compatibility
|
||||
#endif
|
||||
|
||||
#ifndef GLAPI
|
||||
#error missing GLAPI
|
||||
#endif
|
||||
|
||||
#ifndef GLAPIENTRY
|
||||
#error missing GLAPIENTRY
|
||||
#endif
|
||||
|
||||
#ifndef GLAPIENTRYP
|
||||
#error missing GLAPIENTRYP
|
||||
#endif
|
||||
|
||||
#ifndef APIENTRY
|
||||
#error missing APIENTRY
|
||||
#endif
|
||||
|
||||
#ifndef APIENTRYP
|
||||
#error missing APIENTRYP
|
||||
#endif
|
||||
|
||||
/* Do we want to export GL_GLEXT_VERSION? */
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
@@ -1,128 +0,0 @@
|
||||
/*
|
||||
* Copyright © 2013 Intel Corporation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
* IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <epoxy/wgl.h>
|
||||
#include "wgl_common.h"
|
||||
|
||||
static int (*test_callback)(HDC hdc);
|
||||
|
||||
static void
|
||||
setup_pixel_format(HDC hdc)
|
||||
{
|
||||
PIXELFORMATDESCRIPTOR pfd = {
|
||||
sizeof(PIXELFORMATDESCRIPTOR),
|
||||
1,
|
||||
PFD_SUPPORT_OPENGL |
|
||||
PFD_DRAW_TO_WINDOW |
|
||||
PFD_DOUBLEBUFFER,
|
||||
PFD_TYPE_RGBA,
|
||||
32,
|
||||
0, 0, 0, 0, 0, 0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0, 0, 0, 0,
|
||||
16,
|
||||
0,
|
||||
0,
|
||||
PFD_MAIN_PLANE,
|
||||
0,
|
||||
0, 0, 0,
|
||||
};
|
||||
int pixel_format;
|
||||
|
||||
pixel_format = ChoosePixelFormat(hdc, &pfd);
|
||||
if (!pixel_format) {
|
||||
fputs("ChoosePixelFormat failed.\n", stderr);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (SetPixelFormat(hdc, pixel_format, &pfd) != TRUE) {
|
||||
fputs("SetPixelFormat() failed.\n", stderr);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
static LRESULT CALLBACK
|
||||
window_proc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam)
|
||||
{
|
||||
HDC hdc = GetDC(hwnd);
|
||||
int ret;
|
||||
|
||||
switch (message) {
|
||||
case WM_CREATE:
|
||||
setup_pixel_format(hdc);
|
||||
ret = test_callback(hdc);
|
||||
ReleaseDC(hwnd, hdc);
|
||||
exit(ret);
|
||||
return 0;
|
||||
default:
|
||||
return DefWindowProc(hwnd, message, wparam, lparam);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
make_window_and_test(int (*callback)(HDC hdc))
|
||||
{
|
||||
const char *class_name = "epoxy";
|
||||
const char *window_name = "epoxy";
|
||||
int width = 150;
|
||||
int height = 150;
|
||||
HWND hwnd;
|
||||
HINSTANCE hcurrentinst = NULL;
|
||||
WNDCLASS window_class;
|
||||
MSG msg;
|
||||
|
||||
test_callback = callback;
|
||||
|
||||
memset(&window_class, 0, sizeof(window_class));
|
||||
window_class.style = CS_OWNDC | CS_HREDRAW | CS_VREDRAW;
|
||||
window_class.lpfnWndProc = window_proc;
|
||||
window_class.cbClsExtra = 0;
|
||||
window_class.cbWndExtra = 0;
|
||||
window_class.hInstance = hcurrentinst;
|
||||
window_class.hIcon = LoadIcon(NULL, IDI_APPLICATION);
|
||||
window_class.hCursor = LoadCursor(NULL, IDC_ARROW);
|
||||
window_class.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
|
||||
window_class.lpszMenuName = NULL;
|
||||
window_class.lpszClassName = class_name;
|
||||
if (!RegisterClass(&window_class)) {
|
||||
fputs("Failed to register window class\n", stderr);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/* create window */
|
||||
hwnd = CreateWindow(class_name, window_name,
|
||||
WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN | WS_CLIPSIBLINGS,
|
||||
0, 0, width, height,
|
||||
NULL, NULL, hcurrentinst, NULL);
|
||||
|
||||
ShowWindow(hwnd, SW_SHOWDEFAULT);
|
||||
UpdateWindow(hwnd);
|
||||
|
||||
while (GetMessage(&msg, NULL, 0, 0)) {
|
||||
TranslateMessage(&msg);
|
||||
DispatchMessage(&msg);
|
||||
}
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
/*
|
||||
* Copyright © 2013 Intel Corporation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
* IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <epoxy/wgl.h>
|
||||
|
||||
void
|
||||
make_window_and_test(int (*callback)(HDC hdc));
|
||||
@@ -1,80 +0,0 @@
|
||||
/*
|
||||
* Copyright © 2013 Intel Corporation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
* IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "wgl_common.h"
|
||||
#include <epoxy/gl.h>
|
||||
|
||||
static int
|
||||
test_function(HDC hdc)
|
||||
{
|
||||
bool pass = true;
|
||||
int val;
|
||||
HGLRC ctx;
|
||||
|
||||
ctx = wglCreateContext(hdc);
|
||||
if (!ctx) {
|
||||
fputs("Failed to create wgl context\n", stderr);
|
||||
return 1;
|
||||
}
|
||||
if (!wglMakeCurrent(hdc, ctx)) {
|
||||
fputs("Failed to make context current\n", stderr);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* GL 1.0 APIs are available as symbols in opengl32.dll. */
|
||||
glEnable(GL_LIGHTING);
|
||||
val = 0;
|
||||
glGetIntegerv(GL_LIGHTING, &val);
|
||||
if (!val) {
|
||||
fputs("Enabling GL_LIGHTING didn't stick.\n", stderr);
|
||||
pass = false;
|
||||
}
|
||||
|
||||
if (epoxy_gl_version() >= 15 ||
|
||||
epoxy_has_gl_extension("GL_ARB_vertex_buffer_object")) {
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 1234);
|
||||
|
||||
val = 0;
|
||||
glGetIntegerv(GL_ELEMENT_ARRAY_BUFFER_BINDING, &val);
|
||||
if (val != 1234) {
|
||||
printf("GL_ELEMENT_ARRAY_BUFFER_BINDING didn't stick: %d\n", val);
|
||||
pass = false;
|
||||
}
|
||||
}
|
||||
|
||||
wglMakeCurrent(NULL, NULL);
|
||||
wglDeleteContext(ctx);
|
||||
|
||||
return !pass;
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
make_window_and_test(test_function);
|
||||
|
||||
/* UNREACHED */
|
||||
return 1;
|
||||
}
|
||||
@@ -1,165 +0,0 @@
|
||||
/*
|
||||
* Copyright © 2013 Intel Corporation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
* IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file wgl_per_context_funcptrs.c
|
||||
*
|
||||
* Tests that epoxy works correctly when wglGetProcAddress() returns
|
||||
* different function pointers for different contexts.
|
||||
*
|
||||
* wgl allows that to be the case when the device or pixel format are
|
||||
* different. We don't know if the underlying implementation actually
|
||||
* *will* return different function pointers, so force the issue by
|
||||
* overriding wglGetProcAddress() to return our function pointers with
|
||||
* magic behavior. This way we can test epoxy's implementation
|
||||
* regardless.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include "wgl_common.h"
|
||||
#include <epoxy/gl.h>
|
||||
|
||||
#define CREATESHADER_CTX1_VAL 1001
|
||||
#define CREATESHADER_CTX2_VAL 1002
|
||||
|
||||
static HGLRC ctx1, ctx2, current_context;
|
||||
static bool pass = true;
|
||||
|
||||
#define OVERRIDE_API(type) __declspec(dllexport) type __stdcall
|
||||
|
||||
OVERRIDE_API (GLuint) override_glCreateShader_ctx1(GLenum target);
|
||||
OVERRIDE_API (GLuint) override_glCreateShader_ctx2(GLenum target);
|
||||
OVERRIDE_API (PROC) override_wglGetProcAddress(LPCSTR name);
|
||||
|
||||
OVERRIDE_API (GLuint)
|
||||
override_glCreateShader_ctx1(GLenum target)
|
||||
{
|
||||
if (current_context != ctx1) {
|
||||
fputs("ctx1 called while other context current\n", stderr);
|
||||
pass = false;
|
||||
}
|
||||
return CREATESHADER_CTX1_VAL;
|
||||
}
|
||||
|
||||
OVERRIDE_API (GLuint)
|
||||
override_glCreateShader_ctx2(GLenum target)
|
||||
{
|
||||
if (current_context != ctx2) {
|
||||
fputs("ctx2 called while other context current\n", stderr);
|
||||
pass = false;
|
||||
}
|
||||
return CREATESHADER_CTX2_VAL;
|
||||
}
|
||||
|
||||
OVERRIDE_API (PROC)
|
||||
override_wglGetProcAddress(LPCSTR name)
|
||||
{
|
||||
assert(strcmp(name, "glCreateShader") == 0);
|
||||
|
||||
if (current_context == ctx1) {
|
||||
return (PROC)override_glCreateShader_ctx1;
|
||||
} else {
|
||||
assert(current_context == ctx2);
|
||||
return (PROC)override_glCreateShader_ctx2;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
test_createshader(HDC hdc, HGLRC ctx)
|
||||
{
|
||||
GLuint shader, expected;
|
||||
int ctxnum;
|
||||
|
||||
wglMakeCurrent(hdc, ctx);
|
||||
current_context = ctx;
|
||||
|
||||
/* Install our GPA override so we can force per-context function
|
||||
* pointers.
|
||||
*/
|
||||
wglGetProcAddress = override_wglGetProcAddress;
|
||||
|
||||
if (ctx == ctx1) {
|
||||
expected = CREATESHADER_CTX1_VAL;
|
||||
ctxnum = 1;
|
||||
} else {
|
||||
assert(ctx == ctx2);
|
||||
expected = CREATESHADER_CTX2_VAL;
|
||||
ctxnum = 2;
|
||||
}
|
||||
|
||||
shader = glCreateShader(GL_FRAGMENT_SHADER);
|
||||
printf("ctx%d: Returned %d\n", ctxnum, shader);
|
||||
if (shader != expected) {
|
||||
fprintf(stderr, " expected %d\n", expected);
|
||||
pass = false;
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
test_function(HDC hdc)
|
||||
{
|
||||
ctx1 = wglCreateContext(hdc);
|
||||
ctx2 = wglCreateContext(hdc);
|
||||
if (!ctx1 || !ctx2) {
|
||||
fputs("Failed to create wgl contexts\n", stderr);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (!wglMakeCurrent(hdc, ctx1)) {
|
||||
fputs("Failed to make context current\n", stderr);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (epoxy_gl_version() < 20) {
|
||||
/* We could possibly do a 1.3 entrypoint or something instead. */
|
||||
fputs("Test relies on overriding a GL 2.0 entrypoint\n", stderr);
|
||||
return 77;
|
||||
}
|
||||
|
||||
/* Force resolving epoxy_wglGetProcAddress. */
|
||||
wglGetProcAddress("glCreateShader");
|
||||
|
||||
test_createshader(hdc, ctx1);
|
||||
test_createshader(hdc, ctx1);
|
||||
test_createshader(hdc, ctx2);
|
||||
test_createshader(hdc, ctx2);
|
||||
test_createshader(hdc, ctx1);
|
||||
test_createshader(hdc, ctx2);
|
||||
|
||||
wglMakeCurrent(NULL, NULL);
|
||||
wglDeleteContext(ctx1);
|
||||
wglDeleteContext(ctx2);
|
||||
|
||||
return !pass;
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
make_window_and_test(test_function);
|
||||
|
||||
/* UNREACHED */
|
||||
return 1;
|
||||
}
|
||||
@@ -1,74 +0,0 @@
|
||||
/*
|
||||
* Copyright © 2013 Intel Corporation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
* IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "wgl_common.h"
|
||||
#include <epoxy/gl.h>
|
||||
|
||||
static int
|
||||
test_function(HDC hdc)
|
||||
{
|
||||
bool pass = true;
|
||||
HGLRC ctx;
|
||||
GLuint dlist[2] = {100, 101};
|
||||
const char *string = "some string";
|
||||
|
||||
ctx = wglCreateContext(hdc);
|
||||
if (!ctx) {
|
||||
fputs("Failed to create wgl context\n", stderr);
|
||||
return 1;
|
||||
}
|
||||
if (!wglMakeCurrent(hdc, ctx)) {
|
||||
fputs("Failed to make context current\n", stderr);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* First, use the #ifdeffed variant of the function */
|
||||
wglUseFontBitmaps(hdc, 0, 255, dlist[0]);
|
||||
glListBase(dlist[1]);
|
||||
glCallLists(strlen(string), GL_UNSIGNED_BYTE, string);
|
||||
|
||||
/* Now, use the specific version, manually. */
|
||||
#ifdef UNICODE
|
||||
wglUseFontBitmapsW(hdc, 0, 255, dlist[0]);
|
||||
#else
|
||||
wglUseFontBitmapsA(hdc, 0, 255, dlist[0]);
|
||||
#endif
|
||||
glListBase(dlist[1]);
|
||||
glCallLists(strlen(string), GL_UNSIGNED_BYTE, string);
|
||||
|
||||
wglMakeCurrent(NULL, NULL);
|
||||
wglDeleteContext(ctx);
|
||||
|
||||
return !pass;
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
make_window_and_test(test_function);
|
||||
|
||||
/* UNREACHED */
|
||||
return 1;
|
||||
}
|
||||
Symlink
+1
@@ -0,0 +1 @@
|
||||
../../../local/recipes/dev/m4
|
||||
@@ -1,5 +0,0 @@
|
||||
#TODO not compiled or tested
|
||||
[source]
|
||||
tar = "https://ftp.gnu.org/gnu/m4/m4-1.14.21.tar.xz"
|
||||
[build]
|
||||
template = "configure"
|
||||
+1
@@ -0,0 +1 @@
|
||||
../../../../local/recipes/qt/qt6-sensors
|
||||
@@ -1 +0,0 @@
|
||||
../../local/recipes/qt/qt6-sensors/recipe.toml
|
||||
@@ -1,5 +0,0 @@
|
||||
set(QT_REPO_MODULE_VERSION "6.11.0")
|
||||
set(QT_REPO_MODULE_PRERELEASE_VERSION_SEGMENT "alpha1")
|
||||
set(QT_EXTRA_INTERNAL_TARGET_DEFINES "QT_NO_QASCONST=1")
|
||||
list(APPEND QT_EXTRA_INTERNAL_TARGET_DEFINES "QT_NO_FOREACH=1")
|
||||
list(APPEND QT_EXTRA_INTERNAL_TARGET_DEFINES "QT_NO_CONTEXTLESS_CONNECT=1")
|
||||
@@ -1,4 +0,0 @@
|
||||
[gerrit]
|
||||
host=codereview.qt-project.org
|
||||
project=qt/qtsensors
|
||||
defaultbranch=dev
|
||||
@@ -1 +0,0 @@
|
||||
92ed021507d4f8c38e0e9548db97c8dd039829d9
|
||||
@@ -1,27 +0,0 @@
|
||||
# Copyright (C) 2022 The Qt Company Ltd.
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
|
||||
cmake_minimum_required(VERSION 3.16)
|
||||
|
||||
include(.cmake.conf)
|
||||
|
||||
project(QtSensors
|
||||
VERSION "${QT_REPO_MODULE_VERSION}"
|
||||
DESCRIPTION "Qt Sensors Libraries"
|
||||
HOMEPAGE_URL "https://qt.io/"
|
||||
LANGUAGES CXX C
|
||||
)
|
||||
|
||||
find_package(Qt6 ${PROJECT_VERSION} CONFIG REQUIRED COMPONENTS BuildInternals)
|
||||
|
||||
# This should be called as early as possible, just after find_package(BuildInternals) where it is
|
||||
# defined.
|
||||
qt_internal_project_setup()
|
||||
|
||||
find_package(Qt6 ${PROJECT_VERSION} CONFIG REQUIRED COMPONENTS Core)
|
||||
find_package(Qt6 ${PROJECT_VERSION} CONFIG OPTIONAL_COMPONENTS
|
||||
Xml Gui Widgets Quick Qml Svg DBus QuickTest
|
||||
)
|
||||
|
||||
qt_build_repo()
|
||||
@@ -1,73 +0,0 @@
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
@@ -1,9 +0,0 @@
|
||||
Copyright (c) <year> <owner>.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
@@ -1,451 +0,0 @@
|
||||
|
||||
GNU Free Documentation License
|
||||
Version 1.3, 3 November 2008
|
||||
|
||||
|
||||
Copyright (C) 2000, 2001, 2002, 2007, 2008 Free Software Foundation, Inc.
|
||||
<https://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
0. PREAMBLE
|
||||
|
||||
The purpose of this License is to make a manual, textbook, or other
|
||||
functional and useful document "free" in the sense of freedom: to
|
||||
assure everyone the effective freedom to copy and redistribute it,
|
||||
with or without modifying it, either commercially or noncommercially.
|
||||
Secondarily, this License preserves for the author and publisher a way
|
||||
to get credit for their work, while not being considered responsible
|
||||
for modifications made by others.
|
||||
|
||||
This License is a kind of "copyleft", which means that derivative
|
||||
works of the document must themselves be free in the same sense. It
|
||||
complements the GNU General Public License, which is a copyleft
|
||||
license designed for free software.
|
||||
|
||||
We have designed this License in order to use it for manuals for free
|
||||
software, because free software needs free documentation: a free
|
||||
program should come with manuals providing the same freedoms that the
|
||||
software does. But this License is not limited to software manuals;
|
||||
it can be used for any textual work, regardless of subject matter or
|
||||
whether it is published as a printed book. We recommend this License
|
||||
principally for works whose purpose is instruction or reference.
|
||||
|
||||
|
||||
1. APPLICABILITY AND DEFINITIONS
|
||||
|
||||
This License applies to any manual or other work, in any medium, that
|
||||
contains a notice placed by the copyright holder saying it can be
|
||||
distributed under the terms of this License. Such a notice grants a
|
||||
world-wide, royalty-free license, unlimited in duration, to use that
|
||||
work under the conditions stated herein. The "Document", below,
|
||||
refers to any such manual or work. Any member of the public is a
|
||||
licensee, and is addressed as "you". You accept the license if you
|
||||
copy, modify or distribute the work in a way requiring permission
|
||||
under copyright law.
|
||||
|
||||
A "Modified Version" of the Document means any work containing the
|
||||
Document or a portion of it, either copied verbatim, or with
|
||||
modifications and/or translated into another language.
|
||||
|
||||
A "Secondary Section" is a named appendix or a front-matter section of
|
||||
the Document that deals exclusively with the relationship of the
|
||||
publishers or authors of the Document to the Document's overall
|
||||
subject (or to related matters) and contains nothing that could fall
|
||||
directly within that overall subject. (Thus, if the Document is in
|
||||
part a textbook of mathematics, a Secondary Section may not explain
|
||||
any mathematics.) The relationship could be a matter of historical
|
||||
connection with the subject or with related matters, or of legal,
|
||||
commercial, philosophical, ethical or political position regarding
|
||||
them.
|
||||
|
||||
The "Invariant Sections" are certain Secondary Sections whose titles
|
||||
are designated, as being those of Invariant Sections, in the notice
|
||||
that says that the Document is released under this License. If a
|
||||
section does not fit the above definition of Secondary then it is not
|
||||
allowed to be designated as Invariant. The Document may contain zero
|
||||
Invariant Sections. If the Document does not identify any Invariant
|
||||
Sections then there are none.
|
||||
|
||||
The "Cover Texts" are certain short passages of text that are listed,
|
||||
as Front-Cover Texts or Back-Cover Texts, in the notice that says that
|
||||
the Document is released under this License. A Front-Cover Text may
|
||||
be at most 5 words, and a Back-Cover Text may be at most 25 words.
|
||||
|
||||
A "Transparent" copy of the Document means a machine-readable copy,
|
||||
represented in a format whose specification is available to the
|
||||
general public, that is suitable for revising the document
|
||||
straightforwardly with generic text editors or (for images composed of
|
||||
pixels) generic paint programs or (for drawings) some widely available
|
||||
drawing editor, and that is suitable for input to text formatters or
|
||||
for automatic translation to a variety of formats suitable for input
|
||||
to text formatters. A copy made in an otherwise Transparent file
|
||||
format whose markup, or absence of markup, has been arranged to thwart
|
||||
or discourage subsequent modification by readers is not Transparent.
|
||||
An image format is not Transparent if used for any substantial amount
|
||||
of text. A copy that is not "Transparent" is called "Opaque".
|
||||
|
||||
Examples of suitable formats for Transparent copies include plain
|
||||
ASCII without markup, Texinfo input format, LaTeX input format, SGML
|
||||
or XML using a publicly available DTD, and standard-conforming simple
|
||||
HTML, PostScript or PDF designed for human modification. Examples of
|
||||
transparent image formats include PNG, XCF and JPG. Opaque formats
|
||||
include proprietary formats that can be read and edited only by
|
||||
proprietary word processors, SGML or XML for which the DTD and/or
|
||||
processing tools are not generally available, and the
|
||||
machine-generated HTML, PostScript or PDF produced by some word
|
||||
processors for output purposes only.
|
||||
|
||||
The "Title Page" means, for a printed book, the title page itself,
|
||||
plus such following pages as are needed to hold, legibly, the material
|
||||
this License requires to appear in the title page. For works in
|
||||
formats which do not have any title page as such, "Title Page" means
|
||||
the text near the most prominent appearance of the work's title,
|
||||
preceding the beginning of the body of the text.
|
||||
|
||||
The "publisher" means any person or entity that distributes copies of
|
||||
the Document to the public.
|
||||
|
||||
A section "Entitled XYZ" means a named subunit of the Document whose
|
||||
title either is precisely XYZ or contains XYZ in parentheses following
|
||||
text that translates XYZ in another language. (Here XYZ stands for a
|
||||
specific section name mentioned below, such as "Acknowledgements",
|
||||
"Dedications", "Endorsements", or "History".) To "Preserve the Title"
|
||||
of such a section when you modify the Document means that it remains a
|
||||
section "Entitled XYZ" according to this definition.
|
||||
|
||||
The Document may include Warranty Disclaimers next to the notice which
|
||||
states that this License applies to the Document. These Warranty
|
||||
Disclaimers are considered to be included by reference in this
|
||||
License, but only as regards disclaiming warranties: any other
|
||||
implication that these Warranty Disclaimers may have is void and has
|
||||
no effect on the meaning of this License.
|
||||
|
||||
2. VERBATIM COPYING
|
||||
|
||||
You may copy and distribute the Document in any medium, either
|
||||
commercially or noncommercially, provided that this License, the
|
||||
copyright notices, and the license notice saying this License applies
|
||||
to the Document are reproduced in all copies, and that you add no
|
||||
other conditions whatsoever to those of this License. You may not use
|
||||
technical measures to obstruct or control the reading or further
|
||||
copying of the copies you make or distribute. However, you may accept
|
||||
compensation in exchange for copies. If you distribute a large enough
|
||||
number of copies you must also follow the conditions in section 3.
|
||||
|
||||
You may also lend copies, under the same conditions stated above, and
|
||||
you may publicly display copies.
|
||||
|
||||
|
||||
3. COPYING IN QUANTITY
|
||||
|
||||
If you publish printed copies (or copies in media that commonly have
|
||||
printed covers) of the Document, numbering more than 100, and the
|
||||
Document's license notice requires Cover Texts, you must enclose the
|
||||
copies in covers that carry, clearly and legibly, all these Cover
|
||||
Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on
|
||||
the back cover. Both covers must also clearly and legibly identify
|
||||
you as the publisher of these copies. The front cover must present
|
||||
the full title with all words of the title equally prominent and
|
||||
visible. You may add other material on the covers in addition.
|
||||
Copying with changes limited to the covers, as long as they preserve
|
||||
the title of the Document and satisfy these conditions, can be treated
|
||||
as verbatim copying in other respects.
|
||||
|
||||
If the required texts for either cover are too voluminous to fit
|
||||
legibly, you should put the first ones listed (as many as fit
|
||||
reasonably) on the actual cover, and continue the rest onto adjacent
|
||||
pages.
|
||||
|
||||
If you publish or distribute Opaque copies of the Document numbering
|
||||
more than 100, you must either include a machine-readable Transparent
|
||||
copy along with each Opaque copy, or state in or with each Opaque copy
|
||||
a computer-network location from which the general network-using
|
||||
public has access to download using public-standard network protocols
|
||||
a complete Transparent copy of the Document, free of added material.
|
||||
If you use the latter option, you must take reasonably prudent steps,
|
||||
when you begin distribution of Opaque copies in quantity, to ensure
|
||||
that this Transparent copy will remain thus accessible at the stated
|
||||
location until at least one year after the last time you distribute an
|
||||
Opaque copy (directly or through your agents or retailers) of that
|
||||
edition to the public.
|
||||
|
||||
It is requested, but not required, that you contact the authors of the
|
||||
Document well before redistributing any large number of copies, to
|
||||
give them a chance to provide you with an updated version of the
|
||||
Document.
|
||||
|
||||
|
||||
4. MODIFICATIONS
|
||||
|
||||
You may copy and distribute a Modified Version of the Document under
|
||||
the conditions of sections 2 and 3 above, provided that you release
|
||||
the Modified Version under precisely this License, with the Modified
|
||||
Version filling the role of the Document, thus licensing distribution
|
||||
and modification of the Modified Version to whoever possesses a copy
|
||||
of it. In addition, you must do these things in the Modified Version:
|
||||
|
||||
A. Use in the Title Page (and on the covers, if any) a title distinct
|
||||
from that of the Document, and from those of previous versions
|
||||
(which should, if there were any, be listed in the History section
|
||||
of the Document). You may use the same title as a previous version
|
||||
if the original publisher of that version gives permission.
|
||||
B. List on the Title Page, as authors, one or more persons or entities
|
||||
responsible for authorship of the modifications in the Modified
|
||||
Version, together with at least five of the principal authors of the
|
||||
Document (all of its principal authors, if it has fewer than five),
|
||||
unless they release you from this requirement.
|
||||
C. State on the Title page the name of the publisher of the
|
||||
Modified Version, as the publisher.
|
||||
D. Preserve all the copyright notices of the Document.
|
||||
E. Add an appropriate copyright notice for your modifications
|
||||
adjacent to the other copyright notices.
|
||||
F. Include, immediately after the copyright notices, a license notice
|
||||
giving the public permission to use the Modified Version under the
|
||||
terms of this License, in the form shown in the Addendum below.
|
||||
G. Preserve in that license notice the full lists of Invariant Sections
|
||||
and required Cover Texts given in the Document's license notice.
|
||||
H. Include an unaltered copy of this License.
|
||||
I. Preserve the section Entitled "History", Preserve its Title, and add
|
||||
to it an item stating at least the title, year, new authors, and
|
||||
publisher of the Modified Version as given on the Title Page. If
|
||||
there is no section Entitled "History" in the Document, create one
|
||||
stating the title, year, authors, and publisher of the Document as
|
||||
given on its Title Page, then add an item describing the Modified
|
||||
Version as stated in the previous sentence.
|
||||
J. Preserve the network location, if any, given in the Document for
|
||||
public access to a Transparent copy of the Document, and likewise
|
||||
the network locations given in the Document for previous versions
|
||||
it was based on. These may be placed in the "History" section.
|
||||
You may omit a network location for a work that was published at
|
||||
least four years before the Document itself, or if the original
|
||||
publisher of the version it refers to gives permission.
|
||||
K. For any section Entitled "Acknowledgements" or "Dedications",
|
||||
Preserve the Title of the section, and preserve in the section all
|
||||
the substance and tone of each of the contributor acknowledgements
|
||||
and/or dedications given therein.
|
||||
L. Preserve all the Invariant Sections of the Document,
|
||||
unaltered in their text and in their titles. Section numbers
|
||||
or the equivalent are not considered part of the section titles.
|
||||
M. Delete any section Entitled "Endorsements". Such a section
|
||||
may not be included in the Modified Version.
|
||||
N. Do not retitle any existing section to be Entitled "Endorsements"
|
||||
or to conflict in title with any Invariant Section.
|
||||
O. Preserve any Warranty Disclaimers.
|
||||
|
||||
If the Modified Version includes new front-matter sections or
|
||||
appendices that qualify as Secondary Sections and contain no material
|
||||
copied from the Document, you may at your option designate some or all
|
||||
of these sections as invariant. To do this, add their titles to the
|
||||
list of Invariant Sections in the Modified Version's license notice.
|
||||
These titles must be distinct from any other section titles.
|
||||
|
||||
You may add a section Entitled "Endorsements", provided it contains
|
||||
nothing but endorsements of your Modified Version by various
|
||||
parties--for example, statements of peer review or that the text has
|
||||
been approved by an organization as the authoritative definition of a
|
||||
standard.
|
||||
|
||||
You may add a passage of up to five words as a Front-Cover Text, and a
|
||||
passage of up to 25 words as a Back-Cover Text, to the end of the list
|
||||
of Cover Texts in the Modified Version. Only one passage of
|
||||
Front-Cover Text and one of Back-Cover Text may be added by (or
|
||||
through arrangements made by) any one entity. If the Document already
|
||||
includes a cover text for the same cover, previously added by you or
|
||||
by arrangement made by the same entity you are acting on behalf of,
|
||||
you may not add another; but you may replace the old one, on explicit
|
||||
permission from the previous publisher that added the old one.
|
||||
|
||||
The author(s) and publisher(s) of the Document do not by this License
|
||||
give permission to use their names for publicity for or to assert or
|
||||
imply endorsement of any Modified Version.
|
||||
|
||||
|
||||
5. COMBINING DOCUMENTS
|
||||
|
||||
You may combine the Document with other documents released under this
|
||||
License, under the terms defined in section 4 above for modified
|
||||
versions, provided that you include in the combination all of the
|
||||
Invariant Sections of all of the original documents, unmodified, and
|
||||
list them all as Invariant Sections of your combined work in its
|
||||
license notice, and that you preserve all their Warranty Disclaimers.
|
||||
|
||||
The combined work need only contain one copy of this License, and
|
||||
multiple identical Invariant Sections may be replaced with a single
|
||||
copy. If there are multiple Invariant Sections with the same name but
|
||||
different contents, make the title of each such section unique by
|
||||
adding at the end of it, in parentheses, the name of the original
|
||||
author or publisher of that section if known, or else a unique number.
|
||||
Make the same adjustment to the section titles in the list of
|
||||
Invariant Sections in the license notice of the combined work.
|
||||
|
||||
In the combination, you must combine any sections Entitled "History"
|
||||
in the various original documents, forming one section Entitled
|
||||
"History"; likewise combine any sections Entitled "Acknowledgements",
|
||||
and any sections Entitled "Dedications". You must delete all sections
|
||||
Entitled "Endorsements".
|
||||
|
||||
|
||||
6. COLLECTIONS OF DOCUMENTS
|
||||
|
||||
You may make a collection consisting of the Document and other
|
||||
documents released under this License, and replace the individual
|
||||
copies of this License in the various documents with a single copy
|
||||
that is included in the collection, provided that you follow the rules
|
||||
of this License for verbatim copying of each of the documents in all
|
||||
other respects.
|
||||
|
||||
You may extract a single document from such a collection, and
|
||||
distribute it individually under this License, provided you insert a
|
||||
copy of this License into the extracted document, and follow this
|
||||
License in all other respects regarding verbatim copying of that
|
||||
document.
|
||||
|
||||
|
||||
7. AGGREGATION WITH INDEPENDENT WORKS
|
||||
|
||||
A compilation of the Document or its derivatives with other separate
|
||||
and independent documents or works, in or on a volume of a storage or
|
||||
distribution medium, is called an "aggregate" if the copyright
|
||||
resulting from the compilation is not used to limit the legal rights
|
||||
of the compilation's users beyond what the individual works permit.
|
||||
When the Document is included in an aggregate, this License does not
|
||||
apply to the other works in the aggregate which are not themselves
|
||||
derivative works of the Document.
|
||||
|
||||
If the Cover Text requirement of section 3 is applicable to these
|
||||
copies of the Document, then if the Document is less than one half of
|
||||
the entire aggregate, the Document's Cover Texts may be placed on
|
||||
covers that bracket the Document within the aggregate, or the
|
||||
electronic equivalent of covers if the Document is in electronic form.
|
||||
Otherwise they must appear on printed covers that bracket the whole
|
||||
aggregate.
|
||||
|
||||
|
||||
8. TRANSLATION
|
||||
|
||||
Translation is considered a kind of modification, so you may
|
||||
distribute translations of the Document under the terms of section 4.
|
||||
Replacing Invariant Sections with translations requires special
|
||||
permission from their copyright holders, but you may include
|
||||
translations of some or all Invariant Sections in addition to the
|
||||
original versions of these Invariant Sections. You may include a
|
||||
translation of this License, and all the license notices in the
|
||||
Document, and any Warranty Disclaimers, provided that you also include
|
||||
the original English version of this License and the original versions
|
||||
of those notices and disclaimers. In case of a disagreement between
|
||||
the translation and the original version of this License or a notice
|
||||
or disclaimer, the original version will prevail.
|
||||
|
||||
If a section in the Document is Entitled "Acknowledgements",
|
||||
"Dedications", or "History", the requirement (section 4) to Preserve
|
||||
its Title (section 1) will typically require changing the actual
|
||||
title.
|
||||
|
||||
|
||||
9. TERMINATION
|
||||
|
||||
You may not copy, modify, sublicense, or distribute the Document
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense, or distribute it is void, and
|
||||
will automatically terminate your rights under this License.
|
||||
|
||||
However, if you cease all violation of this License, then your license
|
||||
from a particular copyright holder is reinstated (a) provisionally,
|
||||
unless and until the copyright holder explicitly and finally
|
||||
terminates your license, and (b) permanently, if the copyright holder
|
||||
fails to notify you of the violation by some reasonable means prior to
|
||||
60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, receipt of a copy of some or all of the same material does
|
||||
not give you any rights to use it.
|
||||
|
||||
|
||||
10. FUTURE REVISIONS OF THIS LICENSE
|
||||
|
||||
The Free Software Foundation may publish new, revised versions of the
|
||||
GNU Free Documentation License from time to time. Such new versions
|
||||
will be similar in spirit to the present version, but may differ in
|
||||
detail to address new problems or concerns. See
|
||||
https://www.gnu.org/licenses/.
|
||||
|
||||
Each version of the License is given a distinguishing version number.
|
||||
If the Document specifies that a particular numbered version of this
|
||||
License "or any later version" applies to it, you have the option of
|
||||
following the terms and conditions either of that specified version or
|
||||
of any later version that has been published (not as a draft) by the
|
||||
Free Software Foundation. If the Document does not specify a version
|
||||
number of this License, you may choose any version ever published (not
|
||||
as a draft) by the Free Software Foundation. If the Document
|
||||
specifies that a proxy can decide which future versions of this
|
||||
License can be used, that proxy's public statement of acceptance of a
|
||||
version permanently authorizes you to choose that version for the
|
||||
Document.
|
||||
|
||||
11. RELICENSING
|
||||
|
||||
"Massive Multiauthor Collaboration Site" (or "MMC Site") means any
|
||||
World Wide Web server that publishes copyrightable works and also
|
||||
provides prominent facilities for anybody to edit those works. A
|
||||
public wiki that anybody can edit is an example of such a server. A
|
||||
"Massive Multiauthor Collaboration" (or "MMC") contained in the site
|
||||
means any set of copyrightable works thus published on the MMC site.
|
||||
|
||||
"CC-BY-SA" means the Creative Commons Attribution-Share Alike 3.0
|
||||
license published by Creative Commons Corporation, a not-for-profit
|
||||
corporation with a principal place of business in San Francisco,
|
||||
California, as well as future copyleft versions of that license
|
||||
published by that same organization.
|
||||
|
||||
"Incorporate" means to publish or republish a Document, in whole or in
|
||||
part, as part of another Document.
|
||||
|
||||
An MMC is "eligible for relicensing" if it is licensed under this
|
||||
License, and if all works that were first published under this License
|
||||
somewhere other than this MMC, and subsequently incorporated in whole or
|
||||
in part into the MMC, (1) had no cover texts or invariant sections, and
|
||||
(2) were thus incorporated prior to November 1, 2008.
|
||||
|
||||
The operator of an MMC Site may republish an MMC contained in the site
|
||||
under CC-BY-SA on the same site at any time before August 1, 2009,
|
||||
provided the MMC is eligible for relicensing.
|
||||
|
||||
|
||||
ADDENDUM: How to use this License for your documents
|
||||
|
||||
To use this License in a document you have written, include a copy of
|
||||
the License in the document and put the following copyright and
|
||||
license notices just after the title page:
|
||||
|
||||
Copyright (c) YEAR YOUR NAME.
|
||||
Permission is granted to copy, distribute and/or modify this document
|
||||
under the terms of the GNU Free Documentation License, Version 1.3
|
||||
or any later version published by the Free Software Foundation;
|
||||
with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
|
||||
A copy of the license is included in the section entitled "GNU
|
||||
Free Documentation License".
|
||||
|
||||
If you have Invariant Sections, Front-Cover Texts and Back-Cover Texts,
|
||||
replace the "with...Texts." line with this:
|
||||
|
||||
with the Invariant Sections being LIST THEIR TITLES, with the
|
||||
Front-Cover Texts being LIST, and with the Back-Cover Texts being LIST.
|
||||
|
||||
If you have Invariant Sections without Cover Texts, or some other
|
||||
combination of the three, merge those two alternatives to suit the
|
||||
situation.
|
||||
|
||||
If your document contains nontrivial examples of program code, we
|
||||
recommend releasing these examples in parallel under your choice of
|
||||
free software license, such as the GNU General Public License,
|
||||
to permit their use in free software.
|
||||
@@ -1,339 +0,0 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Lesser General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must show them these terms so they know their
|
||||
rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's
|
||||
source code as you receive it, in any medium, provided that you
|
||||
conspicuously and appropriately publish on each copy an appropriate
|
||||
copyright notice and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any warranty;
|
||||
and give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program
|
||||
specifies a version number of this License which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this
|
||||
when it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) year name of author
|
||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, the commands you use may
|
||||
be called something other than `show w' and `show c'; they could even be
|
||||
mouse-clicks or menu items--whatever suits your program.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1989
|
||||
Ty Coon, President of Vice
|
||||
|
||||
This General Public License does not permit incorporating your program into
|
||||
proprietary programs. If your program is a subroutine library, you may
|
||||
consider it more useful to permit linking proprietary applications with the
|
||||
library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License.
|
||||
@@ -1,674 +0,0 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU General Public License is a free, copyleft license for
|
||||
software and other kinds of works.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
the GNU General Public License is intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users. We, the Free Software Foundation, use the
|
||||
GNU General Public License for most of our software; it applies also to
|
||||
any other work released this way by its authors. You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to prevent others from denying you
|
||||
these rights or asking you to surrender the rights. Therefore, you have
|
||||
certain responsibilities if you distribute copies of the software, or if
|
||||
you modify it: responsibilities to respect the freedom of others.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must pass on to the recipients the same
|
||||
freedoms that you received. You must make sure that they, too, receive
|
||||
or can get the source code. And you must show them these terms so they
|
||||
know their rights.
|
||||
|
||||
Developers that use the GNU GPL protect your rights with two steps:
|
||||
(1) assert copyright on the software, and (2) offer you this License
|
||||
giving you legal permission to copy, distribute and/or modify it.
|
||||
|
||||
For the developers' and authors' protection, the GPL clearly explains
|
||||
that there is no warranty for this free software. For both users' and
|
||||
authors' sake, the GPL requires that modified versions be marked as
|
||||
changed, so that their problems will not be attributed erroneously to
|
||||
authors of previous versions.
|
||||
|
||||
Some devices are designed to deny users access to install or run
|
||||
modified versions of the software inside them, although the manufacturer
|
||||
can do so. This is fundamentally incompatible with the aim of
|
||||
protecting users' freedom to change the software. The systematic
|
||||
pattern of such abuse occurs in the area of products for individuals to
|
||||
use, which is precisely where it is most unacceptable. Therefore, we
|
||||
have designed this version of the GPL to prohibit the practice for those
|
||||
products. If such problems arise substantially in other domains, we
|
||||
stand ready to extend this provision to those domains in future versions
|
||||
of the GPL, as needed to protect the freedom of users.
|
||||
|
||||
Finally, every program is threatened constantly by software patents.
|
||||
States should not allow patents to restrict development and use of
|
||||
software on general-purpose computers, but in those that do, we wish to
|
||||
avoid the special danger that patents applied to a free program could
|
||||
make it effectively proprietary. To prevent this, the GPL assures that
|
||||
patents cannot be used to render the program non-free.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Use with the GNU Affero General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU Affero General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the special requirements of the GNU Affero General Public License,
|
||||
section 13, concerning interaction through a network will apply to the
|
||||
combination as such.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program does terminal interaction, make it output a short
|
||||
notice like this when it starts in an interactive mode:
|
||||
|
||||
<program> Copyright (C) <year> <name of author>
|
||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, your program's commands
|
||||
might be different; for a GUI interface, you would use an "about box".
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU GPL, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
|
||||
The GNU General Public License does not permit incorporating your program
|
||||
into proprietary programs. If your program is a subroutine library, you
|
||||
may consider it more useful to permit linking proprietary applications with
|
||||
the library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License. But first, please read
|
||||
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
|
||||
@@ -1,165 +0,0 @@
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
|
||||
This version of the GNU Lesser General Public License incorporates
|
||||
the terms and conditions of version 3 of the GNU General Public
|
||||
License, supplemented by the additional permissions listed below.
|
||||
|
||||
0. Additional Definitions.
|
||||
|
||||
As used herein, "this License" refers to version 3 of the GNU Lesser
|
||||
General Public License, and the "GNU GPL" refers to version 3 of the GNU
|
||||
General Public License.
|
||||
|
||||
"The Library" refers to a covered work governed by this License,
|
||||
other than an Application or a Combined Work as defined below.
|
||||
|
||||
An "Application" is any work that makes use of an interface provided
|
||||
by the Library, but which is not otherwise based on the Library.
|
||||
Defining a subclass of a class defined by the Library is deemed a mode
|
||||
of using an interface provided by the Library.
|
||||
|
||||
A "Combined Work" is a work produced by combining or linking an
|
||||
Application with the Library. The particular version of the Library
|
||||
with which the Combined Work was made is also called the "Linked
|
||||
Version".
|
||||
|
||||
The "Minimal Corresponding Source" for a Combined Work means the
|
||||
Corresponding Source for the Combined Work, excluding any source code
|
||||
for portions of the Combined Work that, considered in isolation, are
|
||||
based on the Application, and not on the Linked Version.
|
||||
|
||||
The "Corresponding Application Code" for a Combined Work means the
|
||||
object code and/or source code for the Application, including any data
|
||||
and utility programs needed for reproducing the Combined Work from the
|
||||
Application, but excluding the System Libraries of the Combined Work.
|
||||
|
||||
1. Exception to Section 3 of the GNU GPL.
|
||||
|
||||
You may convey a covered work under sections 3 and 4 of this License
|
||||
without being bound by section 3 of the GNU GPL.
|
||||
|
||||
2. Conveying Modified Versions.
|
||||
|
||||
If you modify a copy of the Library, and, in your modifications, a
|
||||
facility refers to a function or data to be supplied by an Application
|
||||
that uses the facility (other than as an argument passed when the
|
||||
facility is invoked), then you may convey a copy of the modified
|
||||
version:
|
||||
|
||||
a) under this License, provided that you make a good faith effort to
|
||||
ensure that, in the event an Application does not supply the
|
||||
function or data, the facility still operates, and performs
|
||||
whatever part of its purpose remains meaningful, or
|
||||
|
||||
b) under the GNU GPL, with none of the additional permissions of
|
||||
this License applicable to that copy.
|
||||
|
||||
3. Object Code Incorporating Material from Library Header Files.
|
||||
|
||||
The object code form of an Application may incorporate material from
|
||||
a header file that is part of the Library. You may convey such object
|
||||
code under terms of your choice, provided that, if the incorporated
|
||||
material is not limited to numerical parameters, data structure
|
||||
layouts and accessors, or small macros, inline functions and templates
|
||||
(ten or fewer lines in length), you do both of the following:
|
||||
|
||||
a) Give prominent notice with each copy of the object code that the
|
||||
Library is used in it and that the Library and its use are
|
||||
covered by this License.
|
||||
|
||||
b) Accompany the object code with a copy of the GNU GPL and this license
|
||||
document.
|
||||
|
||||
4. Combined Works.
|
||||
|
||||
You may convey a Combined Work under terms of your choice that,
|
||||
taken together, effectively do not restrict modification of the
|
||||
portions of the Library contained in the Combined Work and reverse
|
||||
engineering for debugging such modifications, if you also do each of
|
||||
the following:
|
||||
|
||||
a) Give prominent notice with each copy of the Combined Work that
|
||||
the Library is used in it and that the Library and its use are
|
||||
covered by this License.
|
||||
|
||||
b) Accompany the Combined Work with a copy of the GNU GPL and this license
|
||||
document.
|
||||
|
||||
c) For a Combined Work that displays copyright notices during
|
||||
execution, include the copyright notice for the Library among
|
||||
these notices, as well as a reference directing the user to the
|
||||
copies of the GNU GPL and this license document.
|
||||
|
||||
d) Do one of the following:
|
||||
|
||||
0) Convey the Minimal Corresponding Source under the terms of this
|
||||
License, and the Corresponding Application Code in a form
|
||||
suitable for, and under terms that permit, the user to
|
||||
recombine or relink the Application with a modified version of
|
||||
the Linked Version to produce a modified Combined Work, in the
|
||||
manner specified by section 6 of the GNU GPL for conveying
|
||||
Corresponding Source.
|
||||
|
||||
1) Use a suitable shared library mechanism for linking with the
|
||||
Library. A suitable mechanism is one that (a) uses at run time
|
||||
a copy of the Library already present on the user's computer
|
||||
system, and (b) will operate properly with a modified version
|
||||
of the Library that is interface-compatible with the Linked
|
||||
Version.
|
||||
|
||||
e) Provide Installation Information, but only if you would otherwise
|
||||
be required to provide such information under section 6 of the
|
||||
GNU GPL, and only to the extent that such information is
|
||||
necessary to install and execute a modified version of the
|
||||
Combined Work produced by recombining or relinking the
|
||||
Application with a modified version of the Linked Version. (If
|
||||
you use option 4d0, the Installation Information must accompany
|
||||
the Minimal Corresponding Source and Corresponding Application
|
||||
Code. If you use option 4d1, you must provide the Installation
|
||||
Information in the manner specified by section 6 of the GNU GPL
|
||||
for conveying Corresponding Source.)
|
||||
|
||||
5. Combined Libraries.
|
||||
|
||||
You may place library facilities that are a work based on the
|
||||
Library side by side in a single library together with other library
|
||||
facilities that are not Applications and are not covered by this
|
||||
License, and convey such a combined library under terms of your
|
||||
choice, if you do both of the following:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work based
|
||||
on the Library, uncombined with any other library facilities,
|
||||
conveyed under the terms of this License.
|
||||
|
||||
b) Give prominent notice with the combined library that part of it
|
||||
is a work based on the Library, and explaining where to find the
|
||||
accompanying uncombined form of the same work.
|
||||
|
||||
6. Revised Versions of the GNU Lesser General Public License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions
|
||||
of the GNU Lesser General Public License from time to time. Such new
|
||||
versions will be similar in spirit to the present version, but may
|
||||
differ in detail to address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Library as you received it specifies that a certain numbered version
|
||||
of the GNU Lesser General Public License "or any later version"
|
||||
applies to it, you have the option of following the terms and
|
||||
conditions either of that published version or of any later version
|
||||
published by the Free Software Foundation. If the Library as you
|
||||
received it does not specify a version number of the GNU Lesser
|
||||
General Public License, you may choose any version of the GNU Lesser
|
||||
General Public License ever published by the Free Software Foundation.
|
||||
|
||||
If the Library as you received it specifies that a proxy can decide
|
||||
whether future versions of the GNU Lesser General Public License shall
|
||||
apply, that proxy's public statement of acceptance of any version is
|
||||
permanent authorization for you to choose that version for the
|
||||
Library.
|
||||
@@ -1,8 +0,0 @@
|
||||
Licensees holding valid commercial Qt licenses may use this software in
|
||||
accordance with the the terms contained in a written agreement between
|
||||
you and The Qt Company. Alternatively, the terms and conditions that were
|
||||
accepted by the licensee when buying and/or downloading the
|
||||
software do apply.
|
||||
|
||||
For the latest licensing terms and conditions, see https://www.qt.io/terms-conditions.
|
||||
For further information use the contact form at https://www.qt.io/contact-us.
|
||||
@@ -1,22 +0,0 @@
|
||||
The Qt Company GPL Exception 1.0
|
||||
|
||||
Exception 1:
|
||||
|
||||
As a special exception you may create a larger work which contains the
|
||||
output of this application and distribute that work under terms of your
|
||||
choice, so long as the work is not otherwise derived from or based on
|
||||
this application and so long as the work does not in itself generate
|
||||
output that contains the output from this application in its original
|
||||
or modified form.
|
||||
|
||||
Exception 2:
|
||||
|
||||
As a special exception, you have permission to combine this application
|
||||
with Plugins licensed under the terms of your choice, to produce an
|
||||
executable, and to copy and distribute the resulting executable under
|
||||
the terms of your choice. However, the executable must be accompanied
|
||||
by a prominent notice offering all users of the executable the entire
|
||||
source code to this application, excluding the source code of the
|
||||
independent modules, but including any changes you have made to this
|
||||
application, under the terms of this license.
|
||||
|
||||
@@ -1,61 +0,0 @@
|
||||
version = 1
|
||||
|
||||
[[annotations]]
|
||||
path = ["tests/**.txt", "tests/**.ui"]
|
||||
precedence = "closest"
|
||||
SPDX-FileCopyrightText = "Copyright (C) The Qt Company Ltd."
|
||||
SPDX-License-Identifier = "LicenseRef-Qt-Commercial OR GPL-3.0-only"
|
||||
|
||||
[[annotations]]
|
||||
path = ["src/plugins/**"]
|
||||
precedence = "closest"
|
||||
SPDX-FileCopyrightText = "Copyright (C) The Qt Company Ltd."
|
||||
SPDX-License-Identifier = "LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only"
|
||||
|
||||
[[annotations]]
|
||||
path = ["**.qrc", "**CMakeLists.txt", "**.yaml", "**configure.json",
|
||||
"**.cfg", "qt_cmdline.cmake", "**.pri", "**.conf",
|
||||
"**ci_config_linux.json", ".tag"]
|
||||
precedence = "closest"
|
||||
comment = "build system"
|
||||
SPDX-FileCopyrightText = "Copyright (C) The Qt Company Ltd."
|
||||
SPDX-License-Identifier = "BSD-3-Clause"
|
||||
|
||||
[[annotations]]
|
||||
path = ["**/.gitattributes", "**.gitignore", "**.gitreview"]
|
||||
precedence = "closest"
|
||||
SPDX-FileCopyrightText = "Copyright (C) The Qt Company Ltd."
|
||||
SPDX-License-Identifier = "LicenseRef-Qt-Commercial OR BSD-3-Clause"
|
||||
|
||||
[[annotations]]
|
||||
path = ["examples/**"]
|
||||
comment = "this must be after the build system table because example and snippets take precedence over build system"
|
||||
precedence = "closest"
|
||||
SPDX-FileCopyrightText = "Copyright (C) The Qt Company Ltd."
|
||||
SPDX-License-Identifier = "LicenseRef-Qt-Commercial OR BSD-3-Clause"
|
||||
|
||||
[[annotations]]
|
||||
path = ["**/doc/images/**", "**.qdocconf", "doc/**.dia"]
|
||||
comment = "documentation"
|
||||
precedence = "closest"
|
||||
SPDX-FileCopyrightText = "Copyright (C) The Qt Company Ltd."
|
||||
SPDX-License-Identifier = "LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only"
|
||||
|
||||
[[annotations]]
|
||||
path = ["**.toml", "licenseRule.json"]
|
||||
precedence = "override"
|
||||
SPDX-FileCopyrightText = "Copyright (C) The Qt Company Ltd."
|
||||
SPDX-License-Identifier = "LicenseRef-Qt-Commercial OR BSD-3-Clause"
|
||||
|
||||
[[annotations]]
|
||||
path = ["**/qt_attribution.json"]
|
||||
precedence = "override"
|
||||
SPDX-FileCopyrightText = "Copyright (C) The Qt Company Ltd."
|
||||
SPDX-License-Identifier = "LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only"
|
||||
|
||||
[[annotations]]
|
||||
path = ["**LICENSE*"]
|
||||
precedence = "override"
|
||||
comment = "License file."
|
||||
SPDX-FileCopyrightText = "None"
|
||||
SPDX-License-Identifier = "CC0-1.0"
|
||||
@@ -1,13 +0,0 @@
|
||||
# Copyright (C) 2022 The Qt Company Ltd.
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
find_package(PkgConfig)
|
||||
if (PKG_CONFIG_FOUND)
|
||||
pkg_check_modules(Sensorfw sensord-qt5 IMPORTED_TARGET)
|
||||
if (NOT TARGET PkgConfig::Sensorfw)
|
||||
set(Sensorfw_FOUND 0)
|
||||
endif()
|
||||
else()
|
||||
message("Sensorfw pkg not found. Looking for library")
|
||||
find_library(Sensorfw sensorfw)
|
||||
endif()
|
||||
@@ -1,44 +0,0 @@
|
||||
{
|
||||
"Project": {
|
||||
"BuildSystemIntegration": {
|
||||
"child_order": [
|
||||
"GCCSetup",
|
||||
"CMake",
|
||||
"LinkLibraries"
|
||||
]
|
||||
},
|
||||
"CMake": {
|
||||
"_active": true,
|
||||
"_copy_from": "CMakeIntegration",
|
||||
"build_environment": {},
|
||||
"build_options": "-j4",
|
||||
"generate_options": "--fresh",
|
||||
"generator": "Ninja"
|
||||
},
|
||||
"GCCSetup": {
|
||||
"_active": true,
|
||||
"_copy_from": "Command",
|
||||
"build_command": "gccsetup --cc gcc --cxx g++ --config ../../../axivion/"
|
||||
},
|
||||
"LinkLibraries": {
|
||||
"_active": true,
|
||||
"_copy_from": "AxivionLinker",
|
||||
"input_files": [
|
||||
"build/lib/lib*.so*.ir",
|
||||
"build/qml/*/lib*.so*.ir"
|
||||
],
|
||||
"ir": "build/$(env:TESTED_MODULE_COIN).ir",
|
||||
"plugin_files": [
|
||||
"build/plugins/*/lib*.so*.ir"
|
||||
]
|
||||
}
|
||||
},
|
||||
"_Format": "1.0",
|
||||
"_Version": "7.6.2",
|
||||
"_VersionNum": [
|
||||
7,
|
||||
6,
|
||||
2,
|
||||
12725
|
||||
]
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
version: 2
|
||||
accept_configuration:
|
||||
condition: property
|
||||
property: features
|
||||
not_contains_value: Disable
|
||||
|
||||
instructions:
|
||||
Build:
|
||||
- type: EnvironmentVariable
|
||||
variableName: VERIFY_SOURCE_SBOM
|
||||
variableValue: "ON"
|
||||
- !include "{{qt/qtbase}}/coin_module_build_template_v2.yaml"
|
||||
|
||||
Test:
|
||||
- !include "{{qt/qtbase}}/coin_module_test_template_v3.yaml"
|
||||
- !include "{{qt/qtbase}}/coin_module_test_docs.yaml"
|
||||
@@ -1,37 +0,0 @@
|
||||
# Copyright (C) 2022 The Qt Company Ltd.
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
cmake_minimum_required(VERSION 3.16)
|
||||
project(config_test_winrt LANGUAGES C CXX)
|
||||
|
||||
if(DEFINED QT_CONFIG_COMPILE_TEST_CMAKE_SYSTEM_PREFIX_PATH)
|
||||
set(CMAKE_SYSTEM_PREFIX_PATH "${QT_CONFIG_COMPILE_TEST_CMAKE_SYSTEM_PREFIX_PATH}")
|
||||
endif()
|
||||
if(DEFINED QT_CONFIG_COMPILE_TEST_CMAKE_SYSTEM_FRAMEWORK_PATH)
|
||||
set(CMAKE_SYSTEM_FRAMEWORK_PATH "${QT_CONFIG_COMPILE_TEST_CMAKE_SYSTEM_FRAMEWORK_PATH}")
|
||||
endif()
|
||||
|
||||
foreach(p ${QT_CONFIG_COMPILE_TEST_PACKAGES})
|
||||
find_package(${p})
|
||||
endforeach()
|
||||
|
||||
if(QT_CONFIG_COMPILE_TEST_LIBRARIES)
|
||||
link_libraries(${QT_CONFIG_COMPILE_TEST_LIBRARIES})
|
||||
endif()
|
||||
if(QT_CONFIG_COMPILE_TEST_LIBRARY_TARGETS)
|
||||
foreach(lib ${QT_CONFIG_COMPILE_TEST_LIBRARY_TARGETS})
|
||||
if(TARGET ${lib})
|
||||
link_libraries(${lib})
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
add_executable(${PROJECT_NAME}
|
||||
main.cpp
|
||||
)
|
||||
|
||||
if(MSVC)
|
||||
target_link_libraries(${PROJECT_NAME} PRIVATE
|
||||
runtimeobject
|
||||
)
|
||||
endif()
|
||||
@@ -1,26 +0,0 @@
|
||||
// Copyright (C) 2021 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
#include <functional>
|
||||
#include <windows.system.h>
|
||||
|
||||
#include <windows.devices.sensors.h>
|
||||
#include <windows.foundation.h>
|
||||
#include <wrl.h>
|
||||
|
||||
using namespace Microsoft::WRL;
|
||||
using namespace Microsoft::WRL::Wrappers;
|
||||
using namespace ABI::Windows::Foundation;
|
||||
using namespace ABI::Windows::Devices::Sensors;
|
||||
|
||||
typedef ITypedEventHandler<Accelerometer *, AccelerometerReadingChangedEventArgs *> AccelerometerReadingHandler;
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
HStringReference classId(RuntimeClass_Windows_Devices_Sensors_Accelerometer);
|
||||
ComPtr<IAccelerometer> sensor;
|
||||
ComPtr<IAccelerometerStatics> factory;
|
||||
HRESULT hr = RoGetActivationFactory(classId.Get(), IID_PPV_ARGS(&factory));
|
||||
hr = factory->GetDefault(&sensor);
|
||||
return 0;
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
# Copyright (C) 2022 The Qt Company Ltd.
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
|
||||
|
||||
#### Inputs
|
||||
|
||||
|
||||
|
||||
#### Libraries
|
||||
|
||||
|
||||
|
||||
#### Tests
|
||||
|
||||
|
||||
|
||||
#### Features
|
||||
|
||||
|
||||
qt_extra_definition("QT_VERSION_STR" "\"${PROJECT_VERSION}\"" PUBLIC)
|
||||
qt_extra_definition("QT_VERSION_MAJOR" ${PROJECT_VERSION_MAJOR} PUBLIC)
|
||||
qt_extra_definition("QT_VERSION_MINOR" ${PROJECT_VERSION_MINOR} PUBLIC)
|
||||
qt_extra_definition("QT_VERSION_PATCH" ${PROJECT_VERSION_PATCH} PUBLIC)
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user