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

Assets hot reloading #162

Open
5 tasks
voxelias opened this issue Apr 23, 2022 · 1 comment
Open
5 tasks

Assets hot reloading #162

voxelias opened this issue Apr 23, 2022 · 1 comment
Labels
feature request New feature request

Comments

@voxelias
Copy link
Member

  • Add dirty flag to assets
  • Add timestamp of last file modification
  • Add a new thread to control last file modification timestamp and reschedule the import
  • Set dirty flag, if the asset was updated
  • Make sure buffers being updated and dirty flag is unset
@voxelias voxelias added the feature request New feature request label Apr 23, 2022
@QuantumEntangledAndy
Copy link
Contributor

I am thinking of maybe something like this. Separate the gpu and cpu representations. Assets represents the data on the cpu buffers that on gpu.

Both assets and buffers have a revision number. When an asset is changed the number is incremented.

Gpu objects have a function that is something like which is called as part of the render system.

fn load(&mut self, cpu: & CpuRepresentation) {
  // check if buffer revision == asset revision if not copy data from cpu to gpu
}

Function should return something like.

enum Update {
  Structure,
  Data,
  None
}

A Structure update indicated that the underlaying data structure like buffer size or texture dimensions was changed and that the render system should rebind.

A Data update indicates that new data was put into the buffer but that the structure was not changed. It can just re-queue the same gpu pipeline.

A None update means no change. Depending on the system it may not even want to re-queue the gpu pipeline.

By using revision rather than dirty we are more resistant to the case where there are multiple buffer that need updating off the same cpu data.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request New feature request
Projects
None yet
Development

No branches or pull requests

2 participants