Skip to content
Commits on Source (73)
......@@ -13,32 +13,32 @@ env:
matrix:
include:
- os: linux
dist: xenial
dist: bionic
env:
- LABEL="ubuntu64"
- APT_PACKAGES="gcc-5 g++-5 libdwarf-dev libprocps4-dev qtbase5-dev qtdeclarative5-dev"
- CMAKE_OPTIONS="-DCMAKE_C_COMPILER=gcc-5 -DCMAKE_CXX_COMPILER=g++-5 -DENABLE_GUI=1"
- APT_PACKAGES="gcc g++ libdwarf-dev libprocps-dev qtbase5-dev qtdeclarative5-dev"
- CMAKE_OPTIONS="-DPython3_EXECUTABLE=/usr/bin/python3 -DENABLE_GUI=1"
- os: linux
dist: xenial
dist: bionic
env:
- LABEL="ubuntu32"
- APT_PACKAGES="linux-libc-dev gcc-multilib gcc-5-multilib g++-5-multilib"
- CMAKE_OPTIONS="-DCMAKE_C_COMPILER=gcc-5 -DCMAKE_CXX_COMPILER=g++-5 -DCMAKE_C_FLAGS=-m32 -DCMAKE_CXX_FLAGS=-m32 -DCMAKE_SYSTEM_LIBRARY_PATH=/usr/lib32 -DENABLE_GUI=0"
- APT_PACKAGES="linux-libc-dev gcc-multilib gcc-multilib g++-multilib"
- CMAKE_OPTIONS="-DPython3_EXECUTABLE=/usr/bin/python3 -DCMAKE_C_FLAGS=-m32 -DCMAKE_CXX_FLAGS=-m32 -DCMAKE_SYSTEM_LIBRARY_PATH=/usr/lib32 -DENABLE_GUI=0"
- os: linux
dist: xenial
dist: bionic
env:
- LABEL="ubuntu64-clang"
- APT_PACKAGES="build-essential clang-4.0 libc++-dev libc++abi-dev libdwarf-dev libprocps4-dev qtbase5-dev qtdeclarative5-dev"
- CMAKE_OPTIONS="-DCMAKE_C_COMPILER=clang-4.0 -DCMAKE_CXX_COMPILER=clang++-4.0 -DCMAKE_CXX_FLAGS=-stdlib=libc++ -DENABLE_GUI=1"
- APT_PACKAGES="build-essential clang libc++-dev libc++abi-dev libdwarf-dev libprocps-dev qtbase5-dev qtdeclarative5-dev"
- CMAKE_OPTIONS="-DPython3_EXECUTABLE=/usr/bin/python3 -DCMAKE_C_COMPILER=/usr/bin/clang -DCMAKE_CXX_COMPILER=/usr/bin/clang++ -DENABLE_GUI=1"
- os: linux
dist: xenial
dist: bionic
env:
- LABEL="mingw32"
- APT_PACKAGES="g++-mingw-w64-i686"
- MINGW_PREFIX=i686-w64-mingw32
- CMAKE_OPTIONS="-DCMAKE_TOOLCHAIN_FILE=Toolchain.cmake -Cdxsdk-master/Cache-mingw32.cmake -DENABLE_GUI=0"
- CMAKE_OPTIONS="-DPython3_EXECUTABLE=/usr/bin/python3 -DCMAKE_TOOLCHAIN_FILE=Toolchain.cmake -Cdxsdk-master/Cache-mingw32.cmake -DENABLE_GUI=0"
- os: linux
dist: xenial
dist: bionic
services:
- docker
env:
......@@ -46,7 +46,7 @@ matrix:
- DOCKER_IMAGE=jrfonseca/centos6
- CMAKE_OPTIONS="-DCMAKE_BUILD_TYPE=RelWithDebInfo -DENABLE_STATIC_LIBGCC=ON -DENABLE_STATIC_LIBSTDCXX=ON -DENABLE_STATIC_EXE=ON -DENABLE_GUI=OFF"
- os: osx
osx_image: xcode10.1
osx_image: xcode11.2
env:
- LABEL="mac64"
- CMAKE_OPTIONS="-DENABLE_GUI=1"
......@@ -58,7 +58,6 @@ before_install:
sudo apt-get update -qq
sudo apt-get install -qq -y $APT_PACKAGES
fi
- if [ "$LABEL" = "ubuntu64-clang" ]; then sudo ln -s /usr/include/libcxxabi/__cxxabi_config.h /usr/include/c++/v1/__cxxabi_config.h; fi
- if [ "$TRAVIS_OS_NAME" = "osx" ]; then brew update; brew install qt5; export CMAKE_PREFIX_PATH=$(brew --prefix qt5); fi
- cmake --version
- |
......
......@@ -102,9 +102,14 @@ else ()
endmacro()
endif ()
find_host_package (PythonInterp 2.7 REQUIRED)
if (NOT PYTHON_VERSION_MAJOR EQUAL 2)
message (FATAL_ERROR "Python 2.x required and requested, but Python ${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR} found.")
if (CMAKE_VERSION VERSION_LESS 3.12)
find_host_package (PythonInterp 3 REQUIRED)
if (NOT PYTHON_VERSION_MAJOR EQUAL 3)
message (FATAL_ERROR "Python 3.x required and requested, but Python ${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR} found.")
endif ()
set (Python3_EXECUTABLE "${PYTHON_EXECUTABLE}")
else ()
find_host_package (Python3 REQUIRED)
endif ()
find_package (Threads)
......@@ -191,6 +196,10 @@ if (ENABLE_EGL AND ENABLE_WAFFLE)
find_package (Waffle REQUIRED)
endif ()
if (ENABLE_EGL AND NOT ENABLE_X11)
add_definitions (-DEGL_NO_X11)
endif ()
##############################################################################
# Set global build options
......@@ -532,6 +541,7 @@ add_subdirectory (thirdparty/crc32c)
if (CMAKE_EXECUTABLE_FORMAT STREQUAL "ELF")
add_subdirectory (thirdparty/libbacktrace)
include_directories (${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/libbacktrace)
include_directories (${CMAKE_CURRENT_BINARY_DIR}/thirdparty/libbacktrace)
set (LIBBACKTRACE_LIBRARIES ${CMAKE_DL_LIBS} backtrace)
add_definitions (-DHAVE_BACKTRACE=1)
endif ()
......@@ -629,12 +639,12 @@ install (
RENAME LICENSE.txt
)
set (CPACK_PACKAGE_VERSION_MAJOR "8")
set (CPACK_PACKAGE_VERSION_MAJOR "9")
set (CPACK_PACKAGE_VERSION_MINOR "0")
# Use current date in YYYYMMDD format as patch number
execute_process (
COMMAND ${PYTHON_EXECUTABLE} -c "import time, sys; sys.stdout.write(time.strftime('%Y%m%d'))"
COMMAND ${Python3_EXECUTABLE} -c "import time, sys; sys.stdout.write(time.strftime('%Y%m%d'))"
OUTPUT_VARIABLE CPACK_PACKAGE_VERSION_PATCH
)
......
......@@ -18,14 +18,15 @@ environment:
MSBUILD_FLAGS: /verbosity:minimal /maxcpucount
matrix:
- CMAKE_GENERATOR: "Visual Studio 15 2017"
QT5: C:\Qt\5.11\msvc2015
QT5: C:\Qt\5.12\msvc2017
- CMAKE_GENERATOR: "Visual Studio 15 2017 Win64"
QT5: C:\Qt\5.11\msvc2017_64
QT5: C:\Qt\5.12\msvc2017_64
matrix:
fast_finish: true
before_build:
- set Path=C:\Python36;%Path%
- set Path=%QT5%\bin;%Path%
- cmake -H. -Bbuild -G "%CMAKE_GENERATOR%" "-DCMAKE_PREFIX_PATH=%QT5%" -DENABLE_GUI=ON
......
......@@ -11,11 +11,15 @@ RUN yum -y install centos-release-scl && yum clean all
RUN yum -y install python27 && yum clean all
RUN /usr/bin/scl enable python27 true
# https://www.softwarecollections.org/en/scls/rhscl/rh-python35/
RUN yum -y install rh-python35 && yum clean all
RUN /usr/bin/scl enable rh-python35 true
# https://www.softwarecollections.org/en/scls/rhscl/devtoolset-7/
#RUN yum -y install devtoolset-7 && yum clean all
RUN yum -y install devtoolset-7-gcc devtoolset-7-binutils devtoolset-7-gcc-c++ && yum clean all
RUN /usr/bin/scl enable devtoolset-7 true
# Make sure the above SCLs are already enabled
ENTRYPOINT ["/usr/bin/scl", "enable", "python27", "devtoolset-7", "--"]
CMD ["/usr/bin/scl", "enable", "python27", "devtoolset-7", "--", "/bin/bash"]
ENTRYPOINT ["/usr/bin/scl", "enable", "python27", "rh-python35", "devtoolset-7", "--"]
CMD ["/usr/bin/scl", "enable", "python27", "rh-python35", "devtoolset-7", "--", "/bin/bash"]
......@@ -2,6 +2,6 @@ FROM ubuntu:16.04
MAINTAINER "Jose Fonseca" <jfonseca@vmware.com>
ENV container docker
RUN apt-get update && apt-get install -y build-essential zlib1g-dev libdwarf-dev libx11-dev libgl-dev libwaffle-dev python2.7 ninja-build cmake
RUN apt-get update && apt-get install -y build-essential zlib1g-dev libdwarf-dev libx11-dev libgl-dev libwaffle-dev python2.7 python3 ninja-build cmake
CMD ["/bin/bash"]
......@@ -11,7 +11,7 @@ add_definitions(
if (WIN32)
add_definitions (-DAPITRACE_PYTHON_EXECUTABLE="python")
else ()
add_definitions (-DAPITRACE_PYTHON_EXECUTABLE="${PYTHON_EXECUTABLE}")
add_definitions (-DAPITRACE_PYTHON_EXECUTABLE="${Python3_EXECUTABLE}")
endif ()
include_directories (
......
......@@ -152,7 +152,7 @@ public:
}
void visit(Blob *node) override {
writer.writeByteArray(node->buf, node->size);
writer.writeBytes(node->buf, node->size);
}
void visit(Pointer *node) override {
......
......@@ -24,6 +24,7 @@
*
**************************************************************************/
#include <set>
#include <sstream>
#include <string.h>
#include <limits.h> // for CHAR_MAX
......@@ -49,7 +50,7 @@ usage(void)
" -h, --help Show detailed help for trim options and exit\n"
" --calls=CALLSET Include specified calls in the trimmed output.\n"
" --frames=FRAMESET Include specified frames in the trimmed output.\n"
" --thread=THREAD_ID Only retain calls from specified thread\n"
" --thread=THREAD_ID Only retain calls from specified thread (can be passed multiple times.)\n"
" -o, --output=TRACE_FILE Output trace file\n"
;
}
......@@ -89,8 +90,8 @@ struct trim_options {
/* Output filename */
std::string output;
/* Emit only calls from this thread (-1 == all threads) */
int thread;
/* Emit only calls from this thread (empty == all threads) */
std::set<unsigned> threadIds;
};
static int
......@@ -133,7 +134,8 @@ trim_trace(const char *filename, struct trim_options *options)
}
/* If requested, ignore all calls not belonging to the specified thread. */
if (options->thread != -1 && call->thread_id != options->thread) {
if (!options->threadIds.empty() &&
options->threadIds.find(call->thread_id) == options->threadIds.end()) {
goto NEXT;
}
......@@ -166,8 +168,6 @@ command(int argc, char *argv[])
options.calls = trace::CallSet(trace::FREQUENCY_NONE);
options.frames = trace::CallSet(trace::FREQUENCY_NONE);
options.output = "";
options.thread = -1;
int opt;
while ((opt = getopt_long(argc, argv, shortOptions, longOptions, NULL)) != -1) {
......@@ -182,7 +182,7 @@ command(int argc, char *argv[])
options.frames.merge(optarg);
break;
case THREAD_OPT:
options.thread = atoi(optarg);
options.threadIds.insert(atoi(optarg));
break;
case 'o':
options.output = optarg;
......
......@@ -54,6 +54,8 @@ private:
POP = '0',
POP_MARK = '1',
DUP = '2',
BINBYTES = 'B',
SHORT_BINBYTES = 'C',
FLOAT = 'F',
INT = 'I',
BININT = 'J',
......@@ -112,7 +114,7 @@ public:
inline void begin() {
os.put(PROTO);
os.put(2);
os.put(3);
}
inline void end() {
......@@ -314,14 +316,23 @@ public:
os.put(u.c[0]);
}
inline void writeByteArray(const void *buf, size_t length) {
os.put(GLOBAL);
os << "__builtin__\nbytearray\n";
inline void writeBytes(const char *s, size_t length) {
if (!s) {
writeNone();
return;
}
if (length < 256) {
os.put(SHORT_BINBYTES);
os.put(length);
} else {
os.put(BINBYTES);
putInt32(length);
}
os.write(s, length);
os.put(BINPUT);
os.put(1);
writeString(static_cast<const char *>(buf), length);
os.put(TUPLE1);
os.put(REDUCE);
}
inline void writePointer(unsigned long long addr) {
......
apitrace (9.0+repack-1) unstable; urgency=medium
* New upstream release.
* control: Migrate to python3. (Closes: #936126)
* patches: Refreshed.
-- Timo Aaltonen <tjaalton@debian.org> Fri, 29 Nov 2019 07:42:02 +0200
apitrace (8.0+repack-2) unstable; urgency=medium
* rules: fix built-using to have the source package version, not
......
......@@ -13,7 +13,7 @@ Build-Depends:
qtbase5-dev,
libqt5webkit5-dev,
pkg-config,
python,
python3,
zlib1g-dev,
libsnappy-dev,
libpng-dev,
......@@ -31,8 +31,8 @@ Depends:
${shlibs:Depends},
${misc:Depends},
apitrace-tracers (= ${binary:Version}),
python,
python-pil,
python3,
python3-pil,
Description: tools for debugging OpenGL applications and drivers - cli frontends
apitrace is a suite of tools for debugging OpenGL applications and drivers.
It includes a tool to generate a trace of all the OpenGL calls an application
......
......@@ -3,7 +3,7 @@ index ed3b54d4..cf0ddf5d 100644
--- a/scripts/highlight.py
+++ b/scripts/highlight.py
@@ -1,3 +1,4 @@
+#!/usr/bin/env python
+#!/usr/bin/env python3
#########################################################################
#
# Copyright 2011-2012 Jose Fonseca
......@@ -4,12 +4,13 @@ Author: Christopher James Halse Rogers <raof@ubuntu.com>
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -530,8 +530,6 @@ endif ()
@@ -539,9 +539,6 @@ endif ()
add_subdirectory (thirdparty/crc32c)
if (CMAKE_EXECUTABLE_FORMAT STREQUAL "ELF")
- add_subdirectory (thirdparty/libbacktrace)
- include_directories (${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/libbacktrace)
- include_directories (${CMAKE_CURRENT_BINARY_DIR}/thirdparty/libbacktrace)
set (LIBBACKTRACE_LIBRARIES ${CMAKE_DL_LIBS} backtrace)
add_definitions (-DHAVE_BACKTRACE=1)
endif ()
......@@ -7,7 +7,7 @@ add_custom_command (
OUTPUT
${CMAKE_CURRENT_BINARY_DIR}/glproc.hpp
${CMAKE_CURRENT_BINARY_DIR}/glproc.cpp
COMMAND ${PYTHON_EXECUTABLE}
COMMAND ${Python3_EXECUTABLE}
${CMAKE_CURRENT_SOURCE_DIR}/glproc.py
${CMAKE_CURRENT_BINARY_DIR}/glproc.hpp
${CMAKE_CURRENT_BINARY_DIR}/glproc.cpp
......
from dispatch import *
from .dispatch import *
......@@ -35,3 +35,11 @@
#include <d3d8.h>
#ifndef D3DSI_INSTLENGTH_MASK
#define D3DSI_INSTLENGTH_MASK 0x0F000000
#endif
#ifndef D3DSI_INSTLENGTH_SHIFT
#define D3DSI_INSTLENGTH_SHIFT 24
#endif
......@@ -104,4 +104,10 @@
#define D3DUSAGE_RESTRICT_SHARED_RESOURCE_DRIVER 0x00001000L
#endif
#ifndef D3DSI_INSTLENGTH_MASK
#define D3DSI_INSTLENGTH_MASK 0x0F000000
#endif
#ifndef D3DSI_INSTLENGTH_SHIFT
#define D3DSI_INSTLENGTH_SHIFT 24
#endif
......@@ -58,18 +58,18 @@ class Dispatcher:
# define standard name aliases for convenience, but only when not
# tracing, as that would cause symbol clashing with the tracing
# functions
print '#ifdef RETRACE'
print('#ifdef RETRACE')
for function in module.functions:
print '#define %s _%s' % (function.name, function.name)
print '#endif /* RETRACE */'
print
print('#define %s _%s' % (function.name, function.name))
print('#endif /* RETRACE */')
print()
def dispatchFunctionDecl(self, module, function):
ptype = function_pointer_type(function)
pvalue = function_pointer_value(function)
print 'typedef ' + function.prototype('* %s' % ptype) + ';'
print 'extern %s %s;' % (ptype, pvalue)
print
print('typedef ' + function.prototype('* %s' % ptype) + ';')
print('extern %s %s;' % (ptype, pvalue))
print()
def dispatchModuleImpl(self, module):
for function in module.functions:
......@@ -84,19 +84,19 @@ class Dispatcher:
else:
ret = 'return '
print 'static ' + function.prototype('_fail_' + function.name) + ' {'
print('static ' + function.prototype('_fail_' + function.name) + ' {')
self.failFunction(function)
print '}'
print
print('}')
print()
print 'static ' + function.prototype('_get_' + function.name) + ' {'
print('static ' + function.prototype('_get_' + function.name) + ' {')
self.invokeGetProcAddress(module, function)
print ' %s%s(%s);' % (ret, pvalue, ', '.join([str(arg.name) for arg in function.args]))
print '}'
print
print(' %s%s(%s);' % (ret, pvalue, ', '.join([str(arg.name) for arg in function.args])))
print('}')
print()
print '%s %s = &%s;' % (ptype, pvalue, '_get_' + function.name)
print
print('%s %s = &%s;' % (ptype, pvalue, '_get_' + function.name))
print()
def getProcAddressName(self, module, function):
raise NotImplementedError
......@@ -105,25 +105,25 @@ class Dispatcher:
ptype = function_pointer_type(function)
pvalue = function_pointer_value(function)
getProcAddressName = self.getProcAddressName(module, function)
print ' %s _ptr;' % (ptype,)
print ' _ptr = (%s)%s("%s");' % (ptype, getProcAddressName, function.name)
print ' if (!_ptr) {'
print ' _ptr = &%s;' % ('_fail_' + function.name)
print ' }'
print ' %s = _ptr;' % (pvalue,)
print(' %s _ptr;' % (ptype,))
print(' _ptr = (%s)%s("%s");' % (ptype, getProcAddressName, function.name))
print(' if (!_ptr) {')
print(' _ptr = &%s;' % ('_fail_' + function.name))
print(' }')
print(' %s = _ptr;' % (pvalue,))
def failFunction(self, function):
print r' const char *_name = "%s";' % function.name
print(r' const char *_name = "%s";' % function.name)
if function.type is stdapi.Void or function.fail is not None:
print r' os::log("warning: ignoring call to unavailable function %s\n", _name);'
print(r' os::log("warning: ignoring call to unavailable function %s\n", _name);')
if function.type is stdapi.Void:
assert function.fail is None
print ' return;'
print(' return;')
else:
assert function.fail is not None
print ' return %s;' % function.fail
print(' return %s;' % function.fail)
else:
print r' os::log("error: unavailable function %s\n", _name);'
print r' os::abort();'
print(r' os::log("error: unavailable function %s\n", _name);')
print(r' os::abort();')
......@@ -31,6 +31,7 @@
#pragma once
#include <stdint.h>
#include <KHR/khrplatform.h>
#ifdef _GDI32_
......
......@@ -504,19 +504,19 @@ class GlDispatcher(Dispatcher):
def failFunction(self, function):
# Fallback to EXT_debug_label on MacOSX, some enums need to be translated.
if function.name in ('glObjectLabel', 'glObjectLabelKHR'):
print r'#ifdef __APPLE__'
print r' if (translateDebugLabelIdentifier(identifier)) {'
print r' _glLabelObjectEXT(identifier, name, length < 0 ? 0 : length, length == 0 ? "" : label);'
print r' return;'
print r' }'
print r'#endif'
print(r'#ifdef __APPLE__')
print(r' if (translateDebugLabelIdentifier(identifier)) {')
print(r' _glLabelObjectEXT(identifier, name, length < 0 ? 0 : length, length == 0 ? "" : label);')
print(r' return;')
print(r' }')
print(r'#endif')
if function.name in ('glGetObjectLabel', 'glGetObjectLabelKHR'):
print r'#ifdef __APPLE__'
print r' if (translateDebugLabelIdentifier(identifier)) {'
print r' _glGetObjectLabelEXT(identifier, name, bufSize, length, label);'
print r' return;'
print r' }'
print r'#endif'
print(r'#ifdef __APPLE__')
print(r' if (translateDebugLabelIdentifier(identifier)) {')
print(r' _glGetObjectLabelEXT(identifier, name, bufSize, length, label);')
print(r' return;')
print(r' }')
print(r'#endif')
# We fake these when they are not available
if function.name in (
......@@ -553,25 +553,25 @@ class GlDispatcher(Dispatcher):
):
return
if function.name.startswith('glGetObjectLabel'):
print r' if (length != 0) *length = 0;'
print r' if (label != 0 && bufSize > 0) *label = 0;'
print(r' if (length != 0) *length = 0;')
print(r' if (label != 0 && bufSize > 0) *label = 0;')
return
if function.name == 'glGetDebugMessageLogAMD':
print r' if (categories != 0) *categories = 0;'
print r' if (ids != 0) *ids = 0;'
print r' if (severities != 0) *severities = 0;'
print r' if (lengths != 0) *lengths = 0;'
print r' if (message != 0 && bufsize > 0) *message = 0;'
print r' return 0;'
print(r' if (categories != 0) *categories = 0;')
print(r' if (ids != 0) *ids = 0;')
print(r' if (severities != 0) *severities = 0;')
print(r' if (lengths != 0) *lengths = 0;')
print(r' if (message != 0 && bufsize > 0) *message = 0;')
print(r' return 0;')
return
if function.name.startswith('glGetDebugMessageLog'):
print r' if (sources != 0) *sources = 0;'
print r' if (types != 0) *types = 0;'
print r' if (ids != 0) *ids = 0;'
print r' if (severities != 0) *severities = 0;'
print r' if (lengths != 0) *lengths = 0;'
print r' if (messageLog != 0 && bufsize > 0) *messageLog = 0;'
print r' return 0;'
print(r' if (sources != 0) *sources = 0;')
print(r' if (types != 0) *types = 0;')
print(r' if (ids != 0) *ids = 0;')
print(r' if (severities != 0) *severities = 0;')
print(r' if (lengths != 0) *lengths = 0;')
print(r' if (messageLog != 0 && bufsize > 0) *messageLog = 0;')
print(r' return 0;')
return
Dispatcher.failFunction(self, function)
......@@ -581,96 +581,96 @@ if __name__ == '__main__':
decl, impl = sys.argv[1:]
sys.stdout = open(decl, 'wt')
print
print '#pragma once'
print
print '#include "glimports.hpp"'
print
print '#if defined(_WIN32)'
print 'extern HMODULE _libGlHandle;'
print '#else'
print 'extern void * _libGlHandle;'
print '#endif'
print
print 'void * _getPublicProcAddress(const char *procName);'
print 'void * _getPrivateProcAddress(const char *procName);'
print
print()
print('#pragma once')
print()
print('#include "glimports.hpp"')
print()
print('#if defined(_WIN32)')
print('extern HMODULE _libGlHandle;')
print('#else')
print('extern void * _libGlHandle;')
print('#endif')
print()
print('void * _getPublicProcAddress(const char *procName);')
print('void * _getPrivateProcAddress(const char *procName);')
print()
dispatcher = GlDispatcher()
print
print()
dispatcher.dispatchModuleDecl(eglapi)
print
print '#if defined(_WIN32)'
print
print()
print('#if defined(_WIN32)')
print()
dispatcher.dispatchModuleDecl(wglapi)
print
print '#elif defined(__APPLE__)'
print
print()
print('#elif defined(__APPLE__)')
print()
dispatcher.dispatchModuleDecl(cglapi)
print
print '#elif defined(HAVE_X11)'
print
print()
print('#elif defined(HAVE_X11)')
print()
dispatcher.dispatchModuleDecl(glxapi)
print
print '#endif'
print
print()
print('#endif')
print()
dispatcher.dispatchModuleDecl(glapi)
print
print()
sys.stdout = open(impl, 'wt')
print
print '#include "glproc.hpp"'
print '#include "os.hpp"'
print
print()
print('#include "glproc.hpp"')
print('#include "os.hpp"')
print()
dispatcher = GlDispatcher()
print
print()
dispatcher.dispatchModuleImpl(eglapi)
print
print '#if defined(_WIN32)'
print
print()
print('#if defined(_WIN32)')
print()
dispatcher.dispatchModuleImpl(wglapi)
print
print '#elif defined(__APPLE__)'
print
print 'static inline bool'
print 'translateDebugLabelIdentifier(GLenum & identifier)'
print '{'
print ' switch (identifier) {'
print ' case GL_TEXTURE:'
print ' case GL_FRAMEBUFFER:'
print ' case GL_RENDERBUFFER:'
print ' case GL_SAMPLER:'
print ' case GL_TRANSFORM_FEEDBACK:'
print ' return true;'
print ' case GL_BUFFER:'
print ' identifier = GL_BUFFER_OBJECT_EXT;'
print ' return true;'
print ' case GL_SHADER:'
print ' identifier = GL_SHADER_OBJECT_EXT;'
print ' return true;'
print ' case GL_PROGRAM:'
print ' identifier = GL_PROGRAM_OBJECT_EXT;'
print ' return true;'
print ' case GL_VERTEX_ARRAY:'
print ' identifier = GL_VERTEX_ARRAY_OBJECT_EXT;'
print ' return true;'
print ' case GL_QUERY:'
print ' identifier = GL_QUERY_OBJECT_EXT;'
print ' return true;'
print ' case GL_PROGRAM_PIPELINE:'
print ' identifier = GL_PROGRAM_PIPELINE_OBJECT_EXT;'
print ' return true;'
print ' default:'
print ' return false;'
print ' }'
print '}'
print
print()
print('#elif defined(__APPLE__)')
print()
print('static inline bool')
print('translateDebugLabelIdentifier(GLenum & identifier)')
print('{')
print(' switch (identifier) {')
print(' case GL_TEXTURE:')
print(' case GL_FRAMEBUFFER:')
print(' case GL_RENDERBUFFER:')
print(' case GL_SAMPLER:')
print(' case GL_TRANSFORM_FEEDBACK:')
print(' return true;')
print(' case GL_BUFFER:')
print(' identifier = GL_BUFFER_OBJECT_EXT;')
print(' return true;')
print(' case GL_SHADER:')
print(' identifier = GL_SHADER_OBJECT_EXT;')
print(' return true;')
print(' case GL_PROGRAM:')
print(' identifier = GL_PROGRAM_OBJECT_EXT;')
print(' return true;')
print(' case GL_VERTEX_ARRAY:')
print(' identifier = GL_VERTEX_ARRAY_OBJECT_EXT;')
print(' return true;')
print(' case GL_QUERY:')
print(' identifier = GL_QUERY_OBJECT_EXT;')
print(' return true;')
print(' case GL_PROGRAM_PIPELINE:')
print(' identifier = GL_PROGRAM_PIPELINE_OBJECT_EXT;')
print(' return true;')
print(' default:')
print(' return false;')
print(' }')
print('}')
print()
dispatcher.dispatchModuleImpl(cglapi)
print
print '#elif defined(HAVE_X11)'
print
print()
print('#elif defined(HAVE_X11)')
print()
dispatcher.dispatchModuleImpl(glxapi)
print
print '#endif'
print
print()
print('#endif')
print()
dispatcher.dispatchModuleImpl(glapi)
print
print()