@swf2es/render 0.1.32 → 0.1.34

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.
Files changed (48) hide show
  1. package/dist/commands.d.ts +2 -1
  2. package/dist/commands.d.ts.map +1 -1
  3. package/dist/commands.js +2 -1
  4. package/dist/commands.js.map +1 -1
  5. package/dist/geometry.d.ts +11 -3
  6. package/dist/geometry.d.ts.map +1 -1
  7. package/dist/geometry.js +13 -0
  8. package/dist/geometry.js.map +1 -1
  9. package/dist/index.d.ts +2 -1
  10. package/dist/index.d.ts.map +1 -1
  11. package/dist/index.js +2 -1
  12. package/dist/index.js.map +1 -1
  13. package/dist/plan.js +1 -1
  14. package/dist/plan.js.map +1 -1
  15. package/dist/registry.d.ts +4 -0
  16. package/dist/registry.d.ts.map +1 -1
  17. package/dist/registry.js +8 -0
  18. package/dist/registry.js.map +1 -1
  19. package/dist/rows.d.ts +4 -0
  20. package/dist/rows.d.ts.map +1 -1
  21. package/dist/rows.js +20 -0
  22. package/dist/rows.js.map +1 -1
  23. package/dist/scene.d.ts +30 -3
  24. package/dist/scene.d.ts.map +1 -1
  25. package/dist/scene.js +76 -3
  26. package/dist/scene.js.map +1 -1
  27. package/dist/spans.d.ts +27 -0
  28. package/dist/spans.d.ts.map +1 -0
  29. package/dist/spans.js +146 -0
  30. package/dist/spans.js.map +1 -0
  31. package/dist/webgl/atlas.d.ts.map +1 -1
  32. package/dist/webgl/atlas.js +8 -0
  33. package/dist/webgl/atlas.js.map +1 -1
  34. package/dist/webgl/backend.d.ts +10 -7
  35. package/dist/webgl/backend.d.ts.map +1 -1
  36. package/dist/webgl/backend.js +13 -26
  37. package/dist/webgl/backend.js.map +1 -1
  38. package/package.json +2 -2
  39. package/src/commands.ts +2 -1
  40. package/src/geometry.ts +18 -3
  41. package/src/index.ts +2 -0
  42. package/src/plan.ts +1 -1
  43. package/src/registry.ts +10 -0
  44. package/src/rows.ts +24 -0
  45. package/src/scene.ts +82 -3
  46. package/src/spans.ts +223 -0
  47. package/src/webgl/atlas.ts +9 -0
  48. package/src/webgl/backend.ts +13 -39
package/src/geometry.ts CHANGED
@@ -71,9 +71,10 @@ export interface GeometryData {
71
71
  glyphs?: { vertices: Float32Array; mode: Float32Array; table: Float32Array };
72
72
  indices: Uint32Array;
73
73
  /**
74
- * No part of it over another: a bitmap's quad, or one fill's triangles.
75
- * Alone in a blend mode's layer, such a geometry is drawn straight onto
76
- * what is below it, as blending it pixel by pixel blends each pixel once.
74
+ * No part of it over another: a bitmap's quad, one fill's triangles, or
75
+ * fills found to meet without overlapping (markFlat). Alone in a blend
76
+ * mode's layer, such a geometry is drawn straight onto what is below it,
77
+ * as blending it pixel by pixel blends each pixel once.
77
78
  */
78
79
  flat?: boolean;
79
80
  }
