Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 23d40f46815dafd5828fa1932569943b85f8f24e
https://github.com/WebKit/WebKit/commit/23d40f46815dafd5828fa1932569943b85f8f24e
Author: Kimmo Kinnunen <[email protected]>
Date: 2023-03-15 (Wed, 15 Mar 2023)
Changed paths:
M Source/WebCore/html/canvas/CanvasRenderingContext2DBase.cpp
M Source/WebCore/html/canvas/WebGL2RenderingContext.cpp
M Source/WebCore/html/canvas/WebGL2RenderingContext.h
M Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp
M Source/WebCore/html/canvas/WebGLRenderingContextBase.h
Log Message:
-----------
WebGLRenderingContextBase texImageSource HTMLCanvasElement implementation
unable to share code with OffscreenCanvas
https://bugs.webkit.org/show_bug.cgi?id=253885
rdar://106699408
Reviewed by Matt Woodrow.
The WebGLRenderingContextBase::texImageSourceHelper() would invoke the payload
code
directly inside embedded the std::variant visitor. This would make the function
overly complex
compared to normally structured member functions. It would also make it harder
than needed to
invoke a TexImageSource case which would match to same implementation. This
would be needed
in order to match HTMLCanvasElement and OffscreenCanvas implementations with
CanvasBase.
Simplify by having a simple generic visitor call overloaded member
function, and let the overloading rules select the correct method based
on the `source` type. This pattern is used in
CanvasRenderingContext2DBase. Removes an rendundant hunk from said
implementation as an example. The hunk is redundant as the generic
implementation is exactly the same as the removed specific one.
The change of structure leaks into other functions:
- validateTexImageSubRectangle was redundantly templated and in the
header file.
Instead remove T parameter, add the source size parameter and move to
.cpp file.
- TexImageFunctionID defines the function name and function type. The
three variables are redundant: id, name, type.
Instead of resolving the function name and type in the
`texImageSourceHelper`
and passing all three variables down tho the overloads, pass just the
`functionID`.
Propagate the change to all functions that use `functionName`, `functionID`
and/or `functionType`:
pass just the `functionID`. Later patches may remove further use of leaf
`functionName` / `functionType`.
- WebCodecsVideoFrame variant of texImageSource was missing texture parameter
validation.
Add the validation. This is an example of case where the code syntax
simplification is beneficial, as
the mistakes are harder to make and easier to spot.
This is needed in order to add missing OffscreenCanvas as texImageSource
in future patches.
* Source/WebCore/html/canvas/CanvasRenderingContext2DBase.cpp:
(WebCore::CanvasRenderingContext2DBase::drawImage):
* Source/WebCore/html/canvas/WebGL2RenderingContext.cpp:
(WebCore::WebGL2RenderingContext::validateTexImageBinding):
(WebCore::WebGL2RenderingContext::texImage2D):
(WebCore::WebGL2RenderingContext::texImage3D):
(WebCore::WebGL2RenderingContext::texSubImage2D):
(WebCore::WebGL2RenderingContext::texSubImage3D):
* Source/WebCore/html/canvas/WebGL2RenderingContext.h:
* Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp:
(WebCore::WebGLRenderingContextBase::safeGetImageSize):
(WebCore::WebGLRenderingContextBase::getImageDataSize):
(WebCore::WebGLRenderingContextBase::texImageSourceHelper):
(WebCore::WebGLRenderingContextBase::texImageSource):
(WebCore::WebGLRenderingContextBase::texImageArrayBufferViewHelper):
(WebCore::WebGLRenderingContextBase::texImageImpl):
(WebCore::WebGLRenderingContextBase::texImageFunctionName):
(WebCore::WebGLRenderingContextBase::texImageFunctionType):
(WebCore::WebGLRenderingContextBase::validateTexImageSubRectangle):
(WebCore::WebGLRenderingContextBase::validateTexFunc):
(WebCore::WebGLRenderingContextBase::validateTexFuncParameters):
(WebCore::WebGLRenderingContextBase::validateTexImageSourceFormatAndType):
(WebCore::WebGLRenderingContextBase::videoFrameToImage):
(WebCore::WebGLRenderingContextBase::validateTexImageBinding):
(WebCore::WebGLRenderingContextBase::validateHTMLImageElement):
(WebCore::WebGLRenderingContextBase::validateHTMLCanvasElement):
(WebCore::WebGLRenderingContextBase::validateHTMLVideoElement):
(WebCore::WebGLRenderingContextBase::validateImageBitmap):
(WebCore::WebGLRenderingContextBase::getTexImageSourceSize): Deleted.
(WebCore::WebGLRenderingContextBase::getTexImageFunctionName): Deleted.
* Source/WebCore/html/canvas/WebGLRenderingContextBase.h:
(WebCore::WebGLRenderingContextBase::getTextureSourceSize): Deleted.
(WebCore::WebGLRenderingContextBase::validateTexImageSubRectangle): Deleted.
Canonical link: https://commits.webkit.org/261678@main
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes