@luma.gl/core 9.2.5 → 9.3.0-alpha.10

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 (280) hide show
  1. package/dist/adapter/canvas-context.d.ts +6 -162
  2. package/dist/adapter/canvas-context.d.ts.map +1 -1
  3. package/dist/adapter/canvas-context.js +5 -419
  4. package/dist/adapter/canvas-context.js.map +1 -1
  5. package/dist/adapter/canvas-observer.d.ts +32 -0
  6. package/dist/adapter/canvas-observer.d.ts.map +1 -0
  7. package/dist/adapter/canvas-observer.js +90 -0
  8. package/dist/adapter/canvas-observer.js.map +1 -0
  9. package/dist/adapter/canvas-surface.d.ts +150 -0
  10. package/dist/adapter/canvas-surface.d.ts.map +1 -0
  11. package/dist/adapter/canvas-surface.js +392 -0
  12. package/dist/adapter/canvas-surface.js.map +1 -0
  13. package/dist/adapter/device.d.ts +81 -16
  14. package/dist/adapter/device.d.ts.map +1 -1
  15. package/dist/adapter/device.js +196 -10
  16. package/dist/adapter/device.js.map +1 -1
  17. package/dist/adapter/luma.js +1 -1
  18. package/dist/adapter/luma.js.map +1 -1
  19. package/dist/adapter/presentation-context.d.ts +11 -0
  20. package/dist/adapter/presentation-context.d.ts.map +1 -0
  21. package/dist/adapter/presentation-context.js +12 -0
  22. package/dist/adapter/presentation-context.js.map +1 -0
  23. package/dist/adapter/resources/buffer.d.ts +5 -5
  24. package/dist/adapter/resources/buffer.d.ts.map +1 -1
  25. package/dist/adapter/resources/buffer.js +18 -7
  26. package/dist/adapter/resources/buffer.js.map +1 -1
  27. package/dist/adapter/resources/command-buffer.d.ts +3 -1
  28. package/dist/adapter/resources/command-buffer.d.ts.map +1 -1
  29. package/dist/adapter/resources/command-buffer.js +3 -1
  30. package/dist/adapter/resources/command-buffer.js.map +1 -1
  31. package/dist/adapter/resources/command-encoder.d.ts +30 -7
  32. package/dist/adapter/resources/command-encoder.d.ts.map +1 -1
  33. package/dist/adapter/resources/command-encoder.js +68 -2
  34. package/dist/adapter/resources/command-encoder.js.map +1 -1
  35. package/dist/adapter/resources/compute-pipeline.d.ts +2 -2
  36. package/dist/adapter/resources/compute-pipeline.d.ts.map +1 -1
  37. package/dist/adapter/resources/fence.d.ts +16 -0
  38. package/dist/adapter/resources/fence.d.ts.map +1 -0
  39. package/dist/adapter/resources/fence.js +17 -0
  40. package/dist/adapter/resources/fence.js.map +1 -0
  41. package/dist/adapter/resources/framebuffer.d.ts +1 -1
  42. package/dist/adapter/resources/framebuffer.d.ts.map +1 -1
  43. package/dist/adapter/resources/framebuffer.js +15 -12
  44. package/dist/adapter/resources/framebuffer.js.map +1 -1
  45. package/dist/adapter/resources/query-set.d.ts +17 -1
  46. package/dist/adapter/resources/query-set.d.ts.map +1 -1
  47. package/dist/adapter/resources/query-set.js.map +1 -1
  48. package/dist/adapter/resources/render-pipeline.d.ts +28 -10
  49. package/dist/adapter/resources/render-pipeline.d.ts.map +1 -1
  50. package/dist/adapter/resources/render-pipeline.js +21 -2
  51. package/dist/adapter/resources/render-pipeline.js.map +1 -1
  52. package/dist/adapter/resources/resource.d.ts +13 -0
  53. package/dist/adapter/resources/resource.d.ts.map +1 -1
  54. package/dist/adapter/resources/resource.js +243 -14
  55. package/dist/adapter/resources/resource.js.map +1 -1
  56. package/dist/adapter/resources/shader.js +27 -25
  57. package/dist/adapter/resources/shader.js.map +1 -1
  58. package/dist/adapter/resources/shared-render-pipeline.d.ts +22 -0
  59. package/dist/adapter/resources/shared-render-pipeline.d.ts.map +1 -0
  60. package/dist/adapter/resources/shared-render-pipeline.js +25 -0
  61. package/dist/adapter/resources/shared-render-pipeline.js.map +1 -0
  62. package/dist/adapter/resources/texture-view.d.ts +1 -1
  63. package/dist/adapter/resources/texture-view.d.ts.map +1 -1
  64. package/dist/adapter/resources/texture.d.ts +168 -28
  65. package/dist/adapter/resources/texture.d.ts.map +1 -1
  66. package/dist/adapter/resources/texture.js +284 -25
  67. package/dist/adapter/resources/texture.js.map +1 -1
  68. package/dist/adapter/types/attachments.d.ts +1 -1
  69. package/dist/adapter/types/attachments.d.ts.map +1 -1
  70. package/dist/adapter/types/buffer-layout.d.ts +1 -1
  71. package/dist/adapter/types/buffer-layout.d.ts.map +1 -1
  72. package/dist/adapter/types/parameters.d.ts +3 -1
  73. package/dist/adapter/types/parameters.d.ts.map +1 -1
  74. package/dist/adapter/types/parameters.js +1 -0
  75. package/dist/adapter/types/parameters.js.map +1 -1
  76. package/dist/adapter/types/shader-layout.d.ts +10 -6
  77. package/dist/adapter/types/shader-layout.d.ts.map +1 -1
  78. package/dist/adapter/types/uniforms.d.ts +6 -0
  79. package/dist/adapter/types/uniforms.d.ts.map +1 -1
  80. package/dist/adapter-utils/bind-groups.d.ts +9 -0
  81. package/dist/adapter-utils/bind-groups.d.ts.map +1 -0
  82. package/dist/adapter-utils/bind-groups.js +41 -0
  83. package/dist/adapter-utils/bind-groups.js.map +1 -0
  84. package/dist/adapter-utils/format-compiler-log.d.ts.map +1 -1
  85. package/dist/adapter-utils/format-compiler-log.js +23 -15
  86. package/dist/adapter-utils/format-compiler-log.js.map +1 -1
  87. package/dist/adapter-utils/get-attribute-from-layouts.d.ts +2 -2
  88. package/dist/adapter-utils/get-attribute-from-layouts.d.ts.map +1 -1
  89. package/dist/adapter-utils/get-attribute-from-layouts.js +6 -6
  90. package/dist/adapter-utils/get-attribute-from-layouts.js.map +1 -1
  91. package/dist/dist.dev.js +2692 -645
  92. package/dist/dist.min.js +10 -9
  93. package/dist/factories/bind-group-factory.d.ts +20 -0
  94. package/dist/factories/bind-group-factory.d.ts.map +1 -0
  95. package/dist/factories/bind-group-factory.js +79 -0
  96. package/dist/factories/bind-group-factory.js.map +1 -0
  97. package/dist/factories/core-module-state.d.ts +7 -0
  98. package/dist/factories/core-module-state.d.ts.map +1 -0
  99. package/dist/{shadertypes/data-types/shader-types.js → factories/core-module-state.js} +1 -1
  100. package/dist/factories/core-module-state.js.map +1 -0
  101. package/dist/factories/pipeline-factory.d.ts +54 -0
  102. package/dist/factories/pipeline-factory.d.ts.map +1 -0
  103. package/dist/factories/pipeline-factory.js +270 -0
  104. package/dist/factories/pipeline-factory.js.map +1 -0
  105. package/dist/factories/shader-factory.d.ts +20 -0
  106. package/dist/factories/shader-factory.d.ts.map +1 -0
  107. package/dist/factories/shader-factory.js +84 -0
  108. package/dist/factories/shader-factory.js.map +1 -0
  109. package/dist/index.cjs +2427 -554
  110. package/dist/index.cjs.map +4 -4
  111. package/dist/index.d.ts +30 -14
  112. package/dist/index.d.ts.map +1 -1
  113. package/dist/index.js +19 -7
  114. package/dist/index.js.map +1 -1
  115. package/dist/portable/shader-block-writer.d.ts +51 -0
  116. package/dist/portable/shader-block-writer.d.ts.map +1 -0
  117. package/dist/portable/shader-block-writer.js +185 -0
  118. package/dist/portable/shader-block-writer.js.map +1 -0
  119. package/dist/portable/uniform-block.d.ts +1 -1
  120. package/dist/portable/uniform-block.d.ts.map +1 -1
  121. package/dist/portable/uniform-store.d.ts +55 -24
  122. package/dist/portable/uniform-store.d.ts.map +1 -1
  123. package/dist/portable/uniform-store.js +73 -25
  124. package/dist/portable/uniform-store.js.map +1 -1
  125. package/dist/shadertypes/data-types/data-type-decoder.d.ts +20 -0
  126. package/dist/shadertypes/data-types/data-type-decoder.d.ts.map +1 -0
  127. package/dist/shadertypes/data-types/data-type-decoder.js +79 -0
  128. package/dist/shadertypes/data-types/data-type-decoder.js.map +1 -0
  129. package/dist/shadertypes/data-types/data-types.d.ts +31 -12
  130. package/dist/shadertypes/data-types/data-types.d.ts.map +1 -1
  131. package/dist/shadertypes/data-types/decode-data-types.d.ts.map +1 -1
  132. package/dist/shadertypes/data-types/decode-data-types.js +2 -1
  133. package/dist/shadertypes/data-types/decode-data-types.js.map +1 -1
  134. package/dist/{image-utils → shadertypes/image-types}/image-types.d.ts +0 -6
  135. package/dist/shadertypes/image-types/image-types.d.ts.map +1 -0
  136. package/dist/shadertypes/image-types/image-types.js.map +1 -0
  137. package/dist/shadertypes/shader-types/shader-block-layout.d.ts +72 -0
  138. package/dist/shadertypes/shader-types/shader-block-layout.d.ts.map +1 -0
  139. package/dist/shadertypes/shader-types/shader-block-layout.js +209 -0
  140. package/dist/shadertypes/shader-types/shader-block-layout.js.map +1 -0
  141. package/dist/shadertypes/shader-types/shader-type-decoder.d.ts +41 -0
  142. package/dist/shadertypes/shader-types/shader-type-decoder.d.ts.map +1 -0
  143. package/dist/shadertypes/{data-types/decode-shader-types.js → shader-types/shader-type-decoder.js} +43 -4
  144. package/dist/shadertypes/shader-types/shader-type-decoder.js.map +1 -0
  145. package/dist/shadertypes/shader-types/shader-types.d.ts +101 -0
  146. package/dist/shadertypes/shader-types/shader-types.d.ts.map +1 -0
  147. package/dist/shadertypes/shader-types/shader-types.js +30 -0
  148. package/dist/shadertypes/shader-types/shader-types.js.map +1 -0
  149. package/dist/shadertypes/texture-types/pixel-utils.d.ts.map +1 -0
  150. package/dist/shadertypes/{textures → texture-types}/pixel-utils.js +4 -4
  151. package/dist/shadertypes/texture-types/pixel-utils.js.map +1 -0
  152. package/dist/shadertypes/texture-types/texture-format-decoder.d.ts +36 -0
  153. package/dist/shadertypes/texture-types/texture-format-decoder.d.ts.map +1 -0
  154. package/dist/shadertypes/{textures → texture-types}/texture-format-decoder.js +109 -37
  155. package/dist/shadertypes/texture-types/texture-format-decoder.js.map +1 -0
  156. package/dist/shadertypes/texture-types/texture-format-generics.d.ts +34 -0
  157. package/dist/shadertypes/texture-types/texture-format-generics.d.ts.map +1 -0
  158. package/dist/shadertypes/texture-types/texture-format-generics.js.map +1 -0
  159. package/dist/shadertypes/texture-types/texture-format-table.d.ts.map +1 -0
  160. package/dist/shadertypes/{textures → texture-types}/texture-format-table.js +10 -9
  161. package/dist/shadertypes/texture-types/texture-format-table.js.map +1 -0
  162. package/dist/shadertypes/{textures → texture-types}/texture-formats.d.ts +51 -17
  163. package/dist/shadertypes/texture-types/texture-formats.d.ts.map +1 -0
  164. package/dist/shadertypes/{textures → texture-types}/texture-formats.js +1 -0
  165. package/dist/shadertypes/texture-types/texture-formats.js.map +1 -0
  166. package/dist/shadertypes/texture-types/texture-layout.d.ts +5 -0
  167. package/dist/shadertypes/texture-types/texture-layout.d.ts.map +1 -0
  168. package/dist/shadertypes/texture-types/texture-layout.js +41 -0
  169. package/dist/shadertypes/texture-types/texture-layout.js.map +1 -0
  170. package/dist/shadertypes/vertex-types/vertex-format-decoder.d.ts +24 -0
  171. package/dist/shadertypes/vertex-types/vertex-format-decoder.d.ts.map +1 -0
  172. package/dist/shadertypes/vertex-types/vertex-format-decoder.js +106 -0
  173. package/dist/shadertypes/vertex-types/vertex-format-decoder.js.map +1 -0
  174. package/dist/shadertypes/vertex-types/vertex-formats.d.ts +50 -0
  175. package/dist/shadertypes/vertex-types/vertex-formats.d.ts.map +1 -0
  176. package/dist/shadertypes/vertex-types/vertex-formats.js.map +1 -0
  177. package/dist/utils/array-equal.d.ts +1 -1
  178. package/dist/utils/array-equal.d.ts.map +1 -1
  179. package/dist/utils/array-equal.js +15 -9
  180. package/dist/utils/array-equal.js.map +1 -1
  181. package/dist/utils/assert.d.ts +5 -0
  182. package/dist/utils/assert.d.ts.map +1 -0
  183. package/dist/utils/assert.js +17 -0
  184. package/dist/utils/assert.js.map +1 -0
  185. package/dist/utils/stats-manager.d.ts.map +1 -1
  186. package/dist/utils/stats-manager.js +61 -1
  187. package/dist/utils/stats-manager.js.map +1 -1
  188. package/package.json +6 -6
  189. package/src/adapter/canvas-context.ts +7 -556
  190. package/src/adapter/canvas-observer.ts +130 -0
  191. package/src/adapter/canvas-surface.ts +521 -0
  192. package/src/adapter/device.ts +312 -24
  193. package/src/adapter/presentation-context.ts +16 -0
  194. package/src/adapter/resources/buffer.ts +19 -9
  195. package/src/adapter/resources/command-buffer.ts +4 -2
  196. package/src/adapter/resources/command-encoder.ts +101 -10
  197. package/src/adapter/resources/compute-pipeline.ts +2 -2
  198. package/src/adapter/resources/fence.ts +32 -0
  199. package/src/adapter/resources/framebuffer.ts +16 -13
  200. package/src/adapter/resources/query-set.ts +17 -1
  201. package/src/adapter/resources/render-pipeline.ts +52 -16
  202. package/src/adapter/resources/resource.ts +289 -14
  203. package/src/adapter/resources/shader.ts +28 -28
  204. package/src/adapter/resources/shared-render-pipeline.ts +40 -0
  205. package/src/adapter/resources/texture-view.ts +1 -1
  206. package/src/adapter/resources/texture.ts +427 -49
  207. package/src/adapter/types/attachments.ts +1 -1
  208. package/src/adapter/types/buffer-layout.ts +1 -1
  209. package/src/adapter/types/parameters.ts +4 -1
  210. package/src/adapter/types/shader-layout.ts +15 -9
  211. package/src/adapter/types/uniforms.ts +12 -0
  212. package/src/adapter-utils/bind-groups.ts +71 -0
  213. package/src/adapter-utils/format-compiler-log.ts +23 -15
  214. package/src/adapter-utils/get-attribute-from-layouts.ts +8 -11
  215. package/src/factories/bind-group-factory.ts +139 -0
  216. package/src/factories/core-module-state.ts +11 -0
  217. package/src/factories/pipeline-factory.ts +328 -0
  218. package/src/factories/shader-factory.ts +103 -0
  219. package/src/index.ts +70 -26
  220. package/src/portable/shader-block-writer.ts +254 -0
  221. package/src/portable/uniform-block.ts +1 -1
  222. package/src/portable/uniform-store.ts +98 -40
  223. package/src/shadertypes/data-types/data-type-decoder.ts +105 -0
  224. package/src/shadertypes/data-types/data-types.ts +100 -48
  225. package/src/shadertypes/data-types/decode-data-types.ts +2 -1
  226. package/src/{image-utils → shadertypes/image-types}/image-types.ts +0 -7
  227. package/src/shadertypes/shader-types/shader-block-layout.ts +340 -0
  228. package/src/shadertypes/{data-types/decode-shader-types.ts → shader-types/shader-type-decoder.ts} +88 -14
  229. package/src/shadertypes/shader-types/shader-types.ts +207 -0
  230. package/src/shadertypes/{textures → texture-types}/pixel-utils.ts +4 -4
  231. package/src/shadertypes/{textures → texture-types}/texture-format-decoder.ts +166 -45
  232. package/src/shadertypes/{textures → texture-types}/texture-format-generics.ts +42 -48
  233. package/src/shadertypes/{textures → texture-types}/texture-format-table.ts +10 -9
  234. package/src/shadertypes/{textures → texture-types}/texture-formats.ts +73 -17
  235. package/src/shadertypes/texture-types/texture-layout.ts +60 -0
  236. package/src/shadertypes/vertex-types/vertex-format-decoder.ts +131 -0
  237. package/src/shadertypes/vertex-types/vertex-formats.ts +183 -0
  238. package/src/utils/array-equal.ts +21 -9
  239. package/src/utils/assert.ts +18 -0
  240. package/src/utils/stats-manager.ts +76 -2
  241. package/dist/image-utils/image-types.d.ts.map +0 -1
  242. package/dist/image-utils/image-types.js.map +0 -1
  243. package/dist/portable/uniform-buffer-layout.d.ts +0 -28
  244. package/dist/portable/uniform-buffer-layout.d.ts.map +0 -1
  245. package/dist/portable/uniform-buffer-layout.js +0 -96
  246. package/dist/portable/uniform-buffer-layout.js.map +0 -1
  247. package/dist/shadertypes/data-types/decode-shader-types.d.ts +0 -17
  248. package/dist/shadertypes/data-types/decode-shader-types.d.ts.map +0 -1
  249. package/dist/shadertypes/data-types/decode-shader-types.js.map +0 -1
  250. package/dist/shadertypes/data-types/shader-types.d.ts +0 -45
  251. package/dist/shadertypes/data-types/shader-types.d.ts.map +0 -1
  252. package/dist/shadertypes/data-types/shader-types.js.map +0 -1
  253. package/dist/shadertypes/textures/pixel-utils.d.ts.map +0 -1
  254. package/dist/shadertypes/textures/pixel-utils.js.map +0 -1
  255. package/dist/shadertypes/textures/texture-format-decoder.d.ts +0 -18
  256. package/dist/shadertypes/textures/texture-format-decoder.d.ts.map +0 -1
  257. package/dist/shadertypes/textures/texture-format-decoder.js.map +0 -1
  258. package/dist/shadertypes/textures/texture-format-generics.d.ts +0 -33
  259. package/dist/shadertypes/textures/texture-format-generics.d.ts.map +0 -1
  260. package/dist/shadertypes/textures/texture-format-generics.js.map +0 -1
  261. package/dist/shadertypes/textures/texture-format-table.d.ts.map +0 -1
  262. package/dist/shadertypes/textures/texture-format-table.js.map +0 -1
  263. package/dist/shadertypes/textures/texture-formats.d.ts.map +0 -1
  264. package/dist/shadertypes/textures/texture-formats.js.map +0 -1
  265. package/dist/shadertypes/vertex-arrays/decode-vertex-format.d.ts +0 -18
  266. package/dist/shadertypes/vertex-arrays/decode-vertex-format.d.ts.map +0 -1
  267. package/dist/shadertypes/vertex-arrays/decode-vertex-format.js +0 -100
  268. package/dist/shadertypes/vertex-arrays/decode-vertex-format.js.map +0 -1
  269. package/dist/shadertypes/vertex-arrays/vertex-formats.d.ts +0 -27
  270. package/dist/shadertypes/vertex-arrays/vertex-formats.d.ts.map +0 -1
  271. package/dist/shadertypes/vertex-arrays/vertex-formats.js.map +0 -1
  272. package/src/portable/uniform-buffer-layout.ts +0 -118
  273. package/src/shadertypes/data-types/shader-types.ts +0 -87
  274. package/src/shadertypes/vertex-arrays/decode-vertex-format.ts +0 -124
  275. package/src/shadertypes/vertex-arrays/vertex-formats.ts +0 -91
  276. /package/dist/{image-utils → shadertypes/image-types}/image-types.js +0 -0
  277. /package/dist/shadertypes/{textures → texture-types}/pixel-utils.d.ts +0 -0
  278. /package/dist/shadertypes/{textures → texture-types}/texture-format-generics.js +0 -0
  279. /package/dist/shadertypes/{textures → texture-types}/texture-format-table.d.ts +0 -0
  280. /package/dist/shadertypes/{vertex-arrays → vertex-types}/vertex-formats.js +0 -0
