@plasius/gpu-world-generator 0.0.8 → 0.0.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +24 -0
- package/dist/index.cjs +603 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +75 -1
- package/dist/index.d.ts +75 -1
- package/dist/index.js +594 -1
- package/dist/index.js.map +1 -1
- package/docs/adrs/adr-0004-worker-dag-manifests-for-chunk-and-voxel-generation.md +37 -0
- package/docs/adrs/index.md +1 -0
- package/docs/design/worker-manifest-integration.md +42 -0
- package/docs/tdrs/index.md +3 -0
- package/docs/tdrs/tdr-0001-world-generator-worker-manifest-contract.md +39 -0
- package/package.json +6 -3
- package/src/index.ts +1 -0
- package/src/worker.ts +710 -0
package/README.md
CHANGED
|
@@ -59,6 +59,28 @@ const { levelSpec, cells, terrain } = generateTemperateMixedForest({
|
|
|
59
59
|
import terrainWgsl from "@plasius/gpu-world-generator/terrain.wgsl?raw";
|
|
60
60
|
```
|
|
61
61
|
|
|
62
|
+
## Worker DAG Manifests
|
|
63
|
+
|
|
64
|
+
`@plasius/gpu-world-generator` now publishes worker-first generation manifests
|
|
65
|
+
so chunk and voxel work can be scheduled as a multi-root DAG instead of a flat
|
|
66
|
+
queue.
|
|
67
|
+
|
|
68
|
+
```js
|
|
69
|
+
import { getWorldGeneratorWorkerManifest } from "@plasius/gpu-world-generator";
|
|
70
|
+
|
|
71
|
+
const streaming = getWorldGeneratorWorkerManifest();
|
|
72
|
+
const bake = getWorldGeneratorWorkerManifest("bake");
|
|
73
|
+
|
|
74
|
+
console.log(streaming.jobs.map((job) => job.worker.jobType));
|
|
75
|
+
console.log(bake.jobs.find((job) => job.key === "assetSerialize"));
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
- `streaming` models runtime chunk generation and mesh materialization.
|
|
79
|
+
- `bake` extends the DAG with asset serialization for background/offline output.
|
|
80
|
+
- Jobs include queue class, priority, dependencies, adaptive budget ladders, and
|
|
81
|
+
debug allocation tags for integration with `@plasius/gpu-performance` and
|
|
82
|
+
`@plasius/gpu-debug`.
|
|
83
|
+
|
|
62
84
|
## Demo
|
|
63
85
|
The WebGPU mixed-forest demo lives in `demo/`. Run it with:
|
|
64
86
|
|
|
@@ -81,3 +103,5 @@ npm run pack:check
|
|
|
81
103
|
## Notes
|
|
82
104
|
- For Vite/Pnpm setups, raw WGSL import is the most reliable.
|
|
83
105
|
- See `docs/plan.md` for hierarchy and biome rules.
|
|
106
|
+
- See `docs/design/worker-manifest-integration.md` for the chunk/voxel DAG
|
|
107
|
+
contract.
|
package/dist/index.cjs
CHANGED
|
@@ -59,11 +59,14 @@ __export(index_exports, {
|
|
|
59
59
|
createPerfMonitor: () => createPerfMonitor,
|
|
60
60
|
defaultFieldParams: () => defaultFieldParams,
|
|
61
61
|
defaultFractalMandelSettings: () => defaultFractalMandelSettings,
|
|
62
|
+
defaultWorldGeneratorWorkerProfile: () => defaultWorldGeneratorWorkerProfile,
|
|
62
63
|
encodeTerrainParams: () => encodeTerrainParams,
|
|
63
64
|
fieldWgslUrl: () => fieldWgslUrl,
|
|
64
65
|
fractalPrepassWgslUrl: () => fractalPrepassWgslUrl,
|
|
65
66
|
generateHexGrid: () => generateHexGrid,
|
|
66
67
|
generateTemperateMixedForest: () => generateTemperateMixedForest,
|
|
68
|
+
getWorldGeneratorWorkerManifest: () => getWorldGeneratorWorkerManifest,
|
|
69
|
+
getWorldGeneratorWorkerProfile: () => getWorldGeneratorWorkerProfile,
|
|
67
70
|
hexAreaFromSide: () => hexAreaFromSide,
|
|
68
71
|
hexSideFromArea: () => hexSideFromArea,
|
|
69
72
|
loadFieldWgsl: () => loadFieldWgsl,
|
|
@@ -89,7 +92,12 @@ __export(index_exports, {
|
|
|
89
92
|
tileKeyFromWorldPosition: () => tileKeyFromWorldPosition,
|
|
90
93
|
tileKeyToString: () => tileKeyToString,
|
|
91
94
|
unpackTerrain: () => unpackTerrain,
|
|
92
|
-
validateTileAssetPayload: () => validateTileAssetPayload
|
|
95
|
+
validateTileAssetPayload: () => validateTileAssetPayload,
|
|
96
|
+
worldGeneratorDebugOwner: () => worldGeneratorDebugOwner,
|
|
97
|
+
worldGeneratorWorkerManifests: () => worldGeneratorWorkerManifests,
|
|
98
|
+
worldGeneratorWorkerProfileNames: () => worldGeneratorWorkerProfileNames,
|
|
99
|
+
worldGeneratorWorkerProfiles: () => worldGeneratorWorkerProfiles,
|
|
100
|
+
worldGeneratorWorkerQueueClass: () => worldGeneratorWorkerQueueClass
|
|
93
101
|
});
|
|
94
102
|
module.exports = __toCommonJS(index_exports);
|
|
95
103
|
|
|
@@ -1877,6 +1885,591 @@ function createMeshBuilder(sizeOrOptions = 1) {
|
|
|
1877
1885
|
}
|
|
1878
1886
|
};
|
|
1879
1887
|
}
|
|
1888
|
+
|
|
1889
|
+
// src/worker.ts
|
|
1890
|
+
var worldGeneratorDebugOwner = "world-generator";
|
|
1891
|
+
var worldGeneratorWorkerQueueClass = "voxel";
|
|
1892
|
+
var defaultWorldGeneratorWorkerProfile = "streaming";
|
|
1893
|
+
function buildBudgetLevels(jobType, queueClass, levels) {
|
|
1894
|
+
return Object.freeze(
|
|
1895
|
+
levels.map(
|
|
1896
|
+
(level) => Object.freeze({
|
|
1897
|
+
id: level.id,
|
|
1898
|
+
estimatedCostMs: level.estimatedCostMs,
|
|
1899
|
+
config: Object.freeze({
|
|
1900
|
+
maxDispatchesPerFrame: level.config.maxDispatchesPerFrame,
|
|
1901
|
+
maxJobsPerDispatch: level.config.maxJobsPerDispatch,
|
|
1902
|
+
cadenceDivisor: level.config.cadenceDivisor,
|
|
1903
|
+
workgroupScale: level.config.workgroupScale,
|
|
1904
|
+
maxQueueDepth: level.config.maxQueueDepth,
|
|
1905
|
+
metadata: Object.freeze({
|
|
1906
|
+
owner: worldGeneratorDebugOwner,
|
|
1907
|
+
queueClass,
|
|
1908
|
+
jobType,
|
|
1909
|
+
quality: level.id
|
|
1910
|
+
})
|
|
1911
|
+
})
|
|
1912
|
+
})
|
|
1913
|
+
)
|
|
1914
|
+
);
|
|
1915
|
+
}
|
|
1916
|
+
var worldGeneratorWorkerProfileSpecs = {
|
|
1917
|
+
streaming: {
|
|
1918
|
+
description: "Runtime chunk generation DAG for fractal prepass, terrain synthesis, voxel materialization, mesh build, and tile bake.",
|
|
1919
|
+
suggestedAllocationIds: [
|
|
1920
|
+
"world.chunk.field.scratch",
|
|
1921
|
+
"world.chunk.height.buffer",
|
|
1922
|
+
"world.chunk.voxel.buffer",
|
|
1923
|
+
"world.chunk.mesh.buffer"
|
|
1924
|
+
],
|
|
1925
|
+
jobs: {
|
|
1926
|
+
fractalPrepass: {
|
|
1927
|
+
priority: 4,
|
|
1928
|
+
dependencies: [],
|
|
1929
|
+
domain: "custom",
|
|
1930
|
+
authority: "authoritative",
|
|
1931
|
+
importance: "high",
|
|
1932
|
+
levels: [
|
|
1933
|
+
{
|
|
1934
|
+
id: "fixed",
|
|
1935
|
+
estimatedCostMs: 0.6,
|
|
1936
|
+
config: {
|
|
1937
|
+
maxDispatchesPerFrame: 1,
|
|
1938
|
+
maxJobsPerDispatch: 1,
|
|
1939
|
+
cadenceDivisor: 1,
|
|
1940
|
+
workgroupScale: 1,
|
|
1941
|
+
maxQueueDepth: 32
|
|
1942
|
+
}
|
|
1943
|
+
}
|
|
1944
|
+
],
|
|
1945
|
+
suggestedAllocationIds: ["world.chunk.field.scratch"]
|
|
1946
|
+
},
|
|
1947
|
+
fieldSynthesis: {
|
|
1948
|
+
priority: 4,
|
|
1949
|
+
dependencies: [],
|
|
1950
|
+
domain: "custom",
|
|
1951
|
+
authority: "authoritative",
|
|
1952
|
+
importance: "critical",
|
|
1953
|
+
levels: [
|
|
1954
|
+
{
|
|
1955
|
+
id: "fixed",
|
|
1956
|
+
estimatedCostMs: 0.9,
|
|
1957
|
+
config: {
|
|
1958
|
+
maxDispatchesPerFrame: 1,
|
|
1959
|
+
maxJobsPerDispatch: 2,
|
|
1960
|
+
cadenceDivisor: 1,
|
|
1961
|
+
workgroupScale: 1,
|
|
1962
|
+
maxQueueDepth: 48
|
|
1963
|
+
}
|
|
1964
|
+
}
|
|
1965
|
+
],
|
|
1966
|
+
suggestedAllocationIds: ["world.chunk.field.scratch"]
|
|
1967
|
+
},
|
|
1968
|
+
terrainSynthesis: {
|
|
1969
|
+
priority: 5,
|
|
1970
|
+
dependencies: ["fractalPrepass", "fieldSynthesis"],
|
|
1971
|
+
domain: "custom",
|
|
1972
|
+
authority: "authoritative",
|
|
1973
|
+
importance: "critical",
|
|
1974
|
+
levels: [
|
|
1975
|
+
{
|
|
1976
|
+
id: "fixed",
|
|
1977
|
+
estimatedCostMs: 1.4,
|
|
1978
|
+
config: {
|
|
1979
|
+
maxDispatchesPerFrame: 1,
|
|
1980
|
+
maxJobsPerDispatch: 1,
|
|
1981
|
+
cadenceDivisor: 1,
|
|
1982
|
+
workgroupScale: 1,
|
|
1983
|
+
maxQueueDepth: 32
|
|
1984
|
+
}
|
|
1985
|
+
}
|
|
1986
|
+
],
|
|
1987
|
+
suggestedAllocationIds: ["world.chunk.height.buffer"]
|
|
1988
|
+
},
|
|
1989
|
+
voxelMaterialize: {
|
|
1990
|
+
priority: 3,
|
|
1991
|
+
dependencies: ["terrainSynthesis"],
|
|
1992
|
+
domain: "custom",
|
|
1993
|
+
authority: "non-authoritative-simulation",
|
|
1994
|
+
importance: "high",
|
|
1995
|
+
levels: [
|
|
1996
|
+
{
|
|
1997
|
+
id: "low",
|
|
1998
|
+
estimatedCostMs: 0.8,
|
|
1999
|
+
config: {
|
|
2000
|
+
maxDispatchesPerFrame: 1,
|
|
2001
|
+
maxJobsPerDispatch: 1,
|
|
2002
|
+
cadenceDivisor: 2,
|
|
2003
|
+
workgroupScale: 0.6,
|
|
2004
|
+
maxQueueDepth: 24
|
|
2005
|
+
}
|
|
2006
|
+
},
|
|
2007
|
+
{
|
|
2008
|
+
id: "medium",
|
|
2009
|
+
estimatedCostMs: 1.2,
|
|
2010
|
+
config: {
|
|
2011
|
+
maxDispatchesPerFrame: 1,
|
|
2012
|
+
maxJobsPerDispatch: 2,
|
|
2013
|
+
cadenceDivisor: 1,
|
|
2014
|
+
workgroupScale: 0.8,
|
|
2015
|
+
maxQueueDepth: 32
|
|
2016
|
+
}
|
|
2017
|
+
},
|
|
2018
|
+
{
|
|
2019
|
+
id: "high",
|
|
2020
|
+
estimatedCostMs: 1.8,
|
|
2021
|
+
config: {
|
|
2022
|
+
maxDispatchesPerFrame: 2,
|
|
2023
|
+
maxJobsPerDispatch: 2,
|
|
2024
|
+
cadenceDivisor: 1,
|
|
2025
|
+
workgroupScale: 1,
|
|
2026
|
+
maxQueueDepth: 40
|
|
2027
|
+
}
|
|
2028
|
+
}
|
|
2029
|
+
],
|
|
2030
|
+
suggestedAllocationIds: ["world.chunk.voxel.buffer"]
|
|
2031
|
+
},
|
|
2032
|
+
meshBuild: {
|
|
2033
|
+
priority: 2,
|
|
2034
|
+
dependencies: ["terrainSynthesis", "voxelMaterialize"],
|
|
2035
|
+
domain: "geometry",
|
|
2036
|
+
authority: "visual",
|
|
2037
|
+
importance: "high",
|
|
2038
|
+
levels: [
|
|
2039
|
+
{
|
|
2040
|
+
id: "low",
|
|
2041
|
+
estimatedCostMs: 0.7,
|
|
2042
|
+
config: {
|
|
2043
|
+
maxDispatchesPerFrame: 1,
|
|
2044
|
+
maxJobsPerDispatch: 1,
|
|
2045
|
+
cadenceDivisor: 2,
|
|
2046
|
+
workgroupScale: 0.6,
|
|
2047
|
+
maxQueueDepth: 16
|
|
2048
|
+
}
|
|
2049
|
+
},
|
|
2050
|
+
{
|
|
2051
|
+
id: "medium",
|
|
2052
|
+
estimatedCostMs: 1.1,
|
|
2053
|
+
config: {
|
|
2054
|
+
maxDispatchesPerFrame: 1,
|
|
2055
|
+
maxJobsPerDispatch: 1,
|
|
2056
|
+
cadenceDivisor: 1,
|
|
2057
|
+
workgroupScale: 0.8,
|
|
2058
|
+
maxQueueDepth: 24
|
|
2059
|
+
}
|
|
2060
|
+
},
|
|
2061
|
+
{
|
|
2062
|
+
id: "high",
|
|
2063
|
+
estimatedCostMs: 1.6,
|
|
2064
|
+
config: {
|
|
2065
|
+
maxDispatchesPerFrame: 2,
|
|
2066
|
+
maxJobsPerDispatch: 2,
|
|
2067
|
+
cadenceDivisor: 1,
|
|
2068
|
+
workgroupScale: 1,
|
|
2069
|
+
maxQueueDepth: 32
|
|
2070
|
+
}
|
|
2071
|
+
}
|
|
2072
|
+
],
|
|
2073
|
+
suggestedAllocationIds: ["world.chunk.mesh.buffer"]
|
|
2074
|
+
},
|
|
2075
|
+
tileBake: {
|
|
2076
|
+
priority: 2,
|
|
2077
|
+
dependencies: ["terrainSynthesis"],
|
|
2078
|
+
domain: "textures",
|
|
2079
|
+
authority: "non-authoritative-simulation",
|
|
2080
|
+
importance: "medium",
|
|
2081
|
+
levels: [
|
|
2082
|
+
{
|
|
2083
|
+
id: "low",
|
|
2084
|
+
estimatedCostMs: 0.6,
|
|
2085
|
+
config: {
|
|
2086
|
+
maxDispatchesPerFrame: 1,
|
|
2087
|
+
maxJobsPerDispatch: 1,
|
|
2088
|
+
cadenceDivisor: 3,
|
|
2089
|
+
workgroupScale: 0.5,
|
|
2090
|
+
maxQueueDepth: 16
|
|
2091
|
+
}
|
|
2092
|
+
},
|
|
2093
|
+
{
|
|
2094
|
+
id: "medium",
|
|
2095
|
+
estimatedCostMs: 0.9,
|
|
2096
|
+
config: {
|
|
2097
|
+
maxDispatchesPerFrame: 1,
|
|
2098
|
+
maxJobsPerDispatch: 1,
|
|
2099
|
+
cadenceDivisor: 2,
|
|
2100
|
+
workgroupScale: 0.75,
|
|
2101
|
+
maxQueueDepth: 24
|
|
2102
|
+
}
|
|
2103
|
+
},
|
|
2104
|
+
{
|
|
2105
|
+
id: "high",
|
|
2106
|
+
estimatedCostMs: 1.3,
|
|
2107
|
+
config: {
|
|
2108
|
+
maxDispatchesPerFrame: 2,
|
|
2109
|
+
maxJobsPerDispatch: 2,
|
|
2110
|
+
cadenceDivisor: 1,
|
|
2111
|
+
workgroupScale: 1,
|
|
2112
|
+
maxQueueDepth: 32
|
|
2113
|
+
}
|
|
2114
|
+
}
|
|
2115
|
+
],
|
|
2116
|
+
suggestedAllocationIds: ["world.chunk.height.buffer"]
|
|
2117
|
+
}
|
|
2118
|
+
}
|
|
2119
|
+
},
|
|
2120
|
+
bake: {
|
|
2121
|
+
description: "Offline tile bake DAG for terrain generation, voxel materialization, mesh build, and asset serialization.",
|
|
2122
|
+
suggestedAllocationIds: [
|
|
2123
|
+
"world.bake.field.scratch",
|
|
2124
|
+
"world.bake.height.buffer",
|
|
2125
|
+
"world.bake.mesh.buffer",
|
|
2126
|
+
"world.bake.asset.binary"
|
|
2127
|
+
],
|
|
2128
|
+
jobs: {
|
|
2129
|
+
fractalPrepass: {
|
|
2130
|
+
priority: 4,
|
|
2131
|
+
dependencies: [],
|
|
2132
|
+
domain: "custom",
|
|
2133
|
+
authority: "authoritative",
|
|
2134
|
+
importance: "high",
|
|
2135
|
+
levels: [
|
|
2136
|
+
{
|
|
2137
|
+
id: "fixed",
|
|
2138
|
+
estimatedCostMs: 0.7,
|
|
2139
|
+
config: {
|
|
2140
|
+
maxDispatchesPerFrame: 1,
|
|
2141
|
+
maxJobsPerDispatch: 1,
|
|
2142
|
+
cadenceDivisor: 1,
|
|
2143
|
+
workgroupScale: 1,
|
|
2144
|
+
maxQueueDepth: 32
|
|
2145
|
+
}
|
|
2146
|
+
}
|
|
2147
|
+
],
|
|
2148
|
+
suggestedAllocationIds: ["world.bake.field.scratch"]
|
|
2149
|
+
},
|
|
2150
|
+
fieldSynthesis: {
|
|
2151
|
+
priority: 4,
|
|
2152
|
+
dependencies: [],
|
|
2153
|
+
domain: "custom",
|
|
2154
|
+
authority: "authoritative",
|
|
2155
|
+
importance: "critical",
|
|
2156
|
+
levels: [
|
|
2157
|
+
{
|
|
2158
|
+
id: "fixed",
|
|
2159
|
+
estimatedCostMs: 1,
|
|
2160
|
+
config: {
|
|
2161
|
+
maxDispatchesPerFrame: 1,
|
|
2162
|
+
maxJobsPerDispatch: 2,
|
|
2163
|
+
cadenceDivisor: 1,
|
|
2164
|
+
workgroupScale: 1,
|
|
2165
|
+
maxQueueDepth: 48
|
|
2166
|
+
}
|
|
2167
|
+
}
|
|
2168
|
+
],
|
|
2169
|
+
suggestedAllocationIds: ["world.bake.field.scratch"]
|
|
2170
|
+
},
|
|
2171
|
+
terrainSynthesis: {
|
|
2172
|
+
priority: 5,
|
|
2173
|
+
dependencies: ["fractalPrepass", "fieldSynthesis"],
|
|
2174
|
+
domain: "custom",
|
|
2175
|
+
authority: "authoritative",
|
|
2176
|
+
importance: "critical",
|
|
2177
|
+
levels: [
|
|
2178
|
+
{
|
|
2179
|
+
id: "fixed",
|
|
2180
|
+
estimatedCostMs: 1.6,
|
|
2181
|
+
config: {
|
|
2182
|
+
maxDispatchesPerFrame: 1,
|
|
2183
|
+
maxJobsPerDispatch: 1,
|
|
2184
|
+
cadenceDivisor: 1,
|
|
2185
|
+
workgroupScale: 1,
|
|
2186
|
+
maxQueueDepth: 32
|
|
2187
|
+
}
|
|
2188
|
+
}
|
|
2189
|
+
],
|
|
2190
|
+
suggestedAllocationIds: ["world.bake.height.buffer"]
|
|
2191
|
+
},
|
|
2192
|
+
voxelMaterialize: {
|
|
2193
|
+
priority: 3,
|
|
2194
|
+
dependencies: ["terrainSynthesis"],
|
|
2195
|
+
domain: "custom",
|
|
2196
|
+
authority: "non-authoritative-simulation",
|
|
2197
|
+
importance: "high",
|
|
2198
|
+
levels: [
|
|
2199
|
+
{
|
|
2200
|
+
id: "low",
|
|
2201
|
+
estimatedCostMs: 0.9,
|
|
2202
|
+
config: {
|
|
2203
|
+
maxDispatchesPerFrame: 1,
|
|
2204
|
+
maxJobsPerDispatch: 1,
|
|
2205
|
+
cadenceDivisor: 2,
|
|
2206
|
+
workgroupScale: 0.6,
|
|
2207
|
+
maxQueueDepth: 24
|
|
2208
|
+
}
|
|
2209
|
+
},
|
|
2210
|
+
{
|
|
2211
|
+
id: "medium",
|
|
2212
|
+
estimatedCostMs: 1.4,
|
|
2213
|
+
config: {
|
|
2214
|
+
maxDispatchesPerFrame: 1,
|
|
2215
|
+
maxJobsPerDispatch: 2,
|
|
2216
|
+
cadenceDivisor: 1,
|
|
2217
|
+
workgroupScale: 0.8,
|
|
2218
|
+
maxQueueDepth: 32
|
|
2219
|
+
}
|
|
2220
|
+
},
|
|
2221
|
+
{
|
|
2222
|
+
id: "high",
|
|
2223
|
+
estimatedCostMs: 2,
|
|
2224
|
+
config: {
|
|
2225
|
+
maxDispatchesPerFrame: 2,
|
|
2226
|
+
maxJobsPerDispatch: 2,
|
|
2227
|
+
cadenceDivisor: 1,
|
|
2228
|
+
workgroupScale: 1,
|
|
2229
|
+
maxQueueDepth: 48
|
|
2230
|
+
}
|
|
2231
|
+
}
|
|
2232
|
+
],
|
|
2233
|
+
suggestedAllocationIds: ["world.bake.height.buffer"]
|
|
2234
|
+
},
|
|
2235
|
+
meshBuild: {
|
|
2236
|
+
priority: 2,
|
|
2237
|
+
dependencies: ["terrainSynthesis", "voxelMaterialize"],
|
|
2238
|
+
domain: "geometry",
|
|
2239
|
+
authority: "visual",
|
|
2240
|
+
importance: "high",
|
|
2241
|
+
levels: [
|
|
2242
|
+
{
|
|
2243
|
+
id: "low",
|
|
2244
|
+
estimatedCostMs: 0.9,
|
|
2245
|
+
config: {
|
|
2246
|
+
maxDispatchesPerFrame: 1,
|
|
2247
|
+
maxJobsPerDispatch: 1,
|
|
2248
|
+
cadenceDivisor: 2,
|
|
2249
|
+
workgroupScale: 0.6,
|
|
2250
|
+
maxQueueDepth: 16
|
|
2251
|
+
}
|
|
2252
|
+
},
|
|
2253
|
+
{
|
|
2254
|
+
id: "medium",
|
|
2255
|
+
estimatedCostMs: 1.3,
|
|
2256
|
+
config: {
|
|
2257
|
+
maxDispatchesPerFrame: 1,
|
|
2258
|
+
maxJobsPerDispatch: 1,
|
|
2259
|
+
cadenceDivisor: 1,
|
|
2260
|
+
workgroupScale: 0.8,
|
|
2261
|
+
maxQueueDepth: 24
|
|
2262
|
+
}
|
|
2263
|
+
},
|
|
2264
|
+
{
|
|
2265
|
+
id: "high",
|
|
2266
|
+
estimatedCostMs: 1.9,
|
|
2267
|
+
config: {
|
|
2268
|
+
maxDispatchesPerFrame: 2,
|
|
2269
|
+
maxJobsPerDispatch: 2,
|
|
2270
|
+
cadenceDivisor: 1,
|
|
2271
|
+
workgroupScale: 1,
|
|
2272
|
+
maxQueueDepth: 32
|
|
2273
|
+
}
|
|
2274
|
+
}
|
|
2275
|
+
],
|
|
2276
|
+
suggestedAllocationIds: ["world.bake.mesh.buffer"]
|
|
2277
|
+
},
|
|
2278
|
+
tileBake: {
|
|
2279
|
+
priority: 2,
|
|
2280
|
+
dependencies: ["terrainSynthesis"],
|
|
2281
|
+
domain: "textures",
|
|
2282
|
+
authority: "non-authoritative-simulation",
|
|
2283
|
+
importance: "medium",
|
|
2284
|
+
levels: [
|
|
2285
|
+
{
|
|
2286
|
+
id: "low",
|
|
2287
|
+
estimatedCostMs: 0.8,
|
|
2288
|
+
config: {
|
|
2289
|
+
maxDispatchesPerFrame: 1,
|
|
2290
|
+
maxJobsPerDispatch: 1,
|
|
2291
|
+
cadenceDivisor: 3,
|
|
2292
|
+
workgroupScale: 0.5,
|
|
2293
|
+
maxQueueDepth: 16
|
|
2294
|
+
}
|
|
2295
|
+
},
|
|
2296
|
+
{
|
|
2297
|
+
id: "medium",
|
|
2298
|
+
estimatedCostMs: 1.1,
|
|
2299
|
+
config: {
|
|
2300
|
+
maxDispatchesPerFrame: 1,
|
|
2301
|
+
maxJobsPerDispatch: 1,
|
|
2302
|
+
cadenceDivisor: 2,
|
|
2303
|
+
workgroupScale: 0.75,
|
|
2304
|
+
maxQueueDepth: 24
|
|
2305
|
+
}
|
|
2306
|
+
},
|
|
2307
|
+
{
|
|
2308
|
+
id: "high",
|
|
2309
|
+
estimatedCostMs: 1.5,
|
|
2310
|
+
config: {
|
|
2311
|
+
maxDispatchesPerFrame: 2,
|
|
2312
|
+
maxJobsPerDispatch: 2,
|
|
2313
|
+
cadenceDivisor: 1,
|
|
2314
|
+
workgroupScale: 1,
|
|
2315
|
+
maxQueueDepth: 32
|
|
2316
|
+
}
|
|
2317
|
+
}
|
|
2318
|
+
],
|
|
2319
|
+
suggestedAllocationIds: ["world.bake.height.buffer"]
|
|
2320
|
+
},
|
|
2321
|
+
assetSerialize: {
|
|
2322
|
+
priority: 1,
|
|
2323
|
+
dependencies: ["meshBuild", "tileBake"],
|
|
2324
|
+
domain: "custom",
|
|
2325
|
+
authority: "non-authoritative-simulation",
|
|
2326
|
+
importance: "medium",
|
|
2327
|
+
levels: [
|
|
2328
|
+
{
|
|
2329
|
+
id: "low",
|
|
2330
|
+
estimatedCostMs: 0.4,
|
|
2331
|
+
config: {
|
|
2332
|
+
maxDispatchesPerFrame: 1,
|
|
2333
|
+
maxJobsPerDispatch: 1,
|
|
2334
|
+
cadenceDivisor: 4,
|
|
2335
|
+
workgroupScale: 0.5,
|
|
2336
|
+
maxQueueDepth: 8
|
|
2337
|
+
}
|
|
2338
|
+
},
|
|
2339
|
+
{
|
|
2340
|
+
id: "medium",
|
|
2341
|
+
estimatedCostMs: 0.7,
|
|
2342
|
+
config: {
|
|
2343
|
+
maxDispatchesPerFrame: 1,
|
|
2344
|
+
maxJobsPerDispatch: 1,
|
|
2345
|
+
cadenceDivisor: 2,
|
|
2346
|
+
workgroupScale: 0.75,
|
|
2347
|
+
maxQueueDepth: 12
|
|
2348
|
+
}
|
|
2349
|
+
},
|
|
2350
|
+
{
|
|
2351
|
+
id: "high",
|
|
2352
|
+
estimatedCostMs: 1,
|
|
2353
|
+
config: {
|
|
2354
|
+
maxDispatchesPerFrame: 2,
|
|
2355
|
+
maxJobsPerDispatch: 2,
|
|
2356
|
+
cadenceDivisor: 1,
|
|
2357
|
+
workgroupScale: 1,
|
|
2358
|
+
maxQueueDepth: 16
|
|
2359
|
+
}
|
|
2360
|
+
}
|
|
2361
|
+
],
|
|
2362
|
+
suggestedAllocationIds: ["world.bake.asset.binary"]
|
|
2363
|
+
}
|
|
2364
|
+
}
|
|
2365
|
+
}
|
|
2366
|
+
};
|
|
2367
|
+
function buildWorldGeneratorWorkerProfile(name, spec) {
|
|
2368
|
+
return Object.freeze({
|
|
2369
|
+
name,
|
|
2370
|
+
description: spec.description,
|
|
2371
|
+
jobs: Object.freeze(Object.keys(spec.jobs))
|
|
2372
|
+
});
|
|
2373
|
+
}
|
|
2374
|
+
function buildWorldGeneratorWorkerManifestJob(profileName, jobName, spec) {
|
|
2375
|
+
const label = `world-generator.${profileName}.${jobName}`;
|
|
2376
|
+
return Object.freeze({
|
|
2377
|
+
key: jobName,
|
|
2378
|
+
label,
|
|
2379
|
+
worker: Object.freeze({
|
|
2380
|
+
jobType: label,
|
|
2381
|
+
queueClass: worldGeneratorWorkerQueueClass,
|
|
2382
|
+
priority: spec.priority,
|
|
2383
|
+
dependencies: Object.freeze(
|
|
2384
|
+
spec.dependencies.map(
|
|
2385
|
+
(dependency) => `world-generator.${profileName}.${dependency}`
|
|
2386
|
+
)
|
|
2387
|
+
),
|
|
2388
|
+
schedulerMode: "dag"
|
|
2389
|
+
}),
|
|
2390
|
+
performance: Object.freeze({
|
|
2391
|
+
id: label,
|
|
2392
|
+
jobType: label,
|
|
2393
|
+
queueClass: worldGeneratorWorkerQueueClass,
|
|
2394
|
+
domain: spec.domain,
|
|
2395
|
+
authority: spec.authority,
|
|
2396
|
+
importance: spec.importance,
|
|
2397
|
+
levels: buildBudgetLevels(
|
|
2398
|
+
label,
|
|
2399
|
+
worldGeneratorWorkerQueueClass,
|
|
2400
|
+
spec.levels
|
|
2401
|
+
)
|
|
2402
|
+
}),
|
|
2403
|
+
debug: Object.freeze({
|
|
2404
|
+
owner: worldGeneratorDebugOwner,
|
|
2405
|
+
queueClass: worldGeneratorWorkerQueueClass,
|
|
2406
|
+
jobType: label,
|
|
2407
|
+
tags: Object.freeze(["world-generator", profileName, jobName, spec.domain]),
|
|
2408
|
+
suggestedAllocationIds: Object.freeze([...spec.suggestedAllocationIds])
|
|
2409
|
+
})
|
|
2410
|
+
});
|
|
2411
|
+
}
|
|
2412
|
+
function buildWorldGeneratorWorkerManifest(name, spec) {
|
|
2413
|
+
return Object.freeze({
|
|
2414
|
+
schemaVersion: 1,
|
|
2415
|
+
owner: worldGeneratorDebugOwner,
|
|
2416
|
+
profile: name,
|
|
2417
|
+
description: spec.description,
|
|
2418
|
+
queueClass: worldGeneratorWorkerQueueClass,
|
|
2419
|
+
schedulerMode: "dag",
|
|
2420
|
+
suggestedAllocationIds: Object.freeze([...spec.suggestedAllocationIds]),
|
|
2421
|
+
jobs: Object.freeze(
|
|
2422
|
+
Object.entries(spec.jobs).map(
|
|
2423
|
+
([jobName, jobSpec]) => buildWorldGeneratorWorkerManifestJob(name, jobName, jobSpec)
|
|
2424
|
+
)
|
|
2425
|
+
)
|
|
2426
|
+
});
|
|
2427
|
+
}
|
|
2428
|
+
var worldGeneratorWorkerProfiles = Object.freeze(
|
|
2429
|
+
Object.fromEntries(
|
|
2430
|
+
Object.entries(worldGeneratorWorkerProfileSpecs).map(([name, spec]) => [
|
|
2431
|
+
name,
|
|
2432
|
+
buildWorldGeneratorWorkerProfile(
|
|
2433
|
+
name,
|
|
2434
|
+
spec
|
|
2435
|
+
)
|
|
2436
|
+
])
|
|
2437
|
+
)
|
|
2438
|
+
);
|
|
2439
|
+
var worldGeneratorWorkerProfileNames = Object.freeze(
|
|
2440
|
+
Object.keys(worldGeneratorWorkerProfiles)
|
|
2441
|
+
);
|
|
2442
|
+
var worldGeneratorWorkerManifests = Object.freeze(
|
|
2443
|
+
Object.fromEntries(
|
|
2444
|
+
Object.entries(worldGeneratorWorkerProfileSpecs).map(([name, spec]) => [
|
|
2445
|
+
name,
|
|
2446
|
+
buildWorldGeneratorWorkerManifest(
|
|
2447
|
+
name,
|
|
2448
|
+
spec
|
|
2449
|
+
)
|
|
2450
|
+
])
|
|
2451
|
+
)
|
|
2452
|
+
);
|
|
2453
|
+
function getWorldGeneratorWorkerProfile(name = defaultWorldGeneratorWorkerProfile) {
|
|
2454
|
+
const profile = worldGeneratorWorkerProfiles[name];
|
|
2455
|
+
if (!profile) {
|
|
2456
|
+
const available = worldGeneratorWorkerProfileNames.join(", ");
|
|
2457
|
+
throw new Error(
|
|
2458
|
+
`Unknown world-generator worker profile "${name}". Available: ${available}.`
|
|
2459
|
+
);
|
|
2460
|
+
}
|
|
2461
|
+
return profile;
|
|
2462
|
+
}
|
|
2463
|
+
function getWorldGeneratorWorkerManifest(name = defaultWorldGeneratorWorkerProfile) {
|
|
2464
|
+
const manifest = worldGeneratorWorkerManifests[name];
|
|
2465
|
+
if (!manifest) {
|
|
2466
|
+
const available = worldGeneratorWorkerProfileNames.join(", ");
|
|
2467
|
+
throw new Error(
|
|
2468
|
+
`Unknown world-generator worker profile "${name}". Available: ${available}.`
|
|
2469
|
+
);
|
|
2470
|
+
}
|
|
2471
|
+
return manifest;
|
|
2472
|
+
}
|
|
1880
2473
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1881
2474
|
0 && (module.exports = {
|
|
1882
2475
|
DEFAULT_TILE_SIZE_WORLD,
|
|
@@ -1907,11 +2500,14 @@ function createMeshBuilder(sizeOrOptions = 1) {
|
|
|
1907
2500
|
createPerfMonitor,
|
|
1908
2501
|
defaultFieldParams,
|
|
1909
2502
|
defaultFractalMandelSettings,
|
|
2503
|
+
defaultWorldGeneratorWorkerProfile,
|
|
1910
2504
|
encodeTerrainParams,
|
|
1911
2505
|
fieldWgslUrl,
|
|
1912
2506
|
fractalPrepassWgslUrl,
|
|
1913
2507
|
generateHexGrid,
|
|
1914
2508
|
generateTemperateMixedForest,
|
|
2509
|
+
getWorldGeneratorWorkerManifest,
|
|
2510
|
+
getWorldGeneratorWorkerProfile,
|
|
1915
2511
|
hexAreaFromSide,
|
|
1916
2512
|
hexSideFromArea,
|
|
1917
2513
|
loadFieldWgsl,
|
|
@@ -1937,6 +2533,11 @@ function createMeshBuilder(sizeOrOptions = 1) {
|
|
|
1937
2533
|
tileKeyFromWorldPosition,
|
|
1938
2534
|
tileKeyToString,
|
|
1939
2535
|
unpackTerrain,
|
|
1940
|
-
validateTileAssetPayload
|
|
2536
|
+
validateTileAssetPayload,
|
|
2537
|
+
worldGeneratorDebugOwner,
|
|
2538
|
+
worldGeneratorWorkerManifests,
|
|
2539
|
+
worldGeneratorWorkerProfileNames,
|
|
2540
|
+
worldGeneratorWorkerProfiles,
|
|
2541
|
+
worldGeneratorWorkerQueueClass
|
|
1941
2542
|
});
|
|
1942
2543
|
//# sourceMappingURL=index.cjs.map
|