[webkit-changes] [WebKit/WebKit] a220e6: WebGL readPixels target memory is copied to GPUP a...

Kimmo Kinnunen noreply at github.com
Mon Jun 5 04:51:39 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: a220e6ed62d7c98a37183d3aa89fa5282fab9a08
      https://github.com/WebKit/WebKit/commit/a220e6ed62d7c98a37183d3aa89fa5282fab9a08
  Author: Kimmo Kinnunen <kkinnunen at apple.com>
  Date:   2023-06-05 (Mon, 05 Jun 2023)

  Changed paths:
    M Source/WebCore/Headers.cmake
    M Source/WebCore/WebCore.xcodeproj/project.pbxproj
    M Source/WebCore/html/canvas/WebGL2RenderingContext.cpp
    M Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp
    M Source/WebCore/platform/graphics/GraphicsContextGL.h
    M Source/WebCore/platform/graphics/PixelBufferConversion.cpp
    M Source/WebCore/platform/graphics/PixelBufferConversion.h
    M Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLE.cpp
    M Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLE.h
    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/WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.cpp
    M Source/WebKit/WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.h
    M Source/WebKit/WebProcess/GPU/graphics/RemoteGraphicsContextGLProxyFunctionsGenerated.cpp
    M Tools/Scripts/generate-gpup-webgl
    M Tools/TestWebKitAPI/Tests/WebCore/cocoa/TestGraphicsContextGLCocoa.mm

  Log Message:
  -----------
  WebGL readPixels target memory is copied to GPUP and then back
https://bugs.webkit.org/show_bug.cgi?id=257602
rdar://110112242

Reviewed by Dan Glastonbury.

WebGL readPixels data store would be copied to GPUP, filled by
glReadPixels and then copied back to WP. This was done because
the readPixels data store has following areas that should not be
modified:
- skipped rows * cols pixels
- row lenght bytes that are not accounted by width,
- alignment bytes
- bytes that are out of bounds of the read framebuffer object

Instead, use readPixels with tightly packed buffer in GPUP.
Re-pack the data rows to caller data store in WP according to the
WebGL pack rules.

Read framebuffer bounds are [0, 0, w, h] where WebGLRenderingContextBase
does not know what the w, h are. Thus we need to skip pixels in
negative part of the read bounds, as well as the data store width pixels
that fall outside w, h. The w, h are gotten from ANGLE as the result
of ReadPixelsRobustANGLE.

* Source/WebCore/html/canvas/WebGL2RenderingContext.cpp:
(WebCore::WebGL2RenderingContext::readPixels):
* Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp:
(WebCore::WebGLRenderingContextBase::readPixels):
* Source/WebCore/platform/graphics/GraphicsContextGL.h:
* Source/WebCore/platform/graphics/PixelBufferConversion.cpp:
(WebCore::copyRows):
* Source/WebCore/platform/graphics/PixelBufferConversion.h:
* Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLE.cpp:
(WebCore::GraphicsContextGLANGLE::readPixels):
(WebCore::GraphicsContextGLANGLE::readPixelsWithStatus):
(WebCore::GraphicsContextGLANGLE::readPixelsBufferObject):
(WebCore::GraphicsContextGLANGLE::readPixelsImpl):
* Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLE.h:
* Source/WebKit/GPUProcess/graphics/RemoteGraphicsContextGL.cpp:
(WebKit::RemoteGraphicsContextGL::readPixelsInline):
(WebKit::RemoteGraphicsContextGL::readPixelsSharedMemory):
* Source/WebKit/GPUProcess/graphics/RemoteGraphicsContextGL.h:
* Source/WebKit/GPUProcess/graphics/RemoteGraphicsContextGL.messages.in:
* Source/WebKit/WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.cpp:
(WebKit::RemoteGraphicsContextGLProxy::readPixels):
* Tools/Scripts/generate-gpup-webgl:

Canonical link: https://commits.webkit.org/264865@main




More information about the webkit-changes mailing list