Refactor VideoTextureCopier to be specific to a particular GraphicsContextGL and polymorphic to it VideoTextureCopierCV VideoTextureCopierGStreamer Solves two problems: 1) No reason to create copier per media object -> If context is lost, media object caches stale converter?' -> Creates conversion shaders per media object, not per graphics context 2) Not possible to create remote version of this -> Need to refactor before being able to not use GraphicsContextGLOpenGL Should be: GraphicsContectGL::copyImageToPlatformTexture GraphicsContextGL::copyVideoTextureToPlatformTexture OR GraphicsContectGL::getVideoTextureCopier
<rdar://problem/69876433>
This is needed for web process video drawing to web process webgl canvas after WebGL is using GraphicsContextGL interface. This is needed for web process video drawing to remote webgl canvas (transitional feature).
Created attachment 412520 [details] Patch
Created attachment 413789 [details] Patch
Comment on attachment 413789 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=413789&action=review > Source/WebCore/platform/graphics/GraphicsContextGL.h:1300 > + virtual GraphicsContextGLCV* asCV() = 0; I wonder if we should just expose copyPixelBufferToTexture on GraphicsContextGL directly, and have the context keep the GraphicsContextGLCV class for internal use?
Comment on attachment 413789 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=413789&action=review >> Source/WebCore/platform/graphics/GraphicsContextGL.h:1300 >> + virtual GraphicsContextGLCV* asCV() = 0; > > I wonder if we should just expose copyPixelBufferToTexture on GraphicsContextGL directly, and have the context keep the GraphicsContextGLCV class for internal use? So the idea here is that there could be GraphicsContextGLGStreamer interface for GStreamer specific things, like GStreamer specific copyGStreamerImageToTexture(somespecificaparameters). Also if some day there is other platforms with other APIs, those could have their own interface. This way we solve: - avoid having union of all needed parameters in the method calls. E.g. GStreamer has "image orientation" to be passed, where as Cocoa does not have that. - avoid having empty functions for platforms not needing a certain function - avoid having PlatformNativePixelBuffer typedef abstractions that may conflict (e.g. some platforms might have two such abstractions, other platform might have only one).
So wrt what we talked off-line about ExtensionsGL, GraphicsContextGLCV is the concept of ExtensionsGL done in a way (that I think) probably originally was sort-of envisioned.
And to elaborate: In case we want a generic function call, and eventually we probably should want it, we should add copyImageBufferToTexture() call, and extend the WebCore::ImageBuffer abstraction so that native video objects can be wrapped into the ImageBuffer. Similar to eventually we should make GraphicsContextGL to draw to WebCore::ImageBuffer, so that then we can draw WebGL context to WebGL context in generic way by drawing ImageBuffer to the WebGL context
Committed r269678: <https://trac.webkit.org/changeset/269678> All reviewed patches have been landed. Closing bug and clearing flags on attachment 413789 [details].
Sounds good!