Hi, 

Please find attached a first patch to add WebGL support for WebKitDFB.

The patch should compile for both pure DirectFB and cairo-dfb versions
for targets supporting Open GL ES 2.0 on top of IDirectFBGL.
It has however been tested only on Intel CE.

Note to Intel CE SDK users: It actually runs on a slightly modified
IDirectFBGL implementation (by default, the IDirectFBGL context is bound
to the Open GL ES 1.1 Api, as stated here
http://old.nabble.com/Re%3A-IDirectFBGL---what-are-the-use-cases--p28736
159.html). I won't post a patch here, but the modification is really
straightforward.

Regarding the implementation itself, I am not completely satisfied, but
as a proof-of-concept, it works. Let me explain:
In WebKit, the WebGL canvas can be rendered using two paths: 
- the software path copies the 3D content to an image buffer that is
later composited with the backing store
- the hardware path renders directly the 3D content to a native surface
that is composited with the backing store.
My understanding today is that following the hardware path in a clean
way would require enabling the ACCELERATED_COMPOSITING for the whole
WebKitDFB, which would be nice, but not that easy.
On the other hand, following the software path leads to poor
performances, as once the 3D rendering has been done, it takes two more
blits to have it on screen (through a pixman buffer if you use cairo-dfb
!).
So, I decided to go for a compromise: I use the software path, but I
modified the code initializing the image buffer so that it actually
wraps a directfb surface used as a 3D offscreen buffer (thus it only
requires a single blit betwen two directfb surfaces to have it on
screen).

The following WebGL samples work without any modification:

http://learningwebgl.com/lessons/lesson04
http://learningwebgl.com/lessons/lesson05
http://learningwebgl.com/lessons/lesson06
http://learningwebgl.com/lessons/lesson09

I experienced crashes with the other examples, but I managed to have
some of them run with little modifications around float precision and
texture loading (I will investigate more on this).

Not tested:
- dynamically resize canvas
- display multiple canvas on the same page.

Cheers

David Corvoysier
France Telecom / Orange Labs

 <<WebKitDFB-WebGL.bz2>>  

Attachment: WebKitDFB-WebGL.bz2
Description: WebKitDFB-WebGL.bz2

_______________________________________________
directfb-dev mailing list
directfb-dev@directfb.org
http://mail.directfb.org/cgi-bin/mailman/listinfo/directfb-dev

Reply via email to