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

Update Branch #482

Merged
merged 68 commits into from
Jan 13, 2025
Merged

Update Branch #482

merged 68 commits into from
Jan 13, 2025

Conversation

Drulokia
Copy link
Collaborator

No description provided.

wouterlucas and others added 30 commits December 4, 2024 22:41
This fixes the error:
net::ERR_BLOCKED_BY_RESPONSE.NotSameOriginAfterDefaultedToSameOriginByCoep 302 (Found)
… management

Load Textures only when node becomes visible.
This fixes the error:

net::ERR_BLOCKED_BY_RESPONSE.NotSameOriginAfterDefaultedToSameOriginByCoep
302 (Found)
wouterlucas and others added 29 commits December 17, 2024 22:28
SVG changed due to Alpha fix.
Batch the amount of textures being downloaded (source) and uploaded
(core ctx creation) to the GPU to reduce load on constrained devices.

The default is set to `0` where everything will be processed in a single
frame, this can be reduced to any value (e.g. `50` or `25`) to limit the
amount of textures being processed per frame.

Todo:
- [x] Fix loaded events w/ dimensions
- [x] Run through all the tests (+fixes)
- [x] Check Canvas2D regression
- [x] Align RGB / RGBA handling with hasAlpha on Texture Creates to save
some bits
…Node and Stage

This avoids sending a free event each time we load a texture and;
Improves the renderability changes and loading of texture w.r.t. texture state.
### What’s New? ✨
This PR refactors Texture Throttling in the following ways:

- 🕒 Async RTT Texture Loading: When an RTT node is set, wait for the
texture to load asynchronously.
- 🗑️ Improved Texture Cleanup: When a texture is freed, its source
texture is now also marked as freed. Fixes a bug where textures weren't
returning after memory cleanup.
- 🔄 Auto-Trigger Texture Loading: Refactored isRenderable owner changes
to automatically call texture loading if the texture state is freed or
initial.

## How to Test? 🧪

RTT Changes: Use `test=rtt-dimension`. 🖼️ You should see race conditions
occurring prior to this PR.

Texture Freed Fix: Add a rocko.png to the
`test=texture-cleanup-critical` test and move it in and out of the
screen to validate. 🎯 (Not the prettiest, but it works!). Might create
an automated test for this in the future.

## What’s Next? 🚀
More Testing! 🛠️
Causing issues where cached linearGradients is shared with
radialGradient
✨ What changed? ✨

* Decouple **isRenderable** from **hasRenderableOwner** as textures can
be loaded asynchronously.
* Refactored the `isRenderable` detection:
  - If a node has `alpha = 0` or is off screen its not renderable
- If a node has dimensions and color properties, its marked renderable
and we assume its a `ColorTexture`.
- If a node has a texture, it will be marked as a renderable owner.
Which will trigger loading of the texture (if its the first owner)
    - If the texture is loaded, it is marked renderable
* On `renderQuads` we assume everything has a texture if not we set the
defaultTexture for 1x1 sampling. This is implicit but matches the old
behaviour.
* `CoreTextNode` overwrites behaviour and checks for text !== ''.
* Also fixed a bug where the default texture was still loading but
already referenced.
* Added a `CoreNode` unit test to validate this more rapidly.

🔧 Addresses the following
Fixes #477
this fix the issue that elements with shaders but without color are not
marked as renderable
Stop gap solution, ideally we do want SDF Font Face textures cleaned up
if we can detect they have no renderable owners anymore to save as much
memory as we can in case we hit critical levels.

However for now prevent Font Face textures from being cleaned up until
we have proper guards/reloads in the SDF Font Renderer at the expense of
keeping the Font atlas always in memory regardless if its being used.
@Drulokia Drulokia merged commit 090c794 into 468-dynamic-app-width-and-height Jan 13, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants