generator.module
- ..
- README.md4.1 KB
- fused.luau35.0 KB
- init.luau65.9 KB
This package holds more than this page lists. See all of its files in its world.
README.md
generator.stored
A Generator's stored result: what its cook stood in the scene, written into the world as engine-native records and stood again from there in any process that shows the same graph with the same params, with procgen not loaded.
key(graphGuid, params, output)names a result from the manifest and the params alone: the graph's checksum, the checksum of every asset it references (world content followed at any depth, library content by its own checksum), procgen's own version (its package's checksum), the params in canonical form and the output named.version(graphGuid, params, output)answers that key with the way of cooking it stands for (way: the same parts with what the library version decides left out) and the library version.write(owner, graphGuid, key, opts)writes what stands under the Generator's entity: each entity it realized as a record (its components, its native components with each mesh and material by address), each instance set with its placements, and what moves with time on the device as the compute lists that rewrite it (remainder). Blobs are named by the SHA-256 of their bytes and written before the record; a blob already present, or a record already filed under the key, is not written again.read(graphGuid, key)answers the record filed under a key,stand(owner, record)stands it (meshes from their stored bytes, materials from their records, entities born temporary, instance sets at their placements, the device runs and their programs),tick(standing, time)runs the stored rewrites at a time of the result's timeline,frameWork(standing)states what a frame of them queues on the device, andrelease(standing, ownerGone)takes it all down.
A frame of the stored rewrites is one dispatch (fused): stand makes one kernel of every program the rewrites dispatch and a command table of every entry they recorded, in order (each dispatch's program, threads, the page, first word and length of each run it binds, and its parameters; each write's words and where they go). The kernel binds the result's pages and the table, and runs every entry in its one workgroup with a storage barrier between each and the next; each frame writes the values the curves give into the table's slot area and dispatches it. The table is built again when the page group moves this result's runs. While the kernel compiles, the rewrites replay as recorded. Rewrites the kernel cannot state (a program that synchronizes its workgroup, reads where its thread stands in it, or binds anything but arrays of words, scalars and vectors; runs standing in more pages than it can bind) replay as recorded, one dispatch per recorded dispatch, and frameWork names why.
A result lives under /zero/source/_cache/procgen/<graph guid>/: <key>.result (the record), <sha256>.zmsh (meshes), <sha256>.bin (instance placements and device runs), <sha256>.wgsl (program sources), <key>.<way>.version (the way of cooking it stands for, holding the library version) and <key>.published (present once a published version of the library wrote or stood it). A record names each entity by its place in the result, so two processes that cook one key write the same bytes.
The store keeps one result per way of cooking a graph's output. mark(graphGuid, version) writes a result's marks; a Generator in an edit session marks the result it writes or stands. retire(graphGuid, version, previous) runs after a Generator writes a result: it removes every other result of the same way (one another version of the library cooked) and the result the Generator stood for before a param or graph edit, with their marks and every blob no remaining record names. A result a published version of the library marked stays until a published version writes the next, since a player's engine runs a published version (published() reads which version the engine runs), and a result a Generator of this process stands for (hold(holder, key)) stays while it does.
The Generator component requires this module itself, and loads the parts ~.generator installs only once it cooks.