Version Markers (V1-V6)

April 25, 2026 · View on GitHub

Source comments throughout the engine reference Vn markers. There are two unrelated namespaces with the same prefix — context disambiguates them. This doc indexes every site and points to the authoritative spec.


Two namespaces

NamespaceMeaningAuthoritative doc
JobSystem hazardsV1-V6 are vulnerability mitigations in the fiber scheduler design — each Vn is a class of bug the architecture defends againstarch/fiber-system.md
Asset format versionsV1, V2, … are binary schema versions of artifact files (.luth.model, .luth.shader) — Header.Version field controls reader patharch/asset-pipeline.md

Comments referencing either should use the form // V3 (job hazard) — see arch/version-glossary.md so a reader can disambiguate without context.


Namespace 1 — JobSystem hazards

Each Vn is the engine's response to a known fiber-scheduling pitfall. Full detail in arch/fiber-system.md.

HazardOne-line meaningWhere in source
V1No yield under spin-lock; hot path uses SpinLock, never std::mutexjobs/SpinLock.h:9, core/FrameData.h:74
V2Main thread isolated — never steals jobs, never yieldscore/App.cpp:146,152, jobs/JobSystem.cpp:617,709
V3RAII RecordingScope blocks fiber yield while a VkCommandBuffer is being recordedjobs/JobSystem.h:95,107,158, jobs/JobSystem.cpp:711, jobs/Fiber.h:117
V4WaitOnAddress + generation counter pattern — every queue insertion pairs with WakeByAddressSinglejobs/MPMCQueue.h:18,73,118,147, jobs/JobSystem.cpp:248,435,438
V5Depth-limited inline execution — WaitForCounter runs work inline up to depth 4, then forces fiber switchjobs/JobSystem.h:98,153, jobs/JobSystem.cpp:33,640, renderer/rendergraph/RenderGraph.{h,cpp}
V6Overflow TaggedPageAllocator tier — Frame N gets pages even when GPU stalls on N-2core/FrameData.h:66

When adding new hot-path code in jobs/ or renderer/rendergraph/, comment any new construct that addresses one of these hazards as // V<n> .... Don't invent V7+ without first updating arch/fiber-system.md.


Namespace 2 — Asset format versions

Binary artifact files (under cache/assets/) store a Header.Version field at the top. Importers/serializers branch on it to support old artifacts without forced re-import. Defined in luth/source/luth/resources/AssetSerializer.{h,cpp}.

Model artifacts (.luth.model)

VersionSchemaNotes
V1ModelHeader = {MeshCount, MaterialCount} (8 B); MeshHeader = {VertexCount, IndexCount, MaterialIndex} (12 B)Original format. Read-only support for backward compat (AssetSerializer.cpp:302).
V2ModelHeader adds IsSkinned, BoneCount, AnimationCount; payload appends Skeleton + AnimationClipsCurrent write format (AssetSerializer.cpp:190). All new model imports use V2.

AssetSerializer.cpp:302–327 is the V1 backward-compat read branch — preserved so old cached artifacts don't trigger re-import on engine upgrade.

Shader artifacts (.luth.shader)

VersionSchemaNotes
V1Paired .vert + .frag artifacts (legacy)Rejected. Pre-v2.1.0 format; current importer rejects V1 artifacts (AssetSerializer.cpp:411).
V2Single-stage shader — one source file → one artifact + UUIDCurrent format since v2.1.0 shader-asset-pipeline epic.

V1 shader artifacts no longer round-trip — re-import is required if cache is from before v2.1.0.


Conventions for new comments

FormWhen
// V3 (job hazard) — see arch/version-glossary.mdInside jobs/, renderer/rendergraph/, hot paths that touch fiber scheduling
// V2 (asset format)Inside resources/AssetSerializer.{h,cpp} or any importer branching on header version
// V<n> ... (no qualifier)Avoid. Always disambiguate the namespace

If a future epic introduces a third namespace (e.g. shader header schema bumps), add a section to this file before sprinkling Vn comments in source.