You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.
We should move the extrusion texture step to the beginning of a frame to improve rendering performance.
Right now, the workflow of a frame is like this:
(main framebuffer is bound)
Clear main framebuffer (✅ first operation is clear -> no restore)
Render some layers
Render extrusion layer
Bind extrusions framebuffer
Clear extrusions framebuffer (✅ first operation is clear -> no restore)
Draw extrusions
Bind main framebuffer
Draw extrusions texture (:warning: FBO restore)
Render remaining layers
When binding a framebuffer and rendering operations on it, the GPU has to restore the contents of the framebuffer. The driver can optimize that when we do a clear as the first drawing operation (since that discards the contents of the framebuffer). Therefore, drawing to the main framebuffer, then binding a different framebuffer, and rebinding the main framebuffer triggers a framebuffer load on the first draw call.
Instead, we could do all operations that require binding a separate framebuffer (i.e. drawing the extrusions texture) as the first thing when rendering a frame (i.e. before calling clear on the main framebuffer) and have the following order:
(main framebuffer is bound)
Create extrusion texture
Bind extrusions framebuffer
Clear extrusions framebuffer (✅ first operation is clear -> no restore)
Draw extrusions
Bind main framebuffer
Clear main framebuffer (✅ first operation is clear -> no restore)
Render some layers
Render extrusion texture
Render remaining layers
In addition to that, the iOS OpenGL inspector reports these issues when drawing extrusions:
Depth testing enabled without an attached depth buffer: Your app rendered with DEPTH_TEST enabled into a framebuffer without an attached depth buffer.
Missing framebuffer attachments: Framebuffer Lines #2 has no attachments and therefore is not usable in its current state.
This sounds good. The one tradeoff here is that we may need to create and store multiple OffscreenTextures if there are multiple extrusion layers, but it sounds like the benefits here outweigh that.
We should move the extrusion texture step to the beginning of a frame to improve rendering performance.
Right now, the workflow of a frame is like this:
When binding a framebuffer and rendering operations on it, the GPU has to restore the contents of the framebuffer. The driver can optimize that when we do a clear as the first drawing operation (since that discards the contents of the framebuffer). Therefore, drawing to the main framebuffer, then binding a different framebuffer, and rebinding the main framebuffer triggers a framebuffer load on the first draw call.
Instead, we could do all operations that require binding a separate framebuffer (i.e. drawing the extrusions texture) as the first thing when rendering a frame (i.e. before calling clear on the main framebuffer) and have the following order:
In addition to that, the iOS OpenGL inspector reports these issues when drawing extrusions:
These two errors may be the reason for #9279
The text was updated successfully, but these errors were encountered: