Hongbo, Thank you for review.
On 2014/10/14 02:27:48, Hongbo Min wrote:
> According to my previous work, an attempt to clear a framebuffer on
tiled GPU
> is time-consuming, if glDiscardFramebuffer is used, it gives a
performance hint
> and allow GPU driver to set the pixel vale to whatever it wishes, and
the
> glClear could be skipped (I have verified it on ASUS Nexus series, it
works well
> without glClear if glDiscardFramebuffer is used).
As far as I understand, your CL didn't affect whether glClear is skipped
or not. WebGLRenderingContextBase::clearIfComposited still do glClear
every frame.
Let me explain why your CL speed up in tiled-based GPU as I understand.
When binding another fbo, tiled-based GPU must stores tiled cache to gpu
memory (texture, stencil buffer and depth buffer). glDiscardFramebuffer
hints GPU to not read back tiled cache to gpu memory because the
software don't need anymore the changed fbo information. It saves huge
gpu bandwidth.
Let's go back to your CL. The fbo lifecycle is as follows:
1. WebGL replaces color texture to front fbo. At that time, you hint
glDiscardFramebuffer because DrawingBuffer doesn't update fbo so you
don't want to copy tiled cache to color texture redundantly. It wastes
bandwidth.
2. Something later, WebGLRenderingContextBase::clearIfComposited
performs glClear on the fbo.
My CL is the same to your WebGL CL. This code just bind fbo and replace
color texture, so we don't want to copy back tiled cache to color
texture redundantly. glDiscardFramebuffer can make it.
> So my question is, where is glClear called to clear
> |offscreen_target_frame_buffer_| and prepare a new frame? and can we
skip that
> glClear if have?
As I explain above, glClear is not related to glDiscardFramebuffer.
https://codereview.chromium.org/651863002/