@luma.gl/core 9.2.6 → 9.3.0-alpha.11

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 (282) 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 +193 -11
  16. package/dist/adapter/device.js.map +1 -1
  17. package/dist/adapter/luma.d.ts.map +1 -1
  18. package/dist/adapter/luma.js +2 -1
  19. package/dist/adapter/luma.js.map +1 -1
  20. package/dist/adapter/presentation-context.d.ts +11 -0
  21. package/dist/adapter/presentation-context.d.ts.map +1 -0
  22. package/dist/adapter/presentation-context.js +12 -0
  23. package/dist/adapter/presentation-context.js.map +1 -0
  24. package/dist/adapter/resources/buffer.d.ts +1 -1
  25. package/dist/adapter/resources/buffer.d.ts.map +1 -1
  26. package/dist/adapter/resources/buffer.js +14 -6
  27. package/dist/adapter/resources/buffer.js.map +1 -1
  28. package/dist/adapter/resources/command-buffer.d.ts +3 -1
  29. package/dist/adapter/resources/command-buffer.d.ts.map +1 -1
  30. package/dist/adapter/resources/command-buffer.js +3 -1
  31. package/dist/adapter/resources/command-buffer.js.map +1 -1
  32. package/dist/adapter/resources/command-encoder.d.ts +30 -7
  33. package/dist/adapter/resources/command-encoder.d.ts.map +1 -1
  34. package/dist/adapter/resources/command-encoder.js +68 -2
  35. package/dist/adapter/resources/command-encoder.js.map +1 -1
  36. package/dist/adapter/resources/compute-pipeline.d.ts +2 -2
  37. package/dist/adapter/resources/compute-pipeline.d.ts.map +1 -1
  38. package/dist/adapter/resources/fence.d.ts +16 -0
  39. package/dist/adapter/resources/fence.d.ts.map +1 -0
  40. package/dist/adapter/resources/fence.js +17 -0
  41. package/dist/adapter/resources/fence.js.map +1 -0
  42. package/dist/adapter/resources/framebuffer.d.ts +1 -1
  43. package/dist/adapter/resources/framebuffer.d.ts.map +1 -1
  44. package/dist/adapter/resources/framebuffer.js +15 -12
  45. package/dist/adapter/resources/framebuffer.js.map +1 -1
  46. package/dist/adapter/resources/query-set.d.ts +17 -1
  47. package/dist/adapter/resources/query-set.d.ts.map +1 -1
  48. package/dist/adapter/resources/query-set.js.map +1 -1
  49. package/dist/adapter/resources/render-pipeline.d.ts +28 -10
  50. package/dist/adapter/resources/render-pipeline.d.ts.map +1 -1
  51. package/dist/adapter/resources/render-pipeline.js +21 -2
  52. package/dist/adapter/resources/render-pipeline.js.map +1 -1
  53. package/dist/adapter/resources/resource.d.ts +13 -0
  54. package/dist/adapter/resources/resource.d.ts.map +1 -1
  55. package/dist/adapter/resources/resource.js +243 -14
  56. package/dist/adapter/resources/resource.js.map +1 -1
  57. package/dist/adapter/resources/shader.js +27 -25
  58. package/dist/adapter/resources/shader.js.map +1 -1
  59. package/dist/adapter/resources/shared-render-pipeline.d.ts +22 -0
  60. package/dist/adapter/resources/shared-render-pipeline.d.ts.map +1 -0
  61. package/dist/adapter/resources/shared-render-pipeline.js +25 -0
  62. package/dist/adapter/resources/shared-render-pipeline.js.map +1 -0
  63. package/dist/adapter/resources/texture-view.d.ts +1 -1
  64. package/dist/adapter/resources/texture-view.d.ts.map +1 -1
  65. package/dist/adapter/resources/texture.d.ts +168 -28
  66. package/dist/adapter/resources/texture.d.ts.map +1 -1
  67. package/dist/adapter/resources/texture.js +284 -25
  68. package/dist/adapter/resources/texture.js.map +1 -1
  69. package/dist/adapter/types/attachments.d.ts +1 -1
  70. package/dist/adapter/types/attachments.d.ts.map +1 -1
  71. package/dist/adapter/types/buffer-layout.d.ts +1 -1
  72. package/dist/adapter/types/buffer-layout.d.ts.map +1 -1
  73. package/dist/adapter/types/parameters.d.ts +3 -1
  74. package/dist/adapter/types/parameters.d.ts.map +1 -1
  75. package/dist/adapter/types/parameters.js +1 -0
  76. package/dist/adapter/types/parameters.js.map +1 -1
  77. package/dist/adapter/types/shader-layout.d.ts +10 -6
  78. package/dist/adapter/types/shader-layout.d.ts.map +1 -1
  79. package/dist/adapter/types/uniforms.d.ts +6 -0
  80. package/dist/adapter/types/uniforms.d.ts.map +1 -1
  81. package/dist/adapter-utils/bind-groups.d.ts +9 -0
  82. package/dist/adapter-utils/bind-groups.d.ts.map +1 -0
  83. package/dist/adapter-utils/bind-groups.js +41 -0
  84. package/dist/adapter-utils/bind-groups.js.map +1 -0
  85. package/dist/adapter-utils/format-compiler-log.d.ts.map +1 -1
  86. package/dist/adapter-utils/format-compiler-log.js +23 -15
  87. package/dist/adapter-utils/format-compiler-log.js.map +1 -1
  88. package/dist/adapter-utils/get-attribute-from-layouts.d.ts +2 -2
  89. package/dist/adapter-utils/get-attribute-from-layouts.d.ts.map +1 -1
  90. package/dist/adapter-utils/get-attribute-from-layouts.js +6 -6
  91. package/dist/adapter-utils/get-attribute-from-layouts.js.map +1 -1
  92. package/dist/dist.dev.js +2734 -644
  93. package/dist/dist.min.js +10 -9
  94. package/dist/factories/bind-group-factory.d.ts +20 -0
  95. package/dist/factories/bind-group-factory.d.ts.map +1 -0
  96. package/dist/factories/bind-group-factory.js +88 -0
  97. package/dist/factories/bind-group-factory.js.map +1 -0
  98. package/dist/factories/core-module-state.d.ts +7 -0
  99. package/dist/factories/core-module-state.d.ts.map +1 -0
  100. package/dist/{shadertypes/data-types/shader-types.js → factories/core-module-state.js} +1 -1
  101. package/dist/factories/core-module-state.js.map +1 -0
  102. package/dist/factories/pipeline-factory.d.ts +54 -0
  103. package/dist/factories/pipeline-factory.d.ts.map +1 -0
  104. package/dist/factories/pipeline-factory.js +270 -0
  105. package/dist/factories/pipeline-factory.js.map +1 -0
  106. package/dist/factories/shader-factory.d.ts +20 -0
  107. package/dist/factories/shader-factory.d.ts.map +1 -0
  108. package/dist/factories/shader-factory.js +84 -0
  109. package/dist/factories/shader-factory.js.map +1 -0
  110. package/dist/index.cjs +2447 -534
  111. package/dist/index.cjs.map +4 -4
  112. package/dist/index.d.ts +30 -14
  113. package/dist/index.d.ts.map +1 -1
  114. package/dist/index.js +19 -7
  115. package/dist/index.js.map +1 -1
  116. package/dist/portable/shader-block-writer.d.ts +51 -0
  117. package/dist/portable/shader-block-writer.d.ts.map +1 -0
  118. package/dist/portable/shader-block-writer.js +185 -0
  119. package/dist/portable/shader-block-writer.js.map +1 -0
  120. package/dist/portable/uniform-block.d.ts +1 -1
  121. package/dist/portable/uniform-block.d.ts.map +1 -1
  122. package/dist/portable/uniform-store.d.ts +55 -24
  123. package/dist/portable/uniform-store.d.ts.map +1 -1
  124. package/dist/portable/uniform-store.js +73 -25
  125. package/dist/portable/uniform-store.js.map +1 -1
  126. package/dist/shadertypes/data-types/data-type-decoder.d.ts +20 -0
  127. package/dist/shadertypes/data-types/data-type-decoder.d.ts.map +1 -0
  128. package/dist/shadertypes/data-types/data-type-decoder.js +79 -0
  129. package/dist/shadertypes/data-types/data-type-decoder.js.map +1 -0
  130. package/dist/shadertypes/data-types/data-types.d.ts +31 -12
  131. package/dist/shadertypes/data-types/data-types.d.ts.map +1 -1
  132. package/dist/shadertypes/data-types/decode-data-types.d.ts.map +1 -1
  133. package/dist/shadertypes/data-types/decode-data-types.js +4 -3
  134. package/dist/shadertypes/data-types/decode-data-types.js.map +1 -1
  135. package/dist/{image-utils → shadertypes/image-types}/image-types.d.ts +0 -6
  136. package/dist/shadertypes/image-types/image-types.d.ts.map +1 -0
  137. package/dist/shadertypes/image-types/image-types.js.map +1 -0
  138. package/dist/shadertypes/shader-types/shader-block-layout.d.ts +72 -0
  139. package/dist/shadertypes/shader-types/shader-block-layout.d.ts.map +1 -0
  140. package/dist/shadertypes/shader-types/shader-block-layout.js +209 -0
  141. package/dist/shadertypes/shader-types/shader-block-layout.js.map +1 -0
  142. package/dist/shadertypes/shader-types/shader-type-decoder.d.ts +41 -0
  143. package/dist/shadertypes/shader-types/shader-type-decoder.d.ts.map +1 -0
  144. package/dist/shadertypes/{data-types/decode-shader-types.js → shader-types/shader-type-decoder.js} +43 -4
  145. package/dist/shadertypes/shader-types/shader-type-decoder.js.map +1 -0
  146. package/dist/shadertypes/shader-types/shader-types.d.ts +101 -0
  147. package/dist/shadertypes/shader-types/shader-types.d.ts.map +1 -0
  148. package/dist/shadertypes/shader-types/shader-types.js +30 -0
  149. package/dist/shadertypes/shader-types/shader-types.js.map +1 -0
  150. package/dist/shadertypes/texture-types/pixel-utils.d.ts.map +1 -0
  151. package/dist/shadertypes/{textures → texture-types}/pixel-utils.js +4 -4
  152. package/dist/shadertypes/texture-types/pixel-utils.js.map +1 -0
  153. package/dist/shadertypes/texture-types/texture-format-decoder.d.ts +36 -0
  154. package/dist/shadertypes/texture-types/texture-format-decoder.d.ts.map +1 -0
  155. package/dist/shadertypes/{textures → texture-types}/texture-format-decoder.js +110 -38
  156. package/dist/shadertypes/texture-types/texture-format-decoder.js.map +1 -0
  157. package/dist/shadertypes/texture-types/texture-format-generics.d.ts +34 -0
  158. package/dist/shadertypes/texture-types/texture-format-generics.d.ts.map +1 -0
  159. package/dist/shadertypes/texture-types/texture-format-generics.js.map +1 -0
  160. package/dist/shadertypes/texture-types/texture-format-table.d.ts.map +1 -0
  161. package/dist/shadertypes/{textures → texture-types}/texture-format-table.js +12 -11
  162. package/dist/shadertypes/texture-types/texture-format-table.js.map +1 -0
  163. package/dist/shadertypes/{textures → texture-types}/texture-formats.d.ts +51 -17
  164. package/dist/shadertypes/texture-types/texture-formats.d.ts.map +1 -0
  165. package/dist/shadertypes/{textures → texture-types}/texture-formats.js +1 -0
  166. package/dist/shadertypes/texture-types/texture-formats.js.map +1 -0
  167. package/dist/shadertypes/texture-types/texture-layout.d.ts +5 -0
  168. package/dist/shadertypes/texture-types/texture-layout.d.ts.map +1 -0
  169. package/dist/shadertypes/texture-types/texture-layout.js +41 -0
  170. package/dist/shadertypes/texture-types/texture-layout.js.map +1 -0
  171. package/dist/shadertypes/vertex-types/vertex-format-decoder.d.ts +24 -0
  172. package/dist/shadertypes/vertex-types/vertex-format-decoder.d.ts.map +1 -0
  173. package/dist/shadertypes/vertex-types/vertex-format-decoder.js +144 -0
  174. package/dist/shadertypes/vertex-types/vertex-format-decoder.js.map +1 -0
  175. package/dist/shadertypes/vertex-types/vertex-formats.d.ts +50 -0
  176. package/dist/shadertypes/vertex-types/vertex-formats.d.ts.map +1 -0
  177. package/dist/shadertypes/vertex-types/vertex-formats.js.map +1 -0
  178. package/dist/utils/array-equal.d.ts +1 -1
  179. package/dist/utils/array-equal.d.ts.map +1 -1
  180. package/dist/utils/array-equal.js +15 -9
  181. package/dist/utils/array-equal.js.map +1 -1
  182. package/dist/utils/assert.d.ts +5 -0
  183. package/dist/utils/assert.d.ts.map +1 -0
  184. package/dist/utils/assert.js +17 -0
  185. package/dist/utils/assert.js.map +1 -0
  186. package/dist/utils/stats-manager.d.ts.map +1 -1
  187. package/dist/utils/stats-manager.js +61 -1
  188. package/dist/utils/stats-manager.js.map +1 -1
  189. package/package.json +6 -6
  190. package/src/adapter/canvas-context.ts +7 -556
  191. package/src/adapter/canvas-observer.ts +130 -0
  192. package/src/adapter/canvas-surface.ts +521 -0
  193. package/src/adapter/device.ts +311 -25
  194. package/src/adapter/luma.ts +1 -0
  195. package/src/adapter/presentation-context.ts +16 -0
  196. package/src/adapter/resources/buffer.ts +13 -5
  197. package/src/adapter/resources/command-buffer.ts +4 -2
  198. package/src/adapter/resources/command-encoder.ts +101 -10
  199. package/src/adapter/resources/compute-pipeline.ts +2 -2
  200. package/src/adapter/resources/fence.ts +32 -0
  201. package/src/adapter/resources/framebuffer.ts +16 -13
  202. package/src/adapter/resources/query-set.ts +17 -1
  203. package/src/adapter/resources/render-pipeline.ts +52 -16
  204. package/src/adapter/resources/resource.ts +289 -14
  205. package/src/adapter/resources/shader.ts +28 -28
  206. package/src/adapter/resources/shared-render-pipeline.ts +40 -0
  207. package/src/adapter/resources/texture-view.ts +1 -1
  208. package/src/adapter/resources/texture.ts +427 -49
  209. package/src/adapter/types/attachments.ts +1 -1
  210. package/src/adapter/types/buffer-layout.ts +1 -1
  211. package/src/adapter/types/parameters.ts +4 -1
  212. package/src/adapter/types/shader-layout.ts +15 -9
  213. package/src/adapter/types/uniforms.ts +12 -0
  214. package/src/adapter-utils/bind-groups.ts +71 -0
  215. package/src/adapter-utils/format-compiler-log.ts +23 -15
  216. package/src/adapter-utils/get-attribute-from-layouts.ts +8 -11
  217. package/src/factories/bind-group-factory.ts +157 -0
  218. package/src/factories/core-module-state.ts +11 -0
  219. package/src/factories/pipeline-factory.ts +328 -0
  220. package/src/factories/shader-factory.ts +103 -0
  221. package/src/index.ts +70 -26
  222. package/src/portable/shader-block-writer.ts +254 -0
  223. package/src/portable/uniform-block.ts +1 -1
  224. package/src/portable/uniform-store.ts +98 -40
  225. package/src/shadertypes/data-types/data-type-decoder.ts +105 -0
  226. package/src/shadertypes/data-types/data-types.ts +100 -48
  227. package/src/shadertypes/data-types/decode-data-types.ts +4 -3
  228. package/src/{image-utils → shadertypes/image-types}/image-types.ts +0 -7
  229. package/src/shadertypes/shader-types/shader-block-layout.ts +340 -0
  230. package/src/shadertypes/{data-types/decode-shader-types.ts → shader-types/shader-type-decoder.ts} +88 -14
  231. package/src/shadertypes/shader-types/shader-types.ts +207 -0
  232. package/src/shadertypes/{textures → texture-types}/pixel-utils.ts +4 -4
  233. package/src/shadertypes/{textures → texture-types}/texture-format-decoder.ts +167 -46
  234. package/src/shadertypes/{textures → texture-types}/texture-format-generics.ts +42 -48
  235. package/src/shadertypes/{textures → texture-types}/texture-format-table.ts +12 -11
  236. package/src/shadertypes/{textures → texture-types}/texture-formats.ts +73 -17
  237. package/src/shadertypes/texture-types/texture-layout.ts +60 -0
  238. package/src/shadertypes/vertex-types/vertex-format-decoder.ts +175 -0
  239. package/src/shadertypes/vertex-types/vertex-formats.ts +196 -0
  240. package/src/utils/array-equal.ts +21 -9
  241. package/src/utils/assert.ts +18 -0
  242. package/src/utils/stats-manager.ts +76 -2
  243. package/dist/image-utils/image-types.d.ts.map +0 -1
  244. package/dist/image-utils/image-types.js.map +0 -1
  245. package/dist/portable/uniform-buffer-layout.d.ts +0 -28
  246. package/dist/portable/uniform-buffer-layout.d.ts.map +0 -1
  247. package/dist/portable/uniform-buffer-layout.js +0 -96
  248. package/dist/portable/uniform-buffer-layout.js.map +0 -1
  249. package/dist/shadertypes/data-types/decode-shader-types.d.ts +0 -17
  250. package/dist/shadertypes/data-types/decode-shader-types.d.ts.map +0 -1
  251. package/dist/shadertypes/data-types/decode-shader-types.js.map +0 -1
  252. package/dist/shadertypes/data-types/shader-types.d.ts +0 -45
  253. package/dist/shadertypes/data-types/shader-types.d.ts.map +0 -1
  254. package/dist/shadertypes/data-types/shader-types.js.map +0 -1
  255. package/dist/shadertypes/textures/pixel-utils.d.ts.map +0 -1
  256. package/dist/shadertypes/textures/pixel-utils.js.map +0 -1
  257. package/dist/shadertypes/textures/texture-format-decoder.d.ts +0 -18
  258. package/dist/shadertypes/textures/texture-format-decoder.d.ts.map +0 -1
  259. package/dist/shadertypes/textures/texture-format-decoder.js.map +0 -1
  260. package/dist/shadertypes/textures/texture-format-generics.d.ts +0 -33
  261. package/dist/shadertypes/textures/texture-format-generics.d.ts.map +0 -1
  262. package/dist/shadertypes/textures/texture-format-generics.js.map +0 -1
  263. package/dist/shadertypes/textures/texture-format-table.d.ts.map +0 -1
  264. package/dist/shadertypes/textures/texture-format-table.js.map +0 -1
  265. package/dist/shadertypes/textures/texture-formats.d.ts.map +0 -1
  266. package/dist/shadertypes/textures/texture-formats.js.map +0 -1
  267. package/dist/shadertypes/vertex-arrays/decode-vertex-format.d.ts +0 -18
  268. package/dist/shadertypes/vertex-arrays/decode-vertex-format.d.ts.map +0 -1
  269. package/dist/shadertypes/vertex-arrays/decode-vertex-format.js +0 -100
  270. package/dist/shadertypes/vertex-arrays/decode-vertex-format.js.map +0 -1
  271. package/dist/shadertypes/vertex-arrays/vertex-formats.d.ts +0 -27
  272. package/dist/shadertypes/vertex-arrays/vertex-formats.d.ts.map +0 -1
  273. package/dist/shadertypes/vertex-arrays/vertex-formats.js.map +0 -1
  274. package/src/portable/uniform-buffer-layout.ts +0 -118
  275. package/src/shadertypes/data-types/shader-types.ts +0 -87
  276. package/src/shadertypes/vertex-arrays/decode-vertex-format.ts +0 -124
  277. package/src/shadertypes/vertex-arrays/vertex-formats.ts +0 -91
  278. /package/dist/{image-utils → shadertypes/image-types}/image-types.js +0 -0
  279. /package/dist/shadertypes/{textures → texture-types}/pixel-utils.d.ts +0 -0
  280. /package/dist/shadertypes/{textures → texture-types}/texture-format-generics.js +0 -0
  281. /package/dist/shadertypes/{textures → texture-types}/texture-format-table.d.ts +0 -0
  282. /package/dist/shadertypes/{vertex-arrays → vertex-types}/vertex-formats.js +0 -0
