diff --git a/README.md b/README.md index 8564d19..e95bbd5 100644 --- a/README.md +++ b/README.md @@ -35,6 +35,12 @@ When you call `webgl_memory.get_info()`, the result is: ```lua { + context = { + vendor = , + renderer = , + unmasked_vendor = , + unmasked_renderer = , + }, memory = { buffer = , texture = , diff --git a/webgl_memory/lib/web/lib_webgl_memory.js b/webgl_memory/lib/web/lib_webgl_memory.js index 5cb245c..f917985 100644 --- a/webgl_memory/lib/web/lib_webgl_memory.js +++ b/webgl_memory/lib/web/lib_webgl_memory.js @@ -8,16 +8,26 @@ var LibraryWebGLMemory = { return cstr; }, - addHeapSize: function (obj) { + addExtraInfo: function (obj) { obj.memory.wasmheap = Module.HEAP8.length; + var gl = Module.ctx; + obj.context = { + vendor: gl.getParameter(gl.VENDOR), + renderer: gl.getParameter(gl.RENDERER) + }; + var debugInfo = gl.getExtension("WEBGL_debug_renderer_info"); + if (debugInfo) { + obj.context.unmasked_vendor = gl.getParameter(debugInfo.UNMASKED_VENDOR_WEBGL); + obj.context.unmasked_renderer = gl.getParameter(debugInfo.UNMASKED_RENDERER_WEBGL); + } return obj; } }, - WebGLMemory_GetInfo: function (param, subparam) { + WebGLMemory_GetInfo: function () { var ext = Module.ctx.getExtension("GMAN_webgl_memory"); if (ext) { - return WebGLMemory.cstringify(WebGLMemory.addHeapSize(ext.getMemoryInfo())); + return WebGLMemory.cstringify(WebGLMemory.addExtraInfo(ext.getMemoryInfo())); } else { if (!WebGLMemory.warnShown) { WebGLMemory.warnShown = true; @@ -25,7 +35,7 @@ var LibraryWebGLMemory = { "Unable to get the `GMAN_webgl_memory` extension - webgl-memory.js hasn't been loaded yet?" ); } - return WebGLMemory.cstringify(WebGLMemory.addHeapSize({ + return WebGLMemory.cstringify(WebGLMemory.addExtraInfo({ memory: { buffer: 0, texture: 0,