@@ -5,12 +5,18 @@
5
5
  import {StatsManager, lumaStats} from '../utils/stats-manager';
6
6
  import {log} from '../utils/log';
7
7
  import {uid} from '../utils/uid';
8
- import type {VertexFormat, VertexFormatInfo} from '../shadertypes/vertex-arrays/vertex-formats';
9
- import type {TextureFormat, TextureFormatInfo} from '../shadertypes/textures/texture-formats';
8
+ import type {VertexFormat, VertexFormatInfo} from '../shadertypes/vertex-types/vertex-formats';
9
+ import type {
10
+ TextureFormat,
11
+ TextureFormatInfo,
12
+ CompressedTextureFormat
13
+ } from '../shadertypes/texture-types/texture-formats';
10
14
  import type {CanvasContext, CanvasContextProps} from './canvas-context';
15
+ import type {PresentationContext, PresentationContextProps} from './presentation-context';
11
16
  import type {BufferProps} from './resources/buffer';
12
17
  import {Buffer} from './resources/buffer';
13
18
  import type {RenderPipeline, RenderPipelineProps} from './resources/render-pipeline';
19
+ import type {SharedRenderPipeline} from './resources/shared-render-pipeline';
14
20
  import type {ComputePipeline, ComputePipelineProps} from './resources/compute-pipeline';
15
21
  import type {Sampler, SamplerProps} from './resources/sampler';
16
22
  import type {Shader, ShaderProps} from './resources/shader';
@@ -24,11 +30,14 @@ import type {CommandBuffer} from './resources/command-buffer';
24
30
  import type {VertexArray, VertexArrayProps} from './resources/vertex-array';
25
31
  import type {TransformFeedback, TransformFeedbackProps} from './resources/transform-feedback';
26
32
  import type {QuerySet, QuerySetProps} from './resources/query-set';
33
+ import type {Fence} from './resources/fence';
34
+ import type {Bindings, ComputeShaderLayout, ShaderLayout} from './types/shader-layout';
27
35
 
28
- import {getVertexFormatInfo} from '../shadertypes/vertex-arrays/decode-vertex-format';
29
- import {textureFormatDecoder} from '../shadertypes/textures/texture-format-decoder';
30
- import type {ExternalImage} from '../image-utils/image-types';
31
- import {isExternalImage, getExternalImageSize} from '../image-utils/image-types';
36
+ import {vertexFormatDecoder} from '../shadertypes/vertex-types/vertex-format-decoder';
37
+ import {textureFormatDecoder} from '../shadertypes/texture-types/texture-format-decoder';
38
+ import type {ExternalImage} from '../shadertypes/image-types/image-types';
39
+ import {isExternalImage, getExternalImageSize} from '../shadertypes/image-types/image-types';
40
+ import {getTextureFormatTable} from '../shadertypes/texture-types/texture-format-table';
32
41
 
