@woosh/meep-engine 3.60.9 → 3.61.1
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/CHANGELOG.md +90 -0
- package/package.json +1 -1
- package/src/engine/ecs/EntityManager.d.ts +3 -3
- package/src/engine/ecs/EntityManager.js +3 -3
- package/src/engine/ecs/storage/populateEngineSerializationRegistry.d.ts.map +1 -1
- package/src/engine/ecs/storage/populateEngineSerializationRegistry.js +4 -0
- package/src/engine/graphics/ecs/decal/v2/Decal.d.ts +46 -2
- package/src/engine/graphics/ecs/decal/v2/Decal.d.ts.map +1 -1
- package/src/engine/graphics/ecs/decal/v2/Decal.js +74 -5
- package/src/engine/graphics/ecs/decal/v2/DecalSerializationAdapter.d.ts.map +1 -1
- package/src/engine/graphics/ecs/decal/v2/DecalSerializationAdapter.js +13 -1
- package/src/engine/graphics/ecs/decal/v2/DecalSerializationUpgrader_1_2.d.ts +9 -0
- package/src/engine/graphics/ecs/decal/v2/DecalSerializationUpgrader_1_2.d.ts.map +1 -0
- package/src/engine/graphics/ecs/decal/v2/DecalSerializationUpgrader_1_2.js +37 -0
- package/src/engine/graphics3/DecalSystem.d.ts.map +1 -1
- package/src/engine/graphics3/DecalSystem.js +462 -447
- package/src/engine/graphics3/decal/DECAL_GPU_RECORD.d.ts +14 -0
- package/src/engine/graphics3/decal/DECAL_GPU_RECORD.d.ts.map +1 -1
- package/src/engine/graphics3/decal/DECAL_GPU_RECORD.js +53 -13
- package/src/engine/graphics3/decal/chunk_decal_record.d.ts +6 -1
- package/src/engine/graphics3/decal/chunk_decal_record.d.ts.map +1 -1
- package/src/engine/graphics3/decal/chunk_decal_record.js +28 -9
- package/src/engine/graphics3/decal/decal_gpu_records.d.ts +2 -1
- package/src/engine/graphics3/decal/decal_gpu_records.d.ts.map +1 -1
- package/src/engine/graphics3/decal/decal_gpu_records.js +26 -5
- package/src/engine/graphics3/decal/decal_material_samplers.d.ts +6 -0
- package/src/engine/graphics3/decal/decal_material_samplers.d.ts.map +1 -1
- package/src/engine/graphics3/decal/decal_material_samplers.js +13 -0
- package/src/engine/graphics3/decal/shader_cluster_assign_decals.js +1 -1
- package/src/engine/graphics3/decal/shader_cull_decals_frustum.js +1 -1
- package/src/engine/graphics3/decal/shader_decal_composite.d.ts +5 -0
- package/src/engine/graphics3/decal/shader_decal_composite.d.ts.map +1 -1
- package/src/engine/graphics3/decal/shader_decal_composite.js +69 -28
- package/src/engine/network/NetworkSession.d.ts +3 -0
- package/src/engine/network/NetworkSession.d.ts.map +1 -1
- package/src/engine/network/NetworkSession.js +68 -10
- package/src/engine/network/README.md +6 -3
- package/src/engine/network/orchestrator/ServerAuthoritativeClient.d.ts +51 -5
- package/src/engine/network/orchestrator/ServerAuthoritativeClient.d.ts.map +1 -1
- package/src/engine/network/orchestrator/ServerAuthoritativeClient.js +308 -34
- package/src/engine/network/replication/Replicator.d.ts +8 -2
- package/src/engine/network/replication/Replicator.d.ts.map +1 -1
- package/src/engine/network/replication/Replicator.js +13 -4
- package/src/engine/network/sim/ActionLog.d.ts +16 -2
- package/src/engine/network/sim/ActionLog.d.ts.map +1 -1
- package/src/engine/network/sim/ActionLog.js +33 -2
- package/src/engine/network/sim/RewindEngine.d.ts +9 -0
- package/src/engine/network/sim/RewindEngine.d.ts.map +1 -1
- package/src/engine/network/sim/RewindEngine.js +15 -1
- package/src/engine/network/state/FrameBufferRing.d.ts +12 -5
- package/src/engine/network/state/FrameBufferRing.d.ts.map +1 -1
- package/src/engine/network/state/FrameBufferRing.js +32 -6
- package/src/engine/network/time/TimeDilation.d.ts +30 -14
- package/src/engine/network/time/TimeDilation.d.ts.map +1 -1
- package/src/engine/network/time/TimeDilation.js +47 -17
- package/src/engine/physics/fluid/ecs/FluidObstacleSystem.d.ts +4 -4
- package/src/generation/foliage/skeleton/ShootWoodHash.d.ts +3 -2
- package/src/generation/foliage/skeleton/ShootWoodHash.d.ts.map +1 -1
- package/src/generation/foliage/skeleton/ShootWoodHash.js +25 -2
- package/src/shade/renderer/buffer/graph_read_buffer.d.ts +3 -1
- package/src/shade/renderer/buffer/graph_read_buffer.d.ts.map +1 -1
- package/src/shade/renderer/buffer/graph_read_buffer.js +9 -6
- package/src/shade/renderer/buffer/util/shader_buffer_copy_storage_to_storage.d.ts +5 -0
- package/src/shade/renderer/buffer/util/shader_buffer_copy_storage_to_storage.d.ts.map +1 -1
- package/src/shade/renderer/buffer/util/shader_buffer_copy_storage_to_storage.js +48 -43
- package/src/shade/renderer/material/GPUMaterialManager.d.ts.map +1 -1
- package/src/shade/renderer/material/GPUMaterialManager.js +117 -35
- package/src/shade/renderer/material/standard/fragment_gbuffer.d.ts +2 -2
- package/src/shade/renderer/material/standard/fragment_gbuffer.d.ts.map +1 -1
- package/src/shade/renderer/material/standard/fragment_gbuffer.js +10 -3
- package/src/shade/renderer/material/standard/material_gbuffer_vertex.d.ts +15 -3
- package/src/shade/renderer/material/standard/material_gbuffer_vertex.d.ts.map +1 -1
- package/src/shade/renderer/material/standard/material_gbuffer_vertex.js +25 -4
- package/src/shade/renderer/particles/GPUParticleSystem.d.ts +23 -5
- package/src/shade/renderer/particles/GPUParticleSystem.d.ts.map +1 -1
- package/src/shade/renderer/particles/GPUParticleSystem.js +294 -20
- package/src/shade/renderer/particles/resize/shader_particle_shrink_alive_list.d.ts +21 -0
- package/src/shade/renderer/particles/resize/shader_particle_shrink_alive_list.d.ts.map +1 -0
- package/src/shade/renderer/particles/resize/shader_particle_shrink_alive_list.js +83 -0
- package/src/shade/renderer/particles/resize/shader_particle_shrink_free_list.d.ts +21 -0
- package/src/shade/renderer/particles/resize/shader_particle_shrink_free_list.d.ts.map +1 -0
- package/src/shade/renderer/particles/resize/shader_particle_shrink_free_list.js +64 -0
- package/src/shade/renderer/restir/di/chunk_restir_resolve.d.ts.map +1 -1
- package/src/shade/renderer/restir/di/chunk_restir_resolve.js +91 -94
- package/src/shade/renderer/restir/reservoir/chunk_rtxdi_stream_sample.js +1 -1
- package/src/shade/renderer/shader/chunk/color/rgbe9995/chunk_rgbe9995_decode.d.ts +14 -0
- package/src/shade/renderer/shader/chunk/color/rgbe9995/chunk_rgbe9995_decode.d.ts.map +1 -1
- package/src/shade/renderer/shader/chunk/color/rgbe9995/chunk_rgbe9995_decode.js +36 -21
- package/src/shade/renderer/shader/chunk/color/rgbe9995/chunk_rgbe9995_sample_gather.d.ts +22 -0
- package/src/shade/renderer/shader/chunk/color/rgbe9995/chunk_rgbe9995_sample_gather.d.ts.map +1 -0
- package/src/shade/renderer/shader/chunk/color/rgbe9995/chunk_rgbe9995_sample_gather.js +64 -0
- package/src/shade/renderer/shader/chunk/geometry/normal/chunk_decode_vertex_normal.d.ts.map +1 -1
- package/src/shade/renderer/shader/chunk/geometry/normal/chunk_decode_vertex_normal.js +13 -18
- package/src/shade/renderer/shader/chunk/geometry/normal/chunk_encode_vertex_normal.d.ts.map +1 -1
- package/src/shade/renderer/shader/chunk/geometry/normal/chunk_encode_vertex_normal.js +28 -30
- package/src/shade/renderer/shader/chunk/geometry/vec2/chunk_unit_u32_to_vec2.d.ts.map +1 -1
- package/src/shade/renderer/shader/chunk/geometry/vec2/chunk_unit_u32_to_vec2.js +15 -16
- package/src/shade/renderer/shader/chunk/geometry/vec2/chunk_unit_vec2_to_u32.d.ts +0 -1
- package/src/shade/renderer/shader/chunk/geometry/vec2/chunk_unit_vec2_to_u32.d.ts.map +1 -1
- package/src/shade/renderer/shader/chunk/geometry/vec2/chunk_unit_vec2_to_u32.js +15 -18
- package/src/shade/renderer/shader/chunk/subgroup/chunk_subgroup_bitset_or.d.ts +32 -0
- package/src/shade/renderer/shader/chunk/subgroup/chunk_subgroup_bitset_or.d.ts.map +1 -0
- package/src/shade/renderer/shader/chunk/subgroup/chunk_subgroup_bitset_or.js +73 -0
- package/src/shade/wgsl/emulator/WGSLJavaScriptCompiler.js +8 -1
- package/src/shade/wgsl/emulator/WGSLLanguageCore.d.ts.map +1 -1
- package/src/shade/wgsl/emulator/WGSLLanguageCore.js +7 -3
- package/src/shade/renderer/global_illumination/brick4/cpu/brick4_sh3_color_encode.d.ts +0 -2
- package/src/shade/renderer/global_illumination/brick4/cpu/brick4_sh3_color_encode.d.ts.map +0 -1
- package/src/shade/renderer/global_illumination/brick4/cpu/brick4_sh3_color_encode.js +0 -6
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { UINT32_MAX } from "../../../../../core/binary/UINT32_MAX.js";
|
|
2
|
+
import { WebGPUExtensionType } from "../../../../descriptor/WebGPUExtensionType.js";
|
|
3
|
+
import { CodeChunk } from "../../compiler/CodeChunk.js";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* The index {@link chunk_subgroup_bitset_or} skips.
|
|
7
|
+
*
|
|
8
|
+
* @type {number}
|
|
9
|
+
*/
|
|
10
|
+
export const SUBGROUP_BITSET_OR_NONE = UINT32_MAX;
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Set bit `index` of a bitset, one atomic per distinct word the subgroup holds: the lanes holding
|
|
14
|
+
* the first outstanding word take a round, OR together the bits they hold in it — or skip that when
|
|
15
|
+
* they all hold the same bit — one of them sets them with one `atomicOr`, and the rounds repeat
|
|
16
|
+
* until no word is left.
|
|
17
|
+
*
|
|
18
|
+
* `fn subgroup_bitset_or(bits: ptr<storage, array<atomic<u32>>, read_write>, index: u32)`
|
|
19
|
+
*
|
|
20
|
+
* Bit `index` is bit `index & 31` of word `index >> 5`. An index of {@link SUBGROUP_BITSET_OR_NONE},
|
|
21
|
+
* or one whose word is past the end of `bits`, sets nothing. Every lane of the subgroup calls it,
|
|
22
|
+
* from subgroup-uniform control flow.
|
|
23
|
+
*
|
|
24
|
+
* The atomic is made by a lane of the round, so a lane that holds nothing never stands in for one
|
|
25
|
+
* that does — in a fragment shader, a helper invocation given {@link SUBGROUP_BITSET_OR_NONE} can
|
|
26
|
+
* never be the one that writes, and its write would be discarded.
|
|
27
|
+
*
|
|
28
|
+
* A subgroup runs one round per distinct word it holds, so the loop is bounded by its lane count.
|
|
29
|
+
* Indices that follow the screen — a material per pixel — come in runs, and a subgroup ordinarily
|
|
30
|
+
* holds one or two.
|
|
31
|
+
*
|
|
32
|
+
* @see chunk_subgroup_keyed_append for the counting twin
|
|
33
|
+
* @type {CodeChunk}
|
|
34
|
+
*/
|
|
35
|
+
export const chunk_subgroup_bitset_or = CodeChunk.from(
|
|
36
|
+
//language=WGSL
|
|
37
|
+
`
|
|
38
|
+
// every lane runs the loop until no lane holds a word; the rounds run on the lanes holding one
|
|
39
|
+
@diagnostic(off, subgroup_uniformity)
|
|
40
|
+
fn subgroup_bitset_or(bits: ptr<storage, array<atomic<u32>>, read_write>, index: u32) {
|
|
41
|
+
const NONE = ${SUBGROUP_BITSET_OR_NONE}u;
|
|
42
|
+
|
|
43
|
+
var outstanding = select(index >> 5u, NONE, index == NONE);
|
|
44
|
+
let bit = 1u << (index & 31u);
|
|
45
|
+
|
|
46
|
+
loop {
|
|
47
|
+
if (!subgroupAny(outstanding != NONE)) {
|
|
48
|
+
break;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
if (outstanding != NONE) {
|
|
52
|
+
let round_word = subgroupBroadcastFirst(outstanding);
|
|
53
|
+
|
|
54
|
+
if (outstanding == round_word) {
|
|
55
|
+
var round_bits = bit;
|
|
56
|
+
|
|
57
|
+
// a run of one index needs no reduction
|
|
58
|
+
if (!subgroupAll(bit == subgroupBroadcastFirst(bit))) {
|
|
59
|
+
round_bits = subgroupOr(bit);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
if (subgroupElect() && round_word < arrayLength(bits)) {
|
|
63
|
+
atomicOr(&(*bits)[round_word], round_bits);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
outstanding = NONE;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
`);
|
|
72
|
+
|
|
73
|
+
chunk_subgroup_bitset_or.addExtension(WebGPUExtensionType.Subgroups);
|
|
@@ -3232,7 +3232,14 @@ function inferBuiltinReturnType(name, args) {
|
|
|
3232
3232
|
// Both gathers return the four texels of a 2x2 footprint. Saying so here matters more than
|
|
3233
3233
|
// for most builtins: the shadow chunks immediately swizzle the result (`samples.wzxy`), and
|
|
3234
3234
|
// an unknown type degrades swizzle codegen downstream.
|
|
3235
|
-
if (name === 'textureGather'
|
|
3235
|
+
if (name === 'textureGather') {
|
|
3236
|
+
const first = args[0] !== undefined ? args[0].type : null;
|
|
3237
|
+
const texture = first !== null && first.kind === 'texture' ? first : (args[1] !== undefined ? args[1].type : null);
|
|
3238
|
+
const scalar = texture !== null && texture.kind === 'texture' ? texture.scalar : 'f32';
|
|
3239
|
+
return { kind: 'vec', size: 4, scalar: scalar === 'u32' || /uint$/.test(scalar) ? 'u32'
|
|
3240
|
+
: scalar === 'i32' || /sint$/.test(scalar) ? 'i32' : 'f32' };
|
|
3241
|
+
}
|
|
3242
|
+
if (name === 'textureGatherCompare') {
|
|
3236
3243
|
return { kind: 'vec', size: 4, scalar: 'f32' };
|
|
3237
3244
|
}
|
|
3238
3245
|
if (name === 'textureDimensions') {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WGSLLanguageCore.d.ts","sourceRoot":"","sources":["../../../../../src/shade/wgsl/emulator/WGSLLanguageCore.js"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"WGSLLanguageCore.d.ts","sourceRoot":"","sources":["../../../../../src/shade/wgsl/emulator/WGSLLanguageCore.js"],"names":[],"mappings":";IAs3DA;;;;;;;;;;;;;OAaG;IACH,+DAyFC"}
|
|
@@ -1347,7 +1347,7 @@ export const WGSLLanguageCore = {
|
|
|
1347
1347
|
const tz = w * t.size[2] + oz;
|
|
1348
1348
|
texel_coord = dim === 1 ? [tx] : (dim === 2 ? [tx, ty] : [tx, ty, tz]);
|
|
1349
1349
|
}
|
|
1350
|
-
const result = new Float32Array(4);
|
|
1350
|
+
const result = t.data instanceof Uint32Array || t.data instanceof Int32Array ? new t.data.constructor(4) : new Float32Array(4);
|
|
1351
1351
|
cpu_texture_sample(result, sampler ?? FALLBACK_LINEAR_CLAMP_SAMPLER, t, texel_coord);
|
|
1352
1352
|
return result;
|
|
1353
1353
|
},
|
|
@@ -1504,7 +1504,7 @@ export const WGSLLanguageCore = {
|
|
|
1504
1504
|
|
|
1505
1505
|
if (extra_b !== undefined) { offset_x = extra_b[0]; offset_y = extra_b[1]; }
|
|
1506
1506
|
|
|
1507
|
-
const result = new Float32Array(4);
|
|
1507
|
+
const result = t.data instanceof Uint32Array || t.data instanceof Int32Array ? new t.data.constructor(4) : new Float32Array(4);
|
|
1508
1508
|
|
|
1509
1509
|
cpu_texture_gather(
|
|
1510
1510
|
result,
|
|
@@ -1582,7 +1582,7 @@ export const WGSLLanguageCore = {
|
|
|
1582
1582
|
throw new Error("textureGatherCompare: the bound sampler has no 'compare' function — WGSL requires a sampler_comparison here. Bind a SamplerDescriptor with `compare` set (the engine's shadow path uses SHADOWMAP_COMPARE_SAMPLER_DESCRIPTOR, `compare: \"greater\"` for reverse-Z).");
|
|
1583
1583
|
}
|
|
1584
1584
|
|
|
1585
|
-
const result = new Float32Array(4);
|
|
1585
|
+
const result = t.data instanceof Uint32Array || t.data instanceof Int32Array ? new t.data.constructor(4) : new Float32Array(4);
|
|
1586
1586
|
|
|
1587
1587
|
cpu_texture_gather(
|
|
1588
1588
|
result,
|
|
@@ -1773,6 +1773,10 @@ export const WGSLLanguageCore = {
|
|
|
1773
1773
|
subgroupOr(value) { return value; },
|
|
1774
1774
|
subgroupXor(value) { return value; },
|
|
1775
1775
|
|
|
1776
|
+
// Votes over a subgroup of one are that one's predicate.
|
|
1777
|
+
subgroupAll(predicate) { return predicate; },
|
|
1778
|
+
subgroupAny(predicate) { return predicate; },
|
|
1779
|
+
|
|
1776
1780
|
// Scans: exclusive of the only lane is the identity, inclusive of it is its value.
|
|
1777
1781
|
subgroupExclusiveAdd() { return 0; },
|
|
1778
1782
|
subgroupExclusiveMul() { return 1; },
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"brick4_sh3_color_encode.d.ts","sourceRoot":"","sources":["../../../../../../../src/shade/renderer/global_illumination/brick4/cpu/brick4_sh3_color_encode.js"],"names":[],"mappings":"AAAA,8GAKC"}
|