@playcanvas/supersplat-viewer 1.20.1 → 1.20.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@playcanvas/supersplat-viewer",
3
- "version": "1.20.1",
3
+ "version": "1.20.2",
4
4
  "author": "PlayCanvas <support@playcanvas.com>",
5
5
  "homepage": "https://github.com/playcanvas/supersplat-viewer#readme",
6
6
  "description": "Viewer for https://superspl.at",
package/public/index.html CHANGED
@@ -21,11 +21,20 @@
21
21
  const settingsUrl = url.searchParams.has('settings') ? url.searchParams.get('settings') : './settings.json';
22
22
  const contentUrl = url.searchParams.has('content') ? url.searchParams.get('content') : './scene.compressed.ply';
23
23
 
24
+ // ?webgpu picks the best WebGPU renderer for the platform: compute on
25
+ // macOS (where the raster gpu-sort path stalls) and gpu-sort elsewhere.
26
+ // Prefer userAgentData when available, fall back to the deprecated
27
+ // navigator.platform / userAgent. Exclude iPad desktop mode, which
28
+ // reports as Mac but should not take the macOS path.
29
+ const uaPlatform = navigator.userAgentData?.platform || navigator.platform || navigator.userAgent || '';
30
+ const isIPad = navigator.maxTouchPoints > 1 && /Mac/i.test(navigator.platform || '');
31
+ const isMac = !isIPad && /macOS|Mac/i.test(uaPlatform);
24
32
  const renderer =
25
- url.searchParams.has('compute') ? 'compute' :
26
- url.searchParams.has('gpu') ? 'gpu' :
27
- url.searchParams.has('cpu') ? 'cpu' :
28
- 'webgl';
33
+ url.searchParams.has('compute') ? 'compute' :
34
+ url.searchParams.has('gpu-sort') ? 'gpu-sort' :
35
+ url.searchParams.has('cpu-sort') ? 'cpu-sort' :
36
+ url.searchParams.has('webgpu') ? (isMac ? 'compute' : 'gpu-sort') :
37
+ 'webgl';
29
38
 
30
39
  const budgetParam = url.searchParams.get('budget');
31
40
  const budget = budgetParam !== null ? Number(budgetParam) : undefined;
package/public/index.js CHANGED
@@ -80777,8 +80777,8 @@ fn prepareOutputFromGamma(gammaColor: vec3f, depth: f32) -> vec3f {
80777
80777
  `;
80778
80778
  const rendererTable = {
80779
80779
  'webgl': GSPLAT_RENDERER_RASTER_CPU_SORT,
80780
- 'cpu': GSPLAT_RENDERER_RASTER_CPU_SORT,
80781
- 'gpu': GSPLAT_RENDERER_RASTER_GPU_SORT,
80780
+ 'cpu-sort': GSPLAT_RENDERER_RASTER_CPU_SORT,
80781
+ 'gpu-sort': GSPLAT_RENDERER_RASTER_GPU_SORT,
80782
80782
  'compute': GSPLAT_RENDERER_COMPUTE
80783
80783
  };
80784
80784
  const tonemapTable = {
@@ -82096,7 +82096,7 @@ const initXr = (global) => {
82096
82096
  });
82097
82097
  };
82098
82098
 
82099
- var version = "1.20.1";
82099
+ var version = "1.20.2";
82100
82100
 
82101
82101
  const loadGsplat = async (app, config, progressCallback) => {
82102
82102
  const { contents, contentUrl, aa } = config;
@@ -82166,6 +82166,7 @@ const createApp = async (canvas, config) => {
82166
82166
  xrCompatible: !useWebGPU,
82167
82167
  powerPreference: 'high-performance'
82168
82168
  });
82169
+ console.log(`Renderer: ${device.deviceType}, ${config.renderer === 'webgl' ? 'cpu-sort' : config.renderer}`);
82169
82170
  // Set maxPixelRatio so the XR framebuffer scale factor is computed correctly.
82170
82171
  // Regular rendering bypasses maxPixelRatio via the custom initCanvas sizing.
82171
82172
  device.maxPixelRatio = window.devicePixelRatio;