@luma.gl/webgl 8.6.0-alpha.1 → 8.6.0-alpha.5

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 (701) hide show
  1. package/LICENSE +8 -1
  2. package/dist/_deprecated/context-api.d.ts +85 -0
  3. package/dist/_deprecated/context-api.d.ts.map +1 -0
  4. package/dist/_deprecated/context-api.js +76 -0
  5. package/dist/_deprecated/context-api.js.map +1 -0
  6. package/dist/{features/webgl-features-table.d.ts → _deprecated/features.d.ts} +4 -7
  7. package/dist/_deprecated/features.d.ts.map +1 -0
  8. package/dist/_deprecated/features.js +111 -0
  9. package/dist/_deprecated/features.js.map +1 -0
  10. package/dist/adapter/converters/set-device-parameters.d.ts +5 -0
  11. package/dist/adapter/converters/set-device-parameters.d.ts.map +1 -0
  12. package/dist/adapter/converters/set-device-parameters.js +124 -0
  13. package/dist/adapter/converters/set-device-parameters.js.map +1 -0
  14. package/dist/adapter/converters/webgpu-texture-formats.d.ts +281 -0
  15. package/dist/adapter/converters/webgpu-texture-formats.d.ts.map +1 -0
  16. package/dist/adapter/converters/webgpu-texture-formats.js +285 -0
  17. package/dist/adapter/converters/webgpu-texture-formats.js.map +1 -0
  18. package/dist/adapter/device-helpers/device-features.d.ts +12 -0
  19. package/dist/adapter/device-helpers/device-features.d.ts.map +1 -0
  20. package/dist/adapter/device-helpers/device-features.js +123 -0
  21. package/dist/adapter/device-helpers/device-features.js.map +1 -0
  22. package/dist/adapter/device-helpers/device-limits.d.ts +51 -0
  23. package/dist/adapter/device-helpers/device-limits.d.ts.map +1 -0
  24. package/dist/adapter/device-helpers/device-limits.js +90 -0
  25. package/dist/adapter/device-helpers/device-limits.js.map +1 -0
  26. package/dist/adapter/device-helpers/get-device-info.d.ts +4 -0
  27. package/dist/adapter/device-helpers/get-device-info.d.ts.map +1 -0
  28. package/dist/adapter/device-helpers/get-device-info.js +44 -0
  29. package/dist/adapter/device-helpers/get-device-info.js.map +1 -0
  30. package/dist/adapter/device-helpers/is-old-ie.d.ts +2 -0
  31. package/dist/adapter/device-helpers/is-old-ie.d.ts.map +1 -0
  32. package/dist/{esm/features/check-old-ie.js → adapter/device-helpers/is-old-ie.js} +3 -3
  33. package/dist/adapter/device-helpers/is-old-ie.js.map +1 -0
  34. package/dist/adapter/webgl-device.d.ts +110 -0
  35. package/dist/adapter/webgl-device.d.ts.map +1 -0
  36. package/dist/adapter/webgl-device.js +207 -0
  37. package/dist/adapter/webgl-device.js.map +1 -0
  38. package/dist/adapter/webgl-shader.d.ts +18 -0
  39. package/dist/adapter/webgl-shader.d.ts.map +1 -0
  40. package/dist/adapter/webgl-shader.js +82 -0
  41. package/dist/adapter/webgl-shader.js.map +1 -0
  42. package/dist/classes/accessor.js +2 -2
  43. package/dist/classes/accessor.js.map +1 -1
  44. package/dist/classes/accessor.ts.disabled +1 -1
  45. package/dist/classes/clear.d.ts +3 -2
  46. package/dist/classes/clear.d.ts.map +1 -1
  47. package/dist/classes/clear.js +7 -4
  48. package/dist/classes/clear.js.map +1 -1
  49. package/dist/classes/copy-and-blit.d.ts +18 -1
  50. package/dist/classes/copy-and-blit.d.ts.map +1 -1
  51. package/dist/classes/copy-and-blit.js +30 -25
  52. package/dist/classes/copy-and-blit.js.map +1 -1
  53. package/dist/classes/framebuffer.d.ts +10 -1
  54. package/dist/classes/framebuffer.d.ts.map +1 -1
  55. package/dist/classes/framebuffer.js +15 -15
  56. package/dist/classes/framebuffer.js.map +1 -1
  57. package/dist/classes/program-configuration.d.ts +14 -17
  58. package/dist/classes/program-configuration.d.ts.map +1 -1
  59. package/dist/classes/program-configuration.js +10 -97
  60. package/dist/classes/program-configuration.js.map +1 -1
  61. package/dist/classes/program.d.ts +25 -20
  62. package/dist/classes/program.d.ts.map +1 -1
  63. package/dist/classes/program.js +39 -28
  64. package/dist/classes/program.js.map +1 -1
  65. package/dist/classes/query.d.ts.map +1 -1
  66. package/dist/classes/query.js +6 -5
  67. package/dist/classes/query.js.map +1 -1
  68. package/dist/classes/renderbuffer-formats.js +1 -1
  69. package/dist/classes/renderbuffer-formats.js.map +1 -1
  70. package/dist/classes/renderbuffer.d.ts.map +1 -1
  71. package/dist/classes/renderbuffer.js +4 -3
  72. package/dist/classes/renderbuffer.js.map +1 -1
  73. package/dist/classes/{webgl-shader.d.ts → shader.d.ts} +4 -13
  74. package/dist/classes/shader.d.ts.map +1 -0
  75. package/dist/classes/{webgl-shader.js → shader.js} +7 -79
  76. package/dist/classes/shader.js.map +1 -0
  77. package/dist/classes/texture-2d.d.ts +4 -3
  78. package/dist/classes/texture-2d.d.ts.map +1 -1
  79. package/dist/classes/texture-2d.js +5 -8
  80. package/dist/classes/texture-2d.js.map +1 -1
  81. package/dist/classes/texture-3d.d.ts +3 -2
  82. package/dist/classes/texture-3d.d.ts.map +1 -1
  83. package/dist/classes/texture-3d.js +15 -6
  84. package/dist/classes/texture-3d.js.map +1 -1
  85. package/dist/classes/texture-cube.d.ts +2 -1
  86. package/dist/classes/texture-cube.d.ts.map +1 -1
  87. package/dist/classes/texture-cube.js +3 -4
  88. package/dist/classes/texture-cube.js.map +1 -1
  89. package/dist/classes/texture-formats.js +1 -1
  90. package/dist/classes/texture-formats.js.map +1 -1
  91. package/dist/classes/texture.d.ts +14 -9
  92. package/dist/classes/texture.d.ts.map +1 -1
  93. package/dist/classes/texture.js +19 -18
  94. package/dist/classes/texture.js.map +1 -1
  95. package/dist/classes/transform-feedback.d.ts.map +1 -1
  96. package/dist/classes/transform-feedback.js +5 -4
  97. package/dist/classes/transform-feedback.js.map +1 -1
  98. package/dist/classes/uniform-buffer-layout.js +1 -1
  99. package/dist/classes/uniform-buffer-layout.js.map +1 -1
  100. package/dist/classes/uniforms.d.ts +0 -1
  101. package/dist/classes/uniforms.d.ts.map +1 -1
  102. package/dist/classes/uniforms.js +1 -2
  103. package/dist/classes/uniforms.js.map +1 -1
  104. package/dist/classes/vertex-array-object.d.ts +7 -6
  105. package/dist/classes/vertex-array-object.d.ts.map +1 -1
  106. package/dist/classes/vertex-array-object.js +11 -12
  107. package/dist/classes/vertex-array-object.js.map +1 -1
  108. package/dist/classes/vertex-array.d.ts +14 -14
  109. package/dist/classes/vertex-array.d.ts.map +1 -1
  110. package/dist/classes/vertex-array.js +3 -4
  111. package/dist/classes/vertex-array.js.map +1 -1
  112. package/dist/classes/webgl-buffer.d.ts +2 -0
  113. package/dist/classes/webgl-buffer.d.ts.map +1 -1
  114. package/dist/classes/webgl-buffer.js +8 -5
  115. package/dist/classes/webgl-buffer.js.map +1 -1
  116. package/dist/classes/webgl-resource.d.ts +6 -4
  117. package/dist/classes/webgl-resource.d.ts.map +1 -1
  118. package/dist/classes/webgl-resource.js +12 -8
  119. package/dist/classes/webgl-resource.js.map +1 -1
  120. package/dist/context/context/context-state.d.ts +18 -0
  121. package/dist/context/context/context-state.d.ts.map +1 -0
  122. package/dist/context/context/context-state.js +26 -0
  123. package/dist/context/context/context-state.js.map +1 -0
  124. package/dist/context/context/create-context.d.ts +40 -0
  125. package/dist/context/context/create-context.d.ts.map +1 -0
  126. package/dist/context/context/create-context.js +37 -0
  127. package/dist/context/context/create-context.js.map +1 -0
  128. package/dist/context/context/device-pixels.d.ts +25 -0
  129. package/dist/context/context/device-pixels.d.ts.map +1 -0
  130. package/dist/context/context/device-pixels.js +98 -0
  131. package/dist/context/context/device-pixels.js.map +1 -0
  132. package/dist/context/context/get-canvas.d.ts +13 -0
  133. package/dist/context/context/get-canvas.d.ts.map +1 -0
  134. package/dist/context/context/get-canvas.js +31 -0
  135. package/dist/context/context/get-canvas.js.map +1 -0
  136. package/dist/context/context/resize-context.d.ts +20 -0
  137. package/dist/context/context/resize-context.d.ts.map +1 -0
  138. package/dist/context/context/resize-context.js +15 -0
  139. package/dist/context/context/resize-context.js.map +1 -0
  140. package/dist/context/context/webgl-checks.d.ts +13 -0
  141. package/dist/context/context/webgl-checks.d.ts.map +1 -0
  142. package/dist/context/context/webgl-checks.js +34 -0
  143. package/dist/context/context/webgl-checks.js.map +1 -0
  144. package/dist/context/parameters/unified-parameter-api.d.ts +31 -0
  145. package/dist/context/parameters/unified-parameter-api.d.ts.map +1 -0
  146. package/dist/context/parameters/unified-parameter-api.js +65 -0
  147. package/dist/context/parameters/unified-parameter-api.js.map +1 -0
  148. package/dist/context/parameters/webgl-parameter-tables.d.ts +169 -0
  149. package/dist/context/parameters/webgl-parameter-tables.d.ts.map +1 -0
  150. package/dist/context/parameters/webgl-parameter-tables.js +445 -0
  151. package/dist/context/parameters/webgl-parameter-tables.js.map +1 -0
  152. package/dist/context/parameters/webgl-parameters.d.ts +144 -0
  153. package/dist/context/parameters/webgl-parameters.d.ts.map +1 -0
  154. package/dist/context/parameters/webgl-parameters.js +2 -0
  155. package/dist/context/parameters/webgl-parameters.js.map +1 -0
  156. package/dist/context/polyfill/get-parameter-polyfill.d.ts +2 -0
  157. package/dist/context/polyfill/get-parameter-polyfill.d.ts.map +1 -0
  158. package/dist/context/polyfill/get-parameter-polyfill.js +91 -0
  159. package/dist/context/polyfill/get-parameter-polyfill.js.map +1 -0
  160. package/dist/context/polyfill/polyfill-context.d.ts +5 -0
  161. package/dist/context/polyfill/polyfill-context.d.ts.map +1 -0
  162. package/dist/context/polyfill/polyfill-context.js +91 -0
  163. package/dist/context/polyfill/polyfill-context.js.map +1 -0
  164. package/dist/context/polyfill/polyfill-table.d.ts +48 -0
  165. package/dist/context/polyfill/polyfill-table.d.ts.map +1 -0
  166. package/dist/context/polyfill/polyfill-table.js +160 -0
  167. package/dist/context/polyfill/polyfill-table.js.map +1 -0
  168. package/dist/context/polyfill/polyfill-vertex-array-object.d.ts +2 -0
  169. package/dist/context/polyfill/polyfill-vertex-array-object.d.ts.map +1 -0
  170. package/dist/context/polyfill/polyfill-vertex-array-object.js +335 -0
  171. package/dist/context/polyfill/polyfill-vertex-array-object.js.map +1 -0
  172. package/dist/context/state-tracker/deep-array-equal.d.ts +3 -0
  173. package/dist/context/state-tracker/deep-array-equal.d.ts.map +1 -0
  174. package/dist/context/state-tracker/deep-array-equal.js +21 -0
  175. package/dist/context/state-tracker/deep-array-equal.js.map +1 -0
  176. package/dist/context/state-tracker/track-context-state.d.ts +22 -0
  177. package/dist/context/state-tracker/track-context-state.d.ts.map +1 -0
  178. package/dist/context/state-tracker/track-context-state.js +169 -0
  179. package/dist/context/state-tracker/track-context-state.js.map +1 -0
  180. package/dist/context/state-tracker/with-parameters.d.ts +13 -0
  181. package/dist/context/state-tracker/with-parameters.d.ts.map +1 -0
  182. package/dist/context/state-tracker/with-parameters.js +36 -0
  183. package/dist/context/state-tracker/with-parameters.js.map +1 -0
  184. package/dist/debug/debug-uniforms.js +1 -1
  185. package/dist/debug/debug-uniforms.js.map +1 -1
  186. package/dist/debug/debug-vertex-array.js +2 -2
  187. package/dist/debug/debug-vertex-array.js.map +1 -1
  188. package/dist/es5/_deprecated/context-api.js +116 -0
  189. package/dist/es5/_deprecated/context-api.js.map +1 -0
  190. package/dist/es5/_deprecated/features.js +118 -0
  191. package/dist/es5/_deprecated/features.js.map +1 -0
  192. package/dist/es5/adapter/converters/set-device-parameters.js +138 -0
  193. package/dist/es5/adapter/converters/set-device-parameters.js.map +1 -0
  194. package/dist/es5/adapter/converters/webgpu-texture-formats.js +296 -0
  195. package/dist/es5/adapter/converters/webgpu-texture-formats.js.map +1 -0
  196. package/dist/es5/adapter/device-helpers/device-features.js +152 -0
  197. package/dist/es5/adapter/device-helpers/device-features.js.map +1 -0
  198. package/dist/es5/adapter/device-helpers/device-limits.js +64 -0
  199. package/dist/es5/adapter/device-helpers/device-limits.js.map +1 -0
  200. package/dist/es5/adapter/device-helpers/get-device-info.js +55 -0
  201. package/dist/es5/adapter/device-helpers/get-device-info.js.map +1 -0
  202. package/dist/es5/adapter/device-helpers/is-old-ie.js +16 -0
  203. package/dist/es5/adapter/device-helpers/is-old-ie.js.map +1 -0
  204. package/dist/es5/adapter/webgl-device.js +279 -0
  205. package/dist/es5/adapter/webgl-device.js.map +1 -0
  206. package/dist/es5/adapter/webgl-shader.js +155 -0
  207. package/dist/es5/adapter/webgl-shader.js.map +1 -0
  208. package/dist/es5/bundle.js +1 -1
  209. package/dist/es5/bundle.js.map +1 -1
  210. package/dist/es5/classes/accessor.js +104 -74
  211. package/dist/es5/classes/accessor.js.map +1 -1
  212. package/dist/es5/classes/accessor.ts.disabled +1 -1
  213. package/dist/es5/classes/clear.js +55 -34
  214. package/dist/es5/classes/clear.js.map +1 -1
  215. package/dist/es5/classes/copy-and-blit.js +175 -156
  216. package/dist/es5/classes/copy-and-blit.js.map +1 -1
  217. package/dist/es5/classes/framebuffer.js +647 -518
  218. package/dist/es5/classes/framebuffer.js.map +1 -1
  219. package/dist/es5/classes/program-configuration.js +78 -128
  220. package/dist/es5/classes/program-configuration.js.map +1 -1
  221. package/dist/es5/classes/program.js +379 -292
  222. package/dist/es5/classes/program.js.map +1 -1
  223. package/dist/es5/classes/query.js +172 -107
  224. package/dist/es5/classes/query.js.map +1 -1
  225. package/dist/es5/classes/renderbuffer-formats.js +126 -164
  226. package/dist/es5/classes/renderbuffer-formats.js.map +1 -1
  227. package/dist/es5/classes/renderbuffer.js +151 -98
  228. package/dist/es5/classes/renderbuffer.js.map +1 -1
  229. package/dist/es5/classes/shader.js +195 -0
  230. package/dist/es5/classes/shader.js.map +1 -0
  231. package/dist/es5/classes/texture-2d.js +44 -17
  232. package/dist/es5/classes/texture-2d.js.map +1 -1
  233. package/dist/es5/classes/texture-3d.js +107 -48
  234. package/dist/es5/classes/texture-3d.js.map +1 -1
  235. package/dist/es5/classes/texture-cube.js +169 -110
  236. package/dist/es5/classes/texture-cube.js.map +1 -1
  237. package/dist/es5/classes/texture-formats.js +42 -71
  238. package/dist/es5/classes/texture-formats.js.map +1 -1
  239. package/dist/es5/classes/texture.js +780 -665
  240. package/dist/es5/classes/texture.js.map +1 -1
  241. package/dist/es5/classes/transform-feedback.js +206 -150
  242. package/dist/es5/classes/transform-feedback.js.map +1 -1
  243. package/dist/es5/classes/uniform-buffer-layout.js +103 -89
  244. package/dist/es5/classes/uniform-buffer-layout.js.map +1 -1
  245. package/dist/es5/classes/uniforms.js +39 -80
  246. package/dist/es5/classes/uniforms.js.map +1 -1
  247. package/dist/es5/classes/vertex-array-object.js +268 -209
  248. package/dist/es5/classes/vertex-array-object.js.map +1 -1
  249. package/dist/es5/classes/vertex-array.js +348 -303
  250. package/dist/es5/classes/vertex-array.js.map +1 -1
  251. package/dist/es5/classes/webgl-buffer.js +374 -303
  252. package/dist/es5/classes/webgl-buffer.js.map +1 -1
  253. package/dist/es5/classes/webgl-resource.js +231 -161
  254. package/dist/es5/classes/webgl-resource.js.map +1 -1
  255. package/dist/es5/context/context/context-state.js +31 -0
  256. package/dist/es5/context/context/context-state.js.map +1 -0
  257. package/dist/es5/context/context/create-context.js +57 -0
  258. package/dist/es5/context/context/create-context.js.map +1 -0
  259. package/dist/es5/context/context/device-pixels.js +115 -0
  260. package/dist/es5/context/context/device-pixels.js.map +1 -0
  261. package/dist/es5/context/context/get-canvas.js +40 -0
  262. package/dist/es5/context/context/get-canvas.js.map +1 -0
  263. package/dist/es5/context/context/resize-context.js +23 -0
  264. package/dist/es5/context/context/resize-context.js.map +1 -0
  265. package/dist/es5/context/context/webgl-checks.js +54 -0
  266. package/dist/es5/context/context/webgl-checks.js.map +1 -0
  267. package/dist/es5/context/parameters/unified-parameter-api.js +95 -0
  268. package/dist/es5/context/parameters/unified-parameter-api.js.map +1 -0
  269. package/dist/es5/context/parameters/webgl-parameter-tables.js +392 -0
  270. package/dist/es5/context/parameters/webgl-parameter-tables.js.map +1 -0
  271. package/dist/es5/context/parameters/webgl-parameters.js +6 -0
  272. package/dist/es5/context/parameters/webgl-parameters.js.map +1 -0
  273. package/dist/es5/context/polyfill/get-parameter-polyfill.js +81 -0
  274. package/dist/es5/context/polyfill/get-parameter-polyfill.js.map +1 -0
  275. package/dist/es5/context/polyfill/polyfill-context.js +134 -0
  276. package/dist/es5/context/polyfill/polyfill-context.js.map +1 -0
  277. package/dist/es5/context/polyfill/polyfill-table.js +166 -0
  278. package/dist/es5/context/polyfill/polyfill-table.js.map +1 -0
  279. package/dist/es5/context/polyfill/polyfill-vertex-array-object.js +341 -0
  280. package/dist/es5/context/polyfill/polyfill-vertex-array-object.js.map +1 -0
  281. package/dist/es5/context/state-tracker/deep-array-equal.js +28 -0
  282. package/dist/es5/context/state-tracker/deep-array-equal.js.map +1 -0
  283. package/dist/es5/context/state-tracker/track-context-state.js +196 -0
  284. package/dist/es5/context/state-tracker/track-context-state.js.map +1 -0
  285. package/dist/es5/context/state-tracker/with-parameters.js +44 -0
  286. package/dist/es5/context/state-tracker/with-parameters.js.map +1 -0
  287. package/dist/es5/debug/debug-program-configuration.js +48 -20
  288. package/dist/es5/debug/debug-program-configuration.js.map +1 -1
  289. package/dist/es5/debug/debug-uniforms.js +110 -70
  290. package/dist/es5/debug/debug-uniforms.js.map +1 -1
  291. package/dist/es5/debug/debug-vertex-array.js +49 -54
  292. package/dist/es5/debug/debug-vertex-array.js.map +1 -1
  293. package/dist/es5/helpers/get-program-bindings.js +274 -0
  294. package/dist/es5/helpers/get-program-bindings.js.map +1 -0
  295. package/dist/es5/helpers/program-bindings.js +2 -0
  296. package/dist/es5/helpers/program-bindings.js.map +1 -0
  297. package/dist/es5/index.js +268 -192
  298. package/dist/es5/index.js.map +1 -1
  299. package/dist/es5/init.js +18 -14
  300. package/dist/es5/init.js.map +1 -1
  301. package/dist/es5/types/accessor.d.ts +29 -0
  302. package/dist/es5/webgl-utils/attribute-utils.js +74 -87
  303. package/dist/es5/webgl-utils/attribute-utils.js.map +1 -1
  304. package/dist/es5/webgl-utils/constants-to-keys.js +7 -7
  305. package/dist/es5/webgl-utils/constants-to-keys.js.map +1 -1
  306. package/dist/es5/webgl-utils/format-utils.js +4 -4
  307. package/dist/es5/webgl-utils/format-utils.js.map +1 -1
  308. package/dist/es5/webgl-utils/get-error.js +18 -18
  309. package/dist/es5/webgl-utils/get-error.js.map +1 -1
  310. package/dist/es5/webgl-utils/index.js +10 -10
  311. package/dist/es5/webgl-utils/parse-shader-compiler-log.js +53 -25
  312. package/dist/es5/webgl-utils/parse-shader-compiler-log.js.map +1 -1
  313. package/dist/es5/webgl-utils/texture-utils.js +32 -36
  314. package/dist/es5/webgl-utils/texture-utils.js.map +1 -1
  315. package/dist/es5/webgl-utils/typed-array-utils.js +33 -32
  316. package/dist/es5/webgl-utils/typed-array-utils.js.map +1 -1
  317. package/dist/esm/_deprecated/context-api.js +76 -0
  318. package/dist/esm/_deprecated/context-api.js.map +1 -0
  319. package/dist/esm/_deprecated/features.js +111 -0
  320. package/dist/esm/_deprecated/features.js.map +1 -0
  321. package/dist/esm/adapter/converters/set-device-parameters.js +124 -0
  322. package/dist/esm/adapter/converters/set-device-parameters.js.map +1 -0
  323. package/dist/esm/adapter/converters/webgpu-texture-formats.js +285 -0
  324. package/dist/esm/adapter/converters/webgpu-texture-formats.js.map +1 -0
  325. package/dist/esm/adapter/device-helpers/device-features.js +123 -0
  326. package/dist/esm/adapter/device-helpers/device-features.js.map +1 -0
  327. package/dist/esm/adapter/device-helpers/device-limits.js +90 -0
  328. package/dist/esm/adapter/device-helpers/device-limits.js.map +1 -0
  329. package/dist/esm/adapter/device-helpers/get-device-info.js +44 -0
  330. package/dist/esm/adapter/device-helpers/get-device-info.js.map +1 -0
  331. package/dist/{features/check-old-ie.js → esm/adapter/device-helpers/is-old-ie.js} +3 -3
  332. package/dist/esm/adapter/device-helpers/is-old-ie.js.map +1 -0
  333. package/dist/esm/adapter/webgl-device.js +207 -0
  334. package/dist/esm/adapter/webgl-device.js.map +1 -0
  335. package/dist/esm/adapter/webgl-shader.js +82 -0
  336. package/dist/esm/adapter/webgl-shader.js.map +1 -0
  337. package/dist/esm/classes/accessor.js +2 -2
  338. package/dist/esm/classes/accessor.js.map +1 -1
  339. package/dist/esm/classes/accessor.ts.disabled +1 -1
  340. package/dist/esm/classes/clear.js +7 -4
  341. package/dist/esm/classes/clear.js.map +1 -1
  342. package/dist/esm/classes/copy-and-blit.js +30 -25
  343. package/dist/esm/classes/copy-and-blit.js.map +1 -1
  344. package/dist/esm/classes/framebuffer.js +15 -15
  345. package/dist/esm/classes/framebuffer.js.map +1 -1
  346. package/dist/esm/classes/program-configuration.js +10 -97
  347. package/dist/esm/classes/program-configuration.js.map +1 -1
  348. package/dist/esm/classes/program.js +39 -28
  349. package/dist/esm/classes/program.js.map +1 -1
  350. package/dist/esm/classes/query.js +6 -5
  351. package/dist/esm/classes/query.js.map +1 -1
  352. package/dist/esm/classes/renderbuffer-formats.js +1 -1
  353. package/dist/esm/classes/renderbuffer-formats.js.map +1 -1
  354. package/dist/esm/classes/renderbuffer.js +4 -3
  355. package/dist/esm/classes/renderbuffer.js.map +1 -1
  356. package/dist/esm/classes/{webgl-shader.js → shader.js} +7 -79
  357. package/dist/esm/classes/shader.js.map +1 -0
  358. package/dist/esm/classes/texture-2d.js +5 -8
  359. package/dist/esm/classes/texture-2d.js.map +1 -1
  360. package/dist/esm/classes/texture-3d.js +15 -6
  361. package/dist/esm/classes/texture-3d.js.map +1 -1
  362. package/dist/esm/classes/texture-cube.js +3 -4
  363. package/dist/esm/classes/texture-cube.js.map +1 -1
  364. package/dist/esm/classes/texture-formats.js +1 -1
  365. package/dist/esm/classes/texture-formats.js.map +1 -1
  366. package/dist/esm/classes/texture.js +19 -18
  367. package/dist/esm/classes/texture.js.map +1 -1
  368. package/dist/esm/classes/transform-feedback.js +5 -4
  369. package/dist/esm/classes/transform-feedback.js.map +1 -1
  370. package/dist/esm/classes/uniform-buffer-layout.js +1 -1
  371. package/dist/esm/classes/uniform-buffer-layout.js.map +1 -1
  372. package/dist/esm/classes/uniforms.js +1 -2
  373. package/dist/esm/classes/uniforms.js.map +1 -1
  374. package/dist/esm/classes/vertex-array-object.js +11 -12
  375. package/dist/esm/classes/vertex-array-object.js.map +1 -1
  376. package/dist/esm/classes/vertex-array.js +3 -4
  377. package/dist/esm/classes/vertex-array.js.map +1 -1
  378. package/dist/esm/classes/webgl-buffer.js +8 -5
  379. package/dist/esm/classes/webgl-buffer.js.map +1 -1
  380. package/dist/esm/classes/webgl-resource.js +12 -8
  381. package/dist/esm/classes/webgl-resource.js.map +1 -1
  382. package/dist/esm/context/context/context-state.js +26 -0
  383. package/dist/esm/context/context/context-state.js.map +1 -0
  384. package/dist/esm/context/context/create-context.js +37 -0
  385. package/dist/esm/context/context/create-context.js.map +1 -0
  386. package/dist/esm/context/context/device-pixels.js +98 -0
  387. package/dist/esm/context/context/device-pixels.js.map +1 -0
  388. package/dist/esm/context/context/get-canvas.js +31 -0
  389. package/dist/esm/context/context/get-canvas.js.map +1 -0
  390. package/dist/esm/context/context/resize-context.js +15 -0
  391. package/dist/esm/context/context/resize-context.js.map +1 -0
  392. package/dist/esm/context/context/webgl-checks.js +34 -0
  393. package/dist/esm/context/context/webgl-checks.js.map +1 -0
  394. package/dist/esm/context/parameters/unified-parameter-api.js +65 -0
  395. package/dist/esm/context/parameters/unified-parameter-api.js.map +1 -0
  396. package/dist/esm/context/parameters/webgl-parameter-tables.js +445 -0
  397. package/dist/esm/context/parameters/webgl-parameter-tables.js.map +1 -0
  398. package/dist/esm/context/parameters/webgl-parameters.js +2 -0
  399. package/dist/esm/context/parameters/webgl-parameters.js.map +1 -0
  400. package/dist/esm/context/polyfill/get-parameter-polyfill.js +91 -0
  401. package/dist/esm/context/polyfill/get-parameter-polyfill.js.map +1 -0
  402. package/dist/esm/context/polyfill/polyfill-context.js +91 -0
  403. package/dist/esm/context/polyfill/polyfill-context.js.map +1 -0
  404. package/dist/esm/context/polyfill/polyfill-table.js +160 -0
  405. package/dist/esm/context/polyfill/polyfill-table.js.map +1 -0
  406. package/dist/esm/context/polyfill/polyfill-vertex-array-object.js +335 -0
  407. package/dist/esm/context/polyfill/polyfill-vertex-array-object.js.map +1 -0
  408. package/dist/esm/context/state-tracker/deep-array-equal.js +21 -0
  409. package/dist/esm/context/state-tracker/deep-array-equal.js.map +1 -0
  410. package/dist/esm/context/state-tracker/track-context-state.js +169 -0
  411. package/dist/esm/context/state-tracker/track-context-state.js.map +1 -0
  412. package/dist/esm/context/state-tracker/with-parameters.js +36 -0
  413. package/dist/esm/context/state-tracker/with-parameters.js.map +1 -0
  414. package/dist/esm/debug/debug-uniforms.js +1 -1
  415. package/dist/esm/debug/debug-uniforms.js.map +1 -1
  416. package/dist/esm/debug/debug-vertex-array.js +2 -2
  417. package/dist/esm/debug/debug-vertex-array.js.map +1 -1
  418. package/dist/esm/helpers/get-program-bindings.js +228 -0
  419. package/dist/esm/helpers/get-program-bindings.js.map +1 -0
  420. package/dist/esm/helpers/program-bindings.js +2 -0
  421. package/dist/esm/helpers/program-bindings.js.map +1 -0
  422. package/dist/esm/index.js +26 -20
  423. package/dist/esm/index.js.map +1 -1
  424. package/dist/esm/init.js +11 -8
  425. package/dist/esm/init.js.map +1 -1
  426. package/dist/esm/types/accessor.d.ts +29 -0
  427. package/dist/esm/webgl-utils/attribute-utils.js +1 -1
  428. package/dist/esm/webgl-utils/attribute-utils.js.map +1 -1
  429. package/dist/esm/webgl-utils/constants-to-keys.js +1 -1
  430. package/dist/esm/webgl-utils/constants-to-keys.js.map +1 -1
  431. package/dist/esm/webgl-utils/format-utils.js +1 -1
  432. package/dist/esm/webgl-utils/format-utils.js.map +1 -1
  433. package/dist/esm/webgl-utils/texture-utils.js +2 -2
  434. package/dist/esm/webgl-utils/texture-utils.js.map +1 -1
  435. package/dist/esm/webgl-utils/typed-array-utils.js +22 -18
  436. package/dist/esm/webgl-utils/typed-array-utils.js.map +1 -1
  437. package/dist/helpers/get-program-bindings.d.ts +8 -0
  438. package/dist/helpers/get-program-bindings.d.ts.map +1 -0
  439. package/dist/helpers/get-program-bindings.js +228 -0
  440. package/dist/helpers/get-program-bindings.js.map +1 -0
  441. package/dist/helpers/program-bindings.d.ts +41 -0
  442. package/dist/helpers/program-bindings.d.ts.map +1 -0
  443. package/dist/helpers/program-bindings.js +2 -0
  444. package/dist/helpers/program-bindings.js.map +1 -0
  445. package/dist/index.d.ts +41 -20
  446. package/dist/index.d.ts.map +1 -1
  447. package/dist/index.js +26 -20
  448. package/dist/index.js.map +1 -1
  449. package/dist/init.d.ts.map +1 -1
  450. package/dist/init.js +11 -8
  451. package/dist/init.js.map +1 -1
  452. package/dist/types/accessor.d.ts +29 -0
  453. package/dist/webgl-utils/attribute-utils.d.ts +1 -1
  454. package/dist/webgl-utils/attribute-utils.js +1 -1
  455. package/dist/webgl-utils/attribute-utils.js.map +1 -1
  456. package/dist/webgl-utils/constants-to-keys.js +1 -1
  457. package/dist/webgl-utils/constants-to-keys.js.map +1 -1
  458. package/dist/webgl-utils/format-utils.d.ts +2 -2
  459. package/dist/webgl-utils/format-utils.js +1 -1
  460. package/dist/webgl-utils/format-utils.js.map +1 -1
  461. package/dist/webgl-utils/texture-utils.d.ts +12 -8
  462. package/dist/webgl-utils/texture-utils.d.ts.map +1 -1
  463. package/dist/webgl-utils/texture-utils.js +2 -2
  464. package/dist/webgl-utils/texture-utils.js.map +1 -1
  465. package/dist/webgl-utils/typed-array-utils.d.ts +39 -32
  466. package/dist/webgl-utils/typed-array-utils.d.ts.map +1 -1
  467. package/dist/webgl-utils/typed-array-utils.js +22 -18
  468. package/dist/webgl-utils/typed-array-utils.js.map +1 -1
  469. package/package.json +5 -6
  470. package/src/.DS_Store +0 -0
  471. package/src/_deprecated/context-api.ts +146 -0
  472. package/src/_deprecated/features.ts +159 -0
  473. package/src/adapter/converters/set-device-parameters.ts +182 -0
  474. package/src/adapter/converters/webgpu-texture-formats.ts +167 -0
  475. package/src/adapter/device-helpers/device-features.ts +227 -0
  476. package/src/adapter/device-helpers/device-limits.ts +150 -0
  477. package/src/adapter/device-helpers/get-device-info.ts +49 -0
  478. package/src/{features/check-old-ie.ts → adapter/device-helpers/is-old-ie.ts} +3 -3
  479. package/src/adapter/webgl-device.ts +399 -0
  480. package/src/adapter/webgl-shader.ts +84 -0
  481. package/src/classes/accessor.js +2 -2
  482. package/src/classes/accessor.ts.disabled +1 -1
  483. package/src/classes/clear.ts +9 -4
  484. package/src/classes/copy-and-blit.ts +49 -52
  485. package/src/classes/framebuffer.ts +38 -35
  486. package/src/classes/program-configuration.ts +28 -81
  487. package/src/classes/program.ts +89 -75
  488. package/src/classes/query.ts +6 -6
  489. package/src/classes/renderbuffer-formats.ts +1 -1
  490. package/src/classes/renderbuffer.ts +5 -4
  491. package/src/classes/{webgl-shader.ts → shader.ts} +7 -78
  492. package/src/classes/texture-2d.ts +6 -11
  493. package/src/classes/texture-3d.ts +16 -11
  494. package/src/classes/texture-cube.ts +7 -7
  495. package/src/classes/texture-formats.ts +1 -1
  496. package/src/classes/texture.ts +39 -40
  497. package/src/classes/transform-feedback.ts +14 -13
  498. package/src/classes/uniform-buffer-layout.ts +1 -1
  499. package/src/classes/uniforms.ts +4 -10
  500. package/src/classes/vertex-array-object.ts +17 -20
  501. package/src/classes/vertex-array.ts +16 -11
  502. package/src/classes/webgl-buffer.ts +7 -5
  503. package/src/classes/webgl-resource.ts +20 -18
  504. package/src/context/context/context-state.ts +39 -0
  505. package/src/context/context/create-context.ts +83 -0
  506. package/src/context/context/device-pixels.ts +147 -0
  507. package/src/context/context/get-canvas.ts +37 -0
  508. package/src/context/context/resize-context.ts +37 -0
  509. package/src/context/context/webgl-checks.ts +49 -0
  510. package/src/context/parameters/unified-parameter-api.ts +128 -0
  511. package/src/context/parameters/webgl-parameter-tables.ts +625 -0
  512. package/src/context/parameters/webgl-parameters.ts +197 -0
  513. package/src/context/polyfill/get-parameter-polyfill.ts +118 -0
  514. package/src/context/polyfill/polyfill-context.ts +98 -0
  515. package/src/context/polyfill/polyfill-table.ts +162 -0
  516. package/src/context/polyfill/polyfill-vertex-array-object.ts +360 -0
  517. package/src/context/state-tracker/deep-array-equal.ts +20 -0
  518. package/src/context/state-tracker/track-context-state.ts +250 -0
  519. package/src/context/state-tracker/with-parameters.ts +50 -0
  520. package/src/debug/debug-uniforms.ts +1 -1
  521. package/src/debug/debug-vertex-array.ts +2 -4
  522. package/src/helpers/get-program-bindings.ts +244 -0
  523. package/src/helpers/program-bindings.ts +46 -0
  524. package/src/index.ts +94 -23
  525. package/src/init.ts +12 -9
  526. package/src/types/accessor.d.ts +29 -0
  527. package/src/types.ts +1 -1
  528. package/src/webgl-utils/attribute-utils.ts +1 -1
  529. package/src/webgl-utils/constants-to-keys.ts +1 -1
  530. package/src/webgl-utils/format-utils.ts +1 -1
  531. package/src/webgl-utils/{texture-utils.js → texture-utils.ts} +13 -10
  532. package/src/webgl-utils/{typed-array-utils.js → typed-array-utils.ts} +59 -16
  533. package/dist/classes/webgl-shader.d.ts.map +0 -1
  534. package/dist/classes/webgl-shader.js.map +0 -1
  535. package/dist/context/gl-context.d.ts +0 -15
  536. package/dist/context/gl-context.d.ts.map +0 -1
  537. package/dist/context/gl-context.js +0 -32
  538. package/dist/context/gl-context.js.map +0 -1
  539. package/dist/context/luma-context-data.d.ts +0 -31
  540. package/dist/context/luma-context-data.d.ts.map +0 -1
  541. package/dist/context/luma-context-data.js +0 -5
  542. package/dist/context/luma-context-data.js.map +0 -1
  543. package/dist/es5/classes/webgl-shader.js +0 -213
  544. package/dist/es5/classes/webgl-shader.js.map +0 -1
  545. package/dist/es5/context/gl-context.js +0 -46
  546. package/dist/es5/context/gl-context.js.map +0 -1
  547. package/dist/es5/context/luma-context-data.js +0 -12
  548. package/dist/es5/context/luma-context-data.js.map +0 -1
  549. package/dist/es5/features/check-glsl-extension.js +0 -40
  550. package/dist/es5/features/check-glsl-extension.js.map +0 -1
  551. package/dist/es5/features/check-old-ie.js +0 -15
  552. package/dist/es5/features/check-old-ie.js.map +0 -1
  553. package/dist/es5/features/features.js +0 -85
  554. package/dist/es5/features/features.js.map +0 -1
  555. package/dist/es5/features/index.js +0 -64
  556. package/dist/es5/features/index.js.map +0 -1
  557. package/dist/es5/features/limits.js +0 -72
  558. package/dist/es5/features/limits.js.map +0 -1
  559. package/dist/es5/features/webgl-features-table.js +0 -84
  560. package/dist/es5/features/webgl-features-table.js.map +0 -1
  561. package/dist/es5/features/webgl-limits-table.js +0 -172
  562. package/dist/es5/features/webgl-limits-table.js.map +0 -1
  563. package/dist/es5/utils/array-utils-flat.js +0 -50
  564. package/dist/es5/utils/array-utils-flat.js.map +0 -1
  565. package/dist/es5/utils/assert.js +0 -13
  566. package/dist/es5/utils/assert.js.map +0 -1
  567. package/dist/es5/utils/check-props.js +0 -50
  568. package/dist/es5/utils/check-props.js.map +0 -1
  569. package/dist/es5/utils/format-value.js +0 -57
  570. package/dist/es5/utils/format-value.js.map +0 -1
  571. package/dist/es5/utils/index.js +0 -68
  572. package/dist/es5/utils/index.js.map +0 -1
  573. package/dist/es5/utils/is-old-ie.js +0 -13
  574. package/dist/es5/utils/is-old-ie.js.map +0 -1
  575. package/dist/es5/utils/load-file.js +0 -43
  576. package/dist/es5/utils/load-file.js.map +0 -1
  577. package/dist/es5/utils/stub-methods.js +0 -25
  578. package/dist/es5/utils/stub-methods.js.map +0 -1
  579. package/dist/es5/utils/utils.js +0 -31
  580. package/dist/es5/utils/utils.js.map +0 -1
  581. package/dist/es5/webgl-utils/texture-utils.d.ts +0 -11
  582. package/dist/es5/webgl-utils/typed-array-utils.d.ts +0 -36
  583. package/dist/esm/classes/webgl-shader.js.map +0 -1
  584. package/dist/esm/context/gl-context.js +0 -32
  585. package/dist/esm/context/gl-context.js.map +0 -1
  586. package/dist/esm/context/luma-context-data.js +0 -5
  587. package/dist/esm/context/luma-context-data.js.map +0 -1
  588. package/dist/esm/features/check-glsl-extension.js +0 -27
  589. package/dist/esm/features/check-glsl-extension.js.map +0 -1
  590. package/dist/esm/features/check-old-ie.js.map +0 -1
  591. package/dist/esm/features/features.js +0 -67
  592. package/dist/esm/features/features.js.map +0 -1
  593. package/dist/esm/features/index.js +0 -5
  594. package/dist/esm/features/index.js.map +0 -1
  595. package/dist/esm/features/limits.js +0 -55
  596. package/dist/esm/features/limits.js.map +0 -1
  597. package/dist/esm/features/webgl-features-table.js +0 -71
  598. package/dist/esm/features/webgl-features-table.js.map +0 -1
  599. package/dist/esm/features/webgl-limits-table.js +0 -161
  600. package/dist/esm/features/webgl-limits-table.js.map +0 -1
  601. package/dist/esm/utils/array-utils-flat.js +0 -39
  602. package/dist/esm/utils/array-utils-flat.js.map +0 -1
  603. package/dist/esm/utils/assert.js +0 -6
  604. package/dist/esm/utils/assert.js.map +0 -1
  605. package/dist/esm/utils/check-props.js +0 -38
  606. package/dist/esm/utils/check-props.js.map +0 -1
  607. package/dist/esm/utils/format-value.js +0 -50
  608. package/dist/esm/utils/format-value.js.map +0 -1
  609. package/dist/esm/utils/index.js +0 -7
  610. package/dist/esm/utils/index.js.map +0 -1
  611. package/dist/esm/utils/is-old-ie.js +0 -5
  612. package/dist/esm/utils/is-old-ie.js.map +0 -1
  613. package/dist/esm/utils/load-file.js +0 -30
  614. package/dist/esm/utils/load-file.js.map +0 -1
  615. package/dist/esm/utils/stub-methods.js +0 -16
  616. package/dist/esm/utils/stub-methods.js.map +0 -1
  617. package/dist/esm/utils/utils.js +0 -20
  618. package/dist/esm/utils/utils.js.map +0 -1
  619. package/dist/esm/webgl-utils/texture-utils.d.ts +0 -11
  620. package/dist/esm/webgl-utils/typed-array-utils.d.ts +0 -36
  621. package/dist/features/check-glsl-extension.d.ts +0 -2
  622. package/dist/features/check-glsl-extension.d.ts.map +0 -1
  623. package/dist/features/check-glsl-extension.js +0 -27
  624. package/dist/features/check-glsl-extension.js.map +0 -1
  625. package/dist/features/check-old-ie.d.ts +0 -2
  626. package/dist/features/check-old-ie.d.ts.map +0 -1
  627. package/dist/features/check-old-ie.js.map +0 -1
  628. package/dist/features/features.d.ts +0 -6
  629. package/dist/features/features.d.ts.map +0 -1
  630. package/dist/features/features.js +0 -67
  631. package/dist/features/features.js.map +0 -1
  632. package/dist/features/index.d.ts +0 -5
  633. package/dist/features/index.d.ts.map +0 -1
  634. package/dist/features/index.js +0 -5
  635. package/dist/features/index.js.map +0 -1
  636. package/dist/features/limits.d.ts +0 -28
  637. package/dist/features/limits.d.ts.map +0 -1
  638. package/dist/features/limits.js +0 -55
  639. package/dist/features/limits.js.map +0 -1
  640. package/dist/features/webgl-features-table.d.ts.map +0 -1
  641. package/dist/features/webgl-features-table.js +0 -71
  642. package/dist/features/webgl-features-table.js.map +0 -1
  643. package/dist/features/webgl-limits-table.d.ts +0 -161
  644. package/dist/features/webgl-limits-table.d.ts.map +0 -1
  645. package/dist/features/webgl-limits-table.js +0 -161
  646. package/dist/features/webgl-limits-table.js.map +0 -1
  647. package/dist/utils/array-utils-flat.d.ts +0 -9
  648. package/dist/utils/array-utils-flat.d.ts.map +0 -1
  649. package/dist/utils/array-utils-flat.js +0 -39
  650. package/dist/utils/array-utils-flat.js.map +0 -1
  651. package/dist/utils/assert.d.ts +0 -2
  652. package/dist/utils/assert.d.ts.map +0 -1
  653. package/dist/utils/assert.js +0 -6
  654. package/dist/utils/assert.js.map +0 -1
  655. package/dist/utils/check-props.d.ts +0 -2
  656. package/dist/utils/check-props.d.ts.map +0 -1
  657. package/dist/utils/check-props.js +0 -38
  658. package/dist/utils/check-props.js.map +0 -1
  659. package/dist/utils/format-value.d.ts +0 -5
  660. package/dist/utils/format-value.d.ts.map +0 -1
  661. package/dist/utils/format-value.js +0 -50
  662. package/dist/utils/format-value.js.map +0 -1
  663. package/dist/utils/index.d.ts +0 -7
  664. package/dist/utils/index.d.ts.map +0 -1
  665. package/dist/utils/index.js +0 -7
  666. package/dist/utils/index.js.map +0 -1
  667. package/dist/utils/is-old-ie.d.ts +0 -4
  668. package/dist/utils/is-old-ie.d.ts.map +0 -1
  669. package/dist/utils/is-old-ie.js +0 -5
  670. package/dist/utils/is-old-ie.js.map +0 -1
  671. package/dist/utils/load-file.d.ts +0 -4
  672. package/dist/utils/load-file.d.ts.map +0 -1
  673. package/dist/utils/load-file.js +0 -30
  674. package/dist/utils/load-file.js.map +0 -1
  675. package/dist/utils/stub-methods.d.ts +0 -2
  676. package/dist/utils/stub-methods.d.ts.map +0 -1
  677. package/dist/utils/stub-methods.js +0 -16
  678. package/dist/utils/stub-methods.js.map +0 -1
  679. package/dist/utils/utils.d.ts +0 -15
  680. package/dist/utils/utils.d.ts.map +0 -1
  681. package/dist/utils/utils.js +0 -20
  682. package/dist/utils/utils.js.map +0 -1
  683. package/src/context/gl-context.ts +0 -31
  684. package/src/context/luma-context-data.ts +0 -27
  685. package/src/features/check-glsl-extension.ts +0 -34
  686. package/src/features/features.ts +0 -80
  687. package/src/features/index.ts +0 -5
  688. package/src/features/limits.ts +0 -66
  689. package/src/features/webgl-features-table.ts +0 -104
  690. package/src/features/webgl-limits-table.ts +0 -51
  691. package/src/utils/array-utils-flat.ts +0 -56
  692. package/src/utils/assert.ts +0 -7
  693. package/src/utils/check-props.ts +0 -68
  694. package/src/utils/format-value.ts +0 -37
  695. package/src/utils/index.ts +0 -6
  696. package/src/utils/is-old-ie.ts +0 -6
  697. package/src/utils/load-file.ts +0 -40
  698. package/src/utils/stub-methods.ts +0 -20
  699. package/src/utils/utils.ts +0 -35
  700. package/src/webgl-utils/texture-utils.d.ts +0 -11
  701. package/src/webgl-utils/typed-array-utils.d.ts +0 -36
