Forked from
The Tor Project / Applications / Tor Browser
Source project has a limited visibility.
-
Lee Salzman authored
Now that each DrawTargetWebgl shares the same WebGL context, we can efficiently draw snapshots of one DrawTargetWebgl to another without requiring any readback or error-prone driver-provided shared context/resource mechanism. We just need to simply pass the WebGL texture from one target to the other, and use it like any other texture. This provides SourceSurfaceWebgl to store and pass along that WebGL texture. It is largely modeled off of SourceSurfaceSkia in terms of its copy-on-write behavior. There are three noteworthy state changes that it must track from DrawTargetWebgl - when the framebuffer contents is changing, when the framebuffer is being destroyed, and when any cached texture handle separate from a framebuffer is also being destroyed. It will copy, orphan, or read back data as appropriate to handle each case. If it needs to be mapped, it just forces a read back of the data into a CPU surface that can be mapped as requested. Differential Revision: https://phabricator.services.mozilla.com/D138118
Lee Salzman authoredNow that each DrawTargetWebgl shares the same WebGL context, we can efficiently draw snapshots of one DrawTargetWebgl to another without requiring any readback or error-prone driver-provided shared context/resource mechanism. We just need to simply pass the WebGL texture from one target to the other, and use it like any other texture. This provides SourceSurfaceWebgl to store and pass along that WebGL texture. It is largely modeled off of SourceSurfaceSkia in terms of its copy-on-write behavior. There are three noteworthy state changes that it must track from DrawTargetWebgl - when the framebuffer contents is changing, when the framebuffer is being destroyed, and when any cached texture handle separate from a framebuffer is also being destroyed. It will copy, orphan, or read back data as appropriate to handle each case. If it needs to be mapped, it just forces a read back of the data into a CPU surface that can be mapped as requested. Differential Revision: https://phabricator.services.mozilla.com/D138118