Skip to content

Commit

Permalink
Reduce sort worker memory needs
Browse files Browse the repository at this point in the history
  • Loading branch information
mkkellogg committed Jun 10, 2024
1 parent 4de5a3d commit 54c8d52
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ Advanced `Viewer` parameters
| `enablePerScenePropertiesInSplatShader` | When true, will include a usage of per-scene attributes in the splat shader, such as opacity. Default is false for performance reasons. These properties are separate from transform properties (scale, rotation, position) that are enabled by the 'dynamicScene' parameter.
| `enableSIMDInSort` | Enable the usage of SIMD WebAssembly instructions for the splat sort.
| `plyInMemoryCompressionLevel` | Level to compress `.ply` files when loading them for direct rendering (not exporting to `.ksplat`). Valid values are the same as `.ksplat` compression levels (0, 1, or 2). Default is 2.
| `freeIntermediateSplatData` | When true, the intermediate splat data that is the result of decompressing splat bufffer(s) and is used to populate the data textures will be freed. This will reduces memory usage, but if that data needs to be modified it will need to be re-populated from the splat buffer(s).
| `freeIntermediateSplatData` | When true, the intermediate splat data that is the result of decompressing splat bufffer(s) and is used to populate the data textures will be freed. This will reduces memory usage, but if that data needs to be modified it will need to be re-populated from the splat buffer(s). Default is false.
<br>

### Creating KSPLAT files
Expand Down
7 changes: 5 additions & 2 deletions src/Viewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,11 @@ export class Viewer {

// When true, the intermediate splat data that is the result of decompressing splat bufffer(s) and is used to
// populate the data textures will be freed. This will reduces memory usage, but if that data needs to be modified
// it will need to be re-populated from the splat buffer(s).
this.freeIntermediateSplatData = options.freeIntermediateSplatData || false;
// it will need to be re-populated from the splat buffer(s). Default is false.
if (options.freeIntermediateSplatData === undefined || options.freeIntermediateSplatData === null) {
options.freeIntermediateSplatData = false;
}
this.freeIntermediateSplatData = options.freeIntermediateSplatData;

// It appears that for certain iOS versions, special actions need to be taken with the
// usage of SIMD instructions and shared memory
Expand Down
4 changes: 2 additions & 2 deletions src/worker/SortWorker.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,8 @@ function sortWorker(self) {
module: {},
env: {
memory: new WebAssembly.Memory({
initial: totalPagesRequired * 2,
maximum: totalPagesRequired * 4,
initial: totalPagesRequired,
maximum: totalPagesRequired,
shared: true,
}),
}
Expand Down

0 comments on commit 54c8d52

Please sign in to comment.