Cost of FULL_ES2

104 views
Skip to first unread message

Max Savenkov

unread,
May 9, 2014, 3:54:13 AM5/9/14
to emscripte...@googlegroups.com
I'm wondering, how huge is the cost of FULL_ES2 emulation. I'm porting a 2D library that relies on old Vertex Arrays and I was using this switch to make it work at all. Then, I decided to write a path that uses VBOs instead, and after some experimentation, got it to work and removed FULL_ES2 from compilation. But I'm not seeing any FPS improvement at all. So, before I delve further into library's code, I wanted to know, if Vertex Arrays emulation costs anything at all. Maybe I should just leave FULL_ES2 switch in and not waste my time on alternate path?

Jukka Jylänki

unread,
May 9, 2014, 5:07:11 AM5/9/14
to emscripte...@googlegroups.com
The answer is, like usual, "it depends".

What the FULL_ES2 emulation does is it allows the user code to render from CPU-side memory arrays. When you do glDrawArrays/Elements while having such arrays bound, the emulation will create its own VBOs under the hood, upload the CPU-side data to the VBO (with glBufferData/glBufferSubData), and then render that.

As a result, this means that every draw call from CPU memory results in a full reupload of that memory to GPU before drawing, and that is the performance hit.

If you are rendering static geometry that could only be updated once and then rendered multiple times, then the emulation path cannot know and take advantage of that, and you could do less work by manual VBO management. On the other hand, if you are rendering dynamic geometry that needs to be uploaded to GPU each frame anyways, then chances are that the difference will be very small.

Generally we would definitely recommend avoiding FULL_ES2 whenever possible. One way to estimate the impact before having written the port is to use a browser profiler to measure how much time is being spent in the GL context bufferData & bufferSubData functions - those should be where the most of the added cost comes from, assuming that you could avoid redundant buffer uploads if you used VBOs manually in the code.

   Jukka



2014-05-09 10:54 GMT+03:00 Max Savenkov <max.sa...@gmail.com>:
I'm wondering, how huge is the cost of FULL_ES2 emulation. I'm porting a 2D library that relies on old Vertex Arrays and I was using this switch to make it work at all. Then, I decided to write a path that uses VBOs instead, and after some experimentation, got it to work and removed FULL_ES2 from compilation. But I'm not seeing any FPS improvement at all. So, before I delve further into library's code, I wanted to know, if Vertex Arrays emulation costs anything at all. Maybe I should just leave FULL_ES2 switch in and not waste my time on alternate path?

--
You received this message because you are subscribed to the Google Groups "emscripten-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to emscripten-disc...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

MaxEd

unread,
May 9, 2014, 1:21:45 PM5/9/14
to emscripte...@googlegroups.com
OK, then it's obvious why I'm not seeing any improvement in FPS. This 2D library reuploads all buffers every frame by default.

09.05.2014 13:07, Jukka Jylänki пишет:
You received this message because you are subscribed to a topic in the Google Groups "emscripten-discuss" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/emscripten-discuss/UFFoDp7hgXo/unsubscribe.
To unsubscribe from this group and all its topics, send an email to emscripten-disc...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages