-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[WebXR] Refactor WebXROpaqueFramebuffer attachment logic
https://bugs.webkit.org/show_bug.cgi?id=269683 rdar://123201364 Reviewed by Tim Horton. Patches are from Dan and I added some small bug fixes. Refactor WebXROpaqueFramebuffer handling of framebuffer attachments to support Shared or Layered layout. There are a few combinations of context attributes that WebXROpaqueFramebuffer handles: if `antialias`: Create internal MSAA color buffer if `depth/stencil` Create internal MSAA depth/stencil buffer if `!antialias`: Draw to externally provided color texture if `depth/stencil` if `!externally provided depth/stencil` Create internal depth/stencil buffer Prior to this change, the code handled these combinations in `StartFrame(...)` & `SetupFramebuffer(...)` with a loose collection of state. This change simplifies the old assumption, dropping support for external Textures, standardizing on Renderbuffers, and introduces helpers for keeping related state together via `WebXRExternalRenderbuffer` and `WebXRAttachmentSet`. WebXRExternalRenderbuffer represents an externally provided Renderbuffer through the OpenGL renderbuffer object and EGLImage pointer. WebXRAttachmentSet represents a group of related color, depth and stencil buffers. These can be "internal" or "external" via `WebXRAttachments` & `WebXRExternalAttachments`. Object naming has been changed to consistently use `draw` for the target of WebGL rendering commands and `display` for the target presented to the user via a WebXR compositor system. To simplify the handling of attachments, the output of WebGL commands are always "blitted" from the draw target to display target, removing the optimal path in the previous code. This path will not be taken on any compositors supported on Cocoa and will be redressed in a future patch. Due to limitations of `glBlitFramebuffer`, blitting to `Layered` layout from an MSAA enabled attachment set requires the use of an intermediate, resolved path represented by the `resolve` prefixed `m_resolvedAttachments` & `m_resolveFBO`. * Source/WebCore/Modules/webxr/WebXROpaqueFramebuffer.cpp: (WebCore::ensure): (WebCore::createAndBindCompositorBuffer): (WebCore::WebXROpaqueFramebuffer::WebXROpaqueFramebuffer): (WebCore::WebXROpaqueFramebuffer::~WebXROpaqueFramebuffer): (WebCore::WebXROpaqueFramebuffer::startFrame): (WebCore::WebXROpaqueFramebuffer::endFrame): (WebCore::WebXROpaqueFramebuffer::resolveMSAAFramebuffer): (WebCore::WebXROpaqueFramebuffer::blitShared): (WebCore::WebXROpaqueFramebuffer::blitSharedToLayered): (WebCore::WebXROpaqueFramebuffer::setupFramebuffer): (WebCore::WebXROpaqueFramebuffer::allocateRenderbufferStorage): (WebCore::WebXROpaqueFramebuffer::allocateAttachments): (WebCore::WebXROpaqueFramebuffer::bindAttachments): (WebCore::WebXRExternalRenderbuffer::destroyImage): (WebCore::WebXRExternalRenderbuffer::release): (WebCore::WebXRExternalRenderbuffer::leakObject): (WebCore::createAndBindCompositorTexture): Deleted. (WebCore::WebXROpaqueFramebuffer::allocateColorStorage): Deleted. (WebCore::WebXROpaqueFramebuffer::allocateDepthStencilStorage): Deleted. (WebCore::WebXROpaqueFramebuffer::bindColorBuffer): Deleted. (WebCore::WebXROpaqueFramebuffer::bindDepthStencilBuffer): Deleted. * Source/WebCore/Modules/webxr/WebXROpaqueFramebuffer.h: (WebCore::WebXRAttachmentSet::release): (WebCore::WebXRAttachmentSet::leakObject): (WebCore::WebXROpaqueFramebuffer::framebuffer const): * Source/WebCore/platform/graphics/GraphicsContextGL.h: (WebCore::destroyFunc): * Source/WebCore/platform/xr/PlatformXR.h: * Source/WebKit/Shared/XR/PlatformXR.serialization.in: * Source/WebKit/UIProcess/XR/ios/PlatformXRARKit.mm: (WebKit::ARKitCoordinator::renderLoop): Metal: Override internal format of images Add support for overriding the internal format when binding Metal textures to EGL images. Fixed: angleproject:8552 Change-Id: I364a88a2e608e462c5216c92927679814ab91ca5 The following changes make blitting work. * Source/WebCore/Modules/webxr/WebXROpaqueFramebuffer.cpp: (WebCore::createAndBindCompositorBuffer): (WebCore::WebXROpaqueFramebuffer::startFrame): * Source/WebCore/platform/graphics/GraphicsContextGL.h: * Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLE.cpp: (WebCore::GraphicsContextGLANGLE::createAndBindEGLImage): * Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLE.h: * Source/WebCore/platform/graphics/cocoa/GraphicsContextGLCocoa.h: * Source/WebCore/platform/graphics/cocoa/GraphicsContextGLCocoa.mm: (WebCore::GraphicsContextGLCocoa::createAndBindEGLImage): * Source/WebKit/GPUProcess/graphics/RemoteGraphicsContextGL.cpp: (WebKit::RemoteGraphicsContextGL::createAndBindEGLImage): * Source/WebKit/GPUProcess/graphics/RemoteGraphicsContextGL.h: * Source/WebKit/GPUProcess/graphics/RemoteGraphicsContextGL.messages.in: * Source/WebKit/WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.cpp: (WebKit::RemoteGraphicsContextGLProxy::createAndBindEGLImage): * Source/WebKit/WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.h: * Source/WebKit/WebProcess/GPU/graphics/cocoa/RemoteGraphicsContextGLProxyCocoa.mm: Helper utilites for creating, enabled and disabling the use of rasterization rate maps in GPUP. Infrastructure inplace to support caching of map for Shared and Layered layouts, but only Shared is currently supported. * Source/WebCore/PAL/pal/spi/cocoa/MetalSPI.h: * Source/WebCore/platform/graphics/GraphicsContextGL.h: * Source/WebCore/platform/graphics/GraphicsTypesGL.h: * Source/WebCore/platform/graphics/cocoa/ANGLEUtilitiesCocoa.h: * Source/WebCore/platform/graphics/cocoa/ANGLEUtilitiesCocoa.mm: (WebCore::newRasterizationRateMap): * Source/WebCore/platform/graphics/cocoa/GraphicsContextGLCocoa.h: * Source/WebCore/platform/graphics/cocoa/GraphicsContextGLCocoa.mm: (WebCore::GraphicsContextGLCocoa::createFoveation): (WebCore::GraphicsContextGLCocoa::enableFoveation): (WebCore::GraphicsContextGLCocoa::disableFoveation): * Source/WebKit/GPUProcess/graphics/RemoteGraphicsContextGL.messages.in: * Source/WebKit/GPUProcess/graphics/RemoteGraphicsContextGLFunctionsGenerated.h: (createFoveation): (enableFoveation): (disableFoveation): * Source/WebKit/Scripts/webkit/messages.py: (types_that_cannot_be_forward_declared): (headers_for_type): * Source/WebKit/WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.h: * Source/WebKit/WebProcess/GPU/graphics/RemoteGraphicsContextGLProxyFunctionsGenerated.cpp: (WebKit::RemoteGraphicsContextGLProxy::createFoveation): (WebKit::RemoteGraphicsContextGLProxy::enableFoveation): (WebKit::RemoteGraphicsContextGLProxy::disableFoveation): * Tools/Scripts/generate-gpup-webgl: Refactor setup logic to be passed once. WebXROpaqueFramebuffer::setupFramebuffer should extract the necessary data to create framebuffers from the information provided in PlatformXR::FrameData::LayerSetupData. Changed WebXRWebGLLayer to query WebXROpaqueFramebuffer for the viewport, since WebXRWebGLLayer has no knowledge of the structure of the layout, dimensions, etc. Canonical link: https://commits.webkit.org/276825@main
- Loading branch information
1 parent
8af90c0
commit 42e8269
Showing
95 changed files
with
1,227 additions
and
225 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.