@flighthq/scene2d-wgpu 0.5.1-next.920.da8f530 → 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 +20 -19
  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 +26 -14
  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 +29 -25
  87. package/dist/wgpuQuadBatch.js.map +1 -1
  88. package/dist/wgpuQuadBatchWriter.d.ts +11 -5
  89. package/dist/wgpuQuadBatchWriter.d.ts.map +1 -1
  90. package/dist/wgpuQuadBatchWriter.js +45 -19
  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 +49 -35
  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 +30 -36
  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 +17 -32
  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 +68 -48
  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 +20 -19
  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 +95 -90
  157. package/dist/wgpuVelocity.js.map +1 -1
  158. package/package.json +31 -24
  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 +99 -38
  172. package/src/wgpuQuadBatch.test.ts +126 -32
  173. package/src/wgpuQuadBatchWriter.test.ts +108 -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 +38 -41
  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 +67 -24
  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,14 +1,30 @@
1
- import { createImageResource } from '@flighthq/image/contract';
2
- import { renderWgpuBackground, submitWgpuRenderPass } from '@flighthq/render-wgpu/contract';
1
+ import {
2
+ createImageResource,
3
+ registerTestImageDimensionResolver,
4
+ unregisterTestImageDimensionResolver,
5
+ } from '@flighthq/image/contract';
6
+ import type { HostImageCapability, ImageResource } from '@flighthq/image/contract';
7
+ import { beginWgpuScreenRenderPassForTest, submitWgpuFrame } from '@flighthq/render-wgpu/contract';
3
8
  import { getWgpuRenderStateRuntime } from '@flighthq/render-wgpu/contract';
4
9
  import { createWgpuRenderStateForTest, installWgpuMock } from '@flighthq/render-wgpu/contract';
10
+ import { BatchFormat } from '@flighthq/render/contract';
11
+ import type { RenderProxy2D } from '@flighthq/render/contract';
12
+ import type { CanvasSurface, HostCanvasCapability } from '@flighthq/surface/contract';
5
13
  import { createTextLabel } from '@flighthq/text/contract';
6
14
  import * as textlayout from '@flighthq/textlayout/contract';
7
- import type { Raster2DSurface, RenderProxy2D } from '@flighthq/types/contract';
8
- import { BatchFormat, EntityRuntimeKey } from '@flighthq/types/contract';
9
15
 
10
- import { registerWgpuStandardMaterial } from './wgpuStandardMaterial';
11
- import { defaultWgpuTextLabelRenderer, drawWgpuTextLabel } from './wgpuTextLabel';
16
+ import { registerWgpuStandardMaterial } from './wgpuStandardMaterial.ts';
17
+ import { wgpuTextLabelRenderer, drawWgpuTextLabel } from './wgpuTextLabel.ts';
18
+
19
+ // A test that wraps a host handle supplies the host: the resource measures through the registered
20
+ // resolver, and clearing after each test keeps this file from covering for another's missing one.
21
+ beforeEach(() => {
22
+ registerTestImageDimensionResolver();
23
+ });
24
+
25
+ afterEach(() => {
26
+ unregisterTestImageDimensionResolver();
27
+ });
12
28
 
13
29
  beforeAll(() => installWgpuMock());
14
30
 
@@ -35,33 +51,70 @@ afterEach(() => {
35
51
  vi.restoreAllMocks();
36
52
  });
37
53
 
