@luma.gl/webgl 9.0.0-alpha.5 → 9.0.0-alpha.50

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 (531) hide show
  1. package/LICENSE +3 -1
  2. package/dist/adapter/converters/device-parameters.d.ts +23 -4
  3. package/dist/adapter/converters/device-parameters.d.ts.map +1 -1
  4. package/dist/adapter/converters/device-parameters.js +101 -73
  5. package/dist/adapter/converters/device-parameters.js.map +1 -1
  6. package/dist/adapter/converters/sampler-parameters.d.ts +6 -6
  7. package/dist/adapter/converters/sampler-parameters.d.ts.map +1 -1
  8. package/dist/adapter/converters/sampler-parameters.js +74 -111
  9. package/dist/adapter/converters/sampler-parameters.js.map +1 -1
  10. package/dist/adapter/converters/shader-formats.d.ts +9 -0
  11. package/dist/adapter/converters/shader-formats.d.ts.map +1 -0
  12. package/dist/adapter/converters/shader-formats.js +52 -0
  13. package/dist/adapter/converters/shader-formats.js.map +1 -0
  14. package/dist/adapter/converters/texture-formats.d.ts +32 -44
  15. package/dist/adapter/converters/texture-formats.d.ts.map +1 -1
  16. package/dist/adapter/converters/texture-formats.js +309 -346
  17. package/dist/adapter/converters/texture-formats.js.map +1 -1
  18. package/dist/adapter/converters/vertex-formats.d.ts +9 -3
  19. package/dist/adapter/converters/vertex-formats.d.ts.map +1 -1
  20. package/dist/adapter/converters/vertex-formats.js +53 -22
  21. package/dist/adapter/converters/vertex-formats.js.map +1 -1
  22. package/dist/adapter/device-helpers/device-features.d.ts +1 -1
  23. package/dist/adapter/device-helpers/device-features.d.ts.map +1 -1
  24. package/dist/adapter/device-helpers/device-features.js +17 -23
  25. package/dist/adapter/device-helpers/device-features.js.map +1 -1
  26. package/dist/adapter/device-helpers/device-limits.d.ts +3 -3
  27. package/dist/adapter/device-helpers/device-limits.d.ts.map +1 -1
  28. package/dist/adapter/device-helpers/device-limits.js +54 -58
  29. package/dist/adapter/device-helpers/device-limits.js.map +1 -1
  30. package/dist/adapter/device-helpers/get-device-info.d.ts +1 -1
  31. package/dist/adapter/device-helpers/get-device-info.d.ts.map +1 -1
  32. package/dist/adapter/device-helpers/get-device-info.js +31 -22
  33. package/dist/adapter/device-helpers/get-device-info.js.map +1 -1
  34. package/dist/adapter/device-helpers/is-old-ie.d.ts.map +1 -1
  35. package/dist/adapter/device-helpers/is-old-ie.js +2 -1
  36. package/dist/adapter/device-helpers/is-old-ie.js.map +1 -1
  37. package/dist/adapter/helpers/decode-webgl-types.d.ts +26 -0
  38. package/dist/adapter/helpers/decode-webgl-types.d.ts.map +1 -0
  39. package/dist/adapter/helpers/decode-webgl-types.js +89 -0
  40. package/dist/adapter/helpers/decode-webgl-types.js.map +1 -0
  41. package/dist/adapter/helpers/get-shader-info.d.ts +9 -0
  42. package/dist/adapter/helpers/get-shader-info.d.ts.map +1 -0
  43. package/dist/adapter/helpers/get-shader-info.js +25 -0
  44. package/dist/adapter/helpers/get-shader-info.js.map +1 -0
  45. package/dist/adapter/helpers/get-shader-layout.d.ts +1 -48
  46. package/dist/adapter/helpers/get-shader-layout.d.ts.map +1 -1
  47. package/dist/adapter/helpers/get-shader-layout.js +87 -143
  48. package/dist/adapter/helpers/get-shader-layout.js.map +1 -1
  49. package/dist/adapter/helpers/parse-shader-compiler-log.d.ts +1 -1
  50. package/dist/adapter/helpers/parse-shader-compiler-log.d.ts.map +1 -1
  51. package/dist/adapter/helpers/parse-shader-compiler-log.js +16 -11
  52. package/dist/adapter/helpers/parse-shader-compiler-log.js.map +1 -1
  53. package/dist/adapter/helpers/set-uniform.d.ts +3 -2
  54. package/dist/adapter/helpers/set-uniform.d.ts.map +1 -1
  55. package/dist/adapter/helpers/set-uniform.js +51 -82
  56. package/dist/adapter/helpers/set-uniform.js.map +1 -1
  57. package/dist/adapter/helpers/webgl-topology-utils.d.ts +16 -0
  58. package/dist/adapter/helpers/webgl-topology-utils.d.ts.map +1 -0
  59. package/dist/adapter/helpers/webgl-topology-utils.js +103 -0
  60. package/dist/adapter/helpers/webgl-topology-utils.js.map +1 -0
  61. package/dist/adapter/objects/constants-to-keys.d.ts +1 -3
  62. package/dist/adapter/objects/constants-to-keys.d.ts.map +1 -1
  63. package/dist/adapter/objects/constants-to-keys.js +2 -29
  64. package/dist/adapter/objects/constants-to-keys.js.map +1 -1
  65. package/dist/adapter/objects/webgl-renderbuffer.d.ts +15 -12
  66. package/dist/adapter/objects/webgl-renderbuffer.d.ts.map +1 -1
  67. package/dist/adapter/objects/webgl-renderbuffer.js +36 -44
  68. package/dist/adapter/objects/webgl-renderbuffer.js.map +1 -1
  69. package/dist/adapter/objects/webgl-resource.d.ts +6 -9
  70. package/dist/adapter/objects/webgl-resource.d.ts.map +1 -1
  71. package/dist/adapter/objects/webgl-resource.js +26 -83
  72. package/dist/adapter/objects/webgl-resource.js.map +1 -1
  73. package/dist/adapter/resources/webgl-buffer.d.ts +19 -11
  74. package/dist/adapter/resources/webgl-buffer.d.ts.map +1 -1
  75. package/dist/adapter/resources/webgl-buffer.js +60 -88
  76. package/dist/adapter/resources/webgl-buffer.js.map +1 -1
  77. package/dist/adapter/resources/webgl-command-buffer.d.ts +15 -9
  78. package/dist/adapter/resources/webgl-command-buffer.d.ts.map +1 -1
  79. package/dist/adapter/resources/webgl-command-buffer.js +175 -48
  80. package/dist/adapter/resources/webgl-command-buffer.js.map +1 -1
  81. package/dist/adapter/resources/webgl-command-encoder.d.ts +7 -6
  82. package/dist/adapter/resources/webgl-command-encoder.d.ts.map +1 -1
  83. package/dist/adapter/resources/webgl-command-encoder.js +10 -20
  84. package/dist/adapter/resources/webgl-command-encoder.js.map +1 -1
  85. package/dist/adapter/resources/webgl-external-texture.js.map +1 -1
  86. package/dist/adapter/resources/webgl-framebuffer.d.ts +21 -24
  87. package/dist/adapter/resources/webgl-framebuffer.d.ts.map +1 -1
  88. package/dist/adapter/resources/webgl-framebuffer.js +63 -173
  89. package/dist/adapter/resources/webgl-framebuffer.js.map +1 -1
  90. package/dist/adapter/resources/webgl-render-pass.d.ts +19 -4
  91. package/dist/adapter/resources/webgl-render-pass.d.ts.map +1 -1
  92. package/dist/adapter/resources/webgl-render-pass.js +99 -11
  93. package/dist/adapter/resources/webgl-render-pass.js.map +1 -1
  94. package/dist/adapter/resources/webgl-render-pipeline.d.ts +55 -21
  95. package/dist/adapter/resources/webgl-render-pipeline.d.ts.map +1 -1
  96. package/dist/adapter/resources/webgl-render-pipeline.js +108 -270
  97. package/dist/adapter/resources/webgl-render-pipeline.js.map +1 -1
  98. package/dist/adapter/resources/webgl-sampler.d.ts +6 -5
  99. package/dist/adapter/resources/webgl-sampler.d.ts.map +1 -1
  100. package/dist/adapter/resources/webgl-sampler.js +11 -21
  101. package/dist/adapter/resources/webgl-sampler.js.map +1 -1
  102. package/dist/adapter/resources/webgl-shader.d.ts +3 -4
  103. package/dist/adapter/resources/webgl-shader.d.ts.map +1 -1
  104. package/dist/adapter/resources/webgl-shader.js +21 -34
  105. package/dist/adapter/resources/webgl-shader.js.map +1 -1
  106. package/dist/adapter/resources/webgl-texture.d.ts +62 -42
  107. package/dist/adapter/resources/webgl-texture.d.ts.map +1 -1
  108. package/dist/adapter/resources/webgl-texture.js +137 -256
  109. package/dist/adapter/resources/webgl-texture.js.map +1 -1
  110. package/dist/adapter/resources/webgl-transform-feedback.d.ts +47 -0
  111. package/dist/adapter/resources/webgl-transform-feedback.d.ts.map +1 -0
  112. package/dist/adapter/resources/webgl-transform-feedback.js +164 -0
  113. package/dist/adapter/resources/webgl-transform-feedback.js.map +1 -0
  114. package/dist/adapter/resources/webgl-vertex-array.d.ts +67 -0
  115. package/dist/adapter/resources/webgl-vertex-array.d.ts.map +1 -0
  116. package/dist/adapter/resources/webgl-vertex-array.js +167 -0
  117. package/dist/adapter/resources/webgl-vertex-array.js.map +1 -0
  118. package/dist/adapter/webgl-canvas-context.d.ts +6 -7
  119. package/dist/adapter/webgl-canvas-context.d.ts.map +1 -1
  120. package/dist/adapter/webgl-canvas-context.js +10 -23
  121. package/dist/adapter/webgl-canvas-context.js.map +1 -1
  122. package/dist/adapter/webgl-device.d.ts +76 -41
  123. package/dist/adapter/webgl-device.d.ts.map +1 -1
  124. package/dist/adapter/webgl-device.js +219 -129
  125. package/dist/adapter/webgl-device.js.map +1 -1
  126. package/dist/classic/accessor.d.ts +3 -3
  127. package/dist/classic/accessor.d.ts.map +1 -1
  128. package/dist/classic/accessor.js +26 -52
  129. package/dist/classic/accessor.js.map +1 -1
  130. package/dist/classic/clear.d.ts +22 -0
  131. package/dist/classic/clear.d.ts.map +1 -0
  132. package/dist/classic/clear.js +88 -0
  133. package/dist/classic/clear.js.map +1 -0
  134. package/dist/classic/copy-and-blit.d.ts +62 -0
  135. package/dist/classic/copy-and-blit.d.ts.map +1 -0
  136. package/dist/classic/copy-and-blit.js +191 -0
  137. package/dist/classic/copy-and-blit.js.map +1 -0
  138. package/dist/classic/format-utils.d.ts +3 -0
  139. package/dist/classic/format-utils.d.ts.map +1 -0
  140. package/dist/classic/format-utils.js +37 -0
  141. package/dist/classic/format-utils.js.map +1 -0
  142. package/dist/classic/typed-array-utils.d.ts +17 -17
  143. package/dist/classic/typed-array-utils.d.ts.map +1 -1
  144. package/dist/classic/typed-array-utils.js +18 -39
  145. package/dist/classic/typed-array-utils.js.map +1 -1
  146. package/dist/context/context/create-browser-context.d.ts +40 -0
  147. package/dist/context/context/create-browser-context.d.ts.map +1 -0
  148. package/dist/context/context/create-browser-context.js +53 -0
  149. package/dist/context/context/create-browser-context.js.map +1 -0
  150. package/dist/context/context/create-headless-context.d.ts +9 -0
  151. package/dist/context/context/create-headless-context.d.ts.map +1 -0
  152. package/dist/context/context/create-headless-context.js +42 -0
  153. package/dist/context/context/create-headless-context.js.map +1 -0
  154. package/dist/context/context/webgl-checks.d.ts.map +1 -1
  155. package/dist/context/context/webgl-checks.js +1 -4
  156. package/dist/context/context/webgl-checks.js.map +1 -1
  157. package/dist/context/debug/spector.d.ts +1 -2
  158. package/dist/context/debug/spector.d.ts.map +1 -1
  159. package/dist/context/debug/spector.js +8 -20
  160. package/dist/context/debug/spector.js.map +1 -1
  161. package/dist/context/debug/webgl-developer-tools.d.ts +2 -2
  162. package/dist/context/debug/webgl-developer-tools.d.ts.map +1 -1
  163. package/dist/context/debug/webgl-developer-tools.js +15 -39
  164. package/dist/context/debug/webgl-developer-tools.js.map +1 -1
  165. package/dist/context/parameters/unified-parameter-api.d.ts +9 -8
  166. package/dist/context/parameters/unified-parameter-api.d.ts.map +1 -1
  167. package/dist/context/parameters/unified-parameter-api.js +9 -19
  168. package/dist/context/parameters/unified-parameter-api.js.map +1 -1
  169. package/dist/context/parameters/webgl-parameter-tables.d.ts +105 -106
  170. package/dist/context/parameters/webgl-parameter-tables.d.ts.map +1 -1
  171. package/dist/context/parameters/webgl-parameter-tables.js +267 -286
  172. package/dist/context/parameters/webgl-parameter-tables.js.map +1 -1
  173. package/dist/context/polyfill/context-data.d.ts +13 -0
  174. package/dist/context/polyfill/context-data.d.ts.map +1 -0
  175. package/dist/context/polyfill/context-data.js +12 -0
  176. package/dist/context/polyfill/context-data.js.map +1 -0
  177. package/dist/context/polyfill/get-parameter-polyfill.d.ts +1 -1
  178. package/dist/context/polyfill/get-parameter-polyfill.d.ts.map +1 -1
  179. package/dist/context/polyfill/get-parameter-polyfill.js +37 -43
  180. package/dist/context/polyfill/get-parameter-polyfill.js.map +1 -1
  181. package/dist/context/polyfill/polyfill-context.d.ts.map +1 -1
  182. package/dist/context/polyfill/polyfill-context.js +22 -30
  183. package/dist/context/polyfill/polyfill-context.js.map +1 -1
  184. package/dist/context/polyfill/polyfill-table.d.ts +8 -8
  185. package/dist/context/polyfill/polyfill-table.d.ts.map +1 -1
  186. package/dist/context/polyfill/polyfill-table.js +18 -41
  187. package/dist/context/polyfill/polyfill-table.js.map +1 -1
  188. package/dist/context/polyfill/polyfill-vertex-array-object.d.ts.map +1 -1
  189. package/dist/context/polyfill/polyfill-vertex-array-object.js +17 -87
  190. package/dist/context/polyfill/polyfill-vertex-array-object.js.map +1 -1
  191. package/dist/context/state-tracker/deep-array-equal.d.ts.map +1 -1
  192. package/dist/context/state-tracker/deep-array-equal.js +0 -4
  193. package/dist/context/state-tracker/deep-array-equal.js.map +1 -1
  194. package/dist/context/state-tracker/track-context-state.d.ts.map +1 -1
  195. package/dist/context/state-tracker/track-context-state.js +26 -62
  196. package/dist/context/state-tracker/track-context-state.js.map +1 -1
  197. package/dist/context/state-tracker/with-parameters.d.ts +2 -1
  198. package/dist/context/state-tracker/with-parameters.d.ts.map +1 -1
  199. package/dist/context/state-tracker/with-parameters.js +8 -10
  200. package/dist/context/state-tracker/with-parameters.js.map +1 -1
  201. package/dist/dist.dev.js +8555 -0
  202. package/dist/index.cjs +6602 -0
  203. package/dist/index.d.ts +26 -24
  204. package/dist/index.d.ts.map +1 -1
  205. package/dist/index.js +27 -26
  206. package/dist/index.js.map +1 -1
  207. package/dist/types.d.ts +3 -1
  208. package/dist/types.d.ts.map +1 -1
  209. package/dist/types.js.map +1 -1
  210. package/dist.min.js +49 -0
  211. package/package.json +21 -9
  212. package/src/adapter/converters/device-parameters.ts +144 -41
  213. package/src/adapter/converters/sampler-parameters.ts +103 -41
  214. package/src/adapter/converters/shader-formats.ts +44 -0
  215. package/src/adapter/converters/texture-formats.ts +268 -195
  216. package/src/adapter/converters/vertex-formats.ts +71 -10
  217. package/src/adapter/device-helpers/device-features.ts +14 -3
  218. package/src/adapter/device-helpers/device-limits.ts +5 -3
  219. package/src/adapter/device-helpers/get-device-info.ts +53 -18
  220. package/src/adapter/device-helpers/is-old-ie.ts +3 -0
  221. package/src/adapter/helpers/{uniforms.ts → decode-webgl-types.ts} +39 -21
  222. package/src/adapter/helpers/get-shader-info.ts +41 -0
  223. package/src/adapter/helpers/get-shader-layout.ts +121 -146
  224. package/src/adapter/helpers/parse-shader-compiler-log.ts +24 -8
  225. package/src/adapter/helpers/set-uniform.ts +39 -35
  226. package/src/adapter/helpers/webgl-topology-utils.ts +103 -0
  227. package/src/adapter/objects/constants-to-keys.ts +6 -25
  228. package/src/adapter/objects/webgl-renderbuffer.ts +43 -37
  229. package/src/adapter/objects/webgl-resource.ts +16 -23
  230. package/src/adapter/resources/webgl-buffer.ts +67 -62
  231. package/src/adapter/resources/webgl-command-buffer.ts +327 -25
  232. package/src/adapter/resources/webgl-command-encoder.ts +20 -12
  233. package/src/adapter/resources/webgl-external-texture.ts +5 -2
  234. package/src/adapter/resources/webgl-framebuffer.ts +90 -134
  235. package/src/adapter/resources/webgl-render-pass.ts +166 -4
  236. package/src/adapter/resources/webgl-render-pipeline.ts +256 -192
  237. package/src/adapter/resources/webgl-sampler.ts +16 -10
  238. package/src/adapter/resources/webgl-shader.ts +14 -11
  239. package/src/adapter/resources/webgl-texture.ts +138 -99
  240. package/src/adapter/resources/webgl-transform-feedback.ts +202 -0
  241. package/src/adapter/resources/webgl-vertex-array.ts +283 -0
  242. package/src/adapter/webgl-canvas-context.ts +16 -14
  243. package/src/adapter/webgl-device.ts +328 -79
  244. package/src/classic/accessor.ts +8 -18
  245. package/src/classic/clear.ts +113 -0
  246. package/src/classic/copy-and-blit.ts +311 -0
  247. package/src/classic/format-utils.ts +46 -0
  248. package/src/classic/typed-array-utils.ts +21 -27
  249. package/src/context/context/create-browser-context.ts +140 -0
  250. package/src/context/context/create-headless-context.ts +51 -0
  251. package/src/context/context/webgl-checks.ts +3 -1
  252. package/src/context/debug/spector.ts +9 -6
  253. package/src/context/debug/webgl-developer-tools.ts +23 -15
  254. package/src/context/parameters/unified-parameter-api.ts +23 -14
  255. package/src/context/parameters/webgl-parameter-tables.ts +120 -98
  256. package/src/context/polyfill/context-data.ts +30 -0
  257. package/src/context/polyfill/get-parameter-polyfill.ts +11 -7
  258. package/src/context/polyfill/polyfill-context.ts +10 -9
  259. package/src/context/polyfill/polyfill-table.ts +21 -16
  260. package/src/context/polyfill/polyfill-vertex-array-object.ts +5 -0
  261. package/src/context/state-tracker/deep-array-equal.ts +2 -0
  262. package/src/context/state-tracker/track-context-state.ts +14 -11
  263. package/src/context/state-tracker/with-parameters.ts +13 -4
  264. package/src/index.ts +70 -35
  265. package/src/types.ts +5 -0
  266. package/dist/adapter/converters/renderbuffer-formats.d.ts +0 -16
  267. package/dist/adapter/converters/renderbuffer-formats.d.ts.map +0 -1
  268. package/dist/adapter/converters/renderbuffer-formats.js +0 -185
  269. package/dist/adapter/converters/renderbuffer-formats.js.map +0 -1
  270. package/dist/adapter/helpers/attribute-utils.d.ts +0 -11
  271. package/dist/adapter/helpers/attribute-utils.d.ts.map +0 -1
  272. package/dist/adapter/helpers/attribute-utils.js +0 -81
  273. package/dist/adapter/helpers/attribute-utils.js.map +0 -1
  274. package/dist/adapter/helpers/uniforms.d.ts +0 -26
  275. package/dist/adapter/helpers/uniforms.d.ts.map +0 -1
  276. package/dist/adapter/helpers/uniforms.js +0 -99
  277. package/dist/adapter/helpers/uniforms.js.map +0 -1
  278. package/dist/adapter/objects/webgl-vertex-array-object.d.ts +0 -27
  279. package/dist/adapter/objects/webgl-vertex-array-object.d.ts.map +0 -1
  280. package/dist/adapter/objects/webgl-vertex-array-object.js +0 -84
  281. package/dist/adapter/objects/webgl-vertex-array-object.js.map +0 -1
  282. package/dist/bundle.d.ts +0 -2
  283. package/dist/bundle.d.ts.map +0 -1
  284. package/dist/bundle.js +0 -5
  285. package/dist/bundle.js.map +0 -1
  286. package/dist/classic/buffer.d.ts +0 -95
  287. package/dist/classic/buffer.d.ts.map +0 -1
  288. package/dist/classic/buffer.js +0 -384
  289. package/dist/classic/buffer.js.map +0 -1
  290. package/dist/context/context/context-state.d.ts +0 -18
  291. package/dist/context/context/context-state.d.ts.map +0 -1
  292. package/dist/context/context/context-state.js +0 -26
  293. package/dist/context/context/context-state.js.map +0 -1
  294. package/dist/context/context/create-context.d.ts +0 -41
  295. package/dist/context/context/create-context.d.ts.map +0 -1
  296. package/dist/context/context/create-context.js +0 -49
  297. package/dist/context/context/create-context.js.map +0 -1
  298. package/dist/context/context/device-pixels.d.ts +0 -25
  299. package/dist/context/context/device-pixels.d.ts.map +0 -1
  300. package/dist/context/context/device-pixels.js +0 -98
  301. package/dist/context/context/device-pixels.js.map +0 -1
  302. package/dist/es5/adapter/converters/device-parameters.js +0 -170
  303. package/dist/es5/adapter/converters/device-parameters.js.map +0 -1
  304. package/dist/es5/adapter/converters/renderbuffer-formats.js +0 -163
  305. package/dist/es5/adapter/converters/renderbuffer-formats.js.map +0 -1
  306. package/dist/es5/adapter/converters/sampler-parameters.js +0 -226
  307. package/dist/es5/adapter/converters/sampler-parameters.js.map +0 -1
  308. package/dist/es5/adapter/converters/texture-formats.js +0 -1031
  309. package/dist/es5/adapter/converters/texture-formats.js.map +0 -1
  310. package/dist/es5/adapter/converters/vertex-formats.js +0 -45
  311. package/dist/es5/adapter/converters/vertex-formats.js.map +0 -1
  312. package/dist/es5/adapter/device-helpers/device-features.js +0 -144
  313. package/dist/es5/adapter/device-helpers/device-features.js.map +0 -1
  314. package/dist/es5/adapter/device-helpers/device-limits.js +0 -64
  315. package/dist/es5/adapter/device-helpers/device-limits.js.map +0 -1
  316. package/dist/es5/adapter/device-helpers/get-device-info.js +0 -55
  317. package/dist/es5/adapter/device-helpers/get-device-info.js.map +0 -1
  318. package/dist/es5/adapter/device-helpers/is-old-ie.js +0 -16
  319. package/dist/es5/adapter/device-helpers/is-old-ie.js.map +0 -1
  320. package/dist/es5/adapter/helpers/attribute-utils.js +0 -91
  321. package/dist/es5/adapter/helpers/attribute-utils.js.map +0 -1
  322. package/dist/es5/adapter/helpers/get-shader-layout.js +0 -371
  323. package/dist/es5/adapter/helpers/get-shader-layout.js.map +0 -1
  324. package/dist/es5/adapter/helpers/parse-shader-compiler-log.js +0 -72
  325. package/dist/es5/adapter/helpers/parse-shader-compiler-log.js.map +0 -1
  326. package/dist/es5/adapter/helpers/set-uniform.js +0 -125
  327. package/dist/es5/adapter/helpers/set-uniform.js.map +0 -1
  328. package/dist/es5/adapter/helpers/uniforms.js +0 -112
  329. package/dist/es5/adapter/helpers/uniforms.js.map +0 -1
  330. package/dist/es5/adapter/objects/constants-to-keys.js +0 -54
  331. package/dist/es5/adapter/objects/constants-to-keys.js.map +0 -1
  332. package/dist/es5/adapter/objects/webgl-renderbuffer.js +0 -150
  333. package/dist/es5/adapter/objects/webgl-renderbuffer.js.map +0 -1
  334. package/dist/es5/adapter/objects/webgl-resource.js +0 -292
  335. package/dist/es5/adapter/objects/webgl-resource.js.map +0 -1
  336. package/dist/es5/adapter/objects/webgl-vertex-array-object.js +0 -137
  337. package/dist/es5/adapter/objects/webgl-vertex-array-object.js.map +0 -1
  338. package/dist/es5/adapter/resources/webgl-buffer.js +0 -243
  339. package/dist/es5/adapter/resources/webgl-buffer.js.map +0 -1
  340. package/dist/es5/adapter/resources/webgl-command-buffer.js +0 -96
  341. package/dist/es5/adapter/resources/webgl-command-buffer.js.map +0 -1
  342. package/dist/es5/adapter/resources/webgl-command-encoder.js +0 -98
  343. package/dist/es5/adapter/resources/webgl-command-encoder.js.map +0 -1
  344. package/dist/es5/adapter/resources/webgl-external-texture.js +0 -2
  345. package/dist/es5/adapter/resources/webgl-external-texture.js.map +0 -1
  346. package/dist/es5/adapter/resources/webgl-framebuffer.js +0 -345
  347. package/dist/es5/adapter/resources/webgl-framebuffer.js.map +0 -1
  348. package/dist/es5/adapter/resources/webgl-render-pass.js +0 -61
  349. package/dist/es5/adapter/resources/webgl-render-pass.js.map +0 -1
  350. package/dist/es5/adapter/resources/webgl-render-pipeline.js +0 -505
  351. package/dist/es5/adapter/resources/webgl-render-pipeline.js.map +0 -1
  352. package/dist/es5/adapter/resources/webgl-sampler.js +0 -96
  353. package/dist/es5/adapter/resources/webgl-sampler.js.map +0 -1
  354. package/dist/es5/adapter/resources/webgl-shader.js +0 -149
  355. package/dist/es5/adapter/resources/webgl-shader.js.map +0 -1
  356. package/dist/es5/adapter/resources/webgl-texture.js +0 -986
  357. package/dist/es5/adapter/resources/webgl-texture.js.map +0 -1
  358. package/dist/es5/adapter/webgl-canvas-context.js +0 -97
  359. package/dist/es5/adapter/webgl-canvas-context.js.map +0 -1
  360. package/dist/es5/adapter/webgl-device.js +0 -399
  361. package/dist/es5/adapter/webgl-device.js.map +0 -1
  362. package/dist/es5/bundle.js +0 -7
  363. package/dist/es5/bundle.js.map +0 -1
  364. package/dist/es5/classic/accessor.js +0 -181
  365. package/dist/es5/classic/accessor.js.map +0 -1
  366. package/dist/es5/classic/buffer.js +0 -470
  367. package/dist/es5/classic/buffer.js.map +0 -1
  368. package/dist/es5/classic/typed-array-utils.js +0 -126
  369. package/dist/es5/classic/typed-array-utils.js.map +0 -1
  370. package/dist/es5/context/context/context-state.js +0 -31
  371. package/dist/es5/context/context/context-state.js.map +0 -1
  372. package/dist/es5/context/context/create-context.js +0 -69
  373. package/dist/es5/context/context/create-context.js.map +0 -1
  374. package/dist/es5/context/context/device-pixels.js +0 -115
  375. package/dist/es5/context/context/device-pixels.js.map +0 -1
  376. package/dist/es5/context/context/webgl-checks.js +0 -54
  377. package/dist/es5/context/context/webgl-checks.js.map +0 -1
  378. package/dist/es5/context/debug/spector.js +0 -133
  379. package/dist/es5/context/debug/spector.js.map +0 -1
  380. package/dist/es5/context/debug/webgl-developer-tools.js +0 -198
  381. package/dist/es5/context/debug/webgl-developer-tools.js.map +0 -1
  382. package/dist/es5/context/parameters/unified-parameter-api.js +0 -97
  383. package/dist/es5/context/parameters/unified-parameter-api.js.map +0 -1
  384. package/dist/es5/context/parameters/webgl-parameter-tables.js +0 -392
  385. package/dist/es5/context/parameters/webgl-parameter-tables.js.map +0 -1
  386. package/dist/es5/context/polyfill/get-parameter-polyfill.js +0 -81
  387. package/dist/es5/context/polyfill/get-parameter-polyfill.js.map +0 -1
  388. package/dist/es5/context/polyfill/polyfill-context.js +0 -135
  389. package/dist/es5/context/polyfill/polyfill-context.js.map +0 -1
  390. package/dist/es5/context/polyfill/polyfill-table.js +0 -166
  391. package/dist/es5/context/polyfill/polyfill-table.js.map +0 -1
  392. package/dist/es5/context/polyfill/polyfill-vertex-array-object.js +0 -341
  393. package/dist/es5/context/polyfill/polyfill-vertex-array-object.js.map +0 -1
  394. package/dist/es5/context/state-tracker/deep-array-equal.js +0 -28
  395. package/dist/es5/context/state-tracker/deep-array-equal.js.map +0 -1
  396. package/dist/es5/context/state-tracker/track-context-state.js +0 -211
  397. package/dist/es5/context/state-tracker/track-context-state.js.map +0 -1
  398. package/dist/es5/context/state-tracker/with-parameters.js +0 -44
  399. package/dist/es5/context/state-tracker/with-parameters.js.map +0 -1
  400. package/dist/es5/index.js +0 -276
  401. package/dist/es5/index.js.map +0 -1
  402. package/dist/es5/init.js +0 -10
  403. package/dist/es5/init.js.map +0 -1
  404. package/dist/es5/types/webgl.js +0 -6
  405. package/dist/es5/types/webgl.js.map +0 -1
  406. package/dist/es5/types.js +0 -2
  407. package/dist/es5/types.js.map +0 -1
  408. package/dist/esm/adapter/converters/device-parameters.js +0 -155
  409. package/dist/esm/adapter/converters/device-parameters.js.map +0 -1
  410. package/dist/esm/adapter/converters/renderbuffer-formats.js +0 -185
  411. package/dist/esm/adapter/converters/renderbuffer-formats.js.map +0 -1
  412. package/dist/esm/adapter/converters/sampler-parameters.js +0 -208
  413. package/dist/esm/adapter/converters/sampler-parameters.js.map +0 -1
  414. package/dist/esm/adapter/converters/texture-formats.js +0 -954
  415. package/dist/esm/adapter/converters/texture-formats.js.map +0 -1
  416. package/dist/esm/adapter/converters/vertex-formats.js +0 -35
  417. package/dist/esm/adapter/converters/vertex-formats.js.map +0 -1
  418. package/dist/esm/adapter/device-helpers/device-features.js +0 -102
  419. package/dist/esm/adapter/device-helpers/device-features.js.map +0 -1
  420. package/dist/esm/adapter/device-helpers/device-limits.js +0 -91
  421. package/dist/esm/adapter/device-helpers/device-limits.js.map +0 -1
  422. package/dist/esm/adapter/device-helpers/get-device-info.js +0 -44
  423. package/dist/esm/adapter/device-helpers/get-device-info.js.map +0 -1
  424. package/dist/esm/adapter/device-helpers/is-old-ie.js +0 -8
  425. package/dist/esm/adapter/device-helpers/is-old-ie.js.map +0 -1
  426. package/dist/esm/adapter/helpers/attribute-utils.js +0 -81
  427. package/dist/esm/adapter/helpers/attribute-utils.js.map +0 -1
  428. package/dist/esm/adapter/helpers/get-shader-layout.js +0 -306
  429. package/dist/esm/adapter/helpers/get-shader-layout.js.map +0 -1
  430. package/dist/esm/adapter/helpers/parse-shader-compiler-log.js +0 -37
  431. package/dist/esm/adapter/helpers/parse-shader-compiler-log.js.map +0 -1
  432. package/dist/esm/adapter/helpers/set-uniform.js +0 -115
  433. package/dist/esm/adapter/helpers/set-uniform.js.map +0 -1
  434. package/dist/esm/adapter/helpers/uniforms.js +0 -99
  435. package/dist/esm/adapter/helpers/uniforms.js.map +0 -1
  436. package/dist/esm/adapter/objects/constants-to-keys.js +0 -42
  437. package/dist/esm/adapter/objects/constants-to-keys.js.map +0 -1
  438. package/dist/esm/adapter/objects/webgl-renderbuffer.js +0 -94
  439. package/dist/esm/adapter/objects/webgl-renderbuffer.js.map +0 -1
  440. package/dist/esm/adapter/objects/webgl-resource.js +0 -216
  441. package/dist/esm/adapter/objects/webgl-resource.js.map +0 -1
  442. package/dist/esm/adapter/objects/webgl-vertex-array-object.js +0 -84
  443. package/dist/esm/adapter/objects/webgl-vertex-array-object.js.map +0 -1
  444. package/dist/esm/adapter/resources/webgl-buffer.js +0 -164
  445. package/dist/esm/adapter/resources/webgl-buffer.js.map +0 -1
  446. package/dist/esm/adapter/resources/webgl-command-buffer.js +0 -65
  447. package/dist/esm/adapter/resources/webgl-command-buffer.js.map +0 -1
  448. package/dist/esm/adapter/resources/webgl-command-encoder.js +0 -53
  449. package/dist/esm/adapter/resources/webgl-command-encoder.js.map +0 -1
  450. package/dist/esm/adapter/resources/webgl-external-texture.js +0 -2
  451. package/dist/esm/adapter/resources/webgl-external-texture.js.map +0 -1
  452. package/dist/esm/adapter/resources/webgl-framebuffer.js +0 -265
  453. package/dist/esm/adapter/resources/webgl-framebuffer.js.map +0 -1
  454. package/dist/esm/adapter/resources/webgl-render-pass.js +0 -19
  455. package/dist/esm/adapter/resources/webgl-render-pass.js.map +0 -1
  456. package/dist/esm/adapter/resources/webgl-render-pipeline.js +0 -400
  457. package/dist/esm/adapter/resources/webgl-render-pipeline.js.map +0 -1
  458. package/dist/esm/adapter/resources/webgl-sampler.js +0 -50
  459. package/dist/esm/adapter/resources/webgl-sampler.js.map +0 -1
  460. package/dist/esm/adapter/resources/webgl-shader.js +0 -75
  461. package/dist/esm/adapter/resources/webgl-shader.js.map +0 -1
  462. package/dist/esm/adapter/resources/webgl-texture.js +0 -833
  463. package/dist/esm/adapter/resources/webgl-texture.js.map +0 -1
  464. package/dist/esm/adapter/webgl-canvas-context.js +0 -54
  465. package/dist/esm/adapter/webgl-canvas-context.js.map +0 -1
  466. package/dist/esm/adapter/webgl-device.js +0 -280
  467. package/dist/esm/adapter/webgl-device.js.map +0 -1
  468. package/dist/esm/bundle.js +0 -5
  469. package/dist/esm/bundle.js.map +0 -1
  470. package/dist/esm/classic/accessor.js +0 -144
  471. package/dist/esm/classic/accessor.js.map +0 -1
  472. package/dist/esm/classic/buffer.js +0 -384
  473. package/dist/esm/classic/buffer.js.map +0 -1
  474. package/dist/esm/classic/typed-array-utils.js +0 -112
  475. package/dist/esm/classic/typed-array-utils.js.map +0 -1
  476. package/dist/esm/context/context/context-state.js +0 -26
  477. package/dist/esm/context/context/context-state.js.map +0 -1
  478. package/dist/esm/context/context/create-context.js +0 -49
  479. package/dist/esm/context/context/create-context.js.map +0 -1
  480. package/dist/esm/context/context/device-pixels.js +0 -98
  481. package/dist/esm/context/context/device-pixels.js.map +0 -1
  482. package/dist/esm/context/context/webgl-checks.js +0 -34
  483. package/dist/esm/context/context/webgl-checks.js.map +0 -1
  484. package/dist/esm/context/debug/spector.js +0 -76
  485. package/dist/esm/context/debug/spector.js.map +0 -1
  486. package/dist/esm/context/debug/webgl-developer-tools.js +0 -121
  487. package/dist/esm/context/debug/webgl-developer-tools.js.map +0 -1
  488. package/dist/esm/context/parameters/unified-parameter-api.js +0 -65
  489. package/dist/esm/context/parameters/unified-parameter-api.js.map +0 -1
  490. package/dist/esm/context/parameters/webgl-parameter-tables.js +0 -445
  491. package/dist/esm/context/parameters/webgl-parameter-tables.js.map +0 -1
  492. package/dist/esm/context/polyfill/get-parameter-polyfill.js +0 -91
  493. package/dist/esm/context/polyfill/get-parameter-polyfill.js.map +0 -1
  494. package/dist/esm/context/polyfill/polyfill-context.js +0 -92
  495. package/dist/esm/context/polyfill/polyfill-context.js.map +0 -1
  496. package/dist/esm/context/polyfill/polyfill-table.js +0 -160
  497. package/dist/esm/context/polyfill/polyfill-table.js.map +0 -1
  498. package/dist/esm/context/polyfill/polyfill-vertex-array-object.js +0 -335
  499. package/dist/esm/context/polyfill/polyfill-vertex-array-object.js.map +0 -1
  500. package/dist/esm/context/state-tracker/deep-array-equal.js +0 -21
  501. package/dist/esm/context/state-tracker/deep-array-equal.js.map +0 -1
  502. package/dist/esm/context/state-tracker/track-context-state.js +0 -183
  503. package/dist/esm/context/state-tracker/track-context-state.js.map +0 -1
  504. package/dist/esm/context/state-tracker/with-parameters.js +0 -36
  505. package/dist/esm/context/state-tracker/with-parameters.js.map +0 -1
  506. package/dist/esm/index.js +0 -27
  507. package/dist/esm/index.js.map +0 -1
  508. package/dist/esm/init.js +0 -4
  509. package/dist/esm/init.js.map +0 -1
  510. package/dist/esm/types/webgl.js +0 -2
  511. package/dist/esm/types/webgl.js.map +0 -1
  512. package/dist/esm/types.js +0 -2
  513. package/dist/esm/types.js.map +0 -1
  514. package/dist/init.d.ts +0 -2
  515. package/dist/init.d.ts.map +0 -1
  516. package/dist/init.js +0 -4
  517. package/dist/init.js.map +0 -1
  518. package/dist/types/webgl.d.ts +0 -145
  519. package/dist/types/webgl.d.ts.map +0 -1
  520. package/dist/types/webgl.js +0 -2
  521. package/dist/types/webgl.js.map +0 -1
  522. package/src/adapter/converters/renderbuffer-formats.ts +0 -92
  523. package/src/adapter/helpers/attribute-utils.ts +0 -61
  524. package/src/adapter/objects/webgl-vertex-array-object.ts +0 -111
  525. package/src/bundle.ts +0 -4
  526. package/src/classic/buffer.ts +0 -474
  527. package/src/context/context/context-state.ts +0 -41
  528. package/src/context/context/create-context.ts +0 -110
  529. package/src/context/context/device-pixels.ts +0 -152
  530. package/src/init.ts +0 -4
  531. package/src/types/webgl.ts +0 -284
