Skip to content

[Assets] Build a deterministic versioned cooked asset database #136

Description

@proggeramlug

Parent: #126

Problem

tools/bloom-cook is currently texture-focused. A high-end renderer needs deterministic offline processing for meshes, meshlets/LODs, textures, materials, animation, environments, and world dependencies. Runtime parsing of source glTF plus uncompressed/general-purpose texture upload cannot support large scenes, virtualized geometry, or predictable platform memory.

Outcome

A versioned, deterministic, content-addressed cooked asset database with platform/quality variants and an incremental CLI.

Build graph

  • Inputs are source assets plus importer/cooker version, platform profile, quality profile, and relevant settings.
  • Each output has a stable content hash and explicit dependency hashes.
  • Rebuild only invalidated nodes; produce identical bytes for identical inputs/settings.
  • Store provenance, source license/path, warnings, and diagnostic names.
  • Write atomically; interrupted cooks may not leave valid-looking partial artifacts.

Required processors

Textures

  • Preserve color-space/normal/data semantics.
  • Generate coverage-preserving alpha mips and normal-aware mips.
  • Emit platform formats: desktop BC family (including BC7/BC6H as appropriate), mobile ASTC/ETC fallback, and WebGPU-compatible path; use KTX2/Basis where it is the right transport rather than as a blanket answer.
  • Record dimensions, mip offsets, format, alpha mode, and streaming page layout.

Meshes

  • Validate/normalize coordinate, index, tangent, skin, and morph data.
  • Generate conventional LODs and bounds.
  • Provide meshlet/cluster hierarchy/page output needed by the virtual-geometry issue.
  • Preserve material boundaries and stable submesh/material IDs.

Materials/animations/environments

  • Cook the complete supported glTF material extension data.
  • Pack animation clips/skeletons with validated joint mappings and compression metadata.
  • Prefilter environment lighting and record color/exposure conventions.

Package/index

  • Versioned manifest maps logical asset IDs to variant chunks, dependencies, offsets/sizes, and hashes.
  • Support loose development output and packed shipping archives without changing logical IDs.
  • Runtime rejects incompatible versions with an actionable recook message.

CLI/API

Provide commands equivalent to:

bloom-cook build <manifest> --platform macos --quality high
bloom-cook inspect <artifact-or-package>
bloom-cook verify <package>
bloom-cook clean --unreferenced

Exact syntax may differ, but output must be scriptable and diagnostics identify source asset/material/node.

Acceptance criteria

  • Sponza, Bistro, Damaged Helmet, and a skinned model cook without runtime source glTF parsing in shipping mode.
  • Two clean cooks with identical inputs/settings produce byte-identical manifests/chunks.
  • Editing one source texture rebuilds that texture and dependent package index, not unrelated meshes/animations.
  • Runtime loads the correct adapter/platform variant and reports deliberate fallback.
  • Cooked texture memory/quality and mesh load time are benchmarked against the current path.
  • Corrupt chunk/hash/version cases are tested and fail safely.
  • The cooker emits the cluster/LOD metadata contract required by virtual geometry.
  • Documentation includes asset manifest examples, cache location, CI use, and migration from direct source loading.

Likely files

  • tools/bloom-cook/
  • shared asset-format crate/module (do not duplicate struct layout between cooker/runtime)
  • native/shared/src/textures.rs, models*.rs, animation/environment loaders
  • package scripts and release workflow

Non-goals

  • Runtime streaming policy; covered by the async streaming issue.
  • An editor asset browser.
  • Removing source-asset loading in development mode.

Dependencies

Can start independently. Coordinate formats with #131, #134, and #137 before freezing v1.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions