@luma.gl/webgl 9.0.0-alpha.16 → 9.0.0-alpha.19

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 (417) hide show
  1. package/dist/adapter/converters/device-parameters.d.ts.map +1 -1
  2. package/dist/adapter/converters/device-parameters.js +117 -200
  3. package/dist/adapter/converters/device-parameters.js.map +1 -0
  4. package/dist/adapter/converters/renderbuffer-formats.d.ts +1 -1
  5. package/dist/adapter/converters/renderbuffer-formats.d.ts.map +1 -1
  6. package/dist/adapter/converters/renderbuffer-formats.js +172 -62
  7. package/dist/adapter/converters/renderbuffer-formats.js.map +1 -0
  8. package/dist/adapter/converters/sampler-parameters.d.ts.map +1 -1
  9. package/dist/adapter/converters/sampler-parameters.js +151 -149
  10. package/dist/adapter/converters/sampler-parameters.js.map +1 -0
  11. package/dist/adapter/converters/texture-formats.d.ts +2 -2
  12. package/dist/adapter/converters/texture-formats.d.ts.map +1 -1
  13. package/dist/adapter/converters/texture-formats.js +847 -438
  14. package/dist/adapter/converters/texture-formats.js.map +1 -0
  15. package/dist/adapter/converters/vertex-formats.js +24 -15
  16. package/dist/adapter/converters/vertex-formats.js.map +1 -0
  17. package/dist/adapter/device-helpers/device-features.js +84 -120
  18. package/dist/adapter/device-helpers/device-features.js.map +1 -0
  19. package/dist/adapter/device-helpers/device-limits.d.ts +1 -1
  20. package/dist/adapter/device-helpers/device-limits.d.ts.map +1 -1
  21. package/dist/adapter/device-helpers/device-limits.js +83 -88
  22. package/dist/adapter/device-helpers/device-limits.js.map +1 -0
  23. package/dist/adapter/device-helpers/get-device-info.js +37 -42
  24. package/dist/adapter/device-helpers/get-device-info.js.map +1 -0
  25. package/dist/adapter/device-helpers/is-old-ie.js +8 -10
  26. package/dist/adapter/device-helpers/is-old-ie.js.map +1 -0
  27. package/dist/adapter/helpers/attribute-utils.js +57 -50
  28. package/dist/adapter/helpers/attribute-utils.js.map +1 -0
  29. package/dist/adapter/helpers/get-shader-info.d.ts +1 -1
  30. package/dist/adapter/helpers/get-shader-info.d.ts.map +1 -1
  31. package/dist/adapter/helpers/get-shader-info.js +19 -21
  32. package/dist/adapter/helpers/get-shader-info.js.map +1 -0
  33. package/dist/adapter/helpers/get-shader-layout.js +251 -310
  34. package/dist/adapter/helpers/get-shader-layout.js.map +1 -0
  35. package/dist/adapter/helpers/parse-shader-compiler-log.js +26 -32
  36. package/dist/adapter/helpers/parse-shader-compiler-log.js.map +1 -0
  37. package/dist/adapter/helpers/set-uniform.d.ts.map +1 -1
  38. package/dist/adapter/helpers/set-uniform.js +80 -67
  39. package/dist/adapter/helpers/set-uniform.js.map +1 -0
  40. package/dist/adapter/helpers/uniforms.js +75 -80
  41. package/dist/adapter/helpers/uniforms.js.map +1 -0
  42. package/dist/adapter/objects/constants-to-keys.js +26 -33
  43. package/dist/adapter/objects/constants-to-keys.js.map +1 -0
  44. package/dist/adapter/objects/webgl-renderbuffer.d.ts +1 -1
  45. package/dist/adapter/objects/webgl-renderbuffer.d.ts.map +1 -1
  46. package/dist/adapter/objects/webgl-renderbuffer.js +70 -67
  47. package/dist/adapter/objects/webgl-renderbuffer.js.map +1 -0
  48. package/dist/adapter/objects/webgl-resource.d.ts.map +1 -1
  49. package/dist/adapter/objects/webgl-resource.js +158 -213
  50. package/dist/adapter/objects/webgl-resource.js.map +1 -0
  51. package/dist/adapter/objects/webgl-vertex-array-object.d.ts +1 -1
  52. package/dist/adapter/objects/webgl-vertex-array-object.d.ts.map +1 -1
  53. package/dist/adapter/objects/webgl-vertex-array-object.js +66 -74
  54. package/dist/adapter/objects/webgl-vertex-array-object.js.map +1 -0
  55. package/dist/adapter/resources/webgl-buffer.d.ts.map +1 -1
  56. package/dist/adapter/resources/webgl-buffer.js +118 -150
  57. package/dist/adapter/resources/webgl-buffer.js.map +1 -0
  58. package/dist/adapter/resources/webgl-command-buffer.d.ts +5 -5
  59. package/dist/adapter/resources/webgl-command-buffer.d.ts.map +1 -1
  60. package/dist/adapter/resources/webgl-command-buffer.js +41 -40
  61. package/dist/adapter/resources/webgl-command-buffer.js.map +1 -0
  62. package/dist/adapter/resources/webgl-command-encoder.js +37 -26
  63. package/dist/adapter/resources/webgl-command-encoder.js.map +1 -0
  64. package/dist/adapter/resources/webgl-external-texture.js +1 -91
  65. package/dist/adapter/resources/webgl-external-texture.js.map +1 -0
  66. package/dist/adapter/resources/webgl-framebuffer.d.ts +2 -2
  67. package/dist/adapter/resources/webgl-framebuffer.d.ts.map +1 -1
  68. package/dist/adapter/resources/webgl-framebuffer.js +198 -231
  69. package/dist/adapter/resources/webgl-framebuffer.js.map +1 -0
  70. package/dist/adapter/resources/webgl-render-pass.js +11 -8
  71. package/dist/adapter/resources/webgl-render-pass.js.map +1 -0
  72. package/dist/adapter/resources/webgl-render-pipeline.d.ts.map +1 -1
  73. package/dist/adapter/resources/webgl-render-pipeline.js +289 -316
  74. package/dist/adapter/resources/webgl-render-pipeline.js.map +1 -0
  75. package/dist/adapter/resources/webgl-sampler.js +35 -42
  76. package/dist/adapter/resources/webgl-sampler.js.map +1 -0
  77. package/dist/adapter/resources/webgl-shader.d.ts.map +1 -1
  78. package/dist/adapter/resources/webgl-shader.js +53 -57
  79. package/dist/adapter/resources/webgl-shader.js.map +1 -0
  80. package/dist/adapter/resources/webgl-texture.d.ts +4 -4
  81. package/dist/adapter/resources/webgl-texture.d.ts.map +1 -1
  82. package/dist/adapter/resources/webgl-texture.js +697 -661
  83. package/dist/adapter/resources/webgl-texture.js.map +1 -0
  84. package/dist/adapter/webgl-canvas-context.d.ts.map +1 -1
  85. package/dist/adapter/webgl-canvas-context.js +35 -55
  86. package/dist/adapter/webgl-canvas-context.js.map +1 -0
  87. package/dist/adapter/webgl-device.d.ts +5 -0
  88. package/dist/adapter/webgl-device.d.ts.map +1 -1
  89. package/dist/adapter/webgl-device.js +270 -287
  90. package/dist/adapter/webgl-device.js.map +1 -0
  91. package/dist/classic/accessor.js +103 -120
  92. package/dist/classic/accessor.js.map +1 -0
  93. package/dist/classic/buffer.d.ts +1 -1
  94. package/dist/classic/buffer.d.ts.map +1 -1
  95. package/dist/classic/buffer.js +300 -325
  96. package/dist/classic/buffer.js.map +1 -0
  97. package/dist/classic/typed-array-utils.d.ts +1 -1
  98. package/dist/classic/typed-array-utils.d.ts.map +1 -1
  99. package/dist/classic/typed-array-utils.js +81 -91
  100. package/dist/classic/typed-array-utils.js.map +1 -0
  101. package/dist/context/context/create-browser-context.d.ts +3 -1
  102. package/dist/context/context/create-browser-context.d.ts.map +1 -1
  103. package/dist/context/context/create-browser-context.js +49 -66
  104. package/dist/context/context/create-browser-context.js.map +1 -0
  105. package/dist/context/context/create-headless-context.d.ts +1 -1
  106. package/dist/context/context/create-headless-context.d.ts.map +1 -1
  107. package/dist/context/context/create-headless-context.js +30 -24
  108. package/dist/context/context/create-headless-context.js.map +1 -0
  109. package/dist/context/context/webgl-checks.js +17 -25
  110. package/dist/context/context/webgl-checks.js.map +1 -0
  111. package/dist/context/debug/spector.d.ts +3 -1
  112. package/dist/context/debug/spector.d.ts.map +1 -1
  113. package/dist/context/debug/spector.js +50 -53
  114. package/dist/context/debug/spector.js.map +1 -0
  115. package/dist/context/debug/webgl-developer-tools.d.ts +1 -1
  116. package/dist/context/debug/webgl-developer-tools.d.ts.map +1 -1
  117. package/dist/context/debug/webgl-developer-tools.js +76 -107
  118. package/dist/context/debug/webgl-developer-tools.js.map +1 -0
  119. package/dist/context/parameters/unified-parameter-api.js +46 -93
  120. package/dist/context/parameters/unified-parameter-api.js.map +1 -0
  121. package/dist/context/parameters/webgl-parameter-tables.d.ts +1 -1
  122. package/dist/context/parameters/webgl-parameter-tables.d.ts.map +1 -1
  123. package/dist/context/parameters/webgl-parameter-tables.js +404 -462
  124. package/dist/context/parameters/webgl-parameter-tables.js.map +1 -0
  125. package/dist/context/polyfill/context-data.js +10 -16
  126. package/dist/context/polyfill/context-data.js.map +1 -0
  127. package/dist/context/polyfill/get-parameter-polyfill.js +71 -91
  128. package/dist/context/polyfill/get-parameter-polyfill.js.map +1 -0
  129. package/dist/context/polyfill/polyfill-context.js +73 -75
  130. package/dist/context/polyfill/polyfill-context.js.map +1 -0
  131. package/dist/context/polyfill/polyfill-table.d.ts.map +1 -1
  132. package/dist/context/polyfill/polyfill-table.js +116 -133
  133. package/dist/context/polyfill/polyfill-table.js.map +1 -0
  134. package/dist/context/polyfill/polyfill-vertex-array-object.d.ts.map +1 -1
  135. package/dist/context/polyfill/polyfill-vertex-array-object.js +227 -255
  136. package/dist/context/polyfill/polyfill-vertex-array-object.js.map +1 -0
  137. package/dist/context/state-tracker/deep-array-equal.js +14 -16
  138. package/dist/context/state-tracker/deep-array-equal.js.map +1 -0
  139. package/dist/context/state-tracker/track-context-state.d.ts.map +1 -1
  140. package/dist/context/state-tracker/track-context-state.js +127 -183
  141. package/dist/context/state-tracker/track-context-state.js.map +1 -0
  142. package/dist/context/state-tracker/with-parameters.d.ts.map +1 -1
  143. package/dist/context/state-tracker/with-parameters.js +29 -43
  144. package/dist/context/state-tracker/with-parameters.js.map +1 -0
  145. package/dist/dist.dev.js +9205 -0
  146. package/dist/index.cjs +5948 -0
  147. package/dist/index.d.ts +0 -2
  148. package/dist/index.d.ts.map +1 -1
  149. package/dist/index.js +25 -41
  150. package/dist/index.js.map +1 -0
  151. package/dist/types/webgl.d.ts +16 -16
  152. package/dist/types/webgl.d.ts.map +1 -1
  153. package/dist/types/webgl.js +1 -0
  154. package/dist/types/webgl.js.map +1 -0
  155. package/dist/types.d.ts +1 -1
  156. package/dist/types.d.ts.map +1 -1
  157. package/dist/types.js +1 -0
  158. package/dist/types.js.map +1 -0
  159. package/dist.min.js +36 -0
  160. package/package.json +18 -9
  161. package/src/adapter/converters/device-parameters.ts +5 -2
  162. package/src/adapter/converters/sampler-parameters.ts +4 -2
  163. package/src/adapter/converters/texture-formats.ts +3 -1
  164. package/src/adapter/device-helpers/get-device-info.ts +8 -8
  165. package/src/adapter/helpers/get-shader-info.ts +1 -1
  166. package/src/adapter/helpers/get-shader-layout.ts +4 -4
  167. package/src/adapter/helpers/parse-shader-compiler-log.ts +1 -1
  168. package/src/adapter/helpers/set-uniform.ts +2 -0
  169. package/src/adapter/objects/webgl-renderbuffer.ts +1 -1
  170. package/src/adapter/objects/webgl-resource.ts +1 -1
  171. package/src/adapter/objects/webgl-vertex-array-object.ts +1 -1
  172. package/src/adapter/resources/webgl-buffer.ts +6 -6
  173. package/src/adapter/resources/webgl-command-encoder.ts +1 -1
  174. package/src/adapter/resources/webgl-framebuffer.ts +3 -4
  175. package/src/adapter/resources/webgl-render-pipeline.ts +19 -20
  176. package/src/adapter/resources/webgl-shader.ts +1 -1
  177. package/src/adapter/resources/webgl-texture.ts +8 -9
  178. package/src/adapter/webgl-canvas-context.ts +2 -2
  179. package/src/adapter/webgl-device.ts +12 -2
  180. package/src/classic/accessor.ts +1 -1
  181. package/src/classic/buffer.ts +3 -3
  182. package/src/classic/typed-array-utils.ts +1 -1
  183. package/src/context/context/create-browser-context.ts +4 -2
  184. package/src/context/context/create-headless-context.ts +2 -2
  185. package/src/context/debug/spector.ts +5 -4
  186. package/src/context/debug/webgl-developer-tools.ts +1 -0
  187. package/src/context/polyfill/polyfill-table.ts +1 -0
  188. package/src/context/polyfill/polyfill-vertex-array-object.ts +2 -0
  189. package/src/context/state-tracker/track-context-state.ts +6 -5
  190. package/src/context/state-tracker/with-parameters.ts +1 -1
  191. package/src/index.ts +1 -5
  192. package/src/types/webgl.ts +2 -0
  193. package/dist/bundle.d.ts +0 -2
  194. package/dist/bundle.d.ts.map +0 -1
  195. package/dist/bundle.js +0 -4
  196. package/dist/dist.min.js +0 -1
  197. package/dist/es5/adapter/converters/device-parameters.js +0 -139
  198. package/dist/es5/adapter/converters/device-parameters.js.map +0 -1
  199. package/dist/es5/adapter/converters/renderbuffer-formats.js +0 -151
  200. package/dist/es5/adapter/converters/renderbuffer-formats.js.map +0 -1
  201. package/dist/es5/adapter/converters/sampler-parameters.js +0 -182
  202. package/dist/es5/adapter/converters/sampler-parameters.js.map +0 -1
  203. package/dist/es5/adapter/converters/texture-formats.js +0 -950
  204. package/dist/es5/adapter/converters/texture-formats.js.map +0 -1
  205. package/dist/es5/adapter/converters/vertex-formats.js +0 -36
  206. package/dist/es5/adapter/converters/vertex-formats.js.map +0 -1
  207. package/dist/es5/adapter/device-helpers/device-features.js +0 -121
  208. package/dist/es5/adapter/device-helpers/device-features.js.map +0 -1
  209. package/dist/es5/adapter/device-helpers/device-limits.js +0 -54
  210. package/dist/es5/adapter/device-helpers/device-limits.js.map +0 -1
  211. package/dist/es5/adapter/device-helpers/get-device-info.js +0 -49
  212. package/dist/es5/adapter/device-helpers/get-device-info.js.map +0 -1
  213. package/dist/es5/adapter/device-helpers/is-old-ie.js +0 -15
  214. package/dist/es5/adapter/device-helpers/is-old-ie.js.map +0 -1
  215. package/dist/es5/adapter/helpers/attribute-utils.js +0 -69
  216. package/dist/es5/adapter/helpers/attribute-utils.js.map +0 -1
  217. package/dist/es5/adapter/helpers/get-shader-info.js +0 -31
  218. package/dist/es5/adapter/helpers/get-shader-info.js.map +0 -1
  219. package/dist/es5/adapter/helpers/get-shader-layout.js +0 -311
  220. package/dist/es5/adapter/helpers/get-shader-layout.js.map +0 -1
  221. package/dist/es5/adapter/helpers/parse-shader-compiler-log.js +0 -54
  222. package/dist/es5/adapter/helpers/parse-shader-compiler-log.js.map +0 -1
  223. package/dist/es5/adapter/helpers/set-uniform.js +0 -92
  224. package/dist/es5/adapter/helpers/set-uniform.js.map +0 -1
  225. package/dist/es5/adapter/helpers/uniforms.js +0 -88
  226. package/dist/es5/adapter/helpers/uniforms.js.map +0 -1
  227. package/dist/es5/adapter/objects/constants-to-keys.js +0 -43
  228. package/dist/es5/adapter/objects/constants-to-keys.js.map +0 -1
  229. package/dist/es5/adapter/objects/webgl-renderbuffer.js +0 -122
  230. package/dist/es5/adapter/objects/webgl-renderbuffer.js.map +0 -1
  231. package/dist/es5/adapter/objects/webgl-resource.js +0 -233
  232. package/dist/es5/adapter/objects/webgl-resource.js.map +0 -1
  233. package/dist/es5/adapter/objects/webgl-vertex-array-object.js +0 -109
  234. package/dist/es5/adapter/objects/webgl-vertex-array-object.js.map +0 -1
  235. package/dist/es5/adapter/resources/webgl-buffer.js +0 -196
  236. package/dist/es5/adapter/resources/webgl-buffer.js.map +0 -1
  237. package/dist/es5/adapter/resources/webgl-command-buffer.js +0 -70
  238. package/dist/es5/adapter/resources/webgl-command-buffer.js.map +0 -1
  239. package/dist/es5/adapter/resources/webgl-command-encoder.js +0 -80
  240. package/dist/es5/adapter/resources/webgl-command-encoder.js.map +0 -1
  241. package/dist/es5/adapter/resources/webgl-external-texture.js +0 -2
  242. package/dist/es5/adapter/resources/webgl-external-texture.js.map +0 -1
  243. package/dist/es5/adapter/resources/webgl-framebuffer.js +0 -275
  244. package/dist/es5/adapter/resources/webgl-framebuffer.js.map +0 -1
  245. package/dist/es5/adapter/resources/webgl-render-pass.js +0 -45
  246. package/dist/es5/adapter/resources/webgl-render-pass.js.map +0 -1
  247. package/dist/es5/adapter/resources/webgl-render-pipeline.js +0 -385
  248. package/dist/es5/adapter/resources/webgl-render-pipeline.js.map +0 -1
  249. package/dist/es5/adapter/resources/webgl-sampler.js +0 -75
  250. package/dist/es5/adapter/resources/webgl-sampler.js.map +0 -1
  251. package/dist/es5/adapter/resources/webgl-shader.js +0 -111
  252. package/dist/es5/adapter/resources/webgl-shader.js.map +0 -1
  253. package/dist/es5/adapter/resources/webgl-texture.js +0 -826
  254. package/dist/es5/adapter/resources/webgl-texture.js.map +0 -1
  255. package/dist/es5/adapter/webgl-canvas-context.js +0 -72
  256. package/dist/es5/adapter/webgl-canvas-context.js.map +0 -1
  257. package/dist/es5/adapter/webgl-device.js +0 -387
  258. package/dist/es5/adapter/webgl-device.js.map +0 -1
  259. package/dist/es5/bundle.js +0 -6
  260. package/dist/es5/bundle.js.map +0 -1
  261. package/dist/es5/classic/accessor.js +0 -151
  262. package/dist/es5/classic/accessor.js.map +0 -1
  263. package/dist/es5/classic/buffer.js +0 -398
  264. package/dist/es5/classic/buffer.js.map +0 -1
  265. package/dist/es5/classic/typed-array-utils.js +0 -99
  266. package/dist/es5/classic/typed-array-utils.js.map +0 -1
  267. package/dist/es5/context/context/create-browser-context.js +0 -66
  268. package/dist/es5/context/context/create-browser-context.js.map +0 -1
  269. package/dist/es5/context/context/create-headless-context.js +0 -47
  270. package/dist/es5/context/context/create-headless-context.js.map +0 -1
  271. package/dist/es5/context/context/webgl-checks.js +0 -44
  272. package/dist/es5/context/context/webgl-checks.js.map +0 -1
  273. package/dist/es5/context/debug/spector.js +0 -99
  274. package/dist/es5/context/debug/spector.js.map +0 -1
  275. package/dist/es5/context/debug/webgl-developer-tools.js +0 -146
  276. package/dist/es5/context/debug/webgl-developer-tools.js.map +0 -1
  277. package/dist/es5/context/parameters/unified-parameter-api.js +0 -76
  278. package/dist/es5/context/parameters/unified-parameter-api.js.map +0 -1
  279. package/dist/es5/context/parameters/webgl-parameter-tables.js +0 -346
  280. package/dist/es5/context/parameters/webgl-parameter-tables.js.map +0 -1
  281. package/dist/es5/context/polyfill/context-data.js +0 -18
  282. package/dist/es5/context/polyfill/context-data.js.map +0 -1
  283. package/dist/es5/context/polyfill/get-parameter-polyfill.js +0 -69
  284. package/dist/es5/context/polyfill/get-parameter-polyfill.js.map +0 -1
  285. package/dist/es5/context/polyfill/polyfill-context.js +0 -109
  286. package/dist/es5/context/polyfill/polyfill-context.js.map +0 -1
  287. package/dist/es5/context/polyfill/polyfill-table.js +0 -143
  288. package/dist/es5/context/polyfill/polyfill-table.js.map +0 -1
  289. package/dist/es5/context/polyfill/polyfill-vertex-array-object.js +0 -271
  290. package/dist/es5/context/polyfill/polyfill-vertex-array-object.js.map +0 -1
  291. package/dist/es5/context/state-tracker/deep-array-equal.js +0 -23
  292. package/dist/es5/context/state-tracker/deep-array-equal.js.map +0 -1
  293. package/dist/es5/context/state-tracker/track-context-state.js +0 -167
  294. package/dist/es5/context/state-tracker/track-context-state.js.map +0 -1
  295. package/dist/es5/context/state-tracker/with-parameters.js +0 -40
  296. package/dist/es5/context/state-tracker/with-parameters.js.map +0 -1
  297. package/dist/es5/index.js +0 -249
  298. package/dist/es5/index.js.map +0 -1
  299. package/dist/es5/init.js +0 -7
  300. package/dist/es5/init.js.map +0 -1
  301. package/dist/es5/types/webgl.js +0 -5
  302. package/dist/es5/types/webgl.js.map +0 -1
  303. package/dist/es5/types.js +0 -2
  304. package/dist/es5/types.js.map +0 -1
  305. package/dist/esm/adapter/converters/device-parameters.js +0 -137
  306. package/dist/esm/adapter/converters/device-parameters.js.map +0 -1
  307. package/dist/esm/adapter/converters/renderbuffer-formats.js +0 -181
  308. package/dist/esm/adapter/converters/renderbuffer-formats.js.map +0 -1
  309. package/dist/esm/adapter/converters/sampler-parameters.js +0 -172
  310. package/dist/esm/adapter/converters/sampler-parameters.js.map +0 -1
  311. package/dist/esm/adapter/converters/texture-formats.js +0 -901
  312. package/dist/esm/adapter/converters/texture-formats.js.map +0 -1
  313. package/dist/esm/adapter/converters/vertex-formats.js +0 -29
  314. package/dist/esm/adapter/converters/vertex-formats.js.map +0 -1
  315. package/dist/esm/adapter/device-helpers/device-features.js +0 -95
  316. package/dist/esm/adapter/device-helpers/device-features.js.map +0 -1
  317. package/dist/esm/adapter/device-helpers/device-limits.js +0 -88
  318. package/dist/esm/adapter/device-helpers/device-limits.js.map +0 -1
  319. package/dist/esm/adapter/device-helpers/get-device-info.js +0 -42
  320. package/dist/esm/adapter/device-helpers/get-device-info.js.map +0 -1
  321. package/dist/esm/adapter/device-helpers/is-old-ie.js +0 -9
  322. package/dist/esm/adapter/device-helpers/is-old-ie.js.map +0 -1
  323. package/dist/esm/adapter/helpers/attribute-utils.js +0 -64
  324. package/dist/esm/adapter/helpers/attribute-utils.js.map +0 -1
  325. package/dist/esm/adapter/helpers/get-shader-info.js +0 -25
  326. package/dist/esm/adapter/helpers/get-shader-info.js.map +0 -1
  327. package/dist/esm/adapter/helpers/get-shader-layout.js +0 -282
  328. package/dist/esm/adapter/helpers/get-shader-layout.js.map +0 -1
  329. package/dist/esm/adapter/helpers/parse-shader-compiler-log.js +0 -30
  330. package/dist/esm/adapter/helpers/parse-shader-compiler-log.js.map +0 -1
  331. package/dist/esm/adapter/helpers/set-uniform.js +0 -85
  332. package/dist/esm/adapter/helpers/set-uniform.js.map +0 -1
  333. package/dist/esm/adapter/helpers/uniforms.js +0 -89
  334. package/dist/esm/adapter/helpers/uniforms.js.map +0 -1
  335. package/dist/esm/adapter/objects/constants-to-keys.js +0 -35
  336. package/dist/esm/adapter/objects/constants-to-keys.js.map +0 -1
  337. package/dist/esm/adapter/objects/webgl-renderbuffer.js +0 -78
  338. package/dist/esm/adapter/objects/webgl-renderbuffer.js.map +0 -1
  339. package/dist/esm/adapter/objects/webgl-resource.js +0 -163
  340. package/dist/esm/adapter/objects/webgl-resource.js.map +0 -1
  341. package/dist/esm/adapter/objects/webgl-vertex-array-object.js +0 -74
  342. package/dist/esm/adapter/objects/webgl-vertex-array-object.js.map +0 -1
  343. package/dist/esm/adapter/resources/webgl-buffer.js +0 -134
  344. package/dist/esm/adapter/resources/webgl-buffer.js.map +0 -1
  345. package/dist/esm/adapter/resources/webgl-command-buffer.js +0 -50
  346. package/dist/esm/adapter/resources/webgl-command-buffer.js.map +0 -1
  347. package/dist/esm/adapter/resources/webgl-command-encoder.js +0 -41
  348. package/dist/esm/adapter/resources/webgl-command-encoder.js.map +0 -1
  349. package/dist/esm/adapter/resources/webgl-external-texture.js +0 -2
  350. package/dist/esm/adapter/resources/webgl-external-texture.js.map +0 -1
  351. package/dist/esm/adapter/resources/webgl-framebuffer.js +0 -207
  352. package/dist/esm/adapter/resources/webgl-framebuffer.js.map +0 -1
  353. package/dist/esm/adapter/resources/webgl-render-pass.js +0 -14
  354. package/dist/esm/adapter/resources/webgl-render-pass.js.map +0 -1
  355. package/dist/esm/adapter/resources/webgl-render-pipeline.js +0 -311
  356. package/dist/esm/adapter/resources/webgl-render-pipeline.js.map +0 -1
  357. package/dist/esm/adapter/resources/webgl-sampler.js +0 -42
  358. package/dist/esm/adapter/resources/webgl-sampler.js.map +0 -1
  359. package/dist/esm/adapter/resources/webgl-shader.js +0 -62
  360. package/dist/esm/adapter/resources/webgl-shader.js.map +0 -1
  361. package/dist/esm/adapter/resources/webgl-texture.js +0 -714
  362. package/dist/esm/adapter/resources/webgl-texture.js.map +0 -1
  363. package/dist/esm/adapter/webgl-canvas-context.js +0 -41
  364. package/dist/esm/adapter/webgl-canvas-context.js.map +0 -1
  365. package/dist/esm/adapter/webgl-device.js +0 -276
  366. package/dist/esm/adapter/webgl-device.js.map +0 -1
  367. package/dist/esm/bundle.js +0 -4
  368. package/dist/esm/bundle.js.map +0 -1
  369. package/dist/esm/classic/accessor.js +0 -120
  370. package/dist/esm/classic/accessor.js.map +0 -1
  371. package/dist/esm/classic/buffer.js +0 -327
  372. package/dist/esm/classic/buffer.js.map +0 -1
  373. package/dist/esm/classic/typed-array-utils.js +0 -92
  374. package/dist/esm/classic/typed-array-utils.js.map +0 -1
  375. package/dist/esm/context/context/create-browser-context.js +0 -53
  376. package/dist/esm/context/context/create-browser-context.js.map +0 -1
  377. package/dist/esm/context/context/create-headless-context.js +0 -39
  378. package/dist/esm/context/context/create-headless-context.js.map +0 -1
  379. package/dist/esm/context/context/webgl-checks.js +0 -31
  380. package/dist/esm/context/context/webgl-checks.js.map +0 -1
  381. package/dist/esm/context/debug/spector.js +0 -64
  382. package/dist/esm/context/debug/spector.js.map +0 -1
  383. package/dist/esm/context/debug/webgl-developer-tools.js +0 -97
  384. package/dist/esm/context/debug/webgl-developer-tools.js.map +0 -1
  385. package/dist/esm/context/parameters/unified-parameter-api.js +0 -55
  386. package/dist/esm/context/parameters/unified-parameter-api.js.map +0 -1
  387. package/dist/esm/context/parameters/webgl-parameter-tables.js +0 -427
  388. package/dist/esm/context/parameters/webgl-parameter-tables.js.map +0 -1
  389. package/dist/esm/context/polyfill/context-data.js +0 -12
  390. package/dist/esm/context/polyfill/context-data.js.map +0 -1
  391. package/dist/esm/context/polyfill/get-parameter-polyfill.js +0 -86
  392. package/dist/esm/context/polyfill/get-parameter-polyfill.js.map +0 -1
  393. package/dist/esm/context/polyfill/polyfill-context.js +0 -84
  394. package/dist/esm/context/polyfill/polyfill-context.js.map +0 -1
  395. package/dist/esm/context/polyfill/polyfill-table.js +0 -138
  396. package/dist/esm/context/polyfill/polyfill-table.js.map +0 -1
  397. package/dist/esm/context/polyfill/polyfill-vertex-array-object.js +0 -265
  398. package/dist/esm/context/polyfill/polyfill-vertex-array-object.js.map +0 -1
  399. package/dist/esm/context/state-tracker/deep-array-equal.js +0 -17
  400. package/dist/esm/context/state-tracker/deep-array-equal.js.map +0 -1
  401. package/dist/esm/context/state-tracker/track-context-state.js +0 -148
  402. package/dist/esm/context/state-tracker/track-context-state.js.map +0 -1
  403. package/dist/esm/context/state-tracker/with-parameters.js +0 -34
  404. package/dist/esm/context/state-tracker/with-parameters.js.map +0 -1
  405. package/dist/esm/index.js +0 -27
  406. package/dist/esm/index.js.map +0 -1
  407. package/dist/esm/init.js +0 -4
  408. package/dist/esm/init.js.map +0 -1
  409. package/dist/esm/types/webgl.js +0 -2
  410. package/dist/esm/types/webgl.js.map +0 -1
  411. package/dist/esm/types.js +0 -2
  412. package/dist/esm/types.js.map +0 -1
  413. package/dist/init.d.ts +0 -2
  414. package/dist/init.d.ts.map +0 -1
  415. package/dist/init.js +0 -3
  416. package/src/bundle.ts +0 -4
  417. package/src/init.ts +0 -4