@@ -0,0 +1,37 @@
1
+ import { assert } from '@luma.gl/core';
2
+ export function glFormatToComponents(format) {
3
+ switch (format) {
4
+ case 6406:
5
+ case 33326:
6
+ case 6403:
7
+ return 1;
8
+ case 33328:
9
+ case 33319:
10
+ return 2;
11
+ case 6407:
12
+ case 34837:
13
+ return 3;
14
+ case 6408:
15
+ case 34836:
16
+ return 4;
17
+ default:
18
+ assert(false);
19
+ return 0;
20
+ }
21
+ }
22
+ export function glTypeToBytes(type) {
23
+ switch (type) {
24
+ case 5121:
25
+ return 1;
26
+ case 33635:
27
+ case 32819:
28
+ case 32820:
29
+ return 2;
30
+ case 5126:
31
+ return 4;
32
+ default:
33
+ assert(false);
34
+ return 0;
35
+ }
36
+ }
37
+ //# sourceMappingURL=format-utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"format-utils.js","names":["assert","glFormatToComponents","format","glTypeToBytes","type"],"sources":["../../src/classic/format-utils.ts"],"sourcesContent":["// luma.gl, MIT license\n// Copyright (c) vis.gl contributors\n\nimport {assert} from '@luma.gl/core';\nimport {GL} from '@luma.gl/constants';\n\n// Returns number of components in a specific readPixels WebGL format\nexport function glFormatToComponents(format) {\n switch (format) {\n case GL.ALPHA:\n case GL.R32F:\n case GL.RED:\n return 1;\n case GL.RG32F:\n case GL.RG:\n return 2;\n case GL.RGB:\n case GL.RGB32F:\n return 3;\n case GL.RGBA:\n case GL.RGBA32F:\n return 4;\n // TODO: Add support for additional WebGL2 formats\n default:\n assert(false);\n return 0;\n }\n}\n\n// Return byte count for given readPixels WebGL type\nexport function glTypeToBytes(type) {\n switch (type) {\n case GL.UNSIGNED_BYTE:\n return 1;\n case GL.UNSIGNED_SHORT_5_6_5:\n case GL.UNSIGNED_SHORT_4_4_4_4:\n case GL.UNSIGNED_SHORT_5_5_5_1:\n return 2;\n case GL.FLOAT:\n return 4;\n // TODO: Add support for additional WebGL2 types\n default:\n assert(false);\n return 0;\n }\n}\n"],"mappings":"AAGA,SAAQA,MAAM,QAAO,eAAe;AAIpC,OAAO,SAASC,oBAAoBA,CAACC,MAAM,EAAE;EAC3C,QAAQA,MAAM;IACZ;IACA;IACA;MACE,OAAO,CAAC;IACV;IACA;MACE,OAAO,CAAC;IACV;IACA;MACE,OAAO,CAAC;IACV;IACA;MACE,OAAO,CAAC;IAEV;MACEF,MAAM,CAAC,KAAK,CAAC;MACb,OAAO,CAAC;EACZ;AACF;AAGA,OAAO,SAASG,aAAaA,CAACC,IAAI,EAAE;EAClC,QAAQA,IAAI;IACV;MACE,OAAO,CAAC;IACV;IACA;IACA;MACE,OAAO,CAAC;IACV;MACE,OAAO,CAAC;IAEV;MACEJ,MAAM,CAAC,KAAK,CAAC;MACb,OAAO,CAAC;EACZ;AACF"}
@@ -1,44 +1,44 @@
1
- import { TypedArray } from '@luma.gl/api/types';
2
- import { GLType } from '../types/webgl';
3
- declare type TypedArrayConstructor = Float32ArrayConstructor | Uint16ArrayConstructor | Uint32ArrayConstructor | Uint8ArrayConstructor | Uint8ClampedArrayConstructor | Int8ArrayConstructor | Int16ArrayConstructor | Int32ArrayConstructor;
1
+ import { TypedArray, TypedArrayConstructor } from '@luma.gl/core';
2
+ import { GLDataType, GLPixelType } from '@luma.gl/constants';
4
3
  /**
5
4
  * Converts TYPED ARRAYS to corresponding GL constant
6
5
  * Used to auto deduce gl parameter types
7
- * @param {*} arrayOrType
6
+ * @deprecated Use getDataTypeFromTypedArray
7
+ * @param arrayOrType
8
8
  * @returns
9
9
  */
