WebXR on Cocoa platforms gets framebuffer texture targets via IOSurfaces. Those must be attached to ANGLE Pbuffers, which are then bound to GL textures. There is already some code in GraphicsContextGL (and in the CoreVideo classes) to do this, but this is an attempt to make a generic function that will handle all use cases.
<rdar://problem/78652783>
Created attachment 430106 [details] Patch
Comment on attachment 430106 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=430106&action=review > Source/WebCore/platform/graphics/cocoa/GraphicsContextGLOpenGLCocoa.mm:651 > + auto usageHintAngle = [&] () -> EGLint { > + if (usage == PbufferAttachmentUsage::Read) > + return EGL_IOSURFACE_READ_HINT_ANGLE; > + return EGL_IOSURFACE_WRITE_HINT_ANGLE; > + }(); Never both? > Source/WebCore/platform/graphics/opengl/GraphicsContextGLOpenGL.h:574 > + friend class WebXROpaqueFramebuffer; This is a layering violation. Platform level concepts should not be aware of things like WebXR. Why is this needed? Why not just make this public? > Source/WebCore/platform/graphics/opengl/GraphicsContextGLOpenGL.h:578 > + enum class PbufferAttachmentUsage { > + Read, > + Write > + }; I would put this all on one line.
Comment on attachment 430106 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=430106&action=review >> Source/WebCore/platform/graphics/cocoa/GraphicsContextGLOpenGLCocoa.mm:651 >> + }(); > > Never both? Good point. I'll check if ANGLE handles that and add it if so. >> Source/WebCore/platform/graphics/opengl/GraphicsContextGLOpenGL.h:574 >> + friend class WebXROpaqueFramebuffer; > > This is a layering violation. Platform level concepts should not be aware of things like WebXR. Why is this needed? Why not just make this public? Duh, of course. Yeah, I'll make them public. >> Source/WebCore/platform/graphics/opengl/GraphicsContextGLOpenGL.h:578 >> + }; > > I would put this all on one line. ok!
Created attachment 430146 [details] Patch
Committed r278260 (238297@main): <https://commits.webkit.org/238297@main>