Skip to content

Use texture sharing instead of shared GL context #133

Closed

Description

@jdm

This would avoid #82 and give us fast WebGL rendering on macOS (per servo/servo#11138 (comment)), as well as the benefits described by servo/rust-webvr#54 (comment).

The root of the problem is that Servo used shared OpenGL contexts to share WebGL textures
instead of using texture primitives that could be shared among different threads/processes
without requiring a shared GL context (e.g. SurfaceTextures on Andriod, IOSurface on Mac, etc)

Activity

  1. paulrouget commented on Apr 8, 2019

    @paulrouget
    Contributor

    We also need a SurfaceTexture on Android.

  2. MortimerGoro commented on Apr 9, 2019

    @MortimerGoro
    Contributor

    For Firefox Reality immersive mode we need a SurfaceTexture on Android.

    I think this would be the approach for Servo immersive mode on Android:

    • Create a render target to a GL_EXTERNAL_TEXTURE_2D with its SurfaceTexture instead of a GL_TEXTURE_2D in Servo WebGLContext
    • WebRender should be updated to render using GL_EXTERNAL_TEXTURE_2D extension (for flat WebGL)
    • FxR can use the same SurfaceTexture for immersive mode. This works even if Servo is in another process so we don't need GL context sharing.

    In order to share the SurfaceTexture, we need to share the java instance, it's not enough with the OpenGL texture id:

    • The global SurfaceTexture can be attached to different GL_textures depending on the GL context where its bound (e.g. it can use glTexId 2 in Webrender GL context, but 4 in FxR render context)
    • The textureId/texName for a SurfaceTexture can be changed by calling attachToGLContext so we can only share the java object reliably
  3. MortimerGoro commented on Apr 9, 2019

    @MortimerGoro
    Contributor

    It would be nice to combine the shared textures with this: #131

  4. moved this to Done in WebGLon Jul 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    • Status
      Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions