engine
engine copied to clipboard
Investigate performance improvement by using invalidateFramebuffer
the WebGl2 function to be used: https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/invalidateFramebuffer
see "When to call glInvalidateFramebuffer?" section here https://community.arm.com/developer/tools-software/graphics/b/blog/posts/mali-performance-2-how-to-correctly-handle-framebuffers
see "Optimizing for tilers" section here: https://www.dropbox.com/s/89pvx9obhv6m0pk/High%20Quality,%20High%20Performance%20Graphics%20in%20Filament%20(Handout).pdf?dl=0
There are TWO MAJOR optimizations you MUST implement before you do ANYTHING else in your engine The first one of them is handling tiling GPUs properly
also see Camera section here: https://learn.unity.com/tutorial/optimizing-graphics-in-unity#5c7f8528edbc2a002053b5ab (sections: Discard and Restore buffer; Tile-based Rendering)
another reference:
invalidateFramebuffer Storing data that you won't use again can have high cost, particularly on tiled-rendering GPUs common on mobile. When you're done with the contents of a framebuffer attachment, use invalidateFramebuffer to discard the data, instead of leaving the driver to waste time storing the data for later use. DEPTH/STENCIL and/or multisampled attachments in particular are great candidates for invalidateFramebuffer.
https://developer.mozilla.org/en-US/docs/Web/API/WebGL_API/WebGL_best_practices
note, that there is an equivalent for a viewport, which we could use as well https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/invalidateSubFramebuffer
I consider this done. The viewport equivalent is not used, but this is rarely used path.