@flighthq/scene2d-wgpu 0.5.1-next.973.788d3d7 → 0.6.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.
Files changed (194) hide show
  1. package/README.md +2 -2
  2. package/dist/.tsbuildinfo.contract +1 -0
  3. package/dist/.tsbuildinfo.runtime +1 -0
  4. package/dist/contract.d.ts +32 -34
  5. package/dist/contract.d.ts.map +1 -1
  6. package/dist/contract.js +32 -34
  7. package/dist/contract.js.map +1 -1
  8. package/dist/contract.scene2d-wgpu-types.d.ts +6 -0
  9. package/dist/contract.scene2d-wgpu-types.d.ts.map +1 -0
  10. package/dist/contract.scene2d-wgpu-types.js +2 -0
  11. package/dist/contract.scene2d-wgpu-types.js.map +1 -0
  12. package/dist/enableWgpuColorAdjustmentGuards.d.ts +3 -2
  13. package/dist/enableWgpuColorAdjustmentGuards.d.ts.map +1 -1
  14. package/dist/enableWgpuColorAdjustmentGuards.js +23 -14
  15. package/dist/enableWgpuColorAdjustmentGuards.js.map +1 -1
  16. package/dist/enableWgpuStrokePathTessellation.d.ts +1 -1
  17. package/dist/enableWgpuStrokePathTessellation.d.ts.map +1 -1
  18. package/dist/enableWgpuStrokePathTessellation.js +1 -6
  19. package/dist/enableWgpuStrokePathTessellation.js.map +1 -1
  20. package/dist/index.d.ts +23 -2
  21. package/dist/index.d.ts.map +1 -1
  22. package/dist/index.js +23 -2
  23. package/dist/index.js.map +1 -1
  24. package/dist/scene2DWgpuPipeline.d.ts +13 -0
  25. package/dist/scene2DWgpuPipeline.d.ts.map +1 -0
  26. package/dist/scene2DWgpuPipeline.js +59 -0
  27. package/dist/scene2DWgpuPipeline.js.map +1 -0
  28. package/dist/types/WgpuColorAdjustmentMaterialFeature.d.ts +2 -0
  29. package/dist/types/WgpuColorAdjustmentMaterialFeature.d.ts.map +1 -0
  30. package/dist/types/WgpuColorAdjustmentMaterialFeature.js +2 -0
  31. package/dist/types/WgpuColorAdjustmentMaterialFeature.js.map +1 -0
  32. package/dist/types/WgpuRenderStats.d.ts +12 -0
  33. package/dist/types/WgpuRenderStats.d.ts.map +1 -0
  34. package/dist/types/WgpuRenderStats.js +2 -0
  35. package/dist/types/WgpuRenderStats.js.map +1 -0
  36. package/dist/types/WgpuRichTextOverlay.d.ts +4 -0
  37. package/dist/types/WgpuRichTextOverlay.d.ts.map +1 -0
  38. package/dist/types/WgpuRichTextOverlay.js +2 -0
  39. package/dist/types/WgpuRichTextOverlay.js.map +1 -0
  40. package/dist/types/WgpuShapeMesh.d.ts +2 -0
  41. package/dist/types/WgpuShapeMesh.d.ts.map +1 -0
  42. package/dist/types/WgpuShapeMesh.js +2 -0
  43. package/dist/types/WgpuShapeMesh.js.map +1 -0
  44. package/dist/types/WgpuShapeRendererData.d.ts +17 -0
  45. package/dist/types/WgpuShapeRendererData.d.ts.map +1 -0
  46. package/dist/types/WgpuShapeRendererData.js +2 -0
  47. package/dist/types/WgpuShapeRendererData.js.map +1 -0
  48. package/dist/wgpuBitmapText.d.ts +2 -2
  49. package/dist/wgpuBitmapText.d.ts.map +1 -1
  50. package/dist/wgpuBitmapText.js +6 -6
  51. package/dist/wgpuBitmapText.js.map +1 -1
  52. package/dist/wgpuCache.d.ts +9 -6
  53. package/dist/wgpuCache.d.ts.map +1 -1
  54. package/dist/wgpuCache.js +17 -18
  55. package/dist/wgpuCache.js.map +1 -1
  56. package/dist/wgpuClip.d.ts +1 -1
  57. package/dist/wgpuClip.d.ts.map +1 -1
  58. package/dist/wgpuClip.js +2 -2
  59. package/dist/wgpuClip.js.map +1 -1
  60. package/dist/wgpuClipContours.d.ts +3 -1
  61. package/dist/wgpuClipContours.d.ts.map +1 -1
  62. package/dist/wgpuClipContours.js +7 -8
  63. package/dist/wgpuClipContours.js.map +1 -1
  64. package/dist/wgpuClipRectangle.d.ts +2 -1
  65. package/dist/wgpuClipRectangle.d.ts.map +1 -1
  66. package/dist/wgpuClipRectangle.js +4 -5
  67. package/dist/wgpuClipRectangle.js.map +1 -1
  68. package/dist/wgpuColorAdjustmentMaterialFeature.d.ts +1 -1
  69. package/dist/wgpuColorAdjustmentMaterialFeature.d.ts.map +1 -1
  70. package/dist/wgpuColorAdjustmentMaterialFeature.js +9 -13
  71. package/dist/wgpuColorAdjustmentMaterialFeature.js.map +1 -1
  72. package/dist/wgpuMeshShapeRenderer.d.ts +3 -2
  73. package/dist/wgpuMeshShapeRenderer.d.ts.map +1 -1
  74. package/dist/wgpuMeshShapeRenderer.js +9 -8
  75. package/dist/wgpuMeshShapeRenderer.js.map +1 -1
  76. package/dist/wgpuNode2D.d.ts +6 -3
  77. package/dist/wgpuNode2D.d.ts.map +1 -1
  78. package/dist/wgpuNode2D.js +20 -4
  79. package/dist/wgpuNode2D.js.map +1 -1
  80. package/dist/wgpuParticleEmitter2D.d.ts +4 -2
  81. package/dist/wgpuParticleEmitter2D.d.ts.map +1 -1
  82. package/dist/wgpuParticleEmitter2D.js +8 -8
  83. package/dist/wgpuParticleEmitter2D.js.map +1 -1
  84. package/dist/wgpuQuadBatch.d.ts +3 -3
  85. package/dist/wgpuQuadBatch.d.ts.map +1 -1
  86. package/dist/wgpuQuadBatch.js +6 -6
  87. package/dist/wgpuQuadBatch.js.map +1 -1
  88. package/dist/wgpuQuadBatchWriter.d.ts +9 -5
  89. package/dist/wgpuQuadBatchWriter.d.ts.map +1 -1
  90. package/dist/wgpuQuadBatchWriter.js +12 -8
  91. package/dist/wgpuQuadBatchWriter.js.map +1 -1
  92. package/dist/wgpuRasterShapeRenderer.d.ts +3 -2
  93. package/dist/wgpuRasterShapeRenderer.d.ts.map +1 -1
  94. package/dist/wgpuRasterShapeRenderer.js +41 -22
  95. package/dist/wgpuRasterShapeRenderer.js.map +1 -1
  96. package/dist/wgpuRenderStats.d.ts +2 -1
  97. package/dist/wgpuRenderStats.d.ts.map +1 -1
  98. package/dist/wgpuRenderStats.js.map +1 -1
  99. package/dist/wgpuRendererData.d.ts +2 -1
  100. package/dist/wgpuRendererData.d.ts.map +1 -1
  101. package/dist/wgpuRendererData.js +1 -1
  102. package/dist/wgpuRendererData.js.map +1 -1
  103. package/dist/wgpuRichText.d.ts +6 -3
  104. package/dist/wgpuRichText.d.ts.map +1 -1
  105. package/dist/wgpuRichText.js +67 -34
  106. package/dist/wgpuRichText.js.map +1 -1
  107. package/dist/wgpuScale9Mapper.d.ts +2 -1
  108. package/dist/wgpuScale9Mapper.d.ts.map +1 -1
  109. package/dist/wgpuScale9Mapper.js.map +1 -1
  110. package/dist/wgpuScale9Shape.d.ts +10 -5
  111. package/dist/wgpuScale9Shape.d.ts.map +1 -1
  112. package/dist/wgpuScale9Shape.js +54 -28
  113. package/dist/wgpuScale9Shape.js.map +1 -1
  114. package/dist/wgpuScale9Sprite.d.ts +3 -2
  115. package/dist/wgpuScale9Sprite.d.ts.map +1 -1
  116. package/dist/wgpuScale9Sprite.js +9 -10
  117. package/dist/wgpuScale9Sprite.js.map +1 -1
  118. package/dist/wgpuShape.d.ts +4 -3
  119. package/dist/wgpuShape.d.ts.map +1 -1
  120. package/dist/wgpuShape.js +7 -7
  121. package/dist/wgpuShape.js.map +1 -1
  122. package/dist/wgpuShapeData.d.ts +8 -3
  123. package/dist/wgpuShapeData.d.ts.map +1 -1
  124. package/dist/wgpuShapeData.js +12 -9
  125. package/dist/wgpuShapeData.js.map +1 -1
  126. package/dist/wgpuShapeMesh.d.ts +4 -2
  127. package/dist/wgpuShapeMesh.d.ts.map +1 -1
  128. package/dist/wgpuShapeMesh.js +9 -8
  129. package/dist/wgpuShapeMesh.js.map +1 -1
  130. package/dist/wgpuShapeRasterizer.d.ts +2 -1
  131. package/dist/wgpuShapeRasterizer.d.ts.map +1 -1
  132. package/dist/wgpuShapeRasterizer.js +3 -8
  133. package/dist/wgpuShapeRasterizer.js.map +1 -1
  134. package/dist/wgpuSprite.d.ts +3 -2
  135. package/dist/wgpuSprite.d.ts.map +1 -1
  136. package/dist/wgpuSprite.js +7 -8
  137. package/dist/wgpuSprite.js.map +1 -1
  138. package/dist/wgpuStandardMaterial.d.ts +2 -2
  139. package/dist/wgpuStandardMaterial.d.ts.map +1 -1
  140. package/dist/wgpuStandardMaterial.js +5 -5
  141. package/dist/wgpuStandardMaterial.js.map +1 -1
  142. package/dist/wgpuTextInput.d.ts +2 -1
  143. package/dist/wgpuTextInput.d.ts.map +1 -1
  144. package/dist/wgpuTextInput.js +6 -7
  145. package/dist/wgpuTextInput.js.map +1 -1
  146. package/dist/wgpuTextLabel.d.ts +3 -2
  147. package/dist/wgpuTextLabel.d.ts.map +1 -1
  148. package/dist/wgpuTextLabel.js +67 -35
  149. package/dist/wgpuTextLabel.js.map +1 -1
  150. package/dist/wgpuTilemap.d.ts +2 -2
  151. package/dist/wgpuTilemap.d.ts.map +1 -1
  152. package/dist/wgpuTilemap.js +6 -6
  153. package/dist/wgpuTilemap.js.map +1 -1
  154. package/dist/wgpuVelocity.d.ts +10 -7
  155. package/dist/wgpuVelocity.d.ts.map +1 -1
  156. package/dist/wgpuVelocity.js +89 -87
  157. package/dist/wgpuVelocity.js.map +1 -1
  158. package/package.json +31 -25
  159. package/src/contract.test.ts +13 -0
  160. package/src/enableWgpuColorAdjustmentGuards.test.ts +50 -28
  161. package/src/enableWgpuStrokePathTessellation.test.ts +4 -9
  162. package/src/scene2DWgpuPipeline.test.ts +53 -0
  163. package/src/wgpuBitmapText.test.ts +10 -10
  164. package/src/wgpuCache.test.ts +130 -168
  165. package/src/wgpuClip.test.ts +1 -1
  166. package/src/wgpuClipContours.test.ts +13 -6
  167. package/src/wgpuClipRectangle.test.ts +8 -8
  168. package/src/wgpuColorAdjustmentMaterialFeature.test.ts +20 -19
  169. package/src/wgpuMeshShapeRenderer.test.ts +51 -52
  170. package/src/wgpuNode2D.test.ts +14 -14
  171. package/src/wgpuParticleEmitter2D.test.ts +52 -45
  172. package/src/wgpuQuadBatch.test.ts +62 -60
  173. package/src/wgpuQuadBatchWriter.test.ts +76 -34
  174. package/src/wgpuRasterShapeRenderer.test.ts +95 -57
  175. package/src/wgpuRenderStats.test.ts +1 -1
  176. package/src/wgpuRendererData.test.ts +2 -2
  177. package/src/wgpuRichText.test.ts +109 -58
  178. package/src/wgpuScale9Mapper.test.ts +1 -1
  179. package/src/wgpuScale9Shape.test.ts +103 -62
  180. package/src/wgpuScale9Sprite.test.ts +31 -36
  181. package/src/wgpuShape.test.ts +111 -76
  182. package/src/wgpuShapeData.test.ts +96 -53
  183. package/src/wgpuShapeMesh.test.ts +39 -25
  184. package/src/wgpuShapeRasterizer.test.ts +11 -7
  185. package/src/wgpuSprite.test.ts +36 -27
  186. package/src/wgpuStandardMaterial.test.ts +9 -13
  187. package/src/wgpuTextInput.test.ts +9 -6
  188. package/src/wgpuTextLabel.test.ts +145 -88
  189. package/src/wgpuTilemap.test.ts +11 -11
  190. package/src/wgpuVelocity.test.ts +86 -86
  191. package/dist/scene2dWgpuPipeline.d.ts +0 -3
  192. package/dist/scene2dWgpuPipeline.d.ts.map +0 -1
  193. package/dist/scene2dWgpuPipeline.js +0 -40
  194. package/dist/scene2dWgpuPipeline.js.map +0 -1