@@ -94,6 +95,8 @@ export class Geometries extends Registry {
94
95
  added: number[] = [];
95
96
  /** Changed in place since the backend last took them (update). */
96
97
  updated: number[] = [];
98
+ /** Found flat since the backend last took them (markFlat). */
99
+ flattened: number[] = [];
97
100
 
98
101
  add(data: GeometryData): GeometryHandle {
99
102
  const handle = this.hold(IDLE_FRAMES);
@@ -115,6 +118,18 @@ export class Geometries extends Registry {
115
118
  }
116
119
  }
117
120
 
121
+ /**
122
+ * Geometry `id` found flat (GeometryData.flat) after it was added, for
123
+ * the backend to draw it so: its flag alone taken again, not its vertices.
124
+ */
125
+ markFlat(id: number): void {
126
+ const data = this.data[id];
127
+ if (data && !data.flat) {
128
+ data.flat = true;
129
+ this.flattened.push(id);
130
+ }
131
+ }
132
+
118
133
  private measure(id: number): void {
119
134
  const data = this.data[id] as GeometryData;
120
135
  if (id * 4 >= this.boxes.length) {
package/src/index.ts CHANGED
@@ -52,6 +52,7 @@ export {
52
52
  ALPHA,
53
53
  ALPHA_MASK,
54
54
  BLEND_NAMES,
55
+ blendsDirect,
55
56
  CLAMP,
56
57
  DARKEN,
57
58
  DIFFERENCE,
@@ -85,4 +86,5 @@ export {
85
86
  WHOLE_ALIASED,
86
87
  WHOLE_SMOOTH,
87
88
  } from "./scene.js";
89
+ export { firstDifference, type Span, spanDifference } from "./spans.js";
88
90
  export { KEEP_FRAMES, type TextureData, type TextureHandle, Textures } from "./textures.js";
package/src/plan.ts CHANGED
@@ -156,7 +156,7 @@ function emit(scene: SceneList, from: number, to: number, out: Commands, stage:
156
156
  out.push(
157
157
  LAYER_PUSH,
158
158
  layerParams(out, scene, scene.geometry[i]),
159
- scene.pads[scene.geometry[i]] >= 0 ? 1 : 0,
159
+ scene.pads[scene.geometry[i]] >= 0 ? 1 : scene.groups[scene.geometry[i]] ? 2 : 0,
160
160
  );
161
161
  break;
162
162
  }
package/src/registry.ts CHANGED
@@ -40,6 +40,11 @@ export class Registry {
40
40
  return this.held[id] === true;
41
41
  }
42
42
 
43
+ /** The generation `id` has, or had when it was last let go of; 0 for one never handed out. */
44
+ generation(id: number): number {
45
+ return this.generations[id] ?? 0;
46
+ }
47
+
43
48
  /** How many ids there have been, the free ones among them. */
44
49
  get size(): number {
45
50
  return this.held.length;
@@ -68,6 +73,11 @@ export class Registry {
68
73
  }
69
74
  }
70
75
 
76
+ /** The frame `id` was last used in. */
77
+ usedIn(id: number): number {
78
+ return this.usedAt[id] ?? -1;
79
+ }
80
+
71
81
  /** `id` used this frame. */
72
82
  use(id: number): void {
73
83
  this.usedAt[id] = this.frame;
package/src/rows.ts CHANGED
@@ -17,6 +17,30 @@ export class Rows {
17
17
  this.count = 0;
18
18
  }
19
19
 
20
+ /** The rows from `count` on taken off, as rows written only to be compared are. */
21
+ truncate(count: number): void {
22
+ this.count = count;
23
+ }
24
+
25
+ /** Rows `first` to `end` of `from` written after these, as they were: the index of the first. */
26
+ append(from: Rows, first: number, end: number): number {
27
+ const row = this.count;
28
+ this.count += end - first;
29
+ if (this.count * ROW_FLOATS > this.data.length) {
30
+ let length = this.data.length * 2;
31
+ while (this.count * ROW_FLOATS > length) {
32
+ length *= 2;
33
+ }
34
+
35
+ const grown = new Float32Array(length);
36
+ grown.set(this.data.subarray(0, row * ROW_FLOATS));
37
+ this.data = grown;
38
+ }
39
+
40
+ this.data.set(from.data.subarray(first * ROW_FLOATS, end * ROW_FLOATS), row * ROW_FLOATS);
41
+ return row;
42
+ }
43
+
20
44
  /**
21
45
  * A row for the transform at `places[at]`, a b c d tx ty: numbers a
22
46
  * caller keeps in a typed array, so that none are boxed passing them.
package/src/scene.ts CHANGED
@@ -31,6 +31,29 @@ export const KERNEL = 14;
31
31
  */
32
32
  export const ALPHA_MASK = -2;
33
33
 
34
+ /**
35
+ * Whether a layer of one flat geometry (GeometryData.flat) in blend mode
36
+ * `mode` may be drawn straight onto what is below instead: each pixel's
37
+ * blend of what covers it in part then is that of its layer's pixel, as
38
+ * adl's is (WebGLBackend.blendDirect).
39
+ */
40
+ export function blendsDirect(mode: number): boolean {
41
+ switch (mode) {
42
+ case ADD:
43
+ case SCREEN:
44
+ case MULTIPLY:
45
+ case LIGHTEN:
46
+ case DARKEN:
47
+ case DIFFERENCE:
48
+ case OVERLAY:
49
+ case HARDLIGHT:
50
+ case INVERT:
51
+ return true;
52
+ default:
53
+ return false;
54
+ }
55
+ }
56
+
34
57
  /** Flash's blend mode names, by their number here. */
35
58
  export const BLEND_NAMES = [
36
59
  "normal",
@@ -149,6 +172,12 @@ export class SceneList {
149
172
  * from its corner: NO_WHOLE, WHOLE_SMOOTH or WHOLE_ALIASED.
150
173
  */
151
174
  wholes = new Uint8Array(16);
175
+ /**
176
+ * Whether each layer is drawn as a layer whatever it holds, never straight
177
+ * onto what is below (WebGLBackend.blendDirect): a blend over what Flash
178
+ * keeps a bitmap of, which it blends as one picture.
179
+ */
180
+ groups = new Uint8Array(16);
152
181
  /**
153
182
  * Each whole layer's object, Flash's bitmap of it, uncut by the target:
154
183
  * x, y, width and height in target pixels, as measureLayers finds it.
@@ -177,14 +206,62 @@ export class SceneList {
177
206
  this.push(DRAW, geometry, row, blend, texture, sampler);
178
207
  }
179
208
 
209
+ /**
210
+ * Entries `first` to `end` of `from`, draws alone, written after these as
211
+ * they were, each naming its row `rowShift` on: a span a frame before
212
+ * wrote, its rows put elsewhere (docs/renderer.md, "Spans"). A boundary
213
+ * names layers and draws by number, which a span does not move yet.
214
+ */
215
+ appendDraws(from: SceneList, first: number, end: number, rowShift: number): void {
216
+ const at = this.length;
217
+ const length = at + end - first;
218
+ while (length > this.geometry.length) {
219
+ this.geometry = grow(this.geometry);
220
+ this.row = grow(this.row);
221
+ this.blend = grow(this.blend);
222
+ this.texture = grow(this.texture);
223
+ this.sampler = grow(this.sampler);
224
+ this.kind = grow(this.kind);
225
+ }
226
+
227
+ const kinds = from.kind;
228
+ const rows = from.row;
229
+ const row = this.row;
230
+ for (let e = first, to = at; e < end; e++, to++) {
231
+ if (kinds[e] !== DRAW) {
232
+ throw new Error(`entry ${e} of a span is no draw, which a span cannot move`);
233
+ }
234
+
235
+ row[to] = rows[e] + rowShift;
236
+ }
237
+
238
+ this.kind.fill(DRAW, at, length);
239
+ this.geometry.set(from.geometry.subarray(first, end), at);
240
+ this.blend.set(from.blend.subarray(first, end), at);
241
+ this.texture.set(from.texture.subarray(first, end), at);
242
+ this.sampler.set(from.sampler.subarray(first, end), at);
243
+ this.length = length;
244
+ }
245
+
246
+ /**
247
+ * The entries from `length` on taken off, as draws written only to be
248
+ * compared are: draws alone, as a layer begun among them would stay
249
+ * counted.
250
+ */
251
+ truncate(length: number): void {
252
+ this.length = length;
253
+ }
254
+
180
255
  /**
181
256
  * A layer begun, padded for its filters (or -1), over whole units as
182
- * `whole` says (wholes), its rectangle none till measured (layerRect):
183
- * its number.
257
+ * `whole` says (wholes), drawn as a layer whatever it holds where
258
+ * `grouped` (groups), its rectangle none till measured (layerRect): its
259
+ * number.
184
260
  */
185
- layerBegin(padding = -1, keep = -1, whole = NO_WHOLE): number {
261
+ layerBegin(padding = -1, keep = -1, whole = NO_WHOLE, grouped = false): number {
186
262
  const layer = this.newLayer(padding, keep);
187
263
  this.wholes[layer] = whole;
264
+ this.groups[layer] = grouped ? 1 : 0;
188
265
  this.push(LAYER_BEGIN, layer, 0, 0, -1, 0);
189
266
  this.open.push(layer);
190
267
  return layer;
@@ -214,6 +291,7 @@ export class SceneList {
214
291
  this.layers = grow(this.layers);
215
292
  this.pads = grow(this.pads);
216
293
  this.wholes = grow(this.wholes);
294
+ this.groups = grow(this.groups);
217
295
  const objects = new Float64Array(this.objects.length * 2);
218
296
  objects.set(this.objects);
219
297
  this.objects = objects;
@@ -226,6 +304,7 @@ export class SceneList {
226
304
 
227
305
  this.pads[layer] = padding;
228
306
  this.wholes[layer] = NO_WHOLE;
307
+ this.groups[layer] = 0;
229
308
  this.keeps[layer] = keep;
230
309
  this.parents[layer] = this.open.at(-1) ?? -1;
231
310
  this.layerRect(layer, 0, 0, 0, 0);
package/src/spans.ts ADDED
@@ -0,0 +1,223 @@
1
+ // Spans of a scene list compared (docs/renderer.md, "Spans"): the view's
2
+ // checked mode walks what a span it kept from a frame before stands for,
3
+ // and has this say, entry for entry and row for row, where the two differ.
4
+ import { ROW_FLOATS, type Rows } from "./rows.js";
5
+ import {
6
+ BLEND_NAMES,
7
+ DRAW,
8
+ KEPT,
9
+ LAYER_BEGIN,
10
+ LAYER_END,
11
+ MASK_BEGIN,
12
+ MASK_POP,
13
+ MASK_USE,
14
+ type SceneList,
15
+ } from "./scene.js";
16
+
17
+ /** A stretch of a scene list's entries, and of the rows they name, that one subtree wrote. */
18
+ export interface Span {
19
+ first: number;
20
+ end: number;
21
+ rowsFirst: number;
22
+ rowsEnd: number;
23
+ }
24
+
25
+ /** A row's floats by name (rows.ts), the two after the translation unused. */
26
+ const ROW_NAMES = [
27
+ "a",
28
+ "b",
29
+ "c",
30
+ "d",
31
+ "tx",
32
+ "ty",
33
+ "pad 6",
34
+ "pad 7",
35
+ "rMul",
36
+ "gMul",
37
+ "bMul",
38
+ "aMul",
39
+ "rAdd",
40
+ "gAdd",
41
+ "bAdd",
42
+ "aAdd",
43
+ ];
44
+
45
+ const KIND_NAMES: Record<number, string> = {
46
+ [DRAW]: "draw",
47
+ [MASK_BEGIN]: "mask begin",
48
+ [MASK_USE]: "mask use",
49
+ [MASK_POP]: "mask pop",
50
+ [LAYER_BEGIN]: "layer begin",
51
+ [LAYER_END]: "layer end",
52
+ [KEPT]: "kept layer",
53
+ };
54
+
55
+ /** Whether two floats differ, NaN equal to itself, as the same sums make it. */
56
+ function differ(x: number, y: number): boolean {
57
+ return x !== y && !(Number.isNaN(x) && Number.isNaN(y));
58
+ }
59
+
60
+ /** Entry `e` of `scene` in words, its row from `rowsFirst` as the span counts it. */
61
+ function entry(scene: SceneList, e: number, rowsFirst: number): string {
62
+ const kind = scene.kind[e];
63
+ const row = scene.row[e];
64
+ const blend = scene.blend[e];
65
+ return `${KIND_NAMES[kind] ?? `kind ${kind}`} of geometry ${scene.geometry[e]}, row ${
66
+ kind === DRAW ? `${row - rowsFirst} of the span` : row
67
+ }, blend ${BLEND_NAMES[blend] ?? blend}, texture ${scene.texture[e]}, sampler ${scene.sampler[e]}`;
68
+ }
69
+
70
+ /** Whether entry `i` of span `a` and of span `b` differ, their rows counted from each span's first. */
71
+ function entriesDiffer(
72
+ aScene: SceneList,
73
+ i: number,
74
+ a: Span,
75
+ bScene: SceneList,
76
+ j: number,
77
+ b: Span,
78
+ ): boolean {
79
+ const kind = aScene.kind[i];
80
+ return (
81
+ kind !== bScene.kind[j] ||
82
+ aScene.geometry[i] !== bScene.geometry[j] ||
83
+ (kind === DRAW
84
+ ? aScene.row[i] - a.rowsFirst !== bScene.row[j] - b.rowsFirst
85
+ : aScene.row[i] !== bScene.row[j]) ||
86
+ aScene.blend[i] !== bScene.blend[j] ||
87
+ aScene.texture[i] !== bScene.texture[j] ||
88
+ aScene.sampler[i] !== bScene.sampler[j]
89
+ );
90
+ }
91
+
92
+ /**
93
+ * The first entry and the first row, counted from each span's first, at
94
+ * which spans `a` and `b` differ, or -1 for none; past the shorter's end
95
+ * where only their lengths do.
96
+ */
97
+ export function firstDifference(
98
+ aScene: SceneList,
99
+ aRows: Rows,
100
+ a: Span,
101
+ bScene: SceneList,
102
+ bRows: Rows,
103
+ b: Span,
104
+ ): { entry: number; row: number } {
105
+ const entries = Math.min(a.end - a.first, b.end - b.first);
106
+ let entry = a.end - a.first === b.end - b.first ? -1 : entries;
107
+ for (let k = 0; k < entries; k++) {
108
+ if (entriesDiffer(aScene, a.first + k, a, bScene, b.first + k, b)) {
109
+ entry = k;
110
+ break;
111
+ }
112
+ }
113
+
114
+ const rows = Math.min(a.rowsEnd - a.rowsFirst, b.rowsEnd - b.rowsFirst);
115
+ let row = a.rowsEnd - a.rowsFirst === b.rowsEnd - b.rowsFirst ? -1 : rows;
116
+ for (let k = 0; k < rows && (row < 0 || k < row); k++) {
117
+ const i = (a.rowsFirst + k) * ROW_FLOATS;
118
+ const j = (b.rowsFirst + k) * ROW_FLOATS;
119
+ for (let f = 0; f < ROW_FLOATS; f++) {
120
+ if (differ(aRows.data[i + f], bRows.data[j + f])) {
121
+ row = k;
122
+ break;
123
+ }
124
+ }
125
+
126
+ if (row === k) {
127
+ break;
128
+ }
129
+ }
130
+
131
+ return { entry, row };
132
+ }
133
+
134
+ /**
135
+ * Where span `b` of `bScene` and `bRows` draws otherwise than span `a` of
136
+ * `aScene` and `aRows`, in words that name each by `aName` and `bName`:
137
+ * their lengths, their first entry and first row that differ, each in full,
138
+ * and how many do; null where they are alike, entry for entry and row for
139
+ * row. A draw's row is compared as the span counts it, from its first.
140
+ */
141
+ export function spanDifference(
142
+ aName: string,
143
+ aScene: SceneList,
144
+ aRows: Rows,
145
+ a: Span,
146
+ bName: string,
147
+ bScene: SceneList,
148
+ bRows: Rows,
149
+ b: Span,
150
+ ): string | null {
151
+ const entries = a.end - a.first;
152
+ const rows = a.rowsEnd - a.rowsFirst;
153
+ const bEntries = b.end - b.first;
154
+ const bRowCount = b.rowsEnd - b.rowsFirst;
155
+ const told: string[] = [];
156
+ if (entries !== bEntries || rows !== bRowCount) {
157
+ told.push(
158
+ `${aName} has ${entries} entries and ${rows} rows, ${bName} ${bEntries} entries and ${bRowCount} rows`,
159
+ );
160
+ }
161
+
162
+ let firstEntry = -1;
163
+ let entriesOff = 0;
164
+ for (let k = 0; k < Math.min(entries, bEntries); k++) {
165
+ if (entriesDiffer(aScene, a.first + k, a, bScene, b.first + k, b)) {
166
+ entriesOff++;
167
+ if (firstEntry < 0) {
168
+ firstEntry = k;
169
+ }
170
+ }
171
+ }
172
+
173
+ if (firstEntry >= 0) {
174
+ told.push(
175
+ `entry ${firstEntry} of the span (scene entry ${a.first + firstEntry} and ${
176
+ b.first + firstEntry
177
+ }) is a ${entry(aScene, a.first + firstEntry, a.rowsFirst)} in ${aName}, a ${entry(
178
+ bScene,
179
+ b.first + firstEntry,
180
+ b.rowsFirst,
181
+ )} in ${bName}; ${entriesOff} of ${Math.min(entries, bEntries)} entries differ`,
182
+ );
183
+ }
184
+
185
+ let firstRow = -1;
186
+ let rowsOff = 0;
187
+ const fields: string[] = [];
188
+ const aData = aRows.data;
189
+ const bData = bRows.data;
190
+ for (let k = 0; k < Math.min(rows, bRowCount); k++) {
191
+ const i = (a.rowsFirst + k) * ROW_FLOATS;
192
+ const j = (b.rowsFirst + k) * ROW_FLOATS;
193
+ let off = false;
194
+ for (let f = 0; f < ROW_FLOATS; f++) {
195
+ if (differ(aData[i + f], bData[j + f])) {
196
+ off = true;
197
+ if (firstRow < 0) {
198
+ fields.push(`${ROW_NAMES[f]} ${aData[i + f]} against ${bData[j + f]}`);
199
+ }
200
+ }
201
+ }
202
+
203
+ if (off) {
204
+ rowsOff++;
205
+ if (firstRow < 0) {
206
+ firstRow = k;
207
+ }
208
+ }
209
+ }
210
+
211
+ if (firstRow >= 0) {
212
+ told.push(
213
+ `row ${firstRow} of the span (row ${a.rowsFirst + firstRow} and ${
214
+ b.rowsFirst + firstRow
215
+ }) has ${fields.join(", ")} in ${aName} and ${bName}; ${rowsOff} of ${Math.min(
216
+ rows,
217
+ bRowCount,
218
+ )} rows differ`,
219
+ );
220
+ }
221
+
222
+ return told.length > 0 ? told.join("; ") : null;
223
+ }
@@ -273,6 +273,15 @@ export class GeometryAtlas {
273
273
  }
274
274
 
275
275
  geometries.updated.length = 0;
276
+ // Found flat: what is added after reads it from its data.
277
+ for (const id of geometries.flattened) {
278
+ const place = this.places[id];
279
+ if (place) {
280
+ place.flat = geometries.get(id)?.flat === true;
281
+ }
282
+ }
283
+
284
+ geometries.flattened.length = 0;
276
285
  let vertices = 0;
277
286
  let indices = 0;
278
287
  let glyphVertices = 0;
@@ -17,19 +17,7 @@ import type { Filters } from "../filters.js";
17
17
  import type { Geometries } from "../geometry.js";
18
18
  import type { Keeps } from "../keeps.js";
19
19
  import type { Rows } from "../rows.js";
20
- import {
21
- ADD,
22
- DARKEN,
23
- DIFFERENCE,
24
- HARDLIGHT,
25
- INVERT,
26
- LIGHTEN,
27
- MULTIPLY,
28
- NORMAL,
29
- OVERLAY,
30
- SCREEN,
31
- type SceneList,
32
- } from "../scene.js";
20
+ import { blendsDirect, NORMAL, type SceneList } from "../scene.js";
33
21
  import type { Textures } from "../textures.js";
34
22
  import { GeometryAtlas } from "./atlas.js";
35
23
  import { Compositor, readsBelow } from "./composite.js";
@@ -46,24 +34,6 @@ import { type Layer, type Open, objectOf, type Target, TargetPool } from "./targ
46
34
 
47
35
  export type { Target } from "./targets.js";
48
36
 
49
- /** The blend modes a flat fill may be drawn in straight onto what is below (blendDirect). */
50
- function direct(mode: number): boolean {
51
- switch (mode) {
52
- case ADD:
53
- case SCREEN:
54
- case MULTIPLY:
55
- case LIGHTEN:
56
- case DARKEN:
57
- case DIFFERENCE:
58
- case OVERLAY:
59
- case HARDLIGHT:
60
- case INVERT:
61
- return true;
62
- default:
63
- return false;
64
- }
65
- }
66
-
67
37
  /**
68
38
  * Executes a frame's commands on a WebGL 2 context it owns, through one
69
39
  * cache of its state. Every geometry is copied once into an atlas of a
@@ -262,6 +232,7 @@ export class WebGLBackend {
262
232
  geometries.added.length = 0;
263
233
  geometries.removed.length = 0;
264
234
  geometries.updated.length = 0;
235
+ geometries.flattened.length = 0;
265
236
  if (this.gl.isContextLost()) {
266
237
  return;
267
238
  }
@@ -1131,13 +1102,16 @@ export class WebGLBackend {
1131
1102
 
1132
1103
  /**
1133
1104
  * The layer pushed at command `k` drawn straight onto the target below,
1134
- * if it may be: unfiltered and not kept, one run of a flat fill alone
1135
- * (Draws.blendable) drawn normally in it, and a mode whose blend of the
1136
- * fill pixel by pixel, its edges covering the pixels in part, is that
1137
- * of the layer's pixels covered alike, as each is linear in what covers it
1138
- * (add short of its sums' clamp); its colour on the quad's. A layer and its
1139
- * resolve and composite left out, what reads what is below copies it as
1140
- * the composite would. Whether it was.
1105
+ * if it may be: unfiltered, not grouped (SceneList.groups) and not kept,
1106
+ * one run of a flat geometry alone (Draws.blendable) drawn normally in
1107
+ * it, and a mode (blendsDirect) whose blend of the fill pixel by pixel,
1108
+ * its edges covering the pixels in part, is that of the layer's pixels
1109
+ * covered alike, as each is linear in what covers it (add short of its
1110
+ * sums' clamp); its colour on the quad's. Where fills of one shape meet
1111
+ * inside a pixel, each blended by what it covers there is as adl blends
1112
+ * them, not the pixel they make together, which a layer would blend. A
1113
+ * layer and its resolve and composite left out, what reads what is below
1114
+ * copies it as the composite would. Whether it was.
1141
1115
  */
1142
1116
  private blendDirect(commands: Commands, k: number, scene: SceneList, canvas: Open): boolean {
1143
1117
  const ops = commands.ops;
@@ -1152,7 +1126,7 @@ export class WebGLBackend {
1152
1126
  ops[run + 3] !== NORMAL ||
1153
1127
  ops[pop] !== LAYER_POP ||
1154
1128
  ops[pop + 3] >= 0 ||
1155
- !direct(ops[pop + 1]) ||
1129
+ !blendsDirect(ops[pop + 1]) ||
1156
1130
  !this.draws.blendable(scene, ops[run + 1])
1157
1131
  ) {
1158
1132
  return false;