summaryrefslogtreecommitdiff
path: root/doc/ASSET_SYSTEM.md
diff options
context:
space:
mode:
authorskal <pascal.massimino@gmail.com>2026-02-03 08:04:06 +0100
committerskal <pascal.massimino@gmail.com>2026-02-03 08:04:06 +0100
commit7cbebea3a0cce82f3a756c26ab0e1323bbf1d169 (patch)
treecef40429a8a55b66394180eac2c5c19711304bc2 /doc/ASSET_SYSTEM.md
parent6d4aeb4120230899589326b5fd87afca58654c05 (diff)
docs: Document asset system technical details
Adds a section on Alignment, String Safety, and Size Reporting to ASSET_SYSTEM.md.
Diffstat (limited to 'doc/ASSET_SYSTEM.md')
-rw-r--r--doc/ASSET_SYSTEM.md7
1 files changed, 7 insertions, 0 deletions
diff --git a/doc/ASSET_SYSTEM.md b/doc/ASSET_SYSTEM.md
index bd5a266..3493936 100644
--- a/doc/ASSET_SYSTEM.md
+++ b/doc/ASSET_SYSTEM.md
@@ -56,6 +56,13 @@ we need a simple tool that:
* put these in the source tree
* this process needs a script for automation
+## Technical Details
+
+To support diverse usage (binary data, strings, typed structs), the asset packer enforces the following:
+1. **Alignment**: All static asset arrays are declared with `alignas(16)`. This ensures that `reinterpret_cast` to types like `float*` or SIMD vectors is safe (provided the data layout matches).
+2. **String Safety**: Every static asset is appended with a null-terminator (`0x00`). This allows the raw pointer to be safely used as a `const char*` C-string.
+3. **Size Reporting**: The `size` field in `AssetRecord` reflects the *original* file size. However, the underlying buffer is guaranteed to be at least `size + 1` bytes long (due to the null terminator).
+
# Shader Snippets
Shader code (WGSL) can also be managed as assets.