@@ -0,0 +1 @@
1
+ {"version":3,"file":"buffer.js","names":["assert","checkProps","GL","assertWebGL2Context","Accessor","getGLTypeFromTypedArray","getTypedArrayFromGLType","WebGLDevice","WEBGLBuffer","DEBUG_DATA_LENGTH","DEPRECATED_PROPS","offset","stride","type","size","divisor","normalized","integer","instanced","isInstanced","PROP_CHECKS_INITIALIZE","removedProps","replacedProps","bytes","deprecatedProps","PROP_CHECKS_SET_PROPS","getWEBGLBufferProps","props","ArrayBuffer","isView","data","byteLength","bufferProps","byteOffset","ClassicBuffer","constructor","device","arguments","length","undefined","attach","_defineProperty","setAccessor","Object","assign","accessor","seal","write","subData","getElementCount","Math","round","getBytesPerElement","getVertexCount","getBytesPerVertex","initialize","Number","isFinite","webglUsage","STATIC_DRAW","debugData","_setData","_setByteLength","setProps","buffer","reallocate","bytesUsed","setData","options","srcOffset","target","gl","webgl2","COPY_WRITE_BUFFER","bindBuffer","handle","bufferSubData","_inferType","copyData","sourceBuffer","readOffset","writeOffset","gl2","COPY_READ_BUFFER","copyBufferSubData","getData","_this$gl","dstData","srcByteOffset","dstOffset","ArrayType","FLOAT","clamped","sourceAvailableElementCount","_getAvailableElementCount","dstElementOffset","dstAvailableElementCount","dstElementCount","min","copyElementCount","getBufferSubData","bind","index","UNIFORM_BUFFER","TRANSFORM_FEEDBACK_BUFFER","_this$gl2","bindBufferRange","_this$gl3","bindBufferBase","unbind","isIndexedBuffer","_this$gl4","getDebugData","changed","invalidateDebugData","trackDeallocatedMemory","_getTarget","bufferData","slice","trackAllocatedMemory","Float32Array","sourceElementOffset","BYTES_PER_ELEMENT","getParameter","pname","value","getBufferParameter"],"sources":["../../src/classic/buffer.ts"],"sourcesContent":["// luma.gl, MIT license\n\nimport type {Device, BufferProps, TypedArray} from '@luma.gl/api';\nimport {assert, checkProps} from '@luma.gl/api';\nimport GL from '@luma.gl/constants';\nimport {assertWebGL2Context} from '../context/context/webgl-checks';\nimport {AccessorObject} from '../types';\nimport Accessor from './accessor';\nimport {getGLTypeFromTypedArray, getTypedArrayFromGLType} from './typed-array-utils';\n\nimport WebGLDevice from '../adapter/webgl-device';\nimport WEBGLBuffer from '../adapter/resources/webgl-buffer';\n\nconst DEBUG_DATA_LENGTH = 10;\n\n// Shared prop checks for constructor and setProps\nconst DEPRECATED_PROPS = {\n offset: 'accessor.offset',\n stride: 'accessor.stride',\n type: 'accessor.type',\n size: 'accessor.size',\n divisor: 'accessor.divisor',\n normalized: 'accessor.normalized',\n integer: 'accessor.integer',\n instanced: 'accessor.divisor',\n isInstanced: 'accessor.divisor'\n};\n\n// Prop checks for constructor\nconst PROP_CHECKS_INITIALIZE = {\n removedProps: {},\n replacedProps: {\n bytes: 'byteLength'\n },\n // new Buffer() with individual accessor props is still used in apps, emit warnings\n deprecatedProps: DEPRECATED_PROPS\n};\n\n// Prop checks for setProps\nconst PROP_CHECKS_SET_PROPS = {\n // Buffer.setProps() with individual accessor props is rare => emit errors\n removedProps: DEPRECATED_PROPS\n};\n\nfunction getWEBGLBufferProps(props: ClassicBufferProps | ArrayBufferView | number): BufferProps {\n // Signature `new Buffer(gl, new Float32Array(...)`\n if (ArrayBuffer.isView(props)) {\n return {data: props};\n }\n\n // Signature: `new Buffer(gl, 100)`\n else if (typeof props === 'number') {\n return {byteLength: props };\n }\n\n props = checkProps('Buffer', props, PROP_CHECKS_INITIALIZE);\n const bufferProps = {...props };\n if (bufferProps.offset) {\n bufferProps.byteOffset = bufferProps.offset;\n }\n return bufferProps;\n}\n\n/** WebGL Buffer interface */\nexport type ClassicBufferProps = BufferProps & {\n handle?: WebGLBuffer;\n\n target?: number;\n webglUsage?: number;\n\n accessor?: AccessorObject;\n\n /** @deprecated */\n index?: number;\n /** @deprecated */\n offset?: number;\n /** @deprecated */\n size?: number;\n /** @deprecated */\n type?: number\n}\n\n/** WebGL Buffer interface */\nexport default class ClassicBuffer extends WEBGLBuffer {\n usage: number;\n accessor: Accessor;\n\n constructor(device: Device | WebGLRenderingContext, props?: ClassicBufferProps);\n constructor(device: Device | WebGLRenderingContext, data: ArrayBufferView | number[]);\n constructor(device: Device | WebGLRenderingContext, byteLength: number);\n\n constructor(device: Device | WebGLRenderingContext, props = {}) {\n super(WebGLDevice.attach(device), getWEBGLBufferProps(props));\n\n // Base class initializes\n // this.initialize(props);\n\n // Deprecated: Merge main props and accessor\n this.setAccessor(Object.assign({}, props, (props as ClassicBufferProps).accessor));\n\n // infer GL type from supplied typed array\n if (this.props.data) {\n const type = getGLTypeFromTypedArray(this.props.data as TypedArray);\n assert(type);\n this.setAccessor(new Accessor(this.accessor, {type}));\n }\n\n Object.seal(this);\n }\n\n override write(data: TypedArray, byteOffset?: number): void {\n this.subData({data, offset: byteOffset});\n }\n\n // returns number of elements in the buffer (assuming that the full buffer is used)\n getElementCount(accessor: AccessorObject = this.accessor): number {\n return Math.round(this.byteLength / Accessor.getBytesPerElement(accessor));\n }\n\n // returns number of vertices in the buffer (assuming that the full buffer is used)\n getVertexCount(accessor: AccessorObject = this.accessor): number {\n return Math.round(this.byteLength / Accessor.getBytesPerVertex(accessor));\n }\n\n // Creates and initializes the buffer object's data store.\n // Signature: `new Buffer(gl, {data: new Float32Array(...)})`\n // Signature: `new Buffer(gl, new Float32Array(...))`\n // Signature: `new Buffer(gl, 100)`\n initialize(props: ClassicBufferProps = {}): this {\n // Signature `new Buffer(gl, new Float32Array(...)`\n if (ArrayBuffer.isView(props)) {\n props = {data: props};\n }\n\n // Signature: `new Buffer(gl, 100)`\n if (Number.isFinite(props)) {\n // @ts-expect-error\n props = {byteLength: props};\n }\n\n props = checkProps('Buffer', props, PROP_CHECKS_INITIALIZE);\n\n // Initialize member fields\n this.webglUsage = props.webglUsage || GL.STATIC_DRAW;\n this.debugData = null;\n\n // Deprecated: Merge main props and accessor\n this.setAccessor(Object.assign({}, props, props.accessor));\n\n // Set data: (re)initializes the buffer\n if (props.data) {\n this._setData(props.data, props.offset, props.byteLength);\n } else {\n this._setByteLength(props.byteLength || 0);\n }\n\n return this;\n }\n\n setProps(props: ClassicBufferProps): this {\n props = checkProps('Buffer', props, PROP_CHECKS_SET_PROPS);\n\n if ('accessor' in props) {\n this.setAccessor(props.accessor);\n }\n\n return this;\n }\n\n // Optionally stores an accessor with the buffer, makes it easier to use it as an attribute later\n // {type, size = 1, offset = 0, stride = 0, normalized = false, integer = false, divisor = 0}\n setAccessor(accessor: AccessorObject | Accessor): this {\n // NOTE: From luma.gl v7.0, Accessors have an optional `buffer `field\n // (mainly to support \"interleaving\")\n // To avoid confusion, ensure `buffer.accessor` does not have a `buffer.accessor.buffer` field:\n accessor = Object.assign({}, accessor);\n // @ts-expect-error\n delete accessor.buffer;\n\n // This new statement ensures that an \"accessor object\" is re-packaged as an Accessor instance\n this.accessor = new Accessor(accessor);\n return this;\n }\n\n // Allocate a bigger GPU buffer (if the current buffer is not big enough).\n // If a reallocation is triggered it clears the buffer\n // Returns:\n // `true`: buffer was reallocated, data was cleared\n // `false`: buffer was big enough, data is intact\n reallocate(byteLength: number): boolean {\n if (byteLength > this.byteLength) {\n this._setByteLength(byteLength);\n return true;\n }\n this.bytesUsed = byteLength;\n return false;\n }\n\n // Update with new data. Reinitializes the buffer\n setData(props: ClassicBufferProps) {\n return this.initialize(props);\n }\n\n // Updates a subset of a buffer object's data store.\n // Data (Typed Array or ArrayBuffer), length is inferred unless provided\n // Offset into buffer\n // WebGL2 only: Offset into srcData\n // WebGL2 only: Number of bytes to be copied\n subData(options: TypedArray | {data: TypedArray, offset?: number; srcOffset?: number; byteLength?: number, length?: number}) {\n // Signature: buffer.subData(new Float32Array([...]))\n if (ArrayBuffer.isView(options)) {\n options = {data: options};\n }\n\n const {data, offset = 0, srcOffset = 0} = options;\n const byteLength = options.byteLength || options.length;\n\n assert(data);\n\n // Create the buffer - binding it here for the first time locks the type\n // In WebGL2, use GL.COPY_WRITE_BUFFER to avoid locking the type\n // @ts-expect-error\n const target = this.gl.webgl2 ? GL.COPY_WRITE_BUFFER : this.target;\n this.gl.bindBuffer(target, this.handle);\n // WebGL2: subData supports additional srcOffset and length parameters\n if (srcOffset !== 0 || byteLength !== undefined) {\n assertWebGL2Context(this.gl);\n // @ts-expect-error\n this.gl.bufferSubData(this.target, offset, data, srcOffset, byteLength);\n } else {\n this.gl.bufferSubData(target, offset, data);\n }\n this.gl.bindBuffer(target, null);\n\n // TODO - update local `data` if offsets are right\n this.debugData = null;\n\n this._inferType(data);\n\n return this;\n }\n\n /**\n * Copies part of the data of another buffer into this buffer\n * @note WEBGL2 ONLY\n */\n copyData(options: {\n sourceBuffer: any;\n readOffset?: number;\n writeOffset?: number;\n size: any;\n }): this {\n const {sourceBuffer, readOffset = 0, writeOffset = 0, size} = options;\n const {gl, gl2} = this;\n assertWebGL2Context(gl);\n\n // Use GL.COPY_READ_BUFFER+GL.COPY_WRITE_BUFFER avoid disturbing other targets and locking type\n gl.bindBuffer(GL.COPY_READ_BUFFER, sourceBuffer.handle);\n gl.bindBuffer(GL.COPY_WRITE_BUFFER, this.handle);\n gl2?.copyBufferSubData(GL.COPY_READ_BUFFER, GL.COPY_WRITE_BUFFER, readOffset, writeOffset, size);\n gl.bindBuffer(GL.COPY_READ_BUFFER, null);\n gl.bindBuffer(GL.COPY_WRITE_BUFFER, null);\n\n // TODO - update local `data` if offsets are 0\n this.debugData = null;\n\n return this;\n }\n\n /**\n * Reads data from buffer into an ArrayBufferView or SharedArrayBuffer.\n * @note WEBGL2 ONLY\n */\n override getData(options?: {\n dstData?: any;\n srcByteOffset?: number;\n dstOffset?: number;\n length?: number;\n }): any {\n let {dstData = null, length = 0} = options || {};\n const {srcByteOffset = 0, dstOffset = 0} = options || {};\n assertWebGL2Context(this.gl);\n\n const ArrayType = getTypedArrayFromGLType(this.accessor.type || GL.FLOAT, {clamped: false});\n const sourceAvailableElementCount = this._getAvailableElementCount(srcByteOffset);\n\n const dstElementOffset = dstOffset;\n\n let dstAvailableElementCount;\n let dstElementCount;\n if (dstData) {\n dstElementCount = dstData.length;\n dstAvailableElementCount = dstElementCount - dstElementOffset;\n } else {\n // Allocate ArrayBufferView with enough size to copy all eligible data.\n dstAvailableElementCount = Math.min(\n sourceAvailableElementCount,\n length || sourceAvailableElementCount\n );\n dstElementCount = dstElementOffset + dstAvailableElementCount;\n }\n\n const copyElementCount = Math.min(sourceAvailableElementCount, dstAvailableElementCount);\n length = length || copyElementCount;\n assert(length <= copyElementCount);\n dstData = dstData || new ArrayType(dstElementCount);\n\n // Use GL.COPY_READ_BUFFER to avoid disturbing other targets and locking type\n this.gl.bindBuffer(GL.COPY_READ_BUFFER, this.handle);\n this.gl2?.getBufferSubData(GL.COPY_READ_BUFFER, srcByteOffset, dstData, dstOffset, length);\n this.gl.bindBuffer(GL.COPY_READ_BUFFER, null);\n\n // TODO - update local `data` if offsets are 0\n return dstData;\n }\n\n /**\n * Binds a buffer to a given binding point (target).\n * GL.TRANSFORM_FEEDBACK_BUFFER and GL.UNIFORM_BUFFER take an index, and optionally a range.\n * - GL.TRANSFORM_FEEDBACK_BUFFER and GL.UNIFORM_BUFFER need an index to affect state\n * - GL.UNIFORM_BUFFER: `offset` must be aligned to GL.UNIFORM_BUFFER_OFFSET_ALIGNMENT.\n * - GL.UNIFORM_BUFFER: `size` must be a minimum of GL.UNIFORM_BLOCK_SIZE_DATA.\n */\n bind(options?: {target?: number; index?: any; offset?: number; size: any}): this {\n const {\n target = this.target, // target for the bind operation\n index = this.accessor && this.accessor.index, // index = index of target (indexed bind point)\n offset = 0,\n size\n } = options || {};\n // NOTE: While GL.TRANSFORM_FEEDBACK_BUFFER and GL.UNIFORM_BUFFER could\n // be used as direct binding points, they will not affect transform feedback or\n // uniform buffer state. Instead indexed bindings need to be made.\n if (target === GL.UNIFORM_BUFFER || target === GL.TRANSFORM_FEEDBACK_BUFFER) {\n if (size !== undefined) {\n this.gl2?.bindBufferRange(target, index, this.handle, offset, size);\n } else {\n assert(offset === 0); // Make sure offset wasn't supplied\n this.gl2?.bindBufferBase(target, index, this.handle);\n }\n } else {\n this.gl.bindBuffer(target, this.handle);\n }\n\n return this;\n }\n\n unbind(options?: {target?: any; index?: any}): this {\n const {target = this.target, index = this.accessor && this.accessor.index} = options || {};\n const isIndexedBuffer = target === GL.UNIFORM_BUFFER || target === GL.TRANSFORM_FEEDBACK_BUFFER;\n if (isIndexedBuffer) {\n this.gl2?.bindBufferBase(target, index, null);\n } else {\n this.gl.bindBuffer(target, null);\n }\n return this;\n }\n\n // PROTECTED METHODS (INTENDED FOR USE BY OTHER FRAMEWORK CODE ONLY)\n\n // Returns a short initial data array\n getDebugData(): {\n data: any;\n changed: boolean;\n } {\n if (!this.debugData) {\n this.debugData = this.getData({length: Math.min(DEBUG_DATA_LENGTH, this.byteLength)});\n return {data: this.debugData, changed: true};\n }\n return {data: this.debugData, changed: false};\n }\n\n invalidateDebugData() {\n this.debugData = null;\n }\n\n // PRIVATE METHODS\n\n // Allocate a new buffer and initialize to contents of typed array\n _setData(data, offset: number = 0, byteLength: number = data.byteLength + offset): this {\n assert(ArrayBuffer.isView(data));\n\n this.trackDeallocatedMemory();\n\n const target = this._getTarget();\n this.gl.bindBuffer(target, this.handle);\n this.gl.bufferData(target, byteLength, this.webglUsage);\n this.gl.bufferSubData(target, offset, data);\n this.gl.bindBuffer(target, null);\n\n this.debugData = data.slice(0, DEBUG_DATA_LENGTH);\n this.bytesUsed = byteLength;\n this.byteLength = byteLength;\n this.trackAllocatedMemory(byteLength);\n\n // infer GL type from supplied typed array\n const type = getGLTypeFromTypedArray(data);\n assert(type);\n this.setAccessor(new Accessor(this.accessor, {type}));\n return this;\n }\n\n // Allocate a GPU buffer of specified size.\n _setByteLength(byteLength: number, webglUsage = this.webglUsage): this {\n assert(byteLength >= 0);\n\n this.trackDeallocatedMemory();\n\n // Workaround needed for Safari (#291):\n // gl.bufferData with size equal to 0 crashes. Instead create zero sized array.\n let data = byteLength;\n if (byteLength === 0) {\n // @ts-expect-error\n data = new Float32Array(0);\n }\n\n const target = this._getTarget();\n this.gl.bindBuffer(target, this.handle);\n this.gl.bufferData(target, data, webglUsage);\n this.gl.bindBuffer(target, null);\n\n this.webglUsage = webglUsage;\n this.debugData = null;\n this.bytesUsed = byteLength;\n this.byteLength = byteLength;\n\n this.trackAllocatedMemory(byteLength);\n\n return this;\n }\n\n // Binding a buffer for the first time locks the type\n // In WebGL2, use GL.COPY_WRITE_BUFFER to avoid locking the type\n _getTarget() {\n // @ts-expect-error\n return this.gl.webgl2 ? GL.COPY_WRITE_BUFFER : this.target;\n }\n\n _getAvailableElementCount(srcByteOffset: number) {\n const ArrayType = getTypedArrayFromGLType(this.accessor.type || GL.FLOAT, {clamped: false});\n const sourceElementOffset = srcByteOffset / ArrayType.BYTES_PER_ELEMENT;\n return this.getElementCount() - sourceElementOffset;\n }\n\n // Automatically infers type from typed array passed to setData\n // Note: No longer that useful, since type is now autodeduced from the compiled shaders\n _inferType(data) {\n if (!this.accessor.type) {\n this.setAccessor(new Accessor(this.accessor, {type: getGLTypeFromTypedArray(data)}));\n }\n }\n\n // RESOURCE METHODS\n\n getParameter(pname: GL): any {\n this.gl.bindBuffer(this.target, this.handle);\n const value = this.gl.getBufferParameter(this.target, pname);\n this.gl.bindBuffer(this.target, null);\n return value;\n }\n\n // DEPRECATIONS - v7.0\n /** @deprecated Use Buffer.accessor.type */\n get type() {\n return this.accessor.type;\n }\n}\n"],"mappings":";AAGA,SAAQA,MAAM,EAAEC,UAAU,QAAO,cAAc;AAC/C,OAAOC,EAAE,MAAM,oBAAoB;AAAC,SAC5BC,mBAAmB;AAAA,OAEpBC,QAAQ;AAAA,SACPC,uBAAuB,EAAEC,uBAAuB;AAAA,OAEjDC,WAAW;AAAA,OACXC,WAAW;AAElB,MAAMC,iBAAiB,GAAG,EAAE;AAG5B,MAAMC,gBAAgB,GAAG;EACvBC,MAAM,EAAE,iBAAiB;EACzBC,MAAM,EAAE,iBAAiB;EACzBC,IAAI,EAAE,eAAe;EACrBC,IAAI,EAAE,eAAe;EACrBC,OAAO,EAAE,kBAAkB;EAC3BC,UAAU,EAAE,qBAAqB;EACjCC,OAAO,EAAE,kBAAkB;EAC3BC,SAAS,EAAE,kBAAkB;EAC7BC,WAAW,EAAE;AACf,CAAC;AAGD,MAAMC,sBAAsB,GAAG;EAC7BC,YAAY,EAAE,CAAC,CAAC;EAChBC,aAAa,EAAE;IACbC,KAAK,EAAE;EACT,CAAC;EAEDC,eAAe,EAAEd;AACnB,CAAC;AAGD,MAAMe,qBAAqB,GAAG;EAE5BJ,YAAY,EAAEX;AAChB,CAAC;AAED,SAASgB,m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ructor = Float32ArrayConstructor | Uint16ArrayConstructor | Uint32ArrayConstructor | Uint8ArrayConstructor | Uint8ClampedArrayConstructor | Int8ArrayConstructor | Int16ArrayConstructor | Int32ArrayConstructor;
3
+ declare type TypedArrayConstructor = Float32ArrayConstructor | Uint16ArrayConstructor | Uint32ArrayConstructor | Uint8ArrayConstructor | Uint8ClampedArrayConstructor | Int8ArrayConstructor | Int16ArrayConstructor | Int32ArrayConstructor;
4
4
  /**
5
5
  * Converts TYPED ARRAYS to corresponding GL constant
6
6
  * Used to auto deduce gl parameter types
@@ -1 +1 @@
1
- {"version":3,"file":"typed-array-utils.d.ts","sourceRoot":"","sources":["../../src/classic/typed-array-utils.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,UAAU,EAAC,MAAM,cAAc,CAAC;AAExC,OAAO,EAAC,MAAM,EAAC,MAAM,gBAAgB,CAAA;AAIrC,KAAK,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,wBAAgB,uBAAuB,CACrC,MAAM,EAAE,GAAG,EACX,OAAO,CAAC,EAAE;IACR,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,GACA,qBAAqB,CAwBvB;AAED;;;;;GAKG;AACF,wBAAgB,QAAQ,CAAC,OAAO,EAAE;IACjC,IAAI,EAAE,GAAG,CAAC;IACV,KAAK,EAAE,GAAG,CAAC;IACX,MAAM,EAAE,GAAG,CAAC;IACZ,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,IAAI,CAAC,EAAE,GAAG,CAAC;CACZ,GAAG,IAAI,CAgBP;AAGD,wBAAgB,WAAW,CAAC,OAAO,EAAE;IACnC,IAAI,EAAE,GAAG,CAAC;IACV,KAAK,EAAE,GAAG,CAAC;IACX,MAAM,EAAE,GAAG,CAAC;CACb,GAAG;IACF,IAAI,EAAE,UAAU,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB,CAaA"}
1
+ {"version":3,"file":"typed-array-utils.d.ts","sourceRoot":"","sources":["../../src/classic/typed-array-utils.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,UAAU,EAAC,MAAM,cAAc,CAAC;AAExC,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,wBAAgB,uBAAuB,CACrC,MAAM,EAAE,GAAG,EACX,OAAO,CAAC,EAAE;IACR,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,GACA,qBAAqB,CAwBvB;AAED;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,OAAO,EAAE;IAChC,IAAI,EAAE,GAAG,CAAC;IACV,KAAK,EAAE,GAAG,CAAC;IACX,MAAM,EAAE,GAAG,CAAC;IACZ,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,IAAI,CAAC,EAAE,GAAG,CAAC;CACZ,GAAG,IAAI,CAgBP;AAGD,wBAAgB,WAAW,CAAC,OAAO,EAAE;IACnC,IAAI,EAAE,GAAG,CAAC;IACV,KAAK,EAAE,GAAG,CAAC;IACX,MAAM,EAAE,GAAG,CAAC;CACb,GAAG;IACF,IAAI,EAAE,UAAU,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB,CAaA"}
@@ -1,102 +1,92 @@
1
- // luma.gl, MIT license
2
1
  import GL from '@luma.gl/constants';
3
2
  const ERR_TYPE_DEDUCTION = 'Failed to deduce GL constant from typed array';
4
- /**
5
- * Converts TYPED ARRAYS to corresponding GL constant
6
- * Used to auto deduce gl parameter types
7
- * @param {*} arrayOrType
8
- * @returns
9
- */
10
3
  export function getGLTypeFromTypedArray(arrayOrType) {
11
- // If typed array, look up constructor
12
- const type = ArrayBuffer.isView(arrayOrType) ? arrayOrType.constructor : arrayOrType;
13
- switch (type) {
14
- case Float32Array:
15
- return GL.FLOAT;
16
- case Uint16Array:
17
- return GL.UNSIGNED_SHORT;
18
- case Uint32Array:
19
- return GL.UNSIGNED_INT;
20
- case Uint8Array:
21
- return GL.UNSIGNED_BYTE;
22
- case Uint8ClampedArray:
23
- return GL.UNSIGNED_BYTE;
24
- case Int8Array:
25
- return GL.BYTE;
26
- case Int16Array:
27
- return GL.SHORT;
28
- case Int32Array:
29
- return GL.INT;
30
- default:
31
- throw new Error(ERR_TYPE_DEDUCTION);
32
- }
4
+ const type = ArrayBuffer.isView(arrayOrType) ? arrayOrType.constructor : arrayOrType;
5
+ switch (type) {
6
+ case Float32Array:
7
+ return GL.FLOAT;
8
+ case Uint16Array:
9
+ return GL.UNSIGNED_SHORT;
10
+ case Uint32Array:
11
+ return GL.UNSIGNED_INT;
12
+ case Uint8Array:
13
+ return GL.UNSIGNED_BYTE;
14
+ case Uint8ClampedArray:
15
+ return GL.UNSIGNED_BYTE;
16
+ case Int8Array:
17
+ return GL.BYTE;
18
+ case Int16Array:
19
+ return GL.SHORT;
20
+ case Int32Array:
21
+ return GL.INT;
22
+ default:
23
+ throw new Error(ERR_TYPE_DEDUCTION);
24
+ }
33
25
  }
34
- /**
35
- * Converts GL constant to corresponding TYPED ARRAY
36
- * Used to auto deduce gl parameter types
37
- * @param {*} glType
38
- * @param {*} param1
39
- * @returns
40
- */
41
- // eslint-disable-next-line complexity
42
26
  export function getTypedArrayFromGLType(glType, options) {
43
- const { clamped = true } = options || {};
44
- // Sorted in some order of likelihood to reduce amount of comparisons
45
- switch (glType) {
46
- case GL.FLOAT:
47
- return Float32Array;
48
- case GL.UNSIGNED_SHORT:
49
- case GL.UNSIGNED_SHORT_5_6_5:
50
- case GL.UNSIGNED_SHORT_4_4_4_4:
51
- case GL.UNSIGNED_SHORT_5_5_5_1:
52
- return Uint16Array;
53
- case GL.UNSIGNED_INT:
54
- return Uint32Array;
55
- case GL.UNSIGNED_BYTE:
56
- return clamped ? Uint8ClampedArray : Uint8Array;
57
- case GL.BYTE:
58
- return Int8Array;
59
- case GL.SHORT:
60
- return Int16Array;
61
- case GL.INT:
62
- return Int32Array;
63
- default:
64
- throw new Error('Failed to deduce typed array type from GL constant');
65
- }
27
+ const {
28
+ clamped = true
29
+ } = options || {};
30
+ switch (glType) {
31
+ case GL.FLOAT:
32
+ return Float32Array;
33
+ case GL.UNSIGNED_SHORT:
34
+ case GL.UNSIGNED_SHORT_5_6_5:
35
+ case GL.UNSIGNED_SHORT_4_4_4_4:
36
+ case GL.UNSIGNED_SHORT_5_5_5_1:
37
+ return Uint16Array;
38
+ case GL.UNSIGNED_INT:
39
+ return Uint32Array;
40
+ case GL.UNSIGNED_BYTE:
41
+ return clamped ? Uint8ClampedArray : Uint8Array;
42
+ case GL.BYTE:
43
+ return Int8Array;
44
+ case GL.SHORT:
45
+ return Int16Array;
46
+ case GL.INT:
47
+ return Int32Array;
48
+ default:
49
+ throw new Error('Failed to deduce typed array type from GL constant');
50
+ }
66
51
  }
67
- /**
68
- * Flip rows (can be used on arrays returned from `Framebuffer.readPixels`)
69
- * https: *stackoverflow.com/questions/41969562/
70
- * how-can-i-flip-the-result-of-webglrenderingcontext-readpixels
71
- * @param {*} param0
72
- */
73
52
  export function flipRows(options) {
74
- const { data, width, height, bytesPerPixel = 4, temp } = options;
75
- const bytesPerRow = width * bytesPerPixel;
76
- // make a temp buffer to hold one row
77
- const tempBuffer = temp || new Uint8Array(bytesPerRow);
78
- for (let y = 0; y < height / 2; ++y) {
79
- const topOffset = y * bytesPerRow;
80
- const bottomOffset = (height - y - 1) * bytesPerRow;
81
- // make copy of a row on the top half
82
- tempBuffer.set(data.subarray(topOffset, topOffset + bytesPerRow));
83
- // copy a row from the bottom half to the top
84
- data.copyWithin(topOffset, bottomOffset, bottomOffset + bytesPerRow);
85
- // copy the copy of the top half row to the bottom half
86
- data.set(tempBuffer, bottomOffset);
87
- }
53
+ const {
54
+ data,
55
+ width,
56
+ height,
57
+ bytesPerPixel = 4,
58
+ temp
59
+ } = options;
60
+ const bytesPerRow = width * bytesPerPixel;
61
+ const tempBuffer = temp || new Uint8Array(bytesPerRow);
62
+ for (let y = 0; y < height / 2; ++y) {
63
+ const topOffset = y * bytesPerRow;
64
+ const bottomOffset = (height - y - 1) * bytesPerRow;
65
+ tempBuffer.set(data.subarray(topOffset, topOffset + bytesPerRow));
66
+ data.copyWithin(topOffset, bottomOffset, bottomOffset + bytesPerRow);
67
+ data.set(tempBuffer, bottomOffset);
68
+ }
88
69
  }
89
70
  export function scalePixels(options) {
90
- const { data, width, height } = options;
91
- const newWidth = Math.round(width / 2);
92
- const newHeight = Math.round(height / 2);
93
- const newData = new Uint8Array(newWidth * newHeight * 4);
94
- for (let y = 0; y < newHeight; y++) {
95
- for (let x = 0; x < newWidth; x++) {
96
- for (let c = 0; c < 4; c++) {
97
- newData[(y * newWidth + x) * 4 + c] = data[(y * 2 * width + x * 2) * 4 + c];
98
- }
99
- }
71
+ const {
72
+ data,
73
+ width,
74
+ height
75
+ } = options;
76
+ const newWidth = Math.round(width / 2);
77
+ const newHeight = Math.round(height / 2);
78
+ const newData = new Uint8Array(newWidth * newHeight * 4);
79
+ for (let y = 0; y < newHeight; y++) {
80
+ for (let x = 0; x < newWidth; x++) {
81
+ for (let c = 0; c < 4; c++) {
82
+ newData[(y * newWidth + x) * 4 + c] = data[(y * 2 * width + x * 2) * 4 + c];
83
+ }
100
84
  }
101
- return { data: newData, width: newWidth, height: newHeight };
85
+ }
86
+ return {
87
+ data: newData,
88
+ width: newWidth,
89
+ height: newHeight
90
+ };
102
91
  }
92
+ //# sourceMappingURL=typed-array-utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"typed-array-utils.js","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"],"sources":["../../src/classic/typed-array-utils.ts"],"sourcesContent":["// luma.gl, MIT license\n\nimport {TypedArray} from '@luma.gl/api';\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 */\nexport 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"],"mappings":"AAGA,OAAOA,EAAE,MAAM,oBAAoB;AAGnC,MAAMC,kBAAkB,GAAG,+CAA+C;AAkB1E,OAAO,SAASC,uBAAuBA,CAACC,WAAuB,EAAU;EAEvE,MAAMC,IAAI,GAAGC,WAAW,CAACC,MAAM,CAACH,WAAW,CAAC,GAAGA,WAAW,CAACI,WAAW,GAAGJ,WAAW;EACpF,QAAQC,IAAI;IACV,KAAKI,YAAY;MACf,OAAOR,EAAE,CAACS,KAAK;IACjB,KAAKC,WAAW;MACd,OAAOV,EAAE,CAACW,cAAc;IAC1B,KAAKC,WAAW;MACd,OAAOZ,EAAE,CAACa,YAAY;IACxB,KAAKC,UAAU;MACb,OAAOd,EAAE,CAACe,aAAa;IACzB,KAAKC,iBAAiB;MACpB,OAAOhB,EAAE,CAACe,aAAa;IACzB,KAAKE,SAAS;MACZ,OAAOjB,EAAE,CAACkB,IAAI;IAChB,KAAKC,UAAU;MACb,OAAOnB,EAAE,CAACoB,KAAK;IACjB,KAAKC,UAAU;MACb,OAAOrB,EAAE,CAACsB,GAAG;IACf;MACE,MAAM,IAAIC,KAAK,CAACtB,kBAAkB,CAAC;EAAC;AAE1C;AAUA,OAAO,SAASuB,uBAAuBA,CACrCC,MAAW,EACXC,OAEC,EACsB;EACvB,MAAM;IAACC,OAA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AAC;IAEjEL,IAAI,CAACY,UAAU,CAACJ,SAAS,EAAEC,YAAY,EAAEA,YAAY,GAAGJ,WAAW,CAAC;IAEpEL,IAAI,CAACU,GAAG,CAACJ,UAAU,EAAEG,YAAY,CAAC;EACpC;AACF;AAGA,OAAO,SAASI,WAAWA,CAACnB,OAI3B,EAIC;EACA,MAAM;IAACM,IAAI;IAAEC,KAAK;IAAEC;EAAM,CAAC,GAAGR,OAAO;EACrC,MAAMoB,QAAQ,GAAGC,IAAI,CAACC,KAAK,CAACf,KAAK,GAAG,CAAC,CAAC;EACtC,MAAMgB,SAAS,GAAGF,IAAI,CAACC,KAAK,CAACd,MAAM,GAAG,CAAC,CAAC;EACxC,MAAMgB,OAAO,GAAG,IAAIpC,UAAU,CAACgC,QAAQ,GAAGG,SAAS,GAAG,CAAC,CAAC;EACxD,KAAK,IAAIV,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGU,SAAS,EAAEV,CAAC,EAAE,EAAE;IAClC,KAAK,IAAIY,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGL,QAAQ,EAAEK,CAAC,EAAE,EAAE;MACjC,KAAK,IAAIC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAG,CAAC,EAAEA,CAAC,EAAE,EAAE;QAC1BF,OAAO,CAAC,CAACX,CAAC,GAAGO,QAAQ,GAAGK,CAAC,IAAI,CAAC,GAAGC,CAAC,CAAC,GAAGpB,IAAI,CAAC,CAACO,CAAC,GAAG,CAAC,GAAGN,KAAK,GAAGkB,CAAC,GAAG,CAAC,IAAI,CAAC,GAAGC,CAAC,CAAC;MAC7E;IACF;EACF;EACA,OAAO;IAACpB,IAAI,EAAEkB,OAAO;IAAEjB,KAAK,EAAEa,QAAQ;IAAEZ,MAAM,EAAEe;EAAS,CAAC;AAC5D"}
@@ -1,3 +1,5 @@
1
+ /// <reference types="dist" />
2
+ /// <reference types="offscreencanvas" />
1
3
  /**
2
4
  * ContextProps
3
5
  * @param webgl2 Set to false to not create a WebGL2 context (force webgl1)
@@ -15,7 +17,7 @@
15
17
  * @param preserveDrawingBuffer Default render target buffers will not be automatically cleared and will preserve their values until cleared or overwritten
16
18
  * @param failIfMajorPerformanceCaveat Do not create if the system performance is low.
17
19
  */
18
- type ContextProps = {
20
+ declare type ContextProps = {
19
21
  type?: 'webgl' | 'webgl1' | 'webgl2' | string;
20
22
  webgl1?: boolean;
21
23
  webgl2?: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"create-browser-context.d.ts","sourceRoot":"","sources":["../../../src/context/context/create-browser-context.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;EAgBE;AACF,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,GAAI,kBAAkB,GAAG,WAAW,CAAC;IAChE,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,qBAAqB,CAAC,EAAE,OAAO,CAAA;CAChC,CAAC;AAUF;;;;GAIG;AACF,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,iBAAiB,GAAG,eAAe,EAAE,KAAK,EAAE,YAAY,GAAG,qBAAqB,CAiD7H"}
1
+ {"version":3,"file":"create-browser-context.d.ts","sourceRoot":"","sources":["../../../src/context/context/create-browser-context.ts"],"names":[],"mappings":";;AAEA;;;;;;;;;;;;;;;;EAgBE;AACF,aAAK,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,GAAI,kBAAkB,GAAG,WAAW,CAAC;IAChE,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,qBAAqB,CAAC,EAAE,OAAO,CAAA;CAChC,CAAC;AAYF;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,iBAAiB,GAAG,eAAe,EAAE,KAAK,EAAE,YAAY,GAAG,qBAAqB,CAiD5H"}
@@ -1,70 +1,53 @@
1
- // luma.gl, MIT license
2
1
  const DEFAULT_CONTEXT_PROPS = {
3
- webgl2: true,
4
- webgl1: true,
5
- powerPreference: 'high-performance',
6
- onContextLost: () => console.error('WebGL context lost'),
7
- onContextRestored: () => console.info('WebGL context restored'),
2
+ webgl2: true,
3
+ webgl1: true,
4
+ powerPreference: 'high-performance',
5
+ onContextLost: () => console.error('WebGL context lost'),
6
+ onContextRestored: () => console.info('WebGL context restored')
8
7
  };
9
- /**
10
- * Create a WebGL context for a canvas
11
- * Note calling this multiple time on the same canvas does return the same context
12
- * @param canvas A canvas element or offscreen canvas
13
- */
14
8
  export function createBrowserContext(canvas, props) {
15
- props = { ...DEFAULT_CONTEXT_PROPS, ...props };
16
- // Try to extract any extra information about why context creation failed
17
- let errorMessage = null;
18
- const onCreateError = (error) => (errorMessage = error.statusMessage || errorMessage);
19
- canvas.addEventListener('webglcontextcreationerror', onCreateError, false);
20
- // Create the desired context
21
- let gl = null;
22
- if (props.type === 'webgl2') {
23
- props = { ...props, webgl1: false };
24
- }
25
- if (props.type === 'webgl1') {
26
- props = { ...props, webgl2: false };
27
- }
28
- // Prefer webgl2 over webgl1 if both are acceptable
29
- if (props.webgl2) {
30
- gl = gl || canvas.getContext('webgl2', props);
31
- }
32
- if (props.webgl1) {
33
- gl = gl || canvas.getContext('webgl', props);
34
- }
35
- // TODO are we removing this listener before giving it a chance to fire?
36
- canvas.removeEventListener('webglcontextcreationerror', onCreateError, false);
37
- if (!gl) {
38
- throw new Error(`Failed to create ${props.webgl2 && !props.webgl1 ? 'WebGL2' : 'WebGL'} context: ${errorMessage || 'Unknown error'}`);
39
- }
40
- if (props.onContextLost) {
41
- // Carefully extract and wrap callbacks to prevent addEventListener from rebinding them.
42
- const { onContextLost } = props;
43
- canvas.addEventListener('webglcontextlost', (event) => onContextLost(event), false);
44
- }
45
- if (props.onContextRestored) {
46
- // Carefully extract and wrap callbacks to prevent addEventListener from rebinding them.
47
- const { onContextRestored } = props;
48
- canvas.addEventListener('webglcontextrestored', (event) => onContextRestored(event), false);
49
- }
50
- return gl;
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 (props.webgl2) {
30
+ gl = gl || canvas.getContext('webgl2', props);
31
+ }
32
+ if (props.webgl1) {
33
+ gl = gl || canvas.getContext('webgl', props);
34
+ }
35
+ canvas.removeEventListener('webglcontextcreationerror', onCreateError, false);
36
+ if (!gl) {
37
+ throw new Error("Failed to create ".concat(props.webgl2 && !props.webgl1 ? 'WebGL2' : 'WebGL', " context: ").concat(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;
51
52
  }
52
- /* TODO - can we call this asynchronously to catch the error events?
53
- export async function createBrowserContextAsync(canvas: HTMLCanvasElement | OffscreenCanvas, props: ContextProps): Promise<WebGLRenderingContext> {
54
- props = {...DEFAULT_CONTEXT_PROPS, ...props};
55
-
56
- // Try to extract any extra information about why context creation failed
57
- let errorMessage = null;
58
- const onCreateError = (error) => (errorMessage = error.statusMessage || errorMessage);
59
- canvas.addEventListener('webglcontextcreationerror', onCreateError, false);
60
-
61
- const gl = createBrowserContext(canvas, props);
62
-
63
- // Give the listener a chance to fire
64
- await new Promise(resolve => setTimeout(resolve, 0));
65
-
66
- canvas.removeEventListener('webglcontextcreationerror', onCreateError, false);
67
-
68
- return gl;
69
- }
70
- */
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","concat","event"],"sources":["../../../src/context/context/create-browser-context.ts"],"sourcesContent":["// luma.gl, MIT license\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(canvas: HTMLCanvasElement | OffscreenCanvas, props: ContextProps): 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 | 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 // Prefer webgl2 over webgl1 if both are acceptable\n if (props.webgl2) {\n gl = gl || canvas.getContext('webgl2', props) as WebGL2RenderingContext | null;\n }\n if (props.webgl1) {\n gl = gl || canvas.getContext('webgl', props) as WebGLRenderingContext | null;\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('webglcontextrestored', (event: Event) => onContextRestored(event), false);\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":"AAmCA,MAAMA,qBAAmC,GAAG;EAC1CC,MAAM,EAAE,IAAI;EACZC,MAAM,EAAE,IAAI;EACZC,eAAe,EAAE,kBAAkB;EAEnCC,aAAa,EAAEA,CAAA,KAAMC,OAAO,CAACC,KAAK,CAAC,oBAAoB,CAAC;EAExDC,iBAAiB,EAAEA,CAAA,KAAMF,OAAO,CAACG,IAAI,CAAC,wBAAwB;AAChE,CAAC;AAOD,OAAO,SAASC,oBAAoBA,CAACC,MAA2C,EAAEC,KAAmB,EAAyB;EAC5HA,KAAK,GAAG;IAAC,GAAGX,qBAAqB;IAAE,GAAGW;EAAK,CAAC;EAG5C,IAAIC,YAAY,GAAG,IAAI;EACvB,MAAMC,aAAa,GAAIP,KAAK,IAAMM,YAAY,GAAGN,KAAK,CAACQ,aAAa,IAAIF,YAAa;EACrFF,MAAM,CAACK,gBAAgB,CAAC,2BAA2B,EAAEF,aAAa,EAAE,KAAK,CAAC;EAG1E,IAAIG,EAAgC,GAAG,IAAI;EAE3C,IAAIL,KAAK,CAACM,IAAI,KAAK,QAAQ,EAAE;IAC3BN,KAAK,GAAG;MAAC,GAAGA,KAAK;MAAET,MAAM,EAAE;IAAK,CAAC;EACnC;EACA,IAAIS,KAAK,CAACM,IAAI,KAAK,QAAQ,EAAE;IAC3BN,KAAK,GAAG;MAAC,GAAGA,KAAK;MAAEV,MAAM,EAAE;IAAK,CAAC;EACnC;EAGA,IAAIU,KAAK,CAACV,MAAM,EAAE;IAChBe,EAAE,GAAGA,EAAE,IAAIN,MAAM,CAACQ,UAAU,CAAC,QAAQ,EAAEP,KAAK,CAAkC;EAChF;EACA,IAAIA,KAAK,CAACT,MAAM,EAAE;IAChBc,EAAE,GAAGA,EAAE,IAAIN,MAAM,CAACQ,UAAU,CAAC,OAAO,EAAEP,KAAK,CAAiC;EAC9E;EAGAD,MAAM,CAACS,mBAAmB,CAAC,2BAA2B,EAAEN,aAAa,EAAE,KAAK,CAAC;EAE7E,IAAI,CAACG,EAAE,EAAE;IACP,MAAM,IAAII,KAAK,qBAAAC,MAAA,CACOV,KAAK,CAACV,MAAM,IAAI,CAACU,KAAK,CAACT,MAAM,GAAG,QAAQ,GAAG,OAAO,gBAAAmB,MAAA,CACpET,YAAY,IAAI,eAAe,EAElC;EACH;EAEA,IAAID,KAAK,CAACP,aAAa,EAAE;IAEvB,MAAM;MAACA;IAAa,CAAC,GAAGO,KAAK;IAC7BD,MAAM,CAACK,gBAAgB,CAAC,kBAAkB,EAAEO,KAAY,IAAKlB,aAAa,CAACkB,KAAK,CAAC,EAAE,KAAK,CAAC;EAC3F;EACA,IAAIX,KAAK,CAACJ,iBAAiB,EAAE;IAE3B,MAAM;MAACA;IAAiB,CAAC,GAAGI,KAAK;IACjCD,MAAM,CAACK,gBAAgB,CAAC,sBAAsB,EAAGO,KAAY,IAAKf,iBAAiB,CAACe,KAAK,CAAC,EAAE,KAAK,CAAC;EACpG;EAEA,OAAON,EAAE;AACX"}
@@ -1,5 +1,5 @@
1
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;
2
+ export declare type HeadlessGL = (width: number, height: number, options: Record<string, unknown>) => WebGLRenderingContext;
3
3
  /** By importing `gl` and registering it with this function, contexts can be created under Node.js */
4
4
  export declare function registerHeadlessGL(headlessgl: HeadlessGL): void;
5
5
  /** @returns true if headless gl is registered */
@@ -1 +1 @@
1
- {"version":3,"file":"create-headless-context.d.ts","sourceRoot":"","sources":["../../../src/context/context/create-headless-context.ts"],"names":[],"mappings":"AAeA,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"}
1
+ {"version":3,"file":"create-headless-context.d.ts","sourceRoot":"","sources":["../../../src/context/context/create-headless-context.ts"],"names":[],"mappings":"AAeA,iFAAiF;AACjF,oBAAY,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"}
@@ -1,36 +1,42 @@
1
1
  const ERR_HEADLESSGL_FAILED = 'Failed to create WebGL context in Node.js, headless gl returned null';
2
- const ERR_HEADLESSGL_LOAD = `\
2
+ const ERR_HEADLESSGL_LOAD = '\
3
3
  luma.gl: loaded under Node.js without headless gl installed, meaning that WebGL \
4
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.`;
5
+ typical configuration for isorender applications running on the server.';
6
6
  const CONTEXT_DEFAULTS = {
7
- width: 1,
8
- height: 1,
9
- debug: true,
10
- throwOnError: false
7
+ width: 1,
8
+ height: 1,
9
+ debug: true,
10
+ throwOnError: false
11
11
  };
12
12
  let headlessGL = null;
13
- /** By importing `gl` and registering it with this function, contexts can be created under Node.js */
14
13
  export function registerHeadlessGL(headlessgl) {
15
- headlessGL = headlessgl;
14
+ headlessGL = headlessgl;
16
15
  }
17
- /** @returns true if headless gl is registered */
18
16
  export function isHeadlessGLRegistered() {
19
- return headlessGL !== null;
17
+ return headlessGL !== null;
20
18
  }
21
- /** Create headless gl context (for running under Node.js) */
22
19
  export function createHeadlessContext(options) {
23
- options = { ...CONTEXT_DEFAULTS, ...options };
24
- const { width, height, webgl1, webgl2 } = options;
25
- if (webgl2 && !webgl1) {
26
- throw new Error('headless-gl does not support WebGL2');
27
- }
28
- if (!headlessGL) {
29
- throw new Error(ERR_HEADLESSGL_LOAD);
30
- }
31
- const gl = headlessGL(width, height, options);
32
- if (!gl) {
33
- throw new Error(ERR_HEADLESSGL_FAILED);
34
- }
35
- return gl;
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;
36
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":["const 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":"AAAA,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,39 +1,31 @@
1
- // luma.gl, MIT license
2
1
  import { assert } from '@luma.gl/api';
3
2
  const ERR_CONTEXT = 'Invalid WebGLRenderingContext';
4
3
  export const ERR_WEBGL = ERR_CONTEXT;
5
4
  export const ERR_WEBGL2 = 'Requires WebGL2';
6
- /** Check if supplied parameter is a WebGLRenderingContext */
7
5
  export function isWebGL(gl) {
8
- if (typeof WebGLRenderingContext !== 'undefined' && gl instanceof WebGLRenderingContext) {
9
- return true;
10
- }
11
- if (typeof WebGL2RenderingContext !== 'undefined' && gl instanceof WebGL2RenderingContext) {
12
- return true;
13
- }
14
- // Look for debug contexts, headless gl etc
15
- return Boolean(gl && Number.isFinite(gl._version));
6
+ if (typeof WebGLRenderingContext !== 'undefined' && gl instanceof WebGLRenderingContext) {
7
+ return true;
8
+ }
9
+ if (typeof WebGL2RenderingContext !== 'undefined' && gl instanceof WebGL2RenderingContext) {
10
+ return true;
11
+ }
12
+ return Boolean(gl && Number.isFinite(gl._version));
16
13
  }
17
- /** Check if supplied parameter is a WebGL2RenderingContext */
18
14
  export function isWebGL2(gl) {
19
- if (typeof WebGL2RenderingContext !== 'undefined' && gl instanceof WebGL2RenderingContext) {
20
- return true;
21
- }
22
- // Look for debug contexts, headless gl etc
23
- return Boolean(gl && gl._version === 2);
15
+ if (typeof WebGL2RenderingContext !== 'undefined' && gl instanceof WebGL2RenderingContext) {
16
+ return true;
17
+ }
18
+ return Boolean(gl && gl._version === 2);
24
19
  }
25
- /** Returns a properly typed WebGL2RenderingContext from a WebGL1 context, or null */
26
20
  export function getWebGL2Context(gl) {
27
- // @ts-expect-error
28
- return isWebGL2(gl) ? gl : null;
21
+ return isWebGL2(gl) ? gl : null;
29
22
  }
30
- /** Throw if supplied parameter is not a WebGLRenderingContext, otherwise return properly typed value */
31
23
  export function assertWebGLContext(gl) {
32
- assert(isWebGL(gl), ERR_CONTEXT);
33
- return gl;
24
+ assert(isWebGL(gl), ERR_CONTEXT);
25
+ return gl;
34
26
  }
35
- /** Throw if supplied parameter is not a WebGL2RenderingContext, otherwise return properly typed value */
36
27
  export function assertWebGL2Context(gl) {
37
- assert(isWebGL2(gl), ERR_WEBGL2);
38
- return gl;
28
+ assert(isWebGL2(gl), ERR_WEBGL2);
29
+ return gl;
39
30
  }
31
+ //# sourceMappingURL=webgl-checks.js.map
@@ -0,0 +1 @@
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\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"],"mappings":"AACA,SAAQA,MAAM,QAAO,cAAc;AAEnC,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"}