Skip to content

Add support for function-based shadings (bug 1254066) - #21012

Merged
calixteman merged 1 commit into
mozilla:masterfrom
calixteman:shading_function
Mar 31, 2026
Merged

calixteman merged 1 commit into
mozilla:masterfrom
calixteman:shading_function

Conversation

@calixteman

Copy link
Copy Markdown
Contributor

It fixes #5046.
We just generate a mesh for the pattern rectangle where the color of each vertex is computed from the function.
Since the mesh is generated in the worker we don't really take into account the current transform when it's drawn.
That being said, there are maybe some possible improvements in using directly the gpu for the shading creation
which could then take into account the current transform, but it could only work with ps function we can convert
ino wgsl language and simple enough color spaces (gray and rgb).

@codecov-commenter

codecov-commenter commented Mar 31, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 75.00000% with 52 lines in your changes missing coverage. Please review.
βœ… Project coverage is 63.36%. Comparing base (a40b91f) to head (b5f2eed).

Files with missing lines Patch % Lines
src/core/pattern.js 74.25% 52 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master   #21012      +/-   ##
==========================================
+ Coverage   63.25%   63.36%   +0.11%     
==========================================
  Files         176      176              
  Lines      124540   124696     +156     
==========================================
+ Hits        78777    79013     +236     
+ Misses      45763    45683      -80     
Flag Coverage Ξ”
fonttest 7.66% <33.33%> (ΓΈ)
unittestcli 63.33% <75.00%> (+0.11%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

β˜” View full report in Codecov by Sentry.
πŸ“’ Have feedback on the report? Share it here.

πŸš€ New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • πŸ“¦ JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Comment thread src/core/pattern.js Resolved
Comment thread src/core/pattern.js Resolved
Comment thread src/core/pattern.js Resolved

@timvandermeij timvandermeij left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

r=me, with the merge conflict and the comments addressed. Thank you for implementing this, and adding test coverage!

Comment thread test/unit/clitests.json Resolved
Comment thread test/unit/jasmine-boot.js Resolved
It fixes mozilla#5046.
We just generate a mesh for the pattern rectangle where the color of each vertex is computed from the function.
Since the mesh is generated in the worker we don't really take into account the current transform when it's drawn.
That being said, there are maybe some possible improvements in using directly the gpu for the shading creation
which could then take into account the current transform, but it could only work with ps function we can convert
ino wgsl language and simple enough color spaces (gray and rgb).
@calixteman

Copy link
Copy Markdown
Contributor Author

/botio test

@moz-tools-bot

Copy link
Copy Markdown
Collaborator

From: Bot.io (Linux m4)


Received

Command cmd_test from @calixteman received. Current queue size: 0

Live output at: http://54.241.84.105:8877/cc1bc289e121125/output.txt

@moz-tools-bot

Copy link
Copy Markdown
Collaborator

From: Bot.io (Windows)


Received

Command cmd_test from @calixteman received. Current queue size: 0

Live output at: http://54.193.163.58:8877/9ab8fb8b6748523/output.txt

@moz-tools-bot

Copy link
Copy Markdown
Collaborator

From: Bot.io (Linux m4)


Success

Full output at http://54.241.84.105:8877/cc1bc289e121125/output.txt

Total script time: 46.40 mins

  • Unit tests: Passed
  • Integration Tests: Passed
  • Regression tests: Passed

@moz-tools-bot

Copy link
Copy Markdown
Collaborator

From: Bot.io (Windows)


Failed

Full output at http://54.193.163.58:8877/9ab8fb8b6748523/output.txt

Total script time: 77.64 mins

  • Unit tests: Passed
  • Integration Tests: FAILED
  • Regression tests: Passed

@calixteman
calixteman merged commit f33f816 into mozilla:master Mar 31, 2026
14 checks passed
@calixteman

Copy link
Copy Markdown
Contributor Author

/botio makeref

@moz-tools-bot

Copy link
Copy Markdown
Collaborator

From: Bot.io (Linux m4)


Received

Command cmd_makeref from @calixteman received. Current queue size: 2

Live output at: http://54.241.84.105:8877/6226ae729340ce0/output.txt

@moz-tools-bot

Copy link
Copy Markdown
Collaborator

From: Bot.io (Windows)


Received

Command cmd_makeref from @calixteman received. Current queue size: 1

Live output at: http://54.193.163.58:8877/857648e7def173c/output.txt

@moz-tools-bot

Copy link
Copy Markdown
Collaborator

From: Bot.io (Linux m4)


Success

Full output at http://54.241.84.105:8877/6226ae729340ce0/output.txt

Total script time: 18.21 mins

  • Make references: Passed
  • Check references: Passed

@moz-tools-bot

Copy link
Copy Markdown
Collaborator

From: Bot.io (Windows)


Success

Full output at http://54.193.163.58:8877/857648e7def173c/output.txt

Total script time: 26.39 mins

  • Make references: Passed
  • Check references: Passed

@18488292860-coder

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 75.00000% with 52 lines in your changes missing coverage. Please review.
βœ… Project coverage is 63.36%. Comparing base (a40b91f) to head (b5f2eed).

Files with missing lines Patch % Lines
src/core/pattern.js 74.25% 52 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master   #21012      +/-   ##
==========================================
+ Coverage   63.25%   63.36%   +0.11%     
==========================================
  Files         176      176              
  Lines      124540   124696     +156     
==========================================
+ Hits        78777    79013     +236     
+ Misses      45763    45683      -80     
Flag Coverage Ξ”
fonttest 7.66% <33.33%> (ΓΈ)
unittestcli 63.33% <75.00%> (+0.11%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

β˜” View full report in Codecov by Sentry.
πŸ“’ Have feedback on the report? Share it here.

πŸš€ New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • πŸ“¦ JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

This branch was previously deployed

1 inactive deployment
code-coverage β€” 3727b709 Deployed Mar 31, 2026 by calixteman via Test (lts/*) #883
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Pink background

6 participants