33
42
  /**
34
43
  * Identifies the GPU vendor and driver.
@@ -117,6 +126,84 @@ export abstract class DeviceLimits {
117
126
  abstract maxComputeWorkgroupsPerDimension: number;
118
127
  }
119
128
 
129
+ function formatErrorLogArguments(context: unknown, args: unknown[]): unknown[] {
130
+ const formattedContext = formatErrorLogValue(context);
131
+ const formattedArgs = args.map(formatErrorLogValue).filter(arg => arg !== undefined);
132
+ return [formattedContext, ...formattedArgs].filter(arg => arg !== undefined);
133
+ }
134
+
135
+ function formatErrorLogValue(value: unknown): unknown {
136
+ if (value === undefined) {
137
+ return undefined;
138
+ }
139
+ if (
140
+ value === null ||
141
+ typeof value === 'string' ||
142
+ typeof value === 'number' ||
143
+ typeof value === 'boolean'
144
+ ) {
145
+ return value;
146
+ }
147
+ if (value instanceof Error) {
148
+ return value.message;
149
+ }
150
+ if (Array.isArray(value)) {
151
+ return value.map(formatErrorLogValue);
152
+ }
153
+ if (typeof value === 'object') {
154
+ if (hasCustomToString(value)) {
155
+ const stringValue = String(value);
156
+ if (stringValue !== '[object Object]') {
157
+ return stringValue;
158
+ }
159
+ }
160
+
161
+ if (looksLikeGPUCompilationMessage(value)) {
162
+ return formatGPUCompilationMessage(value);
163
+ }
164
+
165
+ return value.constructor?.name || 'Object';
166
+ }
167
+
168
+ return String(value);
169
+ }
170
+
171
+ function hasCustomToString(value: object): boolean {
172
+ return (
173
+ 'toString' in value &&
174
+ typeof value.toString === 'function' &&
175
+ value.toString !== Object.prototype.toString
176
+ );
177
+ }
178
+
179
+ function looksLikeGPUCompilationMessage(value: object): value is {
180
+ message?: unknown;
181
+ type?: unknown;
182
+ lineNum?: unknown;
183
+ linePos?: unknown;
184
+ } {
185
+ return 'message' in value && 'type' in value;
186
+ }
187
+
188
+ function formatGPUCompilationMessage(value: {
189
+ message?: unknown;
190
+ type?: unknown;
191
+ lineNum?: unknown;
192
+ linePos?: unknown;
193
+ }): string {
194
+ const type = typeof value.type === 'string' ? value.type : 'message';
195
+ const message = typeof value.message === 'string' ? value.message : '';
196
+ const lineNum = typeof value.lineNum === 'number' ? value.lineNum : null;
197
+ const linePos = typeof value.linePos === 'number' ? value.linePos : null;
198
+ const location =
199
+ lineNum !== null && linePos !== null
200
+ ? ` @ ${lineNum}:${linePos}`
201
+ : lineNum !== null
202
+ ? ` @ ${lineNum}`
203
+ : '';
204
+ return `${type}${location}: ${message}`.trim();
205
+ }
206
+
120
207
  /** Set-like class for features (lets apps check for WebGL / WebGPU extensions) */
