summaryrefslogtreecommitdiff
path: root/src/util/asset_manager.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/util/asset_manager.h')
-rw-r--r--src/util/asset_manager.h18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/util/asset_manager.h b/src/util/asset_manager.h
index 786a8db..f6ad244 100644
--- a/src/util/asset_manager.h
+++ b/src/util/asset_manager.h
@@ -16,10 +16,21 @@ enum class AssetType : uint8_t {
PROC_GPU,
};
+// Compression scheme applied to the packed bytes (only relevant for static
+// embedded assets; disk-load and procedural assets are always NONE).
+enum class AssetCompression : uint8_t {
+ NONE = 0,
+ // Order-0 rANS, model seeded from a corpus-wide histogram embedded in the
+ // generated assets blob (see GetAnsAsciiHistogram). Used for WGSL.
+ ANS_ASCII = 1,
+};
+
struct AssetRecord {
const uint8_t* data; // Pointer to asset data (static or dynamic)
- size_t size; // Size of the asset data
+ size_t size; // Size of 'data' in bytes (compressed size if any)
AssetType type;
+ AssetCompression compression; // How 'data' is encoded; NONE = raw bytes
+ size_t uncompressed_size; // Size after decompression (== size if NONE)
const char* proc_func_name_str; // Name of procedural generation function
// (string literal)
const float* proc_params; // Parameters for procedural generation (static,
@@ -27,6 +38,11 @@ struct AssetRecord {
int num_proc_params; // Number of procedural parameters
};
+// Initial-state histogram (256 entries) used to seed ANS_ASCII compression.
+// Defined in the generated assets blob; computed at pack time over the WGSL
+// corpus.
+const uint32_t* GetAnsAsciiHistogram();
+
// Generic interface
// Retrieves a pointer to the asset data.
// - Static assets are guaranteed to be 16-byte aligned.