Skip to content
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

[TextureMapper] Use linear sampling when blurring for better performance #17471

Conversation

Aki-7
Copy link

@Aki-7 Aki-7 commented Sep 6, 2023

437b554

[TextureMapper] Use linear sampling when blurring for better performance
https://bugs.webkit.org/show_bug.cgi?id=261102

Reviewed by Fujii Hironori.

To reduce the GPU load for gaussian blur, this fix reduces the size of
kernel use for the blur.

By adjusting the position(offset) to sample the texture and the weight
of each element of the kernel so that the linear interpolation during
texture sampling samples two texels and properly weights them, we can
reduce the size of the kernel without changing behaviour.

* Source/WebCore/platform/graphics/texmap/TextureMapperGL.cpp:
(WebCore::kernelHalfSizeToSimplifiedKernelHalfSize):
(WebCore::computeGaussianKernel):
(WebCore::TextureMapperGL::drawBlurred):
* Source/WebCore/platform/graphics/texmap/TextureMapperShaderProgram.cpp:
* Source/WebCore/platform/graphics/texmap/TextureMapperShaderProgram.h:

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

76f7aff

Misc iOS, tvOS & watchOS macOS Linux Windows
βœ… πŸ§ͺ style βœ… πŸ›  ios βœ… πŸ›  mac βœ… πŸ›  wpe βœ… πŸ›  wincairo
βœ… πŸ§ͺ bindings βœ… πŸ›  ios-sim βœ… πŸ›  mac-AS-debug   πŸ§ͺ wpe-wk2
βœ… πŸ§ͺ webkitperl βœ… πŸ§ͺ ios-wk2   πŸ§ͺ api-mac βœ… πŸ›  gtk
βœ… πŸ§ͺ ios-wk2-wpt βœ… πŸ§ͺ mac-wk1   πŸ§ͺ gtk-wk2
βœ… πŸ§ͺ api-ios βœ… πŸ§ͺ mac-wk2 βœ… πŸ§ͺ api-gtk
βœ… πŸ›  tv   πŸ§ͺ mac-AS-debug-wk2
βœ… πŸ›  tv-sim
  πŸ›  watch
βœ… πŸ›  πŸ§ͺ unsafe-merge βœ… πŸ›  watch-sim

@Aki-7 Aki-7 marked this pull request as draft September 6, 2023 05:45
@Aki-7
Copy link
Author

Aki-7 commented Sep 6, 2023

This change will confilict with #17469.
I'll remove draft status after merging/closing #17469

@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Sep 6, 2023
@Aki-7 Aki-7 force-pushed the eng/TextureMapper-Use-linear-sampling-when-blurring-for-better-performance branch from c25145b to 76f7aff Compare September 7, 2023 01:37
@Aki-7 Aki-7 marked this pull request as ready for review September 7, 2023 01:38
@fujii fujii added unsafe-merge-queue Applied to send a pull request to merge-queue, but skip building and testing and removed merging-blocked Applied to prevent a change from being merged labels Sep 7, 2023
https://bugs.webkit.org/show_bug.cgi?id=261102

Reviewed by Fujii Hironori.

To reduce the GPU load for gaussian blur, this fix reduces the size of
kernel use for the blur.

By adjusting the position(offset) to sample the texture and the weight
of each element of the kernel so that the linear interpolation during
texture sampling samples two texels and properly weights them, we can
reduce the size of the kernel without changing behaviour.

* Source/WebCore/platform/graphics/texmap/TextureMapperGL.cpp:
(WebCore::kernelHalfSizeToSimplifiedKernelHalfSize):
(WebCore::computeGaussianKernel):
(WebCore::TextureMapperGL::drawBlurred):
* Source/WebCore/platform/graphics/texmap/TextureMapperShaderProgram.cpp:
* Source/WebCore/platform/graphics/texmap/TextureMapperShaderProgram.h:

Canonical link: https://commits.webkit.org/267715@main
@webkit-commit-queue webkit-commit-queue force-pushed the eng/TextureMapper-Use-linear-sampling-when-blurring-for-better-performance branch from 76f7aff to 437b554 Compare September 7, 2023 03:28
@webkit-commit-queue
Copy link
Collaborator

Committed 267715@main (437b554): https://commits.webkit.org/267715@main

Reviewed commits have been landed. Closing PR #17471 and removing active labels.

@webkit-commit-queue webkit-commit-queue merged commit 437b554 into WebKit:main Sep 7, 2023
@webkit-commit-queue webkit-commit-queue removed the unsafe-merge-queue Applied to send a pull request to merge-queue, but skip building and testing label Sep 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
5 participants