121
208
  export class DeviceFeatures {
122
209
  protected features: Set<DeviceFeature>;
@@ -172,7 +259,6 @@ export type WebGPUDeviceFeature =
172
259
 
173
260
  export type WebGLDeviceFeature =
174
261
  // webgl extension features
175
- | 'timer-query-webgl' // unify with WebGPU timestamp-query?
176
262
  | 'compilation-status-async-webgl' // Non-blocking shader compile/link status query available
177
263
  | 'provoking-vertex-webgl' // parameters.provokingVertex
178
264
  | 'polygon-mode-webgl' // parameters.polygonMode and parameters.polygonOffsetLine
@@ -187,6 +273,7 @@ export type WebGLDeviceFeature =
187
273
  | 'float16-renderable-webgl'
188
274
  | 'rgb9e5ufloat-renderable-webgl'
189
275
  | 'snorm8-renderable-webgl'
276
+ | 'norm16-webgl'
190
277
  | 'norm16-renderable-webgl'
191
278
  | 'snorm16-renderable-webgl'
192
279
 
@@ -241,18 +328,29 @@ export type DeviceProps = {
241
328
  /** Error handler. If it returns a probe logger style function, it will be called at the site of the error to optimize console error links. */
242
329
  onError?: (error: Error, context?: unknown) => unknown;
243
330
  /** Called when the size of a CanvasContext's canvas changes */
244
- onResize?: (ctx: CanvasContext, info: {oldPixelSize: [number, number]}) => unknown;
331
+ onResize?: (
332
+ ctx: CanvasContext | PresentationContext,
333
+ info: {oldPixelSize: [number, number]}
334
+ ) => unknown;
245
335
  /** Called when the absolute position of a CanvasContext's canvas changes. Must set `CanvasContextProps.trackPosition: true` */
246
- onPositionChange?: (ctx: CanvasContext, info: {oldPosition: [number, number]}) => unknown;
336
+ onPositionChange?: (
337
+ ctx: CanvasContext | PresentationContext,
338
+ info: {oldPosition: [number, number]}
339
+ ) => unknown;
247
340
  /** Called when the visibility of a CanvasContext's canvas changes */
248
- onVisibilityChange?: (ctx: CanvasContext) => unknown;
341
+ onVisibilityChange?: (ctx: CanvasContext | PresentationContext) => unknown;
249
342
  /** Called when the device pixel ratio of a CanvasContext's canvas changes */
250
- onDevicePixelRatioChange?: (ctx: CanvasContext, info: {oldRatio: number}) => unknown;
343
+ onDevicePixelRatioChange?: (
344
+ ctx: CanvasContext | PresentationContext,
345
+ info: {oldRatio: number}
346
+ ) => unknown;
251
347
 
252
348
  // DEBUG SETTINGS
253
349
 
254
350
  /** Turn on implementation defined checks that slow down execution but help break where errors occur */
255
351
  debug?: boolean;
352
+ /** Enable GPU timestamp collection without enabling all debug validation paths. */
353
+ debugGPUTime?: boolean;
256
354
  /** Show shader source in browser? The default is `'error'`, meaning that logs are shown when shader compilation has errors */
257
355
  debugShaders?: 'never' | 'errors' | 'warnings' | 'always';
258
356
  /** Renders a small version of updated Framebuffers into the primary canvas context. Can be set in console luma.log.set('debug-framebuffers', true) */
@@ -278,15 +376,31 @@ export type DeviceProps = {
278
376
  _initializeFeatures?: boolean;
279
377
  /** Enable shader caching (via ShaderFactory) */
280
378
  _cacheShaders?: boolean;
281
- /** Enable shader caching (via PipelineFactory) */
379
+ /**
380
+ * Destroy cached shaders when they become unused.
381
+ * Defaults to `false` so repeated create/destroy cycles can still reuse cached shaders.
382
+ * Enable this if the application creates very large numbers of distinct shaders and needs cache eviction.
383
+ */
384
+ _destroyShaders?: boolean;
385
+ /** Enable pipeline caching (via PipelineFactory) */
282
386
  _cachePipelines?: boolean;
283
- /** Never destroy cached shaders and pipelines */
284
- _cacheDestroyPolicy?: 'unused' | 'never';
387
+ /** Enable sharing of backend render-pipeline implementations when caching is enabled. Currently used by WebGL. */
388
+ _sharePipelines?: boolean;
389
+ /**
390
+ * Destroy cached pipelines when they become unused.
391
+ * Defaults to `false` so repeated create/destroy cycles can still reuse cached pipelines.
392
+ * Enable this if the application creates very large numbers of distinct pipelines and needs cache eviction.
393
+ */
394
+ _destroyPipelines?: boolean;
285
395
 
286
396
  /** @deprecated Internal, Do not use directly! Use `luma.attachDevice()` to attach to pre-created contexts/devices. */
287
397
  _handle?: unknown; // WebGL2RenderingContext | GPUDevice | null;
288
398
  };
289
399
 
400
+ type DeviceFactories = {
401
+ bindGroupFactory?: unknown;
402
+ };
403
+
290
404
  /** WebGL independent copy of WebGLContextAttributes */
291
405
  type WebGLContextProps = {
292
406
  /** indicates if the canvas contains an alpha buffer. */
@@ -349,7 +463,8 @@ export abstract class Device {
349
463
  log.log(1, `${context} DPR changed ${info.oldRatio} => ${context.devicePixelRatio}`)(),
350
464
 
351
465
  // Debug flags
352
- debug: log.get('debug') || undefined!,
466
+ debug: getDefaultDebugValue(),
467
+ debugGPUTime: false,
353
468
  debugShaders: log.get('debug-shaders') || undefined!,
354
469
  debugFramebuffers: Boolean(log.get('debug-framebuffers')),
355
470
  debugFactories: Boolean(log.get('debug-factories')),
@@ -360,9 +475,11 @@ export abstract class Device {
360
475
  // Experimental
361
476
  _reuseDevices: false,
362
477
  _requestMaxLimits: true,
363
- _cacheShaders: false,
364
- _cachePipelines: false,
365
- _cacheDestroyPolicy: 'unused',
478
+ _cacheShaders: true,
479
+ _destroyShaders: false,
480
+ _cachePipelines: true,
481
+ _sharePipelines: true,
482
+ _destroyPipelines: false,
366
483
  // TODO - Change these after confirming things work as expected
367
484
  _initializeFeatures: true,
368
485
  _disabledFeatures: {
@@ -394,13 +511,15 @@ export abstract class Device {
394
511
  userData: {[key: string]: unknown} = {};
395
512
  /** stats */
396
513
  readonly statsManager: StatsManager = lumaStats;
514
+ /** Internal per-device factory storage */
515
+ _factories: DeviceFactories = {};
397
516
  /** An abstract timestamp used for change tracking */
398
517
  timestamp: number = 0;
399
518
 
400
519
  /** True if this device has been reused during device creation (app has multiple references) */
401
520
  _reused: boolean = false;
402
521
  /** Used by other luma.gl modules to store data on the device */
403
- _lumaData: {[key: string]: unknown} = {};
522
+ private _moduleData: Record<string, Record<string, unknown>> = {};
404
523
 
405
524
  // Capabilities
406
525
 
@@ -419,6 +538,8 @@ export abstract class Device {
419
538
  abstract preferredDepthFormat: 'depth16' | 'depth24plus' | 'depth32float';
420
539
 
421
540
  protected _textureCaps: Partial<Record<TextureFormat, DeviceTextureFormatCapabilities>> = {};
541
+ /** Internal timestamp query set used when GPU timing collection is enabled for this device. */
542
+ protected _debugGPUTimeQuery: QuerySet | null = null;
422
543
 
423
544
  constructor(props: DeviceProps) {
424
545
  this.props = {...Device.defaultProps, ...props};
@@ -427,8 +548,10 @@ export abstract class Device {
427
548
 
428
549
  abstract destroy(): void;
429
550
 
551
+ // TODO - just expose the shadertypes decoders?
552
+
430
553
  getVertexFormatInfo(format: VertexFormat): VertexFormatInfo {
431
- return getVertexFormatInfo(format);
554
+ return vertexFormatDecoder.getVertexFormatInfo(format);
432
555
  }
433
556
 
434
557
  isVertexFormatSupported(format: VertexFormat): boolean {
@@ -451,9 +574,6 @@ export abstract class Device {
451
574
  return textureCaps;
452
575
  }
453
576
 
454
- /** Return the implementation specific alignment for a texture format. 1 on WebGL, 256 on WebGPU */
455
- abstract getTextureByteAlignment(): number;
456
-
457
577
  /** Calculates the number of mip levels for a texture of width, height and in case of 3d textures only, depth */
458
578
  getMipLevelCount(width: number, height: number, depth3d: number = 1): number {
459
579
  const maxSize = Math.max(width, height, depth3d);
@@ -490,6 +610,19 @@ export abstract class Device {
490
610
  return textureFormatDecoder.isCompressed(format);
491
611
  }
492
612
 
613
+ /** Returns the compressed texture formats that can be created and sampled on this device */
614
+ getSupportedCompressedTextureFormats(): CompressedTextureFormat[] {
615
+ const supportedFormats: CompressedTextureFormat[] = [];
616
+
617
+ for (const format of Object.keys(getTextureFormatTable()) as TextureFormat[]) {
618
+ if (this.isTextureFormatCompressed(format) && this.isTextureFormatSupported(format)) {
619
+ supportedFormats.push(format as CompressedTextureFormat);
620
+ }
621
+ }
622
+
623
+ return supportedFormats;
624
+ }
625
+
493
626
  // DEBUG METHODS
494
627
 
495
628
  pushDebugGroup(groupLabel: string): void {
@@ -547,8 +680,14 @@ export abstract class Device {
547
680
  // Call the error handler
548
681
  const isHandled = this.props.onError(error, context);
549
682
  if (!isHandled) {
683
+ const logArguments = formatErrorLogArguments(context, args);
550
684
  // Note: Returns a function that must be called: `device.reportError(...)()`
551
- return log.error(error.message, context, ...args);
685
+ return log.error(
686
+ this.type === 'webgl' ? '%cWebGL' : '%cWebGPU',
687
+ 'color: white; background: red; padding: 2px 6px; border-radius: 3px;',
688
+ error.message,
689
+ ...logArguments
690
+ );
552
691
  }
553
692
  return () => {};
554
693
  }
@@ -583,6 +722,9 @@ or create a device with the 'debug: true' prop.`;
583
722
  /** Creates a new CanvasContext (WebGPU only) */
584
723
  abstract createCanvasContext(props?: CanvasContextProps): CanvasContext;
585
724
 
725
+ /** Creates a presentation context for a destination canvas. WebGL requires the default canvas context to use an OffscreenCanvas. */
726
+ abstract createPresentationContext(props?: PresentationContextProps): PresentationContext;
727
+
586
728
  /** Call after rendering a frame (necessary e.g. on WebGL OffscreenCanvas) */
587
729
  abstract submit(commandBuffer?: CommandBuffer): void;
588
730
 
@@ -622,6 +764,11 @@ or create a device with the 'debug: true' prop.`;
622
764
 
623
765
  abstract createQuerySet(props: QuerySetProps): QuerySet;
624
766
 
767
+ /** Create a fence sync object */
768
+ createFence(): Fence {
769
+ throw new Error('createFence() not implemented');
770
+ }
771
+
625
772
  /** Create a RenderPass using the default CommandEncoder */
626
773
  beginRenderPass(props?: RenderPassProps): RenderPass {
627
774
  return this.commandEncoder.beginRenderPass(props);
@@ -632,6 +779,101 @@ or create a device with the 'debug: true' prop.`;
632
779
  return this.commandEncoder.beginComputePass(props);
633
780
  }
634
781
 
782
+ /**
783
+ * Generate mipmaps for a WebGPU texture.
784
+ * WebGPU textures must be created up front with the required mip count, usage flags, and a format that supports the chosen generation path.
785
+ * WebGL uses `Texture.generateMipmapsWebGL()` directly because the backend manages mip generation on the texture object itself.
786
+ */
787
+ generateMipmapsWebGPU(_texture: Texture): void {
788
+ throw new Error('not implemented');
789
+ }
790
+
791
+ /** Internal helper for creating a shareable WebGL render-pipeline implementation. */
792
+ _createSharedRenderPipelineWebGL(_props: RenderPipelineProps): SharedRenderPipeline {
793
+ throw new Error('_createSharedRenderPipelineWebGL() not implemented');
794
+ }
795
+
796
+ /** Internal WebGPU-only helper for retrieving the native bind-group layout for a pipeline group. */
797
+ _createBindGroupLayoutWebGPU(
798
+ _pipeline: RenderPipeline | ComputePipeline,
799
+ _group: number
800
+ ): unknown {
801
+ throw new Error('_createBindGroupLayoutWebGPU() not implemented');
802
+ }
803
+
804
+ /** Internal WebGPU-only helper for creating a native bind group. */
805
+ _createBindGroupWebGPU(
806
+ _bindGroupLayout: unknown,
807
+ _shaderLayout: ShaderLayout | ComputeShaderLayout,
808
+ _bindings: Bindings,
809
+ _group: number
810
+ ): unknown {
811
+ throw new Error('_createBindGroupWebGPU() not implemented');
812
+ }
813
+
814
+ /**
815
+ * Internal helper that returns `true` when timestamp-query GPU timing should be
816
+ * collected for this device.
817
+ */
818
+ _supportsDebugGPUTime(): boolean {
819
+ return (
820
+ this.features.has('timestamp-query') && Boolean(this.props.debug || this.props.debugGPUTime)
821
+ );
822
+ }
823
+
824
+ /**
825
+ * Internal helper that enables device-managed GPU timing collection on the
826
+ * default command encoder. Reuses the existing query set if timing is already enabled.
827
+ *
828
+ * @param queryCount - Number of timestamp slots reserved for profiled passes.
829
+ * @returns The device-managed timestamp QuerySet, or `null` when timing is not supported or could not be enabled.
830
+ */
831
+ _enableDebugGPUTime(queryCount: number = 256): QuerySet | null {
832
+ if (!this._supportsDebugGPUTime()) {
833
+ return null;
834
+ }
835
+
836
+ if (this._debugGPUTimeQuery) {
837
+ return this._debugGPUTimeQuery;
838
+ }
839
+
840
+ try {
841
+ this._debugGPUTimeQuery = this.createQuerySet({type: 'timestamp', count: queryCount});
842
+ this.commandEncoder = this.createCommandEncoder({
843
+ id: this.commandEncoder.props.id,
844
+ timeProfilingQuerySet: this._debugGPUTimeQuery
845
+ });
846
+ } catch {
847
+ this._debugGPUTimeQuery = null;
848
+ }
849
+
850
+ return this._debugGPUTimeQuery;
851
+ }
852
+
853
+ /**
854
+ * Internal helper that disables device-managed GPU timing collection and restores
855
+ * the default command encoder to an unprofiled state.
856
+ */
857
+ _disableDebugGPUTime(): void {
858
+ if (!this._debugGPUTimeQuery) {
859
+ return;
860
+ }
861
+
862
+ if (this.commandEncoder.getTimeProfilingQuerySet() === this._debugGPUTimeQuery) {
863
+ this.commandEncoder = this.createCommandEncoder({
864
+ id: this.commandEncoder.props.id
865
+ });
866
+ }
867
+
868
+ this._debugGPUTimeQuery.destroy();
869
+ this._debugGPUTimeQuery = null;
870
+ }
871
+
872
+ /** Internal helper that returns `true` when device-managed GPU timing is currently active. */
873
+ _isDebugGPUTimeEnabled(): boolean {
874
+ return this._debugGPUTimeQuery !== null;
875
+ }
876
+
635
877
  /**
636
878
  * Determines what operations are supported on a texture format, checking against supported device features
637
879
  * Subclasses override to apply additional checks
@@ -711,6 +953,15 @@ or create a device with the 'debug: true' prop.`;
711
953
  throw new Error('not implemented');
712
954
  }
713
955
 
956
+ // INTERNAL LUMA.GL METHODS
957
+
958
+ getModuleData<ModuleDataT extends Record<string, unknown>>(moduleName: string): ModuleDataT {
959
+ this._moduleData[moduleName] ||= {};
960
+ return this._moduleData[moduleName] as ModuleDataT;
961
+ }
962
+
963
+ // INTERNAL HELPERS
964
+
714
965
  // IMPLEMENTATION
715
966
 
716
967
  /** Helper to get the canvas context props */
@@ -756,6 +1007,10 @@ or create a device with the 'debug: true' prop.`;
756
1007
  newProps.indexType = 'uint32';
757
1008
  } else if (props.data instanceof Uint16Array) {
758
1009
  newProps.indexType = 'uint16';
1010
+ } else if (props.data instanceof Uint8Array) {
1011
+ // Convert uint8 to uint16 for WebGPU compatibility (WebGPU doesn't support uint8 indices)
1012
+ newProps.data = new Uint16Array(props.data);
1013
+ newProps.indexType = 'uint16';
759
1014
  }
760
1015
  }
761
1016
  if (!newProps.indexType) {
@@ -766,3 +1021,36 @@ or create a device with the 'debug: true' prop.`;
766
1021
  return newProps;
767
1022
  }
768
1023
  }
1024
+
1025
+ /**
1026
+ * Internal helper for resolving the default `debug` prop.
1027
+ * Precedence is: explicit log debug value first, then `NODE_ENV`, then `false`.
1028
+ */
1029
+ export function _getDefaultDebugValue(logDebugValue: unknown, nodeEnv?: string): boolean {
1030
+ if (logDebugValue !== undefined && logDebugValue !== null) {
1031
+ return Boolean(logDebugValue);
1032
+ }
1033
+
1034
+ if (nodeEnv !== undefined) {
1035
+ return nodeEnv !== 'production';
1036
+ }
1037
+
1038
+ return false;
1039
+ }
1040
+
1041
+ function getDefaultDebugValue(): boolean {
1042
+ return _getDefaultDebugValue(log.get('debug'), getNodeEnv());
1043
+ }
1044
+
1045
+ function getNodeEnv(): string | undefined {
1046
+ const processObject = (
1047
+ globalThis as typeof globalThis & {
1048
+ process?: {env?: Record<string, string | undefined>};
1049
+ }
1050
+ ).process;
1051
+ if (!processObject?.env) {
1052
+ return undefined;
1053
+ }
1054
+
1055
+ return processObject.env['NODE_ENV'];
1056
+ }
@@ -0,0 +1,16 @@
1
+ // luma.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (c) vis.gl contributors
4
+
5
+ import {CanvasSurface} from './canvas-surface';
6
+
7
+ export type {CanvasContextProps as PresentationContextProps} from './canvas-surface';
8
+
9
+ /**
10
+ * Tracks a destination canvas for presentation.
11
+ * Backend implementations either borrow the default GPU-backed canvas (WebGL)
12
+ * or render directly into the destination canvas (WebGPU).
13
+ */
14
+ export abstract class PresentationContext extends CanvasSurface {
15
+ abstract present(): void;
16
+ }
@@ -17,8 +17,8 @@ export type BufferProps = ResourceProps & {
17
17
  byteLength?: number;
18
18
  /** Byte offset into the newly created Buffer to store data at */
19
19
  byteOffset?: number;
20
- /** If props.usage includes Buffer.INDEX */
21
- indexType?: 'uint16' | 'uint32';
20
+ /** If props.usage includes Buffer.INDEX. Note: uint8 indices are automatically converted to uint16 for WebGPU compatibility */
21
+ indexType?: 'uint8' | 'uint16' | 'uint32';
22
22
  /** Data to initialize the buffer with. */
23
23
  data?: ArrayBuffer | ArrayBufferView | null;
24
24
  /** Callback to initialize data without copy */
@@ -50,8 +50,8 @@ export abstract class Buffer extends Resource<BufferProps> {
50
50
 
51
51
  /** The usage with which this buffer was created */
52
52
  readonly usage: number;
53
- /** For index buffers, whether indices are 16 or 32 bit */
54
- readonly indexType?: 'uint16' | 'uint32';
53
+ /** For index buffers, whether indices are 8, 16 or 32 bit. Note: uint8 indices are automatically converted to uint16 for WebGPU compatibility */
54
+ readonly indexType?: 'uint8' | 'uint16' | 'uint32';
55
55
  /** Length of buffer in bytes */
56
56
  abstract byteLength: number;
57
57
  /** "Time" of last update, can be used to check if redraw is needed */
@@ -66,6 +66,8 @@ export abstract class Buffer extends Resource<BufferProps> {
66
66
  deducedProps.indexType = 'uint32';
67
67
  } else if (props.data instanceof Uint16Array) {
68
68
  deducedProps.indexType = 'uint16';
69
+ } else if (props.data instanceof Uint8Array) {
70
+ deducedProps.indexType = 'uint8';
69
71
  }
70
72
  }
71
73
 
@@ -125,20 +127,28 @@ export abstract class Buffer extends Resource<BufferProps> {
125
127
  /** This doesn't handle partial non-zero offset updates correctly */
126
128
  protected _setDebugData(
127
129
  data: ArrayBufferView | ArrayBufferLike | null,
128
- byteOffset: number,
130
+ _byteOffset: number,
129
131
  byteLength: number
130
132
  ): void {
131
- const arrayBuffer: ArrayBufferLike | null = ArrayBuffer.isView(data) ? data.buffer : data;
133
+ let arrayBufferView: ArrayBufferView | null = null;
134
+ let arrayBuffer: ArrayBufferLike | null;
135
+ if (ArrayBuffer.isView(data)) {
136
+ arrayBufferView = data;
137
+ arrayBuffer = data.buffer;
138
+ } else {
139
+ arrayBuffer = data;
140
+ }
132
141
  const debugDataLength = Math.min(
133
142
  data ? data.byteLength : byteLength,
134
143
  Buffer.DEBUG_DATA_MAX_LENGTH
135
144
  );
136
145
  if (arrayBuffer === null) {
137
146
  this.debugData = new ArrayBuffer(debugDataLength);
138
- } else if (byteOffset === 0 && byteLength === arrayBuffer.byteLength) {
139
- this.debugData = arrayBuffer.slice(0, debugDataLength);
140
147
  } else {
141
- this.debugData = arrayBuffer.slice(byteOffset, byteOffset + debugDataLength);
148
+ const sourceByteOffset = Math.min(arrayBufferView?.byteOffset || 0, arrayBuffer.byteLength);
149
+ const availableByteLength = Math.max(0, arrayBuffer.byteLength - sourceByteOffset);
150
+ const copyByteLength = Math.min(debugDataLength, availableByteLength);
151
+ this.debugData = new Uint8Array(arrayBuffer, sourceByteOffset, copyByteLength).slice().buffer;
142
152
  }
143
153
  }
144
154
 
@@ -11,7 +11,7 @@ import {Resource, ResourceProps} from './resource';
11
11
  // // onSubmittedWorkDone(): Promise<undefined>;
12
12
 
13
13
  // writeBuffer(options: WriteBufferOptions): void;
14
- // writeTexture(options: WriteTextureOptions): void;
14
+ // writeTexture(options: TextureWriteOptions): void;
15
15
 
16
16
  // // copyExternalImageToTexture(
17
17
  // // GPUImageCopyExternalImage source,
@@ -23,7 +23,9 @@ import {Resource, ResourceProps} from './resource';
23
23
  export type CommandBufferProps = ResourceProps & {};
24
24
 
25
25
  /**
26
- * Encodes commands to queue that can be executed later
26
+ * Represents the finished contents of exactly one CommandEncoder. Backends may store native
27
+ * command buffers or replayable command lists internally, but submission must preserve the same
28
+ * recorded command ordering.
27
29
  */
28
30
  export abstract class CommandBuffer extends Resource<CommandBufferProps> {
29
31
  override get [Symbol.toStringTag](): string {