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

improve InstancedMesh updating to prepare for async signals and effects #297

Open
trusktr opened this issue Apr 29, 2024 · 0 comments
Open

Comments

@trusktr
Copy link
Member

trusktr commented Apr 29, 2024

In Solid 1.0, effects are synchronous, but this will change in 2.0 where effects will be scheduled with microtasks (awesome!), and is also the direction the TC39 Signals proposal is going in.

Currently some logic in InstancedMesh relies on the synchronous nature of Solid effects. See how #updateSingleInstanceOnly is used within effects currently:

if (!this.#updateSingleInstanceOnly) this.#allMatricesNeedUpdate = true

This will break if effects are not synchronous. F.e. if effects are async (microtask scheduled) if you use setIntanceRotation, and then set the positions attribute in the same tick, the next update will fail to update all positions because #allMatricesNeedUpdate will not have been set to true.

We need to update this logic so that

  • if one of the attributes is set (f.e. positions) in the current tick, then the next update must always update all matrices
  • if an instance setter (f.e. setInstancePosition) is used in the current tick, then the next update must update a single matrix
  • if both of them are used in the current tick, always update all matrices

cc @keywizzle

@trusktr trusktr changed the title improve instance updating to prepare for async signals and effects improve instanced mesh updating to prepare for async signals and effects May 15, 2024
@trusktr trusktr changed the title improve instanced mesh updating to prepare for async signals and effects improve InstancedMesh updating to prepare for async signals and effects May 15, 2024
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

No branches or pull requests

1 participant