-
-
Notifications
You must be signed in to change notification settings - Fork 4.9k
chore: remove renderable hashes #11346
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
Conversation
… rendering - Removed the `_getKey` method from `AbstractText` and related texture management logic from `CanvasTextSystem`, `CanvasTextPipe`, and `HTMLTextPipe`. - Updated texture retrieval methods to use promises for better async handling. - Cleaned up tests to reflect changes in texture management and ensure proper rendering of HTML text.
- Added `_gpuData` property to various renderable classes (e.g., Sprite, Mesh, TilingSprite) to manage GPU-related data. - Updated rendering pipes to utilize the new `_gpuData` structure, replacing previous hash maps for better performance and memory management. - Removed obsolete methods related to renderable destruction and GPU data handling. - Ensured proper cleanup of GPU data during the destruction of renderables to prevent memory leaks.
- Updated text-related classes (AbstractText, Text, BitmapText, HTMLText) to utilize a new GPU data structure for improved performance. - Introduced BatchableText and BatchableHTMLText for efficient GPU management in text rendering. - Modified rendering pipes (CanvasTextPipe, BitmapTextPipe, HTMLTextPipe) to leverage the new GPU data, streamlining texture handling and updates. - Removed obsolete GPU management methods and ensured proper cleanup during text destruction to prevent memory leaks. - Adjusted tests to reflect changes in GPU data handling and ensure accurate rendering behavior.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR simplifies the render pipeline by moving GPU-related data from globally managed hash maps (such as _tilingSpriteDataHash, _gpuSpriteHash, etc.) to a dedicated _gpuData property on each renderable. The changes remove the now-redundant RenderableGCSystem logic and update cleanup methods and tests accordingly.
- Removed all per-renderable hash maps and replaced them with a _gpuData property.
- Updated initialization and destruction paths for renderables in sprite-tiling, graphics, nine-slice sprites, meshes, and particle containers.
- Modified tests to verify _gpuData cleanup instead of the old hash maps.
Reviewed Changes
Copilot reviewed 35 out of 35 changed files in this pull request and generated no comments.
Show a summary per file
File | Description |
---|---|
src/scene/sprite-tiling/TilingSpritePipe.ts | Refactored to use tilingSprite._gpuData instead of a hash map; updated initialization and data access. |
src/scene/graphics/shared/Graphics.ts | Added _gpuData property and cleanup in destroy method. |
src/scene/sprite-nine-slice/NineSliceSpritePipe.ts | Replaced _gpuSpriteHash usage with NineSliceSprite._gpuData. |
src/scene/TilingSprite.ts | Introduced _gpuData property and its cleanup logic. |
src/scene/graphics/shared/GraphicsPipe.ts | Removed graphics batches hash in favor of graphics._gpuData; updated GPU batch handling. |
src/scene/mesh/shared/MeshPipe.ts | Replaced usage of hash maps with Mesh._gpuData for GPU data storage. |
Other test files | Updated expectations and cleanup to verify _gpuData is properly cleaned up. |
Comments suppressed due to low confidence (1)
src/scene/graphics/shared/GraphicsPipe.ts:225
- The variable 'batches' is referenced without being defined. Ensure that the correct batches array is declared or passed, so that the GPU data for graphics is properly cleaned up.
graphics._gpuData.batches = batches;
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Finally.
- Updated various renderable classes (DOMContainer, Renderable, Graphics, Mesh, Sprite, TilingSprite, etc.) to utilize a new GPU data structure for improved performance and memory management. - Modified the ViewContainer class to support a generic GPU data type, allowing for better organization of GPU-related data. - Adjusted rendering pipes to leverage the new `_gpuData` structure, ensuring efficient handling of GPU resources. - Removed obsolete GPU management methods and ensured proper cleanup during destruction to prevent memory leaks. - Updated tests to reflect changes in GPU data handling and ensure accurate rendering behavior.
Description of change
Moved though all the renderables and removed the hashes found on the render pipes. Instead this PR now stores
_gpuData
on the renderables themselves. This means that a lot of code could be removed around how renderables are destroyed and ultimatly we end up with a simpler system!This also removed the need for the
RenderableGCSystem
which can be depricated / removed in another PRPre-Merge Checklist
npm run lint
)npm run test
)