zwcloud / ImGui

Immediate Mode GUI for C#
https://zwcloud.net/#project/imgui
GNU Affero General Public License v3.0
197 stars 21 forks source link

Find a way to aviod copying buffer for `gl.bufferData` and `gl.texImage2D`. #14

Closed zwcloud closed 5 years ago

zwcloud commented 6 years ago

Investigate emscripten.

zwcloud commented 6 years ago

Possible solution 1 Use emscripten memory as an ArrayBufferView and access it from C# via mono/wasm.

Directly access emscripten memory as an ArrayBufferView is currently not directly impossible because it is blocked by kripken/emscripten#6747. A possible workaround is to re-get the ArrayBufferView from Module.HEAPF32.buffer:

if (Module.HEAPF32.buffer !== b) { b = Module.HEAPF32.buffer; view = ...; }

See the gitter archive on 2018/11/06 for details.

zwcloud commented 6 years ago

Possible solution 2 Create, write and read an ArrayBufferView from C# via mono/wasm.

See https://github.com/sq/FNA/blob/c3803c30fb3e96137d2a8f56e5128072bdb4281b/src/Platform/JSIL.cs#L60 Also, by kg

iirc they already have implementations of EA in spidermonkey and v8 that just aren't always enabled due to bugs.

zwcloud commented 6 years ago

using solution 1: https://github.com/zwcloud/ImGui/tree/ac30ace52cbf42d8d7798361c97f97b0816b25bf/templates/WebTemplate