aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/library_gl.js6
-rw-r--r--src/modules.js15
-rw-r--r--src/preamble.js2
3 files changed, 21 insertions, 2 deletions
diff --git a/src/library_gl.js b/src/library_gl.js
index 3055309b..0a30292a 100644
--- a/src/library_gl.js
+++ b/src/library_gl.js
@@ -957,7 +957,11 @@ var LibraryGL = {
usage = 0x88E8; // GL_DYNAMIC_DRAW
break;
}
- GLctx.bufferData(target, HEAPU8.subarray(data, data+size), usage);
+ if (!data) {
+ GLctx.bufferData(target, size, usage);
+ } else {
+ GLctx.bufferData(target, HEAPU8.subarray(data, data+size), usage);
+ }
},
glBufferSubData__sig: 'viiii',
diff --git a/src/modules.js b/src/modules.js
index ad467ba7..d1ef4243 100644
--- a/src/modules.js
+++ b/src/modules.js
@@ -426,7 +426,20 @@ var LibraryManager = {
var libraries = ['library.js', 'library_path.js', 'library_fs.js', 'library_idbfs.js', 'library_memfs.js', 'library_nodefs.js', 'library_sockfs.js', 'library_tty.js', 'library_browser.js', 'library_sdl.js', 'library_gl.js', 'library_glut.js', 'library_xlib.js', 'library_egl.js', 'library_gc.js', 'library_jansson.js', 'library_openal.js', 'library_glfw.js', 'library_uuid.js', 'library_glew.js'].concat(additionalLibraries);
for (var i = 0; i < libraries.length; i++) {
- eval(processMacros(preprocess(read(libraries[i]))));
+ var filename = libraries[i];
+ var src = read(filename);
+ try {
+ var processed = processMacros(preprocess(src));
+ eval(processed);
+ } catch(e) {
+ var details = [e, e.lineNumber ? 'line number: ' + e.lineNumber : '', (e.stack || "").toString().replace('Object.<anonymous>', filename)];
+ if (processed) {
+ error('failure to execute js library "' + filename + '": ' + details + '\npreprocessed source (you can run a js engine on this to get a clearer error message sometimes):\n=============\n' + processed + '\n=============\n');
+ } else {
+ error('failure to process js library "' + filename + '": ' + details + '\noriginal source:\n=============\n' + src + '\n=============\n');
+ }
+ throw e;
+ }
}
/*
diff --git a/src/preamble.js b/src/preamble.js
index d415b87e..9a65b092 100644
--- a/src/preamble.js
+++ b/src/preamble.js
@@ -6,6 +6,8 @@
{{RUNTIME}}
+Module['Runtime'] = Runtime;
+
#if ASM_JS
#if RESERVED_FUNCTION_POINTERS
function jsCall() {