Fix: bind to default framebuffer only when copying from main canvas #10486
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.
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
npm run lint
)npm run test
)