RESOLVED FIXED 227245
Add support for MTLSharedTextures in WebXR
https://bugs.webkit.org/show_bug.cgi?id=227245
Summary Add support for MTLSharedTextures in WebXR
Dean Jackson
Reported 2021-06-21 19:21:15 PDT
Sometimes the IOSurface sent for WebXR is a MTLSharedTexture, which means it can't be treated like a regular single-plane IOSurface. Using the fix for 226690, we should be able to create a MTLTexture object from the IOSurface and bind that to a GL texture.
Attachments
Patch (11.14 KB, patch)
2021-06-21 19:45 PDT, Dean Jackson
thorton: review+
ews-feeder: commit-queue-
EWS test (11.83 KB, patch)
2021-06-25 13:41 PDT, Dean Jackson
ews-feeder: commit-queue-
EWS test 2 (11.87 KB, patch)
2021-06-25 13:56 PDT, Dean Jackson
no flags
Radar WebKit Bug Importer
Comment 1 2021-06-21 19:21:25 PDT
Dean Jackson
Comment 2 2021-06-21 19:45:12 PDT
Ada Chan
Comment 3 2021-06-21 20:58:47 PDT
Comment on attachment 431940 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=431940&action=review > Source/WebCore/Modules/webxr/WebXROpaqueFramebuffer.cpp:143 > + auto size = data.surface->size(); Should we still do the size check for the single plane IOSurface case? > Source/WebCore/Modules/webxr/WebXROpaqueFramebuffer.cpp:198 > + gCGL->destroyPbufferAndDetachIOSurface(m_ioSurfaceTextureHandle); Should we set m_ioSurfaceTextureHandle to null and m_ioSurfaceTextureHandleIsShared to false after?
Dean Jackson
Comment 4 2021-06-22 12:45:11 PDT
Comment on attachment 431940 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=431940&action=review >> Source/WebCore/Modules/webxr/WebXROpaqueFramebuffer.cpp:143 >> + auto size = data.surface->size(); > > Should we still do the size check for the single plane IOSurface case? Yeah - good point. I'll put it back in. >> Source/WebCore/Modules/webxr/WebXROpaqueFramebuffer.cpp:198 >> + gCGL->destroyPbufferAndDetachIOSurface(m_ioSurfaceTextureHandle); > > Should we set m_ioSurfaceTextureHandle to null and m_ioSurfaceTextureHandleIsShared to false after? Agreed. Ultimately we should have a class that wraps these handles and calls the correct destroyer. I started on that but got annoyed that I'd have to keep a reference to the GraphicsContextGL as well as the handle.
Dean Jackson
Comment 5 2021-06-25 13:41:18 PDT
Created attachment 432288 [details] EWS test
Dean Jackson
Comment 6 2021-06-25 13:56:25 PDT
Created attachment 432289 [details] EWS test 2
Dean Jackson
Comment 7 2021-06-25 15:07:09 PDT
Note You need to log in before you can comment on or make changes to this bug.