Electron/Chorimum: texImage2D and putImageData freeze renderer

Viewed 157

We have a native C++ add-on running in an Electron renderer process providing Uint8Array bitmap data to JavaScript where it is painted into a canvas via textImage2D in a webgl context or putImageData in a 2d context.

The Uint8Array is allocated in the native addon and passed via a callback to JS. It is not deallocated immediately after the callback ends, and is kept in a memory pool that holds the last 10 frames sent to be available for async painting.

If the array is passed as is to putImageData or texImage2D, the renderer completely freezes. If it is copied into a new TypedArray beforehand, there is no problem, but we would like to avoid the extra copy operation, hence the memory pool.

I have a feeling the freezing is related to the way Chromium handles GL commands via it's command buffer.

I've tried the following Chromimum command line args in an attempt to isolate the issue, with no luck - renderer process is frozen when the array is not copied beforehand):

  • --use-passthrough-cmd-decoder results in longer render times for 2d, and a null context for webgl
  • --disable-gpu-sandbox does nothing
  • --in-process-gpu does nothing

Any idea what is happening?

0 Answers
Related