@onerjs/core 8.46.1 → 8.46.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/Collisions/gpuPicker.js +9 -1
- package/Collisions/gpuPicker.js.map +1 -1
- package/Engines/WebGPU/webgpuCacheRenderPipeline.d.ts +20 -0
- package/Engines/WebGPU/webgpuCacheRenderPipeline.js +58 -13
- package/Engines/WebGPU/webgpuCacheRenderPipeline.js.map +1 -1
- package/Engines/WebGPU/webgpuConstants.d.ts +5 -2
- package/Engines/WebGPU/webgpuConstants.js +3 -0
- package/Engines/WebGPU/webgpuConstants.js.map +1 -1
- package/Engines/engine.d.ts +45 -41
- package/Engines/webgpuEngine.d.ts +84 -0
- package/Engines/webgpuEngine.js +80 -1
- package/Engines/webgpuEngine.js.map +1 -1
- package/Materials/GaussianSplatting/gaussianSplattingGpuPickingMaterialPlugin.d.ts +7 -0
- package/Materials/GaussianSplatting/gaussianSplattingGpuPickingMaterialPlugin.js +22 -0
- package/Materials/GaussianSplatting/gaussianSplattingGpuPickingMaterialPlugin.js.map +1 -1
- package/Materials/GaussianSplatting/gaussianSplattingMaterial.js +2 -28
- package/Materials/GaussianSplatting/gaussianSplattingMaterial.js.map +1 -1
- package/Meshes/GaussianSplatting/gaussianSplattingCompoundMesh.d.ts +46 -0
- package/Meshes/GaussianSplatting/gaussianSplattingCompoundMesh.js +56 -0
- package/Meshes/GaussianSplatting/gaussianSplattingCompoundMesh.js.map +1 -0
- package/Meshes/GaussianSplatting/gaussianSplattingMesh.d.ts +104 -463
- package/Meshes/GaussianSplatting/gaussianSplattingMesh.js +553 -2018
- package/Meshes/GaussianSplatting/gaussianSplattingMesh.js.map +1 -1
- package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.d.ts +554 -0
- package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.js +2017 -0
- package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.js.map +1 -0
- package/Meshes/index.d.ts +2 -0
- package/Meshes/index.js +2 -0
- package/Meshes/index.js.map +1 -1
- package/Rendering/depthRenderer.js +2 -1
- package/Rendering/depthRenderer.js.map +1 -1
- package/package.json +1 -1
- package/Shaders/ShadersInclude/openpbrBlockAmbientOcclusion.d.ts +0 -5
- package/Shaders/ShadersInclude/openpbrBlockAmbientOcclusion.js +0 -35
- package/Shaders/ShadersInclude/openpbrBlockAmbientOcclusion.js.map +0 -1
- package/ShadersWGSL/ShadersInclude/openpbrBlockAmbientOcclusion.d.ts +0 -5
- package/ShadersWGSL/ShadersInclude/openpbrBlockAmbientOcclusion.js +0 -36
- package/ShadersWGSL/ShadersInclude/openpbrBlockAmbientOcclusion.js.map +0 -1
package/Engines/webgpuEngine.js
CHANGED
|
@@ -412,7 +412,7 @@ export class WebGPUEngine extends ThinWebGPUEngine {
|
|
|
412
412
|
.then(async (adapter) => {
|
|
413
413
|
if (!adapter) {
|
|
414
414
|
// eslint-disable-next-line no-throw-literal
|
|
415
|
-
throw "Could not retrieve a WebGPU adapter (adapter is null).";
|
|
415
|
+
throw "Could not retrieve a WebGPU adapter (adapter is null or undefined).";
|
|
416
416
|
}
|
|
417
417
|
else {
|
|
418
418
|
this._adapter = adapter;
|
|
@@ -2874,6 +2874,85 @@ export class WebGPUEngine extends ThinWebGPUEngine {
|
|
|
2874
2874
|
this._draw(1, fillMode, verticesStart, verticesCount, instancesCount);
|
|
2875
2875
|
}
|
|
2876
2876
|
//------------------------------------------------------------------------------
|
|
2877
|
+
// Async Pipeline Pre-Warming
|
|
2878
|
+
//------------------------------------------------------------------------------
|
|
2879
|
+
/**
|
|
2880
|
+
* Asynchronously pre-creates one or more render pipelines so they are cached and ready
|
|
2881
|
+
* to use without any compilation hitch when first rendered.
|
|
2882
|
+
*
|
|
2883
|
+
* Call this for effects and meshes that are not yet rendering but will be soon
|
|
2884
|
+
* (e.g. streaming content, predicted material changes, pre-loading the next level).
|
|
2885
|
+
*
|
|
2886
|
+
* When passing an array, cache state is set once per entry and restored only at the end,
|
|
2887
|
+
* making batch pre-warming efficient.
|
|
2888
|
+
*
|
|
2889
|
+
* @param options - a single options object, an array of options objects,
|
|
2890
|
+
* or a raw GPURenderPipelineDescriptor for complete control
|
|
2891
|
+
* @returns an array of Promises for the pipelines that had cache misses (empty if all were cached).
|
|
2892
|
+
* When a raw GPURenderPipelineDescriptor is provided, always returns a single-element array.
|
|
2893
|
+
*/
|
|
2894
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
2895
|
+
createRenderPipelineAsync(options) {
|
|
2896
|
+
// Raw GPURenderPipelineDescriptor: bypass the cache and create directly
|
|
2897
|
+
if ("vertex" in options) {
|
|
2898
|
+
return [this._device.createRenderPipelineAsync(options)];
|
|
2899
|
+
}
|
|
2900
|
+
const entries = Array.isArray(options) ? options : [options];
|
|
2901
|
+
const promises = [];
|
|
2902
|
+
const cache = this._cacheRenderPipeline;
|
|
2903
|
+
for (const entry of entries) {
|
|
2904
|
+
// Render target formats
|
|
2905
|
+
cache.setColorFormat(entry.colorFormat ?? this._colorFormat);
|
|
2906
|
+
cache.setDepthStencilFormat(entry.depthStencilFormat ?? this._depthTextureFormat);
|
|
2907
|
+
// Vertex / index buffers from mesh
|
|
2908
|
+
const geometry = entry.mesh.geometry;
|
|
2909
|
+
if (!geometry) {
|
|
2910
|
+
throw new Error("WebGPUEngine.createRenderPipelineAsync: mesh has no geometry to derive vertex/index buffers from.");
|
|
2911
|
+
}
|
|
2912
|
+
cache.setBuffers(geometry.getVertexBuffers(), geometry.getIndexBuffer(), null);
|
|
2913
|
+
// Alpha / blend state
|
|
2914
|
+
const alphaMode = entry.alphaMode ?? 0;
|
|
2915
|
+
if (alphaMode === 0) {
|
|
2916
|
+
cache.setAlphaBlendEnabled([false], 0);
|
|
2917
|
+
}
|
|
2918
|
+
else {
|
|
2919
|
+
const prevAlphaMode = this._alphaMode[0];
|
|
2920
|
+
this.setAlphaMode(alphaMode);
|
|
2921
|
+
cache.setAlphaBlendEnabled(this._alphaState._alphaBlend, this._alphaState._numTargetEnabled);
|
|
2922
|
+
cache.setAlphaBlendFactors(this._alphaState._blendFunctionParameters, this._alphaState._blendEquationParameters);
|
|
2923
|
+
this.setAlphaMode(prevAlphaMode);
|
|
2924
|
+
}
|
|
2925
|
+
// Depth / stencil state
|
|
2926
|
+
cache.setDepthWriteEnabled(entry.depthWrite ?? true);
|
|
2927
|
+
cache.setDepthTestEnabled(entry.depthTest ?? true);
|
|
2928
|
+
cache.setDepthCompare(entry.depthCompare ?? 515);
|
|
2929
|
+
// Rasterization state
|
|
2930
|
+
cache.setCullEnabled(entry.cullEnabled ?? true);
|
|
2931
|
+
cache.setCullFace(entry.cullFace ?? 1);
|
|
2932
|
+
cache.setFrontFace(entry.frontFace ?? 2);
|
|
2933
|
+
// Write mask
|
|
2934
|
+
cache.setWriteMask(entry.writeMask ?? 0xf);
|
|
2935
|
+
// Stencil
|
|
2936
|
+
cache.setStencilEnabled(entry.stencilEnabled ?? false);
|
|
2937
|
+
const fillMode = entry.fillMode ?? 0;
|
|
2938
|
+
const sampleCount = entry.sampleCount ?? this.currentSampleCount;
|
|
2939
|
+
const promise = cache.preWarmPipeline(fillMode, entry.effect, sampleCount, 0);
|
|
2940
|
+
if (promise) {
|
|
2941
|
+
promises.push(promise);
|
|
2942
|
+
}
|
|
2943
|
+
}
|
|
2944
|
+
// Restore the cache state to the engine's current tracked state once after the entire batch
|
|
2945
|
+
cache.setColorFormat(this._colorFormat);
|
|
2946
|
+
cache.setDepthStencilFormat(this._depthTextureFormat);
|
|
2947
|
+
cache.setBuffers(this._currentVertexBuffers ?? null, this._currentIndexBuffer, this._currentOverrideVertexBuffers ?? null);
|
|
2948
|
+
cache.setDepthCullingState(this._depthCullingState.cull ?? false, this._depthCullingState.frontFace ?? 2, this._depthCullingState.cullFace ?? 1, this._depthCullingState.zOffset, this._depthCullingState.zOffsetUnits, this._depthCullingState.depthTest ?? true, this._depthCullingState.depthMask ?? true, this._depthCullingState.depthFunc);
|
|
2949
|
+
cache.setAlphaBlendEnabled(this._alphaState._alphaBlend, this._alphaState._numTargetEnabled);
|
|
2950
|
+
cache.setAlphaBlendFactors(this._alphaState._blendFunctionParameters, this._alphaState._blendEquationParameters);
|
|
2951
|
+
cache.setStencilEnabled(this._stencilStateComposer.enabled ?? false);
|
|
2952
|
+
cache.setWriteMask(this._colorWrite ? 0xf : 0);
|
|
2953
|
+
return promises;
|
|
2954
|
+
}
|
|
2955
|
+
//------------------------------------------------------------------------------
|
|
2877
2956
|
// Dispose
|
|
2878
2957
|
//------------------------------------------------------------------------------
|
|
2879
2958
|
/**
|