38
- function createTestRaster2DSurface(width: number, height: number): Raster2DSurface {
54
+ function createTestSurface(width: number, height: number): CanvasSurface {
39
55
  const canvas = document.createElement('canvas');
40
56
  canvas.width = width;
41
57
  canvas.height = height;
42
58
  const context = canvas.getContext('2d')!;
43
59
  return {
44
- [EntityRuntimeKey]: undefined,
45
60
  get width() {
46
61
  return canvas.width;
47
62
  },
48
- set width(value) {
63
+ set width(value: number) {
49
64
  canvas.width = value;
50
65
  },
51
66
  get height() {
52
67
  return canvas.height;
53
68
  },
54
- set height(value) {
69
+ set height(value: number) {
55
70
  canvas.height = value;
56
71
  },
57
72
  context,
58
- image: createImageResource(canvas),
73
+ } as unknown as CanvasSurface;
74
+ }
75
+
76
+ function createTestCanvasHost(destroyFn: (surface: CanvasSurface) => void = () => {}): HostCanvasCapability {
77
+ return {
78
+ acquire: () => null,
79
+ create: () => null,
80
+ createSurface: createTestSurface,
81
+ destroySurface: destroyFn,
82
+ release() {},
59
83
  };
60
84
  }
61
85
 
62
- function makeTextData() {
86
+ function createTestImageHost(): HostImageCapability {
63
87
  return {
64
- surface: createTestRaster2DSurface(1, 1),
88
+ createImageFromSurface(surface) {
89
+ return createImageResource((surface as unknown as { context: CanvasRenderingContext2D }).context.canvas);
90
+ },
91
+ loadImageFromUrl: () => Promise.reject(new Error('not implemented')),
92
+ };
93
+ }
94
+
95
+ function setTestHosts(state: { canvasHost: unknown; imageHost: unknown }): void {
96
+ state.canvasHost = createTestCanvasHost();
97
+ state.imageHost = createTestImageHost();
98
+ }
99
+
100
+ interface WgpuTextLabelDataView {
101
+ allocH: number;
102
+ allocW: number;
103
+ image: ImageResource | null;
104
+ surface: CanvasSurface | null;
105
+ lastContentId: number;
106
+ lastPixelRatio: number;
107
+ logW: number;
108
+ logH: number;
109
+ }
110
+
111
+ function makeTextData(): WgpuTextLabelDataView {
112
+ const surface = createTestSurface(1, 1);
113
+ return {
114
+ allocH: 0,
115
+ allocW: 0,
116
+ image: createImageResource((surface as unknown as { context: CanvasRenderingContext2D }).context.canvas),
117
+ surface,
65
118
  lastContentId: -1,
66
119
  lastPixelRatio: 0,
67
120
  logW: 0,
@@ -86,118 +139,79 @@ function makeTextProxy(text = '', rendererData: unknown = null): RenderProxy2D {
86
139
  } as unknown as RenderProxy2D;
87
140
  }
88
141
 
89
- function createTestRaster2DSurfaceProvider(destroyRaster2DSurface: (surface: Raster2DSurface) => void = () => {}) {
90
- return {
91
- [EntityRuntimeKey]: undefined,
92
- createRaster2DSurface(width: number, height: number) {
93
- return createTestRaster2DSurface(width, height);
94
- },
95
- destroyRaster2DSurface,
96
- };
97
- }
98
-
99
- describe('defaultWgpuTextLabelRenderer', () => {
100
- it('declares BatchFormat.Quad', () => {
101
- expect(defaultWgpuTextLabelRenderer.format).toBe(BatchFormat.Quad);
102
- });
103
-
104
- it('has createData and submit functions', () => {
105
- expect(typeof defaultWgpuTextLabelRenderer.createData).toBe('function');
106
- expect(typeof defaultWgpuTextLabelRenderer.submit).toBe('function');
107
- });
108
-
109
- it('removes the GPU cache entry before returning the node surface to its creator', async () => {
110
- const order: string[] = [];
111
- const state = await createWgpuRenderStateForTest();
112
- renderWgpuBackground(state);
113
- const cache = getWgpuRenderStateRuntime(state).context.textureSourcePremultipliedTextureCache;
114
- state.raster2DSurfaceProvider = createTestRaster2DSurfaceProvider((surface) => {
115
- order.push('surface');
116
- expect(cache.has(surface.image)).toBe(false);
117
- });
118
- registerWgpuStandardMaterial(state);
119
- const data = defaultWgpuTextLabelRenderer.createData!(state, createTextLabel())!;
120
- drawWgpuTextLabel(state, makeTextProxy('owned', data));
121
- const surface = (data as unknown as { surface: Raster2DSurface }).surface;
122
- const entry = cache.get(surface.image)!;
123
- submitWgpuRenderPass(state);
124
- vi.spyOn(entry.texture, 'destroy').mockImplementation(() => {
125
- order.push('texture');
126
- });
127
-
128
- defaultWgpuTextLabelRenderer.destroyData!(state, data);
129
-
130
- expect(cache.has(surface.image)).toBe(false);
131
- expect(order).toEqual(['texture', 'surface']);
132
- });
133
- });
134
-
135
142
  describe('drawWgpuTextLabel', () => {
136
143
  it('keeps different text nodes on distinct surfaces and GPU textures in one frame', async () => {
137
144
  const state = await createWgpuRenderStateForTest();
138
- state.raster2DSurfaceProvider = createTestRaster2DSurfaceProvider();
139
- renderWgpuBackground(state);
145
+ setTestHosts(state);
146
+ beginWgpuScreenRenderPassForTest(state);
140
147
  registerWgpuStandardMaterial(state);
141
- const firstData = defaultWgpuTextLabelRenderer.createData!(state, createTextLabel())!;
142
- const secondData = defaultWgpuTextLabelRenderer.createData!(state, createTextLabel())!;
148
+ const firstData = wgpuTextLabelRenderer.createData!(state, createTextLabel())!;
149
+ const secondData = wgpuTextLabelRenderer.createData!(state, createTextLabel())!;
143
150
 
144
151
  drawWgpuTextLabel(state, makeTextProxy('first', firstData));
145
152
  drawWgpuTextLabel(state, makeTextProxy('second', secondData));
146
153
 
147
- const firstSurface = (firstData as unknown as { surface: Raster2DSurface }).surface;
148
- const secondSurface = (secondData as unknown as { surface: Raster2DSurface }).surface;
154
+ const firstView = firstData as unknown as WgpuTextLabelDataView;
155
+ const secondView = secondData as unknown as WgpuTextLabelDataView;
149
156
  const cache = getWgpuRenderStateRuntime(state).context.textureSourcePremultipliedTextureCache;
150
- const firstImage = firstSurface.image;
151
- expect(firstSurface).not.toBe(secondSurface);
152
- expect(firstSurface.image).not.toBe(secondSurface.image);
153
- expect(cache.get(firstSurface.image)?.texture).not.toBe(cache.get(secondSurface.image)?.texture);
154
-
155
- drawWgpuTextLabel(state, makeTextProxy('first', firstData));
156
- expect((firstData as unknown as { surface: Raster2DSurface }).surface).toBe(firstSurface);
157
- expect(firstSurface.image).toBe(firstImage);
158
- submitWgpuRenderPass(state);
157
+ expect(firstView.surface).not.toBeNull();
158
+ expect(secondView.surface).not.toBeNull();
159
+ expect(firstView.surface).not.toBe(secondView.surface);
160
+ expect(firstView.image).not.toBe(secondView.image);
161
+ expect(cache.get(firstView.image!)?.texture).not.toBe(cache.get(secondView.image!)?.texture);
162
+ submitWgpuFrame(state);
159
163
  });
160
164
 
161
165
  it('returns early when text is empty', async () => {
162
166
  const state = await createWgpuRenderStateForTest();
163
- renderWgpuBackground(state);
167
+ beginWgpuScreenRenderPassForTest(state);
164
168
  registerWgpuStandardMaterial(state);
165
169
  expect(() => drawWgpuTextLabel(state, makeTextProxy('', makeTextData()))).not.toThrow();
166
170
  expect(getWgpuRenderStateRuntime(state).quadBatchWriterCount).toBe(0);
167
- submitWgpuRenderPass(state);
171
+ submitWgpuFrame(state);
168
172
  });
169
173
 
170
174
  it('writes one instance to the quad-batch writer when text has content', async () => {
171
175
  const state = await createWgpuRenderStateForTest();
172
- state.raster2DSurfaceProvider = createTestRaster2DSurfaceProvider();
173
- renderWgpuBackground(state);
176
+ setTestHosts(state);
177
+ beginWgpuScreenRenderPassForTest(state);
174
178
  registerWgpuStandardMaterial(state);
175
179
  drawWgpuTextLabel(state, makeTextProxy('hello', makeTextData()));
176
180
  expect(getWgpuRenderStateRuntime(state).quadBatchWriterCount).toBe(1);
177
- submitWgpuRenderPass(state);
181
+ submitWgpuFrame(state);
178
182
  });
179
183
 
180
184
  it('rasterizes packed run alpha into the canvas color', async () => {
181
185
  const state = await createWgpuRenderStateForTest();
182
- state.raster2DSurfaceProvider = createTestRaster2DSurfaceProvider();
183
- renderWgpuBackground(state);
186
+ beginWgpuScreenRenderPassForTest(state);
184
187
  registerWgpuStandardMaterial(state);
185
- const data = makeTextData();
188
+ const styles: Array<string | CanvasGradient | CanvasPattern> = [];
189
+ const wrappedCreateSurface = (w: number, h: number): CanvasSurface => {
190
+ const surface = createTestSurface(w, h);
191
+ vi.spyOn(surface.context, 'fillText').mockImplementation(function (this: CanvasRenderingContext2D) {
192
+ styles.push(this.fillStyle);
193
+ });
194
+ return surface;
195
+ };
196
+ state.canvasHost = {
197
+ ...createTestCanvasHost(),
198
+ createSurface: wrappedCreateSurface,
199
+ } as unknown as typeof state.canvasHost;
200
+ state.imageHost = createTestImageHost() as unknown as typeof state.imageHost;
201
+ const data = wgpuTextLabelRenderer.createData!(state, createTextLabel())!;
186
202
  const proxy = makeTextProxy('hello', data);
187
203
  (proxy.source as ReturnType<typeof createTextLabel>).data.textFormat = { color: 0xff000080 };
188
- const styles: Array<string | CanvasGradient | CanvasPattern> = [];
189
- vi.spyOn(data.surface.context, 'fillText').mockImplementation(() => styles.push(data.surface.context.fillStyle));
190
204
 
191
205
  drawWgpuTextLabel(state, proxy);
192
206
 
193
207
  expect(styles).toEqual(['rgba(255, 0, 0, 0.5019607843137255)']);
194
- submitWgpuRenderPass(state);
208
+ submitWgpuFrame(state);
195
209
  });
196
210
 
197
211
  it('does not re-rasterize when only alpha changes (content version unchanged)', async () => {
198
212
  const state = await createWgpuRenderStateForTest();
199
- state.raster2DSurfaceProvider = createTestRaster2DSurfaceProvider();
200
- renderWgpuBackground(state);
213
+ setTestHosts(state);
214
+ beginWgpuScreenRenderPassForTest(state);
201
215
  registerWgpuStandardMaterial(state);
202
216
  const proxy = makeTextProxy('hello', makeTextData());
203
217
  drawWgpuTextLabel(state, proxy);
@@ -206,7 +220,50 @@ describe('drawWgpuTextLabel', () => {
206
220
  drawWgpuTextLabel(state, proxy);
207
221
  // Version is unchanged, so the rasterization block is skipped entirely on the second draw.
208
222
  expect((proxy.rendererData as any).lastContentId).toBe(0);
209
- submitWgpuRenderPass(state);
223
+ submitWgpuFrame(state);
210
224
  updateSpy.mockRestore();
211
225
  });
212
226
  });
227
+
228
+ describe('wgpuTextLabelRenderer', () => {
229
+ it('declares BatchFormat.Quad', () => {
230
+ expect(wgpuTextLabelRenderer.format).toBe(BatchFormat.Quad);
231
+ });
232
+
233
+ it('has createData and submit functions', () => {
234
+ expect(typeof wgpuTextLabelRenderer.createData).toBe('function');
235
+ expect(typeof wgpuTextLabelRenderer.submit).toBe('function');
236
+ });
237
+
238
+ it('removes the GPU cache entry before returning the node surface to its creator', async () => {
239
+ const order: string[] = [];
240
+ let trackOrder = false;
241
+ const state = await createWgpuRenderStateForTest();
242
+ beginWgpuScreenRenderPassForTest(state);
243
+ const cache = getWgpuRenderStateRuntime(state).context.textureSourcePremultipliedTextureCache;
244
+ let trackedImage: ImageResource | null = null;
245
+ state.canvasHost = createTestCanvasHost(() => {
246
+ if (!trackOrder) return;
247
+ order.push('surface');
248
+ if (trackedImage !== null) expect(cache.has(trackedImage)).toBe(false);
249
+ });
250
+ state.imageHost = createTestImageHost();
251
+ registerWgpuStandardMaterial(state);
252
+ const data = wgpuTextLabelRenderer.createData!(state, createTextLabel())!;
253
+ drawWgpuTextLabel(state, makeTextProxy('owned', data));
254
+ const dataView = data as unknown as WgpuTextLabelDataView;
255
+ const image = dataView.image!;
256
+ trackedImage = image;
257
+ const entry = cache.get(image)!;
258
+ submitWgpuFrame(state);
259
+ vi.spyOn(entry.texture, 'destroy').mockImplementation(() => {
260
+ order.push('texture');
261
+ });
262
+ trackOrder = true;
263
+
264
+ wgpuTextLabelRenderer.destroyData!(state, data);
265
+
266
+ expect(cache.has(image)).toBe(false);
267
+ expect(order).toEqual(['texture', 'surface']);
268
+ });
269
+ });
@@ -1,39 +1,39 @@
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 { getRenderProxy2D, prepareScene2DRender } from '@flighthq/render/contract';
4
4
  import { createTilemap } from '@flighthq/tilemap/contract';
5
5
 
6
- import { flushWgpuQuadBatchWriter } from './wgpuQuadBatchWriter';
7
- import { defaultWgpuTilemapRenderer } from './wgpuTilemap';
6
+ import { flushWgpuQuadBatchWriter } from './wgpuQuadBatchWriter.ts';
7
+ import { wgpuTilemapRenderer } from './wgpuTilemap.ts';
8
8
 
9
9
  beforeAll(() => {
10
10
  installWgpuMock();
11
11
  });
12
12
 
13
- describe('defaultWgpuTilemapRenderer', () => {
13
+ describe('wgpuTilemapRenderer', () => {
14
14
  it('has a createData function', () => {
15
- expect(typeof defaultWgpuTilemapRenderer.createData).toBe('function');
15
+ expect(typeof wgpuTilemapRenderer.createData).toBe('function');
16
16
  });
17
17
 
18
18
  it('has a submit function', () => {
19
- expect(typeof defaultWgpuTilemapRenderer.submit).toBe('function');
19
+ expect(typeof wgpuTilemapRenderer.submit).toBe('function');
20
20
  });
21
21
  });
22
22
 
23
- describe('defaultWgpuTilemapRenderer.submit', () => {
23
+ describe('wgpuTilemapRenderer.submit', () => {
24
24
  it('does not throw when atlas is null', async () => {
25
25
  const state = await createWgpuRenderStateForTest();
26
- renderWgpuBackground(state);
26
+ beginWgpuScreenRenderPassForTest(state);
27
27
 
28
28
  const tilemap = createTilemap();
29
29
  prepareScene2DRender(state, tilemap);
30
30
  const renderProxy = getRenderProxy2D(state, tilemap)!;
31
31
 
32
32
  expect(() => {
33
- defaultWgpuTilemapRenderer.submit(state, renderProxy);
33
+ wgpuTilemapRenderer.submit(state, renderProxy);
34
34
  flushWgpuQuadBatchWriter(state as any);
35
35
  }).not.toThrow();
36
- submitWgpuRenderPass(state);
36
+ submitWgpuFrame(state);
37
37
  });
38
38
 
39
39
  it('does not throw when renderPass is null', async () => {
@@ -42,6 +42,6 @@ describe('defaultWgpuTilemapRenderer.submit', () => {
42
42
  prepareScene2DRender(state, tilemap);
43
43
  const renderProxy = getRenderProxy2D(state, tilemap)!;
44
44
 
45
- expect(() => defaultWgpuTilemapRenderer.submit(state, renderProxy)).not.toThrow();
45
+ expect(() => wgpuTilemapRenderer.submit(state, renderProxy)).not.toThrow();
46
46
  });
47
47
  });
@@ -1,28 +1,28 @@
1
1
  import { createParticleEmitter2D, reserveParticleEmitter2D } from '@flighthq/particleemitter/contract';
2
2
  import { createQuadBatch, getQuadBatchRuntime } from '@flighthq/quadbatch/contract';
3
+ import type { QuadBatchRuntime } from '@flighthq/quadbatch/contract';
4
+ import { QuadBatchKind } from '@flighthq/quadbatch/contract';
3
5
  import {
6
+ beginWgpuScreenRenderPassForTest,
4
7
  createWgpuOffscreenRenderState,
5
- createWgpuPipeline,
6
8
  getWgpuRenderStateRuntime,
7
- renderWgpuBackground,
8
9
  } from '@flighthq/render-wgpu/contract';
9
10
  import { createWgpuRenderStateForTest, installWgpuMock } from '@flighthq/render-wgpu/contract';
10
11
  import { createDisplayObject } from '@flighthq/scene2d/contract';
11
- import type { QuadBatchRuntime, TextureAtlas, TextureAtlasRegion } from '@flighthq/types/contract';
12
- import { QuadBatchKind } from '@flighthq/types/contract';
12
+ import type { TextureAtlas, TextureAtlasRegion } from '@flighthq/textureatlas/contract';
13
13
  import { beginVelocityFrame, contributeVelocity, createVelocityField } from '@flighthq/velocity/contract';
14
14
  import { beforeAll, describe, expect, it } from 'vitest';
15
15
 
16
16
  import {
17
17
  createWgpuVelocityTarget,
18
- defaultWgpuNode2DVelocityWriter,
19
- defaultWgpuParticleEmitter2DVelocityWriter,
20
- defaultWgpuQuadBatchVelocityWriter,
18
+ wgpuNode2DVelocityWriter,
19
+ wgpuParticleEmitter2DVelocityWriter,
20
+ wgpuQuadBatchVelocityWriter,
21
21
  drawWgpuVelocityQuad,
22
22
  getWgpuVelocityWriter,
23
23
  registerWgpuVelocityWriter,
24
24
  renderWgpuVelocity,
25
- } from './wgpuVelocity';
25
+ } from './wgpuVelocity.ts';
26
26
 
27
27
  beforeAll(() => {
28
28
  installWgpuMock();
@@ -38,70 +38,6 @@ describe('createWgpuVelocityTarget', () => {
38
38
  });
39
39
  });
40
40
 
41
- describe('defaultWgpuNode2DVelocityWriter', () => {
42
- it('is a velocity writer function', () => {
43
- expect(typeof defaultWgpuNode2DVelocityWriter).toBe('function');
44
- });
45
- });
46
-
47
- describe('defaultWgpuParticleEmitter2DVelocityWriter', () => {
48
- it('is a velocity writer function', () => {
49
- expect(typeof defaultWgpuParticleEmitter2DVelocityWriter).toBe('function');
50
- });
51
-
52
- it('emits per-particle velocity for an emitter with a velocities array without throwing', async () => {
53
- const state = await createWgpuRenderStateForTest();
54
- const target = createWgpuVelocityTarget(state, 128, 64);
55
- const region = { id: 0, x: 0, y: 0, width: 16, height: 16, pivotX: null, pivotY: null } as TextureAtlasRegion;
56
- const atlas = { texture: null, regions: [region] } as TextureAtlas;
57
- const emitter = createParticleEmitter2D();
58
- reserveParticleEmitter2D(emitter, 2);
59
- emitter.data.atlas = atlas;
60
- emitter.data.particleCount = 2;
61
- emitter.data.ids[0] = 0;
62
- emitter.data.ids[1] = 0;
63
- emitter.data.transforms.set([10, 10, 0, 1, 40, 20, 0, 1]);
64
- emitter.data.velocities.set([3, -2, -1, 4]);
65
-
66
- registerWgpuVelocityWriter(state, emitter.kind, defaultWgpuParticleEmitter2DVelocityWriter);
67
- const field = createVelocityField();
68
- beginVelocityFrame(field);
69
-
70
- renderWgpuBackground(state);
71
- expect(() => renderWgpuVelocity(state, emitter, field, target)).not.toThrow();
72
- });
73
- });
74
-
75
- describe('defaultWgpuQuadBatchVelocityWriter', () => {
76
- it('is a velocity writer function', () => {
77
- expect(typeof defaultWgpuQuadBatchVelocityWriter).toBe('function');
78
- });
79
-
80
- it('emits per-instance velocity for a batch with an instanceVelocities array without throwing', async () => {
81
- const state = await createWgpuRenderStateForTest();
82
- const target = createWgpuVelocityTarget(state, 128, 64);
83
- const region = { id: 0, x: 0, y: 0, width: 32, height: 32, pivotX: null, pivotY: null } as TextureAtlasRegion;
84
- const atlas = { texture: null, regions: [region] } as TextureAtlas;
85
- const batch = createQuadBatch({
86
- data: {
87
- atlas,
88
- ids: new Uint16Array([0, 0]),
89
- instanceCount: 2,
90
- transforms: new Float32Array([0, 0, 40, 10]),
91
- transformType: 'vector2',
92
- },
93
- });
94
- (getQuadBatchRuntime(batch) as QuadBatchRuntime).instanceVelocities = new Float32Array([3, -2, -1, 4]);
95
-
96
- registerWgpuVelocityWriter(state, QuadBatchKind, defaultWgpuQuadBatchVelocityWriter);
97
- const field = createVelocityField();
98
- beginVelocityFrame(field);
99
-
100
- renderWgpuBackground(state);
101
- expect(() => renderWgpuVelocity(state, batch, field, target)).not.toThrow();
102
- });
103
- });
104
-
105
41
  describe('drawWgpuVelocityQuad', () => {
106
42
  it('is a no-op outside an active velocity pass', async () => {
107
43
  const state = await createWgpuRenderStateForTest();
@@ -121,8 +57,8 @@ describe('registerWgpuVelocityWriter', () => {
121
57
  it('registers a writer dispatched by kind', async () => {
122
58
  const state = await createWgpuRenderStateForTest();
123
59
  const root = createDisplayObject();
124
- registerWgpuVelocityWriter(state, root.kind, defaultWgpuNode2DVelocityWriter);
125
- expect(getWgpuVelocityWriter(state, root.kind)).toBe(defaultWgpuNode2DVelocityWriter);
60
+ registerWgpuVelocityWriter(state, root.kind, wgpuNode2DVelocityWriter);
61
+ expect(getWgpuVelocityWriter(state, root.kind)).toBe(wgpuNode2DVelocityWriter);
126
62
  });
127
63
 
128
64
  it('replaces persistent snapshots and preserves a derived pipeline snapshot', async () => {
@@ -131,20 +67,19 @@ describe('registerWgpuVelocityWriter', () => {
131
67
  const replacement = vi.fn();
132
68
  const before = getWgpuRenderStateRuntime(state).registries.velocityWriters;
133
69
 
134
- registerWgpuVelocityWriter(state, kind, defaultWgpuNode2DVelocityWriter);
70
+ registerWgpuVelocityWriter(state, kind, wgpuNode2DVelocityWriter);
135
71
  const registered = getWgpuRenderStateRuntime(state).registries.velocityWriters;
136
- const offscreen = createWgpuOffscreenRenderState(
137
- state.deviceState,
138
- createWgpuPipeline(getWgpuRenderStateRuntime(state).registries),
139
- { format: state.format },
140
- );
72
+ const offscreen = createWgpuOffscreenRenderState(state.deviceState, {
73
+ ...getWgpuRenderStateRuntime(state).registries,
74
+ format: state.format,
75
+ });
141
76
  registerWgpuVelocityWriter(state, kind, replacement);
142
77
 
143
78
  expect(registered).not.toBe(before);
144
- expect(before.entries.has(kind)).toBe(false);
145
- expect(registered.entries.get(kind)).toEqual({ state: 'bound', value: defaultWgpuNode2DVelocityWriter });
79
+ expect(before.has(kind)).toBe(false);
80
+ expect(registered.get(kind)).toEqual(wgpuNode2DVelocityWriter);
146
81
  expect(getWgpuVelocityWriter(state, kind)).toBe(replacement);
147
- expect(getWgpuVelocityWriter(offscreen, kind)).toBe(defaultWgpuNode2DVelocityWriter);
82
+ expect(getWgpuVelocityWriter(offscreen, kind)).toBe(wgpuNode2DVelocityWriter);
148
83
  });
149
84
  });
150
85
 
@@ -153,17 +88,17 @@ describe('renderWgpuVelocity', () => {
153
88
  const state = await createWgpuRenderStateForTest();
154
89
  const target = createWgpuVelocityTarget(state, 128, 64);
155
90
  const root = createDisplayObject();
156
- registerWgpuVelocityWriter(state, root.kind, defaultWgpuNode2DVelocityWriter);
91
+ registerWgpuVelocityWriter(state, root.kind, wgpuNode2DVelocityWriter);
157
92
 
158
93
  const field = createVelocityField();
159
94
  beginVelocityFrame(field);
160
95
  contributeVelocity(field, root, 3, -2);
161
96
 
162
- renderWgpuBackground(state);
97
+ beginWgpuScreenRenderPassForTest(state);
163
98
  expect(() => renderWgpuVelocity(state, root, field, target)).not.toThrow();
164
99
  });
165
100
 
166
- it('throws when no command encoder is open (renderWgpuBackground not called)', async () => {
101
+ it('throws when no command encoder is open (no pass has opened one)', async () => {
167
102
  const state = await createWgpuRenderStateForTest();
168
103
  const target = createWgpuVelocityTarget(state, 128, 64);
169
104
  const root = createDisplayObject();
@@ -173,3 +108,68 @@ describe('renderWgpuVelocity', () => {
173
108
  expect(() => renderWgpuVelocity(state, root, field, target)).toThrow(/command encoder/);
174
109
  });
175
110
  });
111
+
112
+ describe('wgpuNode2DVelocityWriter', () => {
113
+ it('is a velocity writer function', () => {
114
+ expect(typeof wgpuNode2DVelocityWriter).toBe('function');
115
+ });
116
+ });
117
+
118
+ describe('wgpuParticleEmitter2DVelocityWriter', () => {
119
+ it('is a velocity writer function', () => {
120
+ expect(typeof wgpuParticleEmitter2DVelocityWriter).toBe('function');
121
+ });
122
+
123
+ it('emits per-particle velocity for an emitter with a velocities array without throwing', async () => {
124
+ const state = await createWgpuRenderStateForTest();
125
+ const target = createWgpuVelocityTarget(state, 128, 64);
126
+ const region = { id: 0, x: 0, y: 0, width: 16, height: 16, pivotX: null, pivotY: null } as TextureAtlasRegion;
127
+ const atlas = { texture: null, regions: [region] } as TextureAtlas;
128
+ const emitter = createParticleEmitter2D();
129
+ reserveParticleEmitter2D(emitter, 2);
130
+ emitter.data.atlas = atlas;
131
+ emitter.data.particleCount = 2;
132
+ emitter.data.ids[0] = 0;
133
+ emitter.data.ids[1] = 0;
134
+ emitter.data.transforms.set([10, 10, 0, 1, 40, 20, 0, 1]);
135
+ emitter.data.velocities.set([3, -2, -1, 4]);
136
+
137
+ registerWgpuVelocityWriter(state, emitter.kind, wgpuParticleEmitter2DVelocityWriter);
138
+ const field = createVelocityField();
139
+ beginVelocityFrame(field);
140
+
141
+ beginWgpuScreenRenderPassForTest(state);
142
+ expect(() => renderWgpuVelocity(state, emitter, field, target)).not.toThrow();
143
+ });
144
+ });
145
+
146
+ describe('wgpuQuadBatchVelocityWriter', () => {
147
+ it('is a velocity writer function', () => {
148
+ expect(typeof wgpuQuadBatchVelocityWriter).toBe('function');
149
+ });
150
+
151
+ it('emits per-instance velocity for a batch with an instanceVelocities array without throwing', async () => {
152
+ const state = await createWgpuRenderStateForTest();
153
+ const target = createWgpuVelocityTarget(state, 128, 64);
154
+ const region = { id: 0, x: 0, y: 0, width: 32, height: 32, pivotX: null, pivotY: null } as TextureAtlasRegion;
155
+ const atlas = { texture: null, regions: [region] } as TextureAtlas;
156
+ const batch = ((created) => {
157
+ Object.assign(created.data, {
158
+ atlas,
159
+ ids: new Uint16Array([0, 0]),
160
+ instanceCount: 2,
161
+ transforms: new Float32Array([0, 0, 40, 10]),
162
+ transformType: 'vector2',
163
+ });
164
+ return created;
165
+ })(createQuadBatch());
166
+ (getQuadBatchRuntime(batch) as QuadBatchRuntime).instanceVelocities = new Float32Array([3, -2, -1, 4]);
167
+
168
+ registerWgpuVelocityWriter(state, QuadBatchKind, wgpuQuadBatchVelocityWriter);
169
+ const field = createVelocityField();
170
+ beginVelocityFrame(field);
171
+
172
+ beginWgpuScreenRenderPassForTest(state);
173
+ expect(() => renderWgpuVelocity(state, batch, field, target)).not.toThrow();
174
+ });
175
+ });
@@ -1,3 +0,0 @@
1
- import type { WgpuPipeline } from '@flighthq/types/contract';
2
- export declare const scene2dWgpuPipeline: WgpuPipeline;
3
- //# sourceMappingURL=scene2dWgpuPipeline.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"scene2dWgpuPipeline.d.ts","sourceRoot":"","sources":["../src/scene2dWgpuPipeline.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAwB,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAoDnF,eAAO,MAAM,mBAAmB,EAAE,YAQhC,CAAC"}
@@ -1,40 +0,0 @@
1
- import { withRegistryTableEntry } from '@flighthq/registry/contract';
2
- import { createEmptyWgpuRegistries, createWgpuPipeline } from '@flighthq/render-wgpu/contract';
3
- import { BitmapTextKind, DisplayObjectKind, MorphShapeKind, ParticleEmitter2DKind, QuadBatchKind, RenderCacheKind, RichTextKind, Scale9ShapeKind, Scale9SpriteKind, ShapeKind, SpriteKind, StandardMaterialKind, TextLabelKind, TilemapKind, } from '@flighthq/types/contract';
4
- import { defaultWgpuBitmapTextRenderer } from './wgpuBitmapText';
5
- import { defaultWgpuRenderCacheRenderer } from './wgpuCache';
6
- import { defaultWgpuScene2DRenderer } from './wgpuNode2D';
7
- import { defaultWgpuParticleEmitter2DRenderer } from './wgpuParticleEmitter2D';
8
- import { defaultWgpuQuadBatchRenderer } from './wgpuQuadBatch';
9
- import { defaultWgpuRichTextRenderer } from './wgpuRichText';
10
- import { defaultWgpuScale9ShapeRenderer } from './wgpuScale9Shape';
11
- import { defaultWgpuScale9SpriteRenderer } from './wgpuScale9Sprite';
12
- import { defaultWgpuMorphShapeRenderer, defaultWgpuShapeRenderer } from './wgpuShape';
13
- import { defaultWgpuSpriteRenderer } from './wgpuSprite';
14
- import { standardWgpuMaterialRenderer } from './wgpuStandardMaterial';
15
- import { defaultWgpuTextLabelRenderer } from './wgpuTextLabel';
16
- import { defaultWgpuTilemapRenderer } from './wgpuTilemap';
17
- function buildScene2dWgpuRenderers() {
18
- let table = createEmptyWgpuRegistries().renderers;
19
- table = withRegistryTableEntry(table, BitmapTextKind, defaultWgpuBitmapTextRenderer);
20
- table = withRegistryTableEntry(table, DisplayObjectKind, defaultWgpuScene2DRenderer);
21
- table = withRegistryTableEntry(table, MorphShapeKind, defaultWgpuMorphShapeRenderer);
22
- table = withRegistryTableEntry(table, ParticleEmitter2DKind, defaultWgpuParticleEmitter2DRenderer);
23
- table = withRegistryTableEntry(table, QuadBatchKind, defaultWgpuQuadBatchRenderer);
24
- table = withRegistryTableEntry(table, RenderCacheKind, defaultWgpuRenderCacheRenderer);
25
- table = withRegistryTableEntry(table, RichTextKind, defaultWgpuRichTextRenderer);
26
- table = withRegistryTableEntry(table, Scale9ShapeKind, defaultWgpuScale9ShapeRenderer);
27
- table = withRegistryTableEntry(table, Scale9SpriteKind, defaultWgpuScale9SpriteRenderer);
28
- table = withRegistryTableEntry(table, ShapeKind, defaultWgpuShapeRenderer);
29
- table = withRegistryTableEntry(table, SpriteKind, defaultWgpuSpriteRenderer);
30
- table = withRegistryTableEntry(table, TextLabelKind, defaultWgpuTextLabelRenderer);
31
- table = withRegistryTableEntry(table, TilemapKind, defaultWgpuTilemapRenderer);
32
- return table;
33
- }
34
- const _registries = createEmptyWgpuRegistries();
35
- export const scene2dWgpuPipeline = createWgpuPipeline({
36
- ..._registries,
37
- materialRenderers: withRegistryTableEntry(_registries.materialRenderers, StandardMaterialKind, standardWgpuMaterialRenderer),
38
- renderers: buildScene2dWgpuRenderers(),
39
- });
40
- //# sourceMappingURL=scene2dWgpuPipeline.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"scene2dWgpuPipeline.js","sourceRoot":"","sources":["../src/scene2dWgpuPipeline.ts"],"names":[],"mappings":"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"}