ArrayBuffer cannot be used with webgl

Having problems with building or using CEF's C/C++ APIs? This forum is here to help. Please do not post bug reports or feature requests here.

ArrayBuffer cannot be used with webgl

Postby yanicks90 » Sun Nov 10, 2019 7:05 am

Hello

I am returning an array buffer from a function that I am then passing to gl.texImage2D. Doing this directly will not work:
Code: Select all
            const frame_data = fetch_raw_frame();
            gl.bindTexture(gl.TEXTURE_2D, texture);
            gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 352, 208, 0, gl.RGBA, gl.UNSIGNED_BYTE, new Uint8Array(frame_data));


This will block forever in gl.texImage2D (no error is returned and the function also never returns).

If I slightly modify my code to this:
Code: Select all
            const frame_data = fetch_raw_frame();
            const arr = new Uint8Array(frame_data);
            const slice = arr.slice(0, frame_data.byteLength);
            gl.bindTexture(gl.TEXTURE_2D, texture);
            gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 352, 208, 0, gl.RGBA, gl.UNSIGNED_BYTE, slice);


It works and the correct data is displayed.

The array buffer is created like this:
Code: Select all
    bool Execute(const CefString &name, CefRefPtr<CefV8Value> object, const CefV8ValueList &arguments, CefRefPtr<CefV8Value> &retval, CefString &exception) override {
        pthread_mutex_lock(_video_shmem_mutex);
        memcpy(_frame_data, _camera_frame_buffer, CAMERA_WIDTH * CAMERA_HEIGHT * 4);
        pthread_mutex_unlock(_video_shmem_mutex);

        retval = CefV8Value::CreateArrayBuffer(_frame_data, CAMERA_WIDTH * CAMERA_HEIGHT * 4, this);

        return true;
    }


Any ideas what could be causing this?

BR
Yanick
yanicks90
Techie
 
Posts: 19
Joined: Sat Oct 26, 2019 11:03 am

Re: ArrayBuffer cannot be used with webgl

Postby yanicks90 » Tue Nov 19, 2019 2:38 pm

Any idea on where to go from this? Is this a chromium bug? A CEF bug?
yanicks90
Techie
 
Posts: 19
Joined: Sat Oct 26, 2019 11:03 am

Re: ArrayBuffer cannot be used with webgl

Postby magreenblatt » Tue Nov 19, 2019 2:45 pm

It's hard to say as there are a lot of moving parts here. I would suggest making a local Chromium/CEF build and debugging the issue.
magreenblatt
Site Admin
 
Posts: 12382
Joined: Fri May 29, 2009 6:57 pm


Return to Support Forum

Who is online

Users browsing this forum: Google [Bot] and 43 guests