10
- export declare function getGLTypeFromTypedArray(arrayOrType: TypedArray): GLType;
10
+ export declare function getGLTypeFromTypedArray(arrayOrType: TypedArray): GLDataType;
11
11
  /**
12
12
  * Converts GL constant to corresponding TYPED ARRAY
13
13
  * Used to auto deduce gl parameter types
14
- * @param {*} glType
15
- * @param {*} param1
14
+ * @deprecated Use getTypedArrayFromDataType
15
+ * @param glType
16
+ * @param param1
16
17
  * @returns
17
18
  */
18
- export declare function getTypedArrayFromGLType(glType: any, options?: {
19
+ export declare function getTypedArrayFromGLType(glType: GLDataType | GLPixelType, options?: {
19
20
  clamped?: boolean;
20
21
  }): TypedArrayConstructor;
21
22
  /**
22
23
  * Flip rows (can be used on arrays returned from `Framebuffer.readPixels`)
23
24
  * https: *stackoverflow.com/questions/41969562/
24
25
  * how-can-i-flip-the-result-of-webglrenderingcontext-readpixels
25
- * @param {*} param0
26
+ * @param param0
26
27
  */
27
28
  export declare function flipRows(options: {
28
- data: any;
29
- width: any;
30
- height: any;
29
+ data: TypedArray;
30
+ width: number;
31
+ height: number;
31
32
  bytesPerPixel?: number;
32
- temp?: any;
33
+ temp?: Uint8Array;
33
34
  }): void;
34
35
  export declare function scalePixels(options: {
35
- data: any;
36
- width: any;
37
- height: any;
36
+ data: TypedArray;
37
+ width: number;
38
+ height: number;
38
39
  }): {
39
40
  data: Uint8Array;
40
41
  width: number;
41
42
  height: number;
42
43
  };
43
- export {};
44
44
  //# sourceMappingURL=typed-array-utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"typed-array-utils.d.ts","sourceRoot":"","sources":["../../src/classic/typed-array-utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,oBAAoB,CAAC;AAE9C,OAAO,EAAC,MAAM,EAAC,MAAM,gBAAgB,CAAA;AAIrC,aAAK,qBAAqB,GACtB,uBAAuB,GACvB,sBAAsB,GACtB,sBAAsB,GACtB,qBAAqB,GACrB,4BAA4B,GAC5B,oBAAoB,GACpB,qBAAqB,GACrB,qBAAqB,CAAC;AAE1B;;;;;GAKG;AACH,wBAAgB,uBAAuB,CAAC,WAAW,EAAE,UAAU,GAAG,MAAM,CAuBvE;AAED;;;;;;GAMG;AAEH,wBA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CAAC;IACvB,IAAI,CAAC,EAAE,UAAU,CAAC;CACnB,GAAG,IAAI,CAgBP;AAGD,wBAAgB,WAAW,CAAC,OAAO,EAAE;IACnC,IAAI,EAAE,UAAU,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB,GAAG;IACF,IAAI,EAAE,UAAU,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB,CAaA"}
@@ -1,33 +1,23 @@
1
- import GL from '@luma.gl/constants';
2
1
  const ERR_TYPE_DEDUCTION = 'Failed to deduce GL constant from typed array';
3
2
  export function getGLTypeFromTypedArray(arrayOrType) {
4
3
  const type = ArrayBuffer.isView(arrayOrType) ? arrayOrType.constructor : arrayOrType;
5
-
6
4
  switch (type) {
7
5
  case Float32Array:
8
- return GL.FLOAT;
9
-
6
+ return 5126;
10
7
  case Uint16Array:
11
- return GL.UNSIGNED_SHORT;
12
-
8
+ return 5123;
13
9
  case Uint32Array:
14
- return GL.UNSIGNED_INT;
15
-
10
+ return 5125;
16
11
  case Uint8Array:
17
- return GL.UNSIGNED_BYTE;
18
-
12
+ return 5121;
19
13
  case Uint8ClampedArray:
20
- return GL.UNSIGNED_BYTE;
21
-
14
+ return 5121;
22
15
  case Int8Array:
23
- return GL.BYTE;
24
-
16
+ return 5120;
25
17
  case Int16Array:
26
- return GL.SHORT;
27
-
18
+ return 5122;
28
19
  case Int32Array:
29
- return GL.INT;
30
-
20
+ return 5124;
31
21
  default:
32
22
  throw new Error(ERR_TYPE_DEDUCTION);
33
23
  }
@@ -36,32 +26,24 @@ export function getTypedArrayFromGLType(glType, options) {
36
26
  const {
37
27
  clamped = true
38
28
  } = options || {};
39
-
40
29
  switch (glType) {
41
- case GL.FLOAT:
30
+ case 5126:
42
31
  return Float32Array;
43
-
44
- case GL.UNSIGNED_SHORT:
45
- case GL.UNSIGNED_SHORT_5_6_5:
46
- case GL.UNSIGNED_SHORT_4_4_4_4:
47
- case GL.UNSIGNED_SHORT_5_5_5_1:
32
+ case 5123:
33
+ case 33635:
34
+ case 32819:
35
+ case 32820:
48
36
  return Uint16Array;
49
-
50
- case GL.UNSIGNED_INT:
37
+ case 5125:
51
38
  return Uint32Array;
52
-
53
- case GL.UNSIGNED_BYTE:
39
+ case 5121:
54
40
  return clamped ? Uint8ClampedArray : Uint8Array;
55
-
56
- case GL.BYTE:
41
+ case 5120:
57
42
  return Int8Array;
58
-
59
- case GL.SHORT:
43
+ case 5122:
60
44
  return Int16Array;
61
-
62
- case GL.INT:
45
+ case 5124:
63
46
  return Int32Array;
64
-
65
47
  default:
66
48
  throw new Error('Failed to deduce typed array type from GL constant');
67
49
  }
@@ -76,7 +58,6 @@ export function flipRows(options) {
76
58
  } = options;
77
59
  const bytesPerRow = width * bytesPerPixel;
78
60
  const tempBuffer = temp || new Uint8Array(bytesPerRow);
79
-
80
61
  for (let y = 0; y < height / 2; ++y) {
81
62
  const topOffset = y * bytesPerRow;
82
63
  const bottomOffset = (height - y - 1) * bytesPerRow;
@@ -94,7 +75,6 @@ export function scalePixels(options) {
94
75
  const newWidth = Math.round(width / 2);
95
76
  const newHeight = Math.round(height / 2);
96
77
  const newData = new Uint8Array(newWidth * newHeight * 4);
97
-
98
78
  for (let y = 0; y < newHeight; y++) {
99
79
  for (let x = 0; x < newWidth; x++) {
100
80
  for (let c = 0; c < 4; c++) {
@@ -102,7 +82,6 @@ export function scalePixels(options) {
102
82
  }
103
83
  }
104
84
  }
105
-
106
85
  return {
107
86
  data: newData,
108
87
  width: newWidth,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/classic/typed-array-utils.ts"],"names":["GL","ERR_TYPE_DEDUCTION","getGLTypeFromTypedArray","arrayOrType","type","ArrayBuffer","isView","constructor","Float32Array","FLOAT","Uint16Array","UNSIGNED_SHORT","Uint32Array","UNSIGNED_INT","Uint8Array","UNSIGNED_BYTE","Uint8ClampedArray","Int8Array","BYTE","Int16Array","SHORT","Int32Array","INT","Error","getTypedArrayFromGLType","glType","options","clamped","UNSIGNED_SHORT_5_6_5","UNSIGNED_SHORT_4_4_4_4","UNSIGNED_SHORT_5_5_5_1","flipRows","data","width","height","bytesPerPixel","temp","bytesPerRow","tempBuffer","y","topOffset","bottomOffset","set","subarray","copyWithin","scalePixels","newWidth","Math","round","newHeight","newData","x","c"],"mappings":"AACA,OAAOA,EAAP,MAAe,oBAAf;AAGA,MAAMC,kBAAkB,GAAG,+CAA3B;AAkBA,OAAO,SAASC,uBAAT,CAAiCC,WAAjC,EAAkE;AAEvE,QAAMC,IAAI,GAAGC,WAAW,CAACC,MAAZ,CAAmBH,WAAnB,IAAkCA,WAAW,CAACI,WAA9C,GAA4DJ,WAAzE;;AACA,UAAQC,IAAR;AACE,SAAKI,YAAL;AACE,aAAOR,EAAE,CAACS,KAAV;;AACF,SAAKC,WAAL;AACE,aAAOV,EAAE,CAACW,cAAV;;AACF,SAAKC,WAAL;AACE,aAAOZ,EAAE,CAACa,YAAV;;AACF,SAAKC,UAAL;AACE,aAAOd,EAAE,CAACe,aAAV;;AACF,SAAKC,iBAAL;AACE,aAAOhB,EAAE,CAACe,aAAV;;AACF,SAAKE,SAAL;AACE,aAAOjB,EAAE,CAACkB,IAAV;;AACF,SAAKC,UAAL;AACE,aAAOnB,EAAE,CAACoB,KAAV;;AACF,SAAKC,UAAL;AACE,aAAOrB,EAAE,CAACsB,GAAV;;AACF;AACE,YAAM,IAAIC,KAAJ,CAAUtB,kBAAV,CAAN;AAlBJ;AAoBD;AAUD,OAAO,SAASuB,uBAAT,CACLC,MADK,EAELC,OAFK,EAKkB;AACvB,QAAM;AAACC,IAAAA,OAAO,GAAG;AAAX,MAAmBD,OAAO,IAAI,EAApC;;AAEA,UAAQD,MAAR;AACE,SAAKzB,EAAE,CAACS,KAAR;AACE,aAAOD,YAAP;;AACF,SAAKR,EAAE,CAACW,cAAR;AACA,SAAKX,EAAE,CAAC4B,oBAAR;AACA,SAAK5B,EAAE,C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AGD,OAAO,SAASI,WAAT,CAAqBnB,OAArB,EAQL;AACA,QAAM;AAACM,IAAAA,IAAD;AAAOC,IAAAA,KAAP;AAAcC,IAAAA;AAAd,MAAwBR,OAA9B;AACA,QAAMoB,QAAQ,GAAGC,IAAI,CAACC,KAAL,CAAWf,KAAK,GAAG,CAAnB,CAAjB;AACA,QAAMgB,SAAS,GAAGF,IAAI,CAACC,KAAL,CAAWd,MAAM,GAAG,CAApB,CAAlB;AACA,QAAMgB,OAAO,GAAG,IAAIpC,UAAJ,CAAegC,QAAQ,GAAGG,SAAX,GAAuB,CAAtC,CAAhB;;AACA,OAAK,IAAIV,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAGU,SAApB,EAA+BV,CAAC,EAAhC,EAAoC;AAClC,SAAK,IAAIY,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAGL,QAApB,EAA8BK,CAAC,EAA/B,EAAmC;AACjC,WAAK,IAAIC,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAG,CAApB,EAAuBA,CAAC,EAAxB,EAA4B;AAC1BF,QAAAA,OAAO,CAAC,CAACX,CAAC,GAAGO,QAAJ,GAAeK,CAAhB,IAAqB,CAArB,GAAyBC,CAA1B,CAAP,GAAsCpB,IAAI,CAAC,CAACO,CAAC,GAAG,CAAJ,GAAQN,KAAR,GAAgBkB,CAAC,GAAG,CAArB,IAA0B,CAA1B,GAA8BC,CAA/B,CAA1C;AACD;AACF;AACF;;AACD,SAAO;AAACpB,IAAAA,IAAI,EAAEkB,OAAP;AAAgBjB,IAAAA,KAAK,EAAEa,QAAvB;AAAiCZ,IAAAA,MAAM,EAAEe;AAAzC,GAAP;AACD","sourcesContent":["import {TypedArray} from '@luma.gl/api/types';\nimport GL from '@luma.gl/constants';\nimport {GLType} from '../types/webgl'\n\nconst ERR_TYPE_DEDUCTION = 'Failed to deduce GL constant from typed array';\n\ntype TypedArrayConstructor =\n | Float32ArrayConstructor\n | Uint16ArrayConstructor\n | Uint32ArrayConstructor\n | Uint8ArrayConstructor\n | Uint8ClampedArrayConstructor\n | Int8ArrayConstructor\n | Int16ArrayConstructor\n | Int32ArrayConstructor;\n\n/**\n * Converts TYPED ARRAYS to corresponding GL constant\n * Used to auto deduce gl parameter types\n * @param {*} arrayOrType\n * @returns\n */\nexport function getGLTypeFromTypedArray(arrayOrType: TypedArray): GLType {\n // If typed array, look up constructor\n const type = ArrayBuffer.isView(arrayOrType) ? arrayOrType.constructor : arrayOrType;\n switch (type) {\n case Float32Array:\n return GL.FLOAT;\n case Uint16Array:\n return GL.UNSIGNED_SHORT;\n case Uint32Array:\n return GL.UNSIGNED_INT;\n case Uint8Array:\n return GL.UNSIGNED_BYTE;\n case Uint8ClampedArray:\n return GL.UNSIGNED_BYTE;\n case Int8Array:\n return GL.BYTE;\n case Int16Array:\n return GL.SHORT;\n case Int32Array:\n return GL.INT;\n default:\n throw new Error(ERR_TYPE_DEDUCTION);\n }\n}\n\n/**\n * Converts GL constant to corresponding TYPED ARRAY\n * Used to auto deduce gl parameter types\n * @param {*} glType\n * @param {*} param1\n * @returns\n */\n// eslint-disable-next-line complexity\nexport function getTypedArrayFromGLType(\n glType: any,\n options?: {\n clamped?: boolean;\n }\n): TypedArrayConstructor {\n const {clamped = true} = options || {};\n // Sorted in some order of likelihood to reduce amount of comparisons\n switch (glType) {\n case GL.FLOAT:\n return Float32Array;\n case GL.UNSIGNED_SHORT:\n case GL.UNSIGNED_SHORT_5_6_5:\n case GL.UNSIGNED_SHORT_4_4_4_4:\n case GL.UNSIGNED_SHORT_5_5_5_1:\n return Uint16Array;\n case GL.UNSIGNED_INT:\n return Uint32Array;\n case GL.UNSIGNED_BYTE:\n return clamped ? Uint8ClampedArray : Uint8Array;\n case GL.BYTE:\n return Int8Array;\n case GL.SHORT:\n return Int16Array;\n case GL.INT:\n return Int32Array;\n default:\n throw new Error('Failed to deduce typed array type from GL constant');\n }\n}\n\n/**\n * Flip rows (can be used on arrays returned from `Framebuffer.readPixels`)\n * https: *stackoverflow.com/questions/41969562/\n * how-can-i-flip-the-result-of-webglrenderingcontext-readpixels\n * @param {*} param0\n */\n export function flipRows(options: {\n data: any;\n width: any;\n height: any;\n bytesPerPixel?: number;\n temp?: any;\n}): void {\n const {data, width, height, bytesPerPixel = 4, temp} = options;\n const bytesPerRow = width * bytesPerPixel;\n\n // make a temp buffer to hold one row\n const tempBuffer = temp || new Uint8Array(bytesPerRow);\n for (let y = 0; y < height / 2; ++y) {\n const topOffset = y * bytesPerRow;\n const bottomOffset = (height - y - 1) * bytesPerRow;\n // make copy of a row on the top half\n tempBuffer.set(data.subarray(topOffset, topOffset + bytesPerRow));\n // copy a row from the bottom half to the top\n data.copyWithin(topOffset, bottomOffset, bottomOffset + bytesPerRow);\n // copy the copy of the top half row to the bottom half\n data.set(tempBuffer, bottomOffset);\n }\n}\n\n\nexport function scalePixels(options: {\n data: any;\n width: any;\n height: any;\n}): {\n data: Uint8Array;\n width: number;\n height: number;\n} {\n const {data, width, height} = options;\n const newWidth = Math.round(width / 2);\n const newHeight = Math.round(height / 2);\n const newData = new Uint8Array(newWidth * newHeight * 4);\n for (let y = 0; y < newHeight; y++) {\n for (let x = 0; x < newWidth; x++) {\n for (let c = 0; c < 4; c++) {\n newData[(y * newWidth + x) * 4 + c] = data[(y * 2 * width + x * 2) * 4 + c];\n }\n }\n }\n return {data: newData, width: newWidth, height: newHeight};\n}\n"],"file":"typed-array-utils.js"}
1
+ {"version":3,"file":"typed-array-utils.js","names":["ERR_TYPE_DEDUCTION","getGLTypeFromTypedArray","arrayOrType","type","ArrayBuffer","isView","constructor","Float32Array","Uint16Array","Uint32Array","Uint8Array","Uint8ClampedArray","Int8Array","Int16Array","Int32Array","Error","getTypedArrayFromGLType","glType","options","clamped","flipRows","data","width","height","bytesPerPixel","temp","bytesPerRow","tempBuffer","y","topOffset","bottomOffset","set","subarray","copyWithin","scalePixels","newWidth","Math","round","newHeight","newData","x","c"],"sources":["../../src/classic/typed-array-utils.ts"],"sourcesContent":["// luma.gl, MIT license\n// Copyright (c) vis.gl contributors\n\nimport {TypedArray, TypedArrayConstructor} from '@luma.gl/core';\nimport {GL, GLDataType, GLPixelType} from '@luma.gl/constants';\n\nconst ERR_TYPE_DEDUCTION = 'Failed to deduce GL constant from typed array';\n\n/**\n * Converts TYPED ARRAYS to corresponding GL constant\n * Used to auto deduce gl parameter types\n * @deprecated Use getDataTypeFromTypedArray\n * @param arrayOrType\n * @returns\n */\nexport function getGLTypeFromTypedArray(arrayOrType: TypedArray): GLDataType {\n // If typed array, look up constructor\n const type = ArrayBuffer.isView(arrayOrType) ? arrayOrType.constructor : arrayOrType;\n switch (type) {\n case Float32Array:\n return GL.FLOAT;\n case Uint16Array:\n return GL.UNSIGNED_SHORT;\n case Uint32Array:\n return GL.UNSIGNED_INT;\n case Uint8Array:\n return GL.UNSIGNED_BYTE;\n case Uint8ClampedArray:\n return GL.UNSIGNED_BYTE;\n case Int8Array:\n return GL.BYTE;\n case Int16Array:\n return GL.SHORT;\n case Int32Array:\n return GL.INT;\n default:\n throw new Error(ERR_TYPE_DEDUCTION);\n }\n}\n\n/**\n * Converts GL constant to corresponding TYPED ARRAY\n * Used to auto deduce gl parameter types\n * @deprecated Use getTypedArrayFromDataType\n * @param glType\n * @param param1\n * @returns\n */\n// eslint-disable-next-line complexity\nexport function getTypedArrayFromGLType(\n glType: GLDataType | GLPixelType,\n options?: {\n clamped?: boolean;\n }\n): TypedArrayConstructor {\n const {clamped = true} = options || {};\n // Sorted in some order of likelihood to reduce amount of comparisons\n switch (glType) {\n case GL.FLOAT:\n return Float32Array;\n case GL.UNSIGNED_SHORT:\n case GL.UNSIGNED_SHORT_5_6_5:\n case GL.UNSIGNED_SHORT_4_4_4_4:\n case GL.UNSIGNED_SHORT_5_5_5_1:\n return Uint16Array;\n case GL.UNSIGNED_INT:\n return Uint32Array;\n case GL.UNSIGNED_BYTE:\n return clamped ? Uint8ClampedArray : Uint8Array;\n case GL.BYTE:\n return Int8Array;\n case GL.SHORT:\n return Int16Array;\n case GL.INT:\n return Int32Array;\n default:\n throw new Error('Failed to deduce typed array type from GL constant');\n }\n}\n\n/**\n * Flip rows (can be used on arrays returned from `Framebuffer.readPixels`)\n * https: *stackoverflow.com/questions/41969562/\n * how-can-i-flip-the-result-of-webglrenderingcontext-readpixels\n * @param param0\n */\nexport function flipRows(options: {\n data: TypedArray;\n width: number;\n height: number;\n bytesPerPixel?: number;\n temp?: Uint8Array;\n}): void {\n const {data, width, height, bytesPerPixel = 4, temp} = options;\n const bytesPerRow = width * bytesPerPixel;\n\n // make a temp buffer to hold one row\n const tempBuffer = temp || new Uint8Array(bytesPerRow);\n for (let y = 0; y < height / 2; ++y) {\n const topOffset = y * bytesPerRow;\n const bottomOffset = (height - y - 1) * bytesPerRow;\n // make copy of a row on the top half\n tempBuffer.set(data.subarray(topOffset, topOffset + bytesPerRow));\n // copy a row from the bottom half to the top\n data.copyWithin(topOffset, bottomOffset, bottomOffset + bytesPerRow);\n // copy the copy of the top half row to the bottom half\n data.set(tempBuffer, bottomOffset);\n }\n}\n\n\nexport function scalePixels(options: {\n data: TypedArray;\n width: number;\n height: number;\n}): {\n data: Uint8Array;\n width: number;\n height: number;\n} {\n const {data, width, height} = options;\n const newWidth = Math.round(width / 2);\n const newHeight = Math.round(height / 2);\n const newData = new Uint8Array(newWidth * newHeight * 4);\n for (let y = 0; y < newHeight; y++) {\n for (let x = 0; x < newWidth; x++) {\n for (let c = 0; c < 4; c++) {\n newData[(y * newWidth + x) * 4 + c] = data[(y * 2 * width + x * 2) * 4 + c];\n }\n }\n }\n return {data: newData, width: newWidth, height: newHeight};\n}\n"],"mappings":"AAMA,MAAMA,kBAAkB,GAAG,+CAA+C;AAS1E,OAAO,SAASC,uBAAuBA,CAACC,WAAuB,EAAc;EAE3E,MAAMC,IAAI,GAAGC,WAAW,CAACC,MAAM,CAACH,WAAW,CAAC,GAAGA,WAAW,CAACI,WAAW,GAAGJ,WAAW;EACpF,QAAQC,IAAI;IACV,KAAKI,YA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param webgl1 set to false to not create a WebGL1 context (fail if webgl2 not available)
5
+ * @param onContextLost
6
+ * @param onContextRestored
7
+ *
8
+ * BROWSER CONTEXT PARAMETERS
9
+ * @param debug Instrument context (at the expense of performance).
10
+ * @param alpha Default render target has an alpha buffer.
11
+ * @param depth Default render target has a depth buffer of at least 16 bits.
12
+ * @param stencil Default render target has a stencil buffer of at least 8 bits.
13
+ * @param antialias Boolean that indicates whether or not to perform anti-aliasing.
14
+ * @param premultipliedAlpha Boolean that indicates that the page compositor will assume the drawing buffer contains colors with pre-multiplied alpha.
15
+ * @param preserveDrawingBuffer Default render target buffers will not be automatically cleared and will preserve their values until cleared or overwritten
16
+ * @param failIfMajorPerformanceCaveat Do not create if the system performance is low.
17
+ */
18
+ type ContextProps = {
19
+ type?: 'webgl' | 'webgl1' | 'webgl2' | string;
20
+ webgl1?: boolean;
21
+ webgl2?: boolean;
22
+ onContextLost?: (event: Event) => void;
23
+ onContextRestored?: (event: Event) => void;
24
+ alpha?: boolean;
25
+ desynchronized?: boolean;
26
+ antialias?: boolean;
27
+ depth?: boolean;
28
+ failIfMajorPerformanceCaveat?: boolean;
29
+ powerPreference?: 'default' | 'high-performance' | 'low-power';
30
+ premultipliedAlpha?: boolean;
31
+ preserveDrawingBuffer?: boolean;
32
+ };
33
+ /**
34
+ * Create a WebGL context for a canvas
35
+ * Note calling this multiple time on the same canvas does return the same context
36
+ * @param canvas A canvas element or offscreen canvas
37
+ */
38
+ export declare function createBrowserContext(canvas: HTMLCanvasElement | OffscreenCanvas, props: ContextProps): WebGLRenderingContext;
39
+ export {};
40
+ //# sourceMappingURL=create-browser-context.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-browser-context.d.ts","sourceRoot":"","sources":["../../../src/context/context/create-browser-context.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;GAgBG;AACH,KAAK,YAAY,GAAG;IAClB,IAAI,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,QAAQ,GAAG,MAAM,CAAC;IAC9C,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IACvC,iBAAiB,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IAC3C,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,4BAA4B,CAAC,EAAE,OAAO,CAAC;IACvC,eAAe,CAAC,EAAE,SAAS,GAAG,kBAAkB,GAAG,WAAW,CAAC;IAC/D,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,qBAAqB,CAAC,EAAE,OAAO,CAAC;CACjC,CAAC;AAYF;;;;GAIG;AACH,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,iBAAiB,GAAG,eAAe,EAC3C,KAAK,EAAE,YAAY,GAClB,qBAAqB,CAiEvB"}
@@ -0,0 +1,53 @@
1
+ const DEFAULT_CONTEXT_PROPS = {
2
+ webgl2: true,
3
+ webgl1: true,
4
+ powerPreference: 'high-performance',
5
+ onContextLost: () => console.error('WebGL context lost'),
6
+ onContextRestored: () => console.info('WebGL context restored')
7
+ };
8
+ export function createBrowserContext(canvas, props) {
9
+ props = {
10
+ ...DEFAULT_CONTEXT_PROPS,
11
+ ...props
12
+ };
13
+ let errorMessage = null;
14
+ const onCreateError = error => errorMessage = error.statusMessage || errorMessage;
15
+ canvas.addEventListener('webglcontextcreationerror', onCreateError, false);
16
+ let gl = null;
17
+ if (props.type === 'webgl2') {
18
+ props = {
19
+ ...props,
20
+ webgl1: false
21
+ };
22
+ }
23
+ if (props.type === 'webgl1') {
24
+ props = {
25
+ ...props,
26
+ webgl2: false
27
+ };
28
+ }
29
+ if (!gl && props.webgl2) {
30
+ gl = canvas.getContext('webgl2', props);
31
+ }
32
+ if (!gl && props.webgl1) {
33
+ gl = canvas.getContext('webgl', props);
34
+ }
35
+ canvas.removeEventListener('webglcontextcreationerror', onCreateError, false);
36
+ if (!gl) {
37
+ throw new Error(`Failed to create ${props.webgl2 && !props.webgl1 ? 'WebGL2' : 'WebGL'} context: ${errorMessage || 'Unknown error'}`);
38
+ }
39
+ if (props.onContextLost) {
40
+ const {
41
+ onContextLost
42
+ } = props;
43
+ canvas.addEventListener('webglcontextlost', event => onContextLost(event), false);
44
+ }
45
+ if (props.onContextRestored) {
46
+ const {
47
+ onContextRestored
48
+ } = props;
49
+ canvas.addEventListener('webglcontextrestored', event => onContextRestored(event), false);
50
+ }
51
+ return gl;
52
+ }
53
+ //# sourceMappingURL=create-browser-context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-browser-context.js","names":["DEFAULT_CONTEXT_PROPS","webgl2","webgl1","powerPreference","onContextLost","console","error","onContextRestored","info","createBrowserContext","canvas","props","errorMessage","onCreateError","statusMessage","addEventListener","gl","type","getContext","removeEventListener","Error","event"],"sources":["../../../src/context/context/create-browser-context.ts"],"sourcesContent":["// luma.gl, MIT license\n// Copyright (c) vis.gl contributors\n\n/**\n * ContextProps\n * @param webgl2 Set to false to not create a WebGL2 context (force webgl1)\n * @param webgl1 set to false to not create a WebGL1 context (fail if webgl2 not available)\n * @param onContextLost\n * @param onContextRestored\n *\n * BROWSER CONTEXT PARAMETERS\n * @param debug Instrument context (at the expense of performance).\n * @param alpha Default render target has an alpha buffer.\n * @param depth Default render target has a depth buffer of at least 16 bits.\n * @param stencil Default render target has a stencil buffer of at least 8 bits.\n * @param antialias Boolean that indicates whether or not to perform anti-aliasing.\n * @param premultipliedAlpha Boolean that indicates that the page compositor will assume the drawing buffer contains colors with pre-multiplied alpha.\n * @param preserveDrawingBuffer Default render target buffers will not be automatically cleared and will preserve their values until cleared or overwritten\n * @param failIfMajorPerformanceCaveat Do not create if the system performance is low.\n */\ntype ContextProps = {\n type?: 'webgl' | 'webgl1' | 'webgl2' | string;\n webgl1?: boolean;\n webgl2?: boolean;\n onContextLost?: (event: Event) => void;\n onContextRestored?: (event: Event) => void;\n alpha?: boolean; // indicates if the canvas contains an alpha buffer.\n desynchronized?: boolean; // hints the user agent to reduce the latency by desynchronizing the canvas paint cycle from the event loop\n antialias?: boolean; // indicates whether or not to perform anti-aliasing.\n depth?: boolean; // indicates that the drawing buffer has a depth buffer of at least 16 bits.\n failIfMajorPerformanceCaveat?: boolean; // indicates if a context will be created if the system performance is low or if no hardware GPU is available.\n powerPreference?: 'default' | 'high-performance' | 'low-power';\n premultipliedAlpha?: boolean; // page compositor will assume the drawing buffer contains colors with pre-multiplied alpha.\n preserveDrawingBuffer?: boolean; // buffers will not be cleared and will preserve their values until cleared or overwritten by the author.\n};\n\nconst DEFAULT_CONTEXT_PROPS: ContextProps = {\n webgl2: true, // Attempt to create a WebGL2 context\n webgl1: true, // Attempt to create a WebGL1 context (false to fail if webgl2 not available)\n powerPreference: 'high-performance', // After all, most apps are using WebGL for performance reasons\n // eslint-disable-next-line no-console\n onContextLost: () => console.error('WebGL context lost'),\n // eslint-disable-next-line no-console\n onContextRestored: () => console.info('WebGL context restored')\n};\n\n/**\n * Create a WebGL context for a canvas\n * Note calling this multiple time on the same canvas does return the same context\n * @param canvas A canvas element or offscreen canvas\n */\nexport function createBrowserContext(\n canvas: HTMLCanvasElement | OffscreenCanvas,\n props: ContextProps\n): WebGLRenderingContext {\n props = {...DEFAULT_CONTEXT_PROPS, ...props};\n\n // Try to extract any extra information about why context creation failed\n let errorMessage = null;\n const onCreateError = error => (errorMessage = error.statusMessage || errorMessage);\n canvas.addEventListener('webglcontextcreationerror', onCreateError, false);\n\n // Create the desired context\n let gl: WebGLRenderingContext | WebGL2RenderingContext | null = null;\n\n if (props.type === 'webgl2') {\n props = {...props, webgl1: false};\n }\n if (props.type === 'webgl1') {\n props = {...props, webgl2: false};\n }\n\n // props.failIfMajorPerformanceCaveat = true;\n\n // Prefer webgl2 over webgl1 if both are acceptable\n if (!gl && props.webgl2) {\n gl = canvas.getContext('webgl2', props) as WebGL2RenderingContext;\n }\n if (!gl && props.webgl1) {\n gl = canvas.getContext('webgl', props) as WebGLRenderingContext;\n }\n\n // Software GPU\n\n // props.failIfMajorPerformanceCaveat = false;\n // if (!gl && props.webgl2) {\n // gl = canvas.getContext('webgl2', props);\n // }\n // if (!gl && props.webgl1) {\n // gl = canvas.getContext('webgl', props);\n // }\n\n // TODO are we removing this listener before giving it a chance to fire?\n canvas.removeEventListener('webglcontextcreationerror', onCreateError, false);\n\n if (!gl) {\n throw new Error(\n `Failed to create ${props.webgl2 && !props.webgl1 ? 'WebGL2' : 'WebGL'} context: ${\n errorMessage || 'Unknown error'\n }`\n );\n }\n\n if (props.onContextLost) {\n // Carefully extract and wrap callbacks to prevent addEventListener from rebinding them.\n const {onContextLost} = props;\n canvas.addEventListener('webglcontextlost', (event: Event) => onContextLost(event), false);\n }\n if (props.onContextRestored) {\n // Carefully extract and wrap callbacks to prevent addEventListener from rebinding them.\n const {onContextRestored} = props;\n canvas.addEventListener(\n 'webglcontextrestored',\n (event: Event) => onContextRestored(event),\n false\n );\n }\n\n return gl;\n}\n\n/* TODO - can we call this asynchronously to catch the error events?\nexport async function createBrowserContextAsync(canvas: HTMLCanvasElement | OffscreenCanvas, props: ContextProps): Promise<WebGLRenderingContext> {\n props = {...DEFAULT_CONTEXT_PROPS, ...props};\n\n // Try to extract any extra information about why context creation failed\n let errorMessage = null;\n const onCreateError = (error) => (errorMessage = error.statusMessage || errorMessage);\n canvas.addEventListener('webglcontextcreationerror', onCreateError, false);\n\n const gl = createBrowserContext(canvas, props);\n\n // Give the listener a chance to fire\n await new Promise(resolve => setTimeout(resolve, 0));\n\n canvas.removeEventListener('webglcontextcreationerror', onCreateError, false);\n\n return gl;\n}\n*/\n"],"mappings":"AAoCA,MAAMA,qBAAmC,GAAG;EAC1CC,MAAM,EAAE,IAAI;EACZC,MAAM,EAAE,IA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KAAK,CAACT,MAAM,GAAG,QAAQ,GAAG,OAAQ,aACrEU,YAAY,IAAI,eACjB,EACH,CAAC;EACH;EAEA,IAAID,KAAK,CAACP,aAAa,EAAE;IAEvB,MAAM;MAACA;IAAa,CAAC,GAAGO,KAAK;IAC7BD,MAAM,CAACK,gBAAgB,CAAC,kBAAkB,EAAGM,KAAY,IAAKjB,aAAa,CAACiB,KAAK,CAAC,EAAE,KAAK,CAAC;EAC5F;EACA,IAAIV,KAAK,CAACJ,iBAAiB,EAAE;IAE3B,MAAM;MAACA;IAAiB,CAAC,GAAGI,KAAK;IACjCD,MAAM,CAACK,gBAAgB,CACrB,sBAAsB,EACrBM,KAAY,IAAKd,iBAAiB,CAACc,KAAK,CAAC,EAC1C,KACF,CAAC;EACH;EAEA,OAAOL,EAAE;AACX"}
@@ -0,0 +1,9 @@
1
+ /** Duck typing for the main headless gl export, a function to create contexts */
2
+ export type HeadlessGL = (width: number, height: number, options: Record<string, unknown>) => WebGLRenderingContext;
3
+ /** By importing `gl` and registering it with this function, contexts can be created under Node.js */
4
+ export declare function registerHeadlessGL(headlessgl: HeadlessGL): void;
5
+ /** @returns true if headless gl is registered */
6
+ export declare function isHeadlessGLRegistered(): boolean;
7
+ /** Create headless gl context (for running under Node.js) */
8
+ export declare function createHeadlessContext(options?: Record<string, any>): WebGLRenderingContext;
9
+ //# sourceMappingURL=create-headless-context.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-headless-context.d.ts","sourceRoot":"","sources":["../../../src/context/context/create-headless-context.ts"],"names":[],"mappings":"AAkBA,iFAAiF;AACjF,MAAM,MAAM,UAAU,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,qBAAqB,CAAC;AAIpH,qGAAqG;AACrG,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,UAAU,QAExD;AAED,iDAAiD;AACjD,wBAAgB,sBAAsB,IAAI,OAAO,CAEhD;AAED,6DAA6D;AAC7D,wBAAgB,qBAAqB,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,qBAAqB,CAgB1F"}
@@ -0,0 +1,42 @@
1
+ const ERR_HEADLESSGL_FAILED = 'Failed to create WebGL context in Node.js, headless gl returned null';
2
+ const ERR_HEADLESSGL_LOAD = '\
3
+ luma.gl: loaded under Node.js without headless gl installed, meaning that WebGL \
4
+ contexts can not be created. This may not be an error. For example, this is a \
5
+ typical configuration for isorender applications running on the server.';
6
+ const CONTEXT_DEFAULTS = {
7
+ width: 1,
8
+ height: 1,
9
+ debug: true,
10
+ throwOnError: false
11
+ };
12
+ let headlessGL = null;
13
+ export function registerHeadlessGL(headlessgl) {
14
+ headlessGL = headlessgl;
15
+ }
16
+ export function isHeadlessGLRegistered() {
17
+ return headlessGL !== null;
18
+ }
19
+ export function createHeadlessContext(options) {
20
+ options = {
21
+ ...CONTEXT_DEFAULTS,
22
+ ...options
23
+ };
24
+ const {
25
+ width,
26
+ height,
27
+ webgl1,
28
+ webgl2
29
+ } = options;
30
+ if (webgl2 && !webgl1) {
31
+ throw new Error('headless-gl does not support WebGL2');
32
+ }
33
+ if (!headlessGL) {
34
+ throw new Error(ERR_HEADLESSGL_LOAD);
35
+ }
36
+ const gl = headlessGL(width, height, options);
37
+ if (!gl) {
38
+ throw new Error(ERR_HEADLESSGL_FAILED);
39
+ }
40
+ return gl;
41
+ }
42
+ //# sourceMappingURL=create-headless-context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-headless-context.js","names":["ERR_HEADLESSGL_FAILED","ERR_HEADLESSGL_LOAD","CONTEXT_DEFAULTS","width","height","debug","throwOnError","headlessGL","registerHeadlessGL","headlessgl","isHeadlessGLRegistered","createHeadlessContext","options","webgl1","webgl2","Error","gl"],"sources":["../../../src/context/context/create-headless-context.ts"],"sourcesContent":["// luma.gl, MIT license\n// Copyright (c) vis.gl contributors\n\nconst ERR_HEADLESSGL_FAILED =\n 'Failed to create WebGL context in Node.js, headless gl returned null';\n\nconst ERR_HEADLESSGL_LOAD = '\\\n luma.gl: loaded under Node.js without headless gl installed, meaning that WebGL \\\n contexts can not be created. This may not be an error. For example, this is a \\\n typical configuration for isorender applications running on the server.';\n\nconst CONTEXT_DEFAULTS = {\n width: 1,\n height: 1,\n debug: true,\n throwOnError: false\n};\n\n/** Duck typing for the main headless gl export, a function to create contexts */\nexport type HeadlessGL = (width: number, height: number, options: Record<string, unknown>) => WebGLRenderingContext;\n\nlet headlessGL: HeadlessGL | null = null; \n\n/** By importing `gl` and registering it with this function, contexts can be created under Node.js */\nexport function registerHeadlessGL(headlessgl: HeadlessGL) {\n headlessGL = headlessgl;\n}\n\n/** @returns true if headless gl is registered */\nexport function isHeadlessGLRegistered(): boolean {\n return headlessGL !== null;\n}\n\n/** Create headless gl context (for running under Node.js) */\nexport function createHeadlessContext(options?: Record<string, any>): WebGLRenderingContext {\n options = {...CONTEXT_DEFAULTS, ...options};\n\n const {width, height, webgl1, webgl2} = options;\n\n if (webgl2 && !webgl1) {\n throw new Error('headless-gl does not support WebGL2');\n }\n if (!headlessGL) {\n throw new Error(ERR_HEADLESSGL_LOAD);\n }\n const gl = headlessGL(width, height, options);\n if (!gl) {\n throw new Error(ERR_HEADLESSGL_FAILED);\n }\n return gl;\n}\n"],"mappings":"AAGA,MAAMA,qBAAqB,GACzB,sEAAsE;AAExE,MAAMC,mBAAmB,GAAG;AAC5B;AACA;AACA,0EAA0E;AAE1E,MAAMC,gBAAgB,GAAG;EACvBC,KAAK,EAAE,CAAC;EACRC,MAAM,EAAE,CAAC;EACTC,KAAK,EAAE,IAAI;EACXC,YAAY,EAAE;AAChB,CAAC;AAKD,IAAIC,UAA6B,GAAG,IAAI;AAGxC,OAAO,SAASC,kBAAkBA,CAACC,UAAsB,EAAE;EACzDF,UAAU,GAAGE,UAAU;AACzB;AAGA,OAAO,SAASC,sBAAsBA,CAAA,EAAY;EAChD,OAAOH,UAAU,KAAK,IAAI;AAC5B;AAGA,OAAO,SAASI,qBAAqBA,CAACC,OAA6B,EAAyB;EAC1FA,OAAO,GAAG;IAAC,GAAGV,gBAAgB;IAAE,GAAGU;EAAO,CAAC;EAE3C,MAAM;IAACT,KAAK;IAAEC,MAAM;IAAES,MAAM;IAAEC;EAAM,CAAC,GAAGF,OAAO;EAE/C,IAAIE,MAAM,IAAI,CAACD,MAAM,EAAE;IACrB,MAAM,IAAIE,KAAK,CAAC,qCAAqC,CAAC;EACxD;EACA,IAAI,CAACR,UAAU,EAAE;IACf,MAAM,IAAIQ,KAAK,CAACd,mBAAmB,CAAC;EACtC;EACA,MAAMe,EAAE,GAAGT,UAAU,CAACJ,KAAK,EAAEC,MAAM,EAAEQ,OAAO,CAAC;EAC7C,IAAI,CAACI,EAAE,EAAE;IACP,MAAM,IAAID,KAAK,CAACf,qBAAqB,CAAC;EACxC;EACA,OAAOgB,EAAE;AACX"}
@@ -1 +1 @@
1
- {"version":3,"file":"webgl-checks.d.ts","sourceRoot":"","sources":["../../../src/context/context/webgl-checks.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,SAAS,kCAAc,CAAC;AACrC,eAAO,MAAM,UAAU,oBAAoB,CAAC;AAG5C,6DAA6D;AAC7D,wBAAgB,OAAO,CAAC,EAAE,EAAE,GAAG,GAAG,OAAO,CASxC;AAGD,8DAA8D;AAC9D,wBAAgB,QAAQ,CAAC,EAAE,EAAE,GAAG,GAAG,OAAO,CAMzC;AAGD,qFAAqF;AACrF,wBAAgB,gBAAgB,CAAC,EAAE,EAAE,qBAAqB,GAAG,sBAAsB,GAAG,IAAI,CAGzF;AAGD,wGAAwG;AACxG,wBAAgB,kBAAkB,CAAC,EAAE,EAAE,GAAG,GAAG,qBAAqB,CAGjE;AAED,yGAAyG;AACzG,wBAAgB,mBAAmB,CAAC,EAAE,EAAE,GAAG,GAAG,sBAAsB,CAGnE"}
1
+ {"version":3,"file":"webgl-checks.d.ts","sourceRoot":"","sources":["../../../src/context/context/webgl-checks.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,SAAS,kCAAc,CAAC;AACrC,eAAO,MAAM,UAAU,oBAAoB,CAAC;AAG5C,6DAA6D;AAC7D,wBAAgB,OAAO,CAAC,EAAE,EAAE,GAAG,GAAG,OAAO,CASxC;AAGD,8DAA8D;AAC9D,wBAAgB,QAAQ,CAAC,EAAE,EAAE,GAAG,GAAG,OAAO,CAMzC;AAGD,qFAAqF;AACrF,wBAAgB,gBAAgB,CAAC,EAAE,EAAE,qBAAqB,GAAG,sBAAsB,GAAG,IAAI,CAGzF;AAGD,wGAAwG;AACxG,wBAAgB,kBAAkB,CAAC,EAAE,EAAE,GAAG,GAAG,qBAAqB,CAGjE;AAED,yGAAyG;AACzG,wBAAgB,mBAAmB,CAAC,EAAE,EAAE,GAAG,GAAG,sBAAsB,CAGnE"}
@@ -1,4 +1,4 @@
1
- import { assert } from '@luma.gl/api';
1
+ import { assert } from '@luma.gl/core';
2
2
  const ERR_CONTEXT = 'Invalid WebGLRenderingContext';
3
3
  export const ERR_WEBGL = ERR_CONTEXT;
4
4
  export const ERR_WEBGL2 = 'Requires WebGL2';
@@ -6,18 +6,15 @@ export function isWebGL(gl) {
6
6
  if (typeof WebGLRenderingContext !== 'undefined' && gl instanceof WebGLRenderingContext) {
7
7
  return true;
8
8
  }
9
-
10
9
  if (typeof WebGL2RenderingContext !== 'undefined' && gl instanceof WebGL2RenderingContext) {
11
10
  return true;
12
11
  }
13
-
14
12
  return Boolean(gl && Number.isFinite(gl._version));
15
13
  }
16
14
  export function isWebGL2(gl) {
17
15
  if (typeof WebGL2RenderingContext !== 'undefined' && gl instanceof WebGL2RenderingContext) {
18
16
  return true;
19
17
  }
20
-
21
18
  return Boolean(gl && gl._version === 2);
22
19
  }
23
20
  export function getWebGL2Context(gl) {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/context/context/webgl-checks.ts"],"names":["assert","ERR_CONTEXT","ERR_WEBGL","ERR_WEBGL2","isWebGL","gl","WebGLRenderingContext","WebGL2RenderingContext","Boolean","Number","isFinite","_version","isWebGL2","getWebGL2Context","assertWebGLContext","assertWebGL2Context"],"mappings":"AACA,SAAQA,MAAR,QAAqB,cAArB;AAEA,MAAMC,WAAW,GAAG,+BAApB;AACA,OAAO,MAAMC,SAAS,GAAGD,WAAlB;AACP,OAAO,MAAME,UAAU,GAAG,iBAAnB;AAIP,OAAO,SAASC,OAAT,CAAiBC,EAAjB,EAAmC;AACxC,MAAI,OAAOC,qBAAP,KAAiC,WAAjC,IAAgDD,EAAE,YAAYC,qBAAlE,EAAyF;AACvF,WAAO,IAAP;AACD;;AACD,MAAI,OAAOC,sBAAP,KAAkC,WAAlC,IAAiDF,EAAE,YAAYE,sBAAnE,EAA2F;AACzF,WAAO,IAAP;AACD;;AAED,SAAOC,OAAO,CAACH,EAAE,IAAII,MAAM,CAACC,QAAP,CAAgBL,EAAE,CAACM,QAAnB,CAAP,CAAd;AACD;AAID,OAAO,SAASC,QAAT,CAAkBP,EAAlB,EAAoC;AACzC,MAAI,OAAOE,sBAAP,KAAkC,WAAlC,IAAiDF,EAAE,YAAYE,sBAAnE,EAA2F;AACzF,WAAO,IAAP;AACD;;AAED,SAAOC,OAAO,CAACH,EAAE,IAAIA,EAAE,CAACM,QAAH,KAAgB,CAAvB,CAAd;AACD;AAID,OAAO,SAASE,gBAAT,CAA0BR,EAA1B,EAAoF;AAEzF,SAAOO,QAAQ,CAACP,EAAD,CAAR,GAAeA,EAAf,GAAoB,IAA3B;AACD;AAID,OAAO,SAASS,kBAAT,CAA4BT,EAA5B,EAA4D;AACjEL,EAAAA,MAAM,CAACI,OAAO,CAACC,EAAD,CAAR,EAAcJ,WAAd,CAAN;AACA,SAAOI,EAAP;AACD;AAGD,OAAO,SAASU,mBAAT,CAA6BV,EAA7B,EAA8D;AACnEL,EAAAA,MAAM,CAACY,QAAQ,CAACP,EAAD,CAAT,EAAeF,UAAf,CAAN;AACA,SAAOE,EAAP;AACD","sourcesContent":["// luma.gl, MIT license\nimport {assert} from '@luma.gl/api';\n\nconst ERR_CONTEXT = 'Invalid WebGLRenderingContext';\nexport const ERR_WEBGL = ERR_CONTEXT;\nexport const ERR_WEBGL2 = 'Requires WebGL2';\n\n\n/** Check if supplied parameter is a WebGLRenderingContext */\nexport function isWebGL(gl: any): boolean {\n if (typeof WebGLRenderingContext !== 'undefined' && gl instanceof WebGLRenderingContext) {\n return true;\n }\n if (typeof WebGL2RenderingContext !== 'undefined' && gl instanceof WebGL2RenderingContext) {\n return true;\n }\n // Look for debug contexts, headless gl etc\n return Boolean(gl && Number.isFinite(gl._version));\n}\n\n\n/** Check if supplied parameter is a WebGL2RenderingContext */\nexport function isWebGL2(gl: any): boolean {\n if (typeof WebGL2RenderingContext !== 'undefined' && gl instanceof WebGL2RenderingContext) {\n return true;\n }\n // Look for debug contexts, headless gl etc\n return Boolean(gl && gl._version === 2);\n}\n\n\n/** Returns a properly typed WebGL2RenderingContext from a WebGL1 context, or null */\nexport function getWebGL2Context(gl: WebGLRenderingContext): WebGL2RenderingContext | null {\n // @ts-expect-error\n return isWebGL2(gl) ? gl : null;\n}\n\n\n/** Throw if supplied parameter is not a WebGLRenderingContext, otherwise return properly typed value */\nexport function assertWebGLContext(gl: any): WebGLRenderingContext {\n assert(isWebGL(gl), ERR_CONTEXT);\n return gl;\n}\n\n/** Throw if supplied parameter is not a WebGL2RenderingContext, otherwise return properly typed value */\nexport function assertWebGL2Context(gl: any): WebGL2RenderingContext {\n assert(isWebGL2(gl), ERR_WEBGL2);\n return gl;\n}\n"],"file":"webgl-checks.js"}
1
+ {"version":3,"file":"webgl-checks.js","names":["assert","ERR_CONTEXT","ERR_WEBGL","ERR_WEBGL2","isWebGL","gl","WebGLRenderingContext","WebGL2RenderingContext","Boolean","Number","isFinite","_version","isWebGL2","getWebGL2Context","assertWebGLContext","assertWebGL2Context"],"sources":["../../../src/context/context/webgl-checks.ts"],"sourcesContent":["// luma.gl, MIT license\n// Copyright (c) vis.gl contributors\n\nimport {assert} from '@luma.gl/core';\n\nconst ERR_CONTEXT = 'Invalid WebGLRenderingContext';\nexport const ERR_WEBGL = ERR_CONTEXT;\nexport const ERR_WEBGL2 = 'Requires WebGL2';\n\n\n/** Check if supplied parameter is a WebGLRenderingContext */\nexport function isWebGL(gl: any): boolean {\n if (typeof WebGLRenderingContext !== 'undefined' && gl instanceof WebGLRenderingContext) {\n return true;\n }\n if (typeof WebGL2RenderingContext !== 'undefined' && gl instanceof WebGL2RenderingContext) {\n return true;\n }\n // Look for debug contexts, headless gl etc\n return Boolean(gl && Number.isFinite(gl._version));\n}\n\n\n/** Check if supplied parameter is a WebGL2RenderingContext */\nexport function isWebGL2(gl: any): boolean {\n if (typeof WebGL2RenderingContext !== 'undefined' && gl instanceof WebGL2RenderingContext) {\n return true;\n }\n // Look for debug contexts, headless gl etc\n return Boolean(gl && gl._version === 2);\n}\n\n\n/** Returns a properly typed WebGL2RenderingContext from a WebGL1 context, or null */\nexport function getWebGL2Context(gl: WebGLRenderingContext): WebGL2RenderingContext | null {\n // @ts-expect-error\n return isWebGL2(gl) ? gl : null;\n}\n\n\n/** Throw if supplied parameter is not a WebGLRenderingContext, otherwise return properly typed value */\nexport function assertWebGLContext(gl: any): WebGLRenderingContext {\n assert(isWebGL(gl), ERR_CONTEXT);\n return gl;\n}\n\n/** Throw if supplied parameter is not a WebGL2RenderingContext, otherwise return properly typed value */\nexport function assertWebGL2Context(gl: any): WebGL2RenderingContext {\n assert(isWebGL2(gl), ERR_WEBGL2);\n return gl;\n}\n"],"mappings":"AAGA,SAAQA,MAAM,QAAO,eAAe;AAEpC,MAAMC,WAAW,GAAG,+BAA+B;AACnD,OAAO,MAAMC,SAAS,GAAGD,WAAW;AACpC,OAAO,MAAME,UAAU,GAAG,iBAAiB;AAI3C,OAAO,SAASC,OAAOA,CAACC,EAAO,EAAW;EACxC,IAAI,OAAOC,qBAAqB,KAAK,WAAW,IAAID,EAAE,YAAYC,qBAAqB,EAAE;IACvF,OAAO,IAAI;EACb;EACA,IAAI,OAAOC,sBAAsB,KAAK,WAAW,IAAIF,EAAE,YAAYE,sBAAsB,EAAE;IACzF,OAAO,IAAI;EACb;EAEA,OAAOC,OAAO,CAACH,EAAE,IAAII,MAAM,CAACC,QAAQ,CAACL,EAAE,CAACM,QAAQ,CAAC,CAAC;AACpD;AAIA,OAAO,SAASC,QAAQA,CAACP,EAAO,EAAW;EACzC,IAAI,OAAOE,sBAAsB,KAAK,WAAW,IAAIF,EAAE,YAAYE,sBAAsB,EAAE;IACzF,OAAO,IAAI;EACb;EAEA,OAAOC,OAAO,CAACH,EAAE,IAAIA,EAAE,CAACM,QAAQ,KAAK,CAAC,CAAC;AACzC;AAIA,OAAO,SAASE,gBAAgBA,CAACR,EAAyB,EAAiC;EAEzF,OAAOO,QAAQ,CAACP,EAAE,CAAC,GAAGA,EAAE,GAAG,IAAI;AACjC;AAIA,OAAO,SAASS,kBAAkBA,CAACT,EAAO,EAAyB;EACjEL,MAAM,CAACI,OAAO,CAACC,EAAE,CAAC,EAAEJ,WAAW,CAAC;EAChC,OAAOI,EAAE;AACX;AAGA,OAAO,SAASU,mBAAmBA,CAACV,EAAO,EAA0B;EACnEL,MAAM,CAACY,QAAQ,CAACP,EAAE,CAAC,EAAEF,UAAU,CAAC;EAChC,OAAOE,EAAE;AACX"}
@@ -1,6 +1,5 @@
1
- /// <reference types="offscreencanvas" />
2
1
  /** Spector debug initialization options */
3
- declare type SpectorProps = {
2
+ type SpectorProps = {
4
3
  /** Canvas to monitor */
5
4
  canvas?: HTMLCanvasElement | OffscreenCanvas;
6
5
  /** Whether debug is enabled. Auto-detected if ommitted */
@@ -1 +1 @@
1
- {"version":3,"file":"spector.d.ts","sourceRoot":"","sources":["../../../src/context/debug/spector.ts"],"names":[],"mappings":";AAGA,2CAA2C;AAC3C,aAAK,YAAY,GAAG;IAClB,wBAAwB;IACxB,MAAM,CAAC,EAAE,iBAAiB,GAAG,eAAe,CAAC;IAC7C,0DAA0D;IAC1D,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,kCAAkC;IAClC,OAAO,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,CAAC;CACrC,CAAC;AAaF,OAAO,CAAC,MAAM,CAAC;IACb,IAAI,OAAO,EAAE,GAAG,CAAC;CAClB;AAED,sDAAsD;AACtD,wBAAsB,aAAa,CAAC,KAAK,CAAC,EAAE,YAAY,iBAQvD;AAED,wBAAgB,mBAAmB,CAAC,KAAK,CAAC,EAAE,YAAY,OAoDvD"}
1
+ {"version":3,"file":"spector.d.ts","sourceRoot":"","sources":["../../../src/context/debug/spector.ts"],"names":[],"mappings":"AAKA,2CAA2C;AAC3C,KAAK,YAAY,GAAG;IAClB,wBAAwB;IACxB,MAAM,CAAC,EAAE,iBAAiB,GAAG,eAAe,CAAC;IAC7C,0DAA0D;IAC1D,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,kCAAkC;IAClC,OAAO,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,CAAC;CACrC,CAAC;AAaF,OAAO,CAAC,MAAM,CAAC;IAEb,IAAI,OAAO,EAAE,GAAG,CAAC;CAClB;AAED,sDAAsD;AACtD,wBAAsB,aAAa,CAAC,KAAK,CAAC,EAAE,YAAY,iBAQvD;AAED,wBAAgB,mBAAmB,CAAC,KAAK,CAAC,EAAE,YAAY,OAoDvD"}
@@ -1,4 +1,4 @@
1
- import { log, loadScript } from '@luma.gl/api';
1
+ import { log, loadScript } from '@luma.gl/core';
2
2
  const DEFAULT_SPECTOR_PROPS = {
3
3
  spector: log.get('spector') || log.get('inspect')
4
4
  };
@@ -11,66 +11,54 @@ export async function loadSpectorJS(props) {
11
11
  try {
12
12
  await loadScript(SPECTOR_CDN_URL);
13
13
  } catch (error) {
14
- log.warn(error);
14
+ log.warn(String(error));
15
15
  }
16
16
  }
17
17
  }
18
18
  export function initializeSpectorJS(props) {
19
19
  var _props, _props2;
20
-
21
- props = { ...DEFAULT_SPECTOR_PROPS,
20
+ props = {
21
+ ...DEFAULT_SPECTOR_PROPS,
22
22
  ...props
23
23
  };
24
-
25
24
  if (!((_props = props) !== null && _props !== void 0 && _props.spector)) {
26
25
  return null;
27
26
  }
28
-
29
27
  if (!spector && globalThis.SPECTOR) {
30
- log.probe(LOG_LEVEL, "SPECTOR found and initialized")();
28
+ log.probe(LOG_LEVEL, 'SPECTOR found and initialized')();
31
29
  spector = new globalThis.SPECTOR.Spector();
32
-
33
30
  if (globalThis.luma) {
34
31
  globalThis.luma.spector = spector;
35
32
  }
36
33
  }
37
-
38
34
  if (!spector) {
39
35
  return null;
40
36
  }
41
-
42
37
  if (!initialized) {
43
38
  var _spector, _spector2;
44
-
45
39
  initialized = true;
46
40
  spector.spyCanvases();
47
- (_spector = spector) === null || _spector === void 0 ? void 0 : _spector.onCaptureStarted.add(capture => log.info("Spector capture started:", capture)());
41
+ (_spector = spector) === null || _spector === void 0 ? void 0 : _spector.onCaptureStarted.add(capture => log.info('Spector capture started:', capture)());
48
42
  (_spector2 = spector) === null || _spector2 === void 0 ? void 0 : _spector2.onCapture.add(capture => {
49
43
  var _spector3, _spector4, _spector5;
50
-
51
- log.info("Spector capture complete:", capture)();
44
+ log.info('Spector capture complete:', capture)();
52
45
  (_spector3 = spector) === null || _spector3 === void 0 ? void 0 : _spector3.getResultUI();
53
46
  (_spector4 = spector) === null || _spector4 === void 0 ? void 0 : _spector4.resultView.display();
54
47
  (_spector5 = spector) === null || _spector5 === void 0 ? void 0 : _spector5.resultView.addCapture(capture);
55
48
  });
56
49
  }
57
-
58
50
  if ((_props2 = props) !== null && _props2 !== void 0 && _props2.canvas) {
59
51
  var _spector6, _props3;
60
-
61
52
  if (typeof props.spector === 'string' && props.spector !== props.canvas.id) {
62
53
  return spector;
63
54
  }
64
-
65
55
  (_spector6 = spector) === null || _spector6 === void 0 ? void 0 : _spector6.startCapture((_props3 = props) === null || _props3 === void 0 ? void 0 : _props3.canvas, 500);
66
56
  new Promise(resolve => setTimeout(resolve, 2000)).then(_ => {
67
57
  var _spector7;
68
-
69
- log.info("Spector capture stopped after 2 seconds")();
58
+ log.info('Spector capture stopped after 2 seconds')();
70
59
  (_spector7 = spector) === null || _spector7 === void 0 ? void 0 : _spector7.stopCapture();
71
60
  });
72
61
  }
73
-
74
62
  return spector;
75
63
  }
76
64
  //# sourceMappingURL=spector.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/context/debug/spector.ts"],"names":["log","loadScript","DEFAULT_SPECTOR_PROPS","spector","get","SPECTOR_CDN_URL","LOG_LEVEL","initialized","loadSpectorJS","props","globalThis","SPECTOR","error","warn","initializeSpectorJS","probe","Spector","luma","spyCanvases","onCaptureStarted","add","capture","info","onCapture","getResultUI","resultView","display","addCapture","canvas","id","startCapture","Promise","resolve","setTimeout","then","_","stopCapture"],"mappings":"AACA,SAAQA,GAAR,EAAaC,UAAb,QAA8B,cAA9B;AAYA,MAAMC,qBAAmC,GAAG;AAC1CC,EAAAA,OAAO,EAAEH,GAAG,CAACI,GAAJ,CAAQ,SAAR,KAAsBJ,GAAG,CAACI,GAAJ,CAAQ,SAAR;AADW,CAA5C;AAKA,MAAMC,eAAe,GAAG,oDAAxB;AACA,MAAMC,SAAS,GAAG,CAAlB;AAEA,IAAIH,OAAY,GAAG,IAAnB;AACA,IAAII,WAAoB,GAAG,KAA3B;AAOA,OAAO,eAAeC,aAAf,CAA6BC,KAA7B,EAAmD;AACxD,MAAI,CAACC,UAAU,CAACC,OAAhB,EAAyB;AACvB,QAAI;AACF,YAAMV,UAAU,CAACI,eAAD,CAAhB;AACD,KAFD,CAEE,OAAMO,KAAN,EAAa;AACbZ,MAAAA,GAAG,CAACa,IAAJ,CAASD,KAAT;AACD;AACF;AACF;AAED,OAAO,SAASE,mBAAT,CAA6BL,KAA7B,EAAmD;AAAA;;AACxDA,EAAAA,KAAK,GAAG,EAAC,GAAGP,qBAAJ;AAA2B,OAAGO;AAA9B,GAAR;;AACA,MAAI,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T,YAAsBrB,KAAtB,4CAAsB,QAAOmB,MAA7B,EAAqC,GAArC;AACA,QAAIG,OAAJ,CAAYC,OAAO,IAAIC,UAAU,CAACD,OAAD,EAAU,IAAV,CAAjC,EAAkDE,IAAlD,CAAuDC,CAAC,IAAI;AAAA;;AAC1DnC,MAAAA,GAAG,CAACsB,IAAJ;AACA,mBAAAnB,OAAO,UAAP,8CAASiC,WAAT;AAED,KAJD;AAKD;;AAED,SAAOjC,OAAP;AACD","sourcesContent":["// luma.gl, MIT license\nimport {log, loadScript} from '@luma.gl/api';\n\n/** Spector debug initialization options */\ntype SpectorProps = {\n /** Canvas to monitor */\n canvas?: HTMLCanvasElement | OffscreenCanvas;\n /** Whether debug is enabled. Auto-detected if ommitted */\n debug?: boolean;\n /** Whether spector is disabled */\n spector?: boolean | string | object;\n};\n\nconst DEFAULT_SPECTOR_PROPS: SpectorProps = {\n spector: log.get('spector') || log.get('inspect')\n};\n\n// https://github.com/BabylonJS/Spector.js#basic-usage\nconst SPECTOR_CDN_URL = 'https://spectorcdn.babylonjs.com/spector.bundle.js';\nconst LOG_LEVEL = 1;\n\nlet spector: any = null;\nlet initialized: boolean = false;\n\ndeclare global {\n var SPECTOR: any;\n}\n\n/** Loads spector from CDN if not already installed */\nexport async function loadSpectorJS(props?: SpectorProps) {\n if (!globalThis.SPECTOR) {\n try {\n await loadScript(SPECTOR_CDN_URL);\n } catch(error) {\n log.warn(error)\n }\n }\n}\n\nexport function initializeSpectorJS(props?: SpectorProps) {\n props = {...DEFAULT_SPECTOR_PROPS, ...props};\n if (!props?.spector) {\n return null;\n }\n\n if (!spector && globalThis.SPECTOR) {\n log.probe(LOG_LEVEL, \"SPECTOR found and initialized\")();\n spector = new globalThis.SPECTOR.Spector();\n if (globalThis.luma) {\n globalThis.luma.spector = spector;\n }\n }\n\n if (!spector) {\n return null;\n }\n\n if (!initialized) {\n initialized = true;\n\n // enables recording some extra information merged in the capture like texture memory sizes and formats\n spector.spyCanvases();\n // A callback when results are ready\n spector?.onCaptureStarted.add((capture: unknown) => log.info(`Spector capture started:`, capture)());\n spector?.onCapture.add((capture: unknown) => {\n log.info(`Spector capture complete:`, capture)();\n // Use undocumented Spector API to open the UI with our capture\n // See https://github.com/BabylonJS/Spector.js/blob/767ad1195a25b85a85c381f400eb50a979239eca/src/spector.ts#L124\n spector?.getResultUI()\n spector?.resultView.display();\n spector?.resultView.addCapture(capture)\n });\n }\n\n if (props?.canvas) {\n // @ts-expect-error If spector is specified as a canvas id, only monitor that canvas\n if (typeof props.spector === 'string' && props.spector !== props.canvas.id) {\n return spector;\n }\n\n // capture startup\n // spector?.captureCanvas(props?.canvas);\n spector?.startCapture(props?.canvas, 500); // 500 commands\n new Promise(resolve => setTimeout(resolve, 2000)).then(_ => {\n log.info(`Spector capture stopped after 2 seconds`)();\n spector?.stopCapture();\n // spector?.displayUI();\n });\n }\n\n return spector;\n}\n"],"file":"spector.js"}
1
+ {"version":3,"file":"spector.js","names":["log","loadScript","DEFAULT_SPECTOR_PROPS","spector","get","SPECTOR_CDN_URL","LOG_LEVEL","initialized","loadSpectorJS","props","globalThis","SPECTOR","error","warn","String","initializeSpectorJS","_props","_props2","probe","Spector","luma","_spector","_spector2","spyCanvases","onCaptureStarted","add","capture","info","onCapture","_spector3","_spector4","_spector5","getResultUI","resultView","display","addCapture","canvas","_spector6","_props3","id","startCapture","Promise","resolve","setTimeout","then","_","_spector7","stopCapture"],"sources":["../../../src/context/debug/spector.ts"],"sourcesContent":["// luma.gl, MIT license\n// Copyright (c) vis.gl contributors\n\nimport {log, loadScript} from '@luma.gl/core';\n\n/** Spector debug initialization options */\ntype SpectorProps = {\n /** Canvas to monitor */\n canvas?: HTMLCanvasElement | OffscreenCanvas;\n /** Whether debug is enabled. Auto-detected if ommitted */\n debug?: boolean;\n /** Whether spector is disabled */\n spector?: boolean | string | object;\n};\n\nconst DEFAULT_SPECTOR_PROPS: SpectorProps = {\n spector: log.get('spector') || log.get('inspect')\n};\n\n// https://github.com/BabylonJS/Spector.js#basic-usage\nconst SPECTOR_CDN_URL = 'https://spectorcdn.babylonjs.com/spector.bundle.js';\nconst LOG_LEVEL = 1;\n\nlet spector: any = null;\nlet initialized: boolean = false;\n\ndeclare global {\n // eslint-disable-next-line no-var\n var SPECTOR: any;\n}\n\n/** Loads spector from CDN if not already installed */\nexport async function loadSpectorJS(props?: SpectorProps) {\n if (!globalThis.SPECTOR) {\n try {\n await loadScript(SPECTOR_CDN_URL);\n } catch(error) {\n log.warn(String(error))\n }\n }\n}\n\nexport function initializeSpectorJS(props?: SpectorProps) {\n props = {...DEFAULT_SPECTOR_PROPS, ...props};\n if (!props?.spector) {\n return null;\n }\n\n if (!spector && globalThis.SPECTOR) {\n log.probe(LOG_LEVEL, 'SPECTOR found and initialized')();\n spector = new globalThis.SPECTOR.Spector();\n if (globalThis.luma) {\n globalThis.luma.spector = spector;\n }\n }\n\n if (!spector) {\n return null;\n }\n\n if (!initialized) {\n initialized = true;\n\n // enables recording some extra information merged in the capture like texture memory sizes and formats\n spector.spyCanvases();\n // A callback when results are ready\n spector?.onCaptureStarted.add((capture: unknown) => log.info('Spector capture started:', capture)());\n spector?.onCapture.add((capture: unknown) => {\n log.info('Spector capture complete:', capture)();\n // Use undocumented Spector API to open the UI with our capture\n // See https://github.com/BabylonJS/Spector.js/blob/767ad1195a25b85a85c381f400eb50a979239eca/src/spector.ts#L124\n spector?.getResultUI()\n spector?.resultView.display();\n spector?.resultView.addCapture(capture)\n });\n }\n\n if (props?.canvas) {\n // @ts-expect-error If spector is specified as a canvas id, only monitor that canvas\n if (typeof props.spector === 'string' && props.spector !== props.canvas.id) {\n return spector;\n }\n\n // capture startup\n // spector?.captureCanvas(props?.canvas);\n spector?.startCapture(props?.canvas, 500); // 500 commands\n new Promise(resolve => setTimeout(resolve, 2000)).then(_ => {\n log.info('Spector capture stopped after 2 seconds')();\n spector?.stopCapture();\n // spector?.displayUI();\n });\n }\n\n return spector;\n}\n"],"mappings":"AAGA,SAAQA,GAAG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