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

Fix: bind to default framebuffer only when copying from main canvas #10486

Merged
merged 1 commit into from Apr 30, 2024

Conversation

ShukantPal
Copy link
Member

The render target system's copyToTexture assumes that if the source render surface is a canvas, then it must be the main framebuffer. But this is false if someone is trying to copy from a secondary or offscreen canvas.

This change uses a direct comparison with the main canvas to check whether to use the default framebuffer instead.

For a bug repro, see this JSFiddle
https://jsfiddle.net/ShukantPal/vwrh51qs/27/

I've verified locally that this fix causes the gradient to paint correctly. @bigtimebuddy Do we still deploy a public build URL for GitHub branches? (so that I can create a fiddle that works correctly using this branch's build)

Pre-Merge Checklist
  • Tests and/or benchmarks are included
  • Documentation is changed or added
  • Lint process passed (npm run lint)
  • Tests passed (npm run test)

The render target system's copyToTexture assumes that if the source render surface is a canvas, then it must be the main framebuffer. But this is false if someone is trying to copy from a secondary or offscreen canvas.

For a bug repro, see this JSFiddle
https://jsfiddle.net/ShukantPal/vwrh51qs/27/

I've verified locally that this fix causes the gradient to paint correctly
@ShukantPal ShukantPal changed the title Bind to null framebuffer only when copy from main canvas Bind to default framebuffer only when copying from main canvas Apr 29, 2024
Copy link

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 644fdf7:

Sandbox Source
pixi.js-sandbox Configuration

@ShukantPal ShukantPal requested review from Zyie, GoodBoyDigital and bigtimebuddy and removed request for Zyie April 29, 2024 06:04
Copy link
Member

@GoodBoyDigital GoodBoyDigital left a comment

Choose a reason for hiding this comment

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

nice!

@bigtimebuddy
Copy link
Member

Try using the codesandbox link above for testing.

Copy link
Member

@Zyie Zyie left a comment

Choose a reason for hiding this comment

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

I've verified that the demo works!

@Zyie Zyie added the ✅ Ready To Merge Helpful when issues are in the queue waiting to get merged. This means the PR is completed and has t label Apr 30, 2024
@Zyie Zyie changed the title Bind to default framebuffer only when copying from main canvas Fix: bind to default framebuffer only when copying from main canvas Apr 30, 2024
@Zyie Zyie added this pull request to the merge queue Apr 30, 2024
Merged via the queue into dev with commit fe1c4c5 Apr 30, 2024
4 checks passed
@Zyie Zyie deleted the shukant/fix-framebuffer-binding branch April 30, 2024 21:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✅ Ready To Merge Helpful when issues are in the queue waiting to get merged. This means the PR is completed and has t
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants