Skip to content
Snippets Groups Projects
Forked from The Tor Project / Applications / Tor Browser
Source project has a limited visibility.
  • Lee Salzman's avatar
    58cc63bd
    Bug 1754130 - Implement SourceSurfaceWebgl for faster snapshots of DrawTargetWebgl. r=aosmond · 58cc63bd
    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
    58cc63bd
    History
    Bug 1754130 - Implement SourceSurfaceWebgl for faster snapshots of DrawTargetWebgl. r=aosmond
    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