@plasius/gpu-world-generator 0.0.10 → 0.0.12
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 +48 -0
- package/dist/index.cjs +769 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +120 -1
- package/dist/index.d.ts +120 -1
- package/dist/index.js +757 -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/adr-0005-render-representation-tiers-and-proxy-outputs.md +51 -0
- package/docs/adrs/index.md +2 -0
- package/docs/design/worker-manifest-integration.md +42 -0
- package/docs/tdrs/index.md +4 -0
- package/docs/tdrs/tdr-0001-world-generator-worker-manifest-contract.md +39 -0
- package/docs/tdrs/tdr-0002-render-representation-tier-contract.md +60 -0
- package/package.json +6 -3
- package/src/index.ts +1 -0
- package/src/worker.ts +978 -0
package/dist/index.js
CHANGED
|
@@ -1784,6 +1784,751 @@ function createMeshBuilder(sizeOrOptions = 1) {
|
|
|
1784
1784
|
}
|
|
1785
1785
|
};
|
|
1786
1786
|
}
|
|
1787
|
+
|
|
1788
|
+
// src/worker.ts
|
|
1789
|
+
var worldGeneratorDebugOwner = "world-generator";
|
|
1790
|
+
var worldGeneratorWorkerQueueClass = "voxel";
|
|
1791
|
+
var defaultWorldGeneratorWorkerProfile = "streaming";
|
|
1792
|
+
var worldGeneratorRepresentationBands = Object.freeze([
|
|
1793
|
+
"near",
|
|
1794
|
+
"mid",
|
|
1795
|
+
"far",
|
|
1796
|
+
"horizon"
|
|
1797
|
+
]);
|
|
1798
|
+
var worldGeneratorRepresentationOutputs = Object.freeze([
|
|
1799
|
+
"liveGeometry",
|
|
1800
|
+
"simplifiedGeometry",
|
|
1801
|
+
"rtProxy",
|
|
1802
|
+
"mergedProxy",
|
|
1803
|
+
"horizonShell"
|
|
1804
|
+
]);
|
|
1805
|
+
var worldGeneratorRepresentationBandPriorityHints = Object.freeze({
|
|
1806
|
+
near: 400,
|
|
1807
|
+
mid: 300,
|
|
1808
|
+
far: 200,
|
|
1809
|
+
horizon: 100
|
|
1810
|
+
});
|
|
1811
|
+
function assertWorldGeneratorIdentifier(name, value) {
|
|
1812
|
+
if (typeof value !== "string" || value.trim().length === 0) {
|
|
1813
|
+
throw new Error(`${name} must be a non-empty string.`);
|
|
1814
|
+
}
|
|
1815
|
+
return value.trim();
|
|
1816
|
+
}
|
|
1817
|
+
function normalizeWorldGeneratorImportance(name, value) {
|
|
1818
|
+
if (value === "medium" || value === "high" || value === "critical") {
|
|
1819
|
+
return value;
|
|
1820
|
+
}
|
|
1821
|
+
throw new Error(`${name} must be one of: medium, high, critical.`);
|
|
1822
|
+
}
|
|
1823
|
+
function buildWorldGeneratorRepresentationDescriptor(options) {
|
|
1824
|
+
return Object.freeze({
|
|
1825
|
+
id: `${options.chunkId}.${options.band}.${options.output}`,
|
|
1826
|
+
chunkId: options.chunkId,
|
|
1827
|
+
profile: options.profile,
|
|
1828
|
+
band: options.band,
|
|
1829
|
+
output: options.output,
|
|
1830
|
+
rasterMode: options.rasterMode,
|
|
1831
|
+
rtParticipation: options.rtParticipation,
|
|
1832
|
+
shadowRelevance: options.shadowRelevance,
|
|
1833
|
+
refreshCadence: Object.freeze({
|
|
1834
|
+
kind: options.refreshCadence.kind,
|
|
1835
|
+
divisor: options.refreshCadence.divisor
|
|
1836
|
+
}),
|
|
1837
|
+
preservesChunkIdentity: options.preservesChunkIdentity,
|
|
1838
|
+
sourceChunkIds: Object.freeze([options.chunkId]),
|
|
1839
|
+
sourceJobKeys: Object.freeze([...options.sourceJobKeys]),
|
|
1840
|
+
suggestedAllocationIds: Object.freeze([...options.suggestedAllocationIds]),
|
|
1841
|
+
scheduling: Object.freeze({
|
|
1842
|
+
owner: "renderer",
|
|
1843
|
+
queueClass: worldGeneratorWorkerQueueClass,
|
|
1844
|
+
priorityHint: worldGeneratorRepresentationBandPriorityHints[options.band],
|
|
1845
|
+
gameplayImportance: options.gameplayImportance,
|
|
1846
|
+
representationBand: options.band
|
|
1847
|
+
})
|
|
1848
|
+
});
|
|
1849
|
+
}
|
|
1850
|
+
function buildBudgetLevels(jobType, queueClass, levels) {
|
|
1851
|
+
return Object.freeze(
|
|
1852
|
+
levels.map(
|
|
1853
|
+
(level) => Object.freeze({
|
|
1854
|
+
id: level.id,
|
|
1855
|
+
estimatedCostMs: level.estimatedCostMs,
|
|
1856
|
+
config: Object.freeze({
|
|
1857
|
+
maxDispatchesPerFrame: level.config.maxDispatchesPerFrame,
|
|
1858
|
+
maxJobsPerDispatch: level.config.maxJobsPerDispatch,
|
|
1859
|
+
cadenceDivisor: level.config.cadenceDivisor,
|
|
1860
|
+
workgroupScale: level.config.workgroupScale,
|
|
1861
|
+
maxQueueDepth: level.config.maxQueueDepth,
|
|
1862
|
+
metadata: Object.freeze({
|
|
1863
|
+
owner: worldGeneratorDebugOwner,
|
|
1864
|
+
queueClass,
|
|
1865
|
+
jobType,
|
|
1866
|
+
quality: level.id
|
|
1867
|
+
})
|
|
1868
|
+
})
|
|
1869
|
+
})
|
|
1870
|
+
)
|
|
1871
|
+
);
|
|
1872
|
+
}
|
|
1873
|
+
var worldGeneratorWorkerProfileSpecs = {
|
|
1874
|
+
streaming: {
|
|
1875
|
+
description: "Runtime chunk generation DAG for fractal prepass, terrain synthesis, voxel materialization, mesh build, and tile bake.",
|
|
1876
|
+
suggestedAllocationIds: [
|
|
1877
|
+
"world.chunk.field.scratch",
|
|
1878
|
+
"world.chunk.height.buffer",
|
|
1879
|
+
"world.chunk.voxel.buffer",
|
|
1880
|
+
"world.chunk.mesh.buffer"
|
|
1881
|
+
],
|
|
1882
|
+
jobs: {
|
|
1883
|
+
fractalPrepass: {
|
|
1884
|
+
priority: 4,
|
|
1885
|
+
dependencies: [],
|
|
1886
|
+
domain: "custom",
|
|
1887
|
+
authority: "authoritative",
|
|
1888
|
+
importance: "high",
|
|
1889
|
+
levels: [
|
|
1890
|
+
{
|
|
1891
|
+
id: "fixed",
|
|
1892
|
+
estimatedCostMs: 0.6,
|
|
1893
|
+
config: {
|
|
1894
|
+
maxDispatchesPerFrame: 1,
|
|
1895
|
+
maxJobsPerDispatch: 1,
|
|
1896
|
+
cadenceDivisor: 1,
|
|
1897
|
+
workgroupScale: 1,
|
|
1898
|
+
maxQueueDepth: 32
|
|
1899
|
+
}
|
|
1900
|
+
}
|
|
1901
|
+
],
|
|
1902
|
+
suggestedAllocationIds: ["world.chunk.field.scratch"]
|
|
1903
|
+
},
|
|
1904
|
+
fieldSynthesis: {
|
|
1905
|
+
priority: 4,
|
|
1906
|
+
dependencies: [],
|
|
1907
|
+
domain: "custom",
|
|
1908
|
+
authority: "authoritative",
|
|
1909
|
+
importance: "critical",
|
|
1910
|
+
levels: [
|
|
1911
|
+
{
|
|
1912
|
+
id: "fixed",
|
|
1913
|
+
estimatedCostMs: 0.9,
|
|
1914
|
+
config: {
|
|
1915
|
+
maxDispatchesPerFrame: 1,
|
|
1916
|
+
maxJobsPerDispatch: 2,
|
|
1917
|
+
cadenceDivisor: 1,
|
|
1918
|
+
workgroupScale: 1,
|
|
1919
|
+
maxQueueDepth: 48
|
|
1920
|
+
}
|
|
1921
|
+
}
|
|
1922
|
+
],
|
|
1923
|
+
suggestedAllocationIds: ["world.chunk.field.scratch"]
|
|
1924
|
+
},
|
|
1925
|
+
terrainSynthesis: {
|
|
1926
|
+
priority: 5,
|
|
1927
|
+
dependencies: ["fractalPrepass", "fieldSynthesis"],
|
|
1928
|
+
domain: "custom",
|
|
1929
|
+
authority: "authoritative",
|
|
1930
|
+
importance: "critical",
|
|
1931
|
+
levels: [
|
|
1932
|
+
{
|
|
1933
|
+
id: "fixed",
|
|
1934
|
+
estimatedCostMs: 1.4,
|
|
1935
|
+
config: {
|
|
1936
|
+
maxDispatchesPerFrame: 1,
|
|
1937
|
+
maxJobsPerDispatch: 1,
|
|
1938
|
+
cadenceDivisor: 1,
|
|
1939
|
+
workgroupScale: 1,
|
|
1940
|
+
maxQueueDepth: 32
|
|
1941
|
+
}
|
|
1942
|
+
}
|
|
1943
|
+
],
|
|
1944
|
+
suggestedAllocationIds: ["world.chunk.height.buffer"]
|
|
1945
|
+
},
|
|
1946
|
+
voxelMaterialize: {
|
|
1947
|
+
priority: 3,
|
|
1948
|
+
dependencies: ["terrainSynthesis"],
|
|
1949
|
+
domain: "custom",
|
|
1950
|
+
authority: "non-authoritative-simulation",
|
|
1951
|
+
importance: "high",
|
|
1952
|
+
levels: [
|
|
1953
|
+
{
|
|
1954
|
+
id: "low",
|
|
1955
|
+
estimatedCostMs: 0.8,
|
|
1956
|
+
config: {
|
|
1957
|
+
maxDispatchesPerFrame: 1,
|
|
1958
|
+
maxJobsPerDispatch: 1,
|
|
1959
|
+
cadenceDivisor: 2,
|
|
1960
|
+
workgroupScale: 0.6,
|
|
1961
|
+
maxQueueDepth: 24
|
|
1962
|
+
}
|
|
1963
|
+
},
|
|
1964
|
+
{
|
|
1965
|
+
id: "medium",
|
|
1966
|
+
estimatedCostMs: 1.2,
|
|
1967
|
+
config: {
|
|
1968
|
+
maxDispatchesPerFrame: 1,
|
|
1969
|
+
maxJobsPerDispatch: 2,
|
|
1970
|
+
cadenceDivisor: 1,
|
|
1971
|
+
workgroupScale: 0.8,
|
|
1972
|
+
maxQueueDepth: 32
|
|
1973
|
+
}
|
|
1974
|
+
},
|
|
1975
|
+
{
|
|
1976
|
+
id: "high",
|
|
1977
|
+
estimatedCostMs: 1.8,
|
|
1978
|
+
config: {
|
|
1979
|
+
maxDispatchesPerFrame: 2,
|
|
1980
|
+
maxJobsPerDispatch: 2,
|
|
1981
|
+
cadenceDivisor: 1,
|
|
1982
|
+
workgroupScale: 1,
|
|
1983
|
+
maxQueueDepth: 40
|
|
1984
|
+
}
|
|
1985
|
+
}
|
|
1986
|
+
],
|
|
1987
|
+
suggestedAllocationIds: ["world.chunk.voxel.buffer"]
|
|
1988
|
+
},
|
|
1989
|
+
meshBuild: {
|
|
1990
|
+
priority: 2,
|
|
1991
|
+
dependencies: ["terrainSynthesis", "voxelMaterialize"],
|
|
1992
|
+
domain: "geometry",
|
|
1993
|
+
authority: "visual",
|
|
1994
|
+
importance: "high",
|
|
1995
|
+
levels: [
|
|
1996
|
+
{
|
|
1997
|
+
id: "low",
|
|
1998
|
+
estimatedCostMs: 0.7,
|
|
1999
|
+
config: {
|
|
2000
|
+
maxDispatchesPerFrame: 1,
|
|
2001
|
+
maxJobsPerDispatch: 1,
|
|
2002
|
+
cadenceDivisor: 2,
|
|
2003
|
+
workgroupScale: 0.6,
|
|
2004
|
+
maxQueueDepth: 16
|
|
2005
|
+
}
|
|
2006
|
+
},
|
|
2007
|
+
{
|
|
2008
|
+
id: "medium",
|
|
2009
|
+
estimatedCostMs: 1.1,
|
|
2010
|
+
config: {
|
|
2011
|
+
maxDispatchesPerFrame: 1,
|
|
2012
|
+
maxJobsPerDispatch: 1,
|
|
2013
|
+
cadenceDivisor: 1,
|
|
2014
|
+
workgroupScale: 0.8,
|
|
2015
|
+
maxQueueDepth: 24
|
|
2016
|
+
}
|
|
2017
|
+
},
|
|
2018
|
+
{
|
|
2019
|
+
id: "high",
|
|
2020
|
+
estimatedCostMs: 1.6,
|
|
2021
|
+
config: {
|
|
2022
|
+
maxDispatchesPerFrame: 2,
|
|
2023
|
+
maxJobsPerDispatch: 2,
|
|
2024
|
+
cadenceDivisor: 1,
|
|
2025
|
+
workgroupScale: 1,
|
|
2026
|
+
maxQueueDepth: 32
|
|
2027
|
+
}
|
|
2028
|
+
}
|
|
2029
|
+
],
|
|
2030
|
+
suggestedAllocationIds: ["world.chunk.mesh.buffer"]
|
|
2031
|
+
},
|
|
2032
|
+
tileBake: {
|
|
2033
|
+
priority: 2,
|
|
2034
|
+
dependencies: ["terrainSynthesis"],
|
|
2035
|
+
domain: "textures",
|
|
2036
|
+
authority: "non-authoritative-simulation",
|
|
2037
|
+
importance: "medium",
|
|
2038
|
+
levels: [
|
|
2039
|
+
{
|
|
2040
|
+
id: "low",
|
|
2041
|
+
estimatedCostMs: 0.6,
|
|
2042
|
+
config: {
|
|
2043
|
+
maxDispatchesPerFrame: 1,
|
|
2044
|
+
maxJobsPerDispatch: 1,
|
|
2045
|
+
cadenceDivisor: 3,
|
|
2046
|
+
workgroupScale: 0.5,
|
|
2047
|
+
maxQueueDepth: 16
|
|
2048
|
+
}
|
|
2049
|
+
},
|
|
2050
|
+
{
|
|
2051
|
+
id: "medium",
|
|
2052
|
+
estimatedCostMs: 0.9,
|
|
2053
|
+
config: {
|
|
2054
|
+
maxDispatchesPerFrame: 1,
|
|
2055
|
+
maxJobsPerDispatch: 1,
|
|
2056
|
+
cadenceDivisor: 2,
|
|
2057
|
+
workgroupScale: 0.75,
|
|
2058
|
+
maxQueueDepth: 24
|
|
2059
|
+
}
|
|
2060
|
+
},
|
|
2061
|
+
{
|
|
2062
|
+
id: "high",
|
|
2063
|
+
estimatedCostMs: 1.3,
|
|
2064
|
+
config: {
|
|
2065
|
+
maxDispatchesPerFrame: 2,
|
|
2066
|
+
maxJobsPerDispatch: 2,
|
|
2067
|
+
cadenceDivisor: 1,
|
|
2068
|
+
workgroupScale: 1,
|
|
2069
|
+
maxQueueDepth: 32
|
|
2070
|
+
}
|
|
2071
|
+
}
|
|
2072
|
+
],
|
|
2073
|
+
suggestedAllocationIds: ["world.chunk.height.buffer"]
|
|
2074
|
+
}
|
|
2075
|
+
}
|
|
2076
|
+
},
|
|
2077
|
+
bake: {
|
|
2078
|
+
description: "Offline tile bake DAG for terrain generation, voxel materialization, mesh build, and asset serialization.",
|
|
2079
|
+
suggestedAllocationIds: [
|
|
2080
|
+
"world.bake.field.scratch",
|
|
2081
|
+
"world.bake.height.buffer",
|
|
2082
|
+
"world.bake.mesh.buffer",
|
|
2083
|
+
"world.bake.asset.binary"
|
|
2084
|
+
],
|
|
2085
|
+
jobs: {
|
|
2086
|
+
fractalPrepass: {
|
|
2087
|
+
priority: 4,
|
|
2088
|
+
dependencies: [],
|
|
2089
|
+
domain: "custom",
|
|
2090
|
+
authority: "authoritative",
|
|
2091
|
+
importance: "high",
|
|
2092
|
+
levels: [
|
|
2093
|
+
{
|
|
2094
|
+
id: "fixed",
|
|
2095
|
+
estimatedCostMs: 0.7,
|
|
2096
|
+
config: {
|
|
2097
|
+
maxDispatchesPerFrame: 1,
|
|
2098
|
+
maxJobsPerDispatch: 1,
|
|
2099
|
+
cadenceDivisor: 1,
|
|
2100
|
+
workgroupScale: 1,
|
|
2101
|
+
maxQueueDepth: 32
|
|
2102
|
+
}
|
|
2103
|
+
}
|
|
2104
|
+
],
|
|
2105
|
+
suggestedAllocationIds: ["world.bake.field.scratch"]
|
|
2106
|
+
},
|
|
2107
|
+
fieldSynthesis: {
|
|
2108
|
+
priority: 4,
|
|
2109
|
+
dependencies: [],
|
|
2110
|
+
domain: "custom",
|
|
2111
|
+
authority: "authoritative",
|
|
2112
|
+
importance: "critical",
|
|
2113
|
+
levels: [
|
|
2114
|
+
{
|
|
2115
|
+
id: "fixed",
|
|
2116
|
+
estimatedCostMs: 1,
|
|
2117
|
+
config: {
|
|
2118
|
+
maxDispatchesPerFrame: 1,
|
|
2119
|
+
maxJobsPerDispatch: 2,
|
|
2120
|
+
cadenceDivisor: 1,
|
|
2121
|
+
workgroupScale: 1,
|
|
2122
|
+
maxQueueDepth: 48
|
|
2123
|
+
}
|
|
2124
|
+
}
|
|
2125
|
+
],
|
|
2126
|
+
suggestedAllocationIds: ["world.bake.field.scratch"]
|
|
2127
|
+
},
|
|
2128
|
+
terrainSynthesis: {
|
|
2129
|
+
priority: 5,
|
|
2130
|
+
dependencies: ["fractalPrepass", "fieldSynthesis"],
|
|
2131
|
+
domain: "custom",
|
|
2132
|
+
authority: "authoritative",
|
|
2133
|
+
importance: "critical",
|
|
2134
|
+
levels: [
|
|
2135
|
+
{
|
|
2136
|
+
id: "fixed",
|
|
2137
|
+
estimatedCostMs: 1.6,
|
|
2138
|
+
config: {
|
|
2139
|
+
maxDispatchesPerFrame: 1,
|
|
2140
|
+
maxJobsPerDispatch: 1,
|
|
2141
|
+
cadenceDivisor: 1,
|
|
2142
|
+
workgroupScale: 1,
|
|
2143
|
+
maxQueueDepth: 32
|
|
2144
|
+
}
|
|
2145
|
+
}
|
|
2146
|
+
],
|
|
2147
|
+
suggestedAllocationIds: ["world.bake.height.buffer"]
|
|
2148
|
+
},
|
|
2149
|
+
voxelMaterialize: {
|
|
2150
|
+
priority: 3,
|
|
2151
|
+
dependencies: ["terrainSynthesis"],
|
|
2152
|
+
domain: "custom",
|
|
2153
|
+
authority: "non-authoritative-simulation",
|
|
2154
|
+
importance: "high",
|
|
2155
|
+
levels: [
|
|
2156
|
+
{
|
|
2157
|
+
id: "low",
|
|
2158
|
+
estimatedCostMs: 0.9,
|
|
2159
|
+
config: {
|
|
2160
|
+
maxDispatchesPerFrame: 1,
|
|
2161
|
+
maxJobsPerDispatch: 1,
|
|
2162
|
+
cadenceDivisor: 2,
|
|
2163
|
+
workgroupScale: 0.6,
|
|
2164
|
+
maxQueueDepth: 24
|
|
2165
|
+
}
|
|
2166
|
+
},
|
|
2167
|
+
{
|
|
2168
|
+
id: "medium",
|
|
2169
|
+
estimatedCostMs: 1.4,
|
|
2170
|
+
config: {
|
|
2171
|
+
maxDispatchesPerFrame: 1,
|
|
2172
|
+
maxJobsPerDispatch: 2,
|
|
2173
|
+
cadenceDivisor: 1,
|
|
2174
|
+
workgroupScale: 0.8,
|
|
2175
|
+
maxQueueDepth: 32
|
|
2176
|
+
}
|
|
2177
|
+
},
|
|
2178
|
+
{
|
|
2179
|
+
id: "high",
|
|
2180
|
+
estimatedCostMs: 2,
|
|
2181
|
+
config: {
|
|
2182
|
+
maxDispatchesPerFrame: 2,
|
|
2183
|
+
maxJobsPerDispatch: 2,
|
|
2184
|
+
cadenceDivisor: 1,
|
|
2185
|
+
workgroupScale: 1,
|
|
2186
|
+
maxQueueDepth: 48
|
|
2187
|
+
}
|
|
2188
|
+
}
|
|
2189
|
+
],
|
|
2190
|
+
suggestedAllocationIds: ["world.bake.height.buffer"]
|
|
2191
|
+
},
|
|
2192
|
+
meshBuild: {
|
|
2193
|
+
priority: 2,
|
|
2194
|
+
dependencies: ["terrainSynthesis", "voxelMaterialize"],
|
|
2195
|
+
domain: "geometry",
|
|
2196
|
+
authority: "visual",
|
|
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: 16
|
|
2208
|
+
}
|
|
2209
|
+
},
|
|
2210
|
+
{
|
|
2211
|
+
id: "medium",
|
|
2212
|
+
estimatedCostMs: 1.3,
|
|
2213
|
+
config: {
|
|
2214
|
+
maxDispatchesPerFrame: 1,
|
|
2215
|
+
maxJobsPerDispatch: 1,
|
|
2216
|
+
cadenceDivisor: 1,
|
|
2217
|
+
workgroupScale: 0.8,
|
|
2218
|
+
maxQueueDepth: 24
|
|
2219
|
+
}
|
|
2220
|
+
},
|
|
2221
|
+
{
|
|
2222
|
+
id: "high",
|
|
2223
|
+
estimatedCostMs: 1.9,
|
|
2224
|
+
config: {
|
|
2225
|
+
maxDispatchesPerFrame: 2,
|
|
2226
|
+
maxJobsPerDispatch: 2,
|
|
2227
|
+
cadenceDivisor: 1,
|
|
2228
|
+
workgroupScale: 1,
|
|
2229
|
+
maxQueueDepth: 32
|
|
2230
|
+
}
|
|
2231
|
+
}
|
|
2232
|
+
],
|
|
2233
|
+
suggestedAllocationIds: ["world.bake.mesh.buffer"]
|
|
2234
|
+
},
|
|
2235
|
+
tileBake: {
|
|
2236
|
+
priority: 2,
|
|
2237
|
+
dependencies: ["terrainSynthesis"],
|
|
2238
|
+
domain: "textures",
|
|
2239
|
+
authority: "non-authoritative-simulation",
|
|
2240
|
+
importance: "medium",
|
|
2241
|
+
levels: [
|
|
2242
|
+
{
|
|
2243
|
+
id: "low",
|
|
2244
|
+
estimatedCostMs: 0.8,
|
|
2245
|
+
config: {
|
|
2246
|
+
maxDispatchesPerFrame: 1,
|
|
2247
|
+
maxJobsPerDispatch: 1,
|
|
2248
|
+
cadenceDivisor: 3,
|
|
2249
|
+
workgroupScale: 0.5,
|
|
2250
|
+
maxQueueDepth: 16
|
|
2251
|
+
}
|
|
2252
|
+
},
|
|
2253
|
+
{
|
|
2254
|
+
id: "medium",
|
|
2255
|
+
estimatedCostMs: 1.1,
|
|
2256
|
+
config: {
|
|
2257
|
+
maxDispatchesPerFrame: 1,
|
|
2258
|
+
maxJobsPerDispatch: 1,
|
|
2259
|
+
cadenceDivisor: 2,
|
|
2260
|
+
workgroupScale: 0.75,
|
|
2261
|
+
maxQueueDepth: 24
|
|
2262
|
+
}
|
|
2263
|
+
},
|
|
2264
|
+
{
|
|
2265
|
+
id: "high",
|
|
2266
|
+
estimatedCostMs: 1.5,
|
|
2267
|
+
config: {
|
|
2268
|
+
maxDispatchesPerFrame: 2,
|
|
2269
|
+
maxJobsPerDispatch: 2,
|
|
2270
|
+
cadenceDivisor: 1,
|
|
2271
|
+
workgroupScale: 1,
|
|
2272
|
+
maxQueueDepth: 32
|
|
2273
|
+
}
|
|
2274
|
+
}
|
|
2275
|
+
],
|
|
2276
|
+
suggestedAllocationIds: ["world.bake.height.buffer"]
|
|
2277
|
+
},
|
|
2278
|
+
assetSerialize: {
|
|
2279
|
+
priority: 1,
|
|
2280
|
+
dependencies: ["meshBuild", "tileBake"],
|
|
2281
|
+
domain: "custom",
|
|
2282
|
+
authority: "non-authoritative-simulation",
|
|
2283
|
+
importance: "medium",
|
|
2284
|
+
levels: [
|
|
2285
|
+
{
|
|
2286
|
+
id: "low",
|
|
2287
|
+
estimatedCostMs: 0.4,
|
|
2288
|
+
config: {
|
|
2289
|
+
maxDispatchesPerFrame: 1,
|
|
2290
|
+
maxJobsPerDispatch: 1,
|
|
2291
|
+
cadenceDivisor: 4,
|
|
2292
|
+
workgroupScale: 0.5,
|
|
2293
|
+
maxQueueDepth: 8
|
|
2294
|
+
}
|
|
2295
|
+
},
|
|
2296
|
+
{
|
|
2297
|
+
id: "medium",
|
|
2298
|
+
estimatedCostMs: 0.7,
|
|
2299
|
+
config: {
|
|
2300
|
+
maxDispatchesPerFrame: 1,
|
|
2301
|
+
maxJobsPerDispatch: 1,
|
|
2302
|
+
cadenceDivisor: 2,
|
|
2303
|
+
workgroupScale: 0.75,
|
|
2304
|
+
maxQueueDepth: 12
|
|
2305
|
+
}
|
|
2306
|
+
},
|
|
2307
|
+
{
|
|
2308
|
+
id: "high",
|
|
2309
|
+
estimatedCostMs: 1,
|
|
2310
|
+
config: {
|
|
2311
|
+
maxDispatchesPerFrame: 2,
|
|
2312
|
+
maxJobsPerDispatch: 2,
|
|
2313
|
+
cadenceDivisor: 1,
|
|
2314
|
+
workgroupScale: 1,
|
|
2315
|
+
maxQueueDepth: 16
|
|
2316
|
+
}
|
|
2317
|
+
}
|
|
2318
|
+
],
|
|
2319
|
+
suggestedAllocationIds: ["world.bake.asset.binary"]
|
|
2320
|
+
}
|
|
2321
|
+
}
|
|
2322
|
+
}
|
|
2323
|
+
};
|
|
2324
|
+
function buildWorldGeneratorWorkerProfile(name, spec) {
|
|
2325
|
+
return Object.freeze({
|
|
2326
|
+
name,
|
|
2327
|
+
description: spec.description,
|
|
2328
|
+
jobs: Object.freeze(Object.keys(spec.jobs))
|
|
2329
|
+
});
|
|
2330
|
+
}
|
|
2331
|
+
function buildWorldGeneratorWorkerManifestJob(profileName, jobName, spec) {
|
|
2332
|
+
const label = `world-generator.${profileName}.${jobName}`;
|
|
2333
|
+
return Object.freeze({
|
|
2334
|
+
key: jobName,
|
|
2335
|
+
label,
|
|
2336
|
+
worker: Object.freeze({
|
|
2337
|
+
jobType: label,
|
|
2338
|
+
queueClass: worldGeneratorWorkerQueueClass,
|
|
2339
|
+
priority: spec.priority,
|
|
2340
|
+
dependencies: Object.freeze(
|
|
2341
|
+
spec.dependencies.map(
|
|
2342
|
+
(dependency) => `world-generator.${profileName}.${dependency}`
|
|
2343
|
+
)
|
|
2344
|
+
),
|
|
2345
|
+
schedulerMode: "dag"
|
|
2346
|
+
}),
|
|
2347
|
+
performance: Object.freeze({
|
|
2348
|
+
id: label,
|
|
2349
|
+
jobType: label,
|
|
2350
|
+
queueClass: worldGeneratorWorkerQueueClass,
|
|
2351
|
+
domain: spec.domain,
|
|
2352
|
+
authority: spec.authority,
|
|
2353
|
+
importance: spec.importance,
|
|
2354
|
+
levels: buildBudgetLevels(
|
|
2355
|
+
label,
|
|
2356
|
+
worldGeneratorWorkerQueueClass,
|
|
2357
|
+
spec.levels
|
|
2358
|
+
)
|
|
2359
|
+
}),
|
|
2360
|
+
debug: Object.freeze({
|
|
2361
|
+
owner: worldGeneratorDebugOwner,
|
|
2362
|
+
queueClass: worldGeneratorWorkerQueueClass,
|
|
2363
|
+
jobType: label,
|
|
2364
|
+
tags: Object.freeze(["world-generator", profileName, jobName, spec.domain]),
|
|
2365
|
+
suggestedAllocationIds: Object.freeze([...spec.suggestedAllocationIds])
|
|
2366
|
+
})
|
|
2367
|
+
});
|
|
2368
|
+
}
|
|
2369
|
+
function buildWorldGeneratorWorkerManifest(name, spec) {
|
|
2370
|
+
return Object.freeze({
|
|
2371
|
+
schemaVersion: 1,
|
|
2372
|
+
owner: worldGeneratorDebugOwner,
|
|
2373
|
+
profile: name,
|
|
2374
|
+
description: spec.description,
|
|
2375
|
+
queueClass: worldGeneratorWorkerQueueClass,
|
|
2376
|
+
schedulerMode: "dag",
|
|
2377
|
+
suggestedAllocationIds: Object.freeze([...spec.suggestedAllocationIds]),
|
|
2378
|
+
jobs: Object.freeze(
|
|
2379
|
+
Object.entries(spec.jobs).map(
|
|
2380
|
+
([jobName, jobSpec]) => buildWorldGeneratorWorkerManifestJob(name, jobName, jobSpec)
|
|
2381
|
+
)
|
|
2382
|
+
)
|
|
2383
|
+
});
|
|
2384
|
+
}
|
|
2385
|
+
var worldGeneratorWorkerProfiles = Object.freeze(
|
|
2386
|
+
Object.fromEntries(
|
|
2387
|
+
Object.entries(worldGeneratorWorkerProfileSpecs).map(([name, spec]) => [
|
|
2388
|
+
name,
|
|
2389
|
+
buildWorldGeneratorWorkerProfile(
|
|
2390
|
+
name,
|
|
2391
|
+
spec
|
|
2392
|
+
)
|
|
2393
|
+
])
|
|
2394
|
+
)
|
|
2395
|
+
);
|
|
2396
|
+
var worldGeneratorWorkerProfileNames = Object.freeze(
|
|
2397
|
+
Object.keys(worldGeneratorWorkerProfiles)
|
|
2398
|
+
);
|
|
2399
|
+
var worldGeneratorWorkerManifests = Object.freeze(
|
|
2400
|
+
Object.fromEntries(
|
|
2401
|
+
Object.entries(worldGeneratorWorkerProfileSpecs).map(([name, spec]) => [
|
|
2402
|
+
name,
|
|
2403
|
+
buildWorldGeneratorWorkerManifest(
|
|
2404
|
+
name,
|
|
2405
|
+
spec
|
|
2406
|
+
)
|
|
2407
|
+
])
|
|
2408
|
+
)
|
|
2409
|
+
);
|
|
2410
|
+
function getWorldGeneratorWorkerProfile(name = defaultWorldGeneratorWorkerProfile) {
|
|
2411
|
+
const profile = worldGeneratorWorkerProfiles[name];
|
|
2412
|
+
if (!profile) {
|
|
2413
|
+
const available = worldGeneratorWorkerProfileNames.join(", ");
|
|
2414
|
+
throw new Error(
|
|
2415
|
+
`Unknown world-generator worker profile "${name}". Available: ${available}.`
|
|
2416
|
+
);
|
|
2417
|
+
}
|
|
2418
|
+
return profile;
|
|
2419
|
+
}
|
|
2420
|
+
function getWorldGeneratorWorkerManifest(name = defaultWorldGeneratorWorkerProfile) {
|
|
2421
|
+
const manifest = worldGeneratorWorkerManifests[name];
|
|
2422
|
+
if (!manifest) {
|
|
2423
|
+
const available = worldGeneratorWorkerProfileNames.join(", ");
|
|
2424
|
+
throw new Error(
|
|
2425
|
+
`Unknown world-generator worker profile "${name}". Available: ${available}.`
|
|
2426
|
+
);
|
|
2427
|
+
}
|
|
2428
|
+
return manifest;
|
|
2429
|
+
}
|
|
2430
|
+
function createWorldGeneratorRepresentationPlan(options) {
|
|
2431
|
+
const profile = options.profile ?? defaultWorldGeneratorWorkerProfile;
|
|
2432
|
+
const spec = worldGeneratorWorkerProfileSpecs[profile];
|
|
2433
|
+
if (!spec) {
|
|
2434
|
+
const available = worldGeneratorWorkerProfileNames.join(", ");
|
|
2435
|
+
throw new Error(
|
|
2436
|
+
`Unknown world-generator worker profile "${profile}". Available: ${available}.`
|
|
2437
|
+
);
|
|
2438
|
+
}
|
|
2439
|
+
const chunkId = assertWorldGeneratorIdentifier("chunkId", options.chunkId);
|
|
2440
|
+
const gameplayImportance = normalizeWorldGeneratorImportance(
|
|
2441
|
+
"gameplayImportance",
|
|
2442
|
+
options.gameplayImportance ?? "high"
|
|
2443
|
+
);
|
|
2444
|
+
const highValueAllocations = spec.suggestedAllocationIds;
|
|
2445
|
+
const farFieldAllocations = spec.suggestedAllocationIds.filter(
|
|
2446
|
+
(allocationId) => allocationId.includes("mesh") || allocationId.includes("asset") || allocationId.includes("tile")
|
|
2447
|
+
);
|
|
2448
|
+
const bakeSourceJobKeys = profile === "bake" ? ["meshBuild", "tileBake", "assetSerialize"] : ["meshBuild", "tileBake"];
|
|
2449
|
+
const representations = Object.freeze([
|
|
2450
|
+
buildWorldGeneratorRepresentationDescriptor({
|
|
2451
|
+
profile,
|
|
2452
|
+
chunkId,
|
|
2453
|
+
band: "near",
|
|
2454
|
+
output: "liveGeometry",
|
|
2455
|
+
rasterMode: "full-live",
|
|
2456
|
+
rtParticipation: "full",
|
|
2457
|
+
shadowRelevance: "ray-traced-primary",
|
|
2458
|
+
refreshCadence: { kind: "per-frame", divisor: 1 },
|
|
2459
|
+
preservesChunkIdentity: true,
|
|
2460
|
+
sourceJobKeys: ["meshBuild"],
|
|
2461
|
+
gameplayImportance: gameplayImportance === "medium" ? "high" : gameplayImportance,
|
|
2462
|
+
suggestedAllocationIds: highValueAllocations
|
|
2463
|
+
}),
|
|
2464
|
+
buildWorldGeneratorRepresentationDescriptor({
|
|
2465
|
+
profile,
|
|
2466
|
+
chunkId,
|
|
2467
|
+
band: "mid",
|
|
2468
|
+
output: "simplifiedGeometry",
|
|
2469
|
+
rasterMode: "simplified-live",
|
|
2470
|
+
rtParticipation: "selective",
|
|
2471
|
+
shadowRelevance: "selective-raster",
|
|
2472
|
+
refreshCadence: { kind: "interval", divisor: 2 },
|
|
2473
|
+
preservesChunkIdentity: true,
|
|
2474
|
+
sourceJobKeys: ["meshBuild"],
|
|
2475
|
+
gameplayImportance,
|
|
2476
|
+
suggestedAllocationIds: highValueAllocations
|
|
2477
|
+
}),
|
|
2478
|
+
buildWorldGeneratorRepresentationDescriptor({
|
|
2479
|
+
profile,
|
|
2480
|
+
chunkId,
|
|
2481
|
+
band: "mid",
|
|
2482
|
+
output: "rtProxy",
|
|
2483
|
+
rasterMode: "not-rendered",
|
|
2484
|
+
rtParticipation: "proxy",
|
|
2485
|
+
shadowRelevance: "selective-raster",
|
|
2486
|
+
refreshCadence: { kind: "interval", divisor: 2 },
|
|
2487
|
+
preservesChunkIdentity: true,
|
|
2488
|
+
sourceJobKeys: ["meshBuild", "tileBake"],
|
|
2489
|
+
gameplayImportance,
|
|
2490
|
+
suggestedAllocationIds: highValueAllocations
|
|
2491
|
+
}),
|
|
2492
|
+
buildWorldGeneratorRepresentationDescriptor({
|
|
2493
|
+
profile,
|
|
2494
|
+
chunkId,
|
|
2495
|
+
band: "far",
|
|
2496
|
+
output: "mergedProxy",
|
|
2497
|
+
rasterMode: "proxy",
|
|
2498
|
+
rtParticipation: "proxy",
|
|
2499
|
+
shadowRelevance: "proxy-caster",
|
|
2500
|
+
refreshCadence: { kind: "interval", divisor: 8 },
|
|
2501
|
+
preservesChunkIdentity: true,
|
|
2502
|
+
sourceJobKeys: bakeSourceJobKeys,
|
|
2503
|
+
gameplayImportance: "medium",
|
|
2504
|
+
suggestedAllocationIds: farFieldAllocations.length > 0 ? farFieldAllocations : highValueAllocations
|
|
2505
|
+
}),
|
|
2506
|
+
buildWorldGeneratorRepresentationDescriptor({
|
|
2507
|
+
profile,
|
|
2508
|
+
chunkId,
|
|
2509
|
+
band: "horizon",
|
|
2510
|
+
output: "horizonShell",
|
|
2511
|
+
rasterMode: "horizon-shell",
|
|
2512
|
+
rtParticipation: "disabled",
|
|
2513
|
+
shadowRelevance: "baked-impression",
|
|
2514
|
+
refreshCadence: { kind: "interval", divisor: 60 },
|
|
2515
|
+
preservesChunkIdentity: true,
|
|
2516
|
+
sourceJobKeys: profile === "bake" ? ["tileBake", "assetSerialize"] : ["tileBake"],
|
|
2517
|
+
gameplayImportance: "medium",
|
|
2518
|
+
suggestedAllocationIds: farFieldAllocations.length > 0 ? farFieldAllocations : highValueAllocations
|
|
2519
|
+
})
|
|
2520
|
+
]);
|
|
2521
|
+
return Object.freeze({
|
|
2522
|
+
schemaVersion: 1,
|
|
2523
|
+
owner: worldGeneratorDebugOwner,
|
|
2524
|
+
profile,
|
|
2525
|
+
chunkId,
|
|
2526
|
+
representations,
|
|
2527
|
+
bands: Object.freeze(
|
|
2528
|
+
[...new Set(representations.map((representation) => representation.band))]
|
|
2529
|
+
)
|
|
2530
|
+
});
|
|
2531
|
+
}
|
|
1787
2532
|
export {
|
|
1788
2533
|
DEFAULT_TILE_SIZE_WORLD,
|
|
1789
2534
|
FIELD_DOWNWARD_MAX,
|
|
@@ -1811,13 +2556,17 @@ export {
|
|
|
1811
2556
|
createFractalPrepassRunner,
|
|
1812
2557
|
createMeshBuilder,
|
|
1813
2558
|
createPerfMonitor,
|
|
2559
|
+
createWorldGeneratorRepresentationPlan,
|
|
1814
2560
|
defaultFieldParams,
|
|
1815
2561
|
defaultFractalMandelSettings,
|
|
2562
|
+
defaultWorldGeneratorWorkerProfile,
|
|
1816
2563
|
encodeTerrainParams,
|
|
1817
2564
|
fieldWgslUrl,
|
|
1818
2565
|
fractalPrepassWgslUrl,
|
|
1819
2566
|
generateHexGrid,
|
|
1820
2567
|
generateTemperateMixedForest,
|
|
2568
|
+
getWorldGeneratorWorkerManifest,
|
|
2569
|
+
getWorldGeneratorWorkerProfile,
|
|
1821
2570
|
hexAreaFromSide,
|
|
1822
2571
|
hexSideFromArea,
|
|
1823
2572
|
loadFieldWgsl,
|
|
@@ -1843,6 +2592,13 @@ export {
|
|
|
1843
2592
|
tileKeyFromWorldPosition,
|
|
1844
2593
|
tileKeyToString,
|
|
1845
2594
|
unpackTerrain,
|
|
1846
|
-
validateTileAssetPayload
|
|
2595
|
+
validateTileAssetPayload,
|
|
2596
|
+
worldGeneratorDebugOwner,
|
|
2597
|
+
worldGeneratorRepresentationBands,
|
|
2598
|
+
worldGeneratorRepresentationOutputs,
|
|
2599
|
+
worldGeneratorWorkerManifests,
|
|
2600
|
+
worldGeneratorWorkerProfileNames,
|
|
2601
|
+
worldGeneratorWorkerProfiles,
|
|
2602
|
+
worldGeneratorWorkerQueueClass
|
|
1847
2603
|
};
|
|
1848
2604
|
//# sourceMappingURL=index.js.map
|