@@ -5,61 +5,61 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  Object.defineProperty(exports, "requestAnimationFrame", {
7
7
  enumerable: true,
8
- get: function () {
8
+ get: function get() {
9
9
  return _requestAnimationFrame.requestAnimationFrame;
10
10
  }
11
11
  });
12
12
  Object.defineProperty(exports, "cancelAnimationFrame", {
13
13
  enumerable: true,
14
- get: function () {
14
+ get: function get() {
15
15
  return _requestAnimationFrame.cancelAnimationFrame;
16
16
  }
17
17
  });
18
18
  Object.defineProperty(exports, "getGLTypeFromTypedArray", {
19
19
  enumerable: true,
20
- get: function () {
20
+ get: function get() {
21
21
  return _typedArrayUtils.getGLTypeFromTypedArray;
22
22
  }
23
23
  });
24
24
  Object.defineProperty(exports, "getTypedArrayFromGLType", {
25
25
  enumerable: true,
26
- get: function () {
26
+ get: function get() {
27
27
  return _typedArrayUtils.getTypedArrayFromGLType;
28
28
  }
29
29
  });
30
30
  Object.defineProperty(exports, "flipRows", {
31
31
  enumerable: true,
32
- get: function () {
32
+ get: function get() {
33
33
  return _typedArrayUtils.flipRows;
34
34
  }
35
35
  });
36
36
  Object.defineProperty(exports, "scalePixels", {
37
37
  enumerable: true,
38
- get: function () {
38
+ get: function get() {
39
39
  return _typedArrayUtils.scalePixels;
40
40
  }
41
41
  });
42
42
  Object.defineProperty(exports, "getKeyValue", {
43
43
  enumerable: true,
44
- get: function () {
44
+ get: function get() {
45
45
  return _constantsToKeys.getKeyValue;
46
46
  }
47
47
  });
48
48
  Object.defineProperty(exports, "getKey", {
49
49
  enumerable: true,
50
- get: function () {
50
+ get: function get() {
51
51
  return _constantsToKeys.getKey;
52
52
  }
53
53
  });
54
54
  Object.defineProperty(exports, "getKeyType", {
55
55
  enumerable: true,
56
- get: function () {
56
+ get: function get() {
57
57
  return _constantsToKeys.getKeyType;
58
58
  }
59
59
  });
60
60
  Object.defineProperty(exports, "cloneTextureFrom", {
61
61
  enumerable: true,
62
- get: function () {
62
+ get: function get() {
63
63
  return _textureUtils.cloneTextureFrom;
64
64
  }
65
65
  });
@@ -1,42 +1,70 @@
1
1
  "use strict";
2
2
 
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
3
5
  Object.defineProperty(exports, "__esModule", {
4
6
  value: true
5
7
  });
6
8
  exports.parseShaderCompilerLog = parseShaderCompilerLog;
7
- const MESSAGE_TYPES = ['warning', 'error', 'info'];
9
+
10
+ var _toArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toArray"));
11
+
12
+ function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
13
+
14
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
15
+
16
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
17
+
18
+ var MESSAGE_TYPES = ['warning', 'error', 'info'];
8
19
 
9
20
  function parseShaderCompilerLog(errLog) {
10
- const lines = errLog.split(/\r?\n/);
11
- const messages = [];
21
+ var lines = errLog.split(/\r?\n/);
22
+ var messages = [];
12
23
 
13
- for (const line of lines) {
14
- if (line.length <= 1) {
15
- continue;
16
- }
24
+ var _iterator = _createForOfIteratorHelper(lines),
25
+ _step;
17
26
 
18
- const segments = line.split(':');
19
- const [messageType, linePosition, lineNumber, ...rest] = segments;
20
- let lineNum = parseInt(lineNumber, 10);
27
+ try {
28
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
29
+ var line = _step.value;
21
30
 
22
- if (isNaN(lineNum)) {
23
- lineNum = 0;
24
- }
31
+ if (line.length <= 1) {
32
+ continue;
33
+ }
25
34
 
26
- let linePos = parseInt(linePosition, 10);
35
+ var segments = line.split(':');
27
36
 
28
- if (isNaN(linePos)) {
29
- linePos = 0;
30
- }
37
+ var _segments = (0, _toArray2.default)(segments),
38
+ messageType = _segments[0],
39
+ linePosition = _segments[1],
40
+ lineNumber = _segments[2],
41
+ rest = _segments.slice(3);
42
+
43
+ var lineNum = parseInt(lineNumber, 10);
44
+
45
+ if (isNaN(lineNum)) {
46
+ lineNum = 0;
47
+ }
31
48
 
32
- const lowerCaseType = messageType.toLowerCase();
33
- const type = MESSAGE_TYPES.includes(lowerCaseType) ? lowerCaseType : 'info';
34
- messages.push({
35
- message: rest.join(':').trim(),
36
- type,
37
- lineNum,
38
- linePos
39
- });
49
+ var linePos = parseInt(linePosition, 10);
50
+
51
+ if (isNaN(linePos)) {
52
+ linePos = 0;
53
+ }
54
+
55
+ var lowerCaseType = messageType.toLowerCase();
56
+ var type = MESSAGE_TYPES.includes(lowerCaseType) ? lowerCaseType : 'info';
57
+ messages.push({
58
+ message: rest.join(':').trim(),
59
+ type: type,
60
+ lineNum: lineNum,
61
+ linePos: linePos
62
+ });
63
+ }
64
+ } catch (err) {
65
+ _iterator.e(err);
66
+ } finally {
67
+ _iterator.f();
40
68
  }
41
69
 
42
70
  return messages;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/webgl-utils/parse-shader-compiler-log.ts"],"names":["MESSAGE_TYPES","parseShaderCompilerLog","errLog","lines","split","messages","line","length","segments","messageType","linePosition","lineNumber","rest","lineNum","parseInt","isNaN","linePos","lowerCaseType","toLowerCase","type","includes","push","message","join","trim"],"mappings":";;;;;;AAGA,MAAMA,aAAa,GAAG,CAAC,SAAD,EAAY,OAAZ,EAAqB,MAArB,CAAtB;;AAOO,SAASC,sBAAT,CAAgCC,MAAhC,EAA6E;AAElF,QAAMC,KAAK,GAAGD,MAAM,CAACE,KAAP,CAAa,OAAb,CAAd;AAEA,QAAMC,QAA2B,GAAG,EAApC;;AAEA,OAAK,MAAMC,IAAX,IAAmBH,KAAnB,EAA0B;AACxB,QAAIG,IAAI,CAACC,MAAL,IAAe,CAAnB,EAAsB;AACpB;AACD;;AAED,UAAMC,QAAkB,GAAGF,IAAI,CAACF,KAAL,CAAW,GAAX,CAA3B;AACA,UAAM,CAACK,WAAD,EAAcC,YAAd,EAA4BC,UAA5B,EAAwC,GAAGC,IAA3C,IAAmDJ,QAAzD;AAEA,QAAIK,OAAO,GAAGC,QAAQ,CAACH,UAAD,EAAa,EAAb,CAAtB;;AACA,QAAII,KAAK,CAACF,OAAD,CAAT,EAAoB;AAClBA,MAAAA,OAAO,GAAG,CAAV;AACD;;AAED,QAAIG,OAAO,GAAGF,QAAQ,CAACJ,YAAD,EAAe,EAAf,CAAtB;;AACA,QAAIK,KAAK,CAACC,OAAD,CAAT,EAAoB;AAClBA,MAAAA,OAAO,GAAG,CAAV;AACD;;AAGD,UAAMC,aAAa,GAAGR,WAAW,CAACS,WAAZ,EAAtB;AACA,UAAMC,IAAI,GAAInB,aAAa,CAACoB,QAAd,CAAuBH,aAAvB,IAAwCA,aAAxC,GAAwD,MAAtE;AAEAZ,IAAAA,QAAQ,CAACgB,IAAT,CAAc;AACZC,MAAAA,OAAO,EAAEV,IAAI,CAACW,IAAL,CAAU,GAAV,EAAeC,IAAf,EADG;AAEZL,MAAAA,IAFY;AAGZN,MAAAA,OAHY;AAIZG,MAAAA;AAJY,KAAd;AAMD;;AAED,SAAOX,QAAP;AACD","sourcesContent":["// luma.gl, MIT license\nimport type {CompilerMessage} from '@luma.gl/shadertools';\n\nconst MESSAGE_TYPES = ['warning', 'error', 'info'];\n\n/**\n * Parse a WebGL-format GLSL compilation log into an array of WebGPU style message records.\n * This follows documented WebGL conventions for compilation logs.\n * Based on https://github.com/wwwtyro/gl-format-compiler-error (public domain)\n */\nexport function parseShaderCompilerLog(errLog: string) : readonly CompilerMessage[] {\n // Parse the error - note: browser and driver dependent\n const lines = errLog.split(/\\r?\\n/);\n\n const messages: CompilerMessage[] = [];\n\n for (const line of lines) {\n if (line.length <= 1) {\n continue;\n }\n\n const segments: string[] = line.split(':');\n const [messageType, linePosition, lineNumber, ...rest] = segments;\n\n let lineNum = parseInt(lineNumber, 10);\n if (isNaN(lineNum)) {\n lineNum = 0;\n }\n\n let linePos = parseInt(linePosition, 10);\n if (isNaN(linePos)) {\n linePos = 0;\n }\n\n // Ensure supported type\n const lowerCaseType = messageType.toLowerCase();\n const type = (MESSAGE_TYPES.includes(lowerCaseType) ? lowerCaseType : 'info') as 'warning' | 'error' | 'info';\n\n messages.push({\n message: rest.join(':').trim(),\n type,\n lineNum,\n linePos // TODO\n })\n }\n\n return messages;\n}\n"],"file":"parse-shader-compiler-log.js"}
1
+ {"version":3,"sources":["../../../src/webgl-utils/parse-shader-compiler-log.ts"],"names":["MESSAGE_TYPES","parseShaderCompilerLog","errLog","lines","split","messages","line","length","segments","messageType","linePosition","lineNumber","rest","lineNum","parseInt","isNaN","linePos","lowerCaseType","toLowerCase","type","includes","push","message","join","trim"],"mappings":";;;;;;;;;;;;;;;;;AAGA,IAAMA,aAAa,GAAG,CAAC,SAAD,EAAY,OAAZ,EAAqB,MAArB,CAAtB;;AAOO,SAASC,sBAAT,CAAgCC,MAAhC,EAA6E;AAElF,MAAMC,KAAK,GAAGD,MAAM,CAACE,KAAP,CAAa,OAAb,CAAd;AAEA,MAAMC,QAA2B,GAAG,EAApC;;AAJkF,6CAM/DF,KAN+D;AAAA;;AAAA;AAMlF,wDAA0B;AAAA,UAAfG,IAAe;;AACxB,UAAIA,IAAI,CAACC,MAAL,IAAe,CAAnB,EAAsB;AACpB;AACD;;AAED,UAAMC,QAAkB,GAAGF,IAAI,CAACF,KAAL,CAAW,GAAX,CAA3B;;AACA,6CAAyDI,QAAzD;AAAA,UAAOC,WAAP;AAAA,UAAoBC,YAApB;AAAA,UAAkCC,UAAlC;AAAA,UAAiDC,IAAjD;;AAEA,UAAIC,OAAO,GAAGC,QAAQ,CAACH,UAAD,EAAa,EAAb,CAAtB;;AACA,UAAII,KAAK,CAACF,OAAD,CAAT,EAAoB;AAClBA,QAAAA,OAAO,GAAG,CAAV;AACD;;AAED,UAAIG,OAAO,GAAGF,QAAQ,CAACJ,YAAD,EAAe,EAAf,CAAtB;;AACA,UAAIK,KAAK,CAACC,OAAD,CAAT,EAAoB;AAClBA,QAAAA,OAAO,GAAG,CAAV;AACD;;AAGD,UAAMC,aAAa,GAAGR,WAAW,CAACS,WAAZ,EAAtB;AACA,UAAMC,IAAI,GAAInB,aAAa,CAACoB,QAAd,CAAuBH,aAAvB,IAAwCA,aAAxC,GAAwD,MAAtE;AAEAZ,MAAAA,QAAQ,CAACgB,IAAT,CAAc;AACZC,QAAAA,OAAO,EAAEV,IAAI,CAACW,IAAL,CAAU,GAAV,EAAeC,IAAf,EADG;AAEZL,QAAAA,IAAI,EAAJA,IAFY;AAGZN,QAAAA,OAAO,EAAPA,OAHY;AAIZG,QAAAA,OAAO,EAAPA;AAJY,OAAd;AAMD;AAlCiF;AAAA;AAAA;AAAA;AAAA;;AAoClF,SAAOX,QAAP;AACD","sourcesContent":["// luma.gl, MIT license\nimport type {CompilerMessage} from '@luma.gl/shadertools';\n\nconst MESSAGE_TYPES = ['warning', 'error', 'info'];\n\n/**\n * Parse a WebGL-format GLSL compilation log into an array of WebGPU style message records.\n * This follows documented WebGL conventions for compilation logs.\n * Based on https://github.com/wwwtyro/gl-format-compiler-error (public domain)\n */\nexport function parseShaderCompilerLog(errLog: string) : readonly CompilerMessage[] {\n // Parse the error - note: browser and driver dependent\n const lines = errLog.split(/\\r?\\n/);\n\n const messages: CompilerMessage[] = [];\n\n for (const line of lines) {\n if (line.length <= 1) {\n continue;\n }\n\n const segments: string[] = line.split(':');\n const [messageType, linePosition, lineNumber, ...rest] = segments;\n\n let lineNum = parseInt(lineNumber, 10);\n if (isNaN(lineNum)) {\n lineNum = 0;\n }\n\n let linePos = parseInt(linePosition, 10);\n if (isNaN(linePos)) {\n linePos = 0;\n }\n\n // Ensure supported type\n const lowerCaseType = messageType.toLowerCase();\n const type = (MESSAGE_TYPES.includes(lowerCaseType) ? lowerCaseType : 'info') as 'warning' | 'error' | 'info';\n\n messages.push({\n message: rest.join(':').trim(),\n type,\n lineNum,\n linePos // TODO\n })\n }\n\n return messages;\n}\n"],"file":"parse-shader-compiler-log.js"}
@@ -8,6 +8,12 @@ Object.defineProperty(exports, "__esModule", {
8
8
  exports.cloneTextureFrom = cloneTextureFrom;
9
9
  exports.toFramebuffer = toFramebuffer;
10
10
 
11
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
12
+
13
+ var _api = require("@luma.gl/api");
14
+
15
+ var _constants = _interopRequireDefault(require("@luma.gl/constants"));
16
+
11
17
  var _texture2d = _interopRequireDefault(require("../classes/texture-2d"));
12
18
 
13
19
  var _textureCube = _interopRequireDefault(require("../classes/texture-cube"));
@@ -16,49 +22,39 @@ var _texture3d = _interopRequireDefault(require("../classes/texture-3d"));
16
22
 
17
23
  var _framebuffer = _interopRequireDefault(require("../classes/framebuffer"));
18
24
 
19
- var _constants = _interopRequireDefault(require("@luma.gl/constants"));
20
-
21
- var _utils = require("../utils");
22
-
23
25
  function cloneTextureFrom(refTexture, overrides) {
24
- (0, _utils.assert)(refTexture instanceof _texture2d.default || refTexture instanceof _textureCube.default || refTexture instanceof _texture3d.default);
25
- const TextureType = refTexture.constructor;
26
- const {
27
- gl,
28
- width,
29
- height,
30
- format,
31
- type,
32
- dataFormat,
33
- border,
34
- mipmaps
35
- } = refTexture;
36
- const textureOptions = Object.assign({
37
- width,
38
- height,
39
- format,
40
- type,
41
- dataFormat,
42
- border,
43
- mipmaps
26
+ (0, _api.assert)(refTexture instanceof _texture2d.default || refTexture instanceof _textureCube.default || refTexture instanceof _texture3d.default);
27
+ var TextureType = refTexture.constructor;
28
+ var gl = refTexture.gl,
29
+ width = refTexture.width,
30
+ height = refTexture.height,
31
+ format = refTexture.format,
32
+ type = refTexture.type,
33
+ dataFormat = refTexture.dataFormat,
34
+ border = refTexture.border,
35
+ mipmaps = refTexture.mipmaps;
36
+ var textureOptions = Object.assign({
37
+ width: width,
38
+ height: height,
39
+ format: format,
40
+ type: type,
41
+ dataFormat: dataFormat,
42
+ border: border,
43
+ mipmaps: mipmaps
44
44
  }, overrides);
45
45
  return new TextureType(gl, textureOptions);
46
46
  }
47
47
 
48
48
  function toFramebuffer(texture, opts) {
49
- const {
50
- gl,
51
- width,
52
- height,
53
- id
54
- } = texture;
55
- const framebuffer = new _framebuffer.default(gl, Object.assign({}, opts, {
49
+ var gl = texture.gl,
50
+ width = texture.width,
51
+ height = texture.height,
52
+ id = texture.id;
53
+ var framebuffer = new _framebuffer.default(gl, Object.assign({}, opts, {
56
54
  id: "framebuffer-for-".concat(id),
57
- width,
58
- height,
59
- attachments: {
60
- [_constants.default.COLOR_ATTACHMENT0]: texture
61
- }
55
+ width: width,
56
+ height: height,
57
+ attachments: (0, _defineProperty2.default)({}, _constants.default.COLOR_ATTACHMENT0, texture)
62
58
  }));
63
59
  return framebuffer;
64
60
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/webgl-utils/texture-utils.js"],"names":["cloneTextureFrom","refTexture","overrides","Texture2D","TextureCube","Texture3D","TextureType","constructor","gl","width","height","format","type","dataFormat","border","mipmaps","textureOptions","Object","assign","toFramebuffer","texture","opts","id","framebuffer","Framebuffer","attachments","GL","COLOR_ATTACHMENT0"],"mappings":";;;;;;;;;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAIO,SAASA,gBAAT,CAA0BC,UAA1B,EAAsCC,SAAtC,EAAiD;AACtD,qBACED,UAAU,YAAYE,kBAAtB,IACEF,UAAU,YAAYG,oBADxB,IAEEH,UAAU,YAAYI,kBAH1B;AAMA,QAAMC,WAAW,GAAGL,UAAU,CAACM,WAA/B;AAEA,QAAM;AAACC,IAAAA,EAAD;AAAKC,IAAAA,KAAL;AAAYC,IAAAA,MAAZ;AAAoBC,IAAAA,MAApB;AAA4BC,IAAAA,IAA5B;AAAkCC,IAAAA,UAAlC;AAA8CC,IAAAA,MAA9C;AAAsDC,IAAAA;AAAtD,MAAiEd,UAAvE;AAEA,QAAMe,cAAc,GAAGC,MAAM,CAACC,MAAP,CACrB;AACET,IAAAA,KADF;AAEEC,IAAAA,MAFF;AAGEC,IAAAA,MAHF;AAIEC,IAAAA,IAJF;AAKEC,IAAAA,UALF;AAMEC,IAAAA,MANF;AAOEC,IAAAA;AAPF,GADqB,EAUrBb,SAVqB,CAAvB;AAeA,SAAO,IAAII,WAAJ,CAAgBE,EAAhB,EAAoBQ,cAApB,CAAP;AACD;;AAKM,SAASG,aAAT,CAAuBC,OAAvB,EAAgCC,IAAhC,EAAsC;AAC3C,QAAM;AAACb,IAAAA,EAAD;AAAKC,IAAAA,KAAL;AAAYC,IAAAA,MAAZ;AAAoBY,IAAAA;AAApB,MAA0BF,OAAhC;AACA,QAAMG,WAAW,GAAG,IAAIC,oBAAJ,CAClBhB,EADkB,EAElBS,MAAM,CAACC,MAAP,CAAc,EAAd,EAAkBG,IAAlB,EAAwB;AACtBC,IAAAA,EAAE,4BAAqBA,EAArB,CADoB;AAEtBb,IAAAA,KAFsB;AAGtBC,IAAAA,MAHsB;AAItBe,IAAAA,WAAW,EAAE;AACX,OAACC,mBAAGC,iBAAJ,GAAwBP;AADb;AAJS,GAAxB,CAFkB,CAApB;AAWA,SAAOG,WAAP;AACD","sourcesContent":["// TODO: Two subdirectories must not depend on each other (classes vs utils)!\nimport Texture2D from '../classes/texture-2d';\nimport TextureCube from '../classes/texture-cube';\nimport Texture3D from '../classes/texture-3d';\nimport Framebuffer from '../classes/framebuffer';\nimport GL from '@luma.gl/constants';\nimport {assert} from '../utils';\n\n// Clone a new texture object from a reference texture object.\n/** @type {import('./texture-utils').cloneTextureFrom} */\nexport function cloneTextureFrom(refTexture, overrides) {\n assert(\n refTexture instanceof Texture2D ||\n refTexture instanceof TextureCube ||\n refTexture instanceof Texture3D\n );\n\n const TextureType = refTexture.constructor;\n\n const {gl, width, height, format, type, dataFormat, border, mipmaps} = refTexture;\n\n const textureOptions = Object.assign(\n {\n width,\n height,\n format,\n type,\n dataFormat,\n border,\n mipmaps\n },\n overrides\n );\n\n // TODO: move this to `Texture` class as instance method and use this.constructor\n // @ts-expect-error\n return new TextureType(gl, textureOptions);\n}\n\n// Wraps a given texture into a framebuffer object, that can be further used\n// to read data from the texture object.\n/** @type {import('./texture-utils').toFramebuffer} */\nexport function toFramebuffer(texture, opts) {\n const {gl, width, height, id} = texture;\n const framebuffer = new Framebuffer(\n gl,\n Object.assign({}, opts, {\n id: `framebuffer-for-${id}`,\n width,\n height,\n attachments: {\n [GL.COLOR_ATTACHMENT0]: texture\n }\n })\n );\n return framebuffer;\n}\n"],"file":"texture-utils.js"}
1
+ {"version":3,"sources":["../../../src/webgl-utils/texture-utils.ts"],"names":["cloneTextureFrom","refTexture","overrides","Texture2D","TextureCube","Texture3D","TextureType","constructor","gl","width","height","format","type","dataFormat","border","mipmaps","textureOptions","Object","assign","toFramebuffer","texture","opts","id","framebuffer","Framebuffer","attachments","GL","COLOR_ATTACHMENT0"],"mappings":";;;;;;;;;;;;AACA;;AACA;;AAEA;;AACA;;AACA;;AACA;;AAKO,SAASA,gBAAT,CAAiDC,UAAjD,EAAgEC,SAAhE,EAAoF;AACzF,mBACED,UAAU,YAAYE,kBAAtB,IACEF,UAAU,YAAYG,oBADxB,IAEEH,UAAU,YAAYI,kBAH1B;AAMA,MAAMC,WAAW,GAAGL,UAAU,CAACM,WAA/B;AAEA,MAAOC,EAAP,GAAuEP,UAAvE,CAAOO,EAAP;AAAA,MAAWC,KAAX,GAAuER,UAAvE,CAAWQ,KAAX;AAAA,MAAkBC,MAAlB,GAAuET,UAAvE,CAAkBS,MAAlB;AAAA,MAA0BC,MAA1B,GAAuEV,UAAvE,CAA0BU,MAA1B;AAAA,MAAkCC,IAAlC,GAAuEX,UAAvE,CAAkCW,IAAlC;AAAA,MAAwCC,UAAxC,GAAuEZ,UAAvE,CAAwCY,UAAxC;AAAA,MAAoDC,MAApD,GAAuEb,UAAvE,CAAoDa,MAApD;AAAA,MAA4DC,OAA5D,GAAuEd,UAAvE,CAA4Dc,OAA5D;AAEA,MAAMC,cAAc,GAAGC,MAAM,CAACC,MAAP,CACrB;AACET,IAAAA,KAAK,EAALA,KADF;AAEEC,IAAAA,MAAM,EAANA,MAFF;AAGEC,IAAAA,MAAM,EAANA,MAHF;AAIEC,IAAAA,IAAI,EAAJA,IAJF;AAKEC,IAAAA,UAAU,EAAVA,UALF;AAMEC,IAAAA,MAAM,EAANA,MANF;AAOEC,IAAAA,OAAO,EAAPA;AAPF,GADqB,EAUrBb,SAVqB,CAAvB;AAeA,SAAO,IAAII,WAAJ,CAAgBE,EAAhB,EAAoBQ,cAApB,CAAP;AACD;;AAMM,SAASG,aAAT,CAAuBC,OAAvB,EAAyCC,IAAzC,EAA+E;AACpF,MAAOb,EAAP,GAAgCY,OAAhC,CAAOZ,EAAP;AAAA,MAAWC,KAAX,GAAgCW,OAAhC,CAAWX,KAAX;AAAA,MAAkBC,MAAlB,GAAgCU,OAAhC,CAAkBV,MAAlB;AAAA,MAA0BY,EAA1B,GAAgCF,OAAhC,CAA0BE,EAA1B;AACA,MAAMC,WAAW,GAAG,IAAIC,oBAAJ,CAClBhB,EADkB,EAElBS,MAAM,CAACC,MAAP,CAAc,EAAd,EAAkBG,IAAlB,EAAwB;AACtBC,IAAAA,EAAE,4BAAqBA,EAArB,CADoB;AAEtBb,IAAAA,KAAK,EAALA,KAFsB;AAGtBC,IAAAA,MAAM,EAANA,MAHsB;AAItBe,IAAAA,WAAW,oCACRC,mBAAGC,iBADK,EACeP,OADf;AAJW,GAAxB,CAFkB,CAApB;AAWA,SAAOG,WAAP;AACD","sourcesContent":["// TODO: Two subdirectories must not depend on each other (classes vs utils)!\nimport {assert} from '@luma.gl/api';\nimport GL from '@luma.gl/constants';\nimport Texture from '../classes/texture';\nimport Texture2D from '../classes/texture-2d';\nimport TextureCube from '../classes/texture-cube';\nimport Texture3D from '../classes/texture-3d';\nimport Framebuffer, {FramebufferProps} from '../classes/framebuffer';\n\ntype TextureType = Texture2D | TextureCube | Texture3D;\n\n/** Clone a new texture object from a reference texture object. */\nexport function cloneTextureFrom<T extends TextureType>(refTexture: T, overrides?: any): T {\n assert(\n refTexture instanceof Texture2D ||\n refTexture instanceof TextureCube ||\n refTexture instanceof Texture3D\n );\n\n const TextureType = refTexture.constructor;\n\n const {gl, width, height, format, type, dataFormat, border, mipmaps} = refTexture;\n\n const textureOptions = Object.assign(\n {\n width,\n height,\n format,\n type,\n dataFormat,\n border,\n mipmaps\n },\n overrides\n );\n\n // TODO: move this to `Texture` class as instance method and use this.constructor\n // @ts-expect-error\n return new TextureType(gl, textureOptions);\n}\n\n/**\n * Wraps a given texture into a framebuffer object, that can be further used\n * to read data from the texture object.\n */ \nexport function toFramebuffer(texture: Texture, opts?: FramebufferProps): Framebuffer {\n const {gl, width, height, id} = texture;\n const framebuffer = new Framebuffer(\n gl,\n Object.assign({}, opts, {\n id: `framebuffer-for-${id}`,\n width,\n height,\n attachments: {\n [GL.COLOR_ATTACHMENT0]: texture\n }\n })\n );\n return framebuffer;\n}\n"],"file":"texture-utils.js"}
@@ -12,10 +12,10 @@ exports.scalePixels = scalePixels;
12
12
 
13
13
  var _constants = _interopRequireDefault(require("@luma.gl/constants"));
14
14
 
15
- const ERR_TYPE_DEDUCTION = 'Failed to deduce GL constant from typed array';
15
+ var ERR_TYPE_DEDUCTION = 'Failed to deduce GL constant from typed array';
16
16
 
17
17
  function getGLTypeFromTypedArray(arrayOrType) {
18
- const type = ArrayBuffer.isView(arrayOrType) ? arrayOrType.constructor : arrayOrType;
18
+ var type = ArrayBuffer.isView(arrayOrType) ? arrayOrType.constructor : arrayOrType;
19
19
 
20
20
  switch (type) {
21
21
  case Float32Array:
@@ -47,9 +47,11 @@ function getGLTypeFromTypedArray(arrayOrType) {
47
47
  }
48
48
  }
49
49
 
50
- function getTypedArrayFromGLType(glType, {
51
- clamped = true
52
- } = {}) {
50
+ function getTypedArrayFromGLType(glType, options) {
51
+ var _ref = options || {},
52
+ _ref$clamped = _ref.clamped,
53
+ clamped = _ref$clamped === void 0 ? true : _ref$clamped;
54
+
53
55
  switch (glType) {
54
56
  case _constants.default.FLOAT:
55
57
  return Float32Array;
@@ -80,37 +82,36 @@ function getTypedArrayFromGLType(glType, {
80
82
  }
81
83
  }
82
84
 
83
- function flipRows({
84
- data,
85
- width,
86
- height,
87
- bytesPerPixel = 4,
88
- temp
89
- }) {
90
- const bytesPerRow = width * bytesPerPixel;
91
- temp = temp || new Uint8Array(bytesPerRow);
92
-
93
- for (let y = 0; y < height / 2; ++y) {
94
- const topOffset = y * bytesPerRow;
95
- const bottomOffset = (height - y - 1) * bytesPerRow;
96
- temp.set(data.subarray(topOffset, topOffset + bytesPerRow));
85
+ function flipRows(options) {
86
+ var data = options.data,
87
+ width = options.width,
88
+ height = options.height,
89
+ _options$bytesPerPixe = options.bytesPerPixel,
90
+ bytesPerPixel = _options$bytesPerPixe === void 0 ? 4 : _options$bytesPerPixe,
91
+ temp = options.temp;
92
+ var bytesPerRow = width * bytesPerPixel;
93
+ var tempBuffer = temp || new Uint8Array(bytesPerRow);
94
+
95
+ for (var y = 0; y < height / 2; ++y) {
96
+ var topOffset = y * bytesPerRow;
97
+ var bottomOffset = (height - y - 1) * bytesPerRow;
98
+ tempBuffer.set(data.subarray(topOffset, topOffset + bytesPerRow));
97
99
  data.copyWithin(topOffset, bottomOffset, bottomOffset + bytesPerRow);
98
- data.set(temp, bottomOffset);
100
+ data.set(tempBuffer, bottomOffset);
99
101
  }
100
102
  }
101
103
 
102
- function scalePixels({
103
- data,
104
- width,
105
- height
106
- }) {
107
- const newWidth = Math.round(width / 2);
108
- const newHeight = Math.round(height / 2);
109
- const newData = new Uint8Array(newWidth * newHeight * 4);
110
-
111
- for (let y = 0; y < newHeight; y++) {
112
- for (let x = 0; x < newWidth; x++) {
113
- for (let c = 0; c < 4; c++) {
104
+ function scalePixels(options) {
105
+ var data = options.data,
106
+ width = options.width,
107
+ height = options.height;
108
+ var newWidth = Math.round(width / 2);
109
+ var newHeight = Math.round(height / 2);
110
+ var newData = new Uint8Array(newWidth * newHeight * 4);
111
+
112
+ for (var y = 0; y < newHeight; y++) {
113
+ for (var x = 0; x < newWidth; x++) {
114
+ for (var c = 0; c < 4; c++) {
114
115
  newData[(y * newWidth + x) * 4 + c] = data[(y * 2 * width + x * 2) * 4 + c];
115
116
  }
116
117
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/webgl-utils/typed-array-utils.js"],"names":["ERR_TYPE_DEDUCTION","getGLTypeFromTypedArray","arrayOrType","type","ArrayBuffer","isView","constructor","Float32Array","GL","FLOAT","Uint16Array","UNSIGNED_SHORT","Uint32Array","UNSIGNED_INT","Uint8Array","UNSIGNED_BYTE","Uint8ClampedArray","Int8Array","BYTE","Int16Array","SHORT","Int32Array","INT","Error","getTypedArrayFromGLType","glType","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","y","topOffset","bottomOffset","set","subarray","copyWithin","scalePixels","newWidth","Math","round","newHeight","newData","x","c"],"mappings":"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","sourcesContent":["import GL from '@luma.gl/constants';\n\nconst ERR_TYPE_DEDUCTION = 'Failed to deduce GL constant from typed array';\n\n// Converts TYPED ARRAYS to corresponding GL constant\n// Used to auto deduce gl parameter types\nexport function getGLTypeFromTypedArray(arrayOrType) {\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// Converts GL constant to corresponding TYPED ARRAY\n// Used to auto deduce gl parameter types\n\n/* eslint-disable complexity */\nexport function getTypedArrayFromGLType(glType, {clamped = true} = {}) {\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/* eslint-enable complexity */\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\nexport function flipRows({data, width, height, bytesPerPixel = 4, temp}) {\n const bytesPerRow = width * bytesPerPixel;\n\n // make a temp buffer to hold one row\n temp = 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 temp.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(temp, bottomOffset);\n }\n}\n\nexport function scalePixels({data, width, height}) {\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,"sources":["../../../src/webgl-utils/typed-array-utils.ts"],"names":["ERR_TYPE_DEDUCTION","getGLTypeFromTypedArray","arrayOrType","type","ArrayBuffer","isView","constructor","Float32Array","GL","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":"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","sourcesContent":["import GL from '@luma.gl/constants';\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) {\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"}
@@ -0,0 +1,76 @@
1
+ import GL from '@luma.gl/constants';
2
+ import { WebGLDevice } from '@luma.gl/webgl';
3
+ import { DEPRECATED_FEATURES } from './features';
4
+ export function createGLContext(options) {
5
+ const webglDevice = new WebGLDevice(options);
6
+ return webglDevice.gl;
7
+ }
8
+ export function instrumentGLContext(gl, options) {
9
+ const webglDevice = WebGLDevice.attach(gl, options);
10
+ return webglDevice.gl;
11
+ }
12
+ export function resizeGLContext(gl, options) {
13
+ const webglDevice = WebGLDevice.attach(gl);
14
+ webglDevice.resize(options);
15
+ }
16
+ export function hasFeatures(gl, features) {
17
+ const webglDevice = WebGLDevice.attach(gl);
18
+ const normalizedFeatures = Array.isArray(features) ? features : [features];
19
+ const deviceFeatures = normalizedFeatures.map(feature => classicToDeviceFeature(feature));
20
+ return deviceFeatures.every(feature => webglDevice.features.has(feature));
21
+ }
22
+
23
+ function classicToDeviceFeature(feature) {
24
+ const deviceFeature = feature.toLowerCase().replace(/\_/g, '-');
25
+
26
+ if (deviceFeature.startsWith('webgl2') || deviceFeature.startsWith('glsl-')) {
27
+ return deviceFeature;
28
+ }
29
+
30
+ return "webgl-".concat(deviceFeature);
31
+ }
32
+
33
+ export function hasFeature(gl, feature) {
34
+ return hasFeatures(gl, feature);
35
+ }
36
+ export function getFeatures(gl) {
37
+ const webglDevice = WebGLDevice.attach(gl);
38
+ const featureMap = {};
39
+
40
+ for (const feature in DEPRECATED_FEATURES) {
41
+ featureMap[feature] = webglDevice.features.has(classicToDeviceFeature(feature));
42
+ }
43
+
44
+ return featureMap;
45
+ }
46
+ export function getContextDebugInfo(gl) {
47
+ const webglDevice = WebGLDevice.attach(gl);
48
+ const info = webglDevice.info;
49
+ return { ...webglDevice.info,
50
+ vendorMasked: webglDevice.info.vendor,
51
+ rendererMasked: webglDevice.info.renderer
52
+ };
53
+ }
54
+ export function getGLContextInfo(gl) {
55
+ const info = getContextDebugInfo(gl);
56
+ return {
57
+ [GL.UNMASKED_VENDOR_WEBGL]: info.vendor,
58
+ [GL.UNMASKED_RENDERER_WEBGL]: info.renderer,
59
+ [GL.VENDOR]: info.vendorMasked,
60
+ [GL.RENDERER]: info.rendererMasked,
61
+ [GL.VERSION]: info.version
62
+ };
63
+ }
64
+ export function getContextInfo(gl) {
65
+ return { ...getContextDebugInfo(gl),
66
+ ...getContextLimits(gl),
67
+ info: getGLContextInfo(gl)
68
+ };
69
+ }
70
+ export function getContextLimits(gl) {
71
+ const webglDevice = WebGLDevice.attach(gl);
72
+ return {
73
+ limits: webglDevice.webglLimits
74
+ };
75
+ }
76
+ //# sourceMappingURL=context-api.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/_deprecated/context-api.ts"],"names":["GL","WebGLDevice","DEPRECATED_FEATURES","createGLContext","options","webglDevice","gl","instrumentGLContext","attach","resizeGLContext","resize","hasFeatures","features","normalizedFeatures","Array","isArray","deviceFeatures","map","feature","classicToDeviceFeature","every","has","deviceFeature","toLowerCase","replace","startsWith","hasFeature","getFeatures","featureMap","getContextDebugInfo","info","vendorMasked","vendor","rendererMasked","renderer","getGLContextInfo","UNMASKED_VENDOR_WEBGL","UNMASKED_RENDERER_WEBGL","VENDOR","RENDERER","VERSION","version","getContextInfo","getContextLimits","limits","webglLimits"],"mappings":"AAKA,OAAOA,EAAP,MAAe,oBAAf;AACA,SAAQC,WAAR,QAA4C,gBAA5C;AACA,SAAQC,mBAAR,QAAkC,YAAlC;AAOA,OAAO,SAASC,eAAT,CAAyBC,OAAzB,EAAmF;AACxF,QAAMC,WAAW,GAAG,IAAIJ,WAAJ,CAAgBG,OAAhB,CAApB;AAEA,SAAOC,WAAW,CAACC,EAAnB;AACD;AAGD,OAAO,SAASC,mBAAT,CACLD,EADK,EAELF,OAFK,EAGkB;AACvB,QAAMC,WAAW,GAAGJ,WAAW,CAACO,MAAZ,CAAmBF,EAAnB,EAAuBF,OAAvB,CAApB;AACA,SAAOC,WAAW,CAACC,EAAnB;AACD;AAiBD,OAAO,SAASG,eAAT,CACLH,EADK,EAELF,OAFK,EAOL;AACA,QAAMC,WAAW,GAAGJ,WAAW,CAACO,MAAZ,CAAmBF,EAAnB,CAApB;AACAD,EAAAA,WAAW,CAACK,MAAZ,CAAmBN,OAAnB;AACD;AAMD,OAAO,SAASO,WAAT,CAAqBL,EAArB,EAAgDM,QAAhD,EAAsF;AAC3F,QAAMP,WAAW,GAAGJ,WAAW,CAACO,MAAZ,CAAmBF,EAAnB,CAApB;AACA,QAAMO,kBAAkB,GAAGC,KAAK,CAACC,OAAN,CAAcH,QAAd,IAA0BA,QAA1B,GAAqC,CAACA,QAAD,CAAhE;AACA,QAAMI,cAAc,GAAGH,kBAAkB,CAACI,GAAnB,CAAuBC,OAAO,IAAIC,sBAAsB,CAACD,OAAD,CAAxD,CAAvB;AAEA,SAAOF,cAAc,CAACI,KAAf,CAAsBF,OAAD,IAAab,WAAW,CAACO,QAAZ,CAAqBS,GAArB,CAAyBH,OAAzB,CAAlC,CAAP;AACD;;AAED,SAASC,sBAAT,CAAgCD,OAAhC,EAAyD;AACvD,QAAMI,aAAa,GAAGJ,OAAO,CAACK,WAAR,GAAsBC,OAAtB,CAA8B,KAA9B,EAAqC,GAArC,CAAtB;;AACA,MAAIF,aAAa,CAACG,UAAd,CAAyB,QAAzB,KAAsCH,aAAa,CAACG,UAAd,CAAyB,OAAzB,CAA1C,EAA6E;AAC3E,WAAOH,aAAP;AACD;;AACD,yBAAgBA,aAAhB;AACD;;AAMD,OAAO,SAASI,UAAT,CAAoBpB,EAApB,EAA+CY,OAA/C,EAAyE;AAC9E,SAAOP,WAAW,CAACL,EAAD,EAAKY,OAAL,CAAlB;AACD;AAMD,OAAO,SAASS,WAAT,CAAqBrB,EAArB,EAA0E;AAC/E,QAAMD,WAAW,GAAGJ,WAAW,CAACO,MAAZ,CAAmBF,EAAnB,CAApB;AACA,QAAMsB,UAAmC,GAAG,EAA5C;;AACA,OAAK,MAAMV,OAAX,IAAsBhB,mBAAtB,EAA2C;AAEzC0B,IAAAA,UAAU,CAACV,OAAD,CAAV,GAAsBb,WAAW,CAACO,QAAZ,CAAqBS,GAArB,CAAyBF,sBAAsB,CAACD,OAAD,CAA/C,CAAtB;AACD;;AACD,SAAOU,UAAP;AACD;AAQD,OAAO,SAASC,mBAAT,CAA6BvB,EAA7B,EAML;AACA,QAAMD,WAAW,GAAGJ,WAAW,CAACO,MAAZ,CAAmBF,EAAnB,CAApB;AACA,QAAMwB,IAAI,GAAGzB,WAAW,CAACyB,IAAzB;AACA,SAAO,EACL,GAAGzB,WAAW,CAACyB,IADV;AAELC,IAAAA,YAAY,EAAE1B,WAAW,CAACyB,IAAZ,CAAiBE,MAF1B;AAGLC,IAAAA,cAAc,EAAE5B,WAAW,CAACyB,IAAZ,CAAiBI;AAH5B,GAAP;AAKD;AAGD,OAAO,SAASC,gBAAT,CAA0B7B,EAA1B,EAA8B;AACnC,QAAMwB,IAAI,GAAGD,mBAAmB,CAACvB,EAAD,CAAhC;AACA,SAAO;AACL,KAACN,EAAE,CAACoC,qBAAJ,GAA4BN,IAAI,CAACE,MAD5B;AAEL,KAAChC,EAAE,CAACqC,uBAAJ,GAA8BP,IAAI,CAACI,QAF9B;AAGL,KAAClC,EAAE,CAACsC,MAAJ,GAAaR,IAAI,CAACC,YAHb;AAIL,KAAC/B,EAAE,CAACuC,QAAJ,GAAeT,IAAI,CAACG,cAJf;AAKL,KAACjC,EAAE,CAACwC,OAAJ,GAAcV,IAAI,CAACW;AALd,GAAP;AAOD;AAGD,OAAO,SAASC,cAAT,CAAwBpC,EAAxB,EAA4B;AACjC,SAAO,EACL,GAAGuB,mBAAmB,CAACvB,EAAD,CADjB;AAEL,OAAGqC,gBAAgB,CAACrC,EAAD,CAFd;AAGLwB,IAAAA,IAAI,EAAEK,gBAAgB,CAAC7B,EAAD;AAHjB,GAAP;AAKD;AAGD,OAAO,SAASqC,gBAAT,CAA0BrC,EAA1B,EAA8B;AACnC,QAAMD,WAAW,GAAGJ,WAAW,CAACO,MAAZ,CAAmBF,EAAnB,CAApB;AACA,SAAO;AAACsC,IAAAA,MAAM,EAAEvC,WAAW,CAACwC;AAArB,GAAP;AACD","sourcesContent":["// luma.gl, MIT license\n// LEGACY luma.gl v8 API for WebGLRendering context\n// DEPRECATED API - may be removed in luma.gl v9 or v10.\n\n/* eslint-disable quotes */\nimport GL from '@luma.gl/constants';\nimport {WebGLDevice, WebGLDeviceProps} from '@luma.gl/webgl';\nimport {DEPRECATED_FEATURES} from './features';\n\nexport type GLContextOptions = WebGLDeviceProps & {\n throwOnError?: boolean; // If set to false, return `null` if context creation fails.\n};\n\n/** @deprecated Use `new WebGLDevice()` or `luma.createDevice()` */\nexport function createGLContext(options?: GLContextOptions): WebGLRenderingContext | null {\n const webglDevice = new WebGLDevice(options);\n // Note: OK to return the context, it holds on to the device\n return webglDevice.gl;\n}\n\n/** @deprecated Use `WebGLDevice.attach()` */\nexport function instrumentGLContext(\n gl: WebGLRenderingContext | WebGL2RenderingContext,\n options?: GLContextOptions\n): WebGLRenderingContext {\n const webglDevice = WebGLDevice.attach(gl, options);\n return webglDevice.gl;\n}\n\n/**\n * Resize the canvas' drawing buffer.\n *\n * Can match the canvas CSS size, and optionally also consider devicePixelRatio\n * Can be called every frame\n *\n * Regardless of size, the drawing buffer will always be scaled to the viewport, but\n * for best visual results, usually set to either:\n * canvas CSS width x canvas CSS height\n * canvas CSS width * devicePixelRatio x canvas CSS height * devicePixelRatio\n * See http://webgl2fundamentals.org/webgl/lessons/webgl-resizing-the-canvas.html\n *\n * resizeGLContext(gl, {width, height, useDevicePixels})\n * @deprecated Use WebGLDevice.resize()\n */\nexport function resizeGLContext(\n gl: WebGLRenderingContext,\n options?: {\n width?: number;\n height?: number;\n useDevicePixels?: boolean | number;\n }\n) {\n const webglDevice = WebGLDevice.attach(gl);\n webglDevice.resize(options);\n}\n\n/** \n * Check one or more features\n * @deprecated Use `WebGLDevice.features.has()`\n*/\nexport function hasFeatures(gl: WebGLRenderingContext, features: string | string[]): boolean {\n const webglDevice = WebGLDevice.attach(gl);\n const normalizedFeatures = Array.isArray(features) ? features : [features];\n const deviceFeatures = normalizedFeatures.map(feature => classicToDeviceFeature(feature));\n // @ts-expect-error Feature is a string enum\n return deviceFeatures.every((feature) => webglDevice.features.has(feature));\n}\n\nfunction classicToDeviceFeature(feature: string): string {\n const deviceFeature = feature.toLowerCase().replace(/\\_/g, '-');\n if (deviceFeature.startsWith('webgl2') || deviceFeature.startsWith('glsl-')) {\n return deviceFeature;\n }\n return `webgl-${deviceFeature}`;\n}\n\n/**\n * Check one feature\n * @deprecated Use `WebGLDevice.features`\n */\nexport function hasFeature(gl: WebGLRenderingContext, feature: string): boolean {\n return hasFeatures(gl, feature);\n}\n\n/**\n * Return a map of supported features\n * @deprecated Use `WebGLDevice.features`\n */\nexport function getFeatures(gl: WebGLRenderingContext): Record<string, boolean> {\n const webglDevice = WebGLDevice.attach(gl);\n const featureMap: Record<string, boolean> = {};\n for (const feature in DEPRECATED_FEATURES) {\n // @ts-expect-error Feature is a string enum\n featureMap[feature] = webglDevice.features.has(classicToDeviceFeature(feature));\n }\n return featureMap;\n}\n\n/**\n * Provides strings identifying the GPU vendor and driver.\n * https://www.khronos.org/registry/webgl/extensions/WEBGL_debug_renderer_info/\n *\n * @deprecated Use `WebGLDevice.info`\n */\nexport function getContextDebugInfo(gl: WebGLRenderingContext): {\n vendor: string;\n renderer: string;\n vendorMasked: string;\n rendererMasked: string;\n version: string;\n} {\n const webglDevice = WebGLDevice.attach(gl);\n const info = webglDevice.info;\n return {\n ...webglDevice.info,\n vendorMasked: webglDevice.info.vendor,\n rendererMasked: webglDevice.info.renderer\n };\n}\n\n/** @deprecated Use `WebGLDevice.info` */\nexport function getGLContextInfo(gl) {\n const info = getContextDebugInfo(gl);\n return {\n [GL.UNMASKED_VENDOR_WEBGL]: info.vendor,\n [GL.UNMASKED_RENDERER_WEBGL]: info.renderer,\n [GL.VENDOR]: info.vendorMasked,\n [GL.RENDERER]: info.rendererMasked,\n [GL.VERSION]: info.version,\n };\n}\n\n/** @deprecated Use `WebGLDevice.info` and `WebGLDevice.limits` */\nexport function getContextInfo(gl) {\n return {\n ...getContextDebugInfo(gl),\n ...getContextLimits(gl),\n info: getGLContextInfo(gl),\n };\n}\n\n/** @deprecated Use `WebGLDevice.limits` */\nexport function getContextLimits(gl) {\n const webglDevice = WebGLDevice.attach(gl);\n return {limits: webglDevice.webglLimits};\n}\n"],"file":"context-api.js"}
@@ -0,0 +1,111 @@
1
+ import GL from '@luma.gl/constants';
2
+ import { isWebGL2 } from '@luma.gl/webgl';
3
+ import { assert } from '@luma.gl/api';
4
+ export const DEPRECATED_FEATURES = {
5
+ WEBGL2: 'WEBGL2',
6
+ VERTEX_ARRAY_OBJECT: 'VERTEX_ARRAY_OBJECT',
7
+ TIMER_QUERY: 'TIMER_QUERY',
8
+ INSTANCED_RENDERING: 'INSTANCED_RENDERING',
9
+ MULTIPLE_RENDER_TARGETS: 'MULTIPLE_RENDER_TARGETS',
10
+ ELEMENT_INDEX_UINT32: 'ELEMENT_INDEX_UINT32',
11
+ BLEND_EQUATION_MINMAX: 'BLEND_EQUATION_MINMAX',
12
+ FLOAT_BLEND: 'FLOAT_BLEND',
13
+ COLOR_ENCODING_SRGB: 'COLOR_ENCODING_SRGB',
14
+ TEXTURE_DEPTH: 'TEXTURE_DEPTH',
15
+ TEXTURE_FLOAT: 'TEXTURE_FLOAT',
16
+ TEXTURE_HALF_FLOAT: 'TEXTURE_HALF_FLOAT',
17
+ TEXTURE_FILTER_LINEAR_FLOAT: 'TEXTURE_FILTER_LINEAR_FLOAT',
18
+ TEXTURE_FILTER_LINEAR_HALF_FLOAT: 'TEXTURE_FILTER_LINEAR_HALF_FLOAT',
19
+ TEXTURE_FILTER_ANISOTROPIC: 'TEXTURE_FILTER_ANISOTROPIC',
20
+ COLOR_ATTACHMENT_RGBA32F: 'COLOR_ATTACHMENT_RGBA32F',
21
+ COLOR_ATTACHMENT_FLOAT: 'COLOR_ATTACHMENT_FLOAT',
22
+ COLOR_ATTACHMENT_HALF_FLOAT: 'COLOR_ATTACHMENT_HALF_FLOAT',
23
+ GLSL_FRAG_DATA: 'GLSL_FRAG_DATA',
24
+ GLSL_FRAG_DEPTH: 'GLSL_FRAG_DEPTH',
25
+ GLSL_DERIVATIVES: 'GLSL_DERIVATIVES',
26
+ GLSL_TEXTURE_LOD: 'GLSL_TEXTURE_LOD'
27
+ };
28
+ export function getWebGLFeatures(gl) {
29
+ gl.getExtension('EXT_color_buffer_float');
30
+ gl.getExtension('WEBGL_color_buffer_float');
31
+ gl.getExtension('EXT_float_blend');
32
+ const features = new Set();
33
+
34
+ for (const feature in WEBGL_FEATURES) {
35
+ if (isFeatureSupported(gl, feature)) {
36
+ features.add(feature);
37
+ }
38
+ }
39
+
40
+ return features;
41
+ }
42
+
43
+ function isFeatureSupported(gl, cap) {
44
+ const feature = WEBGL_FEATURES[cap];
45
+ assert(feature, cap);
46
+ const [webgl1Feature, webgl2Feature] = feature;
47
+ const featureDefinition = isWebGL2(gl) ? webgl2Feature : webgl1Feature;
48
+
49
+ if (cap === DEPRECATED_FEATURES.COLOR_ATTACHMENT_RGBA32F && !isWebGL2(gl)) {
50
+ return checkFloat32ColorAttachment(gl);
51
+ }
52
+
53
+ if (typeof featureDefinition === 'string') {
54
+ return Boolean(gl.getExtension(featureDefinition));
55
+ }
56
+
57
+ return featureDefinition;
58
+ }
59
+
60
+ function checkFloat32ColorAttachment(gl) {
61
+ let texture;
62
+ let framebuffer;
63
+
64
+ try {
65
+ const texture = gl.createTexture();
66
+ gl.bindTexture(GL.TEXTURE_2D, texture);
67
+ const level = 0;
68
+ const internalFormat = gl.RGBA;
69
+ const width = 1;
70
+ const height = 1;
71
+ const border = 0;
72
+ const srcFormat = gl.RGBA;
73
+ const srcType = gl.UNSIGNED_BYTE;
74
+ const pixel = new Uint8Array([0, 0, 255, 255]);
75
+ gl.texImage2D(gl.TEXTURE_2D, level, internalFormat, width, height, border, srcFormat, srcType, pixel);
76
+ const framebuffer = gl.createFramebuffer();
77
+ gl.bindFramebuffer(GL.FRAMEBUFFER, framebuffer);
78
+ gl.framebufferTexture2D(GL.FRAMEBUFFER, GL.COLOR_ATTACHMENT0, GL.TEXTURE_2D, texture, 0);
79
+ const status = gl.checkFramebufferStatus(GL.FRAMEBUFFER) === GL.FRAMEBUFFER_COMPLETE;
80
+ return status;
81
+ } finally {
82
+ gl.deleteTexture(texture);
83
+ gl.deleteFramebuffer(framebuffer);
84
+ }
85
+ }
86
+
87
+ const WEBGL_FEATURES = {
88
+ [DEPRECATED_FEATURES.WEBGL2]: [false, true],
89
+ [DEPRECATED_FEATURES.VERTEX_ARRAY_OBJECT]: ['OES_vertex_array_object', true],
90
+ [DEPRECATED_FEATURES.TIMER_QUERY]: ['EXT_disjoint_timer_query', 'EXT_disjoint_timer_query_webgl2'],
91
+ [DEPRECATED_FEATURES.INSTANCED_RENDERING]: ['ANGLE_instanced_arrays', true],
92
+ [DEPRECATED_FEATURES.MULTIPLE_RENDER_TARGETS]: ['WEBGL_draw_buffers', true],
93
+ [DEPRECATED_FEATURES.ELEMENT_INDEX_UINT32]: ['OES_element_index_uint', true],
94
+ [DEPRECATED_FEATURES.BLEND_EQUATION_MINMAX]: ['EXT_blend_minmax', true],
95
+ [DEPRECATED_FEATURES.FLOAT_BLEND]: ['EXT_float_blend', 'EXT_float_blend'],
96
+ [DEPRECATED_FEATURES.COLOR_ENCODING_SRGB]: ['EXT_sRGB', true],
97
+ [DEPRECATED_FEATURES.TEXTURE_DEPTH]: ['WEBGL_depth_texture', true],
98
+ [DEPRECATED_FEATURES.TEXTURE_FLOAT]: ['OES_texture_float', true],
99
+ [DEPRECATED_FEATURES.TEXTURE_HALF_FLOAT]: ['OES_texture_half_float', true],
100
+ [DEPRECATED_FEATURES.TEXTURE_FILTER_LINEAR_FLOAT]: ['OES_texture_float_linear', 'OES_texture_float_linear'],
101
+ [DEPRECATED_FEATURES.TEXTURE_FILTER_LINEAR_HALF_FLOAT]: ['OES_texture_half_float_linear', 'OES_texture_half_float_linear'],
102
+ [DEPRECATED_FEATURES.TEXTURE_FILTER_ANISOTROPIC]: ['EXT_texture_filter_anisotropic', 'EXT_texture_filter_anisotropic'],
103
+ [DEPRECATED_FEATURES.COLOR_ATTACHMENT_RGBA32F]: [false, 'EXT_color_buffer_float'],
104
+ [DEPRECATED_FEATURES.COLOR_ATTACHMENT_FLOAT]: [false, 'EXT_color_buffer_float'],
105
+ [DEPRECATED_FEATURES.COLOR_ATTACHMENT_HALF_FLOAT]: ['EXT_color_buffer_half_float', 'EXT_color_buffer_half_float'],
106
+ [DEPRECATED_FEATURES.GLSL_FRAG_DATA]: ['WEBGL_draw_buffers', true],
107
+ [DEPRECATED_FEATURES.GLSL_FRAG_DEPTH]: ['EXT_frag_depth', true],
108
+ [DEPRECATED_FEATURES.GLSL_DERIVATIVES]: ['OES_standard_derivatives', true],
109
+ [DEPRECATED_FEATURES.GLSL_TEXTURE_LOD]: ['EXT_shader_texture_lod', true]
110
+ };
111
+ //# sourceMappingURL=features.js.map