@null3d/engine 0.0.0 → 0.1.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/README.md +109 -0
- package/THIRD-PARTY-NOTICES.txt +0 -1
- package/dist/wasm/single/null3d.js +19 -6
- package/dist/wasm/single/null3d_bg.wasm +0 -0
- package/dist/wasm/threaded/null3d.js +19 -6
- package/dist/wasm/threaded/null3d_bg.wasm +0 -0
- package/docs/api/animation.md +23 -67
- package/docs/api/assets.md +42 -26
- package/docs/api/cameras.md +8 -6
- package/docs/api/controls.md +46 -44
- package/docs/api/debug.md +13 -8
- package/docs/api/engine.md +17 -11
- package/docs/api/feature-draws.md +3 -3
- package/docs/api/feature-effects.md +3 -3
- package/docs/api/feature-instances.md +2 -2
- package/docs/api/features.md +14 -15
- package/docs/api/geometry.md +56 -75
- package/docs/api/grass.md +1 -1
- package/docs/api/impostors.md +120 -9
- package/docs/api/input.md +4 -11
- package/docs/api/lights.md +14 -38
- package/docs/api/lines.md +8 -25
- package/docs/api/materials.md +69 -70
- package/docs/api/math.md +6 -7
- package/docs/api/objects.md +13 -13
- package/docs/api/particles.md +2 -14
- package/docs/api/points.md +3 -25
- package/docs/api/post.md +22 -23
- package/docs/api/quality.md +11 -6
- package/docs/api/raycast.md +13 -32
- package/docs/api/reference/animation.md +9 -9
- package/docs/api/reference/assets.md +18 -18
- package/docs/api/reference/cameras.md +5 -2
- package/docs/api/reference/controls.md +75 -23
- package/docs/api/reference/debug.md +23 -8
- package/docs/api/reference/engine.md +22 -10
- package/docs/api/reference/geometry.md +161 -82
- package/docs/api/reference/grass.md +1 -1
- package/docs/api/reference/impostors.md +92 -1
- package/docs/api/reference/input.md +3 -3
- package/docs/api/reference/lights.md +9 -9
- package/docs/api/reference/lines.md +7 -7
- package/docs/api/reference/materials.md +48 -48
- package/docs/api/reference/math.md +22 -22
- package/docs/api/reference/objects.md +9 -9
- package/docs/api/reference/points.md +4 -4
- package/docs/api/reference/post.md +18 -18
- package/docs/api/reference/quality.md +7 -3
- package/docs/api/reference/raycast.md +6 -6
- package/docs/api/reference/render.md +2 -2
- package/docs/api/reference/scene.md +29 -26
- package/docs/api/reference/sketch.md +4 -0
- package/docs/api/reference/sound.md +203 -0
- package/docs/api/reference/sprites.md +5 -5
- package/docs/api/reference/terrain.md +2 -1
- package/docs/api/reference/textures.md +4 -4
- package/docs/api/reference/ui.md +3 -3
- package/docs/api/reference/vertex-draws.md +3 -3
- package/docs/api/reference/water.md +77 -6
- package/docs/api/reference/wind.md +2 -2
- package/docs/api/render.md +12 -10
- package/docs/api/scene.md +40 -29
- package/docs/api/sketch.md +64 -3
- package/docs/api/sound.md +169 -0
- package/docs/api/splats.md +7 -0
- package/docs/api/sprites.md +4 -20
- package/docs/api/tasks.md +2 -2
- package/docs/api/terrain.md +2 -14
- package/docs/api/textures.md +9 -9
- package/docs/api/ui.md +3 -15
- package/docs/api/water.md +198 -15
- package/docs/api/wind.md +5 -5
- package/docs/cli/null3d.md +93 -18
- package/docs/concepts/architecture.md +10 -10
- package/docs/concepts/assets.md +2 -19
- package/docs/concepts/backends.md +7 -5
- package/docs/concepts/color-management.md +15 -26
- package/docs/concepts/culling.md +1 -1
- package/docs/concepts/instances.md +5 -5
- package/docs/concepts/large-worlds.md +1 -1
- package/docs/concepts/lighting.md +50 -55
- package/docs/concepts/lod.md +2 -15
- package/docs/concepts/materials.md +16 -16
- package/docs/concepts/post-processing.md +7 -29
- package/docs/concepts/quality-preset-tables.md +53 -50
- package/docs/concepts/quality-presets.md +56 -27
- package/docs/concepts/render-graph.md +19 -14
- package/docs/concepts/render-layers.md +3 -17
- package/docs/concepts/shadows.md +10 -28
- package/docs/concepts/static-dynamic.md +2 -2
- package/docs/cookbook/index.md +1 -1
- package/docs/data/threejs-mapping.json +136 -102
- package/docs/errors/E1214.md +3 -3
- package/docs/errors/E1307.md +23 -0
- package/docs/errors/E1420.md +3 -3
- package/docs/errors/index.md +3 -2
- package/docs/getting-started/cdn.md +17 -1
- package/docs/getting-started/first-scene.md +1 -1
- package/docs/getting-started/hosting.md +50 -9
- package/docs/getting-started/install.md +8 -7
- package/docs/getting-started/network-use.md +10 -2
- package/docs/getting-started/project-structure.md +15 -6
- package/docs/getting-started/third-party-notices.md +8 -6
- package/docs/guides/accessibility.md +1 -1
- package/docs/guides/add-ons.md +3 -2
- package/docs/guides/agents.md +16 -5
- package/docs/guides/assets-pipeline.md +13 -12
- package/docs/guides/audio.md +109 -124
- package/docs/guides/car-paint.md +1 -1
- package/docs/guides/content-pages.md +10 -6
- package/docs/guides/custom-passes.md +9 -8
- package/docs/guides/custom-shaders.md +6 -3
- package/docs/guides/debugging.md +78 -4
- package/docs/guides/deploying.md +105 -5
- package/docs/guides/deterministic-simulation.md +1 -1
- package/docs/guides/first-use-shaders.md +4 -4
- package/docs/guides/loading-screens.md +78 -33
- package/docs/guides/multiple-views.md +41 -2
- package/docs/guides/performance.md +6 -3
- package/docs/guides/phones.md +12 -1
- package/docs/guides/physics.md +1 -1
- package/docs/guides/screens.md +7 -5
- package/docs/guides/start-time.md +328 -0
- package/docs/guides/testing.md +23 -5
- package/docs/guides/ui-overlays.md +3 -3
- package/docs/index.md +12 -8
- package/docs/pages.md +26 -23
- package/docs/porting/react-three-fiber.md +228 -5
- package/docs/porting/threejs-loop-and-threads.md +220 -6
- package/docs/porting/threejs-mapping.md +86 -84
- package/docs/porting/threejs-materials.md +212 -5
- package/docs/porting/threejs-overview.md +218 -5
- package/docs/porting/threejs-postprocessing.md +2 -2
- package/docs/porting/threejs-shaders.md +298 -5
- package/docs/porting/threejs-unsupported.md +82 -6
- package/docs/porting/verification.md +181 -5
- package/docs/shaders/builtins.md +1 -1
- package/docs/shaders/library.md +63 -39
- package/docs/shaders/surface-functions.md +11 -10
- package/docs/shaders/wgsl-rules.md +1 -1
- package/lib/debug/channel.d.ts +103 -0
- package/lib/debug/channel.js +269 -0
- package/lib/debug/debug.d.ts +9 -7
- package/lib/debug/draw.d.ts +9 -0
- package/lib/debug/draw.js +49 -2
- package/lib/debug/inspector.d.ts +60 -0
- package/lib/debug/inspector.js +475 -0
- package/lib/debug/stats-panel.d.ts +1 -1
- package/lib/debug/stats.d.ts +2 -3
- package/lib/errors/codes.js +8 -2
- package/lib/errors/engine-error.js +25 -10
- package/lib/errors/fixes.d.ts +1 -0
- package/lib/errors/fixes.js +3 -2
- package/lib/generated/core.d.ts +1 -1
- package/lib/generated/core.js +1 -1
- package/lib/gpu/early-builds.d.ts +68 -0
- package/lib/gpu/early-builds.js +158 -0
- package/lib/gpu/pipeline-name.d.ts +6 -0
- package/lib/gpu/pipeline-name.js +23 -0
- package/lib/gpu/webgl2/backend.d.ts +63 -2
- package/lib/gpu/webgl2/backend.js +226 -8
- package/lib/gpu/webgl2/programs.d.ts +18 -0
- package/lib/gpu/webgl2/programs.js +4 -1
- package/lib/gpu/webgpu/backend.d.ts +89 -2
- package/lib/gpu/webgpu/backend.js +255 -8
- package/lib/gpu/webgpu/pipelines.d.ts +13 -0
- package/lib/gpu/webgpu/pipelines.js +15 -1
- package/lib/index.d.ts +6 -4
- package/lib/index.js +3 -2
- package/lib/math/color.d.ts +5 -5
- package/lib/math/color.js +5 -5
- package/lib/math/mat4.d.ts +6 -12
- package/lib/math/mat4.js +6 -12
- package/lib/math/namespaces/quat.d.ts +3 -3
- package/lib/math/namespaces/quat.js +3 -3
- package/lib/math/quat.d.ts +8 -12
- package/lib/math/quat.js +8 -12
- package/lib/math/random.d.ts +2 -3
- package/lib/math/random.js +2 -3
- package/lib/math/types.d.ts +4 -4
- package/lib/math/vec3.d.ts +3 -6
- package/lib/math/vec3.js +3 -6
- package/lib/page/capabilities.d.ts +7 -7
- package/lib/page/capabilities.js +39 -25
- package/lib/page/check-store.d.ts +14 -2
- package/lib/page/check-store.js +34 -11
- package/lib/page/engine.d.ts +103 -26
- package/lib/page/engine.js +420 -97
- package/lib/page/first-frame.d.ts +16 -0
- package/lib/page/first-frame.js +35 -0
- package/lib/page/frame-stats.d.ts +34 -1
- package/lib/page/frame-stats.js +15 -0
- package/lib/page/label-loop.d.ts +7 -3
- package/lib/page/label-loop.js +17 -10
- package/lib/page/labels.d.ts +3 -3
- package/lib/page/pipeline-store.d.ts +25 -0
- package/lib/page/pipeline-store.js +84 -0
- package/lib/page/start-marker.d.ts +4 -1
- package/lib/page/start-marker.js +5 -2
- package/lib/page/switches.d.ts +32 -2
- package/lib/page/switches.js +9 -1
- package/lib/quality/check.d.ts +24 -3
- package/lib/quality/check.js +21 -7
- package/lib/quality/chooser.d.ts +6 -0
- package/lib/quality/chooser.js +8 -0
- package/lib/quality/governor.d.ts +98 -6
- package/lib/quality/governor.js +250 -20
- package/lib/quality/preset-docs.d.ts +16 -1
- package/lib/quality/preset-docs.js +3 -0
- package/lib/quality/presets.d.ts +84 -7
- package/lib/quality/presets.js +94 -2
- package/lib/render/draw.d.ts +3 -2
- package/lib/render/draw.js +15 -5
- package/lib/render/load-draw.d.ts +7 -5
- package/lib/render/load-draw.js +7 -5
- package/lib/render/loss.d.ts +28 -10
- package/lib/render/loss.js +50 -22
- package/lib/render/recovery.d.ts +20 -0
- package/lib/render/recovery.js +44 -4
- package/lib/render/renderer.d.ts +85 -9
- package/lib/render/renderer.js +181 -42
- package/lib/render/scene-renderer.d.ts +19 -1
- package/lib/render/scene-renderer.js +25 -1
- package/lib/render/webgl2-renderers.js +8 -5
- package/lib/render/webgpu-renderers.js +5 -4
- package/lib/scene/animation.d.ts +28 -32
- package/lib/scene/animation.js +12 -15
- package/lib/scene/assets.d.ts +61 -86
- package/lib/scene/assets.js +103 -236
- package/lib/scene/background.d.ts +14 -18
- package/lib/scene/background.js +5 -2
- package/lib/scene/color.d.ts +3 -3
- package/lib/scene/downloads.d.ts +2 -0
- package/lib/scene/downloads.js +371 -0
- package/lib/scene/environment.d.ts +7 -7
- package/lib/scene/environment.js +1 -1
- package/lib/scene/fake-call-values.js +1 -1
- package/lib/scene/fog.d.ts +11 -4
- package/lib/scene/fog.js +8 -2
- package/lib/scene/frame-cameras.d.ts +19 -0
- package/lib/scene/frame-cameras.js +58 -0
- package/lib/scene/gltf.d.ts +32 -2
- package/lib/scene/gltf.js +78 -49
- package/lib/scene/grading.d.ts +2 -2
- package/lib/scene/grading.js +3 -3
- package/lib/scene/ktx2.d.ts +9 -1
- package/lib/scene/ktx2.js +3 -2
- package/lib/scene/level-rule.d.ts +120 -0
- package/lib/scene/level-rule.js +130 -0
- package/lib/scene/lines.d.ts +13 -17
- package/lib/scene/lines.js +3 -3
- package/lib/scene/lut.d.ts +1 -2
- package/lib/scene/lut.js +1 -2
- package/lib/scene/picks.d.ts +2 -2
- package/lib/scene/pointer-events.d.ts +4 -7
- package/lib/scene/post.d.ts +38 -43
- package/lib/scene/post.js +4 -1
- package/lib/scene/prefab.d.ts +7 -8
- package/lib/scene/prefab.js +7 -8
- package/lib/scene/property-animation.d.ts +1 -1
- package/lib/scene/property-animation.js +1 -1
- package/lib/scene/queries.d.ts +7 -13
- package/lib/scene/resources.d.ts +225 -254
- package/lib/scene/resources.js +179 -81
- package/lib/scene/scene.d.ts +149 -118
- package/lib/scene/scene.js +196 -98
- package/lib/scene/serial-loads.d.ts +29 -0
- package/lib/scene/serial-loads.js +68 -0
- package/lib/scene/shader-preloads.d.ts +34 -0
- package/lib/scene/shader-preloads.js +38 -0
- package/lib/scene/sprites.d.ts +14 -17
- package/lib/scene/sprites.js +5 -6
- package/lib/scene/textures.d.ts +11 -12
- package/lib/scene/textures.js +9 -10
- package/lib/scene/time-of-day.d.ts +3 -4
- package/lib/scene/time-of-day.js +2 -3
- package/lib/scene/vertex-draws.d.ts +5 -4
- package/lib/scene/vertex-draws.js +7 -5
- package/lib/shader-artifact.json +1 -0
- package/lib/shared/core.d.ts +5 -0
- package/lib/shared/core.js +1 -0
- package/lib/shared/import-once.d.ts +6 -0
- package/lib/shared/import-once.js +19 -0
- package/lib/shared/metrics.d.ts +38 -0
- package/lib/shared/metrics.js +62 -1
- package/lib/shared/run-task.js +7 -1
- package/lib/shared/task-pending.d.ts +12 -0
- package/lib/shared/task-pending.js +61 -1
- package/lib/shared/tasks.js +79 -32
- package/lib/shared/version.d.ts +17 -1
- package/lib/shared/version.js +19 -1
- package/lib/shared/wasm.d.ts +12 -4
- package/lib/shared/wasm.js +50 -27
- package/lib/shared/worker-start.d.ts +7 -0
- package/lib/shared/worker-start.js +27 -0
- package/lib/sketch/define-sketch.d.ts +35 -0
- package/lib/sketch/input.d.ts +2 -2
- package/lib/sketch/preset-check.d.ts +20 -6
- package/lib/sketch/preset-check.js +42 -17
- package/lib/sketch/quality.d.ts +69 -11
- package/lib/sketch/quality.js +54 -13
- package/lib/sketch/runner.d.ts +76 -9
- package/lib/sketch/runner.js +385 -52
- package/lib/sketch/ui.d.ts +5 -8
- package/lib/workers/probe-worker.d.ts +5 -0
- package/lib/workers/probe-worker.js +13 -4
- package/lib/workers/protocol.d.ts +61 -13
- package/lib/workers/protocol.js +4 -0
- package/lib/workers/render-worker.js +25 -4
- package/lib/workers/sketch-worker.js +104 -15
- package/package.json +2 -2
|
@@ -21,14 +21,16 @@
|
|
|
21
21
|
import * as G from '../../generated/gpu.js';
|
|
22
22
|
import { DEV } from '../../shared/dev.js';
|
|
23
23
|
import { ImageTable } from '../../shared/images.js';
|
|
24
|
+
import { EarlyBuilds, PipelineListing } from '../early-builds.js';
|
|
24
25
|
import { JoinedBuilds, joinedReady } from '../effect-join.js';
|
|
25
26
|
import { CLOUD_FIELD_WORD, CLOUD_STEPS_WORD, LAYER_WORD, LIGHT_BUFFER_WORD, } from '../environment-words.js';
|
|
26
27
|
import { floatOfBits } from '../float-bits.js';
|
|
27
28
|
import { GpuMemory, textureBytes } from '../memory.js';
|
|
29
|
+
import { pipelineName } from '../pipeline-name.js';
|
|
28
30
|
import { variantFor } from '../variants.js';
|
|
29
31
|
import { forEachFallbackAttribute, forEachVertexAttribute, isNormalized, vertexStride, } from '../vertex-format.js';
|
|
30
32
|
import { setDepthMode } from './depth.js';
|
|
31
|
-
import { buildPermutation, createProgram, customTemplate, engineTemplates, linkLogs, metalFault, mipmapTemplate, prepareProgram, programHost, relink, slotOf, UPLOAD_UNIT, } from './programs.js';
|
|
33
|
+
import { buildPermutation, createProgram, customTemplate, engineTemplates, LinkFailure, linkLogs, metalFault, mipmapTemplate, prepareProgram, programHost, relink, slotOf, UPLOAD_UNIT, } from './programs.js';
|
|
32
34
|
/** The unit that the mip level shader samples: its source texture's group 0, binding 0. */
|
|
33
35
|
const MIP_UNIT = 0;
|
|
34
36
|
/** The key of the mip level program among the programs of pipelines. */
|
|
@@ -133,6 +135,13 @@ function pointAttribute(gl, stride, a) {
|
|
|
133
135
|
else
|
|
134
136
|
gl.vertexAttribPointer(a.location, a.size, type, isNormalized(a), stride, a.offset);
|
|
135
137
|
}
|
|
138
|
+
/**
|
|
139
|
+
* A framebuffer that a live context refused. The backend skips the frame and asks again on the
|
|
140
|
+
* next one, because a driver can answer a lost context's check with a refusal before the loss flag
|
|
141
|
+
* is set; the same refusal on the next frame is a format the device does not draw into.
|
|
142
|
+
*/
|
|
143
|
+
export class WebGL2TargetRefused extends Error {
|
|
144
|
+
}
|
|
136
145
|
/**
|
|
137
146
|
* How GL stores each texture format, by format code, for a canvas with alpha or without. A
|
|
138
147
|
* compressed format is there only when the context turned on its extension, which the backend
|
|
@@ -195,6 +204,34 @@ function glFormats(gl, canvasAlpha) {
|
|
|
195
204
|
add(G.FORMAT_DEPTH16_UNORM, gl.DEPTH_COMPONENT16, gl.DEPTH_COMPONENT, gl.UNSIGNED_SHORT, depth);
|
|
196
205
|
return formats;
|
|
197
206
|
}
|
|
207
|
+
/** The name of each format that a framebuffer's attachments may take. */
|
|
208
|
+
const FORMAT_NAMES = {
|
|
209
|
+
[G.FORMAT_CANVAS]: 'the canvas',
|
|
210
|
+
[G.FORMAT_RGBA8_UNORM]: 'RGBA8',
|
|
211
|
+
[G.FORMAT_RGBA8_UNORM_SRGB]: 'sRGB8',
|
|
212
|
+
[G.FORMAT_RGBA16_FLOAT]: 'RGBA16F',
|
|
213
|
+
[G.FORMAT_RG16_FLOAT]: 'RG16F',
|
|
214
|
+
[G.FORMAT_RG11B10_UFLOAT]: 'R11G11B10F',
|
|
215
|
+
[G.FORMAT_RGB9E5_UFLOAT]: 'RGB9E5',
|
|
216
|
+
[G.FORMAT_RGBA32_FLOAT]: 'RGBA32F',
|
|
217
|
+
[G.FORMAT_R32_UINT]: 'R32UI',
|
|
218
|
+
[G.FORMAT_R32_FLOAT]: 'R32F',
|
|
219
|
+
[G.FORMAT_RGBA32_UINT]: 'RGBA32UI',
|
|
220
|
+
[G.FORMAT_R16_FLOAT]: 'R16F',
|
|
221
|
+
[G.FORMAT_DEPTH24_PLUS]: 'depth24',
|
|
222
|
+
[G.FORMAT_DEPTH32_FLOAT]: 'depth32f',
|
|
223
|
+
[G.FORMAT_DEPTH16_UNORM]: 'depth16',
|
|
224
|
+
};
|
|
225
|
+
/** A framebuffer's attachments by name and GL's own format number, for a driver report. */
|
|
226
|
+
function describeFramebuffer(first, depth, second) {
|
|
227
|
+
const name = (target) => `${FORMAT_NAMES[target.format.code] ?? `format ${target.format.code}`} (0x${target.format.internal.toString(16)})`;
|
|
228
|
+
const parts = [`color ${name(first)}`];
|
|
229
|
+
if (second)
|
|
230
|
+
parts.push(`second color ${name(second)}`);
|
|
231
|
+
if (depth)
|
|
232
|
+
parts.push(`depth ${name(depth)}`);
|
|
233
|
+
return parts.join(', ');
|
|
234
|
+
}
|
|
198
235
|
/** The linear color formats that WebGL2 both renders into and filters, so `generateMipmap` takes them. */
|
|
199
236
|
const NATIVE_MIP_FORMATS = new Set([
|
|
200
237
|
G.FORMAT_RGBA8_UNORM,
|
|
@@ -207,6 +244,10 @@ const NATIVE_MIP_FORMATS = new Set([
|
|
|
207
244
|
* filters. The engine's own draws make the levels of other textures, such as uploaded images
|
|
208
245
|
* (`generateMipmaps` in the backend says why).
|
|
209
246
|
*/
|
|
247
|
+
/** True when `error` is a link that the driver refused, on a context that is not lost. */
|
|
248
|
+
function linkRefused(gl, error) {
|
|
249
|
+
return error instanceof LinkFailure && !gl.isContextLost();
|
|
250
|
+
}
|
|
210
251
|
function linearMips(format, usage, layers, mips) {
|
|
211
252
|
const target = G.TEXTURE_USAGE_RENDER_ATTACHMENT | G.TEXTURE_USAGE_COPY_DST;
|
|
212
253
|
return (mips > 1 &&
|
|
@@ -289,6 +330,13 @@ export class WebGL2Backend {
|
|
|
289
330
|
joins;
|
|
290
331
|
/** True once a list has replayed, after which no frame waits for a joined shader's compile. */
|
|
291
332
|
replayed = false;
|
|
333
|
+
/**
|
|
334
|
+
* How many frames in a row a live context has refused a target, and the target's message, so
|
|
335
|
+
* the next frame may refuse one again before the engine ends: a lost context can answer the
|
|
336
|
+
* check this way before its flag is set, and a cadence can put two targets in the way.
|
|
337
|
+
*/
|
|
338
|
+
refusedFrames = 0;
|
|
339
|
+
refusedTarget = '';
|
|
292
340
|
/** The opcode and word of the command that the replay is carrying out. */
|
|
293
341
|
replayOp = -1;
|
|
294
342
|
replayWord = -1;
|
|
@@ -298,6 +346,10 @@ export class WebGL2Backend {
|
|
|
298
346
|
* draws draw nothing.
|
|
299
347
|
*/
|
|
300
348
|
parked = new Map();
|
|
349
|
+
/** The create commands of the pipelines that the lists before the first frame create. */
|
|
350
|
+
listing = new PipelineListing();
|
|
351
|
+
/** The compiles of the programs that the last start's first frame built, until this first frame. */
|
|
352
|
+
early;
|
|
301
353
|
/**
|
|
302
354
|
* In development builds, the programs that a hot update of a custom material's shader compiles,
|
|
303
355
|
* each under the key of the program it replaces once it has compiled. `relinked` is set once the
|
|
@@ -309,7 +361,16 @@ export class WebGL2Backend {
|
|
|
309
361
|
* bits. Without it, every pipeline's build must be in the shaders that the backend got.
|
|
310
362
|
*/
|
|
311
363
|
moreShaders;
|
|
312
|
-
/**
|
|
364
|
+
/**
|
|
365
|
+
* Hears each program of the scene's objects that the driver refused to link twice, by its
|
|
366
|
+
* pipeline's name and the link's logs. Its draws draw nothing from then on, and the frames go
|
|
367
|
+
* on without them.
|
|
368
|
+
*/
|
|
369
|
+
refused;
|
|
370
|
+
/**
|
|
371
|
+
* True while the current pipeline's program is compiling, or after the driver refused it: draws
|
|
372
|
+
* draw nothing until it is set again.
|
|
373
|
+
*/
|
|
313
374
|
skipDraws = false;
|
|
314
375
|
anisotropic;
|
|
315
376
|
maxAnisotropy;
|
|
@@ -533,11 +594,40 @@ export class WebGL2Backend {
|
|
|
533
594
|
this.replayWord = -1;
|
|
534
595
|
let i = start;
|
|
535
596
|
while (i < end && (words[i] & 0xff) === G.OP_CREATE_RENDER_PIPELINE) {
|
|
597
|
+
this.listing.add(G.OP_CREATE_RENDER_PIPELINE, words, i + 1);
|
|
536
598
|
this.createPipeline(words, i + 1, true);
|
|
537
599
|
i += words[i] >>> 8;
|
|
538
600
|
}
|
|
601
|
+
if (this.listing.active && this.parallel)
|
|
602
|
+
this.compileAhead(words, i, end);
|
|
539
603
|
return i;
|
|
540
604
|
}
|
|
605
|
+
/**
|
|
606
|
+
* Starts to compile, in the background, the program of each pipeline that the list in
|
|
607
|
+
* `words[start, end)` creates after other commands. The frame before the first one then waits
|
|
608
|
+
* for them, as for the programs of the pipelines at the list's front, instead of its first draw
|
|
609
|
+
* with each waiting for its compile.
|
|
610
|
+
*/
|
|
611
|
+
compileAhead(words, start, end) {
|
|
612
|
+
for (let i = start; i < end;) {
|
|
613
|
+
const header = words[i];
|
|
614
|
+
const length = header >>> 8;
|
|
615
|
+
if (length === 0)
|
|
616
|
+
return;
|
|
617
|
+
if ((header & 0xff) === G.OP_CREATE_RENDER_PIPELINE) {
|
|
618
|
+
const template = words[i + 2];
|
|
619
|
+
const permutation = words[i + 3];
|
|
620
|
+
try {
|
|
621
|
+
if (!this.joins.joined(template) && this.templateReady(template, permutation))
|
|
622
|
+
this.programOf(template, permutation, true);
|
|
623
|
+
}
|
|
624
|
+
catch {
|
|
625
|
+
// The pipeline's own command meets the error.
|
|
626
|
+
}
|
|
627
|
+
}
|
|
628
|
+
i += length;
|
|
629
|
+
}
|
|
630
|
+
}
|
|
541
631
|
/**
|
|
542
632
|
* Where the draw section of the list in `words[start, end)` begins, after the pipelines it
|
|
543
633
|
* creates. It walks the same ops as `prepare` and starts no build.
|
|
@@ -678,6 +768,42 @@ export class WebGL2Backend {
|
|
|
678
768
|
});
|
|
679
769
|
}
|
|
680
770
|
}
|
|
771
|
+
/**
|
|
772
|
+
* Starts to compile the programs of `list`, a pipeline list of the pipelines that the first frame
|
|
773
|
+
* of the sketch's last start built (`gpu/early-builds.ts`). Each compile starts once its shader
|
|
774
|
+
* is there, and a pipeline of the same template and permutation takes the program. No frame
|
|
775
|
+
* waits for a program that no pipeline takes. A joined shader's program compiles when its
|
|
776
|
+
* pipeline comes, as its failure sends the effects back to a pass each.
|
|
777
|
+
*/
|
|
778
|
+
buildEarly(list) {
|
|
779
|
+
this.early?.stop();
|
|
780
|
+
this.early = new EarlyBuilds(list, (op, operands) => {
|
|
781
|
+
const template = operands[1];
|
|
782
|
+
const permutation = operands[2];
|
|
783
|
+
if (op !== G.OP_CREATE_RENDER_PIPELINE || this.joins.joined(template))
|
|
784
|
+
return null;
|
|
785
|
+
if (!this.templateReady(template, permutation))
|
|
786
|
+
return undefined;
|
|
787
|
+
const key = `${template} ${permutation}`;
|
|
788
|
+
if (this.programs.has(key))
|
|
789
|
+
return null;
|
|
790
|
+
const glsl = this.need(this.templates, template, 'render pipeline template');
|
|
791
|
+
const program = createProgram(this.gl, glsl, permutation);
|
|
792
|
+
program.early = true;
|
|
793
|
+
this.programs.set(key, program);
|
|
794
|
+
return null;
|
|
795
|
+
});
|
|
796
|
+
}
|
|
797
|
+
/**
|
|
798
|
+
* Ends the list of the pipelines that the frames before the first one created, and returns it,
|
|
799
|
+
* once: the first frame has drawn. The compiles of the last start's list that have not started
|
|
800
|
+
* stop.
|
|
801
|
+
*/
|
|
802
|
+
takeListing() {
|
|
803
|
+
this.early?.stop();
|
|
804
|
+
this.early = undefined;
|
|
805
|
+
return this.listing.take();
|
|
806
|
+
}
|
|
681
807
|
/** Creates each parked pipeline whose custom material's shader has arrived. */
|
|
682
808
|
unpark() {
|
|
683
809
|
for (const [id, operands] of this.parked) {
|
|
@@ -752,7 +878,9 @@ export class WebGL2Backend {
|
|
|
752
878
|
}
|
|
753
879
|
/**
|
|
754
880
|
* Replays the draw list in `words[start, end)`. `floats` views the same memory as `words`, for
|
|
755
|
-
* float operands; `memory` is the engine memory that uploads read from.
|
|
881
|
+
* float operands; `memory` is the engine memory that uploads read from. A target that a live
|
|
882
|
+
* context refuses ends the replay without an error, and the next frame asks again before the
|
|
883
|
+
* refusal is reported: a lost context can answer the check that way before its flag is set.
|
|
756
884
|
*/
|
|
757
885
|
replay(words, floats, start, end, memory) {
|
|
758
886
|
if (memory !== this.memory) {
|
|
@@ -769,6 +897,36 @@ export class WebGL2Backend {
|
|
|
769
897
|
this.floats = floats;
|
|
770
898
|
this.unpackSlot = (this.unpackSlot + 1) % UNPACK_RING;
|
|
771
899
|
this.unpackUsed = 0;
|
|
900
|
+
try {
|
|
901
|
+
this.replayOps(words, floats, start, end);
|
|
902
|
+
}
|
|
903
|
+
catch (error) {
|
|
904
|
+
if (!(error instanceof WebGL2TargetRefused))
|
|
905
|
+
throw error;
|
|
906
|
+
// A live context refused a target. The driver can answer a lost context's check this
|
|
907
|
+
// way before the loss flag is set, so this frame draws nothing and the next frame asks
|
|
908
|
+
// again. A cadence can put two targets in the way on alternating frames, so the retry
|
|
909
|
+
// counts frames, not names.
|
|
910
|
+
if (this.refusedFrames > 0) {
|
|
911
|
+
const before = this.refusedTarget;
|
|
912
|
+
throw new WebGL2TargetRefused(before === error.message
|
|
913
|
+
? error.message
|
|
914
|
+
: `${error.message}; the frame before refused ${before}`);
|
|
915
|
+
}
|
|
916
|
+
this.refusedFrames = 1;
|
|
917
|
+
this.refusedTarget = error.message;
|
|
918
|
+
// The frame's finished reads still go, as at the end of every replay: a read that waits
|
|
919
|
+
// for a frame which never draws again would hold its page waiting.
|
|
920
|
+
this.flushReads();
|
|
921
|
+
return;
|
|
922
|
+
}
|
|
923
|
+
this.refusedFrames = 0;
|
|
924
|
+
this.refusedTarget = '';
|
|
925
|
+
this.flushReads();
|
|
926
|
+
this.replayed = true;
|
|
927
|
+
}
|
|
928
|
+
/** Replays a draw list's commands, as `replay` describes them. */
|
|
929
|
+
replayOps(words, floats, start, end) {
|
|
772
930
|
const gl = this.gl;
|
|
773
931
|
for (let i = start; i < end;) {
|
|
774
932
|
const header = words[i];
|
|
@@ -874,6 +1032,7 @@ export class WebGL2Backend {
|
|
|
874
1032
|
}
|
|
875
1033
|
case G.OP_CREATE_RENDER_PIPELINE:
|
|
876
1034
|
// A list that creates a pipeline after other commands waits for it at its first draw.
|
|
1035
|
+
this.listing.add(op, words, a);
|
|
877
1036
|
this.createPipeline(words, a, false);
|
|
878
1037
|
break;
|
|
879
1038
|
case G.OP_CREATE_BIND_GROUP: {
|
|
@@ -964,8 +1123,6 @@ export class WebGL2Backend {
|
|
|
964
1123
|
}
|
|
965
1124
|
i += length;
|
|
966
1125
|
}
|
|
967
|
-
this.flushReads();
|
|
968
|
-
this.replayed = true;
|
|
969
1126
|
}
|
|
970
1127
|
/**
|
|
971
1128
|
* The program that draws mip levels, or the one that copies a layer, which starts compiling the
|
|
@@ -1007,6 +1164,37 @@ export class WebGL2Backend {
|
|
|
1007
1164
|
this.useProgram(program);
|
|
1008
1165
|
return program;
|
|
1009
1166
|
}
|
|
1167
|
+
/**
|
|
1168
|
+
* Puts a program of the scene's objects in use, as `useProgram` does, and returns true. A link
|
|
1169
|
+
* that the driver refused links once more, from new shaders: a driver can run short of memory
|
|
1170
|
+
* while it links. A second refusal marks the program, so its draws draw nothing from then on,
|
|
1171
|
+
* reports it, and returns false. Any other failure, such as a material with more textures than
|
|
1172
|
+
* the stages hold, still stops the replay, and so does a link on a lost context, which the
|
|
1173
|
+
* renderer recovers from as a loss.
|
|
1174
|
+
*/
|
|
1175
|
+
useObjectsProgram(program) {
|
|
1176
|
+
const objects = program.objects;
|
|
1177
|
+
try {
|
|
1178
|
+
this.useProgram(program);
|
|
1179
|
+
return true;
|
|
1180
|
+
}
|
|
1181
|
+
catch (error) {
|
|
1182
|
+
if (!linkRefused(this.gl, error))
|
|
1183
|
+
throw error;
|
|
1184
|
+
}
|
|
1185
|
+
relink(this.gl, program);
|
|
1186
|
+
try {
|
|
1187
|
+
this.useProgram(program);
|
|
1188
|
+
return true;
|
|
1189
|
+
}
|
|
1190
|
+
catch (error) {
|
|
1191
|
+
if (!linkRefused(this.gl, error))
|
|
1192
|
+
throw error;
|
|
1193
|
+
objects.refused = true;
|
|
1194
|
+
this.refused?.(pipelineName(objects.template, objects.permutation), error.message);
|
|
1195
|
+
return false;
|
|
1196
|
+
}
|
|
1197
|
+
}
|
|
1010
1198
|
/** Puts a program in use, first checking its link and binding its slots at its first use. */
|
|
1011
1199
|
useProgram(program) {
|
|
1012
1200
|
if (!program.ready) {
|
|
@@ -1058,6 +1246,8 @@ export class WebGL2Backend {
|
|
|
1058
1246
|
: undefined;
|
|
1059
1247
|
if (joined)
|
|
1060
1248
|
program.joined = joined;
|
|
1249
|
+
if (glsl.meshPrepass)
|
|
1250
|
+
program.objects = { template, permutation, refused: false };
|
|
1061
1251
|
if ((background || joined) && this.parallel) {
|
|
1062
1252
|
program.background = true;
|
|
1063
1253
|
this.compiling.push(program);
|
|
@@ -1069,6 +1259,14 @@ export class WebGL2Backend {
|
|
|
1069
1259
|
this.joins.keptApart(template);
|
|
1070
1260
|
}
|
|
1071
1261
|
}
|
|
1262
|
+
else if (program.early) {
|
|
1263
|
+
// A program that compiled ahead of its pipeline: the frames wait for it from now on.
|
|
1264
|
+
program.early = undefined;
|
|
1265
|
+
if (background && this.parallel) {
|
|
1266
|
+
program.background = true;
|
|
1267
|
+
this.compiling.push(program);
|
|
1268
|
+
}
|
|
1269
|
+
}
|
|
1072
1270
|
return program;
|
|
1073
1271
|
}
|
|
1074
1272
|
/**
|
|
@@ -2033,8 +2231,17 @@ export class WebGL2Backend {
|
|
|
2033
2231
|
gl.drawBuffers(TWO_DRAW_BUFFERS);
|
|
2034
2232
|
}
|
|
2035
2233
|
const status = gl.checkFramebufferStatus(gl.FRAMEBUFFER);
|
|
2036
|
-
if (status !== gl.FRAMEBUFFER_COMPLETE)
|
|
2037
|
-
|
|
2234
|
+
if (status !== gl.FRAMEBUFFER_COMPLETE) {
|
|
2235
|
+
gl.deleteFramebuffer(framebuffer);
|
|
2236
|
+
const target = describeFramebuffer(first, depth, second);
|
|
2237
|
+
const text = `${target} (status 0x${status.toString(16)})`;
|
|
2238
|
+
// A driver can answer a lost context's check with this status before the loss flag is
|
|
2239
|
+
// set. The renderer drops a frame error while the context is lost, and its recovery
|
|
2240
|
+
// then starts.
|
|
2241
|
+
if (gl.isContextLost())
|
|
2242
|
+
throw new Error(`WebGL2 lost its context inside a framebuffer check: ${text}`);
|
|
2243
|
+
throw new WebGL2TargetRefused(`WebGL2 cannot draw into ${text}`);
|
|
2244
|
+
}
|
|
2038
2245
|
return framebuffer;
|
|
2039
2246
|
}
|
|
2040
2247
|
/**
|
|
@@ -2316,7 +2523,10 @@ export class WebGL2Backend {
|
|
|
2316
2523
|
}
|
|
2317
2524
|
setPipeline(p) {
|
|
2318
2525
|
const program = p.program;
|
|
2319
|
-
this.skipDraws =
|
|
2526
|
+
this.skipDraws =
|
|
2527
|
+
program.joined?.failed === true ||
|
|
2528
|
+
program.objects?.refused === true ||
|
|
2529
|
+
!this.compiled(program);
|
|
2320
2530
|
if (this.skipDraws)
|
|
2321
2531
|
return;
|
|
2322
2532
|
if (program.joined) {
|
|
@@ -2329,6 +2539,12 @@ export class WebGL2Backend {
|
|
|
2329
2539
|
return;
|
|
2330
2540
|
}
|
|
2331
2541
|
}
|
|
2542
|
+
else if (program.objects) {
|
|
2543
|
+
if (!this.useObjectsProgram(program)) {
|
|
2544
|
+
this.skipDraws = true;
|
|
2545
|
+
return;
|
|
2546
|
+
}
|
|
2547
|
+
}
|
|
2332
2548
|
else
|
|
2333
2549
|
this.useProgram(program);
|
|
2334
2550
|
if (this.current?.program !== program && program.textureUnits.length > 0)
|
|
@@ -2701,6 +2917,8 @@ export class WebGL2Backend {
|
|
|
2701
2917
|
this.counts.drawCalls += count;
|
|
2702
2918
|
}
|
|
2703
2919
|
destroy() {
|
|
2920
|
+
this.early?.stop();
|
|
2921
|
+
this.early = undefined;
|
|
2704
2922
|
const gl = this.gl;
|
|
2705
2923
|
for (let id = 0; id < this.buffers.length; id++)
|
|
2706
2924
|
this.destroyBuffer(id);
|
|
@@ -94,6 +94,21 @@ export interface Program {
|
|
|
94
94
|
readonly start: number;
|
|
95
95
|
failed: boolean;
|
|
96
96
|
};
|
|
97
|
+
/**
|
|
98
|
+
* True for a program that a start compiles ahead of its pipeline, from the list of the last
|
|
99
|
+
* start's first frame: no frame waits for it until a pipeline takes it.
|
|
100
|
+
*/
|
|
101
|
+
early?: boolean;
|
|
102
|
+
/**
|
|
103
|
+
* For a program of a template that draws the scene's meshes: its template and permutation, which
|
|
104
|
+
* name it, and whether the driver refused to link it twice, which leaves its draws drawing
|
|
105
|
+
* nothing while the frames go on.
|
|
106
|
+
*/
|
|
107
|
+
objects?: {
|
|
108
|
+
readonly template: number;
|
|
109
|
+
readonly permutation: number;
|
|
110
|
+
refused: boolean;
|
|
111
|
+
};
|
|
97
112
|
}
|
|
98
113
|
/** A render pipeline: its program, and the fixed-function state and vertex format it asks for. */
|
|
99
114
|
export interface Pipeline {
|
|
@@ -178,6 +193,9 @@ export declare function relink(gl: WebGL2RenderingContext, p: Program): void;
|
|
|
178
193
|
* names each error with its line. Call it before the shaders are deleted.
|
|
179
194
|
*/
|
|
180
195
|
export declare function linkLogs(gl: WebGL2RenderingContext, p: Program): string;
|
|
196
|
+
/** A program whose link the driver refused, with the logs of its program and shaders. */
|
|
197
|
+
export declare class LinkFailure extends Error {
|
|
198
|
+
}
|
|
181
199
|
/**
|
|
182
200
|
* The texture units that the stages of a program read, as triples of the unit, the slot where bind
|
|
183
201
|
* groups leave the unit's texture and the slot of the sampler it reads with, or `NO_SAMPLER`. Units
|
|
@@ -364,9 +364,12 @@ export function linkLogs(gl, p) {
|
|
|
364
364
|
.filter((log) => log)
|
|
365
365
|
.join('\n');
|
|
366
366
|
}
|
|
367
|
+
/** A program whose link the driver refused, with the logs of its program and shaders. */
|
|
368
|
+
export class LinkFailure extends Error {
|
|
369
|
+
}
|
|
367
370
|
/** The error of a program whose link failed, with the logs of its program and shaders. */
|
|
368
371
|
function linkError(gl, p, attempt) {
|
|
369
|
-
return new
|
|
372
|
+
return new LinkFailure(`a WebGL2 program failed to link${attempt}: ${linkLogs(gl, p)}`);
|
|
370
373
|
}
|
|
371
374
|
/**
|
|
372
375
|
* The texture units that the stages of a program read, as triples of the unit, the slot where bind
|
|
@@ -8,6 +8,12 @@ import type { CulledCounts } from './culled-counts.js';
|
|
|
8
8
|
import type { GpuTimer } from './gpu-timer.js';
|
|
9
9
|
import { type RenderTemplate } from './pipelines.js';
|
|
10
10
|
import { UploadRoutes } from './upload-routes.js';
|
|
11
|
+
/**
|
|
12
|
+
* True for a pipeline build that the GPU's driver refused, as a `GPUPipelineError` whose reason is
|
|
13
|
+
* `internal`: it ran out of memory, or its compiler refused the shader. The browser's validation
|
|
14
|
+
* of the engine's descriptor gives the reason `validation`.
|
|
15
|
+
*/
|
|
16
|
+
export declare function refusedByDriver(error: unknown): boolean;
|
|
11
17
|
export declare class WebGPUBackend {
|
|
12
18
|
readonly device: GPUDevice;
|
|
13
19
|
private readonly context;
|
|
@@ -36,15 +42,31 @@ export declare class WebGPUBackend {
|
|
|
36
42
|
private mipSampler;
|
|
37
43
|
/** What making each texture's mip levels draws with, by texture id, once it made them. */
|
|
38
44
|
private readonly mipChains;
|
|
39
|
-
/**
|
|
45
|
+
/**
|
|
46
|
+
* Pipelines by id: null while one builds or after the GPU's driver refused it, and undefined for
|
|
47
|
+
* an id that names none. A null pipeline's draws draw nothing.
|
|
48
|
+
*/
|
|
40
49
|
private readonly renderPipelines;
|
|
41
50
|
/** True for each render pipeline, by id, that draws lines rather than triangles. */
|
|
42
51
|
private readonly lineLists;
|
|
43
52
|
/** True while the render pass's pipeline draws lines. */
|
|
44
53
|
private lines;
|
|
45
54
|
private readonly computePipelines;
|
|
46
|
-
/** Pipelines that are building, or that wait for their custom material's shader. */
|
|
55
|
+
/** Pipelines that are building, or that wait for their custom material's shader or a retry. */
|
|
47
56
|
private builds;
|
|
57
|
+
/** The builds that the browser runs now. */
|
|
58
|
+
private running;
|
|
59
|
+
/**
|
|
60
|
+
* The render pipelines of the scene's objects whose build the GPU's driver refused once. Each
|
|
61
|
+
* builds once more, alone, once no other build runs: a driver can run short of memory while it
|
|
62
|
+
* compiles many shaders at once.
|
|
63
|
+
*/
|
|
64
|
+
private readonly retries;
|
|
65
|
+
/**
|
|
66
|
+
* Hears each render pipeline that the GPU's driver refused twice, by its name and the driver's
|
|
67
|
+
* reason. Its draws draw nothing from then on, and the frames go on without them.
|
|
68
|
+
*/
|
|
69
|
+
refused: ((pipeline: string, reason: string) => void) | undefined;
|
|
48
70
|
/**
|
|
49
71
|
* The operands of each `CreateRenderPipeline` whose custom material's shader has not reached
|
|
50
72
|
* this thread yet. Each builds once its shader arrives.
|
|
@@ -63,6 +85,23 @@ export declare class WebGPUBackend {
|
|
|
63
85
|
* skinning pass's, which loads with the first skinned mesh. Each builds once its file arrives.
|
|
64
86
|
*/
|
|
65
87
|
private readonly parkedCompute;
|
|
88
|
+
/** The create commands of the pipelines that the lists before the first frame create. */
|
|
89
|
+
private readonly listing;
|
|
90
|
+
/** The builds of the pipelines that the last start's first frame built, until this first frame. */
|
|
91
|
+
private early;
|
|
92
|
+
/**
|
|
93
|
+
* The builds of the pipelines that a list before the first frame creates after other commands,
|
|
94
|
+
* by the id that the command creates, with the command's key. They start when the list is
|
|
95
|
+
* prepared, and the frame waits for them.
|
|
96
|
+
*/
|
|
97
|
+
private readonly ahead;
|
|
98
|
+
/**
|
|
99
|
+
* The builds of `ahead` by the command's key: commands of equal operands under other ids, such
|
|
100
|
+
* as an add-on's compute passes of one shader, share one build. Built one after another, the
|
|
101
|
+
* browser's cache of equal pipelines answers each after the first; started at once, each would
|
|
102
|
+
* compile the shader again.
|
|
103
|
+
*/
|
|
104
|
+
private readonly aheadByKey;
|
|
66
105
|
/**
|
|
67
106
|
* True when the vertex shaders skin skinned meshes, so a preload of skinning prepares the
|
|
68
107
|
* shaders of its SKIN builds.
|
|
@@ -276,6 +315,24 @@ export declare class WebGPUBackend {
|
|
|
276
315
|
* nothing.
|
|
277
316
|
*/
|
|
278
317
|
prepare(words: Uint32Array, start: number, end: number): number;
|
|
318
|
+
/**
|
|
319
|
+
* Starts to build, in the background, each pipeline that the list in `words[start, end)` creates
|
|
320
|
+
* after other commands, such as an add-on's compute pass. The frame before the first one then
|
|
321
|
+
* waits for them, as for the pipelines at the list's front, and its replay takes them. Without
|
|
322
|
+
* this, its replay would build each at once, and the GPU would compile them one after another
|
|
323
|
+
* inside the first frame.
|
|
324
|
+
*/
|
|
325
|
+
private buildAhead;
|
|
326
|
+
/**
|
|
327
|
+
* The background build of the create command `op` whose operands start at `a`, or undefined
|
|
328
|
+
* while its shader has not arrived or when it builds when its command comes.
|
|
329
|
+
*/
|
|
330
|
+
private startAhead;
|
|
331
|
+
/**
|
|
332
|
+
* The built pipeline of a create command that the list creates after other commands, whose build
|
|
333
|
+
* started when the list was prepared, or undefined when there is none, as after the first frame.
|
|
334
|
+
*/
|
|
335
|
+
private takeAhead;
|
|
279
336
|
/**
|
|
280
337
|
* Where the draw section of the list in `words[start, end)` begins, after the pipelines it
|
|
281
338
|
* creates. It walks the same ops as `prepare` and starts no build.
|
|
@@ -311,6 +368,24 @@ export declare class WebGPUBackend {
|
|
|
311
368
|
* while the vertex shaders skin.
|
|
312
369
|
*/
|
|
313
370
|
precompile(features: readonly string[], module: FirstUseShaders): void;
|
|
371
|
+
/**
|
|
372
|
+
* Starts to build the pipelines of `list`, a pipeline list of the pipelines that the first frame
|
|
373
|
+
* of the sketch's last start built (`gpu/early-builds.ts`). Each build starts once its shader is
|
|
374
|
+
* there, and a create command of the same pipeline takes it. A joined shader's pipelines build
|
|
375
|
+
* when their command comes, as their failure sends the effects back to a pass each.
|
|
376
|
+
*/
|
|
377
|
+
buildEarly(list: Uint32Array): void;
|
|
378
|
+
/**
|
|
379
|
+
* Ends the list of the pipelines that the frames before the first one created, and returns it,
|
|
380
|
+
* once: the first frame has drawn. The builds of the last start's list that no command took
|
|
381
|
+
* stop.
|
|
382
|
+
*/
|
|
383
|
+
takeListing(): Uint32Array | undefined;
|
|
384
|
+
/**
|
|
385
|
+
* Gives the pipeline `id` of `table` the build that started for it ahead of its command: at once
|
|
386
|
+
* when it is built, else when it is.
|
|
387
|
+
*/
|
|
388
|
+
private adopt;
|
|
314
389
|
/**
|
|
315
390
|
* Makes the skinning pass write normals and tangents as 32-bit floats, as the core's skinned
|
|
316
391
|
* vertices hold them in the skinning modes that measure 8-bit ones against floats.
|
|
@@ -327,6 +402,18 @@ export declare class WebGPUBackend {
|
|
|
327
402
|
* operands at `a`: in the background when `background` is set, else at once.
|
|
328
403
|
*/
|
|
329
404
|
private createPipeline;
|
|
405
|
+
/**
|
|
406
|
+
* Hears that a render pipeline did not build. A pipeline of the scene's objects that the GPU's
|
|
407
|
+
* driver refused waits for its retry, and still counts as building. Any other failure, such as
|
|
408
|
+
* a descriptor that the browser's validation refused, is an engine fault, which the next replay
|
|
409
|
+
* reports.
|
|
410
|
+
*/
|
|
411
|
+
private refusedOnce;
|
|
412
|
+
/**
|
|
413
|
+
* Builds the first pipeline that waits for its retry. A second refusal leaves its draws drawing
|
|
414
|
+
* nothing, so the frames go on without those objects, and the backend reports it.
|
|
415
|
+
*/
|
|
416
|
+
private retryRefused;
|
|
330
417
|
/** How to build the render pipeline of a `CreateRenderPipeline` command with its operands at `a`. */
|
|
331
418
|
private renderDescriptor;
|
|
332
419
|
private built;
|