Commit Graph

39 Commits

Author SHA1 Message Date
zhuxudong
1bc2b102ad refactor(shader): migrate GLSL shaders to ShaderLab and clean up shader infrastructure(#2961)
* refactor(core): migrate shaders from core/shaderlib to shader package and clean up old files
2026-05-11 17:55:17 +08:00
AZhan
e19b764e1c fix(text): propagate WorldPosition dirty in _onRootCanvasModify when ReferenceResolutionPerUnit changes (#2981)
* fix(text): mark WorldPosition dirty after slot reallocation in _updateLocalData

Both Text (UI) and TextRenderer share a `bounds` getter that runs
`_updateLocalData` then checks `WorldPosition` dirty. `_updateLocalData`
internally `_freeTextChunks` + `_buildChunk → allocateSubChunk`, which
under PrimitiveChunk's first-fit + free-list-merge allocator can return
a slot previously owned by another renderer. `_buildChunk` writes UV
and color but never pos (pos is `_updatePosition`'s job), so the new
slot retains the previous owner's pos floats as residue.

Before this fix, when a path sets only `LocalPositionBounds` dirty
(e.g. `Text._onRootCanvasModify(ReferenceResolutionPerUnit)` in UI
Text), the bounds getter would:
  1. see LocalPositionBounds → run _updateLocalData (slot may swap)
  2. see WorldPosition not dirty → skip _updatePosition
  3. _setDirtyFlagFalse(Font) clear all dirty bits at once
The next _render also sees clean dirty bits and uploads the residue
pos to GPU — the renderer ends up rendering at someone else's old
world position. In practice this manifested as text glyphs jumping
to the wrong spot or appearing missing after UI tab switches that
free + reallocate chunk slots in the same frame.

Fix: force WorldPosition dirty at the end of _updateLocalData so the
contract "after this call, pos must be rewritten" is unconditionally
honored regardless of which caller invoked it.

Tests cover three layers:
  - dirty-flag invariant: _updateLocalData must leave WorldPosition
    dirty on exit
  - corrupted-slot: bounds getter with only LocalPositionBounds dirty
    rewrites pos even when the slot memory is poisoned
  - full slot-reuse repro: destroy a sibling renderer occupying a
    lower offset, then trigger bounds getter on the survivor — its
    pos must remain correct after the slot moves

Without the fix, all three regression tests fail with the survivor
rendering at the destroyed sibling's old position.

* chore: drop Chinese commentary from text dirty-flag fix

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* test(ui): destroy engine after regression describe block

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* refactor(text): move dirty propagation to input side

Previous fix added _setDirtyFlagTrue(WorldPosition) at the end of
_updateLocalData in both TextRenderer and UI Text. That treats the
output side as the place to declare invalidation, which conflates
two concerns: dirty flags should declare staleness from input
semantics, and update methods should be pure compute units that
don't propagate flags themselves.

Root cause is on the input side: _onRootCanvasModify(ReferenceResolutionPerUnit)
declared LocalPositionBounds dirty but not WorldPosition, even though
ReferenceResolutionPerUnit affects both local layout and the world
positions derived from it. Fix the declaration where the input
semantic event lives.

TextRenderer needs no change — it has no entry point that dirties
LocalPositionBounds without also dirtying WorldPosition (all setters
use DirtyFlag.Position which includes both).

Tests rewritten from white-box (poking private _dirtyFlag, hardcoded
enum values) to public-API integration tests that drive the bug
through uiCanvas.referenceResolutionPerUnit and assert observable
vertex position changes. The new tests fail without the fix
(maxDelta = 0, positions don't update) and pass with it.

* fix(text): include WorldVolume in dirty flag for ReferenceResolutionPerUnit change

Use DirtyFlag.Position (= LocalPositionBounds | WorldPosition | WorldVolume)
instead of the manual two-flag combination. ReferenceResolutionPerUnit
also affects world bounding volume; without the WorldVolume bit,
_updateBounds is skipped in the bounds getter and stale BoundingBox
leaks into frustum culling and raycasting.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-authored-by: chenmo.gl <chenmo.gl@antgroup.com>
2026-05-07 17:23:26 +08:00
ChenMo
e9bea5b32a refactor: unify shader file extension from .gs/.gsl to .shader (#2951)
refactor: Align with Unity convention by using .shader as the standard extension
for Galacean shader files instead of .gs/.gsl.
2026-04-01 23:19:50 +08:00
cptbtptpbcptdtptp
31089dc0a6 Merge remote-tracking branch 'origin/main' into feat/MCode 2026-03-20 15:50:21 +08:00
AZhan
d79647a9ae fix: text dirty flag set error (#2931) 2026-03-20 15:36:57 +08:00
AZhan
886dda635d Fix compont props clone bug (#2926)
* fix: compontont props clone
2026-03-18 11:11:43 +08:00
AZhan
57fdddb599 Unify Signal event mechanism with structured binding support (#2921)
* feat: unify signal event mechanism with structured binding support
2026-03-16 14:54:49 +08:00
AZhan
85364f285f Remove useless code (#2922)
* feat: remove useless code
2026-03-16 10:49:28 +08:00
AZhan
a49884386b Fix setting the font to null will trigger an error (#2917)
* fix: setting the font to null will trigger an error
2026-03-11 20:17:41 +08:00
ChenMo
70453db6ab Add characterSpacing and change spacing units to em (#2908)
feat: Add characterSpacing and change spacing units to em
2026-03-01 21:19:50 +08:00
ym2050
8e84ff8352 Add camera-based event filtering for WorldSpace UICanvas (#2870)
* fix(ui): add eventCamera support for WorldSpace UICanvas (#2793)
2026-02-28 18:58:01 +08:00
ChenMo
c420cf0f24 Deferred destruction for EngineObject during frame processing (#2894)
* fix: prevent crash when destroying entity in physics event callbacks
2026-02-25 17:46:37 +08:00
AZhan
4a99c0c6c4 Register UI Shader (#2772)
* feat: update code
2025-09-17 11:52:10 +08:00
GuoLei1990
ed50bcb097 Merge branch 'main' into dev/1.6 2025-09-15 20:02:12 +08:00
AZhan
bc12049dd7 Fixed local Matrix dirty error triggered by setting UITransform.localMatrix (#2813)
* fix: local world matrix flag
2025-09-15 18:29:01 +08:00
AZhan
b7f5f23351 Optimization Transform clone. (#2816)
* refactor: optimization `Transform` clone
2025-09-15 14:55:44 +08:00
AZhan
bf7da35945 Add relative layout to UITransform (#2760)
* feat: add relative layout to `UITransform`
2025-09-05 15:32:29 +08:00
AZhan
e24f6b8ef6 Fix text global alpha error (#2811)
* fix: text global alpha erro
2025-09-03 18:50:41 +08:00
AZhan
d814019d8b Fix ui clone bug (#2765)
* fix: ui clone bug
2025-07-11 16:01:58 +08:00
AZhan
17c273e22e fix: button clone bug (#2758) 2025-07-08 15:10:25 +08:00
AZhan
8f59562599 Fix ui button clone bug (#2752)
* fix: ui button clone
2025-06-24 16:37:56 +08:00
AZhan
46b6a3cda0 Fixed UITransform cloning missing some properties (#2722)
* fix: ui transform clone
2025-06-18 10:37:13 +08:00
ChenMo
b6ed488b43 Fix ui render bug (#2710) 2025-05-29 11:21:07 +08:00
ChenMo
2af99336f4 fix: ui color space bug (#2706) 2025-05-28 20:32:37 +08:00
ChenMo
425ee3552c Refactor all color properties to linear space (#2656)
* refactor: use linear color space
2025-05-16 16:25:26 +08:00
GuoLei1990
2d71dc95a3 Merge branch 'main' into dev/1.5 2025-04-28 11:27:22 +08:00
hhhhkrx
d15d085f0b Support fxaa (#2605)
* feat: support fxaa
2025-04-24 23:02:54 +08:00
AZhan
e237fc43b6 Fix error when set UICanvas.renderCamera to null (#2630)
* fix: error when set renderCamera to null
2025-04-22 19:35:14 +08:00
AZhan
a4cff37206 Fixed memory leak after engine.destroy (#2619)
* fix: memory leak after `engine.destroy`
2025-04-15 19:31:40 +08:00
AZhan
fa6d0e1eb6 Fixed the problem of image clone (#2603)
* fix: 2d clone
2025-04-10 14:25:09 +08:00
zhuxudong
365bac80b4 Support Texture hardware sRGB encoding and decoding color space (#2593)
* feat(texture): support hardware sRGB encoding and decoding
2025-04-09 14:15:36 +08:00
AZhan
e609141fac Fix UICanvas adaptation issues (#2580)
* fix: the UICanvas.renderMode is CanvasRenderMode.ScreenSpaceCamera bug
 * fix: the issue with incorrect cache value of UICanvas._getCenter
 * fix: the issue that UICanvas did not refresh in time when setting the camera multiple times
2025-03-07 16:15:44 +08:00
AZhan
bf62df763d fix: ui drag only triggered once (#2577) 2025-03-04 11:18:52 +08:00
AZhan
c7b40a40a2 Fixed the problem of modifying component.enable when dispatching UI events, resulting in error reporting (#2549)
* fix: the problem of modifying `component.enable` when dispatching UI events, resulting in error reporting (#2549)
2025-02-12 19:23:35 +08:00
AZhan
57a9f48084 fix: the error in text.bounds when there is no root canvas (#2543) 2025-02-08 17:01:47 +08:00
AZhan
214c693bf8 fix: UIInteractive function name (#2535) 2025-02-06 19:32:33 +08:00
AZhan
200cfc09a0 Fix the buttons of the current frame are not updated in time (#2506)
* fix: the buttons of the current frame are not updated in time
2025-01-15 20:50:18 +08:00
AZhan
6ce548a262 Fixed some GUI issues (#2504)
Support `GUI` in Editor and fix some bug.
2025-01-14 15:20:17 +08:00
singlecoder
8703a2dc4f Support GUI (#2375)
* feat(2d): support GUI
2025-01-09 19:17:21 +08:00