@@ -0,0 +1,196 @@
1
+ // luma.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (c) vis.gl contributors
4
+
5
+ import {
6
+ DataTypeIsIntegerT,
7
+ DataTypeIsNormalizedT,
8
+ DataTypeIsSignedT
9
+ } from '../data-types/data-types';
10
+
11
+ /**
12
+ * Describes the **memory format** and interpretation (normalization) of a buffer that will be supplied to vertex attributes
13
+ * @note Must be compatible with the AttributeShaderType of the shaders, see documentation.
14
+ * @note This is a superset of WebGPU vertex formats to allow for some flexibility for WebGL only applications
15
+ * @todo Add device.isVertexFormatSupported() method?
16
+ */
17
+ export type VertexFormat =
18
+ // 8 bit integers, note that only 16 bit aligned formats are supported in WebGPU (x2 and x4)
19
+ | 'uint8' // Chrome 133+
20
+ | 'uint8x2'
21
+ | 'uint8x4'
22
+ | 'sint8' // Chrome 133+
23
+ | 'sint8x2'
24
+ | 'sint8x4'
25
+ | 'unorm8' // Chrome 133+
26
+ | 'unorm8x2'
27
+ | 'unorm8x3-webgl' // Not in WebGPU
28
+ | 'unorm8x4'
29
+ | 'unorm8x4-bgra' // Chrome 133+
30
+ | 'unorm10-10-10-2' // Chrome 119+
31
+ // | 'snorm-10-10-10-2' // Not in WebGPU, DXD12 doesn't support
32
+ | 'snorm8' // Chrome 133+
33
+ | 'snorm8x2'
34
+ | 'snorm8x3-webgl'
35
+ | 'snorm8x4'
36
+ // 16 bit integers, that only 32 bit aligned formats are supported in WebGPU (x2 and x4)
37
+ | 'uint16' // Chrome 133+
38
+ | 'sint16' // Chrome 133+
39
+ | 'unorm16' // Chrome 133+
40
+ | 'snorm16' // Chrome 133+
41
+ | 'uint16x2'
42
+ | 'uint16x3-webgl' // Not in WebGPU
43
+ | 'uint16x4'
44
+ | 'sint16x2'
45
+ | 'sint16x3-webgl' // Not in WebGPU
46
+ | 'sint16x4'
47
+ | 'unorm16x2'
48
+ | 'unorm16x3-webgl' // Not in WebGPU
49
+ | 'unorm16x4'
50
+ | 'snorm16x2'
51
+ | 'snorm16x3-webgl' // Not in WebGPU
52
+ | 'snorm16x4'
53
+ // 32 bit integers
54
+ | 'uint32'
55
+ | 'uint32x2'
56
+ | 'uint32x3'
57
+ | 'uint32x4'
58
+ | 'sint32'
59
+ | 'sint32x2'
60
+ | 'sint32x3'
61
+ | 'sint32x4'
62
+ // No normalized 32 bit integers in WebGPU...
63
+ // | 'unorm32'
64
+ // | 'unorm32x2'
65
+ // | 'unorm32x3'
66
+ // | 'unorm32x4'
67
+ // | 'snorm32'
68
+ // | 'snorm32x2'
69
+ // | 'snorm32x3'
70
+ // | 'snorm32x4'
71
+ // floats
72
+ | 'float16' // Chrome 133+
73
+ | 'float16x2'
74
+ | 'float16x4'
75
+ | 'float32'
76
+ | 'float32x2'
77
+ | 'float32x3'
78
+ | 'float32x4';
79
+
80
+ /**
81
+ * @type Information about a vertex format
82
+ */
83
+ export type VertexFormatInfo<T extends VertexFormat = VertexFormat> = {
84
+ /** Type of each component */
85
+ type: VertexFormatDataTypeT<T>;
86
+ /** Number of components per vertex / row */
87
+ components: VertexFormatComponentsT<T>;
88
+ /** Is this an integer format (normalized integer formats are not integer) */
89
+ integer: DataTypeIsIntegerT<VertexFormatDataTypeT<T>>;
90
+ /** Is this a signed format? */
91
+ signed: DataTypeIsSignedT<VertexFormatDataTypeT<T>>;
92
+ /** Is this a normalized format? */
93
+ normalized: DataTypeIsNormalizedT<VertexFormatDataTypeT<T>>;
94
+ /** Length in bytes */
95
+ byteLength: number;
96
+ /** Is this a bgra format? */
97
+ bgra?: boolean;
98
+ /** Is this a webgl only format? */
99
+ webglOnly?: boolean;
100
+ };
101
+
102
+ /** @type the NormalizedDataType of the components in a VertexFormat */
103
+ export type VertexFormatDataTypeT<T extends VertexFormat> = T extends VertexFormatUint8
104
+ ? 'uint8'
105
+ : T extends VertexFormatSint8
106
+ ? 'sint8'
107
+ : T extends VertexFormatUnorm8
108
+ ? 'unorm8'
109
+ : T extends VertexFormatSnorm8
110
+ ? 'snorm8'
111
+ : T extends VertexFormatUint16
112
+ ? 'uint16'
113
+ : T extends VertexFormatSint16
114
+ ? 'sint16'
115
+ : T extends VertexFormatUnorm16
116
+ ? 'unorm16'
117
+ : T extends VertexFormatSnorm16
118
+ ? 'snorm16'
119
+ : T extends VertexFormatUint32
120
+ ? 'uint32'
121
+ : T extends VertexFormatSint32
122
+ ? 'sint32'
123
+ : T extends VertexFormatFloat16
124
+ ? 'float16'
125
+ : T extends VertexFormatFloat32
126
+ ? 'float32'
127
+ : never;
128
+
129
+ /** @type number - the number of components in a VertexFormat */
130
+ export type VertexFormatComponentsT<T extends VertexFormat> = T extends VertexFormat2Components
131
+ ? 2
132
+ : T extends VertexFormat3Components
133
+ ? 3
134
+ : T extends VertexFormat4Components
135
+ ? 4
136
+ : 1;
137
+
138
+ // Helper types for the above
139
+
140
+ type VertexFormatUint8 = 'uint8' | 'uint8x2' | 'uint8x4';
141
+ type VertexFormatSint8 = 'sint8' | 'sint8x2' | 'sint8x4';
142
+ type VertexFormatUnorm8 =
143
+ | 'unorm8'
144
+ | 'unorm8x2'
145
+ | 'unorm8x3-webgl'
146
+ | 'unorm8x4'
147
+ | 'unorm8x4-bgra'
148
+ | 'unorm10-10-10-2';
149
+ type VertexFormatSnorm8 = 'snorm8' | 'snorm8x2' | 'snorm8x3-webgl' | 'snorm8x4';
150
+ type VertexFormatUint16 = 'uint16' | 'uint16x2' | 'uint16x3-webgl' | 'uint16x4';
151
+ type VertexFormatSint16 = 'sint16' | 'sint16x2' | 'sint16x3-webgl' | 'sint16x4';
152
+ type VertexFormatUnorm16 = 'unorm16' | 'unorm16x2' | 'unorm16x3-webgl' | 'unorm16x4';
153
+ type VertexFormatSnorm16 = 'snorm16' | 'snorm16x2' | 'snorm16x3-webgl' | 'snorm16x4';
154
+ type VertexFormatUint32 = 'uint32' | 'uint32x2' | 'uint32x3' | 'uint32x4';
155
+ type VertexFormatSint32 = 'sint32' | 'sint32x2' | 'sint32x3' | 'sint32x4';
156
+ type VertexFormatFloat16 = 'float16' | 'float16x2' | 'float16x4';
157
+ type VertexFormatFloat32 = 'float32' | 'float32x2' | 'float32x3' | 'float32x4';
158
+
159
+ type VertexFormat2Components =
160
+ | 'uint8x2'
161
+ | 'sint8x2'
162
+ | 'unorm8x2'
163
+ | 'snorm8x2'
164
+ | 'uint16x2'
165
+ | 'sint16x2'
166
+ | 'unorm16x2'
167
+ | 'snorm16x2'
168
+ | 'uint32x2'
169
+ | 'sint32x2'
170
+ | 'float16x2'
171
+ | 'float32x2';
172
+ type VertexFormat3Components =
173
+ | 'unorm8x3-webgl'
174
+ | 'snorm8x3-webgl'
175
+ | 'uint16x3-webgl'
176
+ | 'sint16x3-webgl'
177
+ | 'unorm16x3-webgl'
178
+ | 'snorm16x3-webgl'
179
+ | 'uint32x3'
180
+ | 'sint32x3'
181
+ | 'float32x3';
182
+ type VertexFormat4Components =
183
+ | 'uint8x4'
184
+ | 'sint8x4'
185
+ | 'unorm8x4'
186
+ | 'unorm8x4-bgra'
187
+ | 'unorm10-10-10-2'
188
+ | 'snorm8x4'
189
+ | 'uint16x4'
190
+ | 'sint16x4'
191
+ | 'unorm16x4'
192
+ | 'snorm16x4'
193
+ | 'uint32x4'
194
+ | 'sint32x4'
195
+ | 'float16x4'
196
+ | 'float32x4';
@@ -4,23 +4,35 @@
4
4
 
