diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/library.js | 5 | ||||
-rw-r--r-- | src/library_gl.js | 36 | ||||
-rw-r--r-- | src/parseTools.js | 2 |
3 files changed, 40 insertions, 3 deletions
diff --git a/src/library.js b/src/library.js index cc28ce6f..56583c76 100644 --- a/src/library.js +++ b/src/library.js @@ -3302,8 +3302,9 @@ LibraryManager.library = { } var info = FS.streams[stream]; if (!info) return -1; - return allocate(info.object.contents.slice(offset, offset+num), - 'i8', ALLOC_NORMAL); + var contents = info.object.contents; + contents = Array.prototype.slice.call(contents, offset, offset+num); + return allocate(contents, 'i8', ALLOC_NORMAL); }, __01mmap64_: 'mmap', diff --git a/src/library_gl.js b/src/library_gl.js index 3ec7c81e..97a050d5 100644 --- a/src/library_gl.js +++ b/src/library_gl.js @@ -393,6 +393,24 @@ var LibraryGL = { return id; }, + glGetActiveUniform: function(program, index, bufSize, length, size, type, name) { + program = GL.programs[program]; + var info = Module.ctx.getActiveUniform(program, index); + + var infoname = info.name.slice(0, bufsize - 1); + writeStringToMemory(infoname, name); + + if (length) { + {{{ makeSetValue('length', '0', 'infoname.length', 'i32') }}}; + } + if (size) { + {{{ makeSetValue('size', '0', 'info.size', 'i32') }}}; + } + if (type) { + {{{ makeSetValue('type', '0', 'info.type', 'i32') }}}; + } + }, + glUniform1f: function(location, v0) { location = GL.uniforms[location]; Module.ctx.uniform1f(location, v0); @@ -538,6 +556,24 @@ var LibraryGL = { return Module.ctx.getAttribLocation(program, name); }, + glGetActiveAttrib: function(program, index, bufSize, length, size, type, name) { + program = GL.programs[program]; + var info = Module.ctx.getActiveAttrib(program, index); + + var infoname = info.name.slice(0, bufsize - 1); + writeStringToMemory(infoname, name); + + if (length) { + {{{ makeSetValue('length', '0', 'infoname.length', 'i32') }}}; + } + if (size) { + {{{ makeSetValue('size', '0', 'info.size', 'i32') }}}; + } + if (type) { + {{{ makeSetValue('type', '0', 'info.type', 'i32') }}}; + } + }, + glCreateShader: function(shaderType) { var id = GL.counter++; GL.shaders[id] = Module.ctx.createShader(shaderType); diff --git a/src/parseTools.js b/src/parseTools.js index 805be4b1..2daf9589 100644 --- a/src/parseTools.js +++ b/src/parseTools.js @@ -123,7 +123,7 @@ function isPointerType(type) { function isStructType(type) { if (isPointerType(type)) return false; if (/^\[\d+\ x\ (.*)\]/.test(type)) return true; // [15 x ?] blocks. Like structs - if (/<?{ [^}]* }>?/.test(type)) return true; // { i32, i8 } etc. - anonymous struct types + if (/<?{ ?[^}]* ?}>?/.test(type)) return true; // { i32, i8 } etc. - anonymous struct types // See comment in isStructPointerType() return type[0] == '%'; } |