diff options
-rwxr-xr-x | emcc | 394 | ||||
-rw-r--r-- | src/deps_info.json | 7 | ||||
-rw-r--r-- | src/jsifier.js | 10 | ||||
-rw-r--r-- | src/library.js | 2 | ||||
-rw-r--r-- | src/library_egl.js | 2 | ||||
-rw-r--r-- | src/library_gl.js | 190 | ||||
-rw-r--r-- | src/library_sdl.js | 2 | ||||
-rw-r--r-- | src/preamble.js | 4 | ||||
-rw-r--r-- | system/lib/gl.c | 1729 | ||||
-rw-r--r-- | system/lib/gl.symbols | 1 | ||||
-rw-r--r-- | system/lib/sdl.cpp | 13 | ||||
-rw-r--r-- | system/lib/sdl.symbols | 1 | ||||
-rw-r--r-- | tests/cubegeom_proc.c | 331 | ||||
-rwxr-xr-x | tests/runner.py | 9 | ||||
-rw-r--r-- | tests/sdlglshader.c | 5 | ||||
-rw-r--r-- | tests/test_browser.py | 21 | ||||
-rw-r--r-- | tests/test_egl.c | 5 | ||||
-rw-r--r-- | tools/file_packager.py | 3 | ||||
-rw-r--r-- | tools/shared.py | 2 | ||||
-rw-r--r-- | tools/system_libs.py | 397 |
20 files changed, 2609 insertions, 519 deletions
@@ -47,9 +47,9 @@ emcc can be influenced by a few environment variables: EMMAKEN_COMPILER - The compiler to be used, if you don't want the default clang. ''' -import os, sys, shutil, tempfile, subprocess, shlex, time, re, logging +import os, sys, shutil, tempfile, subprocess, shlex, time, re, logging, json from subprocess import PIPE, STDOUT -from tools import shared, jsrun +from tools import shared, jsrun, system_libs from tools.shared import Compression, execute, suffix, unsuffixed, unsuffixed_basename, WINDOWS from tools.response_file import read_response_file @@ -311,6 +311,13 @@ Options that are modified or new in %s include: If a directory is passed here, its entire contents will be embedded. + Note: Embedding files is much less + efficient than preloading them. You + should only use it for small amounts + of small files. Instead, use + --preload-file which emits efficient + binary data. + --preload-file <name> A file to preload before running the compiled code asynchronously. Otherwise similar to --embed-file, except that this @@ -384,6 +391,9 @@ Options that are modified or new in %s include: The main file resides in the base directory and has the suffix ".js". + Note: this option is deprecated (modern JS debuggers + should work ok even on large files) + --bind Compiles the source code using the "embind" bindings approach, which connects C/C++ and JS. @@ -1194,12 +1204,12 @@ try: assert shared.Settings.RESERVED_FUNCTION_POINTERS == 0, 'reserved function pointers not supported in fastcomp' assert shared.Settings.ASM_HEAP_LOG == 0, 'asm heap log not supported in fastcomp' assert shared.Settings.LABEL_DEBUG == 0, 'label debug not supported in fastcomp' - assert shared.Settings.LEGACY_GL_EMULATION == 0, 'legacy gl emulation not supported in fastcomp' assert shared.Settings.EXECUTION_TIMEOUT == -1, 'execution timeout not supported in fastcomp' assert shared.Settings.NAMED_GLOBALS == 0, 'named globals not supported in fastcomp' assert shared.Settings.PGO == 0, 'pgo not supported in fastcomp' assert shared.Settings.TARGET_LE32 == 1, 'fastcomp requires le32' assert shared.Settings.USE_TYPED_ARRAYS == 2, 'fastcomp assumes ta2' + assert not split_js_file, '--split-js is deprecated and not supported in fastcomp' assert not bind, 'embind not supported in fastcomp yet' if jcache: logging.warning('jcache is not supported in fastcomp (you should not need it anyhow), disabling') @@ -1401,382 +1411,12 @@ try: logging.debug('will generate JavaScript') - extra_files_to_link = [] - if not LEAVE_INPUTS_RAW and \ - not shared.Settings.BUILD_AS_SHARED_LIB == 2 and \ + not shared.Settings.BUILD_AS_SHARED_LIB and \ not shared.Settings.SIDE_MODULE: # shared libraries/side modules link no C libraries, need them in parent - - # Check if we need to include some libraries that we compile. (We implement libc ourselves in js, but - # compile a malloc implementation and stdlibc++.) - - def read_symbols(path, exclude=None): - symbols = map(lambda line: line.strip().split(' ')[1], open(path).readlines()) - if exclude: - symbols = filter(lambda symbol: symbol not in exclude, symbols) - return set(symbols) - - lib_opts = ['-O2'] - - # XXX We also need to add libc symbols that use malloc, for example strdup. It's very rare to use just them and not - # a normal malloc symbol (like free, after calling strdup), so we haven't hit this yet, but it is possible. - libc_symbols = read_symbols(shared.path_from_root('system', 'lib', 'libc.symbols')) - sdl_symbols = read_symbols(shared.path_from_root('system', 'lib', 'sdl.symbols')) - libcextra_symbols = read_symbols(shared.path_from_root('system', 'lib', 'libcextra.symbols')) - libcxx_symbols = read_symbols(shared.path_from_root('system', 'lib', 'libcxx', 'symbols'), exclude=libc_symbols) - libcxxabi_symbols = read_symbols(shared.path_from_root('system', 'lib', 'libcxxabi', 'symbols'), exclude=libc_symbols) - - # XXX we should disable EMCC_DEBUG when building libs, just like in the relooper - - def build_libc(lib_filename, files): - o_s = [] - prev_cxx = os.environ.get('EMMAKEN_CXX') - if prev_cxx: os.environ['EMMAKEN_CXX'] = '' - musl_internal_includes = shared.path_from_root('system', 'lib', 'libc', 'musl', 'src', 'internal') - for src in files: - o = in_temp(os.path.basename(src) + '.o') - execute([shared.PYTHON, shared.EMCC, shared.path_from_root('system', 'lib', src), '-o', o, '-I', musl_internal_includes] + lib_opts, stdout=stdout, stderr=stderr) - o_s.append(o) - if prev_cxx: os.environ['EMMAKEN_CXX'] = prev_cxx - shared.Building.link(o_s, in_temp(lib_filename)) - return in_temp(lib_filename) - - def build_libcxx(src_dirname, lib_filename, files): - o_s = [] - for src in files: - o = in_temp(src + '.o') - srcfile = shared.path_from_root(src_dirname, src) - execute([shared.PYTHON, shared.EMXX, srcfile, '-o', o, '-std=c++11'] + lib_opts, stdout=stdout, stderr=stderr) - o_s.append(o) - shared.Building.link(o_s, in_temp(lib_filename)) - return in_temp(lib_filename) - - # libc - def create_libc(): - logging.debug(' building libc for cache') - libc_files = [ - 'dlmalloc.c', - os.path.join('libcxx', 'new.cpp'), - ] - musl_files = [ - ['internal', [ - 'floatscan.c', - 'shgetc.c', - ]], - ['math', [ - 'scalbn.c', - 'scalbnl.c', - ]], - ['stdio', [ - '__overflow.c', - '__toread.c', - '__towrite.c', - '__uflow.c', - ]], - ['stdlib', [ - 'atof.c', - 'strtod.c', - ]], - ['string', [ - 'memcmp.c', - 'strcasecmp.c', - 'strcmp.c', - 'strncasecmp.c', - 'strncmp.c', - ]] - ] - for directory, sources in musl_files: - libc_files += [os.path.join('libc', 'musl', 'src', directory, source) for source in sources] - return build_libc('libc.bc', libc_files) - - def apply_libc(need): - # libc needs some sign correction. # If we are in mode 0, switch to 2. We will add our lines - try: - if shared.Settings.CORRECT_SIGNS == 0: raise Exception('we need to change to 2') - except: # we fail if equal to 0 - so we need to switch to 2 - or if CORRECT_SIGNS is not even in Settings - shared.Settings.CORRECT_SIGNS = 2 - if shared.Settings.CORRECT_SIGNS == 2: - shared.Settings.CORRECT_SIGNS_LINES = [shared.path_from_root('src', 'dlmalloc.c') + ':' + str(i+4) for i in [4816, 4191, 4246, 4199, 4205, 4235, 4227]] - # If we are in mode 1, we are correcting everything anyhow. If we are in mode 3, we will be corrected - # so all is well anyhow too. - return True - - # libcextra - def create_libcextra(): - logging.debug('building libcextra for cache') - musl_files = [ - ['ctype', [ - 'iswalnum.c', - 'iswalpha.c', - 'iswblank.c', - 'iswcntrl.c', - 'iswctype.c', - 'iswdigit.c', - 'iswgraph.c', - 'iswlower.c', - 'iswprint.c', - 'iswpunct.c', - 'iswspace.c', - 'iswupper.c', - 'iswxdigit.c', - 'towctrans.c', - 'wcswidth.c', - 'wctrans.c', - 'wcwidth.c', - ]], - ['internal', [ - 'intscan.c', - ]], - ['legacy', [ - 'err.c', - ]], - ['locale', [ - 'iconv.c', - 'iswalnum_l.c', - 'iswalpha_l.c', - 'iswblank_l.c', - 'iswcntrl_l.c', - 'iswctype_l.c', - 'iswdigit_l.c', - 'iswgraph_l.c', - 'iswlower_l.c', - 'iswprint_l.c', - 'iswpunct_l.c', - 'iswspace_l.c', - 'iswupper_l.c', - 'iswxdigit_l.c', - 'strcoll.c', - 'strcasecmp_l.c', - 'strfmon.c', - 'strncasecmp_l.c', - 'strxfrm.c', - 'towctrans_l.c', - 'towlower_l.c', - 'towupper_l.c', - 'wcscoll.c', - 'wcscoll_l.c', - 'wcsxfrm.c', - 'wcsxfrm_l.c', - 'wctrans_l.c', - 'wctype_l.c', - ]], - ['math', [ - '__cos.c', - '__cosdf.c', - '__sin.c', - '__sindf.c', - 'ilogb.c', - 'ilogbf.c', - 'ilogbl.c', - 'ldexp.c', - 'ldexpf.c', - 'ldexpl.c', - 'logb.c', - 'logbf.c', - 'logbl.c', - 'lgamma.c', - 'lgamma_r.c', - 'lgammaf.c', - 'lgammaf_r.c', - 'lgammal.c', - 'scalbnf.c', - 'signgam.c', - 'tgamma.c', - 'tgammaf.c', - 'tgammal.c' - ]], - ['misc', [ - 'getopt.c', - 'getopt_long.c', - ]], - ['multibyte', [ - 'btowc.c', - 'mblen.c', - 'mbrlen.c', - 'mbrtowc.c', - 'mbsinit.c', - 'mbsnrtowcs.c', - 'mbsrtowcs.c', - 'mbstowcs.c', - 'mbtowc.c', - 'wcrtomb.c', - 'wcsnrtombs.c', - 'wcsrtombs.c', - 'wcstombs.c', - 'wctob.c', - 'wctomb.c', - ]], - ['regex', [ - 'fnmatch.c', - 'regcomp.c', - 'regerror.c', - 'regexec.c', - 'tre-mem.c', - ]], - ['stdio', [ - 'fwprintf.c', - 'swprintf.c', - 'vfwprintf.c', - 'vswprintf.c', - 'vwprintf.c', - 'wprintf.c', - 'fputwc.c', - 'fputws.c', - ]], - ['stdlib', [ - 'ecvt.c', - 'fcvt.c', - 'gcvt.c', - 'wcstod.c', - 'wcstol.c', - ]], - ['string', [ - 'memccpy.c', - 'memmem.c', - 'mempcpy.c', - 'memrchr.c', - 'strcasestr.c', - 'strchrnul.c', - 'strlcat.c', - 'strlcpy.c', - 'strsep.c', - 'strverscmp.c', - 'wcpcpy.c', - 'wcpncpy.c', - 'wcscasecmp.c', - 'wcscasecmp_l.c', - 'wcscat.c', - 'wcschr.c', - 'wcscmp.c', - 'wcscpy.c', - 'wcscspn.c', - 'wcsdup.c', - 'wcslen.c', - 'wcsncasecmp.c', - 'wcsncasecmp_l.c', - 'wcsncat.c', - 'wcsncmp.c', - 'wcsncpy.c', - 'wcsnlen.c', - 'wcspbrk.c', - 'wcsrchr.c', - 'wcsspn.c', - 'wcsstr.c', - 'wcstok.c', - 'wcswcs.c', - 'wmemchr.c', - 'wmemcmp.c', - 'wmemcpy.c', - 'wmemmove.c', - 'wmemset.c', - ]] - ] - libcextra_files = [] - for directory, sources in musl_files: - libcextra_files += [os.path.join('libc', 'musl', 'src', directory, source) for source in sources] - return build_libc('libcextra.bc', libcextra_files) - - # libcxx - def create_libcxx(): - logging.debug('building libcxx for cache') - libcxx_files = [ - 'algorithm.cpp', - 'condition_variable.cpp', - 'future.cpp', - 'iostream.cpp', - 'memory.cpp', - 'random.cpp', - 'stdexcept.cpp', - 'system_error.cpp', - 'utility.cpp', - 'bind.cpp', - 'debug.cpp', - 'hash.cpp', - 'mutex.cpp', - 'string.cpp', - 'thread.cpp', - 'valarray.cpp', - 'chrono.cpp', - 'exception.cpp', - 'ios.cpp', - 'locale.cpp', - 'regex.cpp', - 'strstream.cpp' - ] - return build_libcxx(os.path.join('system', 'lib', 'libcxx'), 'libcxx.bc', libcxx_files) - - def apply_libcxx(need): - assert shared.Settings.QUANTUM_SIZE == 4, 'We do not support libc++ with QUANTUM_SIZE == 1' - # libcxx might need corrections, so turn them all on. TODO: check which are actually needed - shared.Settings.CORRECT_SIGNS = shared.Settings.CORRECT_OVERFLOWS = shared.Settings.CORRECT_ROUNDINGS = 1 - #logging.info('using libcxx turns on CORRECT_* options') - return True - - # libcxxabi - just for dynamic_cast for now - def create_libcxxabi(): - logging.debug('building libcxxabi for cache') - libcxxabi_files = [ - 'typeinfo.cpp', - 'private_typeinfo.cpp' - ] - return build_libcxx(os.path.join('system', 'lib', 'libcxxabi', 'src'), 'libcxxabi.bc', libcxxabi_files) - - def apply_libcxxabi(need): - assert shared.Settings.QUANTUM_SIZE == 4, 'We do not support libc++abi with QUANTUM_SIZE == 1' - #logging.info('using libcxxabi, this may need CORRECT_* options') - #shared.Settings.CORRECT_SIGNS = shared.Settings.CORRECT_OVERFLOWS = shared.Settings.CORRECT_ROUNDINGS = 1 - return True - - # SDL. We include code that demands malloc/free if not already required, so we have proper malloc/free from JS SDL code. - # Note that the Force instance here can be optimized out, but we still export malloc/free, so they will be kept alive. - def create_sdl(): - return build_libcxx(os.path.join('system', 'lib'), 'sdl.bc', ['sdl.cpp']) - - def apply_sdl(need): - return 'SDL_Init' in all_needed and ('malloc' not in all_needed or 'free' not in all_needed) - - # Settings this in the environment will avoid checking dependencies and make building big projects a little faster - # 1 means include everything; otherwise it can be the name of a lib (libcxx, etc.) - force = os.environ.get('EMCC_FORCE_STDLIBS') - force_all = force == '1' - - # Scan symbols - all_needed = set() - symbolses = map(lambda temp_file: shared.Building.llvm_nm(temp_file), temp_files) - for symbols in symbolses: - all_needed.update(symbols.undefs) - for symbols in symbolses: - all_needed.difference_update(symbols.defs) - - # Go over libraries to figure out which we must include - # If we have libcxx, we must force inclusion of libc, since libcxx uses new internally. Note: this is kind of hacky. - has = need = None - for name, create, apply_, library_symbols in [('libcxx', create_libcxx, apply_libcxx, libcxx_symbols), - ('libcextra', create_libcextra, lambda x: True, libcextra_symbols), - ('libcxxabi', create_libcxxabi, apply_libcxxabi, libcxxabi_symbols), - ('sdl', create_sdl, apply_sdl, sdl_symbols), - ('libc', create_libc, apply_libc, libc_symbols)]: - force_this = force_all or force == name - if not force_this: - need = set() - has = set() - for symbols in symbolses: - for library_symbol in library_symbols: - if library_symbol in symbols.undefs: - need.add(library_symbol) - if library_symbol in symbols.defs: - has.add(library_symbol) - for haz in has: # remove symbols that are supplied by another of the inputs - if haz in need: - need.remove(haz) - if shared.Settings.VERBOSE: logging.debug('considering %s: we need %s and have %s' % (name, str(need), str(has))) - if force_this or len(need) > 0: - force_all = True - if apply_(need): - # We need to build and link the library in - logging.debug('including %s' % name) - libfile = shared.Cache.get(name, create) - extra_files_to_link.append(libfile) + extra_files_to_link = system_libs.calculate(temp_files, in_temp, stdout, stderr) + else: + extra_files_to_link = [] log_time('calculate system libraries') diff --git a/src/deps_info.json b/src/deps_info.json new file mode 100644 index 00000000..b38ffd00 --- /dev/null +++ b/src/deps_info.json @@ -0,0 +1,7 @@ +{ + "uuid_compare": ["memcmp"], + "SDL_Init": ["malloc", "free"], + "SDL_GL_GetProcAddress": ["emscripten_GetProcAddress"], + "eglGetProcAddress": ["emscripten_GetProcAddress"] +} + diff --git a/src/jsifier.js b/src/jsifier.js index ef15088e..6742f504 100644 --- a/src/jsifier.js +++ b/src/jsifier.js @@ -499,12 +499,8 @@ function JSify(data, functionsOnly) { if (!LINKABLE && !LibraryManager.library.hasOwnProperty(shortident) && !LibraryManager.library.hasOwnProperty(shortident + '__inline')) { if (ERROR_ON_UNDEFINED_SYMBOLS) error('unresolved symbol: ' + shortident); else if (VERBOSE || WARN_ON_UNDEFINED_SYMBOLS) warn('unresolved symbol: ' + shortident); - if (ASM_JS) { - // emit a stub that will fail during runtime. this allows asm validation to succeed. - LibraryManager.library[shortident] = new Function("Module['printErr']('missing function: " + shortident + "'); abort(-1);"); - } else { - cancel = true; // emit nothing, not even var X = undefined; - } + // emit a stub that will fail at runtime + LibraryManager.library[shortident] = new Function("Module['printErr']('missing function: " + shortident + "'); abort(-1);"); } item.JS = cancel ? ';' : addFromLibrary(shortident); } @@ -1852,7 +1848,7 @@ function JSify(data, functionsOnly) { // rest of the output that we started to print out earlier (see comment on the // "Final shape that will be created"). if (PRECISE_I64_MATH && Types.preciseI64MathUsed) { - if (!INCLUDE_FULL_LIBRARY && !SIDE_MODULE) { + if (!INCLUDE_FULL_LIBRARY && !SIDE_MODULE && !BUILD_AS_SHARED_LIB) { // first row are utilities called from generated code, second are needed from fastLong ['i64Add', 'i64Subtract', 'bitshift64Shl', 'bitshift64Lshr', 'bitshift64Ashr', 'llvm_ctlz_i32', 'llvm_cttz_i32'].forEach(function(func) { diff --git a/src/library.js b/src/library.js index a557810c..8f5010ad 100644 --- a/src/library.js +++ b/src/library.js @@ -4613,6 +4613,8 @@ LibraryManager.library = { _ZTIv: [0], // void _ZTIPv: [0], // void* + _ZTISt9exception: [0], // typeinfo for std::exception + llvm_uadd_with_overflow_i8: function(x, y) { x = x & 0xff; y = y & 0xff; diff --git a/src/library_egl.js b/src/library_egl.js index 11cf8951..69dd266d 100644 --- a/src/library_egl.js +++ b/src/library_egl.js @@ -555,7 +555,7 @@ var LibraryEGL = { eglGetProcAddress__deps: ['emscripten_GetProcAddress'], eglGetProcAddress: function(name_) { - return _emscripten_GetProcAddress(Pointer_stringify(name_)); + return _emscripten_GetProcAddress(name_); }, }; diff --git a/src/library_gl.js b/src/library_gl.js index baa0597d..978fb87e 100644 --- a/src/library_gl.js +++ b/src/library_gl.js @@ -1548,9 +1548,7 @@ var LibraryGL = { #endif var log = GLctx.getShaderInfoLog(GL.shaders[shader]); // Work around a bug in Chromium which causes getShaderInfoLog to return null - if (!log) { - log = ""; - } + if (!log) log = '(unknown error)'; log = log.substr(0, maxLength - 1); writeStringToMemory(log, infoLog); if (length) { @@ -1564,7 +1562,10 @@ var LibraryGL = { GL.validateGLObjectID(GL.shaders, shader, 'glGetShaderiv', 'shader'); #endif if (pname == 0x8B84) { // GL_INFO_LOG_LENGTH - {{{ makeSetValue('p', '0', 'GLctx.getShaderInfoLog(GL.shaders[shader]).length + 1', 'i32') }}}; + var log = GLctx.getShaderInfoLog(GL.shaders[shader]); + // Work around a bug in Chromium which causes getShaderInfoLog to return null + if (!log) log = '(unknown error)'; + {{{ makeSetValue('p', '0', 'log.length + 1', 'i32') }}}; } else { {{{ makeSetValue('p', '0', 'GLctx.getShaderParameter(GL.shaders[shader], pname)', 'i32') }}}; } @@ -1853,7 +1854,7 @@ var LibraryGL = { }; var glEnable = _glEnable; - _glEnable = function _glEnable(cap) { + _glEnable = _emscripten_glEnable = function _glEnable(cap) { // Clean up the renderer on any change to the rendering state. The optimization of // skipping renderer setup is aimed at the case of multiple glDraw* right after each other if (GLImmediate.lastRenderer) GLImmediate.lastRenderer.cleanup(); @@ -1878,7 +1879,7 @@ var LibraryGL = { }; var glDisable = _glDisable; - _glDisable = function _glDisable(cap) { + _glDisable = _emscripten_glDisable = function _glDisable(cap) { if (GLImmediate.lastRenderer) GLImmediate.lastRenderer.cleanup(); if (cap == 0x0B60 /* GL_FOG */) { if (GLEmulation.fogEnabled != false) { @@ -1899,7 +1900,7 @@ var LibraryGL = { } glDisable(cap); }; - _glIsEnabled = function _glIsEnabled(cap) { + _glIsEnabled = _emscripten_glIsEnabled = function _glIsEnabled(cap) { if (cap == 0x0B60 /* GL_FOG */) { return GLEmulation.fogEnabled ? 1 : 0; } else if (!(cap in validCapabilities)) { @@ -1909,7 +1910,7 @@ var LibraryGL = { }; var glGetBooleanv = _glGetBooleanv; - _glGetBooleanv = function _glGetBooleanv(pname, p) { + _glGetBooleanv = _emscripten_glGetBooleanv = function _glGetBooleanv(pname, p) { var attrib = GLEmulation.getAttributeFromCapability(pname); if (attrib !== null) { var result = GLImmediate.enabledClientAttributes[attrib]; @@ -1920,7 +1921,7 @@ var LibraryGL = { }; var glGetIntegerv = _glGetIntegerv; - _glGetIntegerv = function _glGetIntegerv(pname, params) { + _glGetIntegerv = _emscripten_glGetIntegerv = function _glGetIntegerv(pname, params) { switch (pname) { case 0x84E2: pname = GLctx.MAX_TEXTURE_IMAGE_UNITS /* fake it */; break; // GL_MAX_TEXTURE_UNITS case 0x8B4A: { // GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB @@ -1989,7 +1990,7 @@ var LibraryGL = { }; var glGetString = _glGetString; - _glGetString = function _glGetString(name_) { + _glGetString = _emscripten_glGetString = function _glGetString(name_) { if (GL.stringCache[name_]) return GL.stringCache[name_]; switch(name_) { case 0x1F03 /* GL_EXTENSIONS */: // Add various extensions that we can support @@ -2013,7 +2014,7 @@ var LibraryGL = { GL.shaderOriginalSources = {}; #endif var glCreateShader = _glCreateShader; - _glCreateShader = function _glCreateShader(shaderType) { + _glCreateShader = _emscripten_glCreateShader = function _glCreateShader(shaderType) { var id = glCreateShader(shaderType); GL.shaderInfos[id] = { type: shaderType, @@ -2030,7 +2031,7 @@ var LibraryGL = { } var glShaderSource = _glShaderSource; - _glShaderSource = function _glShaderSource(shader, count, string, length) { + _glShaderSource = _emscripten_glShaderSource = function _glShaderSource(shader, count, string, length) { var source = GL.getSource(shader, count, string, length); #if GL_DEBUG console.log("glShaderSource: Input: \n" + source); @@ -2144,7 +2145,7 @@ var LibraryGL = { }; var glCompileShader = _glCompileShader; - _glCompileShader = function _glCompileShader(shader) { + _glCompileShader = _emscripten_glCompileShader = function _glCompileShader(shader) { GLctx.compileShader(GL.shaders[shader]); #if GL_DEBUG if (!GLctx.getShaderParameter(GL.shaders[shader], GLctx.COMPILE_STATUS)) { @@ -2159,14 +2160,14 @@ var LibraryGL = { GL.programShaders = {}; var glAttachShader = _glAttachShader; - _glAttachShader = function _glAttachShader(program, shader) { + _glAttachShader = _emscripten_glAttachShader = function _glAttachShader(program, shader) { if (!GL.programShaders[program]) GL.programShaders[program] = []; GL.programShaders[program].push(shader); glAttachShader(program, shader); }; var glDetachShader = _glDetachShader; - _glDetachShader = function _glDetachShader(program, shader) { + _glDetachShader = _emscripten_glDetachShader = function _glDetachShader(program, shader) { var programShader = GL.programShaders[program]; if (!programShader) { Module.printErr('WARNING: _glDetachShader received invalid program: ' + program); @@ -2178,7 +2179,7 @@ var LibraryGL = { }; var glUseProgram = _glUseProgram; - _glUseProgram = function _glUseProgram(program) { + _glUseProgram = _emscripten_glUseProgram = function _glUseProgram(program) { #if GL_DEBUG if (GL.debug) { Module.printErr('[using program with shaders]'); @@ -2199,7 +2200,7 @@ var LibraryGL = { } var glDeleteProgram = _glDeleteProgram; - _glDeleteProgram = function _glDeleteProgram(program) { + _glDeleteProgram = _emscripten_glDeleteProgram = function _glDeleteProgram(program) { glDeleteProgram(program); if (program == GL.currProgram) { GLImmediate.currentRenderer = null; // This changes the FFP emulation shader program, need to recompute that. @@ -2210,12 +2211,12 @@ var LibraryGL = { // If attribute 0 was not bound, bind it to 0 for WebGL performance reasons. Track if 0 is free for that. var zeroUsedPrograms = {}; var glBindAttribLocation = _glBindAttribLocation; - _glBindAttribLocation = function _glBindAttribLocation(program, index, name) { + _glBindAttribLocation = _emscripten_glBindAttribLocation = function _glBindAttribLocation(program, index, name) { if (index == 0) zeroUsedPrograms[program] = true; glBindAttribLocation(program, index, name); }; var glLinkProgram = _glLinkProgram; - _glLinkProgram = function _glLinkProgram(program) { + _glLinkProgram = _emscripten_glLinkProgram = function _glLinkProgram(program) { if (!(program in zeroUsedPrograms)) { GLctx.bindAttribLocation(GL.programs[program], 0, 'a_position'); } @@ -2223,7 +2224,7 @@ var LibraryGL = { }; var glBindBuffer = _glBindBuffer; - _glBindBuffer = function _glBindBuffer(target, buffer) { + _glBindBuffer = _emscripten_glBindBuffer = function _glBindBuffer(target, buffer) { glBindBuffer(target, buffer); if (target == GLctx.ARRAY_BUFFER) { if (GLEmulation.currentVao) { @@ -2238,7 +2239,7 @@ var LibraryGL = { }; var glGetFloatv = _glGetFloatv; - _glGetFloatv = function _glGetFloatv(pname, params) { + _glGetFloatv = _emscripten_glGetFloatv = function _glGetFloatv(pname, params) { if (pname == 0x0BA6) { // GL_MODELVIEW_MATRIX HEAPF32.set(GLImmediate.matrix[0/*m*/], params >> 2); } else if (pname == 0x0BA7) { // GL_PROJECTION_MATRIX @@ -2261,7 +2262,7 @@ var LibraryGL = { }; var glHint = _glHint; - _glHint = function _glHint(target, mode) { + _glHint = _emscripten_glHint = function _glHint(target, mode) { if (target == 0x84EF) { // GL_TEXTURE_COMPRESSION_HINT return; } @@ -2269,21 +2270,21 @@ var LibraryGL = { }; var glEnableVertexAttribArray = _glEnableVertexAttribArray; - _glEnableVertexAttribArray = function _glEnableVertexAttribArray(index) { + _glEnableVertexAttribArray = _emscripten_glEnableVertexAttribArray = function _glEnableVertexAttribArray(index) { glEnableVertexAttribArray(index); GLEmulation.enabledVertexAttribArrays[index] = 1; if (GLEmulation.currentVao) GLEmulation.currentVao.enabledVertexAttribArrays[index] = 1; }; var glDisableVertexAttribArray = _glDisableVertexAttribArray; - _glDisableVertexAttribArray = function _glDisableVertexAttribArray(index) { + _glDisableVertexAttribArray = _emscripten_glDisableVertexAttribArray = function _glDisableVertexAttribArray(index) { glDisableVertexAttribArray(index); delete GLEmulation.enabledVertexAttribArrays[index]; if (GLEmulation.currentVao) delete GLEmulation.currentVao.enabledVertexAttribArrays[index]; }; var glVertexAttribPointer = _glVertexAttribPointer; - _glVertexAttribPointer = function _glVertexAttribPointer(index, size, type, normalized, stride, pointer) { + _glVertexAttribPointer = _emscripten_glVertexAttribPointer = function _glVertexAttribPointer(index, size, type, normalized, stride, pointer) { glVertexAttribPointer(index, size, type, normalized, stride, pointer); if (GLEmulation.currentVao) { // TODO: avoid object creation here? likely not hot though GLEmulation.currentVao.vertexAttribPointers[index] = [index, size, type, normalized, stride, pointer]; @@ -2315,6 +2316,7 @@ var LibraryGL = { glGetShaderPrecisionFormat__sig: 'v', glGetShaderPrecisionFormat: function() { throw 'glGetShaderPrecisionFormat: TODO' }, + glDeleteObject__deps: ['glDeleteProgram', 'glDeleteShader'], glDeleteObject__sig: 'vi', glDeleteObject: function(id) { if (GL.programs[id]) { @@ -2325,8 +2327,10 @@ var LibraryGL = { Module.printErr('WARNING: deleteObject received invalid id: ' + id); } }, + glDeleteObjectARB: 'glDeleteObject', glGetObjectParameteriv__sig: 'viii', + glGetObjectParameteriv__deps: ['glGetProgramiv', 'glGetShaderiv'], glGetObjectParameteriv: function(id, type, result) { if (GL.programs[id]) { if (type == 0x8B84) { // GL_OBJECT_INFO_LOG_LENGTH_ARB @@ -2347,7 +2351,9 @@ var LibraryGL = { Module.printErr('WARNING: getObjectParameteriv received invalid id: ' + id); } }, + glGetObjectParameterivARB: 'glGetObjectParameteriv', + glGetInfoLog__deps: ['glGetProgramInfoLog', 'glGetShaderInfoLog'], glGetInfoLog__sig: 'viiii', glGetInfoLog: function(id, maxLength, length, infoLog) { if (GL.programs[id]) { @@ -2358,6 +2364,7 @@ var LibraryGL = { Module.printErr('WARNING: getObjectParameteriv received invalid id: ' + id); } }, + glGetInfoLogARB: 'glGetInfoLog', glBindProgram__sig: 'vii', glBindProgram: function(type, id) { @@ -2365,6 +2372,7 @@ var LibraryGL = { assert(id == 0); #endif }, + glBindProgramARB: 'glBindProgram', glGetPointerv: function(name, p) { var attribute; @@ -4112,7 +4120,7 @@ var LibraryGL = { // Replace some functions with immediate-mode aware versions. If there are no client // attributes enabled, and we use webgl-friendly modes (no GL_QUADS), then no need // for emulation - _glDrawArrays = function _glDrawArrays(mode, first, count) { + _glDrawArrays = _emscripten_glDrawArrays = function _glDrawArrays(mode, first, count) { if (GLImmediate.totalEnabledClientAttributes == 0 && mode <= 6) { GLctx.drawArrays(mode, first, count); return; @@ -4128,7 +4136,7 @@ var LibraryGL = { GLImmediate.mode = -1; }; - _glDrawElements = function _glDrawElements(mode, count, type, indices, start, end) { // start, end are given if we come from glDrawRangeElements + _glDrawElements = _emscripten_glDrawElements = function _glDrawElements(mode, count, type, indices, start, end) { // start, end are given if we come from glDrawRangeElements if (GLImmediate.totalEnabledClientAttributes == 0 && mode <= 6 && GL.currElementArrayBuffer) { GLctx.drawElements(mode, count, type, indices); return; @@ -4168,36 +4176,36 @@ var LibraryGL = { } var glActiveTexture = _glActiveTexture; - _glActiveTexture = function _glActiveTexture(texture) { + _glActiveTexture = _emscripten_glActiveTexture = function _glActiveTexture(texture) { GLImmediate.TexEnvJIT.hook_activeTexture(texture); glActiveTexture(texture); }; var glEnable = _glEnable; - _glEnable = function _glEnable(cap) { + _glEnable = _emscripten_glEnable = function _glEnable(cap) { GLImmediate.TexEnvJIT.hook_enable(cap); glEnable(cap); }; var glDisable = _glDisable; - _glDisable = function _glDisable(cap) { + _glDisable = _emscripten_glDisable = function _glDisable(cap) { GLImmediate.TexEnvJIT.hook_disable(cap); glDisable(cap); }; var glTexEnvf = (typeof(_glTexEnvf) != 'undefined') ? _glTexEnvf : function(){}; - _glTexEnvf = function _glTexEnvf(target, pname, param) { + _glTexEnvf = _emscripten_glTexEnvf = function _glTexEnvf(target, pname, param) { GLImmediate.TexEnvJIT.hook_texEnvf(target, pname, param); // Don't call old func, since we are the implementor. //glTexEnvf(target, pname, param); }; var glTexEnvi = (typeof(_glTexEnvi) != 'undefined') ? _glTexEnvi : function(){}; - _glTexEnvi = function _glTexEnvi(target, pname, param) { + _glTexEnvi = _emscripten_glTexEnvi = function _glTexEnvi(target, pname, param) { GLImmediate.TexEnvJIT.hook_texEnvi(target, pname, param); // Don't call old func, since we are the implementor. //glTexEnvi(target, pname, param); }; var glTexEnvfv = (typeof(_glTexEnvfv) != 'undefined') ? _glTexEnvfv : function(){}; - _glTexEnvfv = function _glTexEnvfv(target, pname, param) { + _glTexEnvfv = _emscripten_glTexEnvfv = function _glTexEnvfv(target, pname, param) { GLImmediate.TexEnvJIT.hook_texEnvfv(target, pname, param); // Don't call old func, since we are the implementor. //glTexEnvfv(target, pname, param); @@ -4212,7 +4220,7 @@ var LibraryGL = { }; var glGetIntegerv = _glGetIntegerv; - _glGetIntegerv = function _glGetIntegerv(pname, params) { + _glGetIntegerv = _emscripten_glGetIntegerv = function _glGetIntegerv(pname, params) { switch (pname) { case 0x8B8D: { // GL_CURRENT_PROGRAM // Just query directly so we're working with WebGL objects. @@ -4711,6 +4719,7 @@ var LibraryGL = { // Additional non-GLES rendering calls + glDrawRangeElements__deps: ['glDrawElements'], glDrawRangeElements__sig: 'viiiiii', glDrawRangeElements: function(mode, start, end, count, type, indices) { _glDrawElements(mode, count, type, indices, start, end); @@ -4824,6 +4833,7 @@ var LibraryGL = { if (GLEmulation.currentVao && GLEmulation.currentVao.id == id) GLEmulation.currentVao = null; } }, + glBindVertexArray__deps: ['glBindBuffer', 'glEnableVertexAttribArray', 'glVertexAttribPointer', 'glEnableClientState'], glBindVertexArray__sig: 'vi', glBindVertexArray: function(vao) { // undo vao-related things, wipe the slate clean, both for vao of 0 or an actual vao @@ -5031,39 +5041,11 @@ var LibraryGL = { #else // LEGACY_GL_EMULATION - // Warn if code tries to use various emulation stuff, when emulation is disabled - // (do not warn if INCLUDE_FULL_LIBRARY is one, because then likely the gl code will - // not be called anyhow, leave only the runtime aborts) - glVertexPointer__deps: [function() { -#if INCLUDE_FULL_LIBRARY == 0 - warn('Legacy GL function (glVertexPointer) called. You need to compile with -s LEGACY_GL_EMULATION=1 to enable legacy GL emulation.'); -#endif - }], - glVertexPointer: function(){ throw 'Legacy GL function (glVertexPointer) called. You need to compile with -s LEGACY_GL_EMULATION=1 to enable legacy GL emulation.'; }, - glGenVertexArrays__deps: [function() { -#if INCLUDE_FULL_LIBRARY == 0 - warn('Legacy GL function (glGenVertexArrays) called. You need to compile with -s LEGACY_GL_EMULATION=1 to enable legacy GL emulation.'); -#endif - }], - glGenVertexArrays: function(){ throw 'Legacy GL function (glGenVertexArrays) called. You need to compile with -s LEGACY_GL_EMULATION=1 to enable legacy GL emulation.'; }, - glMatrixMode__deps: [function() { -#if INCLUDE_FULL_LIBRARY == 0 - warn('Legacy GL function (glMatrixMode) called. You need to compile with -s LEGACY_GL_EMULATION=1 to enable legacy GL emulation.'); -#endif - }], - glMatrixMode: function(){ throw 'Legacy GL function (glMatrixMode) called. You need to compile with -s LEGACY_GL_EMULATION=1 to enable legacy GL emulation.'; }, - glBegin__deps: [function() { -#if INCLUDE_FULL_LIBRARY == 0 - warn('Legacy GL function (glBegin) called. You need to compile with -s LEGACY_GL_EMULATION=1 to enable legacy GL emulation.'); -#endif - }], - glBegin: function(){ throw 'Legacy GL function (glBegin) called. You need to compile with -s LEGACY_GL_EMULATION=1 to enable legacy GL emulation.'; }, - glLoadIdentity__deps: [function() { -#if INCLUDE_FULL_LIBRARY == 0 - warn('Legacy GL function (glLoadIdentity) called. You need to compile with -s LEGACY_GL_EMULATION=1 to enable legacy GL emulation.'); -#endif - }], - glLoadIdentity: function(){ throw 'Legacy GL function (glLoadIdentity) called. You need to compile with -s LEGACY_GL_EMULATION=1 to enable legacy GL emulation.'; }, + glVertexPointer: function(){ throw 'Legacy GL function (glVertexPointer) called. If you want legacy GL emulation, you need to compile with -s LEGACY_GL_EMULATION=1 to enable legacy GL emulation.'; }, + glGenVertexArrays: function(){ throw 'Legacy GL function (glGenVertexArrays) called. If you want legacy GL emulation, you need to compile with -s LEGACY_GL_EMULATION=1 to enable legacy GL emulation.'; }, + glMatrixMode: function(){ throw 'Legacy GL function (glMatrixMode) called. If you want legacy GL emulation, you need to compile with -s LEGACY_GL_EMULATION=1 to enable legacy GL emulation.'; }, + glBegin: function(){ throw 'Legacy GL function (glBegin) called. If you want legacy GL emulation, you need to compile with -s LEGACY_GL_EMULATION=1 to enable legacy GL emulation.'; }, + glLoadIdentity: function(){ throw 'Legacy GL function (glLoadIdentity) called. If you want legacy GL emulation, you need to compile with -s LEGACY_GL_EMULATION=1 to enable legacy GL emulation.'; }, #endif // LEGACY_GL_EMULATION @@ -5374,53 +5356,37 @@ if (LEGACY_GL_EMULATION) { DEFAULT_LIBRARY_FUNCS_TO_INCLUDE.push('$GLEmulation'); } -// GL proc address retrieval -LibraryGL.emscripten_GetProcAddress__deps = [function() { - // ProcAddress is used, so include everything in GL. This runs before we go to the $ProcAddressTable object, - // and we fill its deps just in time, and create the lookup table - var table = {}; - LibraryManager.library.emscripten_procAddressTable__deps = keys(LibraryGL).map(function(x) { - if (x.substr(-6) == '__deps' || x.substr(-9) == '__postset' || x.substr(-5) == '__sig' || x.substr(-5) == '__asm' || x.substr(0, 2) != 'gl') return null; - var original = x; - if (('_' + x) in Functions.implementedFunctions) { - // a user-implemented function aliases this one, but we still want it to be accessible by name, so rename it - var y = x + '__procTable'; - LibraryManager.library[y] = LibraryManager.library[x]; - LibraryManager.library[y + '__deps'] = LibraryManager.library[x + '__deps']; - LibraryManager.library[y + '__postset'] = LibraryManager.library[x + '__postset']; - LibraryManager.library[y + '__sig'] = LibraryManager.library[x + '__sig'];//|| Functions.implementedFunctions['_' + x]; - LibraryManager.library[y + '__asm'] = LibraryManager.library[x + '__asm']; - x = y; - assert(!(y in Functions.implementedFunctions) && !Functions.unimplementedFunctions['_' + y]); - } - var longX = '_' + x; - var sig = LibraryManager.library[x + '__sig'] || functionStubSigs[longX]; - if (sig) { - table[original] = Functions.getIndex(longX, sig); - if (!(longX in Functions.implementedFunctions)) Functions.unimplementedFunctions[longX] = sig; - } - return x; - }).filter(function(x) { return x !== null }); - // convert table into function with switch, to not confuse closure compiler - var tableImpl = 'switch(name) {\n'; - for (var x in table) tableImpl += 'case "' + x + '": return ' + table[x] + '; break;\n'; - tableImpl += '}\nreturn 0;'; - LibraryManager.library.emscripten_procAddressTable = new Function('name', tableImpl); -}, 'emscripten_procAddressTable']; -LibraryGL.emscripten_GetProcAddress = function _LibraryGL_emscripten_GetProcAddress(name) { - name = name.replace('EXT', '').replace('ARB', ''); - switch(name) { // misc renamings - case 'glCreateProgramObject': name = 'glCreateProgram'; break; - case 'glUseProgramObject': name = 'glUseProgram'; break; - case 'glCreateShaderObject': name = 'glCreateShader'; break; - case 'glAttachObject': name = 'glAttachShader'; break; - case 'glDetachObject': name = 'glDetachShader'; break; - } - var ret = _emscripten_procAddressTable(name); - if (!ret) Module.printErr('WARNING: getProcAddress failed for ' + name); - return ret; +function copyLibEntry(a, b) { + LibraryGL[a] = LibraryGL[b]; + LibraryGL[a + '__postset'] = LibraryGL[b + '__postset']; + LibraryGL[a + '__sig'] = LibraryGL[b + '__sig']; + LibraryGL[a + '__asm'] = LibraryGL[b + '__asm']; + LibraryGL[a + '__deps'] = LibraryGL[b + '__deps'].slice(0); } +// GL proc address retrieval - allow access through glX and emscripten_glX, to allow name collisions with user-implemented things having the same name (see gl.c) +keys(LibraryGL).forEach(function(x) { + if (x.substr(-6) == '__deps' || x.substr(-9) == '__postset' || x.substr(-5) == '__sig' || x.substr(-5) == '__asm' || x.substr(0, 2) != 'gl') return; + while (typeof LibraryGL[x] === 'string') { + // resolve aliases right here, simpler for fastcomp + copyLibEntry(x, LibraryGL[x]); + } + var y = 'emscripten_' + x; + LibraryGL[x + '__deps'] = LibraryGL[x + '__deps'].map(function(dep) { + // prefix dependencies as well + if (typeof dep === 'string' && dep[0] == 'g' && dep[1] == 'l' && LibraryGL[dep]) { + var orig = dep; + dep = 'emscripten_' + dep; + var fixed = LibraryGL[x].toString().replace(new RegExp('_' + orig + '\\(', 'g'), '_' + dep + '('); + fixed = fixed.substr(0, 9) + '_' + y + fixed.substr(9); + LibraryGL[x] = eval('(function() { return ' + fixed + ' })()'); + } + return dep; + }); + // copy it + copyLibEntry(y, x); +}); + // Final merge mergeInto(LibraryManager.library, LibraryGL); diff --git a/src/library_sdl.js b/src/library_sdl.js index caba9b74..8c70ceee 100644 --- a/src/library_sdl.js +++ b/src/library_sdl.js @@ -2487,7 +2487,7 @@ var LibrarySDL = { SDL_GL_GetProcAddress__deps: ['emscripten_GetProcAddress'], SDL_GL_GetProcAddress: function(name_) { - return _emscripten_GetProcAddress(Pointer_stringify(name_)); + return _emscripten_GetProcAddress(name_); }, SDL_GL_SwapBuffers: function() {}, diff --git a/src/preamble.js b/src/preamble.js index 9a65b092..25ef1fb3 100644 --- a/src/preamble.js +++ b/src/preamble.js @@ -188,6 +188,8 @@ function SAFE_HEAP_STORE(dest, value, bytes, isFloat) { #endif assert(dest > 0, 'segmentation fault'); assert(dest % bytes === 0); + assert(dest < Math.max(DYNAMICTOP, STATICTOP)); + assert(DYNAMICTOP <= TOTAL_MEMORY); setValue(dest, value, getSafeHeapType(bytes, isFloat), 1); } @@ -197,6 +199,8 @@ function SAFE_HEAP_LOAD(dest, bytes, isFloat, unsigned) { #endif assert(dest > 0, 'segmentation fault'); assert(dest % bytes === 0); + assert(dest < Math.max(DYNAMICTOP, STATICTOP)); + assert(DYNAMICTOP <= TOTAL_MEMORY); var type = getSafeHeapType(bytes, isFloat); var ret = getValue(dest, type, 1); if (unsigned) ret = unSign(ret, parseInt(type.substr(1)), 1); diff --git a/system/lib/gl.c b/system/lib/gl.c new file mode 100644 index 00000000..e6c60956 --- /dev/null +++ b/system/lib/gl.c @@ -0,0 +1,1729 @@ +// GL proc address retrieval + +#include <string.h> +#include <stdlib.h> +#include <stdio.h> + +#define GL_GLEXT_PROTOTYPES +#include <GL/gl.h> +#include <GL/glext.h> + +// Define emscripten_ versions of gl functions, to avoid name collisions + +/* + * Miscellaneous + */ + +GLAPI void GLAPIENTRY emscripten_glClearIndex( GLfloat c ); + +GLAPI void GLAPIENTRY emscripten_glClearColor( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha ); + +GLAPI void GLAPIENTRY emscripten_glClear( GLbitfield mask ); + +GLAPI void GLAPIENTRY emscripten_glIndexMask( GLuint mask ); + +GLAPI void GLAPIENTRY emscripten_glColorMask( GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha ); + +GLAPI void GLAPIENTRY emscripten_glAlphaFunc( GLenum func, GLclampf ref ); + +GLAPI void GLAPIENTRY emscripten_glBlendFunc( GLenum sfactor, GLenum dfactor ); + +GLAPI void GLAPIENTRY emscripten_glLogicOp( GLenum opcode ); + +GLAPI void GLAPIENTRY emscripten_glCullFace( GLenum mode ); + +GLAPI void GLAPIENTRY emscripten_glFrontFace( GLenum mode ); + +GLAPI void GLAPIENTRY emscripten_glPointSize( GLfloat size ); + +GLAPI void GLAPIENTRY emscripten_glLineWidth( GLfloat width ); + +GLAPI void GLAPIENTRY emscripten_glLineStipple( GLint factor, GLushort pattern ); + +GLAPI void GLAPIENTRY emscripten_glPolygonMode( GLenum face, GLenum mode ); + +GLAPI void GLAPIENTRY emscripten_glPolygonOffset( GLfloat factor, GLfloat units ); + +GLAPI void GLAPIENTRY emscripten_glPolygonStipple( const GLubyte *mask ); + +GLAPI void GLAPIENTRY emscripten_glGetPolygonStipple( GLubyte *mask ); + +GLAPI void GLAPIENTRY emscripten_glEdgeFlag( GLboolean flag ); + +GLAPI void GLAPIENTRY emscripten_glEdgeFlagv( const GLboolean *flag ); + +GLAPI void GLAPIENTRY emscripten_glScissor( GLint x, GLint y, GLsizei width, GLsizei height); + +GLAPI void GLAPIENTRY emscripten_glClipPlane( GLenum plane, const GLdouble *equation ); + +GLAPI void GLAPIENTRY emscripten_glGetClipPlane( GLenum plane, GLdouble *equation ); + +GLAPI void GLAPIENTRY emscripten_glDrawBuffer( GLenum mode ); + +GLAPI void GLAPIENTRY emscripten_glReadBuffer( GLenum mode ); + +GLAPI void GLAPIENTRY emscripten_glEnable( GLenum cap ); + +GLAPI void GLAPIENTRY emscripten_glDisable( GLenum cap ); + +GLAPI GLboolean GLAPIENTRY emscripten_glIsEnabled( GLenum cap ); + + +GLAPI void GLAPIENTRY emscripten_glEnableClientState( GLenum cap ); /* 1.1 */ + +GLAPI void GLAPIENTRY emscripten_glDisableClientState( GLenum cap ); /* 1.1 */ + + +GLAPI void GLAPIENTRY emscripten_glGetBooleanv( GLenum pname, GLboolean *params ); + +GLAPI void GLAPIENTRY emscripten_glGetDoublev( GLenum pname, GLdouble *params ); + +GLAPI void GLAPIENTRY emscripten_glGetFloatv( GLenum pname, GLfloat *params ); + +GLAPI void GLAPIENTRY emscripten_glGetIntegerv( GLenum pname, GLint *params ); + + +GLAPI void GLAPIENTRY emscripten_glPushAttrib( GLbitfield mask ); + +GLAPI void GLAPIENTRY emscripten_glPopAttrib( void ); + + +GLAPI void GLAPIENTRY emscripten_glPushClientAttrib( GLbitfield mask ); /* 1.1 */ + +GLAPI void GLAPIENTRY emscripten_glPopClientAttrib( void ); /* 1.1 */ + + +GLAPI GLint GLAPIENTRY emscripten_glRenderMode( GLenum mode ); + +GLAPI GLenum GLAPIENTRY emscripten_glGetError( void ); + +GLAPI const GLubyte * GLAPIENTRY emscripten_glGetString( GLenum name ); + +GLAPI void GLAPIENTRY emscripten_glFinish( void ); + +GLAPI void GLAPIENTRY emscripten_glFlush( void ); + +GLAPI void GLAPIENTRY emscripten_glHint( GLenum target, GLenum mode ); + + +/* + * Depth Buffer + */ + +GLAPI void GLAPIENTRY emscripten_glClearDepth( GLclampd depth ); + +GLAPI void GLAPIENTRY emscripten_glDepthFunc( GLenum func ); + +GLAPI void GLAPIENTRY emscripten_glDepthMask( GLboolean flag ); + +GLAPI void GLAPIENTRY emscripten_glDepthRange( GLclampd near_val, GLclampd far_val ); + + +/* + * Accumulation Buffer + */ + +GLAPI void GLAPIENTRY emscripten_glClearAccum( GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha ); + +GLAPI void GLAPIENTRY emscripten_glAccum( GLenum op, GLfloat value ); + + +/* + * Transformation + */ + +GLAPI void GLAPIENTRY emscripten_glMatrixMode( GLenum mode ); + +GLAPI void GLAPIENTRY emscripten_glOrtho( GLdouble left, GLdouble right, + GLdouble bottom, GLdouble top, + GLdouble near_val, GLdouble far_val ); + +GLAPI void GLAPIENTRY emscripten_glFrustum( GLdouble left, GLdouble right, + GLdouble bottom, GLdouble top, + GLdouble near_val, GLdouble far_val ); + +GLAPI void GLAPIENTRY emscripten_glViewport( GLint x, GLint y, + GLsizei width, GLsizei height ); + +GLAPI void GLAPIENTRY emscripten_glPushMatrix( void ); + +GLAPI void GLAPIENTRY emscripten_glPopMatrix( void ); + +GLAPI void GLAPIENTRY emscripten_glLoadIdentity( void ); + +GLAPI void GLAPIENTRY emscripten_glLoadMatrixd( const GLdouble *m ); +GLAPI void GLAPIENTRY emscripten_glLoadMatrixf( const GLfloat *m ); + +GLAPI void GLAPIENTRY emscripten_glMultMatrixd( const GLdouble *m ); +GLAPI void GLAPIENTRY emscripten_glMultMatrixf( const GLfloat *m ); + +GLAPI void GLAPIENTRY emscripten_glRotated( GLdouble angle, + GLdouble x, GLdouble y, GLdouble z ); +GLAPI void GLAPIENTRY emscripten_glRotatef( GLfloat angle, + GLfloat x, GLfloat y, GLfloat z ); + +GLAPI void GLAPIENTRY emscripten_glScaled( GLdouble x, GLdouble y, GLdouble z ); +GLAPI void GLAPIENTRY emscripten_glScalef( GLfloat x, GLfloat y, GLfloat z ); + +GLAPI void GLAPIENTRY emscripten_glTranslated( GLdouble x, GLdouble y, GLdouble z ); +GLAPI void GLAPIENTRY emscripten_glTranslatef( GLfloat x, GLfloat y, GLfloat z ); + + +/* + * Display Lists + */ + +GLAPI GLboolean GLAPIENTRY emscripten_glIsList( GLuint list ); + +GLAPI void GLAPIENTRY emscripten_glDeleteLists( GLuint list, GLsizei range ); + +GLAPI GLuint GLAPIENTRY emscripten_glGenLists( GLsizei range ); + +GLAPI void GLAPIENTRY emscripten_glNewList( GLuint list, GLenum mode ); + +GLAPI void GLAPIENTRY emscripten_glEndList( void ); + +GLAPI void GLAPIENTRY emscripten_glCallList( GLuint list ); + +GLAPI void GLAPIENTRY emscripten_glCallLists( GLsizei n, GLenum type, + const GLvoid *lists ); + +GLAPI void GLAPIENTRY emscripten_glListBase( GLuint base ); + + +/* + * Drawing Functions + */ + +GLAPI void GLAPIENTRY emscripten_glBegin( GLenum mode ); + +GLAPI void GLAPIENTRY emscripten_glEnd( void ); + + +GLAPI void GLAPIENTRY emscripten_glVertex2d( GLdouble x, GLdouble y ); +GLAPI void GLAPIENTRY emscripten_glVertex2f( GLfloat x, GLfloat y ); +GLAPI void GLAPIENTRY emscripten_glVertex2i( GLint x, GLint y ); +GLAPI void GLAPIENTRY emscripten_glVertex2s( GLshort x, GLshort y ); + +GLAPI void GLAPIENTRY emscripten_glVertex3d( GLdouble x, GLdouble y, GLdouble z ); +GLAPI void GLAPIENTRY emscripten_glVertex3f( GLfloat x, GLfloat y, GLfloat z ); +GLAPI void GLAPIENTRY emscripten_glVertex3i( GLint x, GLint y, GLint z ); +GLAPI void GLAPIENTRY emscripten_glVertex3s( GLshort x, GLshort y, GLshort z ); + +GLAPI void GLAPIENTRY emscripten_glVertex4d( GLdouble x, GLdouble y, GLdouble z, GLdouble w ); +GLAPI void GLAPIENTRY emscripten_glVertex4f( GLfloat x, GLfloat y, GLfloat z, GLfloat w ); +GLAPI void GLAPIENTRY emscripten_glVertex4i( GLint x, GLint y, GLint z, GLint w ); +GLAPI void GLAPIENTRY emscripten_glVertex4s( GLshort x, GLshort y, GLshort z, GLshort w ); + +GLAPI void GLAPIENTRY emscripten_glVertex2dv( const GLdouble *v ); +GLAPI void GLAPIENTRY emscripten_glVertex2fv( const GLfloat *v ); +GLAPI void GLAPIENTRY emscripten_glVertex2iv( const GLint *v ); +GLAPI void GLAPIENTRY emscripten_glVertex2sv( const GLshort *v ); + +GLAPI void GLAPIENTRY emscripten_glVertex3dv( const GLdouble *v ); +GLAPI void GLAPIENTRY emscripten_glVertex3fv( const GLfloat *v ); +GLAPI void GLAPIENTRY emscripten_glVertex3iv( const GLint *v ); +GLAPI void GLAPIENTRY emscripten_glVertex3sv( const GLshort *v ); + +GLAPI void GLAPIENTRY emscripten_glVertex4dv( const GLdouble *v ); +GLAPI void GLAPIENTRY emscripten_glVertex4fv( const GLfloat *v ); +GLAPI void GLAPIENTRY emscripten_glVertex4iv( const GLint *v ); +GLAPI void GLAPIENTRY emscripten_glVertex4sv( const GLshort *v ); + + +GLAPI void GLAPIENTRY emscripten_glNormal3b( GLbyte nx, GLbyte ny, GLbyte nz ); +GLAPI void GLAPIENTRY emscripten_glNormal3d( GLdouble nx, GLdouble ny, GLdouble nz ); +GLAPI void GLAPIENTRY emscripten_glNormal3f( GLfloat nx, GLfloat ny, GLfloat nz ); +GLAPI void GLAPIENTRY emscripten_glNormal3i( GLint nx, GLint ny, GLint nz ); +GLAPI void GLAPIENTRY emscripten_glNormal3s( GLshort nx, GLshort ny, GLshort nz ); + +GLAPI void GLAPIENTRY emscripten_glNormal3bv( const GLbyte *v ); +GLAPI void GLAPIENTRY emscripten_glNormal3dv( const GLdouble *v ); +GLAPI void GLAPIENTRY emscripten_glNormal3fv( const GLfloat *v ); +GLAPI void GLAPIENTRY emscripten_glNormal3iv( const GLint *v ); +GLAPI void GLAPIENTRY emscripten_glNormal3sv( const GLshort *v ); + + +GLAPI void GLAPIENTRY emscripten_glIndexd( GLdouble c ); +GLAPI void GLAPIENTRY emscripten_glIndexf( GLfloat c ); +GLAPI void GLAPIENTRY emscripten_glIndexi( GLint c ); +GLAPI void GLAPIENTRY emscripten_glIndexs( GLshort c ); +GLAPI void GLAPIENTRY emscripten_glIndexub( GLubyte c ); /* 1.1 */ + +GLAPI void GLAPIENTRY emscripten_glIndexdv( const GLdouble *c ); +GLAPI void GLAPIENTRY emscripten_glIndexfv( const GLfloat *c ); +GLAPI void GLAPIENTRY emscripten_glIndexiv( const GLint *c ); +GLAPI void GLAPIENTRY emscripten_glIndexsv( const GLshort *c ); +GLAPI void GLAPIENTRY emscripten_glIndexubv( const GLubyte *c ); /* 1.1 */ + +GLAPI void GLAPIENTRY emscripten_glColor3b( GLbyte red, GLbyte green, GLbyte blue ); +GLAPI void GLAPIENTRY emscripten_glColor3d( GLdouble red, GLdouble green, GLdouble blue ); +GLAPI void GLAPIENTRY emscripten_glColor3f( GLfloat red, GLfloat green, GLfloat blue ); +GLAPI void GLAPIENTRY emscripten_glColor3i( GLint red, GLint green, GLint blue ); +GLAPI void GLAPIENTRY emscripten_glColor3s( GLshort red, GLshort green, GLshort blue ); +GLAPI void GLAPIENTRY emscripten_glColor3ub( GLubyte red, GLubyte green, GLubyte blue ); +GLAPI void GLAPIENTRY emscripten_glColor3ui( GLuint red, GLuint green, GLuint blue ); +GLAPI void GLAPIENTRY emscripten_glColor3us( GLushort red, GLushort green, GLushort blue ); + +GLAPI void GLAPIENTRY emscripten_glColor4b( GLbyte red, GLbyte green, + GLbyte blue, GLbyte alpha ); +GLAPI void GLAPIENTRY emscripten_glColor4d( GLdouble red, GLdouble green, + GLdouble blue, GLdouble alpha ); +GLAPI void GLAPIENTRY emscripten_glColor4f( GLfloat red, GLfloat green, + GLfloat blue, GLfloat alpha ); +GLAPI void GLAPIENTRY emscripten_glColor4i( GLint red, GLint green, + GLint blue, GLint alpha ); +GLAPI void GLAPIENTRY emscripten_glColor4s( GLshort red, GLshort green, + GLshort blue, GLshort alpha ); +GLAPI void GLAPIENTRY emscripten_glColor4ub( GLubyte red, GLubyte green, + GLubyte blue, GLubyte alpha ); +GLAPI void GLAPIENTRY emscripten_glColor4ui( GLuint red, GLuint green, + GLuint blue, GLuint alpha ); +GLAPI void GLAPIENTRY emscripten_glColor4us( GLushort red, GLushort green, + GLushort blue, GLushort alpha ); + + +GLAPI void GLAPIENTRY emscripten_glColor3bv( const GLbyte *v ); +GLAPI void GLAPIENTRY emscripten_glColor3dv( const GLdouble *v ); +GLAPI void GLAPIENTRY emscripten_glColor3fv( const GLfloat *v ); +GLAPI void GLAPIENTRY emscripten_glColor3iv( const GLint *v ); +GLAPI void GLAPIENTRY emscripten_glColor3sv( const GLshort *v ); +GLAPI void GLAPIENTRY emscripten_glColor3ubv( const GLubyte *v ); +GLAPI void GLAPIENTRY emscripten_glColor3uiv( const GLuint *v ); +GLAPI void GLAPIENTRY emscripten_glColor3usv( const GLushort *v ); + +GLAPI void GLAPIENTRY emscripten_glColor4bv( const GLbyte *v ); +GLAPI void GLAPIENTRY emscripten_glColor4dv( const GLdouble *v ); +GLAPI void GLAPIENTRY emscripten_glColor4fv( const GLfloat *v ); +GLAPI void GLAPIENTRY emscripten_glColor4iv( const GLint *v ); +GLAPI void GLAPIENTRY emscripten_glColor4sv( const GLshort *v ); +GLAPI void GLAPIENTRY emscripten_glColor4ubv( const GLubyte *v ); +GLAPI void GLAPIENTRY emscripten_glColor4uiv( const GLuint *v ); +GLAPI void GLAPIENTRY emscripten_glColor4usv( const GLushort *v ); + + +GLAPI void GLAPIENTRY emscripten_glTexCoord1d( GLdouble s ); +GLAPI void GLAPIENTRY emscripten_glTexCoord1f( GLfloat s ); +GLAPI void GLAPIENTRY emscripten_glTexCoord1i( GLint s ); +GLAPI void GLAPIENTRY emscripten_glTexCoord1s( GLshort s ); + +GLAPI void GLAPIENTRY emscripten_glTexCoord2d( GLdouble s, GLdouble t ); +GLAPI void GLAPIENTRY emscripten_glTexCoord2f( GLfloat s, GLfloat t ); +GLAPI void GLAPIENTRY emscripten_glTexCoord2i( GLint s, GLint t ); +GLAPI void GLAPIENTRY emscripten_glTexCoord2s( GLshort s, GLshort t ); + +GLAPI void GLAPIENTRY emscripten_glTexCoord3d( GLdouble s, GLdouble t, GLdouble r ); +GLAPI void GLAPIENTRY emscripten_glTexCoord3f( GLfloat s, GLfloat t, GLfloat r ); +GLAPI void GLAPIENTRY emscripten_glTexCoord3i( GLint s, GLint t, GLint r ); +GLAPI void GLAPIENTRY emscripten_glTexCoord3s( GLshort s, GLshort t, GLshort r ); + +GLAPI void GLAPIENTRY emscripten_glTexCoord4d( GLdouble s, GLdouble t, GLdouble r, GLdouble q ); +GLAPI void GLAPIENTRY emscripten_glTexCoord4f( GLfloat s, GLfloat t, GLfloat r, GLfloat q ); +GLAPI void GLAPIENTRY emscripten_glTexCoord4i( GLint s, GLint t, GLint r, GLint q ); +GLAPI void GLAPIENTRY emscripten_glTexCoord4s( GLshort s, GLshort t, GLshort r, GLshort q ); + +GLAPI void GLAPIENTRY emscripten_glTexCoord1dv( const GLdouble *v ); +GLAPI void GLAPIENTRY emscripten_glTexCoord1fv( const GLfloat *v ); +GLAPI void GLAPIENTRY emscripten_glTexCoord1iv( const GLint *v ); +GLAPI void GLAPIENTRY emscripten_glTexCoord1sv( const GLshort *v ); + +GLAPI void GLAPIENTRY emscripten_glTexCoord2dv( const GLdouble *v ); +GLAPI void GLAPIENTRY emscripten_glTexCoord2fv( const GLfloat *v ); +GLAPI void GLAPIENTRY emscripten_glTexCoord2iv( const GLint *v ); +GLAPI void GLAPIENTRY emscripten_glTexCoord2sv( const GLshort *v ); + +GLAPI void GLAPIENTRY emscripten_glTexCoord3dv( const GLdouble *v ); +GLAPI void GLAPIENTRY emscripten_glTexCoord3fv( const GLfloat *v ); +GLAPI void GLAPIENTRY emscripten_glTexCoord3iv( const GLint *v ); +GLAPI void GLAPIENTRY emscripten_glTexCoord3sv( const GLshort *v ); + +GLAPI void GLAPIENTRY emscripten_glTexCoord4dv( const GLdouble *v ); +GLAPI void GLAPIENTRY emscripten_glTexCoord4fv( const GLfloat *v ); +GLAPI void GLAPIENTRY emscripten_glTexCoord4iv( const GLint *v ); +GLAPI void GLAPIENTRY emscripten_glTexCoord4sv( const GLshort *v ); + + +GLAPI void GLAPIENTRY emscripten_glRasterPos2d( GLdouble x, GLdouble y ); +GLAPI void GLAPIENTRY emscripten_glRasterPos2f( GLfloat x, GLfloat y ); +GLAPI void GLAPIENTRY emscripten_glRasterPos2i( GLint x, GLint y ); +GLAPI void GLAPIENTRY emscripten_glRasterPos2s( GLshort x, GLshort y ); + +GLAPI void GLAPIENTRY emscripten_glRasterPos3d( GLdouble x, GLdouble y, GLdouble z ); +GLAPI void GLAPIENTRY emscripten_glRasterPos3f( GLfloat x, GLfloat y, GLfloat z ); +GLAPI void GLAPIENTRY emscripten_glRasterPos3i( GLint x, GLint y, GLint z ); +GLAPI void GLAPIENTRY emscripten_glRasterPos3s( GLshort x, GLshort y, GLshort z ); + +GLAPI void GLAPIENTRY emscripten_glRasterPos4d( GLdouble x, GLdouble y, GLdouble z, GLdouble w ); +GLAPI void GLAPIENTRY emscripten_glRasterPos4f( GLfloat x, GLfloat y, GLfloat z, GLfloat w ); +GLAPI void GLAPIENTRY emscripten_glRasterPos4i( GLint x, GLint y, GLint z, GLint w ); +GLAPI void GLAPIENTRY emscripten_glRasterPos4s( GLshort x, GLshort y, GLshort z, GLshort w ); + +GLAPI void GLAPIENTRY emscripten_glRasterPos2dv( const GLdouble *v ); +GLAPI void GLAPIENTRY emscripten_glRasterPos2fv( const GLfloat *v ); +GLAPI void GLAPIENTRY emscripten_glRasterPos2iv( const GLint *v ); +GLAPI void GLAPIENTRY emscripten_glRasterPos2sv( const GLshort *v ); + +GLAPI void GLAPIENTRY emscripten_glRasterPos3dv( const GLdouble *v ); +GLAPI void GLAPIENTRY emscripten_glRasterPos3fv( const GLfloat *v ); +GLAPI void GLAPIENTRY emscripten_glRasterPos3iv( const GLint *v ); +GLAPI void GLAPIENTRY emscripten_glRasterPos3sv( const GLshort *v ); + +GLAPI void GLAPIENTRY emscripten_glRasterPos4dv( const GLdouble *v ); +GLAPI void GLAPIENTRY emscripten_glRasterPos4fv( const GLfloat *v ); +GLAPI void GLAPIENTRY emscripten_glRasterPos4iv( const GLint *v ); +GLAPI void GLAPIENTRY emscripten_glRasterPos4sv( const GLshort *v ); + + +GLAPI void GLAPIENTRY emscripten_glRectd( GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2 ); +GLAPI void GLAPIENTRY emscripten_glRectf( GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2 ); +GLAPI void GLAPIENTRY emscripten_glRecti( GLint x1, GLint y1, GLint x2, GLint y2 ); +GLAPI void GLAPIENTRY emscripten_glRects( GLshort x1, GLshort y1, GLshort x2, GLshort y2 ); + + +GLAPI void GLAPIENTRY emscripten_glRectdv( const GLdouble *v1, const GLdouble *v2 ); +GLAPI void GLAPIENTRY emscripten_glRectfv( const GLfloat *v1, const GLfloat *v2 ); +GLAPI void GLAPIENTRY emscripten_glRectiv( const GLint *v1, const GLint *v2 ); +GLAPI void GLAPIENTRY emscripten_glRectsv( const GLshort *v1, const GLshort *v2 ); + + +/* + * Vertex Arrays (1.1) + */ + +GLAPI void GLAPIENTRY emscripten_glVertexPointer( GLint size, GLenum type, + GLsizei stride, const GLvoid *ptr ); + +GLAPI void GLAPIENTRY emscripten_glNormalPointer( GLenum type, GLsizei stride, + const GLvoid *ptr ); + +GLAPI void GLAPIENTRY emscripten_glColorPointer( GLint size, GLenum type, + GLsizei stride, const GLvoid *ptr ); + +GLAPI void GLAPIENTRY emscripten_glIndexPointer( GLenum type, GLsizei stride, + const GLvoid *ptr ); + +GLAPI void GLAPIENTRY emscripten_glTexCoordPointer( GLint size, GLenum type, + GLsizei stride, const GLvoid *ptr ); + +GLAPI void GLAPIENTRY emscripten_glEdgeFlagPointer( GLsizei stride, const GLvoid *ptr ); + +GLAPI void GLAPIENTRY emscripten_glGetPointerv( GLenum pname, GLvoid **params ); + +GLAPI void GLAPIENTRY emscripten_glArrayElement( GLint i ); + +GLAPI void GLAPIENTRY emscripten_glDrawArrays( GLenum mode, GLint first, GLsizei count ); + +GLAPI void GLAPIENTRY emscripten_glDrawElements( GLenum mode, GLsizei count, + GLenum type, const GLvoid *indices ); + +GLAPI void GLAPIENTRY emscripten_glInterleavedArrays( GLenum format, GLsizei stride, + const GLvoid *pointer ); + +/* + * Lighting + */ + +GLAPI void GLAPIENTRY emscripten_glShadeModel( GLenum mode ); + +GLAPI void GLAPIENTRY emscripten_glLightf( GLenum light, GLenum pname, GLfloat param ); +GLAPI void GLAPIENTRY emscripten_glLighti( GLenum light, GLenum pname, GLint param ); +GLAPI void GLAPIENTRY emscripten_glLightfv( GLenum light, GLenum pname, + const GLfloat *params ); +GLAPI void GLAPIENTRY emscripten_glLightiv( GLenum light, GLenum pname, + const GLint *params ); + +GLAPI void GLAPIENTRY emscripten_glGetLightfv( GLenum light, GLenum pname, + GLfloat *params ); +GLAPI void GLAPIENTRY emscripten_glGetLightiv( GLenum light, GLenum pname, + GLint *params ); + +GLAPI void GLAPIENTRY emscripten_glLightModelf( GLenum pname, GLfloat param ); +GLAPI void GLAPIENTRY emscripten_glLightModeli( GLenum pname, GLint param ); +GLAPI void GLAPIENTRY emscripten_glLightModelfv( GLenum pname, const GLfloat *params ); +GLAPI void GLAPIENTRY emscripten_glLightModeliv( GLenum pname, const GLint *params ); + +GLAPI void GLAPIENTRY emscripten_glMaterialf( GLenum face, GLenum pname, GLfloat param ); +GLAPI void GLAPIENTRY emscripten_glMateriali( GLenum face, GLenum pname, GLint param ); +GLAPI void GLAPIENTRY emscripten_glMaterialfv( GLenum face, GLenum pname, const GLfloat *params ); +GLAPI void GLAPIENTRY emscripten_glMaterialiv( GLenum face, GLenum pname, const GLint *params ); + +GLAPI void GLAPIENTRY emscripten_glGetMaterialfv( GLenum face, GLenum pname, GLfloat *params ); +GLAPI void GLAPIENTRY emscripten_glGetMaterialiv( GLenum face, GLenum pname, GLint *params ); + +GLAPI void GLAPIENTRY emscripten_glColorMaterial( GLenum face, GLenum mode ); + + +/* + * Raster functions + */ + +GLAPI void GLAPIENTRY emscripten_glPixelZoom( GLfloat xfactor, GLfloat yfactor ); + +GLAPI void GLAPIENTRY emscripten_glPixelStoref( GLenum pname, GLfloat param ); +GLAPI void GLAPIENTRY emscripten_glPixelStorei( GLenum pname, GLint param ); + +GLAPI void GLAPIENTRY emscripten_glPixelTransferf( GLenum pname, GLfloat param ); +GLAPI void GLAPIENTRY emscripten_glPixelTransferi( GLenum pname, GLint param ); + +GLAPI void GLAPIENTRY emscripten_glPixelMapfv( GLenum map, GLsizei mapsize, + const GLfloat *values ); +GLAPI void GLAPIENTRY emscripten_glPixelMapuiv( GLenum map, GLsizei mapsize, + const GLuint *values ); +GLAPI void GLAPIENTRY emscripten_glPixelMapusv( GLenum map, GLsizei mapsize, + const GLushort *values ); + +GLAPI void GLAPIENTRY emscripten_glGetPixelMapfv( GLenum map, GLfloat *values ); +GLAPI void GLAPIENTRY emscripten_glGetPixelMapuiv( GLenum map, GLuint *values ); +GLAPI void GLAPIENTRY emscripten_glGetPixelMapusv( GLenum map, GLushort *values ); + +GLAPI void GLAPIENTRY emscripten_glBitmap( GLsizei width, GLsizei height, + GLfloat xorig, GLfloat yorig, + GLfloat xmove, GLfloat ymove, + const GLubyte *bitmap ); + +GLAPI void GLAPIENTRY emscripten_glReadPixels( GLint x, GLint y, + GLsizei width, GLsizei height, + GLenum format, GLenum type, + GLvoid *pixels ); + +GLAPI void GLAPIENTRY emscripten_glDrawPixels( GLsizei width, GLsizei height, + GLenum format, GLenum type, + const GLvoid *pixels ); + +GLAPI void GLAPIENTRY emscripten_glCopyPixels( GLint x, GLint y, + GLsizei width, GLsizei height, + GLenum type ); + +/* + * Stenciling + */ + +GLAPI void GLAPIENTRY emscripten_glStencilFunc( GLenum func, GLint ref, GLuint mask ); + +GLAPI void GLAPIENTRY emscripten_glStencilMask( GLuint mask ); + +GLAPI void GLAPIENTRY emscripten_glStencilOp( GLenum fail, GLenum zfail, GLenum zpass ); + +GLAPI void GLAPIENTRY emscripten_glClearStencil( GLint s ); + + + +/* + * Texture mapping + */ + +GLAPI void GLAPIENTRY emscripten_glTexGend( GLenum coord, GLenum pname, GLdouble param ); +GLAPI void GLAPIENTRY emscripten_glTexGenf( GLenum coord, GLenum pname, GLfloat param ); +GLAPI void GLAPIENTRY emscripten_glTexGeni( GLenum coord, GLenum pname, GLint param ); + +GLAPI void GLAPIENTRY emscripten_glTexGendv( GLenum coord, GLenum pname, const GLdouble *params ); +GLAPI void GLAPIENTRY emscripten_glTexGenfv( GLenum coord, GLenum pname, const GLfloat *params ); +GLAPI void GLAPIENTRY emscripten_glTexGeniv( GLenum coord, GLenum pname, const GLint *params ); + +GLAPI void GLAPIENTRY emscripten_glGetTexGendv( GLenum coord, GLenum pname, GLdouble *params ); +GLAPI void GLAPIENTRY emscripten_glGetTexGenfv( GLenum coord, GLenum pname, GLfloat *params ); +GLAPI void GLAPIENTRY emscripten_glGetTexGeniv( GLenum coord, GLenum pname, GLint *params ); + + +GLAPI void GLAPIENTRY emscripten_glTexEnvf( GLenum target, GLenum pname, GLfloat param ); +GLAPI void GLAPIENTRY emscripten_glTexEnvi( GLenum target, GLenum pname, GLint param ); + +GLAPI void GLAPIENTRY emscripten_glTexEnvfv( GLenum target, GLenum pname, const GLfloat *params ); +GLAPI void GLAPIENTRY emscripten_glTexEnviv( GLenum target, GLenum pname, const GLint *params ); + +GLAPI void GLAPIENTRY emscripten_glGetTexEnvfv( GLenum target, GLenum pname, GLfloat *params ); +GLAPI void GLAPIENTRY emscripten_glGetTexEnviv( GLenum target, GLenum pname, GLint *params ); + + +GLAPI void GLAPIENTRY emscripten_glTexParameterf( GLenum target, GLenum pname, GLfloat param ); +GLAPI void GLAPIENTRY emscripten_glTexParameteri( GLenum target, GLenum pname, GLint param ); + +GLAPI void GLAPIENTRY emscripten_glTexParameterfv( GLenum target, GLenum pname, + const GLfloat *params ); +GLAPI void GLAPIENTRY emscripten_glTexParameteriv( GLenum target, GLenum pname, + const GLint *params ); + +GLAPI void GLAPIENTRY emscripten_glGetTexParameterfv( GLenum target, + GLenum pname, GLfloat *params); +GLAPI void GLAPIENTRY emscripten_glGetTexParameteriv( GLenum target, + GLenum pname, GLint *params ); + +GLAPI void GLAPIENTRY emscripten_glGetTexLevelParameterfv( GLenum target, GLint level, + GLenum pname, GLfloat *params ); +GLAPI void GLAPIENTRY emscripten_glGetTexLevelParameteriv( GLenum target, GLint level, + GLenum pname, GLint *params ); + + +GLAPI void GLAPIENTRY emscripten_glTexImage1D( GLenum target, GLint level, + GLint internalFormat, + GLsizei width, GLint border, + GLenum format, GLenum type, + const GLvoid *pixels ); + +GLAPI void GLAPIENTRY emscripten_glTexImage2D( GLenum target, GLint level, + GLint internalFormat, + GLsizei width, GLsizei height, + GLint border, GLenum format, GLenum type, + const GLvoid *pixels ); + +GLAPI void GLAPIENTRY emscripten_glGetTexImage( GLenum target, GLint level, + GLenum format, GLenum type, + GLvoid *pixels ); + + +/* 1.1 functions */ + +GLAPI void GLAPIENTRY emscripten_glGenTextures( GLsizei n, GLuint *textures ); + +GLAPI void GLAPIENTRY emscripten_glDeleteTextures( GLsizei n, const GLuint *textures); + +GLAPI void GLAPIENTRY emscripten_glBindTexture( GLenum target, GLuint texture ); + +GLAPI void GLAPIENTRY emscripten_glPrioritizeTextures( GLsizei n, + const GLuint *textures, + const GLclampf *priorities ); + +GLAPI GLboolean GLAPIENTRY emscripten_glAreTexturesResident( GLsizei n, + const GLuint *textures, + GLboolean *residences ); + +GLAPI GLboolean GLAPIENTRY emscripten_glIsTexture( GLuint texture ); + + +GLAPI void GLAPIENTRY emscripten_glTexSubImage1D( GLenum target, GLint level, + GLint xoffset, + GLsizei width, GLenum format, + GLenum type, const GLvoid *pixels ); + + +GLAPI void GLAPIENTRY emscripten_glTexSubImage2D( GLenum target, GLint level, + GLint xoffset, GLint yoffset, + GLsizei width, GLsizei height, + GLenum format, GLenum type, + const GLvoid *pixels ); + + +GLAPI void GLAPIENTRY emscripten_glCopyTexImage1D( GLenum target, GLint level, + GLenum internalformat, + GLint x, GLint y, + GLsizei width, GLint border ); + + +GLAPI void GLAPIENTRY emscripten_glCopyTexImage2D( GLenum target, GLint level, + GLenum internalformat, + GLint x, GLint y, + GLsizei width, GLsizei height, + GLint border ); + + +GLAPI void GLAPIENTRY emscripten_glCopyTexSubImage1D( GLenum target, GLint level, + GLint xoffset, GLint x, GLint y, + GLsizei width ); + + +GLAPI void GLAPIENTRY emscripten_glCopyTexSubImage2D( GLenum target, GLint level, + GLint xoffset, GLint yoffset, + GLint x, GLint y, + GLsizei width, GLsizei height ); + + +/* + * Evaluators + */ + +GLAPI void GLAPIENTRY emscripten_glMap1d( GLenum target, GLdouble u1, GLdouble u2, + GLint stride, + GLint order, const GLdouble *points ); +GLAPI void GLAPIENTRY emscripten_glMap1f( GLenum target, GLfloat u1, GLfloat u2, + GLint stride, + GLint order, const GLfloat *points ); + +GLAPI void GLAPIENTRY emscripten_glMap2d( GLenum target, + GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, + GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, + const GLdouble *points ); +GLAPI void GLAPIENTRY emscripten_glMap2f( GLenum target, + GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, + GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, + const GLfloat *points ); + +GLAPI void GLAPIENTRY emscripten_glGetMapdv( GLenum target, GLenum query, GLdouble *v ); +GLAPI void GLAPIENTRY emscripten_glGetMapfv( GLenum target, GLenum query, GLfloat *v ); +GLAPI void GLAPIENTRY emscripten_glGetMapiv( GLenum target, GLenum query, GLint *v ); + +GLAPI void GLAPIENTRY emscripten_glEvalCoord1d( GLdouble u ); +GLAPI void GLAPIENTRY emscripten_glEvalCoord1f( GLfloat u ); + +GLAPI void GLAPIENTRY emscripten_glEvalCoord1dv( const GLdouble *u ); +GLAPI void GLAPIENTRY emscripten_glEvalCoord1fv( const GLfloat *u ); + +GLAPI void GLAPIENTRY emscripten_glEvalCoord2d( GLdouble u, GLdouble v ); +GLAPI void GLAPIENTRY emscripten_glEvalCoord2f( GLfloat u, GLfloat v ); + +GLAPI void GLAPIENTRY emscripten_glEvalCoord2dv( const GLdouble *u ); +GLAPI void GLAPIENTRY emscripten_glEvalCoord2fv( const GLfloat *u ); + +GLAPI void GLAPIENTRY emscripten_glMapGrid1d( GLint un, GLdouble u1, GLdouble u2 ); +GLAPI void GLAPIENTRY emscripten_glMapGrid1f( GLint un, GLfloat u1, GLfloat u2 ); + +GLAPI void GLAPIENTRY emscripten_glMapGrid2d( GLint un, GLdouble u1, GLdouble u2, + GLint vn, GLdouble v1, GLdouble v2 ); +GLAPI void GLAPIENTRY emscripten_glMapGrid2f( GLint un, GLfloat u1, GLfloat u2, + GLint vn, GLfloat v1, GLfloat v2 ); + +GLAPI void GLAPIENTRY emscripten_glEvalPoint1( GLint i ); + +GLAPI void GLAPIENTRY emscripten_glEvalPoint2( GLint i, GLint j ); + +GLAPI void GLAPIENTRY emscripten_glEvalMesh1( GLenum mode, GLint i1, GLint i2 ); + +GLAPI void GLAPIENTRY emscripten_glEvalMesh2( GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2 ); + + +/* + * Fog + */ + +GLAPI void GLAPIENTRY emscripten_glFogf( GLenum pname, GLfloat param ); + +GLAPI void GLAPIENTRY emscripten_glFogi( GLenum pname, GLint param ); + +GLAPI void GLAPIENTRY emscripten_glFogfv( GLenum pname, const GLfloat *params ); + +GLAPI void GLAPIENTRY emscripten_glFogiv( GLenum pname, const GLint *params ); + + +/* + * Selection and Feedback + */ + +GLAPI void GLAPIENTRY emscripten_glFeedbackBuffer( GLsizei size, GLenum type, GLfloat *buffer ); + +GLAPI void GLAPIENTRY emscripten_glPassThrough( GLfloat token ); + +GLAPI void GLAPIENTRY emscripten_glSelectBuffer( GLsizei size, GLuint *buffer ); + +GLAPI void GLAPIENTRY emscripten_glInitNames( void ); + +GLAPI void GLAPIENTRY emscripten_glLoadName( GLuint name ); + +GLAPI void GLAPIENTRY emscripten_glPushName( GLuint name ); + +GLAPI void GLAPIENTRY emscripten_glPopName( void ); + + +GLAPI void GLAPIENTRY emscripten_glDrawRangeElements( GLenum mode, GLuint start, + GLuint end, GLsizei count, GLenum type, const GLvoid *indices ); + +GLAPI void GLAPIENTRY emscripten_glTexImage3D( GLenum target, GLint level, + GLint internalFormat, + GLsizei width, GLsizei height, + GLsizei depth, GLint border, + GLenum format, GLenum type, + const GLvoid *pixels ); + +GLAPI void GLAPIENTRY emscripten_glTexSubImage3D( GLenum target, GLint level, + GLint xoffset, GLint yoffset, + GLint zoffset, GLsizei width, + GLsizei height, GLsizei depth, + GLenum format, + GLenum type, const GLvoid *pixels); + +GLAPI void GLAPIENTRY emscripten_glCopyTexSubImage3D( GLenum target, GLint level, + GLint xoffset, GLint yoffset, + GLint zoffset, GLint x, + GLint y, GLsizei width, + GLsizei height ); + + +GLAPI void GLAPIENTRY emscripten_glColorTable( GLenum target, GLenum internalformat, + GLsizei width, GLenum format, + GLenum type, const GLvoid *table ); + +GLAPI void GLAPIENTRY emscripten_glColorSubTable( GLenum target, + GLsizei start, GLsizei count, + GLenum format, GLenum type, + const GLvoid *data ); + +GLAPI void GLAPIENTRY emscripten_glColorTableParameteriv(GLenum target, GLenum pname, + const GLint *params); + +GLAPI void GLAPIENTRY emscripten_glColorTableParameterfv(GLenum target, GLenum pname, + const GLfloat *params); + +GLAPI void GLAPIENTRY emscripten_glCopyColorSubTable( GLenum target, GLsizei start, + GLint x, GLint y, GLsizei width ); + +GLAPI void GLAPIENTRY emscripten_glCopyColorTable( GLenum target, GLenum internalformat, + GLint x, GLint y, GLsizei width ); + +GLAPI void GLAPIENTRY emscripten_glGetColorTable( GLenum target, GLenum format, + GLenum type, GLvoid *table ); + +GLAPI void GLAPIENTRY emscripten_glGetColorTableParameterfv( GLenum target, GLenum pname, + GLfloat *params ); + +GLAPI void GLAPIENTRY emscripten_glGetColorTableParameteriv( GLenum target, GLenum pname, + GLint *params ); + +GLAPI void GLAPIENTRY emscripten_glBlendEquation( GLenum mode ); + +GLAPI void GLAPIENTRY emscripten_glBlendColor( GLclampf red, GLclampf green, + GLclampf blue, GLclampf alpha ); + +GLAPI void GLAPIENTRY emscripten_glHistogram( GLenum target, GLsizei width, + GLenum internalformat, GLboolean sink ); + +GLAPI void GLAPIENTRY emscripten_glResetHistogram( GLenum target ); + +GLAPI void GLAPIENTRY emscripten_glGetHistogram( GLenum target, GLboolean reset, + GLenum format, GLenum type, + GLvoid *values ); + +GLAPI void GLAPIENTRY emscripten_glGetHistogramParameterfv( GLenum target, GLenum pname, + GLfloat *params ); + +GLAPI void GLAPIENTRY emscripten_glGetHistogramParameteriv( GLenum target, GLenum pname, + GLint *params ); + +GLAPI void GLAPIENTRY emscripten_glMinmax( GLenum target, GLenum internalformat, + GLboolean sink ); + +GLAPI void GLAPIENTRY emscripten_glResetMinmax( GLenum target ); + +GLAPI void GLAPIENTRY emscripten_glGetMinmax( GLenum target, GLboolean reset, + GLenum format, GLenum types, + GLvoid *values ); + +GLAPI void GLAPIENTRY emscripten_glGetMinmaxParameterfv( GLenum target, GLenum pname, + GLfloat *params ); + +GLAPI void GLAPIENTRY emscripten_glGetMinmaxParameteriv( GLenum target, GLenum pname, + GLint *params ); + +GLAPI void GLAPIENTRY emscripten_glConvolutionFilter1D( GLenum target, + GLenum internalformat, GLsizei width, GLenum format, GLenum type, + const GLvoid *image ); + +GLAPI void GLAPIENTRY emscripten_glConvolutionFilter2D( GLenum target, + GLenum internalformat, GLsizei width, GLsizei height, GLenum format, + GLenum type, const GLvoid *image ); + +GLAPI void GLAPIENTRY emscripten_glConvolutionParameterf( GLenum target, GLenum pname, + GLfloat params ); + +GLAPI void GLAPIENTRY emscripten_glConvolutionParameterfv( GLenum target, GLenum pname, + const GLfloat *params ); + +GLAPI void GLAPIENTRY emscripten_glConvolutionParameteri( GLenum target, GLenum pname, + GLint params ); + +GLAPI void GLAPIENTRY emscripten_glConvolutionParameteriv( GLenum target, GLenum pname, + const GLint *params ); + +GLAPI void GLAPIENTRY emscripten_glCopyConvolutionFilter1D( GLenum target, + GLenum internalformat, GLint x, GLint y, GLsizei width ); + +GLAPI void GLAPIENTRY emscripten_glCopyConvolutionFilter2D( GLenum target, + GLenum internalformat, GLint x, GLint y, GLsizei width, + GLsizei height); + +GLAPI void GLAPIENTRY emscripten_glGetConvolutionFilter( GLenum target, GLenum format, + GLenum type, GLvoid *image ); + +GLAPI void GLAPIENTRY emscripten_glGetConvolutionParameterfv( GLenum target, GLenum pname, + GLfloat *params ); + +GLAPI void GLAPIENTRY emscripten_glGetConvolutionParameteriv( GLenum target, GLenum pname, + GLint *params ); + +GLAPI void GLAPIENTRY emscripten_glSeparableFilter2D( GLenum target, + GLenum internalformat, GLsizei width, GLsizei height, GLenum format, + GLenum type, const GLvoid *row, const GLvoid *column ); + +GLAPI void GLAPIENTRY emscripten_glGetSeparableFilter( GLenum target, GLenum format, + GLenum type, GLvoid *row, GLvoid *column, GLvoid *span ); + + +GLAPI void GLAPIENTRY emscripten_glActiveTexture( GLenum texture ); + +GLAPI void GLAPIENTRY emscripten_glClientActiveTexture( GLenum texture ); + +GLAPI void GLAPIENTRY emscripten_glCompressedTexImage1D( GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data ); + +GLAPI void GLAPIENTRY emscripten_glCompressedTexImage2D( GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data ); + +GLAPI void GLAPIENTRY emscripten_glCompressedTexImage3D( GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data ); + +GLAPI void GLAPIENTRY emscripten_glCompressedTexSubImage1D( GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data ); + +GLAPI void GLAPIENTRY emscripten_glCompressedTexSubImage2D( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data ); + +GLAPI void GLAPIENTRY emscripten_glCompressedTexSubImage3D( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data ); + +GLAPI void GLAPIENTRY emscripten_glGetCompressedTexImage( GLenum target, GLint lod, GLvoid *img ); + +GLAPI void GLAPIENTRY emscripten_glMultiTexCoord1d( GLenum target, GLdouble s ); + +GLAPI void GLAPIENTRY emscripten_glMultiTexCoord1dv( GLenum target, const GLdouble *v ); + +GLAPI void GLAPIENTRY emscripten_glMultiTexCoord1f( GLenum target, GLfloat s ); + +GLAPI void GLAPIENTRY emscripten_glMultiTexCoord1fv( GLenum target, const GLfloat *v ); + +GLAPI void GLAPIENTRY emscripten_glMultiTexCoord1i( GLenum target, GLint s ); + +GLAPI void GLAPIENTRY emscripten_glMultiTexCoord1iv( GLenum target, const GLint *v ); + +GLAPI void GLAPIENTRY emscripten_glMultiTexCoord1s( GLenum target, GLshort s ); + +GLAPI void GLAPIENTRY emscripten_glMultiTexCoord1sv( GLenum target, const GLshort *v ); + +GLAPI void GLAPIENTRY emscripten_glMultiTexCoord2d( GLenum target, GLdouble s, GLdouble t ); + +GLAPI void GLAPIENTRY emscripten_glMultiTexCoord2dv( GLenum target, const GLdouble *v ); + +GLAPI void GLAPIENTRY emscripten_glMultiTexCoord2f( GLenum target, GLfloat s, GLfloat t ); + +GLAPI void GLAPIENTRY emscripten_glMultiTexCoord2fv( GLenum target, const GLfloat *v ); + +GLAPI void GLAPIENTRY emscripten_glMultiTexCoord2i( GLenum target, GLint s, GLint t ); + +GLAPI void GLAPIENTRY emscripten_glMultiTexCoord2iv( GLenum target, const GLint *v ); + +GLAPI void GLAPIENTRY emscripten_glMultiTexCoord2s( GLenum target, GLshort s, GLshort t ); + +GLAPI void GLAPIENTRY emscripten_glMultiTexCoord2sv( GLenum target, const GLshort *v ); + +GLAPI void GLAPIENTRY emscripten_glMultiTexCoord3d( GLenum target, GLdouble s, GLdouble t, GLdouble r ); + +GLAPI void GLAPIENTRY emscripten_glMultiTexCoord3dv( GLenum target, const GLdouble *v ); + +GLAPI void GLAPIENTRY emscripten_glMultiTexCoord3f( GLenum target, GLfloat s, GLfloat t, GLfloat r ); + +GLAPI void GLAPIENTRY emscripten_glMultiTexCoord3fv( GLenum target, const GLfloat *v ); + +GLAPI void GLAPIENTRY emscripten_glMultiTexCoord3i( GLenum target, GLint s, GLint t, GLint r ); + +GLAPI void GLAPIENTRY emscripten_glMultiTexCoord3iv( GLenum target, const GLint *v ); + +GLAPI void GLAPIENTRY emscripten_glMultiTexCoord3s( GLenum target, GLshort s, GLshort t, GLshort r ); + +GLAPI void GLAPIENTRY emscripten_glMultiTexCoord3sv( GLenum target, const GLshort *v ); + +GLAPI void GLAPIENTRY emscripten_glMultiTexCoord4d( GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q ); + +GLAPI void GLAPIENTRY emscripten_glMultiTexCoord4dv( GLenum target, const GLdouble *v ); + +GLAPI void GLAPIENTRY emscripten_glMultiTexCoord4f( GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q ); + +GLAPI void GLAPIENTRY emscripten_glMultiTexCoord4fv( GLenum target, const GLfloat *v ); + +GLAPI void GLAPIENTRY emscripten_glMultiTexCoord4i( GLenum target, GLint s, GLint t, GLint r, GLint q ); + +GLAPI void GLAPIENTRY emscripten_glMultiTexCoord4iv( GLenum target, const GLint *v ); + +GLAPI void GLAPIENTRY emscripten_glMultiTexCoord4s( GLenum target, GLshort s, GLshort t, GLshort r, GLshort q ); + +GLAPI void GLAPIENTRY emscripten_glMultiTexCoord4sv( GLenum target, const GLshort *v ); + + +GLAPI void GLAPIENTRY emscripten_glLoadTransposeMatrixd( const GLdouble m[16] ); + +GLAPI void GLAPIENTRY emscripten_glLoadTransposeMatrixf( const GLfloat m[16] ); + +GLAPI void GLAPIENTRY emscripten_glMultTransposeMatrixd( const GLdouble m[16] ); + +GLAPI void GLAPIENTRY emscripten_glMultTransposeMatrixf( const GLfloat m[16] ); + +GLAPI void GLAPIENTRY emscripten_glSampleCoverage( GLclampf value, GLboolean invert ); + + +GLAPI void GLAPIENTRY emscripten_glActiveTextureARB(GLenum texture); +GLAPI void GLAPIENTRY emscripten_glClientActiveTextureARB(GLenum texture); +GLAPI void GLAPIENTRY emscripten_glMultiTexCoord1dARB(GLenum target, GLdouble s); +GLAPI void GLAPIENTRY emscripten_glMultiTexCoord1dvARB(GLenum target, const GLdouble *v); +GLAPI void GLAPIENTRY emscripten_glMultiTexCoord1fARB(GLenum target, GLfloat s); +GLAPI void GLAPIENTRY emscripten_glMultiTexCoord1fvARB(GLenum target, const GLfloat *v); +GLAPI void GLAPIENTRY emscripten_glMultiTexCoord1iARB(GLenum target, GLint s); +GLAPI void GLAPIENTRY emscripten_glMultiTexCoord1ivARB(GLenum target, const GLint *v); +GLAPI void GLAPIENTRY emscripten_glMultiTexCoord1sARB(GLenum target, GLshort s); +GLAPI void GLAPIENTRY emscripten_glMultiTexCoord1svARB(GLenum target, const GLshort *v); +GLAPI void GLAPIENTRY emscripten_glMultiTexCoord2dARB(GLenum target, GLdouble s, GLdouble t); +GLAPI void GLAPIENTRY emscripten_glMultiTexCoord2dvARB(GLenum target, const GLdouble *v); +GLAPI void GLAPIENTRY emscripten_glMultiTexCoord2fARB(GLenum target, GLfloat s, GLfloat t); +GLAPI void GLAPIENTRY emscripten_glMultiTexCoord2fvARB(GLenum target, const GLfloat *v); +GLAPI void GLAPIENTRY emscripten_glMultiTexCoord2iARB(GLenum target, GLint s, GLint t); +GLAPI void GLAPIENTRY emscripten_glMultiTexCoord2ivARB(GLenum target, const GLint *v); +GLAPI void GLAPIENTRY emscripten_glMultiTexCoord2sARB(GLenum target, GLshort s, GLshort t); +GLAPI void GLAPIENTRY emscripten_glMultiTexCoord2svARB(GLenum target, const GLshort *v); +GLAPI void GLAPIENTRY emscripten_glMultiTexCoord3dARB(GLenum target, GLdouble s, GLdouble t, GLdouble r); +GLAPI void GLAPIENTRY emscripten_glMultiTexCoord3dvARB(GLenum target, const GLdouble *v); +GLAPI void GLAPIENTRY emscripten_glMultiTexCoord3fARB(GLenum target, GLfloat s, GLfloat t, GLfloat r); +GLAPI void GLAPIENTRY emscripten_glMultiTexCoord3fvARB(GLenum target, const GLfloat *v); +GLAPI void GLAPIENTRY emscripten_glMultiTexCoord3iARB(GLenum target, GLint s, GLint t, GLint r); +GLAPI void GLAPIENTRY emscripten_glMultiTexCoord3ivARB(GLenum target, const GLint *v); +GLAPI void GLAPIENTRY emscripten_glMultiTexCoord3sARB(GLenum target, GLshort s, GLshort t, GLshort r); +GLAPI void GLAPIENTRY emscripten_glMultiTexCoord3svARB(GLenum target, const GLshort *v); +GLAPI void GLAPIENTRY emscripten_glMultiTexCoord4dARB(GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q); +GLAPI void GLAPIENTRY emscripten_glMultiTexCoord4dvARB(GLenum target, const GLdouble *v); +GLAPI void GLAPIENTRY emscripten_glMultiTexCoord4fARB(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q); +GLAPI void GLAPIENTRY emscripten_glMultiTexCoord4fvARB(GLenum target, const GLfloat *v); +GLAPI void GLAPIENTRY emscripten_glMultiTexCoord4iARB(GLenum target, GLint s, GLint t, GLint r, GLint q); +GLAPI void GLAPIENTRY emscripten_glMultiTexCoord4ivARB(GLenum target, const GLint *v); +GLAPI void GLAPIENTRY emscripten_glMultiTexCoord4sARB(GLenum target, GLshort s, GLshort t, GLshort r, GLshort q); +GLAPI void GLAPIENTRY emscripten_glMultiTexCoord4svARB(GLenum target, const GLshort *v); + + +GLAPI void APIENTRY emscripten_glBlendColor (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); +GLAPI void APIENTRY emscripten_glBlendEquation (GLenum mode); +GLAPI void APIENTRY emscripten_glDrawRangeElements (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices); +GLAPI void APIENTRY emscripten_glTexImage3D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels); +GLAPI void APIENTRY emscripten_glTexSubImage3D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels); +GLAPI void APIENTRY emscripten_glCopyTexSubImage3D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); + + +GLAPI void APIENTRY emscripten_glColorTable (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *table); +GLAPI void APIENTRY emscripten_glColorTableParameterfv (GLenum target, GLenum pname, const GLfloat *params); +GLAPI void APIENTRY emscripten_glColorTableParameteriv (GLenum target, GLenum pname, const GLint *params); +GLAPI void APIENTRY emscripten_glCopyColorTable (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); +GLAPI void APIENTRY emscripten_glGetColorTable (GLenum target, GLenum format, GLenum type, GLvoid *table); +GLAPI void APIENTRY emscripten_glGetColorTableParameterfv (GLenum target, GLenum pname, GLfloat *params); +GLAPI void APIENTRY emscripten_glGetColorTableParameteriv (GLenum target, GLenum pname, GLint *params); +GLAPI void APIENTRY emscripten_glColorSubTable (GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid *data); +GLAPI void APIENTRY emscripten_glCopyColorSubTable (GLenum target, GLsizei start, GLint x, GLint y, GLsizei width); +GLAPI void APIENTRY emscripten_glConvolutionFilter1D (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *image); +GLAPI void APIENTRY emscripten_glConvolutionFilter2D (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *image); +GLAPI void APIENTRY emscripten_glConvolutionParameterf (GLenum target, GLenum pname, GLfloat params); +GLAPI void APIENTRY emscripten_glConvolutionParameterfv (GLenum target, GLenum pname, const GLfloat *params); +GLAPI void APIENTRY emscripten_glConvolutionParameteri (GLenum target, GLenum pname, GLint params); +GLAPI void APIENTRY emscripten_glConvolutionParameteriv (GLenum target, GLenum pname, const GLint *params); +GLAPI void APIENTRY emscripten_glCopyConvolutionFilter1D (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); +GLAPI void APIENTRY emscripten_glCopyConvolutionFilter2D (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height); +GLAPI void APIENTRY emscripten_glGetConvolutionFilter (GLenum target, GLenum format, GLenum type, GLvoid *image); +GLAPI void APIENTRY emscripten_glGetConvolutionParameterfv (GLenum target, GLenum pname, GLfloat *params); +GLAPI void APIENTRY emscripten_glGetConvolutionParameteriv (GLenum target, GLenum pname, GLint *params); +GLAPI void APIENTRY emscripten_glGetSeparableFilter (GLenum target, GLenum format, GLenum type, GLvoid *row, GLvoid *column, GLvoid *span); +GLAPI void APIENTRY emscripten_glSeparableFilter2D (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *row, const GLvoid *column); +GLAPI void APIENTRY emscripten_glGetHistogram (GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values); +GLAPI void APIENTRY emscripten_glGetHistogramParameterfv (GLenum target, GLenum pname, GLfloat *params); +GLAPI void APIENTRY emscripten_glGetHistogramParameteriv (GLenum target, GLenum pname, GLint *params); +GLAPI void APIENTRY emscripten_glGetMinmax (GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values); +GLAPI void APIENTRY emscripten_glGetMinmaxParameterfv (GLenum target, GLenum pname, GLfloat *params); +GLAPI void APIENTRY emscripten_glGetMinmaxParameteriv (GLenum target, GLenum pname, GLint *params); +GLAPI void APIENTRY emscripten_glHistogram (GLenum target, GLsizei width, GLenum internalformat, GLboolean sink); +GLAPI void APIENTRY emscripten_glMinmax (GLenum target, GLenum internalformat, GLboolean sink); +GLAPI void APIENTRY emscripten_glResetHistogram (GLenum target); +GLAPI void APIENTRY emscripten_glResetMinmax (GLenum target); + + +GLAPI void APIENTRY emscripten_glActiveTexture (GLenum texture); +GLAPI void APIENTRY emscripten_glSampleCoverage (GLclampf value, GLboolean invert); +GLAPI void APIENTRY emscripten_glCompressedTexImage3D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data); +GLAPI void APIENTRY emscripten_glCompressedTexImage2D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data); +GLAPI void APIENTRY emscripten_glCompressedTexImage1D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data); +GLAPI void APIENTRY emscripten_glCompressedTexSubImage3D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data); +GLAPI void APIENTRY emscripten_glCompressedTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data); +GLAPI void APIENTRY emscripten_glCompressedTexSubImage1D (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data); +GLAPI void APIENTRY emscripten_glGetCompressedTexImage (GLenum target, GLint level, GLvoid *img); + + +GLAPI void APIENTRY emscripten_glClientActiveTexture (GLenum texture); +GLAPI void APIENTRY emscripten_glMultiTexCoord1d (GLenum target, GLdouble s); +GLAPI void APIENTRY emscripten_glMultiTexCoord1dv (GLenum target, const GLdouble *v); +GLAPI void APIENTRY emscripten_glMultiTexCoord1f (GLenum target, GLfloat s); +GLAPI void APIENTRY emscripten_glMultiTexCoord1fv (GLenum target, const GLfloat *v); +GLAPI void APIENTRY emscripten_glMultiTexCoord1i (GLenum target, GLint s); +GLAPI void APIENTRY emscripten_glMultiTexCoord1iv (GLenum target, const GLint *v); +GLAPI void APIENTRY emscripten_glMultiTexCoord1s (GLenum target, GLshort s); +GLAPI void APIENTRY emscripten_glMultiTexCoord1sv (GLenum target, const GLshort *v); +GLAPI void APIENTRY emscripten_glMultiTexCoord2d (GLenum target, GLdouble s, GLdouble t); +GLAPI void APIENTRY emscripten_glMultiTexCoord2dv (GLenum target, const GLdouble *v); +GLAPI void APIENTRY emscripten_glMultiTexCoord2f (GLenum target, GLfloat s, GLfloat t); +GLAPI void APIENTRY emscripten_glMultiTexCoord2fv (GLenum target, const GLfloat *v); +GLAPI void APIENTRY emscripten_glMultiTexCoord2i (GLenum target, GLint s, GLint t); +GLAPI void APIENTRY emscripten_glMultiTexCoord2iv (GLenum target, const GLint *v); +GLAPI void APIENTRY emscripten_glMultiTexCoord2s (GLenum target, GLshort s, GLshort t); +GLAPI void APIENTRY emscripten_glMultiTexCoord2sv (GLenum target, const GLshort *v); +GLAPI void APIENTRY emscripten_glMultiTexCoord3d (GLenum target, GLdouble s, GLdouble t, GLdouble r); +GLAPI void APIENTRY emscripten_glMultiTexCoord3dv (GLenum target, const GLdouble *v); +GLAPI void APIENTRY emscripten_glMultiTexCoord3f (GLenum target, GLfloat s, GLfloat t, GLfloat r); +GLAPI void APIENTRY emscripten_glMultiTexCoord3fv (GLenum target, const GLfloat *v); +GLAPI void APIENTRY emscripten_glMultiTexCoord3i (GLenum target, GLint s, GLint t, GLint r); +GLAPI void APIENTRY emscripten_glMultiTexCoord3iv (GLenum target, const GLint *v); +GLAPI void APIENTRY emscripten_glMultiTexCoord3s (GLenum target, GLshort s, GLshort t, GLshort r); +GLAPI void APIENTRY emscripten_glMultiTexCoord3sv (GLenum target, const GLshort *v); +GLAPI void APIENTRY emscripten_glMultiTexCoord4d (GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q); +GLAPI void APIENTRY emscripten_glMultiTexCoord4dv (GLenum target, const GLdouble *v); +GLAPI void APIENTRY emscripten_glMultiTexCoord4f (GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q); +GLAPI void APIENTRY emscripten_glMultiTexCoord4fv (GLenum target, const GLfloat *v); +GLAPI void APIENTRY emscripten_glMultiTexCoord4i (GLenum target, GLint s, GLint t, GLint r, GLint q); +GLAPI void APIENTRY emscripten_glMultiTexCoord4iv (GLenum target, const GLint *v); +GLAPI void APIENTRY emscripten_glMultiTexCoord4s (GLenum target, GLshort s, GLshort t, GLshort r, GLshort q); +GLAPI void APIENTRY emscripten_glMultiTexCoord4sv (GLenum target, const GLshort *v); +GLAPI void APIENTRY emscripten_glLoadTransposeMatrixf (const GLfloat *m); +GLAPI void APIENTRY emscripten_glLoadTransposeMatrixd (const GLdouble *m); +GLAPI void APIENTRY emscripten_glMultTransposeMatrixf (const GLfloat *m); +GLAPI void APIENTRY emscripten_glMultTransposeMatrixd (const GLdouble *m); + + +GLAPI void APIENTRY emscripten_glBlendFuncSeparate (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); +GLAPI void APIENTRY emscripten_glMultiDrawArrays (GLenum mode, const GLint *first, const GLsizei *count, GLsizei primcount); +GLAPI void APIENTRY emscripten_glMultiDrawElements (GLenum mode, const GLsizei *count, GLenum type, const GLvoid* *indices, GLsizei primcount); +GLAPI void APIENTRY emscripten_glPointParameterf (GLenum pname, GLfloat param); +GLAPI void APIENTRY emscripten_glPointParameterfv (GLenum pname, const GLfloat *params); +GLAPI void APIENTRY emscripten_glPointParameteri (GLenum pname, GLint param); +GLAPI void APIENTRY emscripten_glPointParameteriv (GLenum pname, const GLint *params); + + +GLAPI void APIENTRY emscripten_glFogCoordf (GLfloat coord); +GLAPI void APIENTRY emscripten_glFogCoordfv (const GLfloat *coord); +GLAPI void APIENTRY emscripten_glFogCoordd (GLdouble coord); +GLAPI void APIENTRY emscripten_glFogCoorddv (const GLdouble *coord); +GLAPI void APIENTRY emscripten_glFogCoordPointer (GLenum type, GLsizei stride, const GLvoid *pointer); +GLAPI void APIENTRY emscripten_glSecondaryColor3b (GLbyte red, GLbyte green, GLbyte blue); +GLAPI void APIENTRY emscripten_glSecondaryColor3bv (const GLbyte *v); +GLAPI void APIENTRY emscripten_glSecondaryColor3d (GLdouble red, GLdouble green, GLdouble blue); +GLAPI void APIENTRY emscripten_glSecondaryColor3dv (const GLdouble *v); +GLAPI void APIENTRY emscripten_glSecondaryColor3f (GLfloat red, GLfloat green, GLfloat blue); +GLAPI void APIENTRY emscripten_glSecondaryColor3fv (const GLfloat *v); +GLAPI void APIENTRY emscripten_glSecondaryColor3i (GLint red, GLint green, GLint blue); +GLAPI void APIENTRY emscripten_glSecondaryColor3iv (const GLint *v); +GLAPI void APIENTRY emscripten_glSecondaryColor3s (GLshort red, GLshort green, GLshort blue); +GLAPI void APIENTRY emscripten_glSecondaryColor3sv (const GLshort *v); +GLAPI void APIENTRY emscripten_glSecondaryColor3ub (GLubyte red, GLubyte green, GLubyte blue); +GLAPI void APIENTRY emscripten_glSecondaryColor3ubv (const GLubyte *v); +GLAPI void APIENTRY emscripten_glSecondaryColor3ui (GLuint red, GLuint green, GLuint blue); +GLAPI void APIENTRY emscripten_glSecondaryColor3uiv (const GLuint *v); +GLAPI void APIENTRY emscripten_glSecondaryColor3us (GLushort red, GLushort green, GLushort blue); +GLAPI void APIENTRY emscripten_glSecondaryColor3usv (const GLushort *v); +GLAPI void APIENTRY emscripten_glSecondaryColorPointer (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); +GLAPI void APIENTRY emscripten_glWindowPos2d (GLdouble x, GLdouble y); +GLAPI void APIENTRY emscripten_glWindowPos2dv (const GLdouble *v); +GLAPI void APIENTRY emscripten_glWindowPos2f (GLfloat x, GLfloat y); +GLAPI void APIENTRY emscripten_glWindowPos2fv (const GLfloat *v); +GLAPI void APIENTRY emscripten_glWindowPos2i (GLint x, GLint y); +GLAPI void APIENTRY emscripten_glWindowPos2iv (const GLint *v); +GLAPI void APIENTRY emscripten_glWindowPos2s (GLshort x, GLshort y); +GLAPI void APIENTRY emscripten_glWindowPos2sv (const GLshort *v); +GLAPI void APIENTRY emscripten_glWindowPos3d (GLdouble x, GLdouble y, GLdouble z); +GLAPI void APIENTRY emscripten_glWindowPos3dv (const GLdouble *v); +GLAPI void APIENTRY emscripten_glWindowPos3f (GLfloat x, GLfloat y, GLfloat z); +GLAPI void APIENTRY emscripten_glWindowPos3fv (const GLfloat *v); +GLAPI void APIENTRY emscripten_glWindowPos3i (GLint x, GLint y, GLint z); +GLAPI void APIENTRY emscripten_glWindowPos3iv (const GLint *v); +GLAPI void APIENTRY emscripten_glWindowPos3s (GLshort x, GLshort y, GLshort z); +GLAPI void APIENTRY emscripten_glWindowPos3sv (const GLshort *v); + + +GLAPI void APIENTRY emscripten_glGenQueries (GLsizei n, GLuint *ids); +GLAPI void APIENTRY emscripten_glDeleteQueries (GLsizei n, const GLuint *ids); +GLAPI GLboolean APIENTRY emscripten_glIsQuery (GLuint id); +GLAPI void APIENTRY emscripten_glBeginQuery (GLenum target, GLuint id); +GLAPI void APIENTRY emscripten_glEndQuery (GLenum target); +GLAPI void APIENTRY emscripten_glGetQueryiv (GLenum target, GLenum pname, GLint *params); +GLAPI void APIENTRY emscripten_glGetQueryObjectiv (GLuint id, GLenum pname, GLint *params); +GLAPI void APIENTRY emscripten_glGetQueryObjectuiv (GLuint id, GLenum pname, GLuint *params); +GLAPI void APIENTRY emscripten_glBindBuffer (GLenum target, GLuint buffer); +GLAPI void APIENTRY emscripten_glDeleteBuffers (GLsizei n, const GLuint *buffers); +GLAPI void APIENTRY emscripten_glGenBuffers (GLsizei n, GLuint *buffers); +GLAPI GLboolean APIENTRY emscripten_glIsBuffer (GLuint buffer); +GLAPI void APIENTRY emscripten_glBufferData (GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage); +GLAPI void APIENTRY emscripten_glBufferSubData (GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data); +GLAPI void APIENTRY emscripten_glGetBufferSubData (GLenum target, GLintptr offset, GLsizeiptr size, GLvoid *data); +GLAPI GLvoid* APIENTRY emscripten_glMapBuffer (GLenum target, GLenum access); +GLAPI GLboolean APIENTRY emscripten_glUnmapBuffer (GLenum target); +GLAPI void APIENTRY emscripten_glGetBufferParameteriv (GLenum target, GLenum pname, GLint *params); +GLAPI void APIENTRY emscripten_glGetBufferPointerv (GLenum target, GLenum pname, GLvoid* *params); + + +GLAPI void APIENTRY emscripten_glBlendEquationSeparate (GLenum modeRGB, GLenum modeAlpha); +GLAPI void APIENTRY emscripten_glDrawBuffers (GLsizei n, const GLenum *bufs); +GLAPI void APIENTRY emscripten_glStencilOpSeparate (GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass); +GLAPI void APIENTRY emscripten_glStencilFuncSeparate (GLenum face, GLenum func, GLint ref, GLuint mask); +GLAPI void APIENTRY emscripten_glStencilMaskSeparate (GLenum face, GLuint mask); +GLAPI void APIENTRY emscripten_glAttachShader (GLuint program, GLuint shader); +GLAPI void APIENTRY emscripten_glBindAttribLocation (GLuint program, GLuint index, const GLchar *name); +GLAPI void APIENTRY emscripten_glCompileShader (GLuint shader); +GLAPI GLuint APIENTRY emscripten_glCreateProgram (void); +GLAPI GLuint APIENTRY emscripten_glCreateShader (GLenum type); +GLAPI void APIENTRY emscripten_glDeleteProgram (GLuint program); +GLAPI void APIENTRY emscripten_glDeleteShader (GLuint shader); +GLAPI void APIENTRY emscripten_glDetachShader (GLuint program, GLuint shader); +GLAPI void APIENTRY emscripten_glDisableVertexAttribArray (GLuint index); +GLAPI void APIENTRY emscripten_glEnableVertexAttribArray (GLuint index); +GLAPI void APIENTRY emscripten_glGetActiveAttrib (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name); +GLAPI void APIENTRY emscripten_glGetActiveUniform (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name); +GLAPI void APIENTRY emscripten_glGetAttachedShaders (GLuint program, GLsizei maxCount, GLsizei *count, GLuint *obj); +GLAPI GLint APIENTRY emscripten_glGetAttribLocation (GLuint program, const GLchar *name); +GLAPI void APIENTRY emscripten_glGetProgramiv (GLuint program, GLenum pname, GLint *params); +GLAPI void APIENTRY emscripten_glGetProgramInfoLog (GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog); +GLAPI void APIENTRY emscripten_glGetShaderiv (GLuint shader, GLenum pname, GLint *params); +GLAPI void APIENTRY emscripten_glGetShaderInfoLog (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog); +GLAPI void APIENTRY emscripten_glGetShaderSource (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source); +GLAPI GLint APIENTRY emscripten_glGetUniformLocation (GLuint program, const GLchar *name); +GLAPI void APIENTRY emscripten_glGetUniformfv (GLuint program, GLint location, GLfloat *params); +GLAPI void APIENTRY emscripten_glGetUniformiv (GLuint program, GLint location, GLint *params); +GLAPI void APIENTRY emscripten_glGetVertexAttribdv (GLuint index, GLenum pname, GLdouble *params); +GLAPI void APIENTRY emscripten_glGetVertexAttribfv (GLuint index, GLenum pname, GLfloat *params); +GLAPI void APIENTRY emscripten_glGetVertexAttribiv (GLuint index, GLenum pname, GLint *params); +GLAPI void APIENTRY emscripten_glGetVertexAttribPointerv (GLuint index, GLenum pname, GLvoid* *pointer); +GLAPI GLboolean APIENTRY emscripten_glIsProgram (GLuint program); +GLAPI GLboolean APIENTRY emscripten_glIsShader (GLuint shader); +GLAPI void APIENTRY emscripten_glLinkProgram (GLuint program); +GLAPI void APIENTRY emscripten_glShaderSource (GLuint shader, GLsizei count, const GLchar* *string, const GLint *length); +GLAPI void APIENTRY emscripten_glUseProgram (GLuint program); +GLAPI void APIENTRY emscripten_glUniform1f (GLint location, GLfloat v0); +GLAPI void APIENTRY emscripten_glUniform2f (GLint location, GLfloat v0, GLfloat v1); +GLAPI void APIENTRY emscripten_glUniform3f (GLint location, GLfloat v0, GLfloat v1, GLfloat v2); +GLAPI void APIENTRY emscripten_glUniform4f (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); +GLAPI void APIENTRY emscripten_glUniform1i (GLint location, GLint v0); +GLAPI void APIENTRY emscripten_glUniform2i (GLint location, GLint v0, GLint v1); +GLAPI void APIENTRY emscripten_glUniform3i (GLint location, GLint v0, GLint v1, GLint v2); +GLAPI void APIENTRY emscripten_glUniform4i (GLint location, GLint v0, GLint v1, GLint v2, GLint v3); +GLAPI void APIENTRY emscripten_glUniform1fv (GLint location, GLsizei count, const GLfloat *value); +GLAPI void APIENTRY emscripten_glUniform2fv (GLint location, GLsizei count, const GLfloat *value); +GLAPI void APIENTRY emscripten_glUniform3fv (GLint location, GLsizei count, const GLfloat *value); +GLAPI void APIENTRY emscripten_glUniform4fv (GLint location, GLsizei count, const GLfloat *value); +GLAPI void APIENTRY emscripten_glUniform1iv (GLint location, GLsizei count, const GLint *value); +GLAPI void APIENTRY emscripten_glUniform2iv (GLint location, GLsizei count, const GLint *value); +GLAPI void APIENTRY emscripten_glUniform3iv (GLint location, GLsizei count, const GLint *value); +GLAPI void APIENTRY emscripten_glUniform4iv (GLint location, GLsizei count, const GLint *value); +GLAPI void APIENTRY emscripten_glUniformMatrix2fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI void APIENTRY emscripten_glUniformMatrix3fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI void APIENTRY emscripten_glUniformMatrix4fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI void APIENTRY emscripten_glValidateProgram (GLuint program); +GLAPI void APIENTRY emscripten_glVertexAttrib1d (GLuint index, GLdouble x); +GLAPI void APIENTRY emscripten_glVertexAttrib1dv (GLuint index, const GLdouble *v); +GLAPI void APIENTRY emscripten_glVertexAttrib1f (GLuint index, GLfloat x); +GLAPI void APIENTRY emscripten_glVertexAttrib1fv (GLuint index, const GLfloat *v); +GLAPI void APIENTRY emscripten_glVertexAttrib1s (GLuint index, GLshort x); +GLAPI void APIENTRY emscripten_glVertexAttrib1sv (GLuint index, const GLshort *v); +GLAPI void APIENTRY emscripten_glVertexAttrib2d (GLuint index, GLdouble x, GLdouble y); +GLAPI void APIENTRY emscripten_glVertexAttrib2dv (GLuint index, const GLdouble *v); +GLAPI void APIENTRY emscripten_glVertexAttrib2f (GLuint index, GLfloat x, GLfloat y); +GLAPI void APIENTRY emscripten_glVertexAttrib2fv (GLuint index, const GLfloat *v); +GLAPI void APIENTRY emscripten_glVertexAttrib2s (GLuint index, GLshort x, GLshort y); +GLAPI void APIENTRY emscripten_glVertexAttrib2sv (GLuint index, const GLshort *v); +GLAPI void APIENTRY emscripten_glVertexAttrib3d (GLuint index, GLdouble x, GLdouble y, GLdouble z); +GLAPI void APIENTRY emscripten_glVertexAttrib3dv (GLuint index, const GLdouble *v); +GLAPI void APIENTRY emscripten_glVertexAttrib3f (GLuint index, GLfloat x, GLfloat y, GLfloat z); +GLAPI void APIENTRY emscripten_glVertexAttrib3fv (GLuint index, const GLfloat *v); +GLAPI void APIENTRY emscripten_glVertexAttrib3s (GLuint index, GLshort x, GLshort y, GLshort z); +GLAPI void APIENTRY emscripten_glVertexAttrib3sv (GLuint index, const GLshort *v); +GLAPI void APIENTRY emscripten_glVertexAttrib4Nbv (GLuint index, const GLbyte *v); +GLAPI void APIENTRY emscripten_glVertexAttrib4Niv (GLuint index, const GLint *v); +GLAPI void APIENTRY emscripten_glVertexAttrib4Nsv (GLuint index, const GLshort *v); +GLAPI void APIENTRY emscripten_glVertexAttrib4Nub (GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w); +GLAPI void APIENTRY emscripten_glVertexAttrib4Nubv (GLuint index, const GLubyte *v); +GLAPI void APIENTRY emscripten_glVertexAttrib4Nuiv (GLuint index, const GLuint *v); +GLAPI void APIENTRY emscripten_glVertexAttrib4Nusv (GLuint index, const GLushort *v); +GLAPI void APIENTRY emscripten_glVertexAttrib4bv (GLuint index, const GLbyte *v); +GLAPI void APIENTRY emscripten_glVertexAttrib4d (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +GLAPI void APIENTRY emscripten_glVertexAttrib4dv (GLuint index, const GLdouble *v); +GLAPI void APIENTRY emscripten_glVertexAttrib4f (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +GLAPI void APIENTRY emscripten_glVertexAttrib4fv (GLuint index, const GLfloat *v); +GLAPI void APIENTRY emscripten_glVertexAttrib4iv (GLuint index, const GLint *v); +GLAPI void APIENTRY emscripten_glVertexAttrib4s (GLuint index, GLshort x, GLshort y, GLshort z, GLshort w); +GLAPI void APIENTRY emscripten_glVertexAttrib4sv (GLuint index, const GLshort *v); +GLAPI void APIENTRY emscripten_glVertexAttrib4ubv (GLuint index, const GLubyte *v); +GLAPI void APIENTRY emscripten_glVertexAttrib4uiv (GLuint index, const GLuint *v); +GLAPI void APIENTRY emscripten_glVertexAttrib4usv (GLuint index, const GLushort *v); +GLAPI void APIENTRY emscripten_glVertexAttribPointer (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *pointer); + + +GLAPI void APIENTRY emscripten_glUniformMatrix2x3fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI void APIENTRY emscripten_glUniformMatrix3x2fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI void APIENTRY emscripten_glUniformMatrix2x4fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI void APIENTRY emscripten_glUniformMatrix4x2fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI void APIENTRY emscripten_glUniformMatrix3x4fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI void APIENTRY emscripten_glUniformMatrix4x3fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); + + +GLAPI void APIENTRY emscripten_glColorMaski (GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a); +GLAPI void APIENTRY emscripten_glGetBooleani_v (GLenum target, GLuint index, GLboolean *data); +GLAPI void APIENTRY emscripten_glGetIntegeri_v (GLenum target, GLuint index, GLint *data); +GLAPI void APIENTRY emscripten_glEnablei (GLenum target, GLuint index); +GLAPI void APIENTRY emscripten_glDisablei (GLenum target, GLuint index); +GLAPI GLboolean APIENTRY emscripten_glIsEnabledi (GLenum target, GLuint index); +GLAPI void APIENTRY emscripten_glBeginTransformFeedback (GLenum primitiveMode); +GLAPI void APIENTRY emscripten_glEndTransformFeedback (void); +GLAPI void APIENTRY emscripten_glBindBufferRange (GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size); +GLAPI void APIENTRY emscripten_glBindBufferBase (GLenum target, GLuint index, GLuint buffer); +GLAPI void APIENTRY emscripten_glTransformFeedbackVaryings (GLuint program, GLsizei count, const GLchar* *varyings, GLenum bufferMode); +GLAPI void APIENTRY emscripten_glGetTransformFeedbackVarying (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name); +GLAPI void APIENTRY emscripten_glClampColor (GLenum target, GLenum clamp); +GLAPI void APIENTRY emscripten_glBeginConditionalRender (GLuint id, GLenum mode); +GLAPI void APIENTRY emscripten_glEndConditionalRender (void); +GLAPI void APIENTRY emscripten_glVertexAttribIPointer (GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); +GLAPI void APIENTRY emscripten_glGetVertexAttribIiv (GLuint index, GLenum pname, GLint *params); +GLAPI void APIENTRY emscripten_glGetVertexAttribIuiv (GLuint index, GLenum pname, GLuint *params); +GLAPI void APIENTRY emscripten_glVertexAttribI1i (GLuint index, GLint x); +GLAPI void APIENTRY emscripten_glVertexAttribI2i (GLuint index, GLint x, GLint y); +GLAPI void APIENTRY emscripten_glVertexAttribI3i (GLuint index, GLint x, GLint y, GLint z); +GLAPI void APIENTRY emscripten_glVertexAttribI4i (GLuint index, GLint x, GLint y, GLint z, GLint w); +GLAPI void APIENTRY emscripten_glVertexAttribI1ui (GLuint index, GLuint x); +GLAPI void APIENTRY emscripten_glVertexAttribI2ui (GLuint index, GLuint x, GLuint y); +GLAPI void APIENTRY emscripten_glVertexAttribI3ui (GLuint index, GLuint x, GLuint y, GLuint z); +GLAPI void APIENTRY emscripten_glVertexAttribI4ui (GLuint index, GLuint x, GLuint y, GLuint z, GLuint w); +GLAPI void APIENTRY emscripten_glVertexAttribI1iv (GLuint index, const GLint *v); +GLAPI void APIENTRY emscripten_glVertexAttribI2iv (GLuint index, const GLint *v); +GLAPI void APIENTRY emscripten_glVertexAttribI3iv (GLuint index, const GLint *v); +GLAPI void APIENTRY emscripten_glVertexAttribI4iv (GLuint index, const GLint *v); +GLAPI void APIENTRY emscripten_glVertexAttribI1uiv (GLuint index, const GLuint *v); +GLAPI void APIENTRY emscripten_glVertexAttribI2uiv (GLuint index, const GLuint *v); +GLAPI void APIENTRY emscripten_glVertexAttribI3uiv (GLuint index, const GLuint *v); +GLAPI void APIENTRY emscripten_glVertexAttribI4uiv (GLuint index, const GLuint *v); +GLAPI void APIENTRY emscripten_glVertexAttribI4bv (GLuint index, const GLbyte *v); +GLAPI void APIENTRY emscripten_glVertexAttribI4sv (GLuint index, const GLshort *v); +GLAPI void APIENTRY emscripten_glVertexAttribI4ubv (GLuint index, const GLubyte *v); +GLAPI void APIENTRY emscripten_glVertexAttribI4usv (GLuint index, const GLushort *v); +GLAPI void APIENTRY emscripten_glGetUniformuiv (GLuint program, GLint location, GLuint *params); +GLAPI void APIENTRY emscripten_glBindFragDataLocation (GLuint program, GLuint color, const GLchar *name); +GLAPI GLint APIENTRY emscripten_glGetFragDataLocation (GLuint program, const GLchar *name); +GLAPI void APIENTRY emscripten_glUniform1ui (GLint location, GLuint v0); +GLAPI void APIENTRY emscripten_glUniform2ui (GLint location, GLuint v0, GLuint v1); +GLAPI void APIENTRY emscripten_glUniform3ui (GLint location, GLuint v0, GLuint v1, GLuint v2); +GLAPI void APIENTRY emscripten_glUniform4ui (GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3); +GLAPI void APIENTRY emscripten_glUniform1uiv (GLint location, GLsizei count, const GLuint *value); +GLAPI void APIENTRY emscripten_glUniform2uiv (GLint location, GLsizei count, const GLuint *value); +GLAPI void APIENTRY emscripten_glUniform3uiv (GLint location, GLsizei count, const GLuint *value); +GLAPI void APIENTRY emscripten_glUniform4uiv (GLint location, GLsizei count, const GLuint *value); +GLAPI void APIENTRY emscripten_glTexParameterIiv (GLenum target, GLenum pname, const GLint *params); +GLAPI void APIENTRY emscripten_glTexParameterIuiv (GLenum target, GLenum pname, const GLuint *params); +GLAPI void APIENTRY emscripten_glGetTexParameterIiv (GLenum target, GLenum pname, GLint *params); +GLAPI void APIENTRY emscripten_glGetTexParameterIuiv (GLenum target, GLenum pname, GLuint *params); +GLAPI void APIENTRY emscripten_glClearBufferiv (GLenum buffer, GLint drawbuffer, const GLint *value); +GLAPI void APIENTRY emscripten_glClearBufferuiv (GLenum buffer, GLint drawbuffer, const GLuint *value); +GLAPI void APIENTRY emscripten_glClearBufferfv (GLenum buffer, GLint drawbuffer, const GLfloat *value); +GLAPI void APIENTRY emscripten_glClearBufferfi (GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil); + + +GLAPI void APIENTRY emscripten_glDrawArraysInstanced (GLenum mode, GLint first, GLsizei count, GLsizei primcount); +GLAPI void APIENTRY emscripten_glDrawElementsInstanced (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei primcount); +GLAPI void APIENTRY emscripten_glTexBuffer (GLenum target, GLenum internalformat, GLuint buffer); +GLAPI void APIENTRY emscripten_glPrimitiveRestartIndex (GLuint index); + + +GLAPI void APIENTRY emscripten_glActiveTextureARB (GLenum texture); +GLAPI void APIENTRY emscripten_glClientActiveTextureARB (GLenum texture); +GLAPI void APIENTRY emscripten_glMultiTexCoord1dARB (GLenum target, GLdouble s); +GLAPI void APIENTRY emscripten_glMultiTexCoord1dvARB (GLenum target, const GLdouble *v); +GLAPI void APIENTRY emscripten_glMultiTexCoord1fARB (GLenum target, GLfloat s); +GLAPI void APIENTRY emscripten_glMultiTexCoord1fvARB (GLenum target, const GLfloat *v); +GLAPI void APIENTRY emscripten_glMultiTexCoord1iARB (GLenum target, GLint s); +GLAPI void APIENTRY emscripten_glMultiTexCoord1ivARB (GLenum target, const GLint *v); +GLAPI void APIENTRY emscripten_glMultiTexCoord1sARB (GLenum target, GLshort s); +GLAPI void APIENTRY emscripten_glMultiTexCoord1svARB (GLenum target, const GLshort *v); +GLAPI void APIENTRY emscripten_glMultiTexCoord2dARB (GLenum target, GLdouble s, GLdouble t); +GLAPI void APIENTRY emscripten_glMultiTexCoord2dvARB (GLenum target, const GLdouble *v); +GLAPI void APIENTRY emscripten_glMultiTexCoord2fARB (GLenum target, GLfloat s, GLfloat t); +GLAPI void APIENTRY emscripten_glMultiTexCoord2fvARB (GLenum target, const GLfloat *v); +GLAPI void APIENTRY emscripten_glMultiTexCoord2iARB (GLenum target, GLint s, GLint t); +GLAPI void APIENTRY emscripten_glMultiTexCoord2ivARB (GLenum target, const GLint *v); +GLAPI void APIENTRY emscripten_glMultiTexCoord2sARB (GLenum target, GLshort s, GLshort t); +GLAPI void APIENTRY emscripten_glMultiTexCoord2svARB (GLenum target, const GLshort *v); +GLAPI void APIENTRY emscripten_glMultiTexCoord3dARB (GLenum target, GLdouble s, GLdouble t, GLdouble r); +GLAPI void APIENTRY emscripten_glMultiTexCoord3dvARB (GLenum target, const GLdouble *v); +GLAPI void APIENTRY emscripten_glMultiTexCoord3fARB (GLenum target, GLfloat s, GLfloat t, GLfloat r); +GLAPI void APIENTRY emscripten_glMultiTexCoord3fvARB (GLenum target, const GLfloat *v); +GLAPI void APIENTRY emscripten_glMultiTexCoord3iARB (GLenum target, GLint s, GLint t, GLint r); +GLAPI void APIENTRY emscripten_glMultiTexCoord3ivARB (GLenum target, const GLint *v); +GLAPI void APIENTRY emscripten_glMultiTexCoord3sARB (GLenum target, GLshort s, GLshort t, GLshort r); +GLAPI void APIENTRY emscripten_glMultiTexCoord3svARB (GLenum target, const GLshort *v); +GLAPI void APIENTRY emscripten_glMultiTexCoord4dARB (GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q); +GLAPI void APIENTRY emscripten_glMultiTexCoord4dvARB (GLenum target, const GLdouble *v); +GLAPI void APIENTRY emscripten_glMultiTexCoord4fARB (GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q); +GLAPI void APIENTRY emscripten_glMultiTexCoord4fvARB (GLenum target, const GLfloat *v); +GLAPI void APIENTRY emscripten_glMultiTexCoord4iARB (GLenum target, GLint s, GLint t, GLint r, GLint q); +GLAPI void APIENTRY emscripten_glMultiTexCoord4ivARB (GLenum target, const GLint *v); +GLAPI void APIENTRY emscripten_glMultiTexCoord4sARB (GLenum target, GLshort s, GLshort t, GLshort r, GLshort q); +GLAPI void APIENTRY emscripten_glMultiTexCoord4svARB (GLenum target, const GLshort *v); + + +GLAPI void APIENTRY emscripten_glLoadTransposeMatrixfARB (const GLfloat *m); +GLAPI void APIENTRY emscripten_glLoadTransposeMatrixdARB (const GLdouble *m); +GLAPI void APIENTRY emscripten_glMultTransposeMatrixfARB (const GLfloat *m); +GLAPI void APIENTRY emscripten_glMultTransposeMatrixdARB (const GLdouble *m); + + +GLAPI void APIENTRY emscripten_glCompressedTexImage3DARB (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data); +GLAPI void APIENTRY emscripten_glCompressedTexImage2DARB (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data); +GLAPI void APIENTRY emscripten_glCompressedTexImage1DARB (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data); +GLAPI void APIENTRY emscripten_glCompressedTexSubImage3DARB (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data); +GLAPI void APIENTRY emscripten_glCompressedTexSubImage2DARB (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data); +GLAPI void APIENTRY emscripten_glCompressedTexSubImage1DARB (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data); +GLAPI void APIENTRY emscripten_glGetCompressedTexImageARB (GLenum target, GLint level, GLvoid *img); + + +GLAPI void APIENTRY emscripten_glVertexAttrib1dARB (GLuint index, GLdouble x); +GLAPI void APIENTRY emscripten_glVertexAttrib1dvARB (GLuint index, const GLdouble *v); +GLAPI void APIENTRY emscripten_glVertexAttrib1fARB (GLuint index, GLfloat x); +GLAPI void APIENTRY emscripten_glVertexAttrib1fvARB (GLuint index, const GLfloat *v); +GLAPI void APIENTRY emscripten_glVertexAttrib1sARB (GLuint index, GLshort x); +GLAPI void APIENTRY emscripten_glVertexAttrib1svARB (GLuint index, const GLshort *v); +GLAPI void APIENTRY emscripten_glVertexAttrib2dARB (GLuint index, GLdouble x, GLdouble y); +GLAPI void APIENTRY emscripten_glVertexAttrib2dvARB (GLuint index, const GLdouble *v); +GLAPI void APIENTRY emscripten_glVertexAttrib2fARB (GLuint index, GLfloat x, GLfloat y); +GLAPI void APIENTRY emscripten_glVertexAttrib2fvARB (GLuint index, const GLfloat *v); +GLAPI void APIENTRY emscripten_glVertexAttrib2sARB (GLuint index, GLshort x, GLshort y); +GLAPI void APIENTRY emscripten_glVertexAttrib2svARB (GLuint index, const GLshort *v); +GLAPI void APIENTRY emscripten_glVertexAttrib3dARB (GLuint index, GLdouble x, GLdouble y, GLdouble z); +GLAPI void APIENTRY emscripten_glVertexAttrib3dvARB (GLuint index, const GLdouble *v); +GLAPI void APIENTRY emscripten_glVertexAttrib3fARB (GLuint index, GLfloat x, GLfloat y, GLfloat z); +GLAPI void APIENTRY emscripten_glVertexAttrib3fvARB (GLuint index, const GLfloat *v); +GLAPI void APIENTRY emscripten_glVertexAttrib3sARB (GLuint index, GLshort x, GLshort y, GLshort z); +GLAPI void APIENTRY emscripten_glVertexAttrib3svARB (GLuint index, const GLshort *v); +GLAPI void APIENTRY emscripten_glVertexAttrib4NbvARB (GLuint index, const GLbyte *v); +GLAPI void APIENTRY emscripten_glVertexAttrib4NivARB (GLuint index, const GLint *v); +GLAPI void APIENTRY emscripten_glVertexAttrib4NsvARB (GLuint index, const GLshort *v); +GLAPI void APIENTRY emscripten_glVertexAttrib4NubARB (GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w); +GLAPI void APIENTRY emscripten_glVertexAttrib4NubvARB (GLuint index, const GLubyte *v); +GLAPI void APIENTRY emscripten_glVertexAttrib4NuivARB (GLuint index, const GLuint *v); +GLAPI void APIENTRY emscripten_glVertexAttrib4NusvARB (GLuint index, const GLushort *v); +GLAPI void APIENTRY emscripten_glVertexAttrib4bvARB (GLuint index, const GLbyte *v); +GLAPI void APIENTRY emscripten_glVertexAttrib4dARB (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +GLAPI void APIENTRY emscripten_glVertexAttrib4dvARB (GLuint index, const GLdouble *v); +GLAPI void APIENTRY emscripten_glVertexAttrib4fARB (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +GLAPI void APIENTRY emscripten_glVertexAttrib4fvARB (GLuint index, const GLfloat *v); +GLAPI void APIENTRY emscripten_glVertexAttrib4ivARB (GLuint index, const GLint *v); +GLAPI void APIENTRY emscripten_glVertexAttrib4sARB (GLuint index, GLshort x, GLshort y, GLshort z, GLshort w); +GLAPI void APIENTRY emscripten_glVertexAttrib4svARB (GLuint index, const GLshort *v); +GLAPI void APIENTRY emscripten_glVertexAttrib4ubvARB (GLuint index, const GLubyte *v); +GLAPI void APIENTRY emscripten_glVertexAttrib4uivARB (GLuint index, const GLuint *v); +GLAPI void APIENTRY emscripten_glVertexAttrib4usvARB (GLuint index, const GLushort *v); +GLAPI void APIENTRY emscripten_glVertexAttribPointerARB (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *pointer); +GLAPI void APIENTRY emscripten_glEnableVertexAttribArrayARB (GLuint index); +GLAPI void APIENTRY emscripten_glDisableVertexAttribArrayARB (GLuint index); +GLAPI void APIENTRY emscripten_glProgramStringARB (GLenum target, GLenum format, GLsizei len, const GLvoid *string); +GLAPI void APIENTRY emscripten_glBindProgramARB (GLenum target, GLuint program); +GLAPI void APIENTRY emscripten_glDeleteProgramsARB (GLsizei n, const GLuint *programs); +GLAPI void APIENTRY emscripten_glGenProgramsARB (GLsizei n, GLuint *programs); +GLAPI void APIENTRY emscripten_glProgramEnvParameter4dARB (GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +GLAPI void APIENTRY emscripten_glProgramEnvParameter4dvARB (GLenum target, GLuint index, const GLdouble *params); +GLAPI void APIENTRY emscripten_glProgramEnvParameter4fARB (GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +GLAPI void APIENTRY emscripten_glProgramEnvParameter4fvARB (GLenum target, GLuint index, const GLfloat *params); +GLAPI void APIENTRY emscripten_glProgramLocalParameter4dARB (GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +GLAPI void APIENTRY emscripten_glProgramLocalParameter4dvARB (GLenum target, GLuint index, const GLdouble *params); +GLAPI void APIENTRY emscripten_glProgramLocalParameter4fARB (GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +GLAPI void APIENTRY emscripten_glProgramLocalParameter4fvARB (GLenum target, GLuint index, const GLfloat *params); +GLAPI void APIENTRY emscripten_glGetProgramEnvParameterdvARB (GLenum target, GLuint index, GLdouble *params); +GLAPI void APIENTRY emscripten_glGetProgramEnvParameterfvARB (GLenum target, GLuint index, GLfloat *params); +GLAPI void APIENTRY emscripten_glGetProgramLocalParameterdvARB (GLenum target, GLuint index, GLdouble *params); +GLAPI void APIENTRY emscripten_glGetProgramLocalParameterfvARB (GLenum target, GLuint index, GLfloat *params); +GLAPI void APIENTRY emscripten_glGetProgramivARB (GLenum target, GLenum pname, GLint *params); +GLAPI void APIENTRY emscripten_glGetProgramStringARB (GLenum target, GLenum pname, GLvoid *string); +GLAPI void APIENTRY emscripten_glGetVertexAttribdvARB (GLuint index, GLenum pname, GLdouble *params); +GLAPI void APIENTRY emscripten_glGetVertexAttribfvARB (GLuint index, GLenum pname, GLfloat *params); +GLAPI void APIENTRY emscripten_glGetVertexAttribivARB (GLuint index, GLenum pname, GLint *params); +GLAPI void APIENTRY emscripten_glGetVertexAttribPointervARB (GLuint index, GLenum pname, GLvoid* *pointer); +GLAPI GLboolean APIENTRY emscripten_glIsProgramARB (GLuint program); + + +GLAPI void APIENTRY emscripten_glBindBufferARB (GLenum target, GLuint buffer); +GLAPI void APIENTRY emscripten_glDeleteBuffersARB (GLsizei n, const GLuint *buffers); +GLAPI void APIENTRY emscripten_glGenBuffersARB (GLsizei n, GLuint *buffers); +GLAPI GLboolean APIENTRY emscripten_glIsBufferARB (GLuint buffer); +GLAPI void APIENTRY emscripten_glBufferDataARB (GLenum target, GLsizeiptrARB size, const GLvoid *data, GLenum usage); +GLAPI void APIENTRY emscripten_glBufferSubDataARB (GLenum target, GLintptrARB offset, GLsizeiptrARB size, const GLvoid *data); +GLAPI void APIENTRY emscripten_glGetBufferSubDataARB (GLenum target, GLintptrARB offset, GLsizeiptrARB size, GLvoid *data); +GLAPI GLvoid* APIENTRY emscripten_glMapBufferARB (GLenum target, GLenum access); +GLAPI GLboolean APIENTRY emscripten_glUnmapBufferARB (GLenum target); +GLAPI void APIENTRY emscripten_glGetBufferParameterivARB (GLenum target, GLenum pname, GLint *params); +GLAPI void APIENTRY emscripten_glGetBufferPointervARB (GLenum target, GLenum pname, GLvoid* *params); + + +GLAPI void APIENTRY emscripten_glGenQueriesARB (GLsizei n, GLuint *ids); +GLAPI void APIENTRY emscripten_glDeleteQueriesARB (GLsizei n, const GLuint *ids); +GLAPI GLboolean APIENTRY emscripten_glIsQueryARB (GLuint id); +GLAPI void APIENTRY emscripten_glBeginQueryARB (GLenum target, GLuint id); +GLAPI void APIENTRY emscripten_glEndQueryARB (GLenum target); +GLAPI void APIENTRY emscripten_glGetQueryivARB (GLenum target, GLenum pname, GLint *params); +GLAPI void APIENTRY emscripten_glGetQueryObjectivARB (GLuint id, GLenum pname, GLint *params); +GLAPI void APIENTRY emscripten_glGetQueryObjectuivARB (GLuint id, GLenum pname, GLuint *params); + + +GLAPI void APIENTRY emscripten_glDeleteObjectARB (GLhandleARB obj); +GLAPI GLhandleARB APIENTRY emscripten_glGetHandleARB (GLenum pname); +GLAPI void APIENTRY emscripten_glDetachObjectARB (GLhandleARB containerObj, GLhandleARB attachedObj); +GLAPI GLhandleARB APIENTRY emscripten_glCreateShaderObjectARB (GLenum shaderType); +GLAPI void APIENTRY emscripten_glShaderSourceARB (GLhandleARB shaderObj, GLsizei count, const GLcharARB* *string, const GLint *length); +GLAPI void APIENTRY emscripten_glCompileShaderARB (GLhandleARB shaderObj); +GLAPI GLhandleARB APIENTRY emscripten_glCreateProgramObjectARB (void); +GLAPI void APIENTRY emscripten_glAttachObjectARB (GLhandleARB containerObj, GLhandleARB obj); +GLAPI void APIENTRY emscripten_glLinkProgramARB (GLhandleARB programObj); +GLAPI void APIENTRY emscripten_glUseProgramObjectARB (GLhandleARB programObj); +GLAPI void APIENTRY emscripten_glValidateProgramARB (GLhandleARB programObj); +GLAPI void APIENTRY emscripten_glUniform1fARB (GLint location, GLfloat v0); +GLAPI void APIENTRY emscripten_glUniform2fARB (GLint location, GLfloat v0, GLfloat v1); +GLAPI void APIENTRY emscripten_glUniform3fARB (GLint location, GLfloat v0, GLfloat v1, GLfloat v2); +GLAPI void APIENTRY emscripten_glUniform4fARB (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); +GLAPI void APIENTRY emscripten_glUniform1iARB (GLint location, GLint v0); +GLAPI void APIENTRY emscripten_glUniform2iARB (GLint location, GLint v0, GLint v1); +GLAPI void APIENTRY emscripten_glUniform3iARB (GLint location, GLint v0, GLint v1, GLint v2); +GLAPI void APIENTRY emscripten_glUniform4iARB (GLint location, GLint v0, GLint v1, GLint v2, GLint v3); +GLAPI void APIENTRY emscripten_glUniform1fvARB (GLint location, GLsizei count, const GLfloat *value); +GLAPI void APIENTRY emscripten_glUniform2fvARB (GLint location, GLsizei count, const GLfloat *value); +GLAPI void APIENTRY emscripten_glUniform3fvARB (GLint location, GLsizei count, const GLfloat *value); +GLAPI void APIENTRY emscripten_glUniform4fvARB (GLint location, GLsizei count, const GLfloat *value); +GLAPI void APIENTRY emscripten_glUniform1ivARB (GLint location, GLsizei count, const GLint *value); +GLAPI void APIENTRY emscripten_glUniform2ivARB (GLint location, GLsizei count, const GLint *value); +GLAPI void APIENTRY emscripten_glUniform3ivARB (GLint location, GLsizei count, const GLint *value); +GLAPI void APIENTRY emscripten_glUniform4ivARB (GLint location, GLsizei count, const GLint *value); +GLAPI void APIENTRY emscripten_glUniformMatrix2fvARB (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI void APIENTRY emscripten_glUniformMatrix3fvARB (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI void APIENTRY emscripten_glUniformMatrix4fvARB (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI void APIENTRY emscripten_glGetObjectParameterfvARB (GLhandleARB obj, GLenum pname, GLfloat *params); +GLAPI void APIENTRY emscripten_glGetObjectParameterivARB (GLhandleARB obj, GLenum pname, GLint *params); +GLAPI void APIENTRY emscripten_glGetInfoLogARB (GLhandleARB obj, GLsizei maxLength, GLsizei *length, GLcharARB *infoLog); +GLAPI void APIENTRY emscripten_glGetAttachedObjectsARB (GLhandleARB containerObj, GLsizei maxCount, GLsizei *count, GLhandleARB *obj); +GLAPI GLint APIENTRY emscripten_glGetUniformLocationARB (GLhandleARB programObj, const GLcharARB *name); +GLAPI void APIENTRY emscripten_glGetActiveUniformARB (GLhandleARB programObj, GLuint index, GLsizei maxLength, GLsizei *length, GLint *size, GLenum *type, GLcharARB *name); +GLAPI void APIENTRY emscripten_glGetUniformfvARB (GLhandleARB programObj, GLint location, GLfloat *params); +GLAPI void APIENTRY emscripten_glGetUniformivARB (GLhandleARB programObj, GLint location, GLint *params); +GLAPI void APIENTRY emscripten_glGetShaderSourceARB (GLhandleARB obj, GLsizei maxLength, GLsizei *length, GLcharARB *source); + + +GLAPI void APIENTRY emscripten_glBindAttribLocationARB (GLhandleARB programObj, GLuint index, const GLcharARB *name); +GLAPI void APIENTRY emscripten_glGetActiveAttribARB (GLhandleARB programObj, GLuint index, GLsizei maxLength, GLsizei *length, GLint *size, GLenum *type, GLcharARB *name); +GLAPI GLint APIENTRY emscripten_glGetAttribLocationARB (GLhandleARB programObj, const GLcharARB *name); + + +GLAPI void APIENTRY emscripten_glDrawArraysInstancedARB (GLenum mode, GLint first, GLsizei count, GLsizei primcount); +GLAPI void APIENTRY emscripten_glDrawElementsInstancedARB (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei primcount); + + +GLAPI GLboolean APIENTRY emscripten_glIsRenderbuffer (GLuint renderbuffer); +GLAPI void APIENTRY emscripten_glBindRenderbuffer (GLenum target, GLuint renderbuffer); +GLAPI void APIENTRY emscripten_glDeleteRenderbuffers (GLsizei n, const GLuint *renderbuffers); +GLAPI void APIENTRY emscripten_glGenRenderbuffers (GLsizei n, GLuint *renderbuffers); +GLAPI void APIENTRY emscripten_glRenderbufferStorage (GLenum target, GLenum internalformat, GLsizei width, GLsizei height); +GLAPI void APIENTRY emscripten_glGetRenderbufferParameteriv (GLenum target, GLenum pname, GLint *params); +GLAPI GLboolean APIENTRY emscripten_glIsFramebuffer (GLuint framebuffer); +GLAPI void APIENTRY emscripten_glBindFramebuffer (GLenum target, GLuint framebuffer); +GLAPI void APIENTRY emscripten_glDeleteFramebuffers (GLsizei n, const GLuint *framebuffers); +GLAPI void APIENTRY emscripten_glGenFramebuffers (GLsizei n, GLuint *framebuffers); +GLAPI GLenum APIENTRY emscripten_glCheckFramebufferStatus (GLenum target); +GLAPI void APIENTRY emscripten_glFramebufferTexture1D (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); +GLAPI void APIENTRY emscripten_glFramebufferTexture2D (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); +GLAPI void APIENTRY emscripten_glFramebufferTexture3D (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset); +GLAPI void APIENTRY emscripten_glFramebufferRenderbuffer (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); +GLAPI void APIENTRY emscripten_glGetFramebufferAttachmentParameteriv (GLenum target, GLenum attachment, GLenum pname, GLint *params); +GLAPI void APIENTRY emscripten_glGenerateMipmap (GLenum target); +GLAPI void APIENTRY emscripten_glBlitFramebuffer (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); +GLAPI void APIENTRY emscripten_glRenderbufferStorageMultisample (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); +GLAPI void APIENTRY emscripten_glFramebufferTextureLayer (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer); + + +GLAPI void APIENTRY emscripten_glBindVertexArray (GLuint array); +GLAPI void APIENTRY emscripten_glDeleteVertexArrays (GLsizei n, const GLuint *arrays); +GLAPI void APIENTRY emscripten_glGenVertexArrays (GLsizei n, GLuint *arrays); +GLAPI GLboolean APIENTRY emscripten_glIsVertexArray (GLuint array); + + +GLAPI void APIENTRY emscripten_glGetUniformIndices (GLuint program, GLsizei uniformCount, const GLchar* *uniformNames, GLuint *uniformIndices); +GLAPI void APIENTRY emscripten_glGetActiveUniformsiv (GLuint program, GLsizei uniformCount, const GLuint *uniformIndices, GLenum pname, GLint *params); +GLAPI void APIENTRY emscripten_glGetActiveUniformName (GLuint program, GLuint uniformIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformName); +GLAPI GLuint APIENTRY emscripten_glGetUniformBlockIndex (GLuint program, const GLchar *uniformBlockName); +GLAPI void APIENTRY emscripten_glGetActiveUniformBlockiv (GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint *params); +GLAPI void APIENTRY emscripten_glGetActiveUniformBlockName (GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformBlockName); +GLAPI void APIENTRY emscripten_glUniformBlockBinding (GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding); + + +GLAPI void APIENTRY emscripten_glReleaseShaderCompiler (void); +GLAPI void APIENTRY emscripten_glShaderBinary (GLsizei count, const GLuint *shaders, GLenum binaryformat, const GLvoid *binary, GLsizei length); +GLAPI void APIENTRY emscripten_glGetShaderPrecisionFormat (GLenum shadertype, GLenum precisiontype, GLint *range, GLint *precision); +GLAPI void APIENTRY emscripten_glDepthRangef (GLclampf n, GLclampf f); +GLAPI void APIENTRY emscripten_glClearDepthf (GLclampf d); + + +GLAPI void APIENTRY emscripten_glVertexAttribDivisor (GLuint index, GLuint divisor); + + +void* emscripten_GetProcAddress(const char *name_) { + char *name = malloc(strlen(name_)+1); + strcpy(name, name_); + // remove EXT|ARB suffixes + char *end = strstr(name, "EXT"); + if (end) *end = 0; + end = strstr(name, "ARB"); + if (end) *end = 0; + // misc renamings + if (!strcmp(name, "glCreateProgramObject")) name = "glCreateProgram"; + else if (!strcmp(name, "glUseProgramObject")) name = "glUseProgram"; + else if (!strcmp(name, "glCreateShaderObject")) name = "glCreateShader"; + else if (!strcmp(name, "glAttachObject")) name = "glAttachShader"; + else if (!strcmp(name, "glDetachObject")) name = "glDetachShader"; + // main list + if (!strcmp(name, "glPixelStorei")) return emscripten_glPixelStorei; + else if (!strcmp(name, "glGetString")) return emscripten_glGetString; + else if (!strcmp(name, "glGetIntegerv")) return emscripten_glGetIntegerv; + else if (!strcmp(name, "glGetFloatv")) return emscripten_glGetFloatv; + else if (!strcmp(name, "glGetBooleanv")) return emscripten_glGetBooleanv; + else if (!strcmp(name, "glGenTextures")) return emscripten_glGenTextures; + else if (!strcmp(name, "glDeleteTextures")) return emscripten_glDeleteTextures; + else if (!strcmp(name, "glCompressedTexImage2D")) return emscripten_glCompressedTexImage2D; + else if (!strcmp(name, "glCompressedTexSubImage2D")) return emscripten_glCompressedTexSubImage2D; + else if (!strcmp(name, "glTexImage2D")) return emscripten_glTexImage2D; + else if (!strcmp(name, "glTexSubImage2D")) return emscripten_glTexSubImage2D; + else if (!strcmp(name, "glReadPixels")) return emscripten_glReadPixels; + else if (!strcmp(name, "glBindTexture")) return emscripten_glBindTexture; + else if (!strcmp(name, "glGetTexParameterfv")) return emscripten_glGetTexParameterfv; + else if (!strcmp(name, "glGetTexParameteriv")) return emscripten_glGetTexParameteriv; + else if (!strcmp(name, "glTexParameterfv")) return emscripten_glTexParameterfv; + else if (!strcmp(name, "glTexParameteriv")) return emscripten_glTexParameteriv; + else if (!strcmp(name, "glIsTexture")) return emscripten_glIsTexture; + else if (!strcmp(name, "glGenBuffers")) return emscripten_glGenBuffers; + else if (!strcmp(name, "glDeleteBuffers")) return emscripten_glDeleteBuffers; + else if (!strcmp(name, "glGetBufferParameteriv")) return emscripten_glGetBufferParameteriv; + else if (!strcmp(name, "glBufferData")) return emscripten_glBufferData; + else if (!strcmp(name, "glBufferSubData")) return emscripten_glBufferSubData; + else if (!strcmp(name, "glIsBuffer")) return emscripten_glIsBuffer; + else if (!strcmp(name, "glGenRenderbuffers")) return emscripten_glGenRenderbuffers; + else if (!strcmp(name, "glDeleteRenderbuffers")) return emscripten_glDeleteRenderbuffers; + else if (!strcmp(name, "glBindRenderbuffer")) return emscripten_glBindRenderbuffer; + else if (!strcmp(name, "glGetRenderbufferParameteriv")) return emscripten_glGetRenderbufferParameteriv; + else if (!strcmp(name, "glIsRenderbuffer")) return emscripten_glIsRenderbuffer; + else if (!strcmp(name, "glGetUniformfv")) return emscripten_glGetUniformfv; + else if (!strcmp(name, "glGetUniformiv")) return emscripten_glGetUniformiv; + else if (!strcmp(name, "glGetUniformLocation")) return emscripten_glGetUniformLocation; + else if (!strcmp(name, "glGetVertexAttribfv")) return emscripten_glGetVertexAttribfv; + else if (!strcmp(name, "glGetVertexAttribiv")) return emscripten_glGetVertexAttribiv; + else if (!strcmp(name, "glGetVertexAttribPointerv")) return emscripten_glGetVertexAttribPointerv; + else if (!strcmp(name, "glGetActiveUniform")) return emscripten_glGetActiveUniform; + else if (!strcmp(name, "glUniform1f")) return emscripten_glUniform1f; + else if (!strcmp(name, "glUniform2f")) return emscripten_glUniform2f; + else if (!strcmp(name, "glUniform3f")) return emscripten_glUniform3f; + else if (!strcmp(name, "glUniform4f")) return emscripten_glUniform4f; + else if (!strcmp(name, "glUniform1i")) return emscripten_glUniform1i; + else if (!strcmp(name, "glUniform2i")) return emscripten_glUniform2i; + else if (!strcmp(name, "glUniform3i")) return emscripten_glUniform3i; + else if (!strcmp(name, "glUniform4i")) return emscripten_glUniform4i; + else if (!strcmp(name, "glUniform1iv")) return emscripten_glUniform1iv; + else if (!strcmp(name, "glUniform2iv")) return emscripten_glUniform2iv; + else if (!strcmp(name, "glUniform3iv")) return emscripten_glUniform3iv; + else if (!strcmp(name, "glUniform4iv")) return emscripten_glUniform4iv; + else if (!strcmp(name, "glUniform1fv")) return emscripten_glUniform1fv; + else if (!strcmp(name, "glUniform2fv")) return emscripten_glUniform2fv; + else if (!strcmp(name, "glUniform3fv")) return emscripten_glUniform3fv; + else if (!strcmp(name, "glUniform4fv")) return emscripten_glUniform4fv; + else if (!strcmp(name, "glUniformMatrix2fv")) return emscripten_glUniformMatrix2fv; + else if (!strcmp(name, "glUniformMatrix3fv")) return emscripten_glUniformMatrix3fv; + else if (!strcmp(name, "glUniformMatrix4fv")) return emscripten_glUniformMatrix4fv; + else if (!strcmp(name, "glBindBuffer")) return emscripten_glBindBuffer; + else if (!strcmp(name, "glVertexAttrib1fv")) return emscripten_glVertexAttrib1fv; + else if (!strcmp(name, "glVertexAttrib2fv")) return emscripten_glVertexAttrib2fv; + else if (!strcmp(name, "glVertexAttrib3fv")) return emscripten_glVertexAttrib3fv; + else if (!strcmp(name, "glVertexAttrib4fv")) return emscripten_glVertexAttrib4fv; + else if (!strcmp(name, "glGetAttribLocation")) return emscripten_glGetAttribLocation; + else if (!strcmp(name, "glGetActiveAttrib")) return emscripten_glGetActiveAttrib; + else if (!strcmp(name, "glCreateShader")) return emscripten_glCreateShader; + else if (!strcmp(name, "glDeleteShader")) return emscripten_glDeleteShader; + else if (!strcmp(name, "glGetAttachedShaders")) return emscripten_glGetAttachedShaders; + else if (!strcmp(name, "glShaderSource")) return emscripten_glShaderSource; + else if (!strcmp(name, "glGetShaderSource")) return emscripten_glGetShaderSource; + else if (!strcmp(name, "glCompileShader")) return emscripten_glCompileShader; + else if (!strcmp(name, "glGetShaderInfoLog")) return emscripten_glGetShaderInfoLog; + else if (!strcmp(name, "glGetShaderiv")) return emscripten_glGetShaderiv; + else if (!strcmp(name, "glGetProgramiv")) return emscripten_glGetProgramiv; + else if (!strcmp(name, "glIsShader")) return emscripten_glIsShader; + else if (!strcmp(name, "glCreateProgram")) return emscripten_glCreateProgram; + else if (!strcmp(name, "glDeleteProgram")) return emscripten_glDeleteProgram; + else if (!strcmp(name, "glAttachShader")) return emscripten_glAttachShader; + else if (!strcmp(name, "glDetachShader")) return emscripten_glDetachShader; + else if (!strcmp(name, "glGetShaderPrecisionFormat")) return emscripten_glGetShaderPrecisionFormat; + else if (!strcmp(name, "glLinkProgram")) return emscripten_glLinkProgram; + else if (!strcmp(name, "glGetProgramInfoLog")) return emscripten_glGetProgramInfoLog; + else if (!strcmp(name, "glUseProgram")) return emscripten_glUseProgram; + else if (!strcmp(name, "glValidateProgram")) return emscripten_glValidateProgram; + else if (!strcmp(name, "glIsProgram")) return emscripten_glIsProgram; + else if (!strcmp(name, "glBindAttribLocation")) return emscripten_glBindAttribLocation; + else if (!strcmp(name, "glBindFramebuffer")) return emscripten_glBindFramebuffer; + else if (!strcmp(name, "glGenFramebuffers")) return emscripten_glGenFramebuffers; + else if (!strcmp(name, "glDeleteFramebuffers")) return emscripten_glDeleteFramebuffers; + else if (!strcmp(name, "glFramebufferRenderbuffer")) return emscripten_glFramebufferRenderbuffer; + else if (!strcmp(name, "glFramebufferTexture2D")) return emscripten_glFramebufferTexture2D; + else if (!strcmp(name, "glGetFramebufferAttachmentParameteriv")) return emscripten_glGetFramebufferAttachmentParameteriv; + else if (!strcmp(name, "glIsFramebuffer")) return emscripten_glIsFramebuffer; + else if (!strcmp(name, "glDeleteObject")) return emscripten_glDeleteObjectARB; + else if (!strcmp(name, "glGetObjectParameteriv")) return emscripten_glGetObjectParameterivARB; + else if (!strcmp(name, "glGetInfoLog")) return emscripten_glGetInfoLogARB; + else if (!strcmp(name, "glBindProgram")) return emscripten_glBindProgramARB; + else if (!strcmp(name, "glGetPointerv")) return emscripten_glGetPointerv; + else if (!strcmp(name, "glDrawRangeElements")) return emscripten_glDrawRangeElements; + else if (!strcmp(name, "glEnableClientState")) return emscripten_glEnableClientState; + else if (!strcmp(name, "glVertexPointer")) return emscripten_glVertexPointer; + else if (!strcmp(name, "glTexCoordPointer")) return emscripten_glTexCoordPointer; + else if (!strcmp(name, "glNormalPointer")) return emscripten_glNormalPointer; + else if (!strcmp(name, "glColorPointer")) return emscripten_glColorPointer; + else if (!strcmp(name, "glClientActiveTexture")) return emscripten_glClientActiveTexture; + else if (!strcmp(name, "glGenVertexArrays")) return emscripten_glGenVertexArrays; + else if (!strcmp(name, "glDeleteVertexArrays")) return emscripten_glDeleteVertexArrays; + else if (!strcmp(name, "glBindVertexArray")) return emscripten_glBindVertexArray; + else if (!strcmp(name, "glMatrixMode")) return emscripten_glMatrixMode; + else if (!strcmp(name, "glLoadIdentity")) return emscripten_glLoadIdentity; + else if (!strcmp(name, "glLoadMatrixf")) return emscripten_glLoadMatrixf; + else if (!strcmp(name, "glFrustum")) return emscripten_glFrustum; + else if (!strcmp(name, "glRotatef")) return emscripten_glRotatef; + else if (!strcmp(name, "glVertexAttribPointer")) return emscripten_glVertexAttribPointer; + else if (!strcmp(name, "glEnableVertexAttribArray")) return emscripten_glEnableVertexAttribArray; + else if (!strcmp(name, "glDisableVertexAttribArray")) return emscripten_glDisableVertexAttribArray; + else if (!strcmp(name, "glDrawArrays")) return emscripten_glDrawArrays; + else if (!strcmp(name, "glDrawElements")) return emscripten_glDrawElements; + else if (!strcmp(name, "glShaderBinary")) return emscripten_glShaderBinary; + else if (!strcmp(name, "glReleaseShaderCompiler")) return emscripten_glReleaseShaderCompiler; + else if (!strcmp(name, "glGetError")) return emscripten_glGetError; + else if (!strcmp(name, "glVertexAttribDivisor")) return emscripten_glVertexAttribDivisor; + else if (!strcmp(name, "glDrawArraysInstanced")) return emscripten_glDrawArraysInstanced; + else if (!strcmp(name, "glDrawElementsInstanced")) return emscripten_glDrawElementsInstanced; + else if (!strcmp(name, "glFinish")) return emscripten_glFinish; + else if (!strcmp(name, "glFlush")) return emscripten_glFlush; + else if (!strcmp(name, "glClearDepth")) return emscripten_glClearDepth; + else if (!strcmp(name, "glClearDepthf")) return emscripten_glClearDepthf; + else if (!strcmp(name, "glDepthFunc")) return emscripten_glDepthFunc; + else if (!strcmp(name, "glEnable")) return emscripten_glEnable; + else if (!strcmp(name, "glDisable")) return emscripten_glDisable; + else if (!strcmp(name, "glFrontFace")) return emscripten_glFrontFace; + else if (!strcmp(name, "glCullFace")) return emscripten_glCullFace; + else if (!strcmp(name, "glClear")) return emscripten_glClear; + else if (!strcmp(name, "glLineWidth")) return emscripten_glLineWidth; + else if (!strcmp(name, "glClearStencil")) return emscripten_glClearStencil; + else if (!strcmp(name, "glDepthMask")) return emscripten_glDepthMask; + else if (!strcmp(name, "glStencilMask")) return emscripten_glStencilMask; + else if (!strcmp(name, "glCheckFramebufferStatus")) return emscripten_glCheckFramebufferStatus; + else if (!strcmp(name, "glGenerateMipmap")) return emscripten_glGenerateMipmap; + else if (!strcmp(name, "glActiveTexture")) return emscripten_glActiveTexture; + else if (!strcmp(name, "glBlendEquation")) return emscripten_glBlendEquation; + else if (!strcmp(name, "glIsEnabled")) return emscripten_glIsEnabled; + else if (!strcmp(name, "glBlendFunc")) return emscripten_glBlendFunc; + else if (!strcmp(name, "glBlendEquationSeparate")) return emscripten_glBlendEquationSeparate; + else if (!strcmp(name, "glDepthRange")) return emscripten_glDepthRange; + else if (!strcmp(name, "glDepthRangef")) return emscripten_glDepthRangef; + else if (!strcmp(name, "glStencilMaskSeparate")) return emscripten_glStencilMaskSeparate; + else if (!strcmp(name, "glHint")) return emscripten_glHint; + else if (!strcmp(name, "glPolygonOffset")) return emscripten_glPolygonOffset; + else if (!strcmp(name, "glVertexAttrib1f")) return emscripten_glVertexAttrib1f; + else if (!strcmp(name, "glSampleCoverage")) return emscripten_glSampleCoverage; + else if (!strcmp(name, "glTexParameteri")) return emscripten_glTexParameteri; + else if (!strcmp(name, "glTexParameterf")) return emscripten_glTexParameterf; + else if (!strcmp(name, "glVertexAttrib2f")) return emscripten_glVertexAttrib2f; + else if (!strcmp(name, "glStencilFunc")) return emscripten_glStencilFunc; + else if (!strcmp(name, "glStencilOp")) return emscripten_glStencilOp; + else if (!strcmp(name, "glViewport")) return emscripten_glViewport; + else if (!strcmp(name, "glClearColor")) return emscripten_glClearColor; + else if (!strcmp(name, "glScissor")) return emscripten_glScissor; + else if (!strcmp(name, "glVertexAttrib3f")) return emscripten_glVertexAttrib3f; + else if (!strcmp(name, "glColorMask")) return emscripten_glColorMask; + else if (!strcmp(name, "glRenderbufferStorage")) return emscripten_glRenderbufferStorage; + else if (!strcmp(name, "glBlendFuncSeparate")) return emscripten_glBlendFuncSeparate; + else if (!strcmp(name, "glBlendColor")) return emscripten_glBlendColor; + else if (!strcmp(name, "glStencilFuncSeparate")) return emscripten_glStencilFuncSeparate; + else if (!strcmp(name, "glStencilOpSeparate")) return emscripten_glStencilOpSeparate; + else if (!strcmp(name, "glVertexAttrib4f")) return emscripten_glVertexAttrib4f; + else if (!strcmp(name, "glCopyTexImage2D")) return emscripten_glCopyTexImage2D; + else if (!strcmp(name, "glCopyTexSubImage2D")) return emscripten_glCopyTexSubImage2D; + + fprintf(stderr, "bad name in getProcAddress: %s | %s\n", name_, name); + return 0; +} + diff --git a/system/lib/gl.symbols b/system/lib/gl.symbols new file mode 100644 index 00000000..8ba8d6f7 --- /dev/null +++ b/system/lib/gl.symbols @@ -0,0 +1 @@ + T emscripten_GetProcAddress diff --git a/system/lib/sdl.cpp b/system/lib/sdl.cpp deleted file mode 100644 index 7038cdb1..00000000 --- a/system/lib/sdl.cpp +++ /dev/null @@ -1,13 +0,0 @@ - -#include <stdlib.h> - -// force malloc&free to be included in from libc -struct Force { - Force() { - void *x = malloc(10); - free(x); - } -}; - -static Force f; - diff --git a/system/lib/sdl.symbols b/system/lib/sdl.symbols deleted file mode 100644 index c2c0af42..00000000 --- a/system/lib/sdl.symbols +++ /dev/null @@ -1 +0,0 @@ - W SDL_Init diff --git a/tests/cubegeom_proc.c b/tests/cubegeom_proc.c new file mode 100644 index 00000000..e80b9b31 --- /dev/null +++ b/tests/cubegeom_proc.c @@ -0,0 +1,331 @@ +/* +THIS WORK, INCLUDING THE SOURCE CODE, DOCUMENTATION +AND RELATED MEDIA AND DATA, IS PLACED INTO THE PUBLIC DOMAIN. + +THE ORIGINAL AUTHOR IS KYLE FOLEY. + +THIS SOFTWARE IS PROVIDED AS-IS WITHOUT WARRANTY +OF ANY KIND, NOT EVEN THE IMPLIED WARRANTY OF +MERCHANTABILITY. THE AUTHOR OF THIS SOFTWARE, +ASSUMES _NO_ RESPONSIBILITY FOR ANY CONSEQUENCE +RESULTING FROM THE USE, MODIFICATION, OR +REDISTRIBUTION OF THIS SOFTWARE. +*/ + +#if !EMSCRIPTEN +#define USE_GLEW 1 +#endif + +#if USE_GLEW +#include "GL/glew.h" +#endif + +#include "SDL/SDL.h" +#if !USE_GLEW +#include "SDL/SDL_opengl.h" +#endif + +#include <stdio.h> +#include <string.h> +#include <assert.h> + +extern void *getBindBuffer(); + +void (*_glBindBuffer)(unsigned, unsigned) = NULL; + +int main(int argc, char *argv[]) +{ + _glBindBuffer = (void (*)(unsigned, unsigned))getBindBuffer(); + // testing + GLint tempInt; + GLboolean tempBool; + void *tempPtr; + + SDL_Surface *screen; + if ( SDL_Init(SDL_INIT_VIDEO) != 0 ) { + printf("Unable to initialize SDL: %s\n", SDL_GetError()); + return 1; + } + + SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 ); + screen = SDL_SetVideoMode( 640, 480, 24, SDL_OPENGL ); + if ( !screen ) { + printf("Unable to set video mode: %s\n", SDL_GetError()); + return 1; + } + + glClearColor( 0, 0, 0, 0 ); + glClear( GL_COLOR_BUFFER_BIT ); + + // Create a texture + + GLuint boundTex = 123; + assert(!glGetError()); + glGetIntegerv(GL_TEXTURE_BINDING_2D, &boundTex); + assert(!glGetError()); + assert(boundTex == 0); + + GLuint texture; + glGenTextures( 1, &texture ); + glBindTexture( GL_TEXTURE_2D, texture ); + + assert(!glGetError()); + glGetIntegerv(GL_TEXTURE_BINDING_2D, &boundTex); + assert(!glGetError()); + assert(boundTex == texture); + + glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR ); + glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR ); + GLubyte textureData[16*16*4]; + for (int x = 0; x < 16; x++) { + for (int y = 0; y < 16; y++) { + *((int*)&textureData[(x*16 + y) * 4]) = x*16 + ((y*16) << 8); + } + } + glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, 16, 16, 0, + GL_RGBA, GL_UNSIGNED_BYTE, textureData ); + + // Create a second texture + + GLuint texture2; + glGenTextures( 1, &texture2 ); + glBindTexture( GL_TEXTURE_2D, texture2 ); + glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR ); + glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR ); + GLubyte texture2Data[] = { 0xff, 0, 0, 0xff, + 0, 0xff, 0, 0xaa, + 0, 0, 0xff, 0x55, + 0x80, 0x90, 0x70, 0 }; + glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, 2, 2, 0, + GL_RGBA, GL_UNSIGNED_BYTE, texture2Data ); + + // BEGIN + +#if USE_GLEW + glewInit(); +#endif + + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + // original: glFrustum(-0.6435469817188064, 0.6435469817188064 ,-0.48266022190470925, 0.48266022190470925 ,0.5400000214576721, 2048); + glFrustum(-0.6435469817188064, 0.1435469817188064 ,-0.48266022190470925, 0.88266022190470925 ,0.5400000214576721, 2048); + glRotatef(-30, 1, 1, 1); + //GLfloat pm[] = { 1.372136116027832, 0, 0, 0, 0, 0.7910231351852417, 0, 0, -0.6352481842041016, 0.29297152161598206, -1.0005275011062622, -1, 0, 0, -1.080284833908081, 0 }; + //glLoadMatrixf(pm); + + glMatrixMode(GL_MODELVIEW); + GLfloat matrixData[] = { -1, 0, 0, 0, + 0, 0,-1, 0, + 0, 1, 0, 0, + 0, 0, 0, 1 }; + glLoadMatrixf(matrixData); + //glTranslated(-512,-512,-527); // XXX this should be uncommented, but if it is then nothing is shown + + glEnable(GL_CULL_FACE); + glEnable(GL_DEPTH_TEST); + + glClear(GL_DEPTH_BUFFER_BIT); + + glEnableClientState(GL_NORMAL_ARRAY); + glEnableClientState(GL_COLOR_ARRAY); + glEnableClientState(GL_TEXTURE_COORD_ARRAY); + + glActiveTexture(GL_TEXTURE0); + + glGetBooleanv(GL_VERTEX_ARRAY, &tempBool); assert(!tempBool); + glEnableClientState(GL_VERTEX_ARRAY); + glGetBooleanv(GL_VERTEX_ARRAY, &tempBool); assert(tempBool); + + GLuint arrayBuffer, elementBuffer; + glGenBuffers(1, &arrayBuffer); + glGenBuffers(1, &elementBuffer); + + GLubyte arrayData[] = { +/* +[0, 0, 0, 67] ==> 128 float +[0, 0, 128, 67] ==> 256 float +[0, 0, 0, 68] ==> 512 float +[0, 0, 128, 68] ==> 1024 float + +[vertex x ] [vertex y ] [vertex z ] [nr] [texture u ] [texture v ] [lm u ] [lm v ] [color r,g,b,a ] */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 68, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 128, 128, 128, // 0 + 0, 0, 0, 68, 0, 0, 0, 0, 0, 0, 0, 68, 0, 0, 0, 0, 0, 0, 0, 67, 0, 0, 0, 0, 0, 0, 0, 0, 128, 128, 128, 128, // 1 + 0, 0, 0, 68, 0, 0, 0, 68, 0, 0, 0, 68, 0, 0, 0, 0, 0, 0, 0, 67, 0, 0, 0, 67, 0, 0, 0, 0, 128, 128, 128, 128, // 2 + 0, 0, 0, 0, 0, 0, 0, 68, 0, 0, 0, 68, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 67, 0, 0, 0, 0, 128, 128, 128, 128, // 3 + 0, 0, 0, 68, 0, 0, 0, 0, 0, 0, 0, 68, 0, 0, 0, 0, 0, 0, 0, 67, 0, 0, 0, 0, 0, 0, 0, 0, 128, 128, 128, 128, // 4 + 0, 0, 128, 68, 0, 0, 0, 0, 0, 0, 0, 68, 0, 0, 0, 0, 0, 0, 128, 67, 0, 0, 0, 0, 0, 0, 0, 0, 128, 128, 128, 128, // 5 + 0, 0, 128, 68, 0, 0, 0, 68, 0, 0, 0, 68, 0, 0, 0, 0, 0, 0, 128, 67, 0, 0, 0, 67, 0, 0, 0, 0, 128, 128, 128, 128, // 6 + 0, 0, 0, 68, 0, 0, 0, 68, 0, 0, 0, 68, 0, 0, 0, 0, 0, 0, 0, 67, 0, 0, 0, 67, 0, 0, 0, 0, 128, 128, 128, 128, // 7 + 0, 0, 0, 0, 0, 0, 0, 68, 0, 0, 0, 68, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 67, 0, 0, 0, 0, 128, 128, 128, 128, // 8 + 0, 0, 0, 68, 0, 0, 0, 68, 0, 0, 0, 68, 0, 0, 0, 0, 0, 0, 0, 67, 0, 0, 0, 67, 0, 0, 0, 0, 128, 128, 128, 128, // 9 + 0, 0, 0, 68, 0, 0, 128, 68, 0, 0, 0, 68, 0, 0, 0, 0, 0, 0, 0, 67, 0, 0, 128, 67, 0, 0, 0, 0, 128, 128, 128, 128, // 10 + 0, 0, 0, 0, 0, 0, 128, 68, 0, 0, 0, 68, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 67, 0, 0, 0, 0, 128, 128, 128, 128, // 11 + 0, 0, 0, 68, 0, 0, 0, 68, 0, 0, 0, 68, 0, 0, 0, 0, 0, 0, 0, 67, 0, 0, 0, 67, 0, 0, 0, 0, 128, 128, 128, 128, // 12 + 0, 0, 128, 68, 0, 0, 0, 68, 0, 0, 0, 68, 0, 0, 0, 0, 0, 0, 128, 67, 0, 0, 0, 67, 0, 0, 0, 0, 128, 128, 128, 128, // 13 + 0, 0, 128, 68, 0, 0, 128, 68, 0, 0, 0, 68, 0, 0, 0, 0, 0, 0, 128, 67, 0, 0, 128, 67, 0, 0, 0, 0, 128, 128, 128, 128, // 14 + 0, 0, 0, 68, 0, 0, 128, 68, 0, 0, 0, 68, 0, 0, 0, 0, 0, 0, 0, 67, 0, 0, 128, 67, 0, 0, 0, 0, 128, 128, 128, 128, // 15 + + 0, 0, 0, 68, 0, 0, 0, 68, 0, 0, 128, 68, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 128, 128, 128, + 0, 0, 0, 68, 0, 0, 0, 0, 0, 0, 128, 68, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 128, 128, 128, + 0, 0, 0, 68, 0, 0, 0, 0, 0, 0, 0, 68, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 128, 128, 128, + 0, 0, 0, 68, 0, 0, 0, 68, 0, 0, 0, 68, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 128, 128, 128, + 0, 0, 0, 0, 0, 0, 0, 68, 0, 0, 0, 68, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 128, 128, 128, + 0, 0, 0, 0, 0, 0, 0, 68, 0, 0, 128, 68, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 128, 128, 128, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 68, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 128, 128, 128, + 0, 0, 0, 68, 0, 0, 0, 68, 0, 0, 128, 68, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 128, 128, 128, + 0, 0, 0, 68, 0, 0, 0, 68, 0, 0, 0, 68, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 128, 128, 128, + 0, 0, 0, 68, 0, 0, 0, 0, 0, 0, 0, 68, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 128, 128, 128, + 0, 0, 0, 68, 0, 0, 0, 0, 0, 0, 128, 68, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 128, 128, 128, + 0, 0, 128, 68, 0, 0, 0, 68, 0, 0, 128, 68, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 128, 128, 128, + 0, 0, 128, 68, 0, 0, 0, 68, 0, 0, 0, 68, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 128, 128, 128, + 0, 0, 128, 68, 0, 0, 0, 0, 0, 0, 0, 68, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 128, 128, 128, + 0, 0, 0, 68, 0, 0, 128, 68, 0, 0, 128, 68, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 128, 128, 128, + 0, 0, 0, 68, 0, 0, 0, 68, 0, 0, 128, 68, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 128, 128, 128, + 0, 0, 0, 68, 0, 0, 0, 68, 0, 0, 0, 68, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 128, 128, 128, + 0, 0, 0, 68, 0, 0, 128, 68, 0, 0, 0, 68, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 128, 128, 128, + 0, 0, 0, 0, 0, 0, 0, 68, 0, 0, 128, 68, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 128, 128, 128, + 0, 0, 0, 0, 0, 0, 0, 68, 0, 0, 0, 68, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 128, 128, 128, + 0, 0, 0, 0, 0, 0, 128, 68, 0, 0, 0, 68, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 128, 128, 128, + 0, 0, 0, 68, 0, 0, 128, 68, 0, 0, 128, 68, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 128, 128, 128, + 0, 0, 0, 68, 0, 0, 128, 68, 0, 0, 0, 68, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 128, 128, 128, + 0, 0, 0, 68, 0, 0, 0, 68, 0, 0, 0, 68, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 128, 128, 128, + 0, 0, 0, 68, 0, 0, 0, 68, 0, 0, 128, 68, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 128, 128, 128, + 0, 0, 128, 68, 0, 0, 0, 68, 0, 0, 128, 68, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 128, 128, 128, + 0, 0, 128, 68, 0, 0, 0, 68, 0, 0, 0, 68, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 128, 128, 128, + 0, 0, 128, 68, 0, 0, 128, 68, 0, 0, 0, 68, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 128, 128, 128 + }; + assert(sizeof(arrayData) == 1408); + _glBindBuffer(GL_ARRAY_BUFFER, arrayBuffer); + glBufferData(GL_ARRAY_BUFFER, sizeof(arrayData), arrayData, GL_STATIC_DRAW); + _glBindBuffer(GL_ARRAY_BUFFER, 0); + + GLushort elementData[] = { 1, 2, 0, 2, 3, 0, 5, 6, 4, 6, 7, 4, 9, 10, 8, 10, 11, 8, 13, 14, 12, 14, 15, 12 }; + assert(sizeof(elementData) == 48); + _glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, elementBuffer); + glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(elementData), elementData, GL_STATIC_DRAW); + _glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); + + _glBindBuffer(GL_ARRAY_BUFFER, arrayBuffer); + _glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, elementBuffer); + + // sauer vertex data is apparently 0-12: V3F, 12: N1B, 16-24: T2F, 24-28: T2S, 28-32: C4B + glVertexPointer(3, GL_FLOAT, 32, (void*)0); // all these apply to the ARRAY_BUFFER that is bound + glTexCoordPointer(2, GL_FLOAT, 32, (void*)16); + + glClientActiveTexture(GL_TEXTURE1); // XXX seems to be ignored in native build + glTexCoordPointer(2, GL_SHORT, 32, (void*)24); + glGetIntegerv(GL_TEXTURE_COORD_ARRAY_SIZE, &tempInt); assert(tempInt == 2); + glGetIntegerv(GL_TEXTURE_COORD_ARRAY_TYPE, &tempInt); assert(tempInt == GL_SHORT); + glGetIntegerv(GL_TEXTURE_COORD_ARRAY_STRIDE, &tempInt); assert(tempInt == 32); + glGetPointerv(GL_TEXTURE_COORD_ARRAY_POINTER, &tempPtr); assert(tempPtr == (void *)24); + + glClientActiveTexture(GL_TEXTURE0); // likely not needed, it is a cleanup + glNormalPointer(GL_BYTE, 32, (void*)12); + glColorPointer(4, GL_UNSIGNED_BYTE, 32, (void*)28); + + glGetPointerv(GL_VERTEX_ARRAY_POINTER, &tempPtr); assert(tempPtr == (void *)0); + glGetPointerv(GL_COLOR_ARRAY_POINTER, &tempPtr); assert(tempPtr == (void *)28); + glGetPointerv(GL_TEXTURE_COORD_ARRAY_POINTER, &tempPtr); assert(tempPtr == (void *)16); + glGetIntegerv(GL_VERTEX_ARRAY_SIZE, &tempInt); assert(tempInt == 3); + glGetIntegerv(GL_VERTEX_ARRAY_TYPE, &tempInt); assert(tempInt == GL_FLOAT); + glGetIntegerv(GL_VERTEX_ARRAY_STRIDE, &tempInt); assert(tempInt == 32); + glGetIntegerv(GL_COLOR_ARRAY_SIZE, &tempInt); assert(tempInt == 4); + glGetIntegerv(GL_COLOR_ARRAY_TYPE, &tempInt); assert(tempInt == GL_UNSIGNED_BYTE); + glGetIntegerv(GL_COLOR_ARRAY_STRIDE, &tempInt); assert(tempInt == 32); + glGetIntegerv(GL_TEXTURE_COORD_ARRAY_SIZE, &tempInt); assert(tempInt == 2); + glGetIntegerv(GL_TEXTURE_COORD_ARRAY_TYPE, &tempInt); assert(tempInt == GL_FLOAT); + glGetIntegerv(GL_TEXTURE_COORD_ARRAY_STRIDE, &tempInt); assert(tempInt == 32); + glGetBooleanv(GL_VERTEX_ARRAY, &tempBool); assert(tempBool); + + glBindTexture(GL_TEXTURE_2D, texture); // diffuse? + glActiveTexture(GL_TEXTURE0); + glActiveTexture(GL_TEXTURE1); + glBindTexture(GL_TEXTURE_2D, texture2); // lightmap? + glActiveTexture(GL_TEXTURE0); + + GLint ok; + + const char *vertexShader = "uniform vec4 texgenscroll;\n" + "void main(void)\n" + "{\n" + " gl_Position = ftransform();\n" + " gl_TexCoord[0].xy = gl_MultiTexCoord0.xy/100.0 + texgenscroll.xy;\n" // added /100 here + " gl_TexCoord[1].xy = gl_MultiTexCoord1.xy/100.0 * 3.051851e-05;\n" + "}\n"; + const char *fragmentShader = "uniform vec4 colorparams;\n" + "uniform sampler2D diffusemap, lightmap;\n" + "void main(void)\n" + "{\n" + " vec4 diffuse = texture2D(diffusemap, gl_TexCoord[0].xy);\n" + " vec4 lm = texture2D(lightmap, gl_TexCoord[1].xy);\n" + " diffuse *= colorparams;\n" + " gl_FragColor = diffuse * lm;\n" + "}\n"; + + GLuint vs = glCreateShader(GL_VERTEX_SHADER); + glShaderSource(vs, 1, &vertexShader, NULL); + glCompileShader(vs); + glGetShaderiv(vs, GL_COMPILE_STATUS, &ok); + assert(ok); + + GLuint fs = glCreateShader(GL_FRAGMENT_SHADER); + glShaderSource(fs, 1, &fragmentShader, NULL); + glCompileShader(fs); + glGetShaderiv(fs, GL_COMPILE_STATUS, &ok); + assert(ok); + + GLuint program = glCreateProgram(); + + glAttachShader(program, vs); + glAttachShader(program, fs); + glLinkProgram(program); + glGetProgramiv(program, GL_LINK_STATUS, &ok); + assert(ok); + + glUseProgram(program); + + GLint lightmapLocation = glGetUniformLocation(program, "lightmap"); + assert(lightmapLocation >= 0); + assert(lightmapLocation == glGetUniformLocation(program, "lightmap")); // must get identical ids + glLinkProgram(program); + glGetProgramiv(program, GL_LINK_STATUS, &ok); + assert(ok); + assert(lightmapLocation != glGetUniformLocation(program, "lightmap")); // must NOT get identical ids, we re-linked! + lightmapLocation = glGetUniformLocation(program, "lightmap"); + assert(lightmapLocation == glGetUniformLocation(program, "lightmap")); // must get identical ids + + glUniform1i(lightmapLocation, 1); // sampler2D? Is it the texture unit? + + GLint diffusemapLocation = glGetUniformLocation(program, "diffusemap"); + assert(diffusemapLocation >= 0); + glUniform1i(diffusemapLocation, 0); + + GLint texgenscrollLocation = glGetUniformLocation(program, "texgenscroll"); + assert(texgenscrollLocation >= 0); + + GLint colorparamsLocation = glGetUniformLocation(program, "colorparams"); + assert(colorparamsLocation >= 0); + + GLfloat texgenscrollData[] = { 0, 0, 0, 0 }; + glUniform4fv(texgenscrollLocation, 1, texgenscrollData); + + GLfloat colorparamsData[] = { 2, 2, 2, 1 }; + glUniform4fv(colorparamsLocation, 1, colorparamsData); + + glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, (void*)12); + glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, (void*) 0); + glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, (void*)24); + glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, (void*)36); + + // END + + SDL_GL_SwapBuffers(); + +#if !EMSCRIPTEN + SDL_Delay(1500); +#endif + + SDL_Quit(); + + return 0; +} diff --git a/tests/runner.py b/tests/runner.py index f59d5cb9..fffd039c 100755 --- a/tests/runner.py +++ b/tests/runner.py @@ -138,7 +138,11 @@ class RunnerCore(unittest.TestCase): post1 = post_build post2 = None - if self.emcc_args is None: + emcc_args = self.emcc_args + if emcc_args is None: + emcc_args = [] + + if emcc_args is None: # legacy testing mode, no longer used Building.emscripten(filename, append_ext=True, extra_args=extra_emscripten_args) if post1: exec post1 in locals() @@ -160,7 +164,7 @@ process(sys.argv[1]) ''') transform.close() transform_args = ['--js-transform', "%s %s" % (PYTHON, transform_filename)] - Building.emcc(filename + '.o.ll', Settings.serialize() + self.emcc_args + transform_args + Building.COMPILER_TEST_OPTS, filename + '.o.js') + Building.emcc(filename + '.o.ll', Settings.serialize() + emcc_args + transform_args + Building.COMPILER_TEST_OPTS, filename + '.o.js') if post2: post2(filename + '.o.js') # Build JavaScript code from source code @@ -649,7 +653,6 @@ class BrowserCore(RunnerCore): def btest(self, filename, expected=None, reference=None, force_c=False, reference_slack=0, manual_reference=False, post_build=None, args=[], outfile='test.html', message='.'): # TODO: use in all other tests - if os.environ.get('EMCC_FAST_COMPILER') == '1' and 'LEGACY_GL_EMULATION=1' in args: return self.skip('no legacy gl emulation in fastcomp') # if we are provided the source and not a path, use that filename_is_src = '\n' in filename src = filename if filename_is_src else '' diff --git a/tests/sdlglshader.c b/tests/sdlglshader.c index a096ef20..9cd80097 100644 --- a/tests/sdlglshader.c +++ b/tests/sdlglshader.c @@ -89,6 +89,11 @@ void setShaders() { glCompileShader_(v); glGetObjectParameteriv_(v, GL_OBJECT_COMPILE_STATUS_ARB, &ok); + if (!ok) { + char msg[512]; + glGetShaderInfoLog(v, sizeof msg, NULL, msg); + printf("shader compilation issue: %s\n", msg); + } assert(ok); glCompileShader_(f); diff --git a/tests/test_browser.py b/tests/test_browser.py index ef67aa20..2c85f5ca 100644 --- a/tests/test_browser.py +++ b/tests/test_browser.py @@ -143,6 +143,8 @@ If manually bisecting: os.chdir(cwd) def test_split(self): + if os.environ.get('EMCC_FAST_COMPILER') == '1': return self.skip('no --split in fastcomp, deprecated') + # test HTML generation. self.reftest(path_from_root('tests', 'htmltest.png')) output = Popen([PYTHON, EMCC, path_from_root('tests', 'hello_world_sdl.cpp'), '-o', 'something.js', '--split', '100', '--pre-js', 'reftest.js']).communicate() @@ -235,6 +237,8 @@ If manually bisecting: self.run_browser('something.html', 'You should see "hello, world!" and a colored cube.', '/report_result?0') def test_split_in_source_filenames(self): + if os.environ.get('EMCC_FAST_COMPILER') == '1': return self.skip('no --split in fastcomp, deprecated') + self.reftest(path_from_root('tests', 'htmltest.png')) output = Popen([PYTHON, EMCC, path_from_root('tests', 'hello_world_sdl.cpp'), '-o', 'something.js', '-g', '--split', '100', '--pre-js', 'reftest.js']).communicate() assert os.path.exists(os.path.join(self.get_dir(), 'something.js')), 'must be main js file' @@ -1152,8 +1156,6 @@ keydown(100);keyup(100); // trigger the end self.run_browser('page.html', '', '/report_result?1') def test_sdl_audio_beeps(self): - if os.environ.get('EMCC_FAST_COMPILER') == '1': return self.skip('todo c++ exceptions in fastcomp') - open(os.path.join(self.get_dir(), 'sdl_audio_beep.cpp'), 'w').write(self.with_report_result(open(path_from_root('tests', 'sdl_audio_beep.cpp')).read())) # use closure to check for a possible bug with closure minifying away newer Audio() attributes @@ -1537,6 +1539,21 @@ keydown(100);keyup(100); // trigger the end def test_cubegeom(self): self.btest('cubegeom.c', reference='cubegeom.png', args=['-O2', '-g', '-s', 'LEGACY_GL_EMULATION=1']) + def test_cubegeom_proc(self): + open('side.c', 'w').write(r''' + +extern void* SDL_GL_GetProcAddress(const char *); + +void *glBindBuffer = 0; // same name as the gl function, to check that the collision does not break us + +void *getBindBuffer() { + if (!glBindBuffer) glBindBuffer = SDL_GL_GetProcAddress("glBindBuffer"); + return glBindBuffer; +} +''') + for opts in [0, 1]: + self.btest('cubegeom_proc.c', reference='cubegeom.png', args=['-O' + str(opts), 'side.c', '-s', 'LEGACY_GL_EMULATION=1']) + def test_cubegeom_glew(self): self.btest('cubegeom_glew.c', reference='cubegeom.png', args=['-O2', '--closure', '1', '-s', 'LEGACY_GL_EMULATION=1']) diff --git a/tests/test_egl.c b/tests/test_egl.c index d66949d0..6eef4aa5 100644 --- a/tests/test_egl.c +++ b/tests/test_egl.c @@ -75,7 +75,10 @@ int main(int argc, char *argv[]) ret = eglTerminate(display); assert(eglGetError() == EGL_SUCCESS); assert(ret == EGL_TRUE); - + + assert(eglGetProcAddress("glClear") != 0); + assert(eglGetProcAddress("glWakaWaka") == 0); + #ifdef REPORT_RESULT REPORT_RESULT(); #endif diff --git a/tools/file_packager.py b/tools/file_packager.py index 874ad942..448bb994 100644 --- a/tools/file_packager.py +++ b/tools/file_packager.py @@ -13,6 +13,9 @@ Usage: file_packager.py TARGET [--preload A [B..]] [--embed C [D..]] [--exclude E [F..]] [--compress COMPRESSION_DATA] [--crunch[=X]] [--js-output=OUTPUT.js] [--no-force] [--use-preload-cache] [--no-heap-copy] + --preload , + --embed See emcc --help for more details on those options. + --crunch=X Will compress dxt files to crn with quality level X. The crunch commandline tool must be present and CRUNCH should be defined in ~/.emscripten that points to it. JS crunch decompressing code will be added to convert the crn to dds in the browser. diff --git a/tools/shared.py b/tools/shared.py index dbf1e3ef..764877ba 100644 --- a/tools/shared.py +++ b/tools/shared.py @@ -345,7 +345,7 @@ def find_temp_directory(): # we re-check sanity when the settings are changed) # We also re-check sanity and clear the cache when the version changes -EMSCRIPTEN_VERSION = '1.10.2' +EMSCRIPTEN_VERSION = '1.10.4' def generate_sanity(): return EMSCRIPTEN_VERSION + '|' + get_llvm_target() + '|' + LLVM_ROOT + '|' + get_clang_version() diff --git a/tools/system_libs.py b/tools/system_libs.py new file mode 100644 index 00000000..3723a5c3 --- /dev/null +++ b/tools/system_libs.py @@ -0,0 +1,397 @@ +import os, json, logging +import shared +from tools.shared import execute + +def calculate(temp_files, in_temp, stdout, stderr): + # Check if we need to include some libraries that we compile. (We implement libc ourselves in js, but + # compile a malloc implementation and stdlibc++.) + + def read_symbols(path, exclude=None): + symbols = map(lambda line: line.strip().split(' ')[1], open(path).readlines()) + if exclude: + symbols = filter(lambda symbol: symbol not in exclude, symbols) + return set(symbols) + + lib_opts = ['-O2'] + + # XXX We also need to add libc symbols that use malloc, for example strdup. It's very rare to use just them and not + # a normal malloc symbol (like free, after calling strdup), so we haven't hit this yet, but it is possible. + libc_symbols = read_symbols(shared.path_from_root('system', 'lib', 'libc.symbols')) + libcextra_symbols = read_symbols(shared.path_from_root('system', 'lib', 'libcextra.symbols')) + libcxx_symbols = read_symbols(shared.path_from_root('system', 'lib', 'libcxx', 'symbols'), exclude=libc_symbols) + libcxxabi_symbols = read_symbols(shared.path_from_root('system', 'lib', 'libcxxabi', 'symbols'), exclude=libc_symbols) + gl_symbols = read_symbols(shared.path_from_root('system', 'lib', 'gl.symbols')) + + # XXX we should disable EMCC_DEBUG when building libs, just like in the relooper + + def build_libc(lib_filename, files): + o_s = [] + prev_cxx = os.environ.get('EMMAKEN_CXX') + if prev_cxx: os.environ['EMMAKEN_CXX'] = '' + musl_internal_includes = shared.path_from_root('system', 'lib', 'libc', 'musl', 'src', 'internal') + for src in files: + o = in_temp(os.path.basename(src) + '.o') + execute([shared.PYTHON, shared.EMCC, shared.path_from_root('system', 'lib', src), '-o', o, '-I', musl_internal_includes] + lib_opts, stdout=stdout, stderr=stderr) + o_s.append(o) + if prev_cxx: os.environ['EMMAKEN_CXX'] = prev_cxx + shared.Building.link(o_s, in_temp(lib_filename)) + return in_temp(lib_filename) + + def build_libcxx(src_dirname, lib_filename, files): + o_s = [] + for src in files: + o = in_temp(src + '.o') + srcfile = shared.path_from_root(src_dirname, src) + execute([shared.PYTHON, shared.EMXX, srcfile, '-o', o, '-std=c++11'] + lib_opts, stdout=stdout, stderr=stderr) + o_s.append(o) + shared.Building.link(o_s, in_temp(lib_filename)) + return in_temp(lib_filename) + + # libc + def create_libc(): + logging.debug(' building libc for cache') + libc_files = [ + 'dlmalloc.c', + os.path.join('libcxx', 'new.cpp'), + ] + musl_files = [ + ['internal', [ + 'floatscan.c', + 'shgetc.c', + ]], + ['math', [ + 'scalbn.c', + 'scalbnl.c', + ]], + ['stdio', [ + '__overflow.c', + '__toread.c', + '__towrite.c', + '__uflow.c', + ]], + ['stdlib', [ + 'atof.c', + 'strtod.c', + ]], + ['string', [ + 'memcmp.c', + 'strcasecmp.c', + 'strcmp.c', + 'strncasecmp.c', + 'strncmp.c', + ]] + ] + for directory, sources in musl_files: + libc_files += [os.path.join('libc', 'musl', 'src', directory, source) for source in sources] + return build_libc('libc.bc', libc_files) + + def apply_libc(need): + # libc needs some sign correction. # If we are in mode 0, switch to 2. We will add our lines + try: + if shared.Settings.CORRECT_SIGNS == 0: raise Exception('we need to change to 2') + except: # we fail if equal to 0 - so we need to switch to 2 - or if CORRECT_SIGNS is not even in Settings + shared.Settings.CORRECT_SIGNS = 2 + if shared.Settings.CORRECT_SIGNS == 2: + shared.Settings.CORRECT_SIGNS_LINES = [shared.path_from_root('src', 'dlmalloc.c') + ':' + str(i+4) for i in [4816, 4191, 4246, 4199, 4205, 4235, 4227]] + # If we are in mode 1, we are correcting everything anyhow. If we are in mode 3, we will be corrected + # so all is well anyhow too. + return True + + # libcextra + def create_libcextra(): + logging.debug('building libcextra for cache') + musl_files = [ + ['ctype', [ + 'iswalnum.c', + 'iswalpha.c', + 'iswblank.c', + 'iswcntrl.c', + 'iswctype.c', + 'iswdigit.c', + 'iswgraph.c', + 'iswlower.c', + 'iswprint.c', + 'iswpunct.c', + 'iswspace.c', + 'iswupper.c', + 'iswxdigit.c', + 'towctrans.c', + 'wcswidth.c', + 'wctrans.c', + 'wcwidth.c', + ]], + ['internal', [ + 'intscan.c', + ]], + ['legacy', [ + 'err.c', + ]], + ['locale', [ + 'iconv.c', + 'iswalnum_l.c', + 'iswalpha_l.c', + 'iswblank_l.c', + 'iswcntrl_l.c', + 'iswctype_l.c', + 'iswdigit_l.c', + 'iswgraph_l.c', + 'iswlower_l.c', + 'iswprint_l.c', + 'iswpunct_l.c', + 'iswspace_l.c', + 'iswupper_l.c', + 'iswxdigit_l.c', + 'strcoll.c', + 'strcasecmp_l.c', + 'strfmon.c', + 'strncasecmp_l.c', + 'strxfrm.c', + 'towctrans_l.c', + 'towlower_l.c', + 'towupper_l.c', + 'wcscoll.c', + 'wcscoll_l.c', + 'wcsxfrm.c', + 'wcsxfrm_l.c', + 'wctrans_l.c', + 'wctype_l.c', + ]], + ['math', [ + '__cos.c', + '__cosdf.c', + '__sin.c', + '__sindf.c', + 'ilogb.c', + 'ilogbf.c', + 'ilogbl.c', + 'ldexp.c', + 'ldexpf.c', + 'ldexpl.c', + 'logb.c', + 'logbf.c', + 'logbl.c', + 'lgamma.c', + 'lgamma_r.c', + 'lgammaf.c', + 'lgammaf_r.c', + 'lgammal.c', + 'scalbnf.c', + 'signgam.c', + 'tgamma.c', + 'tgammaf.c', + 'tgammal.c' + ]], + ['misc', [ + 'getopt.c', + 'getopt_long.c', + ]], + ['multibyte', [ + 'btowc.c', + 'internal.c', + 'mblen.c', + 'mbrlen.c', + 'mbrtowc.c', + 'mbsinit.c', + 'mbsnrtowcs.c', + 'mbsrtowcs.c', + 'mbstowcs.c', + 'mbtowc.c', + 'wcrtomb.c', + 'wcsnrtombs.c', + 'wcsrtombs.c', + 'wcstombs.c', + 'wctob.c', + 'wctomb.c', + ]], + ['regex', [ + 'fnmatch.c', + 'regcomp.c', + 'regerror.c', + 'regexec.c', + 'tre-mem.c', + ]], + ['stdio', [ + 'fwprintf.c', + 'swprintf.c', + 'vfwprintf.c', + 'vswprintf.c', + 'vwprintf.c', + 'wprintf.c', + 'fputwc.c', + 'fputws.c', + ]], + ['stdlib', [ + 'ecvt.c', + 'fcvt.c', + 'gcvt.c', + 'wcstod.c', + 'wcstol.c', + ]], + ['string', [ + 'memccpy.c', + 'memmem.c', + 'mempcpy.c', + 'memrchr.c', + 'strcasestr.c', + 'strchrnul.c', + 'strlcat.c', + 'strlcpy.c', + 'strsep.c', + 'strverscmp.c', + 'wcpcpy.c', + 'wcpncpy.c', + 'wcscasecmp.c', + 'wcscasecmp_l.c', + 'wcscat.c', + 'wcschr.c', + 'wcscmp.c', + 'wcscpy.c', + 'wcscspn.c', + 'wcsdup.c', + 'wcslen.c', + 'wcsncasecmp.c', + 'wcsncasecmp_l.c', + 'wcsncat.c', + 'wcsncmp.c', + 'wcsncpy.c', + 'wcsnlen.c', + 'wcspbrk.c', + 'wcsrchr.c', + 'wcsspn.c', + 'wcsstr.c', + 'wcstok.c', + 'wcswcs.c', + 'wmemchr.c', + 'wmemcmp.c', + 'wmemcpy.c', + 'wmemmove.c', + 'wmemset.c', + ]] + ] + libcextra_files = [] + for directory, sources in musl_files: + libcextra_files += [os.path.join('libc', 'musl', 'src', directory, source) for source in sources] + return build_libc('libcextra.bc', libcextra_files) + + # libcxx + def create_libcxx(): + logging.debug('building libcxx for cache') + libcxx_files = [ + 'algorithm.cpp', + 'condition_variable.cpp', + 'future.cpp', + 'iostream.cpp', + 'memory.cpp', + 'random.cpp', + 'stdexcept.cpp', + 'system_error.cpp', + 'utility.cpp', + 'bind.cpp', + 'debug.cpp', + 'hash.cpp', + 'mutex.cpp', + 'string.cpp', + 'thread.cpp', + 'valarray.cpp', + 'chrono.cpp', + 'exception.cpp', + 'ios.cpp', + 'locale.cpp', + 'regex.cpp', + 'strstream.cpp' + ] + return build_libcxx(os.path.join('system', 'lib', 'libcxx'), 'libcxx.bc', libcxx_files) + + def apply_libcxx(need): + assert shared.Settings.QUANTUM_SIZE == 4, 'We do not support libc++ with QUANTUM_SIZE == 1' + # libcxx might need corrections, so turn them all on. TODO: check which are actually needed + shared.Settings.CORRECT_SIGNS = shared.Settings.CORRECT_OVERFLOWS = shared.Settings.CORRECT_ROUNDINGS = 1 + #logging.info('using libcxx turns on CORRECT_* options') + return True + + # libcxxabi - just for dynamic_cast for now + def create_libcxxabi(): + logging.debug('building libcxxabi for cache') + libcxxabi_files = [ + 'typeinfo.cpp', + 'private_typeinfo.cpp' + ] + return build_libcxx(os.path.join('system', 'lib', 'libcxxabi', 'src'), 'libcxxabi.bc', libcxxabi_files) + + def apply_libcxxabi(need): + assert shared.Settings.QUANTUM_SIZE == 4, 'We do not support libc++abi with QUANTUM_SIZE == 1' + #logging.info('using libcxxabi, this may need CORRECT_* options') + #shared.Settings.CORRECT_SIGNS = shared.Settings.CORRECT_OVERFLOWS = shared.Settings.CORRECT_ROUNDINGS = 1 + return True + + # gl + def create_gl(): + prev_cxx = os.environ.get('EMMAKEN_CXX') + if prev_cxx: os.environ['EMMAKEN_CXX'] = '' + o = in_temp('gl.o') + execute([shared.PYTHON, shared.EMCC, shared.path_from_root('system', 'lib', 'gl.c'), '-o', o]) + if prev_cxx: os.environ['EMMAKEN_CXX'] = prev_cxx + return o + + # Settings this in the environment will avoid checking dependencies and make building big projects a little faster + # 1 means include everything; otherwise it can be the name of a lib (libcxx, etc.) + force = os.environ.get('EMCC_FORCE_STDLIBS') + force_all = force == '1' + + # Scan symbols + symbolses = map(lambda temp_file: shared.Building.llvm_nm(temp_file), temp_files) + + # Add in some hacks for js libraries. If a js lib depends on a symbol provided by a C library, it must be + # added to here, because our deps go only one way (each library here is checked, then we check the next + # in order - libcxx, libcxextra, etc. - and then we run the JS compiler and provide extra symbols from + # library*.js files. But we cannot then go back to the C libraries if a new dep was added! + # TODO: Move all __deps from src/library*.js to deps_info.json, and use that single source of info + # both here and in the JS compiler. + deps_info = json.loads(open(shared.path_from_root('src', 'deps_info.json')).read()) + def add_back_deps(need): + for ident, deps in deps_info.iteritems(): + if ident in need.undefs: + for dep in deps: + need.undefs.add(dep) + shared.Settings.EXPORTED_FUNCTIONS.append('_' + dep) + for symbols in symbolses: + add_back_deps(symbols) + + all_needed = set() + for symbols in symbolses: + all_needed.update(symbols.undefs) + for symbols in symbolses: + all_needed.difference_update(symbols.defs) + + # Go over libraries to figure out which we must include + # If we have libcxx, we must force inclusion of libc, since libcxx uses new internally. Note: this is kind of hacky. + ret = [] + has = need = None + for name, create, apply_, library_symbols in [('libcxx', create_libcxx, apply_libcxx, libcxx_symbols), + ('libcextra', create_libcextra, lambda x: True, libcextra_symbols), + ('libcxxabi', create_libcxxabi, apply_libcxxabi, libcxxabi_symbols), + ('gl', create_gl, lambda x: True, gl_symbols), + ('libc', create_libc, apply_libc, libc_symbols)]: + force_this = force_all or force == name + if not force_this: + need = set() + has = set() + for symbols in symbolses: + for library_symbol in library_symbols: + if library_symbol in symbols.undefs: + need.add(library_symbol) + if library_symbol in symbols.defs: + has.add(library_symbol) + for haz in has: # remove symbols that are supplied by another of the inputs + if haz in need: + need.remove(haz) + if shared.Settings.VERBOSE: logging.debug('considering %s: we need %s and have %s' % (name, str(need), str(has))) + if force_this or len(need) > 0: + force_all = True + if apply_(need): + # We need to build and link the library in + logging.debug('including %s' % name) + libfile = shared.Cache.get(name, create) + ret.append(libfile) + return ret + |