-
Notifications
You must be signed in to change notification settings - Fork 1.7k
WebGLRenderingContextBase texImageSource HTMLCanvasElement implementation unable to share code with OffscreenCanvas #11494
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
webkit-commit-queue
merged 1 commit into
WebKit:main
from
kkinnunen-apple:webgl-teximagesourcehelper-simplify-1
Mar 15, 2023
Merged
Conversation
This file contains hidden or 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
Contributor
EWS run on previous version of this PR (hash ff83ac5)
|
ff83ac5
to
8608133
Compare
EWS run on current version of this PR (hash 8608133)
|
mattwoodrow
approved these changes
Mar 14, 2023
…tion 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
8608133
to
23d40f4
Compare
Committed 261678@main (23d40f4): https://commits.webkit.org/261678@main Reviewed commits have been landed. Closing PR #11494 and removing active labels. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
23d40f4
8608133
🧪 api-gtk🧪 mac-AS-debug-wk2