[webkit-changes] [WebKit/WebKit] a45c00: Debug webgl/2.0.y/conformance2/state/gl-object-get...

Kimmo Kinnunen noreply at github.com
Fri Mar 10 03:01:06 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: a45c00cc8d709a8fd83ec2f1b31d8ded5410e5fe
      https://github.com/WebKit/WebKit/commit/a45c00cc8d709a8fd83ec2f1b31d8ded5410e5fe
  Author: Kimmo Kinnunen <kkinnunen at apple.com>
  Date:   2023-03-10 (Fri, 10 Mar 2023)

  Changed paths:
    M Source/WebCore/html/canvas/WebGL2RenderingContext.cpp
    M Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp
    M Source/WebCore/html/canvas/WebGLRenderingContextBase.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/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

  Log Message:
  -----------
  Debug webgl/2.0.y/conformance2/state/gl-object-get-calls.html is slow because synthetic error management is slow
https://bugs.webkit.org/show_bug.cgi?id=253509
rdar://106358460

Reviewed by Matt Woodrow.

WebGL validation would cause synthetic errors, where as
OpenGL validation and execution would cause "real" errors.
The error management had following issues:
- Errors were stored redundantly in ListHashSet<GCGLint>, which is
  very slow data structure. Mutating this would show up in traces.
- Synthetized errors were sent from WP to GPUP just to be merged
  with the real error list
- getError() would always fetch one error from GPUP

For WebGL 1, OpenGL ES 2.0 spec does not specify the error behavior in detail.
For WebGL 2, OpenGL ES 3.0 spec specifies that "there may be several flag-code
pairs" which are cleared in non-deterministic order when calling getError().

So to fix, instead:
- Errors are stored in OptionSet, since there are only few possible error
  codes.
- When returning an error, return one locally known error. If the known
  error set is empty, fetch all the errors from the underlying context,
  store that as the locally known set and return a possible error from
  that set.

Decreases the runtime of Debug webgl/2.0.y/conformance2/state/gl-object-get-calls.html
from 14s to 10s on MacBook Pro Max.

* Source/WebCore/html/canvas/WebGL2RenderingContext.cpp:
(WebCore::WebGL2RenderingContext::getInternalformatParameter):
* Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp:
(WebCore::errorCodeToString):
(WebCore::errorCodeToGLenum):
(WebCore::WebGLRenderingContextBase::initializeNewContext):
(WebCore::WebGLRenderingContextBase::updateErrors):
(WebCore::WebGLRenderingContextBase::getError):
(WebCore::WebGLRenderingContextBase::loseContextImpl):
(WebCore::WebGLRenderingContextBase::synthesizeGLError):
(WebCore::WebGLRenderingContextBase::synthesizeLostContextGLError):
* Source/WebCore/html/canvas/WebGLRenderingContextBase.h:
* Source/WebCore/platform/graphics/GraphicsContextGL.h:
(WebCore::GraphicsContextGL::enumToErrorCode):
* Source/WebCore/platform/graphics/GraphicsTypesGL.h:
* Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLE.cpp:
(WebCore::GraphicsContextGLANGLE::readnPixelsImpl):
(WebCore::GraphicsContextGLANGLE::reshape):
(WebCore::GraphicsContextGLANGLE::getBufferSubData):
(WebCore::GraphicsContextGLANGLE::getActiveAttribImpl):
(WebCore::GraphicsContextGLANGLE::getActiveUniformImpl):
(WebCore::GraphicsContextGLANGLE::getAttachedShaders):
(WebCore::GraphicsContextGLANGLE::updateErrors):
(WebCore::GraphicsContextGLANGLE::getErrors):
(WebCore::GraphicsContextGLANGLE::getActiveUniformBlockName):
(WebCore::GraphicsContextGLANGLE::addError):
(WebCore::GraphicsContextGLANGLE::moveErrorsToSyntheticErrorList): Deleted.
(WebCore::GraphicsContextGLANGLE::getError): Deleted.
(WebCore::GraphicsContextGLANGLE::synthesizeGLError): Deleted.
* Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLE.h:
* Source/WebKit/GPUProcess/graphics/RemoteGraphicsContextGL.cpp:
(WebKit::RemoteGraphicsContextGL::getErrors):
(WebKit::RemoteGraphicsContextGL::readnPixels2):
(WebKit::RemoteGraphicsContextGL::synthesizeGLError): Deleted.
(WebKit::RemoteGraphicsContextGL::getError): Deleted.
* Source/WebKit/GPUProcess/graphics/RemoteGraphicsContextGL.h:
* Source/WebKit/GPUProcess/graphics/RemoteGraphicsContextGL.messages.in:
* Source/WebKit/GPUProcess/graphics/RemoteGraphicsContextGLFunctionsGenerated.h:
(moveErrorsToSyntheticErrorList): Deleted.
* Source/WebKit/WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.cpp:
(WebKit::RemoteGraphicsContextGLProxy::getErrors):
(WebKit::RemoteGraphicsContextGLProxy::synthesizeGLError): Deleted.
(WebKit::RemoteGraphicsContextGLProxy::getError): Deleted.
* Source/WebKit/WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.h:
* Source/WebKit/WebProcess/GPU/graphics/RemoteGraphicsContextGLProxyFunctionsGenerated.cpp:
(WebKit::RemoteGraphicsContextGLProxy::moveErrorsToSyntheticErrorList): Deleted.
* Tools/Scripts/generate-gpup-webgl:

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




More information about the webkit-changes mailing list