5
5
  import {isNumberArray} from './is-array';
6
6
 
7
- /** Test if two arrays are deep equal, with a length limit that defaults to 16 */
7
+ const MAX_ELEMENTWISE_ARRAY_COMPARE_LENGTH = 128;
8
+
9
+ /** Test if two arrays are deep equal, with a small-array length limit that defaults to 16 */
8
10
  export function arrayEqual(a: unknown, b: unknown, limit: number = 16) {
9
- if (a !== b) {
10
- return false;
11
+ if (a === b) {
12
+ return true;
11
13
  }
14
+
12
15
  const arrayA = a;
13
16
  const arrayB = b;
14
- if (!isNumberArray(arrayA)) {
17
+ if (!isNumberArray(arrayA) || !isNumberArray(arrayB)) {
18
+ return false;
19
+ }
20
+
21
+ if (arrayA.length !== arrayB.length) {
15
22
  return false;
16
23
  }
17
- if (isNumberArray(arrayB) && arrayA.length === arrayB.length) {
18
- for (let i = 0; i < arrayA.length; ++i) {
19
- if (arrayB[i] !== arrayA[i]) {
20
- return false;
21
- }
24
+
25
+ const maxCompareLength = Math.min(limit, MAX_ELEMENTWISE_ARRAY_COMPARE_LENGTH);
26
+ if (arrayA.length > maxCompareLength) {
27
+ return false;
28
+ }
29
+
30
+ for (let i = 0; i < arrayA.length; ++i) {
31
+ if (arrayB[i] !== arrayA[i]) {
32
+ return false;
22
33
  }
23
34
  }
35
+
24
36
  return true;
25
37
  }
26
38
 
@@ -0,0 +1,18 @@
1
+ // luma.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (c) vis.gl contributors
4
+
5
+ /** Throws if condition is true and narrows type */
6
+ export function assert(condition: unknown, message?: string): asserts condition {
7
+ if (!condition) {
8
+ const error = new Error(message ?? 'luma.gl assertion failed.');
9
+ Error.captureStackTrace?.(error, assert);
10
+ throw error;
11
+ }
12
+ }
13
+
14
+ /** Throws if value is not defined, narrows type */
15
+ export function assertDefined<T>(value: T | undefined, message?: string): T {
16
+ assert(value, message);
17
+ return value;
18
+ }
@@ -2,7 +2,29 @@
2
2
  // SPDX-License-Identifier: MIT
3
3
  // Copyright (c) vis.gl contributors
4
4
 
5
- import {Stats} from '@probe.gl/stats';
5
+ import {Stat, Stats} from '@probe.gl/stats';
6
+
7
+ const GPU_TIME_AND_MEMORY_STATS = 'GPU Time and Memory';
8
+ const GPU_TIME_AND_MEMORY_STAT_ORDER = [
9
+ 'Adapter',
10
+ 'GPU',
11
+ 'GPU Type',
12
+ 'GPU Backend',
13
+ 'Frame Rate',
14
+ 'CPU Time',
15
+ 'GPU Time',
16
+ 'GPU Memory',
17
+ 'Buffer Memory',
18
+ 'Texture Memory',
19
+ 'Referenced Buffer Memory',
20
+ 'Referenced Texture Memory',
21
+ 'Swap Chain Texture'
22
+ ] as const;
23
+ const ORDERED_STATS_CACHE = new WeakMap<
24
+ Stats,
25
+ {orderedStatNames: readonly string[]; statCount: number}
26
+ >();
27
+ const ORDERED_STAT_NAME_SET_CACHE = new WeakMap<readonly string[], Set<string>>();
6
28
 
7
29
  /**
8
30
  * Helper class managing a collection of probe.gl stats objects
@@ -19,9 +41,61 @@ export class StatsManager {
19
41
  this.stats.set(name, new Stats({id: name}));
20
42
  }
21
43
 
22
- return this.stats.get(name);
44
+ const stats = this.stats.get(name);
45
+ if (name === GPU_TIME_AND_MEMORY_STATS) {
46
+ initializeStats(stats, GPU_TIME_AND_MEMORY_STAT_ORDER);
47
+ }
48
+
49
+ return stats;
23
50
  }
24
51
  }
25
52
 
26
53
  /** Global stats for all luma.gl devices */
27
54
  export const lumaStats: StatsManager = new StatsManager();
55
+
56
+ function initializeStats(stats: Stats, orderedStatNames: readonly string[]): void {
57
+ const statsMap = stats.stats;
58
+ let addedOrderedStat = false;
59
+ for (const statName of orderedStatNames) {
60
+ if (!statsMap[statName]) {
61
+ stats.get(statName);
62
+ addedOrderedStat = true;
63
+ }
64
+ }
65
+
66
+ const statCount = Object.keys(statsMap).length;
67
+ const cachedStats = ORDERED_STATS_CACHE.get(stats);
68
+ if (
69
+ !addedOrderedStat &&
70
+ cachedStats?.orderedStatNames === orderedStatNames &&
71
+ cachedStats.statCount === statCount
72
+ ) {
73
+ return;
74
+ }
75
+
76
+ const reorderedStats: Record<string, Stat> = {};
77
+ let orderedStatNamesSet = ORDERED_STAT_NAME_SET_CACHE.get(orderedStatNames);
78
+ if (!orderedStatNamesSet) {
79
+ orderedStatNamesSet = new Set(orderedStatNames);
80
+ ORDERED_STAT_NAME_SET_CACHE.set(orderedStatNames, orderedStatNamesSet);
81
+ }
82
+
83
+ for (const statName of orderedStatNames) {
84
+ if (statsMap[statName]) {
85
+ reorderedStats[statName] = statsMap[statName];
86
+ }
87
+ }
88
+
89
+ for (const [statName, stat] of Object.entries(statsMap)) {
90
+ if (!orderedStatNamesSet.has(statName)) {
91
+ reorderedStats[statName] = stat;
92
+ }
93
+ }
94
+
95
+ for (const statName of Object.keys(statsMap)) {
96
+ delete statsMap[statName];
97
+ }
98
+
99
+ Object.assign(statsMap, reorderedStats);
100
+ ORDERED_STATS_CACHE.set(stats, {orderedStatNames, statCount});
101
+ }
@@ -1 +0,0 @@
1
- {"version":3,"file":"image-types.d.ts","sourceRoot":"","sources":["../../src/image-utils/image-types.ts"],"names":[],"mappings":"AAIA;;;GAGG;AACH,MAAM,MAAM,aAAa,GACrB,WAAW,GACX,SAAS,GACT,gBAAgB,GAChB,gBAAgB,GAChB,UAAU,GACV,iBAAiB,GACjB,eAAe,CAAC;AAEpB,MAAM,MAAM,iBAAiB,GAAG;IAC9B,IAAI,EAAE,WAAW,GAAG,iBAAiB,GAAG,eAAe,C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AAI,YAAY,WAAW,CAAC;QACnE,CAAC,OAAO,iBAAiB,KAAK,WAAW,IAAI,IAAI,YAAY,iBAAiB,CAAC;QAC/E,CAAC,OAAO,eAAe,KAAK,WAAW,IAAI,IAAI,YAAY,eAAe,CAAC,EAC3E,CAAC;QACD,OAAO,EAAC,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAC,CAAC;IAClD,CAAC;IACD,IAAI,OAAO,gBAAgB,KAAK,WAAW,IAAI,IAAI,YAAY,gBAAgB,EAAE,CAAC;QAChF,OAAO,EAAC,KAAK,EAAE,IAAI,CAAC,YAAY,EAAE,MAAM,EAAE,IAAI,CAAC,aAAa,EAAC,CAAC;IAChE,CAAC;IACD,IAAI,OAAO,gBAAgB,KAAK,WAAW,IAAI,IAAI,YAAY,gBAAgB,EAAE,CAAC;QAChF,OAAO,EAAC,KAAK,EAAE,IAAI,CAAC,UAAU,EAAE,MAAM,EAAE,IAAI,CAAC,WAAW,EAAC,CAAC;IAC5D,CAAC;IACD,IAAI,OAAO,UAAU,KAAK,WAAW,IAAI,IAAI,YAAY,UAAU,EAAE,CAAC;QACpE,uDAAuD;QACvD,OAAO,EAAC,KAAK,EAAE,IAAI,CAAC,YAAY,EAAE,MAAM,EAAE,IAAI,CAAC,aAAa,EAAC,CAAC;IAChE,CAAC;IACD,MAAM,IAAI,KAAK,CAAC,oBAAoB,CAAC,CAAC;AACxC,CAAC"}
@@ -1,28 +0,0 @@
1
- import type { PrimitiveDataType } from "../shadertypes/data-types/data-types.js";
2
- import type { VariableShaderType } from "../shadertypes/data-types/shader-types.js";
3
- import type { UniformValue } from "../adapter/types/uniforms.js";
4
- /**
5
- * Std140 layout for uniform buffers
6
- * Supports manual listing of uniforms
7
- */
8
- export declare class UniformBufferLayout {
9
- readonly layout: Record<string, {
10
- offset: number;
11
- size: number;
12
- type: PrimitiveDataType;
13
- }>;
14
- /** number of bytes needed for buffer allocation */
15
- readonly byteLength: number;
16
- /** Create a new UniformBufferLayout given a map of attributes. */
17
- constructor(uniformTypes: Record<string, VariableShaderType>, uniformSizes?: Record<string, number>);
18
- /** Get the data for the complete buffer */
19
- getData(uniformValues: Record<string, UniformValue>): Uint8Array;
20
- /** Does this layout have a field with specified name */
21
- has(name: string): boolean;
22
- /** Get offset and size for a field with specified name */
23
- get(name: string): {
24
- offset: number;
25
- size: number;
26
- } | undefined;
27
- }
28
- //# sourceMappingURL=uniform-buffer-layout.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"uniform-buffer-layout.d.ts","sourceRoot":"","sources":["../../src/portable/uniform-buffer-layout.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,iBAAiB,EAAC,gDAA6C;AAC5E,OAAO,KAAK,EAAC,kBAAkB,EAAC,kDAA+C;AAI/E,OAAO,KAAK,EAAC,YAAY,EAAC,qCAAkC;AAW5D;;;GAGG;AACH,qBAAa,mBAAmB;IAC9B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,iBAAiB,CAAA;KAAC,CAAC,CAAM;IAE9F,mDAAmD;IACnD,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAE5B,kEAAkE;gBAEhE,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,kBAAkB,CAAC,EAChD,YAAY,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAM;IAyB3C,2CAA2C;IAC3C,OAAO,CAAC,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,GAAG,UAAU;IAgDhE,wDAAwD;IACxD,GAAG,CAAC,IAAI,EAAE,MAAM;IAIhB,0DAA0D;IAC1D,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAC,GAAG,SAAS;CAI9D"}
@@ -1,96 +0,0 @@
1
- // luma.gl
2
- // SPDX-License-Identifier: MIT
3
- // Copyright (c) vis.gl contributors
4
- import { alignTo } from "../shadertypes/data-types/decode-data-types.js";
5
- import { getVariableShaderTypeInfo } from "../shadertypes/data-types/decode-shader-types.js";
6
- import { getScratchArrayBuffer } from "../utils/array-utils-flat.js";
7
- import { isNumberArray } from "../utils/is-array.js";
8
- import { log } from "../utils/log.js";
9
- /**
10
- * Smallest buffer size that can be used for uniform buffers.
11
- * TODO - does this depend on device?
12
- */
13
- const minBufferSize = 1024;
14
- /**
15
- * Std140 layout for uniform buffers
16
- * Supports manual listing of uniforms
17
- */
18
- export class UniformBufferLayout {
19
- layout = {};
20
- /** number of bytes needed for buffer allocation */
21
- byteLength;
22
- /** Create a new UniformBufferLayout given a map of attributes. */
23
- constructor(uniformTypes, uniformSizes = {}) {
24
- /** number of 4 byte slots taken */
25
- let size = 0;
26
- // Add layout (type, size and offset) definitions for each uniform in the layout
27
- for (const [key, uniformType] of Object.entries(uniformTypes)) {
28
- const typeAndComponents = getVariableShaderTypeInfo(uniformType);
29
- const { type, components } = typeAndComponents;
30
- // Calculate total count for uniform arrays.
31
- const count = components * (uniformSizes?.[key] ?? 1);
32
- // First, align (bump) current offset to an even multiple of current object (1, 2, 4)
33
- size = alignTo(size, count);
34
- // Use the aligned size as the offset of the current uniform.
35
- const offset = size;
36
- // Then, add our object's padded size ((1, 2, multiple of 4) to the current offset
37
- size += count;
38
- this.layout[key] = { type, size: count, offset };
39
- }
40
- size += (4 - (size % 4)) % 4;
41
- const actualByteLength = size * 4;
42
- this.byteLength = Math.max(actualByteLength, minBufferSize);
43
- }
44
- /** Get the data for the complete buffer */
45
- getData(uniformValues) {
46
- // Allocate three typed arrays pointing at same memory
47
- const arrayBuffer = getScratchArrayBuffer(this.byteLength);
48
- const typedArrays = {
49
- i32: new Int32Array(arrayBuffer),
50
- u32: new Uint32Array(arrayBuffer),
51
- f32: new Float32Array(arrayBuffer),
52
- // TODO not implemented
53
- f16: new Uint16Array(arrayBuffer)
54
- };
55
- for (const [name, value] of Object.entries(uniformValues)) {
56
- const uniformLayout = this.layout[name];
57
- if (!uniformLayout) {
58
- log.warn(`Supplied uniform value ${name} not present in uniform block layout`)();
59
- // eslint-disable-next-line no-continue
60
- continue;
61
- }
62
- const { type, size, offset } = uniformLayout;
63
- const typedArray = typedArrays[type];
64
- if (size === 1) {
65
- if (typeof value !== 'number' && typeof value !== 'boolean') {
66
- log.warn(`Supplied value for single component uniform ${name} is not a number: ${value}`)();
67
- // eslint-disable-next-line no-continue
68
- continue;
69
- }
70
- // single value -> just set it
71
- typedArray[offset] = Number(value);
72
- }
73
- else {
74
- if (!isNumberArray(value)) {
75
- log.warn(`Supplied value for multi component / array uniform ${name} is not a numeric array: ${value}`)();
76
- // eslint-disable-next-line no-continue
77
- continue;
78
- }
79
- // vector/matrix -> copy the supplied (typed) array, starting from offset
80
- // TODO: we should limit or check size in case the supplied data overflows
81
- typedArray.set(value, offset);
82
- }
83
- }
84
- return new Uint8Array(arrayBuffer, 0, this.byteLength);
85
- }
86
- /** Does this layout have a field with specified name */
87
- has(name) {
88
- return Boolean(this.layout[name]);
89
- }
90
- /** Get offset and size for a field with specified name */
91
- get(name) {
92
- const layout = this.layout[name];
93
- return layout;
94
- }
95
- }
96
- //# sourceMappingURL=uniform-buffer-layout.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"uniform-buffer-layout.js","sourceRoot":"","sources":["../../src/portable/uniform-buffer-layout.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,+BAA+B;AAC/B,oCAAoC;AAIpC,OAAO,EAAC,OAAO,EAAC,uDAAoD;AACpE,OAAO,EAAC,yBAAyB,EAAC,yDAAsD;AAGxF,OAAO,EAAC,qBAAqB,EAAC,qCAAkC;AAChE,OAAO,EAAC,aAAa,EAAC,6BAA0B;AAChD,OAAO,EAAC,GAAG,EAAC,wBAAqB;AAEjC;;;GAGG;AACH,MAAM,aAAa,GAAW,I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yE;gBACzE,0EAA0E;gBAC1E,UAAU,CAAC,GAAG,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;YAChC,CAAC;QACH,CAAC;QAED,OAAO,IAAI,UAAU,CAAC,WAAW,EAAE,CAAC,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;IACzD,CAAC;IAED,wDAAwD;IACxD,GAAG,CAAC,IAAY;QACd,OAAO,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;IACpC,CAAC;IAED,0DAA0D;IAC1D,GAAG,CAAC,IAAY;QACd,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QACjC,OAAO,MAAM,CAAC;IAChB,CAAC;CACF"}
@@ -1,17 +0,0 @@
1
- import { PrimitiveDataType } from "./data-types.js";
2
- import type { VariableShaderType, AttributeShaderType, AttributeShaderTypeInfo, VariableShaderTypeAlias, AttributeShaderTypeAlias } from "./shader-types.js";
3
- /** Split a uniform type string into type and components */
4
- export declare function getVariableShaderTypeInfo(format: VariableShaderType): {
5
- type: PrimitiveDataType;
6
- components: number;
7
- };
8
- /** Decodes a vertex type, returning byte length and flags (integer, signed, normalized) */
9
- export declare function getAttributeShaderTypeInfo(attributeType: AttributeShaderType): AttributeShaderTypeInfo;
10
- export declare function makeShaderAttributeType(primitiveType: PrimitiveDataType, components: 1 | 2 | 3 | 4): AttributeShaderType;
11
- export declare function resolveAttributeShaderTypeAlias(alias: AttributeShaderTypeAlias | AttributeShaderType): AttributeShaderType;
12
- export declare function resolveVariableShaderTypeAlias(alias: VariableShaderTypeAlias | VariableShaderType): VariableShaderType;
13
- /** Predeclared aliases @see https://www.w3.org/TR/WGSL/#vector-types */
14
- export declare const WGSL_ATTRIBUTE_TYPE_ALIAS_MAP: Record<AttributeShaderTypeAlias, AttributeShaderType>;
15
- /** @todo These tables are quite big, consider parsing alias strings instead */
16
- export declare const WGSL_VARIABLE_TYPE_ALIAS_MAP: Record<VariableShaderTypeAlias, VariableShaderType>;
17
- //# sourceMappingURL=decode-shader-types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"decode-shader-types.d.ts","sourceRoot":"","sources":["../../../src/shadertypes/data-types/decode-shader-types.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,iBAAiB,EAAC,wBAAqB;AAC/C,OAAO,KAAK,EACV,kBAAkB,EAClB,mBAAmB,EACnB,uBAAuB,EACvB,uBAAuB,EACvB,wBAAwB,EACzB,0BAAuB;AAExB,2DAA2D;AAC3D,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,kBAAkB,GAAG;IACrE,IAAI,EAAE,iBAAiB,CAAC;IACxB,UAAU,EAAE,MAAM,CAAC;CACpB,CAGA;AAED,2FAA2F;AAC3F,wBAAgB,0BAA0B,CACxC,aAAa,EAAE,mBAAmB,GACjC,uBAAuB,CAazB;AAED,wBAAgB,uBAAuB,CACrC,aAAa,EAAE,iBAAiB,EAChC,UAAU,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GACxB,mBAAmB,CAErB;AAED,wBAAgB,+BAA+B,CAC7C,KAAK,EAAE,wBAAwB,GAAG,mBAAmB,GACpD,mBAAmB,CAErB;AAED,wBAAgB,8BAA8B,CAC5C,KAAK,EAAE,uBAAuB,GAAG,kBAAkB,GAClD,kBAAkB,CAEpB;AA6FD,yEAAyE;AACzE,eAAO,MAAM,6BAA6B,EAAE,MAAM,CAAC,wBAAwB,EAAE,mBAAmB,CAe7F,CAAC;AAEJ,+EAA+E;AAC/E,eAAO,MAAM,4BAA4B,EAAE,MAAM,CAAC,uBAAuB,EAAE,kBAAkB,CAyC5F,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"decode-shader-types.js","sourceRoot":"","sources":["../../../src/shadertypes/data-types/decode-shader-types.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,+BAA+B;AAC/B,oCAAoC;AAWpC,2DAA2D;AAC3D,MAAM,UAAU,yBAAyB,CAAC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AA4B,GAAwD;IAC/F,GAAG,6BAA6B;IAChC,OAAO,EAAE,aAAa;IACtB,OAAO,EAAE,aAAa;IACtB,OAAO,EAAE,aAAa;IACtB,OAAO,EAAE,aAAa;IACtB,OAAO,EAAE,aAAa;IACtB,OAAO,EAAE,aAAa;IACtB,OAAO,EAAE,aAAa;IACtB,OAAO,EAAE,aAAa;IACtB,OAAO,EAAE,aAAa;IAEtB,OAAO,EAAE,aAAa;IACtB,OAAO,EAAE,aAAa;IACtB,OAAO,EAAE,aAAa;IACtB,OAAO,EAAE,aAAa;IACtB,OAAO,EAAE,aAAa;IACtB,OAAO,EAAE,aAAa;IACtB,OAAO,EAAE,aAAa;IACtB,OAAO,EAAE,aAAa;IACtB,OAAO,EAAE,aAAa;IAEtB,OAAO,EAAE,aAAa;IACtB,OAAO,EAAE,aAAa;IACtB,OAAO,EAAE,aAAa;IACtB,OAAO,EAAE,aAAa;IACtB,OAAO,EAAE,aAAa;IACtB,OAAO,EAAE,aAAa;IACtB,OAAO,EAAE,aAAa;IACtB,OAAO,EAAE,aAAa;IACtB,OAAO,EAAE,aAAa;IAEtB,OAAO,EAAE,aAAa;IACtB,OAAO,EAAE,aAAa;IACtB,OAAO,EAAE,aAAa;IACtB,OAAO,EAAE,aAAa;IACtB,OAAO,EAAE,aAAa;IACtB,OAAO,EAAE,aAAa;IACtB,OAAO,EAAE,aAAa;IACtB,OAAO,EAAE,aAAa;IACtB,OAAO,EAAE,aAAa;CACvB,CAAC"}
@@ -1,45 +0,0 @@
1
- import type { PrimitiveDataType } from "./data-types.js";
2
- /**
3
- * Describes the type of an attribute as defined in the shader source code.
4
- * @note This is a subset of shader variable types
5
- * @note Buffers with various `VertexFormat`s can be supplied for each type, GPU will convert them at runtime/
6
- */
7
- export type AttributeShaderType = PrimitiveDataType | `vec2<${PrimitiveDataType}>` | `vec3<${PrimitiveDataType}>` | `vec4<${PrimitiveDataType}>`;
8
- /**
9
- * Describes the type of a variable that can declared in shader source code.
10
- * @note Uniforms can be declared using these types
11
- * @note Uniforms can be of a wider range of types than attributes.
12
- * @note to WebGL users: "bindings" (textures, samplers, and uniform buffers) are considered "bindings", not shader variables/uniforms
13
- */
14
- export type VariableShaderType = PrimitiveDataType | `vec2<${PrimitiveDataType}>` | `vec3<${PrimitiveDataType}>` | `vec4<${PrimitiveDataType}>` | `mat2x2<${PrimitiveDataType}>` | `mat2x3<${PrimitiveDataType}>` | `mat2x4<${PrimitiveDataType}>` | `mat3x2<${PrimitiveDataType}>` | `mat3x3<${PrimitiveDataType}>` | `mat3x4<${PrimitiveDataType}>` | `mat4x2<${PrimitiveDataType}>` | `mat4x3<${PrimitiveDataType}>` | `mat4x4<${PrimitiveDataType}>`;
15
- type ShaderTypeAliasSuffix = 'f' | 'i' | 'u' | 'h';
16
- /** Shorthand type aliases recognized by WGSL */
17
- export type AttributeShaderTypeAlias = `vec2${ShaderTypeAliasSuffix}` | `vec3${ShaderTypeAliasSuffix}` | `vec4${ShaderTypeAliasSuffix}`;
18
- /** Shorthand type aliases recognized by WGSL */
19
- export type VariableShaderTypeAlias = AttributeShaderTypeAlias | `mat2x2${ShaderTypeAliasSuffix}` | `mat2x3${ShaderTypeAliasSuffix}` | `mat2x4${ShaderTypeAliasSuffix}` | `mat3x2${ShaderTypeAliasSuffix}` | `mat3x3${ShaderTypeAliasSuffix}` | `mat3x4${ShaderTypeAliasSuffix}` | `mat4x2${ShaderTypeAliasSuffix}` | `mat4x3${ShaderTypeAliasSuffix}` | `mat4x4${ShaderTypeAliasSuffix}`;
20
- /** A composite shader type can include structs and arrays, recursively */
21
- export type CompositeShaderType = VariableShaderType | StructShaderType | ArrayShaderType;
22
- /** Represents a struct in WGSL */
23
- export type StructShaderType = {
24
- members: Record<string, CompositeShaderType>;
25
- };
26
- /** Represents an array in WGSL */
27
- export type ArrayShaderType = {
28
- type: CompositeShaderType;
29
- length: number;
30
- };
31
- /** Information extracted from a AttributeShaderType constant */
32
- export type AttributeShaderTypeInfo = {
33
- /** WGSL-style primitive data type, f32, i32, u32 */
34
- primitiveType: PrimitiveDataType;
35
- /** Whether this is a normalized integer (that must be used as float) */
36
- components: 1 | 2 | 3 | 4;
37
- /** Length in bytes of the data for one vertex */
38
- byteLength?: number;
39
- /** Whether this is for integer or float vert */
40
- integer: boolean;
41
- /** Whether this data type is signed */
42
- signed: boolean;
43
- };
44
- export {};
45
- //# sourceMappingURL=shader-types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"shader-types.d.ts","sourceRoot":"","sources":["../../../src/shadertypes/data-types/shader-types.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,iBAAiB,EAAC,wBAAqB;AAEpD;;;;GAIG;AACH,MAAM,MAAM,mBAAmB,GAC3B,iBAAiB,GACjB,QAAQ,iBAAiB,GAAG,GAC5B,QAAQ,iBAAiB,GAAG,GAC5B,QAAQ,iBAAiB,GAAG,CAAC;AAEjC;;;;;GAKG;AACH,MAAM,MAAM,kBAAkB,GAC1B,iBAAiB,GACjB,QAAQ,iBAAiB,GAAG,GAC5B,QAAQ,iBAAiB,GAAG,GAC5B,QAAQ,iBAAiB,GAAG,GAC5B,UAAU,iBAAiB,GAAG,GAC9B,UAAU,iBAAiB,GAAG,GAC9B,UAAU,iBAAiB,GAAG,GAC9B,UAAU,iBAAiB,GAAG,GAC9B,UAAU,iBAAiB,GAAG,GAC9B,UAAU,iBAAiB,GAAG,GAC9B,UAAU,iBAAiB,GAAG,GAC9B,UAAU,iBAAiB,GAAG,GAC9B,UAAU,iBAAiB,GAAG,CAAC;AAGnC,KAAK,qBAAqB,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,CAAC;AAEnD,gDAAgD;AAChD,MAAM,MAAM,wBAAwB,GAChC,OAAO,qBAAqB,EAAE,GAC9B,OAAO,qBAAqB,EAAE,GAC9B,OAAO,qBAAqB,EAAE,CAAC;AAEnC,gDAAgD;AAChD,MAAM,MAAM,uBAAuB,GAC/B,wBAAwB,GACxB,SAAS,qBAAqB,EAAE,GAChC,SAAS,qBAAqB,EAAE,GAChC,SAAS,qBAAqB,EAAE,GAChC,SAAS,qBAAqB,EAAE,GAChC,SAAS,qBAAqB,EAAE,GAChC,SAAS,qBAAqB,EAAE,GAChC,SAAS,qBAAqB,EAAE,GAChC,SAAS,qBAAqB,EAAE,GAChC,SAAS,qBAAqB,EAAE,CAAC;AAErC,0EAA0E;AAC1E,MAAM,MAAM,mBAAmB,GAAG,kBAAkB,GAAG,gBAAgB,GAAG,eAAe,CAAC;AAE1F,kCAAkC;AAClC,MAAM,MAAM,gBAAgB,GAAG;IAC7B,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAAC;CAC9C,CAAC;AAEF,kCAAkC;AAClC,MAAM,MAAM,eAAe,GAAG;IAC5B,IAAI,EAAE,mBAAmB,CAAC;IAC1B,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,gEAAgE;AAChE,MAAM,MAAM,uBAAuB,GAAG;IACpC,oDAAoD;IACpD,aAAa,EAAE,iBAAiB,CAAC;IACjC,wEAAwE;IACxE,UAAU,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAC1B,iDAAiD;IACjD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,gDAAgD;IAChD,OAAO,EAAE,OAAO,CAAC;IACjB,uCAAuC;IACvC,MAAM,EAAE,OAAO,CAAC;CACjB,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"shader-types.js","sourceRoot":"","sources":["../../../src/shadertypes/data-types/shader-types.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,+BAA+B;AAC/B,oCAAoC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"pixel-utils.d.ts","sourceRoot":"","sources":["../../../src/shadertypes/textures/pixel-utils.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,SAAS,GAAG;IACtB,uFAAuF;IACvF,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,sN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WAAW,IAAI,CAAC,IAAI,CAAC;QACrB,uCAAuC;QACvC,IAAI,QAAQ,EAAE,CAAC;YACb,WAAW,IAAI,IAAI,CAAC;QACtB,CAAC;QACD,QAAQ,CAAC,QAAQ,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC;IAC5C,CAAC;AACH,CAAC"}
@@ -1,18 +0,0 @@
1
- import type { TextureFormat, TextureFormatCompressed, TextureFormatInfo, TextureFormatCapabilities, TextureFormatColor } from "./texture-formats.js";
2
- export declare class TextureFormatDecoder {
3
- /** Returns information about a texture format, e.g. attatchment type, components, byte length and flags (integer, signed, normalized) */
4
- getInfo(format: TextureFormat): TextureFormatInfo;
5
- /** Checks if a texture format is color */
6
- isColor(format: TextureFormat): format is TextureFormatColor;
7
- /** Checks if a texture format is depth or stencil */
8
- isDepthStencil(format: TextureFormat): boolean;
9
- /** Checks if a texture format is compressed */
10
- isCompressed(format: TextureFormat): format is TextureFormatCompressed;
11
- /**
12
- * Returns the "static" capabilities of a texture format.
13
- * @note Needs to be checked against current device
14
- */
15
- getCapabilities(format: TextureFormat): TextureFormatCapabilities;
16
- }
17
- export declare const textureFormatDecoder: TextureFormatDecoder;
18
- //# sourceMappingURL=texture-format-decoder.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"texture-format-decoder.d.ts","sourceRoot":"","sources":["../../../src/shadertypes/textures/texture-format-decoder.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EACV,aAAa,EACb,uBAAuB,EACvB,iBAAiB,EACjB,yBAAyB,EACzB,kBAAkB,EACnB,6BAA0B;AAU3B,qBAAa,oBAAoB;IAC/B,yIAAyI;IACzI,OAAO,CAAC,MAAM,EAAE,aAAa,GAAG,iBAAiB;IAIjD,0CAA0C;IAC1C,OAAO,CAAC,MAAM,EAAE,aAAa,GAAG,MAAM,IAAI,kBAAkB;IAI5D,qDAAqD;IACrD,cAAc,CAAC,MAAM,EAAE,aAAa,GAAG,OAAO;IAI9C,+CAA+C;IAC/C,YAAY,CAAC,MAAM,EAAE,aAAa,GAAG,MAAM,IAAI,uBAAuB;IAItE;;;OAGG;IACH,eAAe,CAAC,MAAM,EAAE,aAAa,GAAG,yBAAyB;CAyBlE;AAED,eAAO,MAAM,oBAAoB,sBAA6B,CAAC"}