@@ -1,16 +1,31 @@
1
- import { allocateEntity, finishEntity } from '@flighthq/entity/contract';
2
- import { createImageResource } from '@flighthq/image/contract';
1
+ import { allocateEntity } from '@flighthq/entity/contract';
2
+ import {
3
+ createImageResource,
4
+ registerTestImageDimensionResolver,
5
+ unregisterTestImageDimensionResolver,
6
+ } from '@flighthq/image/contract';
7
+ import type { HostImageCapability } from '@flighthq/image/contract';
3
8
  import { getWgpuRenderStateRuntime } from '@flighthq/render-wgpu/contract';
4
9
  import { createWgpuRenderStateForTest, installWgpuMock } from '@flighthq/render-wgpu/contract';
5
- import type { WgpuShapeRendererData } from '@flighthq/types/contract';
6
- import { EntityRuntimeKey } from '@flighthq/types/contract';
10
+ import type { CanvasSurface, HostCanvasCapability } from '@flighthq/surface/contract';
7
11
 
12
+ import type { WgpuShapeRendererData } from './contract.scene2d-wgpu-types.ts';
8
13
  import {
9
14
  acquireWgpuShapeRasterSurface,
10
15
  createWgpuShapeData,
11
16
  destroyWgpuShapeData,
12
17
  getWgpuShapeData,
13
- } from './wgpuShapeData';
18
+ } from './wgpuShapeData.ts';
19
+
20
+ // A test that wraps a host handle supplies the host: the resource measures through the registered
21
+ // resolver, and clearing after each test keeps this file from covering for another's missing one.
22
+ beforeEach(() => {
23
+ registerTestImageDimensionResolver();
24
+ });
25
+
26
+ afterEach(() => {
27
+ unregisterTestImageDimensionResolver();
28
+ });
14
29
 
