@babylonjs/core 6.36.0 → 6.37.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/Cameras/Inputs/arcRotateCameraGamepadInput.js +4 -0
- package/Cameras/Inputs/arcRotateCameraGamepadInput.js.map +1 -1
- package/Engines/Extensions/engine.dynamicTexture.d.ts +2 -2
- package/Engines/Extensions/engine.dynamicTexture.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.dynamicTexture.js +28 -3
- package/Engines/WebGPU/Extensions/engine.dynamicTexture.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.rawTexture.js +4 -0
- package/Engines/WebGPU/Extensions/engine.rawTexture.js.map +1 -1
- package/Engines/WebGPU/webgpuBufferManager.js +6 -2
- package/Engines/WebGPU/webgpuBufferManager.js.map +1 -1
- package/Engines/WebGPU/webgpuCacheBindGroups.d.ts +1 -0
- package/Engines/WebGPU/webgpuCacheBindGroups.js +12 -0
- package/Engines/WebGPU/webgpuCacheBindGroups.js.map +1 -1
- package/Engines/WebGPU/webgpuCacheRenderPipeline.js +2 -1
- package/Engines/WebGPU/webgpuCacheRenderPipeline.js.map +1 -1
- package/Engines/WebGPU/webgpuCacheRenderPipelineTree.d.ts +2 -2
- package/Engines/WebGPU/webgpuCacheRenderPipelineTree.js +5 -2
- package/Engines/WebGPU/webgpuCacheRenderPipelineTree.js.map +1 -1
- package/Engines/WebGPU/webgpuCacheSampler.js +3 -0
- package/Engines/WebGPU/webgpuCacheSampler.js.map +1 -1
- package/Engines/WebGPU/webgpuClearQuad.js +2 -1
- package/Engines/WebGPU/webgpuClearQuad.js.map +1 -1
- package/Engines/WebGPU/webgpuHardwareTexture.d.ts +1 -1
- package/Engines/WebGPU/webgpuHardwareTexture.js +23 -5
- package/Engines/WebGPU/webgpuHardwareTexture.js.map +1 -1
- package/Engines/WebGPU/webgpuPipelineContext.js +4 -5
- package/Engines/WebGPU/webgpuPipelineContext.js.map +1 -1
- package/Engines/WebGPU/webgpuQuerySet.js +10 -4
- package/Engines/WebGPU/webgpuQuerySet.js.map +1 -1
- package/Engines/WebGPU/webgpuTextureHelper.d.ts +8 -53
- package/Engines/WebGPU/webgpuTextureHelper.js +4 -996
- package/Engines/WebGPU/webgpuTextureHelper.js.map +1 -1
- package/Engines/WebGPU/webgpuTextureManager.d.ts +56 -0
- package/Engines/WebGPU/webgpuTextureManager.js +1012 -0
- package/Engines/WebGPU/webgpuTextureManager.js.map +1 -0
- package/Engines/engine.d.ts +1 -0
- package/Engines/engine.js +9 -2
- package/Engines/engine.js.map +1 -1
- package/Engines/renderTargetWrapper.d.ts +1 -0
- package/Engines/renderTargetWrapper.js +5 -1
- package/Engines/renderTargetWrapper.js.map +1 -1
- package/Engines/thinEngine.d.ts +1 -0
- package/Engines/thinEngine.js +11 -7
- package/Engines/thinEngine.js.map +1 -1
- package/Engines/webgpuEngine.d.ts +9 -2
- package/Engines/webgpuEngine.js +75 -3
- package/Engines/webgpuEngine.js.map +1 -1
- package/FlowGraph/Blocks/Data/flowGraphGetPropertyBlock.d.ts +23 -6
- package/FlowGraph/Blocks/Data/flowGraphGetPropertyBlock.js +14 -3
- package/FlowGraph/Blocks/Data/flowGraphGetPropertyBlock.js.map +1 -1
- package/FlowGraph/Blocks/Event/flowGraphMeshPickEventBlock.d.ts +14 -3
- package/FlowGraph/Blocks/Event/flowGraphMeshPickEventBlock.js +12 -11
- package/FlowGraph/Blocks/Event/flowGraphMeshPickEventBlock.js.map +1 -1
- package/FlowGraph/Blocks/Execution/Animation/flowGraphPauseAnimationBlock.d.ts +1 -1
- package/FlowGraph/Blocks/Execution/Animation/flowGraphPauseAnimationBlock.js +1 -1
- package/FlowGraph/Blocks/Execution/Animation/flowGraphPauseAnimationBlock.js.map +1 -1
- package/FlowGraph/Blocks/Execution/Animation/flowGraphPlayAnimationBlock.d.ts +22 -7
- package/FlowGraph/Blocks/Execution/Animation/flowGraphPlayAnimationBlock.js +15 -9
- package/FlowGraph/Blocks/Execution/Animation/flowGraphPlayAnimationBlock.js.map +1 -1
- package/FlowGraph/Blocks/Execution/Animation/flowGraphStopAnimationBlock.d.ts +1 -1
- package/FlowGraph/Blocks/Execution/Animation/flowGraphStopAnimationBlock.js +1 -1
- package/FlowGraph/Blocks/Execution/Animation/flowGraphStopAnimationBlock.js.map +1 -1
- package/FlowGraph/Blocks/Execution/Audio/flowGraphPlayAudioBlock.d.ts +1 -1
- package/FlowGraph/Blocks/Execution/Audio/flowGraphPlayAudioBlock.js +1 -1
- package/FlowGraph/Blocks/Execution/Audio/flowGraphPlayAudioBlock.js.map +1 -1
- package/FlowGraph/Blocks/Execution/Audio/flowGraphStopAudioBlock.d.ts +1 -1
- package/FlowGraph/Blocks/Execution/Audio/flowGraphStopAudioBlock.js +1 -1
- package/FlowGraph/Blocks/Execution/Audio/flowGraphStopAudioBlock.js.map +1 -1
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphCounterBlock.d.ts +1 -1
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphCounterBlock.js +1 -1
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphCounterBlock.js.map +1 -1
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphDebounceBlock.d.ts +1 -1
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphDebounceBlock.js +1 -1
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphDebounceBlock.js.map +1 -1
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphDoNBlock.d.ts +1 -1
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphDoNBlock.js +1 -1
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphDoNBlock.js.map +1 -1
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphForLoopBlock.d.ts +1 -1
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphForLoopBlock.js +1 -1
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphForLoopBlock.js.map +1 -1
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphThrottleBlock.d.ts +1 -1
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphThrottleBlock.js +1 -1
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphThrottleBlock.js.map +1 -1
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphWaitAllBlock.d.ts +1 -1
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphWaitAllBlock.js +1 -1
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphWaitAllBlock.js.map +1 -1
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphWhileLoopBlock.d.ts +1 -1
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphWhileLoopBlock.js +1 -1
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphWhileLoopBlock.js.map +1 -1
- package/FlowGraph/Blocks/Execution/flowGraphConsoleLogBlock.d.ts +1 -1
- package/FlowGraph/Blocks/Execution/flowGraphConsoleLogBlock.js +1 -1
- package/FlowGraph/Blocks/Execution/flowGraphConsoleLogBlock.js.map +1 -1
- package/FlowGraph/Blocks/Execution/flowGraphSendCustomEventBlock.d.ts +1 -1
- package/FlowGraph/Blocks/Execution/flowGraphSendCustomEventBlock.js +1 -1
- package/FlowGraph/Blocks/Execution/flowGraphSendCustomEventBlock.js.map +1 -1
- package/FlowGraph/Blocks/Execution/flowGraphSetPropertyBlock.d.ts +13 -5
- package/FlowGraph/Blocks/Execution/flowGraphSetPropertyBlock.js +9 -5
- package/FlowGraph/Blocks/Execution/flowGraphSetPropertyBlock.js.map +1 -1
- package/FlowGraph/Blocks/Execution/flowGraphSetVariableBlock.d.ts +1 -1
- package/FlowGraph/Blocks/Execution/flowGraphSetVariableBlock.js +1 -1
- package/FlowGraph/Blocks/Execution/flowGraphSetVariableBlock.js.map +1 -1
- package/FlowGraph/flowGraph.d.ts +24 -6
- package/FlowGraph/flowGraph.js +12 -12
- package/FlowGraph/flowGraph.js.map +1 -1
- package/FlowGraph/flowGraphBlock.d.ts +31 -2
- package/FlowGraph/flowGraphBlock.js +8 -3
- package/FlowGraph/flowGraphBlock.js.map +1 -1
- package/FlowGraph/flowGraphContext.d.ts +5 -1
- package/FlowGraph/flowGraphContext.js +4 -2
- package/FlowGraph/flowGraphContext.js.map +1 -1
- package/FlowGraph/flowGraphCoordinator.d.ts +22 -2
- package/FlowGraph/flowGraphCoordinator.js +7 -11
- package/FlowGraph/flowGraphCoordinator.js.map +1 -1
- package/FlowGraph/{flowGraphWithOnDoneExecutionBlock.js → flowGraphExecutionBlockWithOutSignal.js} +1 -1
- package/FlowGraph/flowGraphExecutionBlockWithOutSignal.js.map +1 -0
- package/FlowGraph/flowGraphPathConverter.d.ts +13 -0
- package/FlowGraph/flowGraphPathConverter.js +31 -0
- package/FlowGraph/flowGraphPathConverter.js.map +1 -0
- package/FlowGraph/flowGraphPathConverterComponent.d.ts +19 -0
- package/FlowGraph/flowGraphPathConverterComponent.js +31 -0
- package/FlowGraph/flowGraphPathConverterComponent.js.map +1 -0
- package/FlowGraph/index.d.ts +0 -1
- package/FlowGraph/index.js +0 -1
- package/FlowGraph/index.js.map +1 -1
- package/FlowGraph/serialization.d.ts +8 -0
- package/FlowGraph/serialization.js +12 -4
- package/FlowGraph/serialization.js.map +1 -1
- package/FlowGraph/typeDefinitions.d.ts +86 -1
- package/FlowGraph/typeDefinitions.js.map +1 -1
- package/Materials/Textures/dynamicTexture.js +2 -1
- package/Materials/Textures/dynamicTexture.js.map +1 -1
- package/Materials/Textures/hardwareTextureWrapper.d.ts +1 -1
- package/Materials/Textures/hardwareTextureWrapper.js.map +1 -1
- package/Materials/Textures/internalTexture.d.ts +6 -2
- package/Materials/Textures/internalTexture.js +6 -4
- package/Materials/Textures/internalTexture.js.map +1 -1
- package/Materials/Textures/renderTargetTexture.js +10 -10
- package/Materials/Textures/renderTargetTexture.js.map +1 -1
- package/Materials/material.d.ts +1 -1
- package/Materials/material.js +3 -1
- package/Materials/material.js.map +1 -1
- package/Materials/shaderMaterial.js +2 -2
- package/Materials/shaderMaterial.js.map +1 -1
- package/Materials/uniformBuffer.d.ts +2 -0
- package/Materials/uniformBuffer.js +16 -0
- package/Materials/uniformBuffer.js.map +1 -1
- package/Meshes/GreasedLine/greasedLineMesh.d.ts +2 -1
- package/Meshes/GreasedLine/greasedLineMesh.js.map +1 -1
- package/Meshes/GreasedLine/greasedLineRibbonMesh.d.ts +2 -1
- package/Meshes/GreasedLine/greasedLineRibbonMesh.js.map +1 -1
- package/Meshes/WebGPU/webgpuDataBuffer.d.ts +1 -0
- package/Meshes/WebGPU/webgpuDataBuffer.js +2 -0
- package/Meshes/WebGPU/webgpuDataBuffer.js.map +1 -1
- package/Meshes/geometry.js +3 -3
- package/Meshes/geometry.js.map +1 -1
- package/Misc/brdfTextureTools.js +9 -7
- package/Misc/brdfTextureTools.js.map +1 -1
- package/Misc/rgbdTextureTools.js +37 -37
- package/Misc/rgbdTextureTools.js.map +1 -1
- package/ObjectModel/index.d.ts +1 -0
- package/ObjectModel/index.js +2 -0
- package/ObjectModel/index.js.map +1 -0
- package/ObjectModel/objectModelInterfaces.d.ts +21 -0
- package/ObjectModel/objectModelInterfaces.js +2 -0
- package/ObjectModel/objectModelInterfaces.js.map +1 -0
- package/Particles/computeShaderParticleSystem.js +2 -2
- package/Particles/computeShaderParticleSystem.js.map +1 -1
- package/Particles/gpuParticleSystem.js +1 -1
- package/Particles/gpuParticleSystem.js.map +1 -1
- package/Particles/particleSystem.js +2 -5
- package/Particles/particleSystem.js.map +1 -1
- package/Rendering/fluidRenderer/fluidRenderer.js +1 -6
- package/Rendering/fluidRenderer/fluidRenderer.js.map +1 -1
- package/Rendering/renderingManager.js +1 -1
- package/Rendering/renderingManager.js.map +1 -1
- package/XR/features/WebXRControllerTeleportation.d.ts +9 -1
- package/XR/features/WebXRControllerTeleportation.js +10 -0
- package/XR/features/WebXRControllerTeleportation.js.map +1 -1
- package/XR/webXRCamera.js.map +1 -1
- package/index.d.ts +1 -0
- package/index.js +1 -0
- package/index.js.map +1 -1
- package/package.json +1 -1
- package/types.d.ts +5 -1
- package/types.js +0 -2
- package/types.js.map +1 -1
- package/FlowGraph/flowGraphPath.d.ts +0 -45
- package/FlowGraph/flowGraphPath.js +0 -156
- package/FlowGraph/flowGraphPath.js.map +0 -1
- package/FlowGraph/flowGraphPathComponent.d.ts +0 -42
- package/FlowGraph/flowGraphPathComponent.js +0 -51
- package/FlowGraph/flowGraphPathComponent.js.map +0 -1
- package/FlowGraph/flowGraphWithOnDoneExecutionBlock.js.map +0 -1
- /package/FlowGraph/{flowGraphWithOnDoneExecutionBlock.d.ts → flowGraphExecutionBlockWithOutSignal.d.ts} +0 -0
|
@@ -10,7 +10,7 @@ import type { DataBuffer } from "../Buffers/dataBuffer";
|
|
|
10
10
|
import type { BaseTexture } from "../Materials/Textures/baseTexture";
|
|
11
11
|
import type { IShaderProcessor } from "./Processors/iShaderProcessor";
|
|
12
12
|
import type { ShaderProcessingContext } from "./Processors/shaderProcessingOptions";
|
|
13
|
-
import {
|
|
13
|
+
import { WebGPUTextureManager } from "./WebGPU/webgpuTextureManager";
|
|
14
14
|
import type { ISceneLike, ThinEngineOptions } from "./thinEngine";
|
|
15
15
|
import { WebGPUBufferManager } from "./WebGPU/webgpuBufferManager";
|
|
16
16
|
import type { HardwareTextureWrapper } from "../Materials/Textures/hardwareTextureWrapper";
|
|
@@ -112,8 +112,11 @@ export interface WebGPUEngineOptions extends ThinEngineOptions, GPURequestAdapte
|
|
|
112
112
|
*/
|
|
113
113
|
export declare class WebGPUEngine extends Engine {
|
|
114
114
|
private static readonly _GLSLslangDefaultOptions;
|
|
115
|
+
private static _InstanceId;
|
|
115
116
|
/** true to enable using TintWASM to convert Spir-V to WGSL */
|
|
116
117
|
static UseTWGSL: boolean;
|
|
118
|
+
/** A unique id to identify this instance */
|
|
119
|
+
readonly uniqueId = -1;
|
|
117
120
|
private readonly _uploadEncoderDescriptor;
|
|
118
121
|
private readonly _renderEncoderDescriptor;
|
|
119
122
|
/** @internal */
|
|
@@ -137,8 +140,10 @@ export declare class WebGPUEngine extends Engine {
|
|
|
137
140
|
private _deviceLimits;
|
|
138
141
|
private _context;
|
|
139
142
|
private _mainPassSampleCount;
|
|
143
|
+
private _glslangOptions?;
|
|
144
|
+
private _twgslOptions?;
|
|
140
145
|
/** @internal */
|
|
141
|
-
_textureHelper:
|
|
146
|
+
_textureHelper: WebGPUTextureManager;
|
|
142
147
|
/** @internal */
|
|
143
148
|
_bufferManager: WebGPUBufferManager;
|
|
144
149
|
private _clearQuad;
|
|
@@ -349,6 +354,8 @@ export declare class WebGPUEngine extends Engine {
|
|
|
349
354
|
private _initializeContextAndSwapChain;
|
|
350
355
|
private _initializeMainAttachments;
|
|
351
356
|
private _configureContext;
|
|
357
|
+
protected _rebuildBuffers(): void;
|
|
358
|
+
protected _restoreEngineAfterContextLost(initEngine: () => void): void;
|
|
352
359
|
/**
|
|
353
360
|
* Force a specific size of the canvas
|
|
354
361
|
* @param width defines the new canvas' width
|
package/Engines/webgpuEngine.js
CHANGED
|
@@ -14,6 +14,7 @@ import { WebGPUShaderProcessorWGSL } from "./WebGPU/webgpuShaderProcessorsWGSL.j
|
|
|
14
14
|
import { WebGPUShaderProcessingContext } from "./WebGPU/webgpuShaderProcessingContext.js";
|
|
15
15
|
import { Tools } from "../Misc/tools.js";
|
|
16
16
|
import { WebGPUTextureHelper } from "./WebGPU/webgpuTextureHelper.js";
|
|
17
|
+
import { WebGPUTextureManager } from "./WebGPU/webgpuTextureManager.js";
|
|
17
18
|
import { WebGPUBufferManager } from "./WebGPU/webgpuBufferManager.js";
|
|
18
19
|
import { WebGPUHardwareTexture } from "./WebGPU/webgpuHardwareTexture.js";
|
|
19
20
|
import { UniformBuffer } from "../Materials/uniformBuffer.js";
|
|
@@ -229,6 +230,8 @@ export class WebGPUEngine extends Engine {
|
|
|
229
230
|
constructor(canvas, options = {}) {
|
|
230
231
|
var _a, _b;
|
|
231
232
|
super(null, (_a = options.antialias) !== null && _a !== void 0 ? _a : true, options);
|
|
233
|
+
/** A unique id to identify this instance */
|
|
234
|
+
this.uniqueId = -1;
|
|
232
235
|
// Page Life cycle and constants
|
|
233
236
|
this._uploadEncoderDescriptor = { label: "upload" };
|
|
234
237
|
this._renderEncoderDescriptor = { label: "render" };
|
|
@@ -355,6 +358,9 @@ export class WebGPUEngine extends Engine {
|
|
|
355
358
|
*/
|
|
356
359
|
initAsync(glslangOptions, twgslOptions) {
|
|
357
360
|
var _a;
|
|
361
|
+
this.uniqueId = WebGPUEngine._InstanceId++;
|
|
362
|
+
this._glslangOptions = glslangOptions;
|
|
363
|
+
this._twgslOptions = twgslOptions;
|
|
358
364
|
return this._initGlslang(glslangOptions !== null && glslangOptions !== void 0 ? glslangOptions : (_a = this._options) === null || _a === void 0 ? void 0 : _a.glslangOptions)
|
|
359
365
|
.then((glslang) => {
|
|
360
366
|
var _a;
|
|
@@ -405,6 +411,7 @@ export class WebGPUEngine extends Engine {
|
|
|
405
411
|
deviceDescriptor.requiredLimits[name] = this._adapterSupportedLimits[name];
|
|
406
412
|
}
|
|
407
413
|
}
|
|
414
|
+
deviceDescriptor.label = `BabylonWebGPUDevice${this.uniqueId}`;
|
|
408
415
|
return this._adapter.requestDevice(deviceDescriptor);
|
|
409
416
|
}
|
|
410
417
|
})
|
|
@@ -431,7 +438,23 @@ export class WebGPUEngine extends Engine {
|
|
|
431
438
|
this._contextWasLost = true;
|
|
432
439
|
Logger.Warn("WebGPU context lost. " + info);
|
|
433
440
|
this.onContextLostObservable.notifyObservers(this);
|
|
434
|
-
this._restoreEngineAfterContextLost(() =>
|
|
441
|
+
this._restoreEngineAfterContextLost(async () => {
|
|
442
|
+
var _a, _b, _c, _d;
|
|
443
|
+
const snapshotRenderingMode = this.snapshotRenderingMode;
|
|
444
|
+
const snapshotRendering = this.snapshotRendering;
|
|
445
|
+
const disableCacheSamplers = this.disableCacheSamplers;
|
|
446
|
+
const disableCacheRenderPipelines = this.disableCacheRenderPipelines;
|
|
447
|
+
const disableCacheBindGroups = this.disableCacheBindGroups;
|
|
448
|
+
const enableGPUTimingMeasurements = this.enableGPUTimingMeasurements;
|
|
449
|
+
await this.initAsync((_a = this._glslangOptions) !== null && _a !== void 0 ? _a : (_b = this._options) === null || _b === void 0 ? void 0 : _b.glslangOptions, (_c = this._twgslOptions) !== null && _c !== void 0 ? _c : (_d = this._options) === null || _d === void 0 ? void 0 : _d.twgslOptions);
|
|
450
|
+
this.snapshotRenderingMode = snapshotRenderingMode;
|
|
451
|
+
this.snapshotRendering = snapshotRendering;
|
|
452
|
+
this.disableCacheSamplers = disableCacheSamplers;
|
|
453
|
+
this.disableCacheRenderPipelines = disableCacheRenderPipelines;
|
|
454
|
+
this.disableCacheBindGroups = disableCacheBindGroups;
|
|
455
|
+
this.enableGPUTimingMeasurements = enableGPUTimingMeasurements;
|
|
456
|
+
this._currentRenderPass = null;
|
|
457
|
+
});
|
|
435
458
|
});
|
|
436
459
|
}
|
|
437
460
|
}, (e) => {
|
|
@@ -440,7 +463,7 @@ export class WebGPUEngine extends Engine {
|
|
|
440
463
|
})
|
|
441
464
|
.then(() => {
|
|
442
465
|
this._bufferManager = new WebGPUBufferManager(this, this._device);
|
|
443
|
-
this._textureHelper = new
|
|
466
|
+
this._textureHelper = new WebGPUTextureManager(this, this._device, this._glslang, this._tintWASM, this._bufferManager, this._deviceEnabledExtensions);
|
|
444
467
|
this._cacheSampler = new WebGPUCacheSampler(this._device);
|
|
445
468
|
this._cacheBindGroups = new WebGPUCacheBindGroups(this._device, this._cacheSampler, this);
|
|
446
469
|
this._timestampQuery = new WebGPUTimestampQuery(this, this._device, this._bufferManager);
|
|
@@ -458,7 +481,12 @@ export class WebGPUEngine extends Engine {
|
|
|
458
481
|
this._uploadEncoder = this._device.createCommandEncoder(this._uploadEncoderDescriptor);
|
|
459
482
|
this._renderEncoder = this._device.createCommandEncoder(this._renderEncoderDescriptor);
|
|
460
483
|
this._initializeLimits();
|
|
461
|
-
this._emptyVertexBuffer = new VertexBuffer(this, [0], "",
|
|
484
|
+
this._emptyVertexBuffer = new VertexBuffer(this, [0], "", {
|
|
485
|
+
stride: 1,
|
|
486
|
+
offset: 0,
|
|
487
|
+
size: 1,
|
|
488
|
+
label: "EmptyVertexBuffer",
|
|
489
|
+
});
|
|
462
490
|
this._cacheRenderPipeline = new WebGPUCacheRenderPipelineTree(this._device, this._emptyVertexBuffer);
|
|
463
491
|
this._depthCullingState = new WebGPUDepthCullingState(this._cacheRenderPipeline);
|
|
464
492
|
this._stencilStateComposer = new WebGPUStencilStateComposer(this._cacheRenderPipeline);
|
|
@@ -696,6 +724,48 @@ export class WebGPUEngine extends Engine {
|
|
|
696
724
|
alphaMode: this.premultipliedAlpha ? WebGPUConstants.CanvasAlphaMode.Premultiplied : WebGPUConstants.CanvasAlphaMode.Opaque,
|
|
697
725
|
});
|
|
698
726
|
}
|
|
727
|
+
_rebuildBuffers() {
|
|
728
|
+
super._rebuildBuffers();
|
|
729
|
+
for (const storageBuffer of this._storageBuffers) {
|
|
730
|
+
// The buffer can already be rebuilt by the call to _rebuildGeometries(), which recreates the storage buffers for the ComputeShaderParticleSystem
|
|
731
|
+
if (storageBuffer.getBuffer().engineId !== this.uniqueId) {
|
|
732
|
+
storageBuffer._rebuild();
|
|
733
|
+
}
|
|
734
|
+
}
|
|
735
|
+
}
|
|
736
|
+
_restoreEngineAfterContextLost(initEngine) {
|
|
737
|
+
WebGPUCacheRenderPipelineTree.ResetCache();
|
|
738
|
+
WebGPUCacheBindGroups.ResetCache();
|
|
739
|
+
// Clear the draw wrappers and material contexts
|
|
740
|
+
const cleanScenes = (scenes) => {
|
|
741
|
+
var _a;
|
|
742
|
+
for (const scene of scenes) {
|
|
743
|
+
for (const mesh of scene.meshes) {
|
|
744
|
+
const subMeshes = mesh.subMeshes;
|
|
745
|
+
if (!subMeshes) {
|
|
746
|
+
continue;
|
|
747
|
+
}
|
|
748
|
+
for (const subMesh of subMeshes) {
|
|
749
|
+
subMesh._drawWrappers = [];
|
|
750
|
+
}
|
|
751
|
+
}
|
|
752
|
+
for (const material of scene.materials) {
|
|
753
|
+
(_a = material._materialContext) === null || _a === void 0 ? void 0 : _a.reset();
|
|
754
|
+
}
|
|
755
|
+
}
|
|
756
|
+
};
|
|
757
|
+
cleanScenes(this.scenes);
|
|
758
|
+
cleanScenes(this._virtualScenes);
|
|
759
|
+
// The leftOver uniform buffers are removed from the list because they will be recreated when we rebuild the effects
|
|
760
|
+
const uboList = [];
|
|
761
|
+
for (const uniformBuffer of this._uniformBuffers) {
|
|
762
|
+
if (uniformBuffer.name.indexOf("leftOver") < 0) {
|
|
763
|
+
uboList.push(uniformBuffer);
|
|
764
|
+
}
|
|
765
|
+
}
|
|
766
|
+
this._uniformBuffers = uboList;
|
|
767
|
+
super._restoreEngineAfterContextLost(initEngine);
|
|
768
|
+
}
|
|
699
769
|
/**
|
|
700
770
|
* Force a specific size of the canvas
|
|
701
771
|
* @param width defines the new canvas' width
|
|
@@ -1670,6 +1740,7 @@ export class WebGPUEngine extends Engine {
|
|
|
1670
1740
|
texture.height = imageBitmap.height;
|
|
1671
1741
|
texture.format = texture.format !== -1 ? texture.format : format !== null && format !== void 0 ? format : 5;
|
|
1672
1742
|
texture.type = texture.type !== -1 ? texture.type : 0;
|
|
1743
|
+
texture._creationFlags = creationFlags !== null && creationFlags !== void 0 ? creationFlags : 0;
|
|
1673
1744
|
processFunction(texture.width, texture.height, imageBitmap, extension, texture, () => { });
|
|
1674
1745
|
if (!((_a = texture._hardwareTexture) === null || _a === void 0 ? void 0 : _a.underlyingResource)) {
|
|
1675
1746
|
// the texture could have been created before reaching this point so don't recreate it if already existing
|
|
@@ -2906,6 +2977,7 @@ WebGPUEngine._GLSLslangDefaultOptions = {
|
|
|
2906
2977
|
jsPath: `${Tools._DefaultCdnUrl}/glslang/glslang.js`,
|
|
2907
2978
|
wasmPath: `${Tools._DefaultCdnUrl}/glslang/glslang.wasm`,
|
|
2908
2979
|
};
|
|
2980
|
+
WebGPUEngine._InstanceId = 0;
|
|
2909
2981
|
/** true to enable using TintWASM to convert Spir-V to WGSL */
|
|
2910
2982
|
WebGPUEngine.UseTWGSL = true;
|
|
2911
2983
|
//# sourceMappingURL=webgpuEngine.js.map
|