@woosh/meep-engine 3.18.0 → 3.20.0
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/build/bundle-worker-image-decoder.js +1 -1
- package/build/bundle-worker-terrain.js +1 -1
- package/editor/view/particles/effect/ParticleCurveEditorView.d.ts.map +1 -1
- package/editor/view/particles/effect/ParticleCurveEditorView.js +303 -120
- package/editor/view/particles/effect/ParticleGradientEditorView.d.ts.map +1 -1
- package/editor/view/particles/effect/ParticleGradientEditorView.js +108 -63
- package/editor/view/particles/effect/ParticleGraphEditorView.js +2 -2
- package/editor/view/particles/effect/ParticleNodeParametersView.d.ts.map +1 -1
- package/editor/view/particles/effect/ParticleNodeParametersView.js +7 -46
- package/editor/view/particles/effect/particle-editor.css +60 -30
- package/package.json +1 -2
- package/samples/engine/README.md +1 -1
- package/src/core/binary/compression/decompress_bytes.d.ts +13 -0
- package/src/core/binary/compression/decompress_bytes.d.ts.map +1 -0
- package/src/core/binary/compression/decompress_bytes.js +28 -0
- package/src/core/collection/array/array_group_by.d.ts.map +1 -1
- package/src/core/collection/array/array_group_by.js +2 -11
- package/src/core/geom/3d/shape/HeightMapShape3D.d.ts.map +1 -1
- package/src/core/geom/3d/shape/HeightMapShape3D.js +4 -9
- package/src/core/model/node-graph/visual/layout/layout_assign_coordinates.js +67 -22
- package/src/core/model/object/optional_clone.d.ts +7 -0
- package/src/core/model/object/optional_clone.d.ts.map +1 -0
- package/src/core/model/object/optional_equality.d.ts +10 -0
- package/src/core/model/object/optional_equality.d.ts.map +1 -0
- package/src/{shade/descriptor/util → core/model/object}/optional_equality.js +2 -2
- package/src/core/model/object/optional_hash.d.ts +9 -0
- package/src/core/model/object/optional_hash.d.ts.map +1 -0
- package/src/{shade/descriptor/util → core/model/object}/optional_hash.js +3 -3
- package/src/engine/asset/Asset.d.ts +1 -1
- package/src/engine/asset/Asset.d.ts.map +1 -1
- package/src/engine/asset/Asset.js +3 -1
- package/src/engine/asset/loaders/image/ImageDecoderWorker.js +12 -27
- package/src/engine/asset/loaders/image/prototypePNG.js +8 -7
- package/src/engine/ecs/gui/hud/HeadsUpDisplaySystem.d.ts.map +1 -1
- package/src/engine/ecs/gui/hud/HeadsUpDisplaySystem.js +9 -10
- 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/particles/ParticleEffect.d.ts +266 -0
- package/src/engine/graphics/ecs/particles/ParticleEffect.d.ts.map +1 -0
- package/src/engine/graphics/ecs/particles/ParticleEffect.js +439 -0
- package/src/engine/graphics/ecs/particles/ParticleEffectSerializationAdapter.d.ts +58 -0
- package/src/engine/graphics/ecs/particles/ParticleEffectSerializationAdapter.d.ts.map +1 -0
- package/src/engine/graphics/ecs/particles/ParticleEffectSerializationAdapter.js +219 -0
- package/src/engine/graphics3/GPUParticleEmitterSystem.d.ts +178 -25
- package/src/engine/graphics3/GPUParticleEmitterSystem.d.ts.map +1 -1
- package/src/engine/graphics3/GPUParticleEmitterSystem.js +809 -310
- package/src/format/image/png/PNGReader.d.ts +7 -6
- package/src/format/image/png/PNGReader.d.ts.map +1 -1
- package/src/format/image/png/PNGReader.js +13 -12
- package/src/format/image/png/chunk/png_chunk_decode_iTXt.d.ts +3 -2
- package/src/format/image/png/chunk/png_chunk_decode_iTXt.d.ts.map +1 -1
- package/src/format/image/png/chunk/png_chunk_decode_iTXt.js +5 -4
- package/src/format/image/png/chunk/png_chunk_decode_zTXt.d.ts +3 -2
- package/src/format/image/png/chunk/png_chunk_decode_zTXt.d.ts.map +1 -1
- package/src/format/image/png/chunk/png_chunk_decode_zTXt.js +5 -4
- package/src/format/image/png/png_inflate.d.ts +3 -3
- package/src/format/image/png/png_inflate.d.ts.map +1 -1
- package/src/format/image/png/png_inflate.js +29 -39
- package/src/format/texture/ktx2/ktx2_read.d.ts +4 -4
- package/src/format/texture/ktx2/ktx2_read.d.ts.map +1 -1
- package/src/format/texture/ktx2/ktx2_read.js +18 -21
- package/src/shade/descriptor/binding/BindGroupLayoutDescriptor.js +1 -1
- package/src/shade/descriptor/binding/BindGroupLayoutEntry.js +3 -3
- package/src/shade/descriptor/pipeline/PipelineDescriptorBase.js +1 -1
- package/src/shade/descriptor/pipeline/PipelineLayoutDescriptor.js +1 -1
- package/src/shade/descriptor/pipeline/render/ColorTargetState.js +3 -3
- package/src/shade/descriptor/pipeline/render/FragmentState.js +1 -1
- package/src/shade/descriptor/pipeline/render/RenderPipelineDescriptor.js +3 -3
- package/src/shade/playground/particle_ecs/README.md +203 -0
- package/src/shade/playground/particle_ecs/bonfire_editor.d.ts +39 -0
- package/src/shade/playground/particle_ecs/bonfire_editor.d.ts.map +1 -0
- package/src/shade/playground/particle_ecs/bonfire_editor.js +315 -0
- package/src/shade/playground/particle_ecs/bonfire_effects.d.ts +145 -0
- package/src/shade/playground/particle_ecs/bonfire_effects.d.ts.map +1 -0
- package/src/shade/playground/particle_ecs/bonfire_effects.js +202 -0
- package/src/shade/playground/particle_ecs/bonfire_sprites.d.ts +23 -0
- package/src/shade/playground/particle_ecs/bonfire_sprites.d.ts.map +1 -0
- package/src/shade/playground/particle_ecs/bonfire_sprites.js +315 -0
- package/src/shade/playground/particle_ecs/bonfire_world.d.ts +86 -0
- package/src/shade/playground/particle_ecs/bonfire_world.d.ts.map +1 -0
- package/src/shade/playground/particle_ecs/bonfire_world.js +303 -0
- package/src/shade/playground/particle_ecs/effects/embers.json +1634 -0
- package/src/shade/playground/particle_ecs/effects/flame.json +1882 -0
- package/src/shade/playground/particle_ecs/effects/smoke.json +1860 -0
- package/src/shade/playground/particle_ecs/effects/soot.json +1606 -0
- package/src/shade/playground/particle_ecs/index.html +330 -0
- package/src/shade/playground/particle_ecs/main.d.ts +2 -0
- package/src/shade/playground/particle_ecs/main.d.ts.map +1 -0
- package/src/shade/playground/particle_ecs/main.js +566 -0
- package/src/shade/playground/particle_ecs/moonlit_environment.d.ts +16 -0
- package/src/shade/playground/particle_ecs/moonlit_environment.d.ts.map +1 -0
- package/src/shade/playground/particle_ecs/moonlit_environment.js +144 -0
- package/src/shade/playground/particle_editor/README.md +5 -4
- package/src/shade/playground/particle_system/particle_prototype.d.ts +7 -9
- package/src/shade/playground/particle_system/particle_prototype.d.ts.map +1 -1
- package/src/shade/playground/particle_system/particle_prototype.js +7 -9
- package/src/shade/playground/profile_hotkey.d.ts +58 -0
- package/src/shade/playground/profile_hotkey.d.ts.map +1 -0
- package/src/shade/playground/profile_hotkey.js +325 -0
- package/src/shade/playground/ssr_motion/README.md +22 -0
- package/src/shade/playground/ssr_motion/index.html +18 -0
- package/src/shade/playground/ssr_motion/main.d.ts +2 -0
- package/src/shade/playground/ssr_motion/main.d.ts.map +1 -0
- package/src/shade/playground/ssr_motion/main.js +149 -0
- package/src/shade/playground/ssr_variance/README.md +105 -0
- package/src/shade/playground/ssr_variance/capture.d.ts +16 -0
- package/src/shade/playground/ssr_variance/capture.d.ts.map +1 -0
- package/src/shade/playground/ssr_variance/capture.js +96 -0
- package/src/shade/playground/ssr_variance/index.html +23 -0
- package/src/shade/playground/ssr_variance/main.d.ts +2 -0
- package/src/shade/playground/ssr_variance/main.d.ts.map +1 -0
- package/src/shade/playground/ssr_variance/main.js +246 -0
- package/src/shade/playground/ssr_variance/reference.d.ts +18 -0
- package/src/shade/playground/ssr_variance/reference.d.ts.map +1 -0
- package/src/shade/playground/ssr_variance/reference.js +78 -0
- package/src/shade/playground/ssr_variance/scene.d.ts +11 -0
- package/src/shade/playground/ssr_variance/scene.d.ts.map +1 -0
- package/src/shade/playground/ssr_variance/scene.js +61 -0
- package/src/shade/playground/ssr_variance/statistics.d.ts +44 -0
- package/src/shade/playground/ssr_variance/statistics.d.ts.map +1 -0
- package/src/shade/playground/ssr_variance/statistics.js +51 -0
- package/src/shade/renderer/geometry/Geometry.d.ts.map +1 -1
- package/src/shade/renderer/geometry/Geometry.js +4 -7
- package/src/shade/renderer/loader/gltf/tiny-gltf.d.ts.map +1 -1
- package/src/shade/renderer/loader/gltf/tiny-gltf.js +9 -3
- package/src/shade/renderer/loader/usd/usd_decode_image.d.ts +4 -4
- package/src/shade/renderer/loader/usd/usd_decode_image.d.ts.map +1 -1
- package/src/shade/renderer/loader/usd/usd_decode_image.js +4 -4
- package/src/shade/renderer/material/StandardShadeMaterial.js +2 -2
- package/src/shade/renderer/particles/DESIGN.md +745 -702
- package/src/shade/renderer/particles/GPUParticleSystem.d.ts.map +1 -1
- package/src/shade/renderer/particles/GPUParticleSystem.js +3 -1
- package/src/shade/renderer/particles/graph/ParticleGroupBuilder.d.ts +1 -1
- package/src/shade/renderer/particles/graph/ParticleGroupBuilder.js +1 -1
- package/src/shade/renderer/particles/graph/ParticleNodeRegistry.d.ts.map +1 -1
- package/src/shade/renderer/particles/graph/ParticleNodeRegistry.js +9 -15
- package/src/shade/renderer/particles/graph/particle_group_library.d.ts.map +1 -1
- package/src/shade/renderer/particles/graph/particle_group_library.js +8 -3
- package/src/shade/renderer/particles/graph/particle_node_parameters.d.ts +0 -2
- package/src/shade/renderer/particles/graph/particle_node_parameters.d.ts.map +1 -1
- package/src/shade/renderer/particles/graph/particle_node_parameters.js +0 -9
- package/src/shade/renderer/particles/graph/particle_node_presentation.d.ts.map +1 -1
- package/src/shade/renderer/particles/graph/particle_node_presentation.js +0 -10
- package/src/shade/renderer/particles/graph/particle_ramp.d.ts +2 -8
- package/src/shade/renderer/particles/graph/particle_ramp.d.ts.map +1 -1
- package/src/shade/renderer/particles/graph/particle_ramp.js +2 -8
- package/src/shade/renderer/particles/graph/validate_particle_graph.js +0 -6
- package/src/shade/renderer/particles/graph_particles_avboit.d.ts.map +1 -1
- package/src/shade/renderer/particles/graph_particles_avboit.js +13 -4
- package/src/shade/renderer/particles/isa/InstructionStream.d.ts +1 -12
- package/src/shade/renderer/particles/isa/InstructionStream.d.ts.map +1 -1
- package/src/shade/renderer/particles/isa/InstructionStream.js +1 -12
- package/src/shade/renderer/particles/isa/ParticleVMISA.d.ts +54 -60
- package/src/shade/renderer/particles/isa/ParticleVMISA.d.ts.map +1 -1
- package/src/shade/renderer/particles/isa/ParticleVMISA.js +9 -17
- package/src/shade/renderer/particles/isa/particle_assembly.d.ts +0 -1
- package/src/shade/renderer/particles/isa/particle_assembly.d.ts.map +1 -1
- package/src/shade/renderer/particles/isa/particle_assembly.js +2 -16
- package/src/shade/renderer/particles/optimizer/dag/particle_vector_graph.d.ts +1 -1
- package/src/shade/renderer/particles/optimizer/dag/particle_vector_graph.js +1 -1
- package/src/shade/renderer/particles/optimizer/dag/particle_vector_lift.js +0 -14
- package/src/shade/renderer/particles/optimizer/dag/particle_vector_pack.js +3 -17
- package/src/shade/renderer/particles/optimizer/particle_program_analysis.d.ts.map +1 -1
- package/src/shade/renderer/particles/optimizer/particle_program_analysis.js +15 -36
- package/src/shade/renderer/particles/optimizer/particle_program_equivalence.d.ts.map +1 -1
- package/src/shade/renderer/particles/optimizer/particle_program_equivalence.js +1 -5
- package/src/shade/renderer/particles/optimizer/particle_program_fuzz.d.ts.map +1 -1
- package/src/shade/renderer/particles/optimizer/particle_program_fuzz.js +1 -8
- package/src/shade/renderer/particles/optimizer/particle_vm_semantics.d.ts +2 -11
- package/src/shade/renderer/particles/optimizer/particle_vm_semantics.d.ts.map +1 -1
- package/src/shade/renderer/particles/optimizer/particle_vm_semantics.js +2 -11
- package/src/shade/renderer/particles/runtime/ParticleEmitter.d.ts +11 -4
- package/src/shade/renderer/particles/runtime/ParticleEmitter.d.ts.map +1 -1
- package/src/shade/renderer/particles/runtime/ParticleEmitter.js +431 -424
- package/src/shade/renderer/particles/shaders/chunk_particle_avboit_contribution.d.ts.map +1 -1
- package/src/shade/renderer/particles/shaders/chunk_particle_avboit_contribution.js +13 -0
- package/src/shade/renderer/particles/shaders/shader_particle_avboit_draw.d.ts +3 -6
- package/src/shade/renderer/particles/shaders/shader_particle_avboit_draw.d.ts.map +1 -1
- package/src/shade/renderer/particles/shaders/shader_particle_avboit_draw.js +49 -17
- package/src/shade/renderer/particles/shaders/shader_particle_emit.d.ts.map +1 -1
- package/src/shade/renderer/particles/shaders/shader_particle_emit.js +0 -2
- package/src/shade/renderer/particles/shaders/shader_particle_emit_wide.d.ts.map +1 -1
- package/src/shade/renderer/particles/shaders/shader_particle_emit_wide.js +0 -2
- package/src/shade/renderer/particles/shaders/shader_particle_simulate.d.ts.map +1 -1
- package/src/shade/renderer/particles/shaders/shader_particle_simulate.js +1 -5
- package/src/shade/renderer/particles/shaders/shader_particle_simulate_wide.d.ts.map +1 -1
- package/src/shade/renderer/particles/shaders/shader_particle_simulate_wide.js +0 -2
- package/src/shade/renderer/particles/vm/ParticleVMReference.d.ts +1 -3
- package/src/shade/renderer/particles/vm/ParticleVMReference.d.ts.map +1 -1
- package/src/shade/renderer/particles/vm/ParticleVMReference.js +4 -20
- package/src/shade/renderer/particles/vm/chunk_particle_vm.d.ts.map +1 -1
- package/src/shade/renderer/particles/vm/chunk_particle_vm.js +2 -5
- package/src/shade/renderer/particles/warmup/shader_particle_warmup_advance.d.ts.map +1 -1
- package/src/shade/renderer/particles/warmup/shader_particle_warmup_advance.js +0 -2
- package/src/shade/renderer/particles/warmup/shader_particle_warmup_advance_wide.d.ts.map +1 -1
- package/src/shade/renderer/particles/warmup/shader_particle_warmup_advance_wide.js +0 -2
- package/src/shade/renderer/postprocess/ssr/SSR.d.ts.map +1 -1
- package/src/shade/renderer/postprocess/ssr/SSR.js +2 -1
- package/src/shade/renderer/postprocess/ssr/reproject/chunk_ssr_reprojection.d.ts.map +1 -1
- package/src/shade/renderer/postprocess/ssr/reproject/chunk_ssr_reprojection.js +20 -5
- package/src/shade/renderer/postprocess/ssr/reproject/chunk_ssr_sample_history.d.ts.map +1 -1
- package/src/shade/renderer/postprocess/ssr/reproject/chunk_ssr_sample_history.js +19 -5
- package/src/shade/renderer/postprocess/ssr/reproject/chunk_ssr_temporal_accumulate.d.ts +4 -0
- package/src/shade/renderer/postprocess/ssr/reproject/chunk_ssr_temporal_accumulate.d.ts.map +1 -0
- package/src/shade/renderer/postprocess/ssr/reproject/chunk_ssr_temporal_accumulate.js +137 -0
- package/src/shade/renderer/postprocess/ssr/ssr_reproject_shader.d.ts +0 -8
- package/src/shade/renderer/postprocess/ssr/ssr_reproject_shader.d.ts.map +1 -1
- package/src/shade/renderer/postprocess/ssr/ssr_reproject_shader.js +18 -114
- package/src/shade/renderer/scene/Mesh.js +1 -1
- package/src/shade/renderer/texture/ShadeTexture.js +1 -1
- package/src/shade/renderer/texture/source/texel_data_from_ktx2.d.ts +2 -2
- package/src/shade/renderer/texture/source/texel_data_from_ktx2.d.ts.map +1 -1
- package/src/shade/renderer/texture/source/texel_data_from_ktx2.js +3 -3
- package/src/shade/renderer/particles/shaders/chunk_particle_curve_animation.d.ts +0 -19
- package/src/shade/renderer/particles/shaders/chunk_particle_curve_animation.d.ts.map +0 -1
- package/src/shade/renderer/particles/shaders/chunk_particle_curve_animation.js +0 -30
- package/src/shade/renderer/particles/shaders/chunk_particle_curve_disabled.d.ts +0 -11
- package/src/shade/renderer/particles/shaders/chunk_particle_curve_disabled.d.ts.map +0 -1
- package/src/shade/renderer/particles/shaders/chunk_particle_curve_disabled.js +0 -13
- package/src/shade/renderer/particles/shaders/chunk_particle_emitter_warmup.d.ts +0 -20
- package/src/shade/renderer/particles/shaders/chunk_particle_emitter_warmup.d.ts.map +0 -1
- package/src/shade/renderer/particles/shaders/chunk_particle_emitter_world_sphere.d.ts +0 -14
- package/src/shade/renderer/particles/shaders/chunk_particle_emitter_world_sphere.d.ts.map +0 -1
- package/src/shade/renderer/particles/shaders/shader_particle_reclaim.d.ts +0 -50
- package/src/shade/renderer/particles/shaders/shader_particle_reclaim.d.ts.map +0 -1
- package/src/shade/renderer/postprocess/ssr/reproject/shader_ffx_denoiser_reflections_reproject.d.ts +0 -17
- package/src/shade/renderer/postprocess/ssr/reproject/shader_ffx_denoiser_reflections_reproject.d.ts.map +0 -1
- /package/src/{shade/descriptor/util → core/model/object}/optional_clone.js +0 -0
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
* A source word means what its kind says — see {@link VM_KIND}:
|
|
24
24
|
*
|
|
25
25
|
* - `NONE`: not an operand the VM resolves — an unused slot, or a raw field the opcode reads for
|
|
26
|
-
* itself: an attribute offset, a component count, a builtin id, a
|
|
26
|
+
* itself: an attribute offset, a component count, a builtin id, a pool index.
|
|
27
27
|
* - `REG`: a register operand. Bits 0..7 are the first slot, bits 8..15 a swizzle — see below.
|
|
28
28
|
* - `IMM`: the word IS the `f32` bit pattern of a literal, read in every lane. A scalar or a
|
|
29
29
|
* lane-uniform vector costs no register and no load; only a vector whose lanes differ still goes
|
|
@@ -80,8 +80,6 @@ export const VM_OPERAND = {
|
|
|
80
80
|
COMP: "comp",
|
|
81
81
|
/** builtin id (see {@link VM_BUILTIN}) */
|
|
82
82
|
BUILTIN: "builtin",
|
|
83
|
-
/** curve handle (row index into the animation-curve table) */
|
|
84
|
-
CURVE: "curve",
|
|
85
83
|
};
|
|
86
84
|
|
|
87
85
|
/**
|
|
@@ -130,7 +128,8 @@ export const VM_BUILTIN_COMPONENTS = Object.freeze({
|
|
|
130
128
|
|
|
131
129
|
/**
|
|
132
130
|
* Opcodes. Numbers are stable wire values — never renumber, only append. 19 was `SCALE` and 45 was
|
|
133
|
-
* `SWIZZLE`; both are spelled by an operand swizzle now
|
|
131
|
+
* `SWIZZLE`; both are spelled by an operand swizzle now. 61 was the animation-table sampler.
|
|
132
|
+
* These numbers stay unused.
|
|
134
133
|
* @enum {number}
|
|
135
134
|
*/
|
|
136
135
|
export const VM_OP = {
|
|
@@ -185,7 +184,6 @@ export const VM_OP = {
|
|
|
185
184
|
SELECT: 55,
|
|
186
185
|
|
|
187
186
|
RANDOM: 60,
|
|
188
|
-
CURVE: 61,
|
|
189
187
|
};
|
|
190
188
|
|
|
191
189
|
/**
|
|
@@ -559,7 +557,7 @@ const _ = VM_OPERAND.NONE;
|
|
|
559
557
|
*
|
|
560
558
|
* Keyed by opcode number. Used by the assembler for validation/disassembly and by the parity
|
|
561
559
|
* meta-test to enforce that every opcode is handled by both executors.
|
|
562
|
-
* @type {Map<number, {name: string, dst: boolean, operands: [string, string, string], width: string, dest: string, default_width: number, min_width: number
|
|
560
|
+
* @type {Map<number, {name: string, dst: boolean, operands: [string, string, string], width: string, dest: string, default_width: number, min_width: number}>}
|
|
563
561
|
*/
|
|
564
562
|
export const VM_ISA = new Map();
|
|
565
563
|
|
|
@@ -575,7 +573,6 @@ export const VM_ISA = new Map();
|
|
|
575
573
|
* @param {string} [options.dest] see {@link VM_DEST}; as wide as the operation unless it reduces
|
|
576
574
|
* @param {number} [options.default_width] width the assembler uses when the text does not say
|
|
577
575
|
* @param {number} [options.min_width] narrowest the opcode is meaningful at
|
|
578
|
-
* @param {number[]} [options.scalar_operands] source slots read as a single lane whatever the width
|
|
579
576
|
*/
|
|
580
577
|
function def(op, name, dst, s0 = _, s1 = _, s2 = _, options = {}) {
|
|
581
578
|
if (VM_ISA.has(op)) {
|
|
@@ -603,7 +600,6 @@ function def(op, name, dst, s0 = _, s1 = _, s2 = _, options = {}) {
|
|
|
603
600
|
dest,
|
|
604
601
|
default_width,
|
|
605
602
|
min_width: options.min_width ?? 1,
|
|
606
|
-
scalar_operands: options.scalar_operands ?? [],
|
|
607
603
|
});
|
|
608
604
|
}
|
|
609
605
|
|
|
@@ -669,8 +665,6 @@ def(VM_OP.SELECT, "SELECT", true, R, R, R);
|
|
|
669
665
|
// One independent uniform draw in `[0, 1)` per lane, and nothing else: a shaped distribution is
|
|
670
666
|
// arithmetic a program writes over this draw — see ../graph/particle_graph_distributions.js.
|
|
671
667
|
def(VM_OP.RANDOM, "RANDOM", true);
|
|
672
|
-
// `t` is one lane; the sampled value fills the destination's width.
|
|
673
|
-
def(VM_OP.CURVE, "CURVE", true, VM_OPERAND.CURVE, R, _, { scalar_operands: [1] });
|
|
674
668
|
|
|
675
669
|
// --- packing an instruction ---------------------------------------------------------------------
|
|
676
670
|
|
|
@@ -699,7 +693,7 @@ export function vm_pack_instruction(op, width, dst, kinds, sources) {
|
|
|
699
693
|
const word = sources[slot] >>> 0;
|
|
700
694
|
|
|
701
695
|
words[1 + slot] = kinds[slot] === VM_KIND.REG && meta !== undefined
|
|
702
|
-
? vm_canonical_register(word,
|
|
696
|
+
? vm_canonical_register(word, operation_width)
|
|
703
697
|
: word;
|
|
704
698
|
}
|
|
705
699
|
|
|
@@ -731,8 +725,7 @@ export function vm_repack_instruction(words) {
|
|
|
731
725
|
* @property {number} slot source slot, `0..2`
|
|
732
726
|
* @property {number} kind a {@link VM_KIND}, never `NONE`
|
|
733
727
|
* @property {number} word the source word as encoded
|
|
734
|
-
* @property {number} lanes how many lanes the instruction reads of it: the operation's width
|
|
735
|
-
* for a slot the ISA marks scalar
|
|
728
|
+
* @property {number} lanes how many lanes the instruction reads of it: the operation's width
|
|
736
729
|
* @property {number} span register slots the operand reaches from its base, for a register; `0` for a
|
|
737
730
|
* literal
|
|
738
731
|
*/
|
|
@@ -741,9 +734,8 @@ export function vm_repack_instruction(words) {
|
|
|
741
734
|
* Visit every source operand of an instruction — every slot whose kind is not `NONE` — with how
|
|
742
735
|
* many lanes the opcode reads of it and how far into the file it reaches.
|
|
743
736
|
*
|
|
744
|
-
*
|
|
745
|
-
*
|
|
746
|
-
* reaches as far as its widest selector among the lanes read.
|
|
737
|
+
* A source is read as wide as the operation runs, and a register operand reaches as far as its
|
|
738
|
+
* widest selector among the lanes read.
|
|
747
739
|
*
|
|
748
740
|
* @param {ArrayLike<number>} words an instruction stream
|
|
749
741
|
* @param {number} base index of the instruction's first word
|
|
@@ -770,7 +762,7 @@ export function vm_visit_operands(words, base, visit) {
|
|
|
770
762
|
}
|
|
771
763
|
|
|
772
764
|
const word = words[base + 1 + slot];
|
|
773
|
-
const lanes =
|
|
765
|
+
const lanes = operation_width;
|
|
774
766
|
|
|
775
767
|
operand.slot = slot;
|
|
776
768
|
operand.kind = kind;
|
|
@@ -99,7 +99,6 @@ export function assemble_particle_program(text: string): ParticleProgram;
|
|
|
99
99
|
* | attribute word offset | `@<word>` | `@7` |
|
|
100
100
|
* | attribute component count | a bare integer `1..4` | `3` |
|
|
101
101
|
* | builtin | a {@link VM_BUILTIN} name | `EMITTER_POSITION` |
|
|
102
|
-
* | curve handle | `k<handle>` | `k2` |
|
|
103
102
|
*
|
|
104
103
|
* A register source's selectors say which lane of the value each lane of the instruction reads, one
|
|
105
104
|
* letter of `xyzw` per lane the instruction spans; left off, lane `c` reads lane `c`. A literal is
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"particle_assembly.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/particles/isa/particle_assembly.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"particle_assembly.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/particles/isa/particle_assembly.js"],"names":[],"mappings":"AAyKA;;;;;;;;GAQG;AAMH;;;;;;;;;;;GAWG;AACH,sDALW,eAAe;IAEE,MAAM,GAAvB,MAAM;IACJ,MAAM,CAmClB;AAwJD;;;;;;;;;;;GAWG;AACH,8CAHW,MAAM;aACM,eAAe,GAAC,IAAI;iBAAe,0BAA0B,EAAE;EA8IrF;AAED;;;;;;;;GAQG;AACH,gDAJW,MAAM,GACJ,eAAe,CAkB3B;AA9gBD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6DG;AAEH,oEAAoE;AACpE,6CAD0D,MAAM,CACV;AAEtD,sEAAsE;AACtE,+CAD4D,MAAM,CACR;AAE1D,+DAA+D;AAC/D,oDADqD,MAAM,CACO;AAElE,kEAAkE;AAClE,gDADwD,MAAM,CACJ;AAE1D,iEAAiE;AACjE,iDADuD,MAAM,CACP;AAEtD;;;;;GAKG;AACH,gDAFU,MAAM,CAEqC;AAErD;;;;;;;;;GASG;AACH,8CAFU,MAAM,CAEoC;;;;;;;;;;UA+CtC,MAAM;aACN,MAAM;;;;;;UA6hBN,MAAM;;;;UACN,MAAM;;;;gBACN,MAAM;;;;YACN,MAAM;;gCA1sBY,sBAAsB"}
|
|
@@ -81,7 +81,6 @@ import {
|
|
|
81
81
|
* | attribute word offset | `@<word>` | `@7` |
|
|
82
82
|
* | attribute component count | a bare integer `1..4` | `3` |
|
|
83
83
|
* | builtin | a {@link VM_BUILTIN} name | `EMITTER_POSITION` |
|
|
84
|
-
* | curve handle | `k<handle>` | `k2` |
|
|
85
84
|
*
|
|
86
85
|
* A register source's selectors say which lane of the value each lane of the instruction reads, one
|
|
87
86
|
* letter of `xyzw` per lane the instruction spans; left off, lane `c` reads lane `c`. A literal is
|
|
@@ -268,7 +267,7 @@ function disassemble_instruction(words, base) {
|
|
|
268
267
|
} else if (vm_decode_kind(word0, slot) === VM_KIND.IMM) {
|
|
269
268
|
operands.push(`${PARTICLE_ASSEMBLY_IMMEDIATE_PREFIX}${format_float(vm_f32_value(word))}`);
|
|
270
269
|
} else {
|
|
271
|
-
operands.push(format_register(word,
|
|
270
|
+
operands.push(format_register(word, operation_width));
|
|
272
271
|
}
|
|
273
272
|
}
|
|
274
273
|
|
|
@@ -337,8 +336,6 @@ function format_operand(role, value) {
|
|
|
337
336
|
return String(value);
|
|
338
337
|
case VM_OPERAND.BUILTIN:
|
|
339
338
|
return BUILTIN_NAME_BY_ID.get(value) ?? String(value);
|
|
340
|
-
case VM_OPERAND.CURVE:
|
|
341
|
-
return `k${value}`;
|
|
342
339
|
default:
|
|
343
340
|
return String(value);
|
|
344
341
|
}
|
|
@@ -809,7 +806,7 @@ function parse_instruction(line, line_number, report) {
|
|
|
809
806
|
|
|
810
807
|
for (let slot = 0; slot < sources.length; slot++) {
|
|
811
808
|
const source = sources[slot];
|
|
812
|
-
const lanes =
|
|
809
|
+
const lanes = operation_width;
|
|
813
810
|
|
|
814
811
|
if (source.kind === VM_KIND.REG && source.selectors !== undefined && source.selectors > 0 && source.selectors !== lanes) {
|
|
815
812
|
report(
|
|
@@ -1090,17 +1087,6 @@ function parse_plain_operand(role, token, line_number, report) {
|
|
|
1090
1087
|
return id === null ? null : { kind: VM_KIND.NONE, word: id };
|
|
1091
1088
|
}
|
|
1092
1089
|
|
|
1093
|
-
case VM_OPERAND.CURVE: {
|
|
1094
|
-
const handle = parse_prefixed(token, "k");
|
|
1095
|
-
|
|
1096
|
-
if (handle === null) {
|
|
1097
|
-
report(line_number, `Expected a curve handle like 'k0', got '${token}'`);
|
|
1098
|
-
return null;
|
|
1099
|
-
}
|
|
1100
|
-
|
|
1101
|
-
return { kind: VM_KIND.NONE, word: handle };
|
|
1102
|
-
}
|
|
1103
|
-
|
|
1104
1090
|
default:
|
|
1105
1091
|
report(line_number, `Unsupported operand role '${role}'`);
|
|
1106
1092
|
return null;
|
|
@@ -124,7 +124,7 @@ export type ParticleVectorNode = {
|
|
|
124
124
|
*/
|
|
125
125
|
patterns: number[];
|
|
126
126
|
/**
|
|
127
|
-
* static fields: literal bits, a record word, a builtin id,
|
|
127
|
+
* static fields: literal bits, a record word, a builtin id,
|
|
128
128
|
* the first draw of a `RANDOM`
|
|
129
129
|
*/
|
|
130
130
|
imm: number[];
|
|
@@ -66,7 +66,7 @@ export const PV = {
|
|
|
66
66
|
* @property {number[]} children the values its sources read, one per source
|
|
67
67
|
* @property {number[]} patterns per source, the swizzle it reads that value through — or, for
|
|
68
68
|
* `BUILD`, the single lane it takes
|
|
69
|
-
* @property {number[]} imm static fields: literal bits, a record word, a builtin id,
|
|
69
|
+
* @property {number[]} imm static fields: literal bits, a record word, a builtin id,
|
|
70
70
|
* the first draw of a `RANDOM`
|
|
71
71
|
*/
|
|
72
72
|
|
|
@@ -383,20 +383,6 @@ function evaluate(graph, instruction, operands, state) {
|
|
|
383
383
|
return lanes_of(graph, value, dest);
|
|
384
384
|
}
|
|
385
385
|
|
|
386
|
-
// Every lane is the same sample, so one lane holds it and a consumer reading it wide reads a
|
|
387
|
-
// broadcast.
|
|
388
|
-
case VM_OP.CURVE: {
|
|
389
|
-
const value = graph.make({
|
|
390
|
-
op,
|
|
391
|
-
width: 1,
|
|
392
|
-
children: [source(1).value],
|
|
393
|
-
patterns: [source(1).pattern],
|
|
394
|
-
imm: [words[1]],
|
|
395
|
-
});
|
|
396
|
-
|
|
397
|
-
return Array.from({ length: dest }, () => ({ value, lane: 0 }));
|
|
398
|
-
}
|
|
399
|
-
|
|
400
386
|
default: {
|
|
401
387
|
if (semantics.side_effects) {
|
|
402
388
|
return null;
|
|
@@ -204,10 +204,10 @@ export function pack_particle_vectors(graph, section, extraction) {
|
|
|
204
204
|
|
|
205
205
|
for (let source = 0; source < node.children.length; source++) {
|
|
206
206
|
group.operands.push(operand(
|
|
207
|
-
|
|
207
|
+
source,
|
|
208
208
|
node.children[source],
|
|
209
209
|
node.patterns[source],
|
|
210
|
-
|
|
210
|
+
group.width,
|
|
211
211
|
sequence
|
|
212
212
|
));
|
|
213
213
|
}
|
|
@@ -695,7 +695,6 @@ export function chunk_stores(stores) {
|
|
|
695
695
|
function raw_fields(node) {
|
|
696
696
|
switch (node.op) {
|
|
697
697
|
case VM_OP.LOAD_BUILTIN:
|
|
698
|
-
case VM_OP.CURVE:
|
|
699
698
|
return [node.imm[0], -1, -1];
|
|
700
699
|
|
|
701
700
|
default:
|
|
@@ -703,17 +702,6 @@ function raw_fields(node) {
|
|
|
703
702
|
}
|
|
704
703
|
}
|
|
705
704
|
|
|
706
|
-
/**
|
|
707
|
-
* @param {import("./particle_vector_graph.js").ParticleVectorNode} node
|
|
708
|
-
* @param {number} source which of the node's sources
|
|
709
|
-
* @returns {number} the instruction source slot it goes in
|
|
710
|
-
*/
|
|
711
|
-
function slot_of(node, source) {
|
|
712
|
-
// `CURVE` takes its handle in slot 0 and the value it samples in slot 1; everything else fills
|
|
713
|
-
// its slots in order.
|
|
714
|
-
return node.op === VM_OP.CURVE ? source + 1 : source;
|
|
715
|
-
}
|
|
716
|
-
|
|
717
705
|
/**
|
|
718
706
|
* How many lanes of each value anything actually reads.
|
|
719
707
|
*
|
|
@@ -772,9 +760,7 @@ function measure_demand(graph, section, extraction) {
|
|
|
772
760
|
continue;
|
|
773
761
|
}
|
|
774
762
|
|
|
775
|
-
const reads = node.op
|
|
776
|
-
? 1
|
|
777
|
-
: Math.max(narrowable(node) ? width : node.operand_width, VM_ISA.get(node.op)?.min_width ?? 1);
|
|
763
|
+
const reads = Math.max(narrowable(node) ? width : node.operand_width, VM_ISA.get(node.op)?.min_width ?? 1);
|
|
778
764
|
|
|
779
765
|
for (let source = 0; source < node.children.length; source++) {
|
|
780
766
|
let highest = 0;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"particle_program_analysis.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/particles/optimizer/particle_program_analysis.js"],"names":[],"mappings":"AAwBA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH;;;;;;;;;;;GAWG;AAEH;;;;;;;;;;;;;;GAcG;AAEH;;;;;;GAMG;AACH,mDAJW,UAAU,MAAM,CAAC,UACjB,MAAM,GACJ,0BAA0B,CAiDtC;AAED;;;GAGG;AACH,2DAHW,UAAU,UAAU,MAAM,CAAC,CAAC,GAC1B,0BAA0B,EAAE,CAUxC;AAED;;;;;;;GAOG;AACH,0CAJW,kBAAkB,UAClB,MAAM,GACJ,MAAM,EAAE,CAUpB;AAED;;;;;;;;;;;GAWG;AACH,2DAHW,UAAU,MAAM,CAAC,GACf,OAAO,CAiBnB;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,sDAJW,0BAA0B,EAAE,mBAC5B,MAAM,GACJ,QAAQ,CAyDpB;AAED;;;;;;;;GAQG;AAEH;;;;;;;;;;;;;;;GAeG;AACH,gDAJW,0BAA0B,EAAE,mBAC5B,MAAM,GACJ,oBAAoB,CA6EhC;AAED;;;;;;;;;;;GAWG;AACH,kDAJW,0BAA0B,EAAE,mBAC5B,MAAM,GACJ,MAAM,CAmClB;
|
|
1
|
+
{"version":3,"file":"particle_program_analysis.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/particles/optimizer/particle_program_analysis.js"],"names":[],"mappings":"AAwBA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH;;;;;;;;;;;GAWG;AAEH;;;;;;;;;;;;;;GAcG;AAEH;;;;;;GAMG;AACH,mDAJW,UAAU,MAAM,CAAC,UACjB,MAAM,GACJ,0BAA0B,CAiDtC;AAED;;;GAGG;AACH,2DAHW,UAAU,UAAU,MAAM,CAAC,CAAC,GAC1B,0BAA0B,EAAE,CAUxC;AAED;;;;;;;GAOG;AACH,0CAJW,kBAAkB,UAClB,MAAM,GACJ,MAAM,EAAE,CAUpB;AAED;;;;;;;;;;;GAWG;AACH,2DAHW,UAAU,MAAM,CAAC,GACf,OAAO,CAiBnB;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,sDAJW,0BAA0B,EAAE,mBAC5B,MAAM,GACJ,QAAQ,CAyDpB;AAED;;;;;;;;GAQG;AAEH;;;;;;;;;;;;;;;GAeG;AACH,gDAJW,0BAA0B,EAAE,mBAC5B,MAAM,GACJ,oBAAoB,CA6EhC;AAED;;;;;;;;;;;GAWG;AACH,kDAJW,0BAA0B,EAAE,mBAC5B,MAAM,GACJ,MAAM,CAmClB;AAED;;;;;;GAMG;AACH,8CANW,MAAM,UACN,MAAM,UACN,MAAM,UACN,MAAM,GACJ,OAAO,CAInB;AAED;;;;;;;;;;;;;GAaG;AACH,yDAPW,0BAA0B,EAAE,QAC5B,MAAM,MACN,MAAM,QACN,MAAM,QACN,MAAM,GACJ,OAAO,CAmBnB;AAED;;;;;;;;;;GAUG;AACH,yDAPW,0BAA0B,EAAE,QAC5B,MAAM,MACN,MAAM,QACN,MAAM,QACN,MAAM,GACJ,OAAO,CAanB;AAED;;;;;;;;;;;GAWG;AACH,oDANW,0BAA0B,EAAE,SAC5B,MAAM,QACN,MAAM,QACN,MAAM,GACJ,OAAO,CAiCnB;AAED;;;;;;;;;;;;;GAaG;AACH;IACI;;OAEG;IACH,oBAFW,MAAM,EAsBhB;IAnBG,qBAAqB;IACrB,OADW,MAAM,CACC;IAClB,gDAAgD;IAChD,UADW,UAAU,CACgB;IACrC,mEAAmE;IACnE,MADW,UAAU,CACY;IACjC,kGAAkG;IAClG,UADW,UAAU,CACyB;IAC9C,qBAAqB;IACrB,SADW,MAAM,CACG;IACpB,sEAAsE;IACtE,WADW,MAAM,CACC;IAUtB;;;;OAIG;IACH,aAJW,MAAM,QACN,MAAM,GACJ,MAAM,EAAE,GAAC,IAAI,CAczB;IAED;;;;;OAKG;IACH,eAHW,kBAAkB,GAChB,MAAM,EAAE,GAAC,IAAI,CAUzB;IAED;;;;OAIG;IACH,YAJW,MAAM,OACN,MAAM,EAAE,GACN,OAAO,CAcnB;IAED;;;;;;;;;;;;;;;;OAgBG;IACH,qBAJW,kBAAkB,GAChB,MAAM,CAiDlB;IAED;;;;;;;;OAQG;IACH,eAFW,UAAU,MAAM,CAAC,QAwC3B;CACJ;;;;;aAhrBa,MAAM;;;;UACN,MAAM;;;;UACN,MAAM;;;;UACN,MAAM;;;;;aACN,MAAM;;;;;WAEN,MAAM;;;;UAEN,MAAM;;;;;;WAKN,MAAM;;;;WACN,MAAM,EAAE;QACR,MAAM;;;;WACN,MAAM;;;;SACN,MAAM;;;;WACN,MAAM;;;;qBACN,MAAM;;;;UACN,MAAM;eACN,OAAO,4BAA4B,EAAE,mBAAmB;;;;WACxD,kBAAkB,GAAC,IAAI;;;;WACvB,kBAAkB,EAAE;;;;aACpB,kBAAkB,EAAE;;;;;;;UAoMpB,UAAU;;;;;WAEV,UAAU;;;;gBAEV,UAAU;;;;gBACV,MAAM;;yBAvRK,wCAAwC"}
|
|
@@ -362,7 +362,7 @@ export function analyze_particle_lanes(decoded, register_slots = PARTICLE_VM_REG
|
|
|
362
362
|
}
|
|
363
363
|
|
|
364
364
|
for (const read of instruction.reads) {
|
|
365
|
-
for (const slot of particle_read_slots(read,
|
|
365
|
+
for (const slot of particle_read_slots(read, operation_width)) {
|
|
366
366
|
if (slot < register_slots) {
|
|
367
367
|
live[slot] = 1;
|
|
368
368
|
}
|
|
@@ -420,19 +420,6 @@ export function particle_peak_live_slots(decoded, register_slots = PARTICLE_VM_R
|
|
|
420
420
|
return peak;
|
|
421
421
|
}
|
|
422
422
|
|
|
423
|
-
/**
|
|
424
|
-
* How many lanes of a source an instruction reads once it is narrowed to `operation_width`: one for a
|
|
425
|
-
* slot the ISA marks scalar, the width for everything else.
|
|
426
|
-
*
|
|
427
|
-
* @param {ParticleDecodedInstruction} instruction
|
|
428
|
-
* @param {ParticleOperandRun} read
|
|
429
|
-
* @param {number} operation_width
|
|
430
|
-
* @returns {number}
|
|
431
|
-
*/
|
|
432
|
-
function particle_lanes_read_at(instruction, read, operation_width) {
|
|
433
|
-
return instruction.meta.scalar_operands.includes(read.operand) ? 1 : operation_width;
|
|
434
|
-
}
|
|
435
|
-
|
|
436
423
|
/**
|
|
437
424
|
* @param {number} base_a
|
|
438
425
|
* @param {number} span_a
|
|
@@ -728,28 +715,20 @@ export class ParticleValueNumbering {
|
|
|
728
715
|
/** Gathered before anything is written: a source may alias the destination. */
|
|
729
716
|
const lanes = new Array(span);
|
|
730
717
|
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
?
|
|
743
|
-
:
|
|
744
|
-
|
|
745
|
-
for (let lane = 0; lane < span; lane++) {
|
|
746
|
-
const from = source === null ? -1 : vm_operand_slot(source.word, lane);
|
|
747
|
-
|
|
748
|
-
lanes[lane] = from >= 0 && from < this.slots
|
|
749
|
-
? { id: this.value_id[from], home: this.home[from], producer: this.producer[from] }
|
|
750
|
-
: { id: this.next_id++, home: base + lane, producer: publish };
|
|
751
|
-
}
|
|
752
|
-
}
|
|
718
|
+
// A copy carries values only from a REGISTER source. A literal is a value the file never
|
|
719
|
+
// held, so a MOV from one mints — and its word is not the slot it would otherwise be
|
|
720
|
+
// read as.
|
|
721
|
+
const source = instruction.op === VM_OP.MOV && instruction.sources[0].kind === VM_KIND.REG
|
|
722
|
+
? instruction.sources[0]
|
|
723
|
+
: null;
|
|
724
|
+
|
|
725
|
+
for (let lane = 0; lane < span; lane++) {
|
|
726
|
+
const from = source === null ? -1 : vm_operand_slot(source.word, lane);
|
|
727
|
+
|
|
728
|
+
lanes[lane] = from >= 0 && from < this.slots
|
|
729
|
+
? { id: this.value_id[from], home: this.home[from], producer: this.producer[from] }
|
|
730
|
+
: { id: this.next_id++, home: base + lane, producer: publish };
|
|
731
|
+
}
|
|
753
732
|
|
|
754
733
|
for (let lane = 0; lane < span; lane++) {
|
|
755
734
|
const slot = base + lane;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"particle_program_equivalence.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/particles/optimizer/particle_program_equivalence.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"particle_program_equivalence.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/particles/optimizer/particle_program_equivalence.js"],"names":[],"mappings":"AA2GA;;;;;;;;;GASG;AACH;IAN+B,KAAK,EAAzB,WAAW;IACmB,SAAS,EAAvC,YAAY,GAAC,MAAM,EAAE;IACN,cAAc,EAA7B,MAAM;IACS,WAAW,EAA1B,MAAM;;YACM,WAAW;YAAU,OAAO;eAAa,MAAM;EAerE;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,+CAHW,WAAW;YACA,UAAU;YAAU,OAAO;EAkEhD;AAqCD;;;;;;;;;;;;;;GAcG;AACH,qDAVW;IAAC,MAAM,EAAE,WAAW,CAAC;IAAC,MAAM,EAAE,OAAO,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAC,SACzD;IAAC,MAAM,EAAE,WAAW,CAAC;IAAC,MAAM,EAAE,OAAO,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAC;IAErC,SAAS,GAA7B,MAAM;IACkD,KAAK,GAA7D;QAAC,MAAM,EAAE,UAAU,CAAC;QAAC,MAAM,EAAE,OAAO,CAAA;KAAC,GAAC,IAAI;IAIxC,MAAM,GAAC,IAAI,CAuCvB;AAED;;;;;;;;;;;;;;GAcG;AACH;IARkG,MAAM,EAA7F;QAAC,KAAK,EAAE,WAAW,CAAC;QAAC,SAAS,EAAE,YAAY,GAAC,MAAM,EAAE,CAAC;QAAC,cAAc,EAAE,MAAM,CAAA;KAAC;IACS,KAAK,EAA5F;QAAC,KAAK,EAAE,WAAW,CAAC;QAAC,SAAS,EAAE,YAAY,GAAC,MAAM,EAAE,CAAC;QAAC,cAAc,EAAE,MAAM,CAAA;KAAC;IACvD,YAAY,GAAnC,MAAM,MAAM,CAAC;IACG,UAAU,GAA1B,MAAM;IAGJ,MAAM,GAAC,IAAI,CAqBvB;AAED;;;;;;;GAOG;AACH,qGAHW,MAAM,GACJ,MAAM,GAAC,IAAI,CAmBvB;AArRD;;;;;GAKG;AACH,oCAFU,MAAM;IAAC,MAAM,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,EAAE,EAAE,CAAC;IAAC,SAAS,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,WAAW,CAAA;CAAC,CAAC,CAOjG"}
|
|
@@ -56,7 +56,7 @@ import { PARTICLE_ZERO_ABSORBING_OPS } from "./pass_fold_constants.js";
|
|
|
56
56
|
*
|
|
57
57
|
* ## Environments
|
|
58
58
|
*
|
|
59
|
-
* A program reads more than its constants — record words, builtins, the RNG
|
|
59
|
+
* A program reads more than its constants — record words, builtins, the RNG — and a
|
|
60
60
|
* pass that mishandled any of those could still agree on a single run. {@link PARTICLE_ENVIRONMENTS}
|
|
61
61
|
* varies all of them, including a record pre-filled with values a `LOAD_ATTR` can pick up.
|
|
62
62
|
*/
|
|
@@ -92,9 +92,6 @@ function seeded_record() {
|
|
|
92
92
|
return record;
|
|
93
93
|
}
|
|
94
94
|
|
|
95
|
-
/** @param {number} handle @param {number} t @returns {number} */
|
|
96
|
-
const sample_curve = (handle, t) => Math.sin(handle + t * 3) * 0.5 + handle * 0.125;
|
|
97
|
-
|
|
98
95
|
/**
|
|
99
96
|
* The contexts a program is compared in. Seeds differ so a pass that dropped or added a draw shows
|
|
100
97
|
* up as a diverging RNG state rather than only as a diverging record.
|
|
@@ -128,7 +125,6 @@ export function run_particle_section({ words, constants, register_count, environ
|
|
|
128
125
|
record,
|
|
129
126
|
builtins: environment.builtins,
|
|
130
127
|
rng_state: environment.rng_state,
|
|
131
|
-
sampleCurve: sample_curve,
|
|
132
128
|
});
|
|
133
129
|
|
|
134
130
|
return { record, killed: result.killed, rng_state: result.rng_state };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"particle_program_fuzz.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/particles/optimizer/particle_program_fuzz.js"],"names":[],"mappings":"AAkDA;;;;;;;;;;;;;GAaG;AACH,oDAXuB,MAAM;IAED,WAAW,GAA5B,MAAM;IACY,IAAI,GAAtB,OAAO;IACW,MAAM,GAAxB,OAAO;IACU,cAAc,GAA/B,MAAM;oBAqHhB;
|
|
1
|
+
{"version":3,"file":"particle_program_fuzz.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/particles/optimizer/particle_program_fuzz.js"],"names":[],"mappings":"AAkDA;;;;;;;;;;;;;GAaG;AACH,oDAXuB,MAAM;IAED,WAAW,GAA5B,MAAM;IACY,IAAI,GAAtB,OAAO;IACW,MAAM,GAAxB,OAAO;IACU,cAAc,GAA/B,MAAM;oBAqHhB;AAuED;;;;;;;;;;;;;;;;;;GAkBG;AACH,yDALuB,MAAM;IAED,MAAM,GAAvB,MAAM;oBAmEhB"}
|
|
@@ -41,7 +41,7 @@ const FUZZ_OPS = [
|
|
|
41
41
|
VM_OP.SMOOTHSTEP, VM_OP.RSQRT, VM_OP.TAN, VM_OP.ASIN, VM_OP.ACOS, VM_OP.ATAN2,
|
|
42
42
|
VM_OP.DOT, VM_OP.CROSS, VM_OP.LENGTH, VM_OP.NORMALIZE, VM_OP.DISTANCE,
|
|
43
43
|
VM_OP.CMP_LT, VM_OP.CMP_LE, VM_OP.CMP_GT, VM_OP.CMP_GE, VM_OP.CMP_EQ,
|
|
44
|
-
VM_OP.SELECT, VM_OP.RANDOM, VM_OP.
|
|
44
|
+
VM_OP.SELECT, VM_OP.RANDOM, VM_OP.LOAD_CONST, VM_OP.LOAD_ATTR, VM_OP.LOAD_BUILTIN,
|
|
45
45
|
VM_OP.NOP,
|
|
46
46
|
];
|
|
47
47
|
|
|
@@ -222,13 +222,6 @@ function emit_random_instruction(stream, assembler, rand, pool) {
|
|
|
222
222
|
return;
|
|
223
223
|
}
|
|
224
224
|
|
|
225
|
-
case VM_OP.CURVE: {
|
|
226
|
-
const handle = Math.floor(rand() * 4);
|
|
227
|
-
|
|
228
|
-
stream.curve(dst, handle, source(group), width);
|
|
229
|
-
return;
|
|
230
|
-
}
|
|
231
|
-
|
|
232
225
|
default: {
|
|
233
226
|
// A `SELECT` whose condition is a constant is the shape the folding pass exists for, and
|
|
234
227
|
// random registers hold one about never — so it is worth steering into deliberately.
|
|
@@ -13,7 +13,7 @@ export function vm_semantics_of(op: number): ParticleOpSemantics;
|
|
|
13
13
|
* it — whether it can be deleted when its result is unread, narrowed when its high lanes are dead,
|
|
14
14
|
* evaluated at compile time, or recognised as a recomputation of something already in a register.
|
|
15
15
|
* Those are four different questions and an opcode can answer them differently: `LOAD_ATTR` is
|
|
16
|
-
* removable but not shareable across a store, `RANDOM` is neither, and `
|
|
16
|
+
* removable but not shareable across a store, `RANDOM` is neither, and `LOAD_BUILTIN` is both.
|
|
17
17
|
*
|
|
18
18
|
* Every opcode has to appear in {@link VM_SEMANTICS} — the spec asserts it — because the safe
|
|
19
19
|
* default for a new one is "assume nothing", and a table that silently omitted it would instead have
|
|
@@ -22,7 +22,7 @@ export function vm_semantics_of(op: number): ParticleOpSemantics;
|
|
|
22
22
|
* Which lane of a source feeds which lane of the result is not a property of the opcode any more:
|
|
23
23
|
* every register operand carries a swizzle, and `vm_operand_slot` in the ISA answers it per operand.
|
|
24
24
|
* What is left here is per-opcode: whether lane `i` of the result depends on lane `i` of the
|
|
25
|
-
* sources alone (`lanewise`)
|
|
25
|
+
* sources alone (`lanewise`).
|
|
26
26
|
*/
|
|
27
27
|
/**
|
|
28
28
|
* @typedef {object} ParticleOpSemantics
|
|
@@ -37,9 +37,6 @@ export function vm_semantics_of(op: number): ParticleOpSemantics;
|
|
|
37
37
|
* @property {boolean} shareable two executions with equal operand values produce equal results, so a
|
|
38
38
|
* second one can read the first one's register instead. False for anything reading the record or
|
|
39
39
|
* the RNG.
|
|
40
|
-
* @property {boolean} broadcasts every lane of the destination holds the same value, by construction
|
|
41
|
-
* rather than by what the operands happen to be. Lane `i` is then a copy of lane 0 and may be read
|
|
42
|
-
* as one.
|
|
43
40
|
* @property {boolean} foldable the JS reference and the WGSL interpreter are both obliged to produce
|
|
44
41
|
* the *same bits* for this operation, so evaluating it here and baking a constant changes nothing
|
|
45
42
|
* on either. Correctly-rounded IEEE arithmetic qualifies; a transcendental does not — JS
|
|
@@ -79,12 +76,6 @@ export type ParticleOpSemantics = {
|
|
|
79
76
|
* the RNG.
|
|
80
77
|
*/
|
|
81
78
|
shareable: boolean;
|
|
82
|
-
/**
|
|
83
|
-
* every lane of the destination holds the same value, by construction
|
|
84
|
-
* rather than by what the operands happen to be. Lane `i` is then a copy of lane 0 and may be read
|
|
85
|
-
* as one.
|
|
86
|
-
*/
|
|
87
|
-
broadcasts: boolean;
|
|
88
79
|
/**
|
|
89
80
|
* the JS reference and the WGSL interpreter are both obliged to produce
|
|
90
81
|
* the *same bits* for this operation, so evaluating it here and baking a constant changes nothing
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"particle_vm_semantics.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/particles/optimizer/particle_vm_semantics.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"particle_vm_semantics.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/particles/optimizer/particle_vm_semantics.js"],"names":[],"mappings":"AA4IA;;;;;;GAMG;AACH,oCAHW,MAAM,GACJ,mBAAmB,CAW/B;AA1JD;;;;;;;;;;;;;;;;;GAiBG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,+CAA+C;AAC/C,2BADW,IAAI,MAAM,EAAE,mBAAmB,CAAC,CACL;;;;;;;kBA1BxB,OAAO;;;;;cAGP,OAAO;;;;;;gBAEP,OAAO;;;;;;eAGP,OAAO;;;;;;;;cAGP,OAAO;;;;;;;;;;sBAKP,OAAO"}
|
|
@@ -7,7 +7,7 @@ import { VM_OP } from "../isa/ParticleVMISA.js";
|
|
|
7
7
|
* it — whether it can be deleted when its result is unread, narrowed when its high lanes are dead,
|
|
8
8
|
* evaluated at compile time, or recognised as a recomputation of something already in a register.
|
|
9
9
|
* Those are four different questions and an opcode can answer them differently: `LOAD_ATTR` is
|
|
10
|
-
* removable but not shareable across a store, `RANDOM` is neither, and `
|
|
10
|
+
* removable but not shareable across a store, `RANDOM` is neither, and `LOAD_BUILTIN` is both.
|
|
11
11
|
*
|
|
12
12
|
* Every opcode has to appear in {@link VM_SEMANTICS} — the spec asserts it — because the safe
|
|
13
13
|
* default for a new one is "assume nothing", and a table that silently omitted it would instead have
|
|
@@ -16,7 +16,7 @@ import { VM_OP } from "../isa/ParticleVMISA.js";
|
|
|
16
16
|
* Which lane of a source feeds which lane of the result is not a property of the opcode any more:
|
|
17
17
|
* every register operand carries a swizzle, and `vm_operand_slot` in the ISA answers it per operand.
|
|
18
18
|
* What is left here is per-opcode: whether lane `i` of the result depends on lane `i` of the
|
|
19
|
-
* sources alone (`lanewise`)
|
|
19
|
+
* sources alone (`lanewise`).
|
|
20
20
|
*/
|
|
21
21
|
|
|
22
22
|
/**
|
|
@@ -32,9 +32,6 @@ import { VM_OP } from "../isa/ParticleVMISA.js";
|
|
|
32
32
|
* @property {boolean} shareable two executions with equal operand values produce equal results, so a
|
|
33
33
|
* second one can read the first one's register instead. False for anything reading the record or
|
|
34
34
|
* the RNG.
|
|
35
|
-
* @property {boolean} broadcasts every lane of the destination holds the same value, by construction
|
|
36
|
-
* rather than by what the operands happen to be. Lane `i` is then a copy of lane 0 and may be read
|
|
37
|
-
* as one.
|
|
38
35
|
* @property {boolean} foldable the JS reference and the WGSL interpreter are both obliged to produce
|
|
39
36
|
* the *same bits* for this operation, so evaluating it here and baking a constant changes nothing
|
|
40
37
|
* on either. Correctly-rounded IEEE arithmetic qualifies; a transcendental does not — JS
|
|
@@ -62,7 +59,6 @@ function semantics(op, flags) {
|
|
|
62
59
|
lanewise: false,
|
|
63
60
|
narrowable: false,
|
|
64
61
|
shareable: false,
|
|
65
|
-
broadcasts: false,
|
|
66
62
|
foldable: false,
|
|
67
63
|
foldable_inexact: false,
|
|
68
64
|
...flags,
|
|
@@ -141,10 +137,6 @@ semantics(VM_OP.SELECT, EXACT);
|
|
|
141
137
|
// Ordered and side-effecting: it advances the shared RNG, and its width IS the number of draws it
|
|
142
138
|
// takes. Removing, duplicating, reordering or narrowing one moves every value drawn after it.
|
|
143
139
|
semantics(VM_OP.RANDOM, { side_effects: true });
|
|
144
|
-
// An external WGSL symbol, but a pure function of (handle, t) — so a dead one goes and a repeated
|
|
145
|
-
// one is shared. Every lane of the result is the same sample, which is what makes it narrowable —
|
|
146
|
-
// and what makes it a broadcast, so a consumer reading it wide is a consumer that wants `.xxxx`.
|
|
147
|
-
semantics(VM_OP.CURVE, { lanewise: true, narrowable: true, shareable: true, broadcasts: true });
|
|
148
140
|
|
|
149
141
|
/**
|
|
150
142
|
* What may be assumed about an opcode. An unknown one is assumed to do everything, so a new opcode
|
|
@@ -159,7 +151,6 @@ export function vm_semantics_of(op) {
|
|
|
159
151
|
lanewise: false,
|
|
160
152
|
narrowable: false,
|
|
161
153
|
shareable: false,
|
|
162
|
-
broadcasts: false,
|
|
163
154
|
foldable: false,
|
|
164
155
|
foldable_inexact: false,
|
|
165
156
|
};
|
|
@@ -24,6 +24,13 @@ export const EMITTER_RENDER_CHANNEL_COMPONENTS: {
|
|
|
24
24
|
/**
|
|
25
25
|
* One particle emitter: a scene node that runs a compiled effect.
|
|
26
26
|
*
|
|
27
|
+
* **In a game, this is built for you.** An entity carrying
|
|
28
|
+
* {@link ../../../../engine/graphics/ecs/particles/ParticleEffect.js ParticleEffect} and a
|
|
29
|
+
* `Transform64` gets one of these from `engine/graphics3/GPUParticleEmitterSystem.js`, which owns it
|
|
30
|
+
* and keeps every field below in step with the component. Build one by hand for the cases with no
|
|
31
|
+
* ECS behind them — a playground, a tool, a spec — or reach for the one the system built through its
|
|
32
|
+
* `node_of(entity)` when an entity reference cannot say what you mean.
|
|
33
|
+
*
|
|
27
34
|
* Being a {@link Node3D} is what places it. Add it to a scene and it gets a row in the scene
|
|
28
35
|
* database's `transforms` table like any other node; parent it to a joint and the GPU hierarchy
|
|
29
36
|
* pass composes its world matrix from the joint's every frame, animation included, with nothing
|
|
@@ -117,10 +124,10 @@ export class ParticleEmitter extends Node3D {
|
|
|
117
124
|
* Image to draw the particles with, by URL, or `null` to draw against the default atlas — a
|
|
118
125
|
* single white texel, so an untextured emitter is a flat quad of its colour.
|
|
119
126
|
*
|
|
120
|
-
*
|
|
121
|
-
* into a
|
|
122
|
-
* a given image lands in that sheet is the system's answer, not the author's — it
|
|
123
|
-
* every repack, without the emitter changing. The resolved patch is
|
|
127
|
+
* `engine/graphics3/GPUParticleEmitterSystem.js` loads this URL through AssetManager and packs
|
|
128
|
+
* the image into a sheet its scene shares. Standalone callers provide their own atlas and
|
|
129
|
+
* regions. Where a given image lands in that sheet is the system's answer, not the author's — it
|
|
130
|
+
* changes on every repack, without the emitter changing. The resolved patch is
|
|
124
131
|
* {@link ./GPUParticleEmitterContext.js#atlas_region}.
|
|
125
132
|
*
|
|
126
133
|
* @type {string|null}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ParticleEmitter.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/particles/runtime/ParticleEmitter.js"],"names":[],"mappings":"AAUA;;;;;GAKG;AACH,sCAFU,MAAM,EAAE,CAIf;AAEH;;;;;;;;;;;;GAYG;AACH;QAFiB,MAAM,GAAE,MAAM;EAS5B;AAEH
|
|
1
|
+
{"version":3,"file":"ParticleEmitter.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/particles/runtime/ParticleEmitter.js"],"names":[],"mappings":"AAUA;;;;;GAKG;AACH,sCAFU,MAAM,EAAE,CAIf;AAEH;;;;;;;;;;;;GAYG;AACH;QAFiB,MAAM,GAAE,MAAM;EAS5B;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AACH;IA0QI;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH;QAfwE,MAAM,EAAnE,OAAO,6BAA6B,EAAE,cAAc;QAEQ,OAAO,EAAnE,OAAO,2BAA2B,EAAE,eAAe;QAExB,QAAQ,GAAnC,UAAU,MAAM,CAAC;QACI,OAAO,GAA5B,MAAM,GAAC,IAAI;QACK,IAAI,GAApB,MAAM;QACU,UAAU,GAA1B,MAAM;QACU,OAAO,GAAvB,MAAM;QACU,KAAK,GAArB,MAAM;QACyB,MAAM;gBAA9B,MAAM,GAAC,MAAM;;QACO,QAAQ,GAAnC,UAAU,MAAM,CAAC;QACD,IAAI,GAApB,MAAM;QACJ,eAAe,CAgD3B;IA7UD;;;;;OAKG;IACH,QAFU,OAAO,6BAA6B,EAAE,cAAc,CAEvD;IAEP;;;;;OAKG;IACH,SAFU,OAAO,2BAA2B,EAAE,eAAe,CAErD;IAER;;;;;;;;;;;OAWG;IACH,SAFU,MAAM,GAAC,IAAI,CAEN;IAEf;;;;;;;;OAQG;IACH,MAFU,MAAM,CAEP;IAET;;;;OAIG;IACH,YAFU,MAAM,CAED;IAEf;;;;;;;;;;;;;;;;;;;OAmBG;IACH,SAFU,MAAM,CAEJ;IAEZ;;;OAGG;IACH,OAFU,MAAM,CAEN;IAEV;;;;OAIG;IACH,UAFU,YAAY,CAEc;IAEpC,+FAA+F;IAC/F,iBADW,MAAM,CAC0B;IAC3C,gDAAgD;IAChD,aADW,MAAM,CACsB;IACvC,uDAAuD;IACvD,cADW,MAAM,CACuB;IACxC,+DAA+D;IAC/D,iBADW,MAAM,CAC0B;IAC3C,gEAAgE;IAChE,cADW,MAAM,CACuB;IACxC,sFAAsF;IACtF,iBADW,MAAM,CAC0B;IAE3C,mBAEC;IAED;;;;;;;;;;;;OAYG;IACH;YAHkB,MAAM,GAAC,MAAM;aA2B9B;IAED;;;;;;;;;;;;OAYG;IACH,cAHW,eAAe,GACb,OAAO,CAuBnB;IAED;;;;;;OAMG;IACH,QAFa,MAAM,CAsBlB;IAED;;;;;;;;;;;;OAYG;IACH,YAFW,eAAe,QAwBzB;IAED;;;;;;OAMG;IACH,SAFa,eAAe,CAgB3B;IA0EL;;;OAGG;IACH,4BAFU,OAAO,CAE0B;CAN1C;uBAjasB,uBAAuB"}
|