15
30
  const destroySurface = vi.fn();
16
31
 
@@ -22,38 +37,55 @@ beforeEach(() => {
22
37
  destroySurface.mockReset();
23
38
  });
24
39
 
25
- function createTestRaster2DSurfaceProvider() {
40
+ function createTestSurface(width: number, height: number): CanvasSurface {
41
+ const canvas = document.createElement('canvas');
42
+ canvas.width = width;
43
+ canvas.height = height;
44
+ const context = canvas.getContext('2d')!;
45
+ return {
46
+ get width() {
47
+ return canvas.width;
48
+ },
49
+ set width(value: number) {
50
+ canvas.width = value;
51
+ },
52
+ get height() {
53
+ return canvas.height;
54
+ },
55
+ set height(value: number) {
56
+ canvas.height = value;
57
+ },
58
+ context,
59
+ } as unknown as CanvasSurface;
60
+ }
61
+
62
+ function createTestCanvasHost(): HostCanvasCapability {
63
+ return {
64
+ acquire: () => null,
65
+ create: () => null,
66
+ createSurface: createTestSurface,
67
+ destroySurface,
68
+ release() {},
69
+ };
70
+ }
71
+
72
+ function createTestImageHost(): HostImageCapability {
26
73
  return {
27
- [EntityRuntimeKey]: undefined,
28
- createRaster2DSurface(width: number, height: number) {
29
- const canvas = document.createElement('canvas');
30
- canvas.width = width;
31
- canvas.height = height;
32
- const context = canvas.getContext('2d')!;
33
- return {
34
- [EntityRuntimeKey]: undefined,
35
- get width() {
36
- return canvas.width;
37
- },
38
- set width(value: number) {
39
- canvas.width = value;
40
- },
41
- get height() {
42
- return canvas.height;
43
- },
44
- set height(value: number) {
45
- canvas.height = value;
46
- },
47
- context,
48
- image: createImageResource(canvas),
49
- };
74
+ createImageFromSurface(surface) {
75
+ return createImageResource((surface as unknown as { context: CanvasRenderingContext2D }).context.canvas);
50
76
  },
51
- destroyRaster2DSurface: destroySurface,
77
+ loadImageFromUrl: () => Promise.reject(new Error('not implemented')),
52
78
  };
53
79
  }
54
80
 
81
+ function setTestHosts(state: { canvasHost: unknown; imageHost: unknown }): void {
82
+ state.canvasHost = createTestCanvasHost();
83
+ state.imageHost = createTestImageHost();
84
+ }
85
+
55
86
  function emptyData(): WgpuShapeRendererData {
56
87
  const out = allocateEntity<WgpuShapeRendererData>();
88
+ out.image = null;
57
89
  out.surface = null;
58
90
  out.lastContentId = -1;
59
91
  out.lastPixelRatio = 0;
@@ -71,32 +103,40 @@ function emptyData(): WgpuShapeRendererData {
71
103
  colorScaleBiasUniformBuffers: [],
72
104
  colorScaleBiasBindGroups: [],
73
105
  };
74
- return finishEntity(out);
106
+ return out;
75
107
  }
76
108
 
77
109
  describe('acquireWgpuShapeRasterSurface', () => {
78
110
  it('allocates once and returns the same surface thereafter', () => {
79
- const provider = createTestRaster2DSurfaceProvider();
111
+ const canvasHost = createTestCanvasHost();
112
+ const imageHost = createTestImageHost();
80
113
  const data = emptyData();
81
- const first = acquireWgpuShapeRasterSurface(provider, data);
114
+ const first = acquireWgpuShapeRasterSurface(canvasHost, imageHost, data);
82
115
  expect(data.surface).toBe(first);
83
- expect(acquireWgpuShapeRasterSurface(provider, data)).toBe(first);
116
+ expect(acquireWgpuShapeRasterSurface(canvasHost, imageHost, data)).toBe(first);
84
117
  });
85
118
 
86
119
  it('wraps the canvas as an Image so the quad batch treats it like any other texture source', () => {
87
- const surface = acquireWgpuShapeRasterSurface(createTestRaster2DSurfaceProvider(), emptyData())!;
88
- expect(surface.image.source).toBe(surface.context.canvas);
89
- expect('canvas' in surface).toBe(false);
120
+ const canvasHost = createTestCanvasHost();
121
+ const imageHost = createTestImageHost();
122
+ const data = emptyData();
123
+ acquireWgpuShapeRasterSurface(canvasHost, imageHost, data);
124
+ const surface = data.surface!;
125
+ const image = data.image!;
126
+ expect(image.source).toBe((surface as unknown as { context: CanvasRenderingContext2D }).context.canvas);
90
127
  });
91
128
 
92
129
  it('preserves expected absence without caching it when the provider refuses', () => {
93
- const provider = {
94
- [EntityRuntimeKey]: undefined,
95
- createRaster2DSurface: () => null,
96
- destroyRaster2DSurface: destroySurface,
130
+ const canvasHost: HostCanvasCapability = {
131
+ acquire: () => null,
132
+ create: () => null,
133
+ createSurface: () => null,
134
+ destroySurface,
135
+ release() {},
97
136
  };
137
+ const imageHost = createTestImageHost();
98
138
  const data = emptyData();
99
- expect(acquireWgpuShapeRasterSurface(provider, data)).toBeNull();
139
+ expect(acquireWgpuShapeRasterSurface(canvasHost, imageHost, data)).toBeNull();
100
140
  expect(data.surface).toBeNull();
101
141
  });
102
142
  });
@@ -104,7 +144,7 @@ describe('acquireWgpuShapeRasterSurface', () => {
104
144
  describe('createWgpuShapeData', () => {
105
145
  it('allocates no canvas up front, so a mesh-only scene carries none', async () => {
106
146
  const state = await createWgpuRenderStateForTest();
107
- state.raster2DSurfaceProvider = createTestRaster2DSurfaceProvider();
147
+ setTestHosts(state);
108
148
  const data = getWgpuShapeData(createWgpuShapeData(state, {} as never))!;
109
149
  expect(data.surface).toBeNull();
110
150
  expect(data.meshes).toBeNull();
@@ -115,7 +155,7 @@ describe('createWgpuShapeData', () => {
115
155
  describe('destroyWgpuShapeData', () => {
116
156
  it('does nothing when the shape only ever tessellated, since there is no surface to free', async () => {
117
157
  const state = await createWgpuRenderStateForTest();
118
- state.raster2DSurfaceProvider = createTestRaster2DSurfaceProvider();
158
+ setTestHosts(state);
119
159
  const data = createWgpuShapeData(state, {} as never);
120
160
  expect(() => destroyWgpuShapeData(state, data)).not.toThrow();
121
161
  expect(destroySurface).not.toHaveBeenCalled();
@@ -123,18 +163,20 @@ describe('destroyWgpuShapeData', () => {
123
163
 
124
164
  it('destroys the cached GPU texture before the raster surface, then frees the mesh buffers', async () => {
125
165
  const state = await createWgpuRenderStateForTest();
126
- state.raster2DSurfaceProvider = createTestRaster2DSurfaceProvider();
166
+ setTestHosts(state);
127
167
  const data = createWgpuShapeData(state, {} as never);
128
168
  const shapeData = getWgpuShapeData(data)!;
129
- const surface = acquireWgpuShapeRasterSurface(state.raster2DSurfaceProvider!, shapeData)!;
169
+ acquireWgpuShapeRasterSurface(state.canvasHost!, state.imageHost!, shapeData);
170
+ const surface = shapeData.surface!;
171
+ const image = shapeData.image!;
130
172
  const cache = getWgpuRenderStateRuntime(state).context.textureSourcePremultipliedTextureCache;
131
173
  const order: string[] = [];
132
174
  const destroy = vi.fn(() => order.push('texture'));
133
- cache.set(surface.image, {
175
+ cache.set(image, {
134
176
  texture: { destroy },
135
177
  } as never);
136
- destroySurface.mockImplementation((destroyed) => {
137
- expect(cache.has(destroyed.image)).toBe(false);
178
+ destroySurface.mockImplementation(() => {
179
+ expect(cache.has(image)).toBe(false);
138
180
  order.push('surface');
139
181
  });
140
182
  const bufferDestroy = vi.fn(() => order.push('buffer'));
@@ -146,7 +188,7 @@ describe('destroyWgpuShapeData', () => {
146
188
  expect(destroy).toHaveBeenCalledOnce();
147
189
  expect(destroySurface).toHaveBeenCalledWith(surface);
148
190
  expect(bufferDestroy).toHaveBeenCalledTimes(2);
149
- expect(cache.has(surface.image)).toBe(false);
191
+ expect(cache.has(image)).toBe(false);
150
192
  expect(order).toEqual(['texture', 'surface', 'buffer', 'buffer']);
151
193
  expect(shapeData.meshBuffers.vertexBuffers).toHaveLength(0);
152
194
  expect(shapeData.meshBuffers.colorScaleBiasUniformBuffers).toHaveLength(0);
@@ -154,10 +196,11 @@ describe('destroyWgpuShapeData', () => {
154
196
 
155
197
  it('destroys a raster surface even when it never acquired a GPU cache entry', async () => {
156
198
  const state = await createWgpuRenderStateForTest();
157
- state.raster2DSurfaceProvider = createTestRaster2DSurfaceProvider();
199
+ setTestHosts(state);
158
200
  const data = createWgpuShapeData(state, {} as never);
159
201
  const shapeData = getWgpuShapeData(data)!;
160
- const surface = acquireWgpuShapeRasterSurface(state.raster2DSurfaceProvider!, shapeData)!;
202
+ acquireWgpuShapeRasterSurface(state.canvasHost!, state.imageHost!, shapeData);
203
+ const surface = shapeData.surface!;
161
204
 
162
205
  destroyWgpuShapeData(state, data);
163
206
 
@@ -168,7 +211,7 @@ describe('destroyWgpuShapeData', () => {
168
211
  describe('getWgpuShapeData', () => {
169
212
  it('reads the shape data back out of the opaque RendererData slot', async () => {
170
213
  const state = await createWgpuRenderStateForTest();
171
- state.raster2DSurfaceProvider = createTestRaster2DSurfaceProvider();
214
+ setTestHosts(state);
172
215
  const data = createWgpuShapeData(state, {} as never);
173
216
  expect(getWgpuShapeData(data)?.meshVersion).toBe(-1);
174
217
  });
@@ -1,18 +1,29 @@
1
+ import type { ColorScaleBias } from '@flighthq/adjustments/contract';
1
2
  import { createMatrix } from '@flighthq/geometry/contract';
2
- import { getWgpuRenderStateRuntime } from '@flighthq/render-wgpu/contract';
3
- import { createWgpuRenderStateForTest, installWgpuMock } from '@flighthq/render-wgpu/contract';
3
+ import { BlendMode } from '@flighthq/materials/contract';
4
+ import {
5
+ beginWgpuScreenRenderPassForTest,
6
+ createWgpuRenderStateForTest,
7
+ getWgpuRenderStateRuntime,
8
+ installWgpuMock,
9
+ } from '@flighthq/render-wgpu/contract';
4
10
  import type {
5
- ColorScaleBias,
6
- RenderProxy2D,
11
+ WgpuBindGroup,
12
+ WgpuBindGroupLayout,
13
+ WgpuBuffer,
14
+ WgpuQueue,
15
+ WgpuRenderPassEncoder,
16
+ WgpuRenderPipeline,
17
+ WgpuRenderPipelineDescriptor,
7
18
  WgpuRenderState,
8
19
  WgpuShapeMeshBuffers,
9
20
  WgpuShapeMeshPipeline,
10
- } from '@flighthq/types/contract';
11
- import type { WgpuShapeMesh } from '@flighthq/types/contract';
12
- import { BlendMode } from '@flighthq/types/contract';
21
+ } from '@flighthq/render-wgpu/contract';
22
+ import type { RenderProxy2D } from '@flighthq/render/contract';
13
23
 
14
- import { registerWgpuColorAdjustmentMaterialFeature } from './wgpuColorAdjustmentMaterialFeature';
15
- import { drawWgpuShapeMeshBatch, drawWgpuShapeMeshes } from './wgpuShapeMesh';
24
+ import type { WgpuShapeMesh } from './contract.scene2d-wgpu-types.ts';
25
+ import { registerWgpuColorAdjustmentMaterialFeature } from './wgpuColorAdjustmentMaterialFeature.ts';
26
+ import { drawWgpuShapeMeshBatch, drawWgpuShapeMeshes } from './wgpuShapeMesh.ts';
16
27
 
17
28
  beforeAll(() => {
18
29
  installWgpuMock();
@@ -38,7 +49,7 @@ function makeBuffers(): WgpuShapeMeshBuffers {
38
49
  };
39
50
  }
40
51
 
41
- function makePassSpy(): GPURenderPassEncoder {
52
+ function makePassSpy(): WgpuRenderPassEncoder {
42
53
  return {
43
54
  setPipeline: vi.fn(),
44
55
  setBindGroup: vi.fn(),
@@ -47,7 +58,7 @@ function makePassSpy(): GPURenderPassEncoder {
47
58
  setStencilReference: vi.fn(),
48
59
  draw: vi.fn(),
49
60
  drawIndexed: vi.fn(),
50
- } as unknown as GPURenderPassEncoder;
61
+ } as unknown as WgpuRenderPassEncoder;
51
62
  }
52
63
 
53
64
  function makeProxy(overrides?: Partial<RenderProxy2D>): RenderProxy2D {
@@ -83,8 +94,11 @@ function ct(
83
94
  } as ColorScaleBias;
84
95
  }
85
96
 
97
+ // A real screen pass, with its encoder swapped for a spy: the draw path reads the pass viewport for its
98
+ // projection, so a state with only a fake encoder attached has no coordinate space to draw into.
86
99
  async function makeState(): Promise<WgpuRenderState> {
87
100
  const state = await createWgpuRenderStateForTest();
101
+ beginWgpuScreenRenderPassForTest(state);
88
102
  getWgpuRenderStateRuntime(state).renderPass = makePassSpy();
89
103
  return state;
90
104
  }
@@ -93,20 +107,20 @@ describe('drawWgpuShapeMeshBatch', () => {
93
107
  it('writes only the shared matrix and color fields, preserving a feature-owned uniform tail', async () => {
94
108
  const state = await makeState();
95
109
  const buffers = makeBuffers();
96
- const uniformBuffers: GPUBuffer[] = [];
97
- const bindGroups: GPUBindGroup[] = [];
110
+ const uniformBuffers: WgpuBuffer[] = [];
111
+ const bindGroups: WgpuBindGroup[] = [];
98
112
  const uniformData = new Float32Array(24);
99
113
  uniformData.set([0.25, 0.5, 0.75, 1, 0.1, 0.2, 0.3, 0.4], 16);
100
114
  const pipelineEntry: WgpuShapeMeshPipeline = {
101
- bindGroupLayout: {} as GPUBindGroupLayout,
102
- pipeline: {} as GPURenderPipeline,
115
+ bindGroupLayout: {} as WgpuBindGroupLayout,
116
+ pipeline: {} as WgpuRenderPipeline,
103
117
  };
104
118
  let upload: Float32Array | undefined;
105
- state.device.queue.writeBuffer = vi.fn((buffer: GPUBuffer, _offset: number, data: BufferSource) => {
119
+ state.device.queue.writeBuffer = vi.fn((buffer: WgpuBuffer, _offset: number, data: BufferSource) => {
106
120
  if (buffer !== uniformBuffers[0]) return;
107
121
  const view = ArrayBuffer.isView(data) ? data : new Uint8Array(data as ArrayBuffer);
108
122
  upload = new Float32Array(view.buffer.slice(view.byteOffset, view.byteOffset + view.byteLength));
109
- }) as unknown as GPUQueue['writeBuffer'];
123
+ }) as unknown as WgpuQueue['writeBuffer'];
110
124
 
111
125
  drawWgpuShapeMeshBatch(
112
126
  state,
@@ -200,7 +214,7 @@ describe('drawWgpuShapeMeshes', () => {
200
214
 
201
215
  const pipelines = [...getWgpuRenderStateRuntime(state).shapeMeshPipelines!.values()].map(
202
216
  (entry) => entry.pipeline,
203
- ) as unknown as { __descriptor: GPURenderPipelineDescriptor }[];
217
+ ) as unknown as { __descriptor: WgpuRenderPipelineDescriptor }[];
204
218
  expect(pipelines).toHaveLength(2);
205
219
  const blends = pipelines.map((pipeline) => [...pipeline.__descriptor.fragment!.targets][0]!.blend!.color);
206
220
  expect(blends).toContainEqual({ srcFactor: 'one', dstFactor: 'one-minus-src-alpha', operation: 'add' });
@@ -210,14 +224,14 @@ describe('drawWgpuShapeMeshes', () => {
210
224
  it('writes premultiplied color (color * alpha) into the uniform buffer', async () => {
211
225
  const state = await makeState();
212
226
  const buffers = makeBuffers();
213
- const writes = new Map<GPUBuffer, Float32Array>();
214
- state.device.queue.writeBuffer = vi.fn((buffer: GPUBuffer, _offset: number, data: BufferSource) => {
227
+ const writes = new Map<WgpuBuffer, Float32Array>();
228
+ state.device.queue.writeBuffer = vi.fn((buffer: WgpuBuffer, _offset: number, data: BufferSource) => {
215
229
  const view = ArrayBuffer.isView(data) ? data : new Uint8Array(data as ArrayBuffer);
216
230
  // Only the uniform write is inspected; record a copy keyed by its destination buffer.
217
231
  if (view.byteLength % 4 === 0) {
218
232
  writes.set(buffer, new Float32Array(view.buffer.slice(view.byteOffset, view.byteOffset + view.byteLength)));
219
233
  }
220
- }) as unknown as GPUQueue['writeBuffer'];
234
+ }) as unknown as WgpuQueue['writeBuffer'];
221
235
 
222
236
  drawWgpuShapeMeshes(state, makeProxy({ alpha: 0.5 }), [{ ...TRIANGLE, color: 0xffffffff }], buffers);
223
237
 
@@ -277,13 +291,13 @@ describe('drawWgpuShapeMeshes', () => {
277
291
  const buffers = makeBuffers();
278
292
  registerWgpuColorAdjustmentMaterialFeature(state);
279
293
  const createShaderModule = vi.spyOn(state.device, 'createShaderModule');
280
- const writes = new Map<GPUBuffer, Float32Array>();
281
- state.device.queue.writeBuffer = vi.fn((buffer: GPUBuffer, _offset: number, data: BufferSource) => {
294
+ const writes = new Map<WgpuBuffer, Float32Array>();
295
+ state.device.queue.writeBuffer = vi.fn((buffer: WgpuBuffer, _offset: number, data: BufferSource) => {
282
296
  const view = ArrayBuffer.isView(data) ? data : new Uint8Array(data as ArrayBuffer);
283
297
  if (view.byteLength % 4 === 0) {
284
298
  writes.set(buffer, new Float32Array(view.buffer.slice(view.byteOffset, view.byteOffset + view.byteLength)));
285
299
  }
286
- }) as unknown as GPUQueue['writeBuffer'];
300
+ }) as unknown as WgpuQueue['writeBuffer'];
287
301
 
288
302
  drawWgpuShapeMeshes(
289
303
  state,
@@ -311,7 +325,7 @@ describe('drawWgpuShapeMeshes', () => {
311
325
  const buffers = makeBuffers();
312
326
  registerWgpuColorAdjustmentMaterialFeature(state);
313
327
 
314
- drawWgpuShapeMeshes(state, makeProxy({ colorMatrix: new Array(20).fill(0) }), [TRIANGLE], buffers);
328
+ drawWgpuShapeMeshes(state, makeProxy({ colorMatrix: new Float32Array(20) }), [TRIANGLE], buffers);
315
329
 
316
330
  expect(buffers.uniformBuffers).toHaveLength(1);
317
331
  expect(buffers.colorScaleBiasUniformBuffers).toHaveLength(0);
@@ -3,10 +3,14 @@ import {
3
3
  getWgpuRenderStateRuntime,
4
4
  installWgpuMock,
5
5
  } from '@flighthq/render-wgpu/contract';
6
- import { createRenderState, enableRenderRegistryGuards, explainRenderRegistryMisses } from '@flighthq/render/contract';
7
- import { RenderRegistry } from '@flighthq/types/contract';
6
+ import {
7
+ createRenderState,
8
+ enableRenderRegistriesGuards,
9
+ explainRenderRegistriesMisses,
10
+ } from '@flighthq/render/contract';
11
+ import { RenderRegistries } from '@flighthq/render/contract';
8
12
 
9
- import { getWgpuShapeRasterizer, registerWgpuShapeRasterizer } from './wgpuShapeRasterizer';
13
+ import { getWgpuShapeRasterizer, registerWgpuShapeRasterizer } from './wgpuShapeRasterizer.ts';
10
14
 
11
15
  beforeAll(() => {
12
16
  installWgpuMock();
@@ -28,8 +32,8 @@ describe('registerWgpuShapeRasterizer', () => {
28
32
  registerWgpuShapeRasterizer(state, rasterizer);
29
33
 
30
34
  expect(getWgpuShapeRasterizer(state)).toBe(rasterizer);
31
- expect(getWgpuRenderStateRuntime(state).registries.shapeRasterizer).not.toBe(before);
32
- expect(before.entry).toBeNull();
35
+ expect(getWgpuRenderStateRuntime(state).registries.shapeRasterizer).toBe(rasterizer);
36
+ expect(before).toBeNull();
33
37
  });
34
38
 
35
39
  it('removes one again, so a state can drop back to tessellation only', async () => {
@@ -40,7 +44,7 @@ describe('registerWgpuShapeRasterizer', () => {
40
44
  registerWgpuShapeRasterizer(state, null);
41
45
 
42
46
  expect(getWgpuShapeRasterizer(state)).toBeNull();
43
- expect(getWgpuRenderStateRuntime(state).registries.shapeRasterizer).not.toBe(before);
44
- expect(before.entry?.state).toBe('bound');
47
+ expect(getWgpuRenderStateRuntime(state).registries.shapeRasterizer).toBeNull();
48
+ expect(before).not.toBeNull();
45
49
  });
46
50
  });
@@ -1,19 +1,19 @@
1
1
  import {
2
+ beginWgpuScreenRenderPassForTest,
2
3
  createWgpuRenderStateForTest,
3
4
  getWgpuRenderStateRuntime,
4
5
  installWgpuMock,
5
6
  registerWgpuRenderTextureResolver,
6
7
  renderIntoWgpuRenderTexture,
7
- renderWgpuBackground,
8
- submitWgpuRenderPass,
8
+ submitWgpuFrame,
9
9
  } from '@flighthq/render-wgpu/contract';
10
10
  import { getOrCreateRenderProxy2D, prepareScene2DRender } from '@flighthq/render/contract';
11
11
  import { createSprite } from '@flighthq/scene2d/contract';
12
12
  import { createRenderTexture, setTextureUvFromPixelRect } from '@flighthq/texture/contract';
13
13
 
14
- import { registerWgpuColorAdjustmentMaterialFeature } from './wgpuColorAdjustmentMaterialFeature';
15
- import { defaultWgpuSpriteRenderer, drawWgpuSprite } from './wgpuSprite';
16
- import { registerWgpuStandardMaterial } from './wgpuStandardMaterial';
14
+ import { registerWgpuColorAdjustmentMaterialFeature } from './wgpuColorAdjustmentMaterialFeature.ts';
15
+ import { wgpuSpriteRenderer, drawWgpuSprite } from './wgpuSprite.ts';
16
+ import { registerWgpuStandardMaterial } from './wgpuStandardMaterial.ts';
17
17
 
18
18
  const CT_MODE_UNIFORM = 1;
19
19
 
@@ -36,8 +36,11 @@ async function drawSpriteOverNewTexture(
36
36
  colorScaleBias: unknown,
37
37
  ): Promise<void> {
38
38
  const texture = createRenderTexture({ height: size, width: size });
39
- renderIntoWgpuRenderTexture(state, texture, () => {});
40
- const sprite = createSprite({ data: { texture } });
39
+ renderIntoWgpuRenderTexture(state, texture, () => {}, { color: [0, 0, 0, 0], depth: 1.0, stencil: 0 });
40
+ const sprite = ((created) => {
41
+ Object.assign(created.data, { texture });
42
+ return created;
43
+ })(createSprite());
41
44
  prepareScene2DRender(state, sprite);
42
45
  const proxy = getOrCreateRenderProxy2D(state, sprite);
43
46
  (proxy as { colorScaleBias: unknown }).colorScaleBias = colorScaleBias;
@@ -46,27 +49,19 @@ async function drawSpriteOverNewTexture(
46
49
 
47
50
  beforeAll(() => installWgpuMock());
48
51
 
49
- describe('defaultWgpuSpriteRenderer', () => {
50
- it('has createData and submit functions', () => {
51
- expect(typeof defaultWgpuSpriteRenderer.createData).toBe('function');
52
- expect(typeof defaultWgpuSpriteRenderer.isDirty).toBe('function');
53
- expect(defaultWgpuSpriteRenderer.submit).toBe(drawWgpuSprite);
54
- });
55
- });
56
-
57
52
  describe('drawWgpuSprite', () => {
58
53
  it('accepts an unbound sprite', async () => {
59
54
  const state = await createWgpuRenderStateForTest();
60
- renderWgpuBackground(state);
55
+ beginWgpuScreenRenderPassForTest(state);
61
56
  const sprite = createSprite();
62
57
  prepareScene2DRender(state, sprite);
63
58
  expect(() => drawWgpuSprite(state, getOrCreateRenderProxy2D(state, sprite))).not.toThrow();
64
- submitWgpuRenderPass(state);
59
+ submitWgpuFrame(state);
65
60
  });
66
61
 
67
62
  it('records a tint against the instance the flush uploads when a new texture breaks the batch', async () => {
68
63
  const state = await createWgpuRenderStateForTest();
69
- renderWgpuBackground(state);
64
+ beginWgpuScreenRenderPassForTest(state);
70
65
  registerWgpuRenderTextureResolver(state);
71
66
  registerWgpuStandardMaterial(state);
72
67
  registerWgpuColorAdjustmentMaterialFeature(state);
@@ -79,18 +74,21 @@ describe('drawWgpuSprite', () => {
79
74
 
80
75
  expect(runtime.quadBatchWriterCount).toBe(1);
81
76
  expect(runtime.quadBatchWriterColorScaleBiasMode).toBe(CT_MODE_UNIFORM);
82
- submitWgpuRenderPass(state);
77
+ submitWgpuFrame(state);
83
78
  });
84
79
 
85
80
  it('uses the physical slab once and preserves a top-origin render-target sub-view', async () => {
86
81
  const state = await createWgpuRenderStateForTest();
87
- renderWgpuBackground(state);
82
+ beginWgpuScreenRenderPassForTest(state);
88
83
  registerWgpuRenderTextureResolver(state);
89
84
  registerWgpuStandardMaterial(state);
90
85
  const renderTexture = createRenderTexture({ height: 480, width: 720 });
91
86
  setTextureUvFromPixelRect(renderTexture, 140, 160, 100, 80);
92
- renderIntoWgpuRenderTexture(state, renderTexture, () => {});
93
- const sprite = createSprite({ data: { texture: renderTexture } });
87
+ renderIntoWgpuRenderTexture(state, renderTexture, () => {}, { color: [0, 0, 0, 0], depth: 1.0, stencil: 0 });
88
+ const sprite = ((created) => {
89
+ Object.assign(created.data, { texture: renderTexture });
90
+ return created;
91
+ })(createSprite());
94
92
  prepareScene2DRender(state, sprite);
95
93
 
96
94
  drawWgpuSprite(state, getOrCreateRenderProxy2D(state, sprite));
@@ -102,22 +100,25 @@ describe('drawWgpuSprite', () => {
102
100
  expect(data[7]).toBeCloseTo(160 / 480);
103
101
  expect(data[8]).toBeCloseTo(100 / 720);
104
102
  expect(data[11]).toBeCloseTo(80 / 480);
105
- submitWgpuRenderPass(state);
103
+ submitWgpuFrame(state);
106
104
  });
107
105
 
108
106
  it('packs a quarter-turned Texture view as affine UV axes', async () => {
109
107
  const state = await createWgpuRenderStateForTest();
110
- renderWgpuBackground(state);
108
+ beginWgpuScreenRenderPassForTest(state);
111
109
  registerWgpuRenderTextureResolver(state);
112
110
  registerWgpuStandardMaterial(state);
113
111
  const texture = createRenderTexture({ height: 50, width: 100 });
114
- renderIntoWgpuRenderTexture(state, texture, () => {});
112
+ renderIntoWgpuRenderTexture(state, texture, () => {}, { color: [0, 0, 0, 0], depth: 1.0, stencil: 0 });
115
113
  texture.uvOffset.x = 0.1;
116
114
  texture.uvOffset.y = 0.4;
117
115
  texture.uvScale.x = 0.3;
118
116
  texture.uvScale.y = 0.2;
119
117
  texture.uvRotation = -Math.PI / 2;
120
- const sprite = createSprite({ data: { texture } });
118
+ const sprite = ((created) => {
119
+ Object.assign(created.data, { texture });
120
+ return created;
121
+ })(createSprite());
121
122
  prepareScene2DRender(state, sprite);
122
123
 
123
124
  drawWgpuSprite(state, getOrCreateRenderProxy2D(state, sprite));
@@ -131,6 +132,14 @@ describe('drawWgpuSprite', () => {
131
132
  expect(data[9]).toBeCloseTo(-0.3);
132
133
  expect(data[10]).toBeCloseTo(0.2);
133
134
  expect(data[11]).toBeCloseTo(0);
134
- submitWgpuRenderPass(state);
135
+ submitWgpuFrame(state);
136
+ });
137
+ });
138
+
139
+ describe('wgpuSpriteRenderer', () => {
140
+ it('has createData and submit functions', () => {
141
+ expect(typeof wgpuSpriteRenderer.createData).toBe('function');
142
+ expect(typeof wgpuSpriteRenderer.isDirty).toBe('function');
143
+ expect(wgpuSpriteRenderer.submit).toBe(drawWgpuSprite);
135
144
  });
136
145
  });
@@ -1,29 +1,25 @@
1
- import { getWgpuMaterialRenderer } from '@flighthq/render-wgpu/contract';
1
+ import { EntityRuntimeKey } from '@flighthq/entity/contract';
2
+ import { StandardMaterialKind } from '@flighthq/materials/contract';
2
3
  import {
3
- createEmptyWgpuRegistries,
4
4
  createWgpuDeviceState,
5
- createWgpuPipeline,
6
5
  createWgpuRenderStateRuntime,
6
+ getWgpuQuadMaterialRenderer,
7
7
  } from '@flighthq/render-wgpu/contract';
8
- import type { WgpuRenderState } from '@flighthq/types/contract';
9
- import { EntityRuntimeKey, StandardMaterialKind } from '@flighthq/types/contract';
8
+ import type { WgpuDevice, WgpuRenderState } from '@flighthq/render-wgpu/contract';
10
9
 
11
- import { registerWgpuStandardMaterial, standardWgpuMaterialRenderer } from './wgpuStandardMaterial';
10
+ import { registerWgpuStandardMaterial, standardWgpuQuadMaterialRenderer } from './wgpuStandardMaterial.ts';
12
11
 
13
12
  describe('registerWgpuStandardMaterial', () => {
14
13
  it('registers the default renderer under StandardMaterialKind', () => {
15
14
  const state = {} as WgpuRenderState;
16
- state[EntityRuntimeKey] = createWgpuRenderStateRuntime(
17
- createWgpuDeviceState({} as GPUDevice),
18
- createWgpuPipeline(createEmptyWgpuRegistries()),
19
- );
15
+ state[EntityRuntimeKey] = createWgpuRenderStateRuntime(createWgpuDeviceState({} as WgpuDevice));
20
16
  registerWgpuStandardMaterial(state);
21
- expect(getWgpuMaterialRenderer(state, StandardMaterialKind)).toBe(standardWgpuMaterialRenderer);
17
+ expect(getWgpuQuadMaterialRenderer(state, StandardMaterialKind)).toBe(standardWgpuQuadMaterialRenderer);
22
18
  });
23
19
  });
24
20
 
25
- describe('standardWgpuMaterialRenderer', () => {
21
+ describe('standardWgpuQuadMaterialRenderer', () => {
26
22
  it('declares no per-instance float data', () => {
27
- expect(standardWgpuMaterialRenderer.instanceFloatCount).toBe(0);
23
+ expect(standardWgpuQuadMaterialRenderer.instanceFloatCount).toBe(0);
28
24
  });
29
25
  });
@@ -1,11 +1,11 @@
1
- import { renderWgpuBackground, submitWgpuRenderPass } from '@flighthq/render-wgpu/contract';
1
+ import { beginWgpuScreenRenderPassForTest, submitWgpuFrame } from '@flighthq/render-wgpu/contract';
2
2
  import { createWgpuRenderStateForTest, installWgpuMock } from '@flighthq/render-wgpu/contract';
3
3
  import { getOrCreateRenderProxy2D, prepareScene2DRender } from '@flighthq/render/contract';
4
4
  import { createRichText } from '@flighthq/text/contract';
5
5
  import { enableTextInput } from '@flighthq/textinput/contract';
6
6
 
7
- import { drawWgpuRichText } from './wgpuRichText';
8
- import { drawWgpuTextInputOverlay, enableWgpuTextInput } from './wgpuTextInput';
7
+ import { drawWgpuRichText } from './wgpuRichText.ts';
8
+ import { drawWgpuTextInputOverlay, enableWgpuTextInput } from './wgpuTextInput.ts';
9
9
 
10
10
  beforeAll(() => {
11
11
  installWgpuMock();
@@ -19,14 +19,17 @@ describe('drawWgpuTextInputOverlay', () => {
19
19
  it('rasterizes a focused editable field without throwing', async () => {
20
20
  enableWgpuTextInput();
21
21
  const state = await createWgpuRenderStateForTest();
22
- renderWgpuBackground(state);
23
- const input = createRichText({ data: { height: 40, text: 'hi', width: 100 } });
22
+ beginWgpuScreenRenderPassForTest(state);
23
+ const input = ((created) => {
24
+ Object.assign(created.data, { height: 40, text: 'hi', width: 100 });
25
+ return created;
26
+ })(createRichText());
24
27
  enableTextInput(input).focused = true;
25
28
  prepareScene2DRender(state, input);
26
29
  const renderProxy = getOrCreateRenderProxy2D(state, input);
27
30
 
28
31
  expect(() => drawWgpuRichText(state, renderProxy)).not.toThrow();
29
- submitWgpuRenderPass(state);
32
+ submitWgpuFrame(state);
30
33
  });
31
34
  });
32
35