@woosh/meep-engine 3.32.0 → 3.33.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/build/bundle-worker-terrain.js +1 -1
- package/package.json +1 -1
- package/src/core/collection/table/RowFirstTable.d.ts +8 -0
- package/src/core/collection/table/RowFirstTable.d.ts.map +1 -1
- package/src/core/collection/table/RowFirstTable.js +40 -11
- package/src/engine/graphics/ecs/sprite/Sprite.d.ts +3 -0
- package/src/engine/graphics/ecs/sprite/Sprite.d.ts.map +1 -1
- package/src/engine/graphics/ecs/sprite/Sprite.js +3 -0
- package/src/engine/graphics/ecs/sprite/SpriteSystemPE.d.ts +3 -0
- package/src/engine/graphics/ecs/sprite/SpriteSystemPE.d.ts.map +1 -1
- package/src/engine/graphics/ecs/sprite/SpriteSystemPE.js +3 -0
- package/src/engine/physics/fluid/ecs/FluidObstacleSystem.d.ts +4 -4
- package/src/shade/device/mock/SoftwareGPURenderPassEncoder.d.ts +20 -3
- package/src/shade/device/mock/SoftwareGPURenderPassEncoder.d.ts.map +1 -1
- package/src/shade/device/mock/SoftwareGPURenderPassEncoder.js +21 -3
- package/src/shade/renderer/GraphicsContext.d.ts +11 -0
- package/src/shade/renderer/GraphicsContext.d.ts.map +1 -1
- package/src/shade/renderer/GraphicsContext.js +52 -38
- package/src/shade/renderer/buffer/GPUBufferReadbackAllocator.d.ts +6 -5
- package/src/shade/renderer/buffer/GPUBufferReadbackAllocator.d.ts.map +1 -1
- package/src/shade/renderer/buffer/GPUBufferReadbackAllocator.js +241 -240
- package/src/shade/renderer/buffer/GPUBufferStagingAllocator.d.ts +51 -0
- package/src/shade/renderer/buffer/GPUBufferStagingAllocator.d.ts.map +1 -1
- package/src/shade/renderer/buffer/GPUBufferStagingAllocator.js +214 -28
- package/src/shade/renderer/dynamic/DynamicMeshAVBOITChannel.d.ts +2 -1
- package/src/shade/renderer/dynamic/DynamicMeshAVBOITChannel.d.ts.map +1 -1
- package/src/shade/renderer/dynamic/DynamicMeshAVBOITChannel.js +19 -17
- package/src/shade/renderer/dynamic/GPUDynamicMeshDrawList.d.ts +70 -0
- package/src/shade/renderer/dynamic/GPUDynamicMeshDrawList.d.ts.map +1 -0
- package/src/shade/renderer/dynamic/GPUDynamicMeshDrawList.js +257 -0
- package/src/shade/renderer/dynamic/GPUDynamicMeshRenderer.d.ts.map +1 -1
- package/src/shade/renderer/dynamic/GPUDynamicMeshRenderer.js +19 -34
- package/src/shade/renderer/dynamic/GPUDynamicMeshResidency.d.ts +6 -20
- package/src/shade/renderer/dynamic/GPUDynamicMeshResidency.d.ts.map +1 -1
- package/src/shade/renderer/dynamic/GPUDynamicMeshResidency.js +42 -36
- package/src/shade/renderer/dynamic/chunk_dynamic_mesh_avboit_vertex.d.ts +2 -1
- package/src/shade/renderer/dynamic/chunk_dynamic_mesh_avboit_vertex.d.ts.map +1 -1
- package/src/shade/renderer/dynamic/chunk_dynamic_mesh_avboit_vertex.js +4 -3
- package/src/shade/renderer/dynamic/chunk_dynamic_mesh_vertex.d.ts +4 -3
- package/src/shade/renderer/dynamic/chunk_dynamic_mesh_vertex.d.ts.map +1 -1
- package/src/shade/renderer/dynamic/chunk_dynamic_mesh_vertex.js +7 -4
- package/src/shade/renderer/dynamic/graph_dynamic_mesh_avboit.d.ts +14 -15
- package/src/shade/renderer/dynamic/graph_dynamic_mesh_avboit.d.ts.map +1 -1
- package/src/shade/renderer/dynamic/graph_dynamic_mesh_avboit.js +49 -83
- package/src/shade/renderer/dynamic/shader_dynamic_mesh.d.ts +19 -3
- package/src/shade/renderer/dynamic/shader_dynamic_mesh.d.ts.map +1 -1
- package/src/shade/renderer/dynamic/shader_dynamic_mesh.js +26 -6
- package/src/shade/renderer/dynamic/shader_dynamic_mesh_avboit_draw.d.ts +2 -1
- package/src/shade/renderer/dynamic/shader_dynamic_mesh_avboit_draw.d.ts.map +1 -1
- package/src/shade/renderer/dynamic/shader_dynamic_mesh_avboit_draw.js +12 -6
- package/src/shade/renderer/dynamic/shader_dynamic_mesh_avboit_splat.d.ts +3 -2
- package/src/shade/renderer/dynamic/shader_dynamic_mesh_avboit_splat.d.ts.map +1 -1
- package/src/shade/renderer/dynamic/shader_dynamic_mesh_avboit_splat.js +21 -13
- package/src/shade/renderer/loader/gltf/tiny-gltf.d.ts +1 -1
- package/src/shade/renderer/postprocess/nss/NSS.d.ts +1 -1
- package/src/shade/renderer/rasterize/native/avboit/AVBOIT_LEDGER.md +20 -0
- package/src/shade/renderer/shader/type/serde/write_gpu_typed_buffer.d.ts.map +1 -1
- package/src/shade/renderer/shader/type/serde/write_gpu_typed_buffer.js +8 -1
package/package.json
CHANGED
|
@@ -70,7 +70,14 @@ export class RowFirstTable {
|
|
|
70
70
|
*/
|
|
71
71
|
trim(): void;
|
|
72
72
|
/**
|
|
73
|
+
* Fit capacity to `row_count` rows: grow if they do not fit, shrink if the table is much larger than they need.
|
|
73
74
|
*
|
|
75
|
+
* A shrink lands on the capacity a grow would pick, and only happens once {@link ALLOCATION_SHRINK_FACTOR} of the
|
|
76
|
+
* capacity would still exceed that, so the next row added or removed cannot undo either direction. Shrinking to
|
|
77
|
+
* exactly `row_count` whenever `capacity * ALLOCATION_SHRINK_FACTOR > row_count` overlapped the minimum grow step,
|
|
78
|
+
* and reallocated the whole table on every append below ~30 rows.
|
|
79
|
+
*
|
|
80
|
+
* NOTE: any reallocation replaces {@link data} and {@link dataView}
|
|
74
81
|
* @param {number} row_count
|
|
75
82
|
*/
|
|
76
83
|
resize(row_count: number): void;
|
|
@@ -178,6 +185,7 @@ export class RowFirstTable {
|
|
|
178
185
|
* @returns {boolean}
|
|
179
186
|
*/
|
|
180
187
|
equals(other: RowFirstTable): boolean;
|
|
188
|
+
#private;
|
|
181
189
|
}
|
|
182
190
|
export type RowFirstTableSpec = import("./RowFirstTableSpec.js").RowFirstTableSpec;
|
|
183
191
|
import Signal from "../../events/signal/Signal.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RowFirstTable.d.ts","sourceRoot":"","sources":["../../../../../src/core/collection/table/RowFirstTable.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"RowFirstTable.d.ts","sourceRoot":"","sources":["../../../../../src/core/collection/table/RowFirstTable.js"],"names":[],"mappings":"AAiDA;;;;;;;;GAQG;AACH;IAOI;;;;;OAKG;IACH,kBAJW,iBAAiB,iBACjB,OAAO,EA+CjB;IAxDD;;;OAGG;IACH,QAFU,MAAM,CAEL;IAkBP;;;OAGG;IACH,MAFU,iBAAiB,CAEX;IAEhB;;;OAGG;IACH,MAFU,WAAW,CAE4D;IAEjF;;;OAGG;IACH,UAFU,MAAM,CAEgB;IAEhC;;;OAGG;IACH,UAFU,QAAQ,CAEqB;IAEvC;;;OAGG;IACH,IAFU;QAAC,KAAK,EAAE,MAAM,CAAA;KAAC,CAOxB;IAIL;;;;;;OAMG;IACH,0DAMC;IAED;;;OAGG;IACH,QAFa,MAAM,CA4ClB;IAED;;;OAGG;IACH,sBAFW,MAAM,QAgDhB;IAED;;OAEG;IACH,aAEC;IAaD;;;;;;;;;;OAUG;IACH,kBAFW,MAAM,QAmBhB;IAED;;;;;OAKG;IACH,0BAJW,MAAM,gBACN,MAAM,SACN,MAAM,QAmBhB;IAED;;;;;OAKG;IACH,yBAJW,MAAM,gBACN,MAAM,GACJ,MAAM,CAmBlB;IAED;;;;OAIG;IACH,kBAHW,MAAM,aACN,MAAM,QAyBhB;IAED;;;;;;OAMG;IACH,kBAHW,MAAM,aACN,MAAM,QAwBhB;IAED;;;;;OAKG;IACH,kBAFY,MAAM,CAYjB;IAED;;;;OAIG;IACH,eAHW,MAAO,MAAM,CAAC,GACZ,MAAM,CAYlB;IAED;;;;OAIG;IACH,eAHW,MAAM,iBACN,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,MAAO,MAAM,CAAC,QAAM,QAIvD;IAED;;;;OAIG;IACH,gBAHW,MAAM,UACN,MAAM,QAwBhB;IAGD;;;;;OAKG;IACH,eAJW,MAAM,WACN,MAAM,EAAE,GACN,MAAM,EAAE,CAUpB;IAED;;;;OAIG;IACH,gBAHW,MAAM,UACN,MAAM,EAAE,QAUlB;IAED;;;;;;OAMG;IACH,gBAFW,MAAM,QAgBhB;IAED;;OAEG;IACH,qBA4BC;IAED;;OAEG;IACH,cAIC;IAED;;;;OAIG;IACH,cAFa,MAAM,EAAE,EAAE,CAetB;IAED;;;OAGG;IACH,uBAIC;IAED;;;;OAIG;IACH,YAFW,aAAa,QAqBvB;IAED;;;OAGG;IACH,cAHW,aAAa,GACX,OAAO,CAwCnB;;CACJ;gCA7oBY,OAAO,wBAAwB,EAAE,iBAAiB;mBAN5C,+BAA+B"}
|
|
@@ -28,11 +28,25 @@ const ALLOCATION_GROW_FACTOR = 1.5;
|
|
|
28
28
|
const ALLOCATION_GROW_MINIMUM_STEP = 32;
|
|
29
29
|
|
|
30
30
|
/**
|
|
31
|
-
* Must be less than 1 and greater than 0
|
|
31
|
+
* Must be less than 1 and greater than 0.
|
|
32
|
+
* A table shrinks once this fraction of its capacity would still exceed what a grow picks for the current row count,
|
|
33
|
+
* see {@link RowFirstTable#resize}
|
|
32
34
|
* @type {number}
|
|
33
35
|
*/
|
|
34
36
|
const ALLOCATION_SHRINK_FACTOR = 0.5;
|
|
35
37
|
|
|
38
|
+
/**
|
|
39
|
+
* Capacity a grow picks for `row_count` rows, and the capacity a shrink lands on
|
|
40
|
+
* @param {number} row_count
|
|
41
|
+
* @returns {number}
|
|
42
|
+
*/
|
|
43
|
+
function capacity_for_row_count(row_count) {
|
|
44
|
+
return Math.max(
|
|
45
|
+
Math.ceil(row_count * ALLOCATION_GROW_FACTOR),
|
|
46
|
+
row_count + ALLOCATION_GROW_MINIMUM_STEP
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
|
|
36
50
|
/**
|
|
37
51
|
* Compact binary table storage.
|
|
38
52
|
* Very efficient in terms of memory usage and allocation.
|
|
@@ -225,26 +239,41 @@ export class RowFirstTable {
|
|
|
225
239
|
}
|
|
226
240
|
|
|
227
241
|
/**
|
|
242
|
+
* Grow capacity to fit `row_count` rows if it does not already, never shrinks.
|
|
243
|
+
* What every operation that adds rows uses, so an append cannot undo a {@link setCapacity} reservation.
|
|
244
|
+
* @param {number} row_count
|
|
245
|
+
*/
|
|
246
|
+
#grow_to_fit(row_count) {
|
|
247
|
+
if (this.capacity < row_count) {
|
|
248
|
+
this.setCapacity(capacity_for_row_count(row_count));
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
/**
|
|
253
|
+
* Fit capacity to `row_count` rows: grow if they do not fit, shrink if the table is much larger than they need.
|
|
228
254
|
*
|
|
255
|
+
* A shrink lands on the capacity a grow would pick, and only happens once {@link ALLOCATION_SHRINK_FACTOR} of the
|
|
256
|
+
* capacity would still exceed that, so the next row added or removed cannot undo either direction. Shrinking to
|
|
257
|
+
* exactly `row_count` whenever `capacity * ALLOCATION_SHRINK_FACTOR > row_count` overlapped the minimum grow step,
|
|
258
|
+
* and reallocated the whole table on every append below ~30 rows.
|
|
259
|
+
*
|
|
260
|
+
* NOTE: any reallocation replaces {@link data} and {@link dataView}
|
|
229
261
|
* @param {number} row_count
|
|
230
262
|
*/
|
|
231
263
|
resize(row_count) {
|
|
232
264
|
assert.isNonNegativeInteger(row_count, 'row_count');
|
|
233
265
|
|
|
266
|
+
const fitted_capacity = capacity_for_row_count(row_count);
|
|
267
|
+
|
|
234
268
|
if (this.capacity < row_count) {
|
|
235
269
|
|
|
236
270
|
//grow
|
|
237
|
-
|
|
238
|
-
Math.ceil(row_count * ALLOCATION_GROW_FACTOR),
|
|
239
|
-
row_count + ALLOCATION_GROW_MINIMUM_STEP
|
|
240
|
-
);
|
|
241
|
-
|
|
242
|
-
this.setCapacity(new_size);
|
|
271
|
+
this.setCapacity(fitted_capacity);
|
|
243
272
|
|
|
244
|
-
} else if (this.capacity * ALLOCATION_SHRINK_FACTOR >
|
|
273
|
+
} else if (this.capacity * ALLOCATION_SHRINK_FACTOR > fitted_capacity) {
|
|
245
274
|
|
|
246
275
|
//shrink
|
|
247
|
-
this.setCapacity(
|
|
276
|
+
this.setCapacity(fitted_capacity);
|
|
248
277
|
|
|
249
278
|
}
|
|
250
279
|
|
|
@@ -343,7 +372,7 @@ export class RowFirstTable {
|
|
|
343
372
|
|
|
344
373
|
const future_length = this.length + row_count;
|
|
345
374
|
|
|
346
|
-
this
|
|
375
|
+
this.#grow_to_fit(future_length);
|
|
347
376
|
|
|
348
377
|
const data = this.data;
|
|
349
378
|
|
|
@@ -370,7 +399,7 @@ export class RowFirstTable {
|
|
|
370
399
|
createEmptyRow() {
|
|
371
400
|
const newRowCount = this.length + 1;
|
|
372
401
|
|
|
373
|
-
this
|
|
402
|
+
this.#grow_to_fit(newRowCount);
|
|
374
403
|
|
|
375
404
|
const rowIndex = this.length;
|
|
376
405
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Sprite.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/ecs/sprite/Sprite.js"],"names":[],"mappings":"AAGA;IACI,aAAS;IACT,YAAS;IACT,iBAAyB;IACzB,aAA2B;CAC9B;;;;
|
|
1
|
+
{"version":3,"file":"Sprite.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/ecs/sprite/Sprite.js"],"names":[],"mappings":"AAGA;;GAEG;AACH;IACI,aAAS;IACT,YAAS;IACT,iBAAyB;IACzB,aAA2B;CAC9B;;;;oBAXmB,kCAAkC;sBAChC,iCAAiC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SpriteSystemPE.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/ecs/sprite/SpriteSystemPE.js"],"names":[],"mappings":"AAsIA;IAGI,cAEC;IAJD,qDAAqC;CAKxC;
|
|
1
|
+
{"version":3,"file":"SpriteSystemPE.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/ecs/sprite/SpriteSystemPE.js"],"names":[],"mappings":"AAsIA;;GAEG;AACH;IAGI,cAEC;IAJD,qDAAqC;CAKxC;sCA5IqC,8CAA8C;4BAGxD,uCAAuC;uBAQ5C,aAAa"}
|
|
@@ -64,11 +64,11 @@ export class FluidObstacleSystem extends System<any> {
|
|
|
64
64
|
/**
|
|
65
65
|
* @param {FluidComponent} fluid
|
|
66
66
|
*/
|
|
67
|
-
static "__#
|
|
67
|
+
static "__#418@#refresh_masks"(fluid: FluidComponent): void;
|
|
68
68
|
/**
|
|
69
69
|
* @param {FluidComponent} fluid
|
|
70
70
|
*/
|
|
71
|
-
static "__#
|
|
71
|
+
static "__#418@#clear_field"(fluid: FluidComponent): void;
|
|
72
72
|
/**
|
|
73
73
|
* Mark every cell of `fluid` whose centre lies within `inflation` of the
|
|
74
74
|
* posed shape as solid. Iteration is clipped to the shape's world AABB
|
|
@@ -80,7 +80,7 @@ export class FluidObstacleSystem extends System<any> {
|
|
|
80
80
|
* @param {number} inflation world-units SDF threshold
|
|
81
81
|
* @param {Float64Array} point length-3 scratch
|
|
82
82
|
*/
|
|
83
|
-
static "__#
|
|
83
|
+
static "__#418@#voxelize"(fluid: FluidComponent, posed: PosedShape3D, aabb: Float64Array, inflation: number, point: Float64Array): void;
|
|
84
84
|
/**
|
|
85
85
|
* Write the obstacle's translation velocity onto every face of every cell
|
|
86
86
|
* it voxelized — the moving-wall boundary condition. Runs AFTER the mask
|
|
@@ -100,7 +100,7 @@ export class FluidObstacleSystem extends System<any> {
|
|
|
100
100
|
* @param {number} wvy
|
|
101
101
|
* @param {number} wvz
|
|
102
102
|
*/
|
|
103
|
-
static "__#
|
|
103
|
+
static "__#418@#stamp_wall_velocity"(fluid: FluidComponent, posed: PosedShape3D, aabb: Float64Array, inflation: number, point: Float64Array, wvx: number, wvy: number, wvz: number): void;
|
|
104
104
|
constructor();
|
|
105
105
|
dependencies: (typeof FluidObstacle)[];
|
|
106
106
|
components_used: (ResourceAccessSpecification<typeof Transform64> | ResourceAccessSpecification<typeof RigidBody> | ResourceAccessSpecification<typeof Collider> | ResourceAccessSpecification<typeof FluidComponent> | ResourceAccessSpecification<typeof FluidObstacle>)[];
|
|
@@ -27,7 +27,11 @@ export class SoftwareGPURenderPassEncoder extends SoftwareGPUObjectBase implemen
|
|
|
27
27
|
* `-1` rather than a number read out of a buffer nobody filled — the same admission
|
|
28
28
|
* {@link SoftwareGPUComputePassEncoder#dispatchWorkgroupsIndirect} makes.
|
|
29
29
|
*
|
|
30
|
-
*
|
|
30
|
+
* A direct draw also records where it starts — `first_vertex` and `first_instance`, or for an
|
|
31
|
+
* indexed one `first_index`, `base_vertex` and `first_instance` — with WebGPU's defaults of 0
|
|
32
|
+
* where they were left out. An indirect one records none of them: they are in the buffer too.
|
|
33
|
+
*
|
|
34
|
+
* @type {{pipeline: GPURenderPipeline|null, bind_groups: GPUBindGroup[], dynamic_offsets: number[][], vertex_buffers: object[], index_buffer: object|null, viewport: object|null, scissor: object|null, vertex_count: number, instance_count: number, first_vertex?: number, first_index?: number, base_vertex?: number, first_instance?: number, indexed: boolean, indirect: boolean}[]}
|
|
31
35
|
*/
|
|
32
36
|
draws: {
|
|
33
37
|
pipeline: GPURenderPipeline | null;
|
|
@@ -39,6 +43,10 @@ export class SoftwareGPURenderPassEncoder extends SoftwareGPUObjectBase implemen
|
|
|
39
43
|
scissor: object | null;
|
|
40
44
|
vertex_count: number;
|
|
41
45
|
instance_count: number;
|
|
46
|
+
first_vertex?: number;
|
|
47
|
+
first_index?: number;
|
|
48
|
+
base_vertex?: number;
|
|
49
|
+
first_instance?: number;
|
|
42
50
|
indexed: boolean;
|
|
43
51
|
indirect: boolean;
|
|
44
52
|
}[];
|
|
@@ -118,15 +126,24 @@ export class SoftwareGPURenderPassEncoder extends SoftwareGPUObjectBase implemen
|
|
|
118
126
|
setStencilReference(reference: number): void;
|
|
119
127
|
stencil_reference: number;
|
|
120
128
|
/**
|
|
129
|
+
* Where the draw starts is recorded with its counts: a direct draw's `instance_index` counts from
|
|
130
|
+
* `first_instance`, and a draw that picks its row of a table through it names that row nowhere
|
|
131
|
+
* else.
|
|
132
|
+
*
|
|
121
133
|
* @param {number} vertex_count
|
|
122
134
|
* @param {number} [instance_count]
|
|
135
|
+
* @param {number} [first_vertex]
|
|
136
|
+
* @param {number} [first_instance]
|
|
123
137
|
*/
|
|
124
|
-
draw(vertex_count: number, instance_count?: number): void;
|
|
138
|
+
draw(vertex_count: number, instance_count?: number, first_vertex?: number, first_instance?: number): void;
|
|
125
139
|
/**
|
|
126
140
|
* @param {number} index_count
|
|
127
141
|
* @param {number} [instance_count]
|
|
142
|
+
* @param {number} [first_index]
|
|
143
|
+
* @param {number} [base_vertex]
|
|
144
|
+
* @param {number} [first_instance]
|
|
128
145
|
*/
|
|
129
|
-
drawIndexed(index_count: number, instance_count?: number): void;
|
|
146
|
+
drawIndexed(index_count: number, instance_count?: number, first_index?: number, base_vertex?: number, first_instance?: number): void;
|
|
130
147
|
/**
|
|
131
148
|
* @param {GPUBuffer} indirect_buffer
|
|
132
149
|
* @param {number} indirect_offset
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SoftwareGPURenderPassEncoder.d.ts","sourceRoot":"","sources":["../../../../../src/shade/device/mock/SoftwareGPURenderPassEncoder.js"],"names":[],"mappings":"AAMA;;;;;;;;;;;;;;GAcG;AACH,mFAFgB,oBAAoB;
|
|
1
|
+
{"version":3,"file":"SoftwareGPURenderPassEncoder.d.ts","sourceRoot":"","sources":["../../../../../src/shade/device/mock/SoftwareGPURenderPassEncoder.js"],"names":[],"mappings":"AAMA;;;;;;;;;;;;;;GAcG;AACH,mFAFgB,oBAAoB;IAuFhC;;;OAGG;IACH,sFAQC;IAhGD;;;;;;;;;;;;;OAaG;IACH,OAFU;QAAC,QAAQ,EAAE,oBAAkB,IAAI,CAAC;QAAC,WAAW,EAAE,cAAc,CAAC;QAAC,eAAe,EAAE,MAAM,EAAE,EAAE,CAAC;QAAC,cAAc,EAAE,MAAM,EAAE,CAAC;QAAC,YAAY,EAAE,MAAM,GAAC,IAAI,CAAC;QAAC,QAAQ,EAAE,MAAM,GAAC,IAAI,CAAC;QAAC,OAAO,EAAE,MAAM,GAAC,IAAI,CAAC;QAAC,YAAY,EAAE,MAAM,CAAC;QAAC,cAAc,EAAE,MAAM,CAAC;QAAC,YAAY,CAAC,EAAE,MAAM,CAAC;QAAC,WAAW,CAAC,EAAE,MAAM,CAAC;QAAC,WAAW,CAAC,EAAE,MAAM,CAAC;QAAC,cAAc,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,OAAO,CAAC;QAAC,QAAQ,EAAE,OAAO,CAAA;KAAC,EAAE,CAE9W;IAEX;;;;;;OAMG;IACH,oCAAW;IAoDX;;;;OAIG;IACH,uBAEC;IAsBD;;OAEG;IACH,+CAIC;IAED;;;;;;;;OAQG;IACH,oBANW,MAAM,8CAEN,MAAM,EAAE,GAAC,WAAW,0BACpB,MAAM,2BACN,MAAM,QA0BhB;IAED;;;;;OAKG;IACH,4BALW,MAAM,QACN,WAAW,GAAC,eAAe,gBAC3B,MAAM,cACN,MAAM,QAUhB;IAED;;;;;OAKG;IACH,sBALW,MAAM,8BAEN,MAAM,SACN,MAAM,QAShB;IAED;;;;;OAKG;IACH,yEAHW,MAAM,SACN,MAAM,QAQhB;IAED;;;;;;;OAOG;IACH,eAPW,MAAM,KACN,MAAM,SACN,MAAM,UACN,MAAM,aACN,MAAM,aACN,MAAM,QAMhB;IAED;;;;;OAKG;IACH,kBALW,MAAM,KACN,MAAM,SACN,MAAM,UACN,MAAM,QAMhB;IAED;;OAEG;IACH,wCAIC;IADG,yBAA2B;IAG/B;;OAEG;IACH,+BAFW,MAAM,QAMhB;IADG,0BAAkC;IAwCtC;;;;;;;;;OASG;IACH,mBALW,MAAM,mBACN,MAAM,iBACN,MAAM,mBACN,MAAM,QAehB;IAED;;;;;;OAMG;IACH,yBANW,MAAM,mBACN,MAAM,gBACN,MAAM,gBACN,MAAM,mBACN,MAAM,QAgBhB;IAED;;;OAGG;IACH,0DAFW,MAAM,QAkBhB;IAED;;;OAGG;IACH,iEAFW,MAAM,QAiBhB;IAED;;OAEG;IACH,sBAFW,MAAM,QAIhB;IAED,sBAEC;IAED;;OAEG;IACH,yBAFW,MAAM,QAIhB;IAED,YAQC;IAGL;;;OAGG;IACH,yCAFU,OAAO,CAEoD;;CANpE;sCA3ZqC,4BAA4B"}
|
|
@@ -28,7 +28,11 @@ export class SoftwareGPURenderPassEncoder extends SoftwareGPUObjectBase {
|
|
|
28
28
|
* `-1` rather than a number read out of a buffer nobody filled — the same admission
|
|
29
29
|
* {@link SoftwareGPUComputePassEncoder#dispatchWorkgroupsIndirect} makes.
|
|
30
30
|
*
|
|
31
|
-
*
|
|
31
|
+
* A direct draw also records where it starts — `first_vertex` and `first_instance`, or for an
|
|
32
|
+
* indexed one `first_index`, `base_vertex` and `first_instance` — with WebGPU's defaults of 0
|
|
33
|
+
* where they were left out. An indirect one records none of them: they are in the buffer too.
|
|
34
|
+
*
|
|
35
|
+
* @type {{pipeline: GPURenderPipeline|null, bind_groups: GPUBindGroup[], dynamic_offsets: number[][], vertex_buffers: object[], index_buffer: object|null, viewport: object|null, scissor: object|null, vertex_count: number, instance_count: number, first_vertex?: number, first_index?: number, base_vertex?: number, first_instance?: number, indexed: boolean, indirect: boolean}[]}
|
|
32
36
|
*/
|
|
33
37
|
draws = [];
|
|
34
38
|
|
|
@@ -291,10 +295,16 @@ export class SoftwareGPURenderPassEncoder extends SoftwareGPUObjectBase {
|
|
|
291
295
|
}
|
|
292
296
|
|
|
293
297
|
/**
|
|
298
|
+
* Where the draw starts is recorded with its counts: a direct draw's `instance_index` counts from
|
|
299
|
+
* `first_instance`, and a draw that picks its row of a table through it names that row nowhere
|
|
300
|
+
* else.
|
|
301
|
+
*
|
|
294
302
|
* @param {number} vertex_count
|
|
295
303
|
* @param {number} [instance_count]
|
|
304
|
+
* @param {number} [first_vertex]
|
|
305
|
+
* @param {number} [first_instance]
|
|
296
306
|
*/
|
|
297
|
-
draw(vertex_count, instance_count = 1) {
|
|
307
|
+
draw(vertex_count, instance_count = 1, first_vertex = 0, first_instance = 0) {
|
|
298
308
|
this.#assert_encoding();
|
|
299
309
|
this.#validate_immediates();
|
|
300
310
|
|
|
@@ -302,6 +312,8 @@ export class SoftwareGPURenderPassEncoder extends SoftwareGPUObjectBase {
|
|
|
302
312
|
...this.#snapshot(),
|
|
303
313
|
vertex_count,
|
|
304
314
|
instance_count,
|
|
315
|
+
first_vertex,
|
|
316
|
+
first_instance,
|
|
305
317
|
indexed: false,
|
|
306
318
|
indirect: false,
|
|
307
319
|
});
|
|
@@ -310,8 +322,11 @@ export class SoftwareGPURenderPassEncoder extends SoftwareGPUObjectBase {
|
|
|
310
322
|
/**
|
|
311
323
|
* @param {number} index_count
|
|
312
324
|
* @param {number} [instance_count]
|
|
325
|
+
* @param {number} [first_index]
|
|
326
|
+
* @param {number} [base_vertex]
|
|
327
|
+
* @param {number} [first_instance]
|
|
313
328
|
*/
|
|
314
|
-
drawIndexed(index_count, instance_count = 1) {
|
|
329
|
+
drawIndexed(index_count, instance_count = 1, first_index = 0, base_vertex = 0, first_instance = 0) {
|
|
315
330
|
this.#assert_encoding();
|
|
316
331
|
this.#validate_immediates();
|
|
317
332
|
|
|
@@ -319,6 +334,9 @@ export class SoftwareGPURenderPassEncoder extends SoftwareGPUObjectBase {
|
|
|
319
334
|
...this.#snapshot(),
|
|
320
335
|
vertex_count: index_count,
|
|
321
336
|
instance_count,
|
|
337
|
+
first_index,
|
|
338
|
+
base_vertex,
|
|
339
|
+
first_instance,
|
|
322
340
|
indexed: true,
|
|
323
341
|
indirect: false,
|
|
324
342
|
});
|
|
@@ -111,6 +111,17 @@ export class GraphicsContext {
|
|
|
111
111
|
offset: number;
|
|
112
112
|
size: number;
|
|
113
113
|
}): void;
|
|
114
|
+
/**
|
|
115
|
+
* Set one bind group of `pipeline`'s layout, leaving the others as they are — for a pass whose
|
|
116
|
+
* groups change at different rates, where {@link setPipelineBindings} would set every group up
|
|
117
|
+
* to the last one on each change.
|
|
118
|
+
*
|
|
119
|
+
* @param {GPUBindingCommandsMixin} pass
|
|
120
|
+
* @param {PipelineDescriptorBase} pipeline
|
|
121
|
+
* @param {number} index the group's index in the pipeline's layout
|
|
122
|
+
* @param {GPUBindingResource[]} resources the group's entries, in binding order
|
|
123
|
+
*/
|
|
124
|
+
setPipelineBindGroup(pass: GPUBindingCommandsMixin, pipeline: PipelineDescriptorBase, index: number, resources: GPUBindingResource[]): void;
|
|
114
125
|
/**
|
|
115
126
|
*
|
|
116
127
|
* @param {BufferDescriptor} buffer_descriptor
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GraphicsContext.d.ts","sourceRoot":"","sources":["../../../../src/shade/renderer/GraphicsContext.js"],"names":[],"mappings":"AAmCA;
|
|
1
|
+
{"version":3,"file":"GraphicsContext.d.ts","sourceRoot":"","sources":["../../../../src/shade/renderer/GraphicsContext.js"],"names":[],"mappings":"AAmCA;IAqKI,yBAiCC;IArMD;;OAEG;IACH,YAFU,kBAAkB,CAEjB;IAEX;;OAEG;IACH,WAFU,kBAAkB,CAElB;IAOV;;OAEG;IACH,UAFU,iBAAiB,CAElB;IAET;;;OAGG;IACH,qDAOC;IAOD;;;OAGG;IACH,6CAEC;IAED;;OAEG;IACH,kBAFU,qBAAqB,CAEd;IAEjB;;OAEG;IACH,kBAFU,qBAAqB,CAEd;IAEjB;;OAEG;IACH,mBAFU,sBAAsB,CAEd;IAGlB;;OAEG;IACH,gBAFU,oBAAoB,CAEf;IAEf;;OAEG;IACH,UAFU,cAAc,CAEf;IAET;;;;OAIG;IACH,kBAFU,qBAAqB,CAEd;IAEjB;;OAEG;IACH,aAFU,gBAAgB,CAEd;IAQZ;;;OAGG;IACH,uBAFU,kBAAkB,CAEN;IAEtB;;;;OAIG;IACH,yBAFU,wBAAwB,CAEV;IAExB;;;;OAIG;IACH,0BAFU,yBAAyB,CAEV;IAEzB;;;;OAIG;IACH,yBAFU,wBAAwB,CAEV;IAExB;;;;OAIG;IACH,2BAFU,0BAA0B,CAEV;IAE1B;;;OAGG;IACH,oBAFU,mBAAmB,CAEV;IAUnB;;;OAGG;IACH,8BAEC;IAED,uBAQC;IAED;;;OAGG;IACH,wBAEC;IAqCD;;;;;;;;OAQG;IACH,6DANW,sBAAsB,aACtB,oBAAoB,EAAE,cACtB;QAAC,MAAM,EAAE,YAAY,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAC,QA2B9D;IAED;;;;;;;;;OASG;IACH,8DAJW,sBAAsB,SACtB,MAAM,aACN,oBAAoB,QA0C9B;IAED;;;;OAIG;IACH,gCAHW,gBAAgB,GACd,gBAAgB,CAI5B;IAED;;OAEG;IACH,+BAgBC;IAED,4BAEC;IAED,eAoDC;IAED,gBAoBC;IAGL;;;OAGG;IACH,4BAFU,OAAO,CAE0B;;CAN1C;+BArZY,OAAO,0CAA0C,EAAE,gBAAgB;qCACnE,OAAO,kDAAkD,EAAE,sBAAsB;2BAKjF,OAAO,mCAAmC,EAAE,YAAY;mCAjBlC,kCAAkC;mCAGlC,kCAAkC;kCADnC,wBAAwB;2CAEf,mDAAmD;oCAH1D,2CAA2C;sCAbzC,6CAA6C;sCAC7C,6CAA6C;uCAF5C,8CAA8C;qCAIhD,0CAA0C;+BAgBhD,6BAA6B;sCACtB,4CAA4C;iCAfjD,+BAA+B;mCAC7B,gCAAgC;yCAC1B,sCAAsC;0CAGrC,uCAAuC;yCACxC,sCAAsC;2CAFpC,wCAAwC;oCAS/C,kCAAkC;iCAVtB,8BAA8B"}
|
|
@@ -183,8 +183,9 @@ export class GraphicsContext {
|
|
|
183
183
|
increment_time() {
|
|
184
184
|
this.#timer_increment++;
|
|
185
185
|
|
|
186
|
-
// advance the single frame clock for the
|
|
186
|
+
// advance the single frame clock for the pools in lockstep
|
|
187
187
|
this.buffer_allocator_main.increment_time();
|
|
188
|
+
this.buffer_allocator_staging.increment_time();
|
|
188
189
|
this.buffer_allocator_upload.increment_time();
|
|
189
190
|
this.allocator_textures.increment_time();
|
|
190
191
|
}
|
|
@@ -257,53 +258,65 @@ export class GraphicsContext {
|
|
|
257
258
|
pass.setImmediates(0, immediate.buffer.raw_bytes, immediate.offset, immediate.size);
|
|
258
259
|
}
|
|
259
260
|
|
|
260
|
-
const bind_group_descriptors = pipeline.layout.bindGroupLayouts;
|
|
261
|
-
|
|
262
261
|
const bind_group_count = bindings.length;
|
|
263
262
|
|
|
264
|
-
assert.lessThanOrEqual(bind_group_count,
|
|
265
|
-
|
|
266
|
-
const bind_group_manager = this.bind_groups;
|
|
263
|
+
assert.lessThanOrEqual(bind_group_count, pipeline.layout.bindGroupLayouts.length, 'too many bind groups (more than in descriptor)');
|
|
267
264
|
|
|
268
265
|
for (let i = 0; i < bind_group_count; i++) {
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
const bind_group_layout_descriptor = bind_group_descriptors[i];
|
|
274
|
-
|
|
275
|
-
const descriptor = BindGroupDescriptor.from(
|
|
276
|
-
bind_group_layout_descriptor,
|
|
277
|
-
group_resource_set
|
|
278
|
-
);
|
|
279
|
-
|
|
280
|
-
const bind_group = bind_group_manager.obtain(descriptor);
|
|
266
|
+
this.setPipelineBindGroup(pass, pipeline, i, bindings[i]);
|
|
267
|
+
}
|
|
268
|
+
}
|
|
281
269
|
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
270
|
+
/**
|
|
271
|
+
* Set one bind group of `pipeline`'s layout, leaving the others as they are — for a pass whose
|
|
272
|
+
* groups change at different rates, where {@link setPipelineBindings} would set every group up
|
|
273
|
+
* to the last one on each change.
|
|
274
|
+
*
|
|
275
|
+
* @param {GPUBindingCommandsMixin} pass
|
|
276
|
+
* @param {PipelineDescriptorBase} pipeline
|
|
277
|
+
* @param {number} index the group's index in the pipeline's layout
|
|
278
|
+
* @param {GPUBindingResource[]} resources the group's entries, in binding order
|
|
279
|
+
*/
|
|
280
|
+
setPipelineBindGroup(pass, pipeline, index, resources) {
|
|
281
|
+
assert.isArray(resources, `bindings[${index}]`);
|
|
285
282
|
|
|
286
|
-
|
|
287
|
-
.map(e => {
|
|
288
|
-
if (e.buffer !== undefined) {
|
|
289
|
-
return `buffer:"${e.buffer.label}"`;
|
|
290
|
-
} else if (e instanceof GPUTextureView) {
|
|
291
|
-
return "texture_view"
|
|
292
|
-
} else if (e instanceof GPUSampler) {
|
|
293
|
-
return "sampler"
|
|
294
|
-
} else {
|
|
295
|
-
// something else
|
|
296
|
-
return "unknown";
|
|
297
|
-
}
|
|
283
|
+
const bind_group_descriptors = pipeline.layout.bindGroupLayouts;
|
|
298
284
|
|
|
299
|
-
|
|
300
|
-
.filter(e => e !== undefined);
|
|
285
|
+
assert.lessThan(index, bind_group_descriptors.length, 'index is past the last group in the descriptor');
|
|
301
286
|
|
|
302
|
-
|
|
303
|
-
}
|
|
287
|
+
const bind_group_manager = this.bind_groups;
|
|
304
288
|
|
|
305
|
-
|
|
289
|
+
const descriptor = BindGroupDescriptor.from(
|
|
290
|
+
bind_group_descriptors[index],
|
|
291
|
+
resources
|
|
292
|
+
);
|
|
293
|
+
|
|
294
|
+
const bind_group = bind_group_manager.obtain(descriptor);
|
|
295
|
+
|
|
296
|
+
if (DEBUG_LOGGING) {
|
|
297
|
+
// debug
|
|
298
|
+
const descriptor_rev = bind_group_manager.reverse_lookup(bind_group);
|
|
299
|
+
|
|
300
|
+
const entries = descriptor_rev.entries
|
|
301
|
+
.map(e => {
|
|
302
|
+
if (e.buffer !== undefined) {
|
|
303
|
+
return `buffer:"${e.buffer.label}"`;
|
|
304
|
+
} else if (e instanceof GPUTextureView) {
|
|
305
|
+
return "texture_view"
|
|
306
|
+
} else if (e instanceof GPUSampler) {
|
|
307
|
+
return "sampler"
|
|
308
|
+
} else {
|
|
309
|
+
// something else
|
|
310
|
+
return "unknown";
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
})
|
|
314
|
+
.filter(e => e !== undefined);
|
|
315
|
+
|
|
316
|
+
console.log(`pass.setBindGrpup(${index}, [ ${entries.join(', ')} ])`);
|
|
306
317
|
}
|
|
318
|
+
|
|
319
|
+
pass.setBindGroup(index, bind_group);
|
|
307
320
|
}
|
|
308
321
|
|
|
309
322
|
/**
|
|
@@ -390,6 +403,7 @@ export class GraphicsContext {
|
|
|
390
403
|
}
|
|
391
404
|
|
|
392
405
|
this.buffer_allocator_main.update();
|
|
406
|
+
this.buffer_allocator_staging.update();
|
|
393
407
|
this.buffer_allocator_upload.update();
|
|
394
408
|
}
|
|
395
409
|
|
|
@@ -2,11 +2,12 @@
|
|
|
2
2
|
* Persistent `MAP_READ | COPY_DST` buffers for reading GPU data back — {@link GPUBufferStagingAllocator}
|
|
3
3
|
* run the other way.
|
|
4
4
|
*
|
|
5
|
-
* The same shape
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
5
|
+
* The same shape: a size-sorted free list, `get(min_size)` serving the smallest buffer that fits
|
|
6
|
+
* and creating one when none does, `release(buffer)` putting it back. Where the staging pool re-maps
|
|
7
|
+
* a buffer on release because the next writer needs it mapped, this one *unmaps*, because the next
|
|
8
|
+
* copy into it needs it unmapped; the mapping is the holder's, taken after the copy has landed and
|
|
9
|
+
* read at the holder's own apply point. Unlike the staging pool, this one has no bound on how much
|
|
10
|
+
* larger than the request a buffer it serves may be, no size classes and no reclaim.
|
|
10
11
|
*
|
|
11
12
|
* Why not `buffer_allocator_main`: `TransientResourcePool`'s reuse safety rests on transients being
|
|
12
13
|
* GPU-only, and a readback buffer is held by the CPU across frames.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GPUBufferReadbackAllocator.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/buffer/GPUBufferReadbackAllocator.js"],"names":[],"mappings":"AAoCA
|
|
1
|
+
{"version":3,"file":"GPUBufferReadbackAllocator.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/buffer/GPUBufferReadbackAllocator.js"],"names":[],"mappings":"AAoCA;;;;;;;;;;;;;;;;;;;GAmBG;AACH;IA4BI;;;;OAIG;IACH;QAF4B,YAAY,GAA7B,MAAM;OAQhB;IAED;;;OAGG;IACH,+BAEC;IAED;;;OAGG;IACH,8BAEC;IAED;;;OAGG;IACH,6BAEC;IAED;;;OAGG;IACH,0BAEC;IAED;;;;;;OAMG;IACH,oBAHW,MAAM,aAkChB;IAED;;;;;OAKG;IACH,iCAsBC;IAED;;;;;OAKG;IACH,iCAMC;IAkBD,gBAUC;;CACJ"}
|