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

Conserative resource creation #199

Merged
merged 32 commits into from
Nov 22, 2023
Merged

Conversation

Duttenheim
Copy link
Contributor

Massive refactor of resource loading and streaming.

  • Loads can be delayed if the upload heap is full, previous strategy was to always create new buffers for that
  • Resources can remain in a tentative state, whereby the GPU resources are allocated but the data isn't loaded yet, the success and failed callbacks are only invoked when the requested LODs are finished
  • Added LODs to the CreateResource API, although it defaults to the loaders default set of LODs, which is decided by the loader.
    • For example, meshes currently uses the set 0x3, which is 0x1 for vertices, and 0x2 for indices, and textures use 0xFF to indicate the first 8 mips.

TODO:

  • Handle GPU rejections. If the resource can't fit on the GPU, the resource system should still keep the resource pending in case space appears.
  • Use sparse resources. If resources are really big, fallback on sparse resources to save GPU memory. This would require a whole GPU feedback loop to gather the accessed mips, however that is already something we need to accurately know which mip should be streamed in with the current system.

@Duttenheim Duttenheim added bug Something isn't working category: graphics Graphics category: concurrency Data/condition races debt Technical debt labels Nov 22, 2023
@Duttenheim Duttenheim self-assigned this Nov 22, 2023
Duttenheim and others added 25 commits November 22, 2023 21:42
Split heaps and pools such that pools can track how much heap memory they are using.
This switch will allow the resource loader to stream in it's resources. What it actually means is that success will only be called once all mips are loaded.
Lod requests work, LodMask is dependent on the resource being loaded so that has to be fixed
This requires us to remember what we parsed from the model and actually only apply it when the mesh finishes loading.
It also requires ModelContext to update its references of the mesh, which we currently do every frame.
Instead, the PendingResourceLoad package contains if the resource is initial or should get updated, which makes it easier to handle LOD streaming
Instead of having a per-frame upload buffer, we have a single pool from which we allocate. Allocations are stored by frame and cleared when that frame has finished, then returns the ranges to the pool.
@Duttenheim Duttenheim force-pushed the conserative-resource-creation branch from d2659d9 to c9dc3bb Compare November 22, 2023 20:42
@Duttenheim Duttenheim merged commit 63740ac into master Nov 22, 2023
4 checks passed
@Duttenheim Duttenheim deleted the conserative-resource-creation branch November 22, 2023 21:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working category: concurrency Data/condition races category: graphics Graphics debt Technical debt
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants