Skip to content

[ModelLoader] Hybrid Parallel Model Loader #6

Description

@juanchuletas

Description:
Currently, FunGT loads models sequentially via Model::load(). Loading multiple large models (like Pixar assets) can block the main thread and result in noticeable delays. To improve performance and scalability, we should implement a hybrid parallel model loader similar to Blender and modern game engines.

Proposed Solution:

  1. Internal parallelism inside Model::load()

    • Use Intel TBB (tbb::parallel_for) to process meshes, materials, and textures within a single model.
    • This speeds up loading large individual models.
  2. External model loading manager

    • Create a ModelLoader class or task queue to handle multiple models concurrently.
    • Allows users to enqueue multiple models without manually spawning threads.
    • Provides methods like waitForAll() or progress tracking.
  3. GPU synchronization

    • Keep GPU buffer creation on the main thread to ensure thread safety with OpenGL.
    • CPU parsing and data preparation remain parallel.

Benefits:

  • Fast loading of large individual models.
  • Allows multiple models to load concurrently without user pain.
  • Mirrors Blender and game engine best practices.

Optional Enhancements:

  • Lazy loading / streaming for very large assets.
  • Limit concurrency via TBB task arena to prevent oversubscription.

References / Inspiration:

  • Blender: Uses TBB for dependency graph, physics, modifiers, and asset import.
  • Game engines (Unreal, Unity, Godot): Separate CPU parse and GPU upload; job/task systems for async model loading.

Suggested Labels:

  • enhancement
  • performance
  • tbb
  • model-loading

Suggested Milestone:

  • v1.2 (or next performance-focused release)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions