[webkit-changes] [WebKit/WebKit] 42e826: [WebXR] Refactor WebXROpaqueFramebuffer attachment...

Dan Glastonbury noreply at github.com
Thu Mar 28 23:15:54 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 42e826978f5dd46198a2fc437b42fdbe1e14fd56
      https://github.com/WebKit/WebKit/commit/42e826978f5dd46198a2fc437b42fdbe1e14fd56
  Author: Dan Glastonbury <djg at apple.com>
  Date:   2024-03-28 (Thu, 28 Mar 2024)

  Changed paths:
    M LayoutTests/TestExpectations
    M LayoutTests/platform/gtk/TestExpectations
    M LayoutTests/platform/wpe/TestExpectations
    M Source/ThirdParty/ANGLE/doc/ExtensionSupport.md
    M Source/ThirdParty/ANGLE/include/GLES2/gl2ext_angle.h
    M Source/ThirdParty/ANGLE/include/platform/autogen/FeaturesMtl_autogen.h
    M Source/ThirdParty/ANGLE/include/platform/mtl_features.json
    M Source/ThirdParty/ANGLE/scripts/generate_entry_points.py
    M Source/ThirdParty/ANGLE/scripts/gl_angle_ext.xml
    M Source/ThirdParty/ANGLE/scripts/registry_xml.py
    M Source/ThirdParty/ANGLE/src/common/entry_points_enum_autogen.cpp
    M Source/ThirdParty/ANGLE/src/common/entry_points_enum_autogen.h
    M Source/ThirdParty/ANGLE/src/common/frame_capture_utils_autogen.cpp
    M Source/ThirdParty/ANGLE/src/common/frame_capture_utils_autogen.h
    M Source/ThirdParty/ANGLE/src/common/gl_enum_utils_autogen.cpp
    M Source/ThirdParty/ANGLE/src/libANGLE/Context.cpp
    M Source/ThirdParty/ANGLE/src/libANGLE/Context_gles_ext_autogen.h
    M Source/ThirdParty/ANGLE/src/libANGLE/State.cpp
    M Source/ThirdParty/ANGLE/src/libANGLE/State.h
    M Source/ThirdParty/ANGLE/src/libANGLE/capture/capture_gles_ext_autogen.cpp
    M Source/ThirdParty/ANGLE/src/libANGLE/capture/capture_gles_ext_autogen.h
    M Source/ThirdParty/ANGLE/src/libANGLE/gles_extensions_autogen.cpp
    M Source/ThirdParty/ANGLE/src/libANGLE/gles_extensions_autogen.h
    M Source/ThirdParty/ANGLE/src/libANGLE/renderer/ContextImpl.cpp
    M Source/ThirdParty/ANGLE/src/libANGLE/renderer/ContextImpl.h
    M Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/StateManagerGL.cpp
    M Source/ThirdParty/ANGLE/src/libANGLE/renderer/metal/ContextMtl.h
    M Source/ThirdParty/ANGLE/src/libANGLE/renderer/metal/ContextMtl.mm
    M Source/ThirdParty/ANGLE/src/libANGLE/renderer/metal/DisplayMtl.h
    M Source/ThirdParty/ANGLE/src/libANGLE/renderer/metal/DisplayMtl.mm
    M Source/ThirdParty/ANGLE/src/libANGLE/renderer/metal/ImageMtl.mm
    M Source/ThirdParty/ANGLE/src/libANGLE/renderer/metal/SurfaceMtl.mm
    M Source/ThirdParty/ANGLE/src/libANGLE/renderer/metal/mtl_command_buffer.h
    M Source/ThirdParty/ANGLE/src/libANGLE/renderer/metal/mtl_command_buffer.mm
    M Source/ThirdParty/ANGLE/src/libANGLE/renderer/metal/mtl_common.h
    M Source/ThirdParty/ANGLE/src/libANGLE/renderer/metal/mtl_render_utils.mm
    M Source/ThirdParty/ANGLE/src/libANGLE/renderer/vulkan/ContextVk.cpp
    M Source/ThirdParty/ANGLE/src/libANGLE/validationEGL.cpp
    M Source/ThirdParty/ANGLE/src/libANGLE/validationES.cpp
    M Source/ThirdParty/ANGLE/src/libANGLE/validationES2.cpp
    M Source/ThirdParty/ANGLE/src/libANGLE/validationES32.cpp
    M Source/ThirdParty/ANGLE/src/libANGLE/validationESEXT_autogen.h
    M Source/ThirdParty/ANGLE/src/libGLESv2/entry_points_gles_ext_autogen.cpp
    M Source/ThirdParty/ANGLE/src/libGLESv2/entry_points_gles_ext_autogen.h
    M Source/ThirdParty/ANGLE/src/libGLESv2/libGLESv2_autogen.cpp
    M Source/ThirdParty/ANGLE/src/libGLESv2/libGLESv2_autogen.def
    M Source/ThirdParty/ANGLE/src/libGLESv2/libGLESv2_no_capture_autogen.def
    M Source/ThirdParty/ANGLE/src/libGLESv2/libGLESv2_vulkan_secondaries_autogen.def
    M Source/ThirdParty/ANGLE/src/libGLESv2/libGLESv2_with_capture_autogen.def
    M Source/ThirdParty/ANGLE/src/libGLESv2/opengl32_autogen.def
    M Source/ThirdParty/ANGLE/src/libGLESv2/opengl32_with_wgl_autogen.def
    M Source/ThirdParty/ANGLE/src/libGLESv2/proc_table_egl_autogen.cpp
    M Source/ThirdParty/ANGLE/src/libGLESv2/proc_table_glx_autogen.cpp
    M Source/ThirdParty/ANGLE/src/libGLESv2/proc_table_wgl_autogen.cpp
    M Source/ThirdParty/ANGLE/src/tests/angle_end2end_tests.gni
    M Source/ThirdParty/ANGLE/util/autogen/angle_features_autogen.cpp
    M Source/ThirdParty/ANGLE/util/autogen/angle_features_autogen.h
    M Source/ThirdParty/ANGLE/util/capture/frame_capture_replay_autogen.cpp
    M Source/ThirdParty/ANGLE/util/capture/trace_gles_loader_autogen.cpp
    M Source/ThirdParty/ANGLE/util/capture/trace_gles_loader_autogen.h
    M Source/ThirdParty/ANGLE/util/capture/trace_interpreter_autogen.cpp
    M Source/ThirdParty/ANGLE/util/gles_loader_autogen.cpp
    M Source/ThirdParty/ANGLE/util/gles_loader_autogen.h
    M Source/WebCore/Modules/webxr/WebXROpaqueFramebuffer.cpp
    M Source/WebCore/Modules/webxr/WebXROpaqueFramebuffer.h
    M Source/WebCore/Modules/webxr/WebXRWebGLLayer.cpp
    M Source/WebCore/Modules/webxr/WebXRWebGLLayer.h
    M Source/WebCore/PAL/pal/spi/cocoa/MetalSPI.h
    M Source/WebCore/platform/graphics/GraphicsContextGL.h
    M Source/WebCore/platform/graphics/GraphicsTypesGL.h
    M Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLE.cpp
    M Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLE.h
    M Source/WebCore/platform/graphics/cocoa/ANGLEUtilitiesCocoa.h
    M Source/WebCore/platform/graphics/cocoa/ANGLEUtilitiesCocoa.mm
    M Source/WebCore/platform/graphics/cocoa/GraphicsContextGLCocoa.h
    M Source/WebCore/platform/graphics/cocoa/GraphicsContextGLCocoa.mm
    M Source/WebCore/platform/graphics/gbm/GraphicsContextGLGBM.cpp
    M Source/WebCore/platform/graphics/gbm/GraphicsContextGLGBM.h
    M Source/WebCore/platform/graphics/texmap/GraphicsContextGLTextureMapperANGLE.cpp
    M Source/WebCore/platform/graphics/texmap/GraphicsContextGLTextureMapperANGLE.h
    M Source/WebCore/platform/xr/PlatformXR.h
    M Source/WebCore/platform/xr/openxr/OpenXRLayer.cpp
    M Source/WebCore/platform/xr/openxr/OpenXRSwapchain.h
    M Source/WebCore/testing/WebFakeXRDevice.cpp
    M Source/WebKit/GPUProcess/graphics/RemoteGraphicsContextGL.cpp
    M Source/WebKit/GPUProcess/graphics/RemoteGraphicsContextGL.h
    M Source/WebKit/GPUProcess/graphics/RemoteGraphicsContextGL.messages.in
    M Source/WebKit/GPUProcess/graphics/RemoteGraphicsContextGLFunctionsGenerated.h
    M Source/WebKit/Scripts/webkit/messages.py
    M Source/WebKit/Shared/XR/PlatformXR.serialization.in
    M Source/WebKit/WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.cpp
    M Source/WebKit/WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.h
    M Source/WebKit/WebProcess/GPU/graphics/RemoteGraphicsContextGLProxyFunctionsGenerated.cpp
    M Source/WebKit/WebProcess/GPU/graphics/cocoa/RemoteGraphicsContextGLProxyCocoa.mm
    M Tools/Scripts/generate-gpup-webgl

  Log Message:
  -----------
  [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



To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications


More information about the webkit-changes mailing list