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

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 (651) hide show
  1. package/dist/api/device2.d.ts +52 -0
  2. package/dist/api/device2.d.ts.map +1 -0
  3. package/dist/api/device2.js +23 -0
  4. package/dist/api/device2.js.map +1 -0
  5. package/dist/classes/accessor.js +2 -2
  6. package/dist/classes/accessor.js.map +1 -1
  7. package/dist/classes/accessor.ts.disabled +1 -1
  8. package/dist/classes/clear.d.ts +3 -2
  9. package/dist/classes/clear.d.ts.map +1 -1
  10. package/dist/classes/clear.js +7 -4
  11. package/dist/classes/clear.js.map +1 -1
  12. package/dist/classes/copy-and-blit.d.ts +18 -1
  13. package/dist/classes/copy-and-blit.d.ts.map +1 -1
  14. package/dist/classes/copy-and-blit.js +30 -25
  15. package/dist/classes/copy-and-blit.js.map +1 -1
  16. package/dist/classes/framebuffer.d.ts +10 -1
  17. package/dist/classes/framebuffer.d.ts.map +1 -1
  18. package/dist/classes/framebuffer.js +15 -15
  19. package/dist/classes/framebuffer.js.map +1 -1
  20. package/dist/classes/program-configuration.d.ts +2 -2
  21. package/dist/classes/program-configuration.d.ts.map +1 -1
  22. package/dist/classes/program-configuration.js +1 -1
  23. package/dist/classes/program-configuration.js.map +1 -1
  24. package/dist/classes/program.d.ts +6 -6
  25. package/dist/classes/program.d.ts.map +1 -1
  26. package/dist/classes/program.js +11 -9
  27. package/dist/classes/program.js.map +1 -1
  28. package/dist/classes/query.d.ts.map +1 -1
  29. package/dist/classes/query.js +6 -5
  30. package/dist/classes/query.js.map +1 -1
  31. package/dist/classes/renderbuffer-formats.js +1 -1
  32. package/dist/classes/renderbuffer-formats.js.map +1 -1
  33. package/dist/classes/renderbuffer.d.ts.map +1 -1
  34. package/dist/classes/renderbuffer.js +4 -3
  35. package/dist/classes/renderbuffer.js.map +1 -1
  36. package/dist/classes/texture-2d.d.ts +4 -3
  37. package/dist/classes/texture-2d.d.ts.map +1 -1
  38. package/dist/classes/texture-2d.js +5 -8
  39. package/dist/classes/texture-2d.js.map +1 -1
  40. package/dist/classes/texture-3d.d.ts +3 -2
  41. package/dist/classes/texture-3d.d.ts.map +1 -1
  42. package/dist/classes/texture-3d.js +15 -6
  43. package/dist/classes/texture-3d.js.map +1 -1
  44. package/dist/classes/texture-cube.d.ts +2 -1
  45. package/dist/classes/texture-cube.d.ts.map +1 -1
  46. package/dist/classes/texture-cube.js +3 -4
  47. package/dist/classes/texture-cube.js.map +1 -1
  48. package/dist/classes/texture-formats.js +1 -1
  49. package/dist/classes/texture-formats.js.map +1 -1
  50. package/dist/classes/texture.d.ts +14 -9
  51. package/dist/classes/texture.d.ts.map +1 -1
  52. package/dist/classes/texture.js +19 -18
  53. package/dist/classes/texture.js.map +1 -1
  54. package/dist/classes/transform-feedback.d.ts.map +1 -1
  55. package/dist/classes/transform-feedback.js +5 -4
  56. package/dist/classes/transform-feedback.js.map +1 -1
  57. package/dist/classes/uniform-buffer-layout.js +1 -1
  58. package/dist/classes/uniform-buffer-layout.js.map +1 -1
  59. package/dist/classes/uniforms.d.ts +0 -1
  60. package/dist/classes/uniforms.d.ts.map +1 -1
  61. package/dist/classes/uniforms.js +1 -2
  62. package/dist/classes/uniforms.js.map +1 -1
  63. package/dist/classes/vertex-array-object.d.ts +1 -1
  64. package/dist/classes/vertex-array-object.d.ts.map +1 -1
  65. package/dist/classes/vertex-array-object.js +8 -9
  66. package/dist/classes/vertex-array-object.js.map +1 -1
  67. package/dist/classes/vertex-array.d.ts +1 -1
  68. package/dist/classes/vertex-array.d.ts.map +1 -1
  69. package/dist/classes/vertex-array.js +1 -2
  70. package/dist/classes/vertex-array.js.map +1 -1
  71. package/dist/classes/webgl-buffer.d.ts +2 -0
  72. package/dist/classes/webgl-buffer.d.ts.map +1 -1
  73. package/dist/classes/webgl-buffer.js +8 -5
  74. package/dist/classes/webgl-buffer.js.map +1 -1
  75. package/dist/classes/webgl-resource.d.ts +6 -4
  76. package/dist/classes/webgl-resource.d.ts.map +1 -1
  77. package/dist/classes/webgl-resource.js +12 -8
  78. package/dist/classes/webgl-resource.js.map +1 -1
  79. package/dist/classes/webgl-shader.d.ts +3 -1
  80. package/dist/classes/webgl-shader.d.ts.map +1 -1
  81. package/dist/classes/webgl-shader.js +7 -4
  82. package/dist/classes/webgl-shader.js.map +1 -1
  83. package/dist/context/context/context-state.d.ts +18 -0
  84. package/dist/context/context/context-state.d.ts.map +1 -0
  85. package/dist/context/context/context-state.js +26 -0
  86. package/dist/context/context/context-state.js.map +1 -0
  87. package/dist/context/context/create-context.d.ts +40 -0
  88. package/dist/context/context/create-context.d.ts.map +1 -0
  89. package/dist/context/context/create-context.js +37 -0
  90. package/dist/context/context/create-context.js.map +1 -0
  91. package/dist/context/context/device-pixels.d.ts +25 -0
  92. package/dist/context/context/device-pixels.d.ts.map +1 -0
  93. package/dist/context/context/device-pixels.js +98 -0
  94. package/dist/context/context/device-pixels.js.map +1 -0
  95. package/dist/context/context/get-canvas.d.ts +13 -0
  96. package/dist/context/context/get-canvas.d.ts.map +1 -0
  97. package/dist/context/context/get-canvas.js +31 -0
  98. package/dist/context/context/get-canvas.js.map +1 -0
  99. package/dist/context/context/resize-context.d.ts +20 -0
  100. package/dist/context/context/resize-context.d.ts.map +1 -0
  101. package/dist/context/context/resize-context.js +15 -0
  102. package/dist/context/context/resize-context.js.map +1 -0
  103. package/dist/context/context/webgl-checks.d.ts +13 -0
  104. package/dist/context/context/webgl-checks.d.ts.map +1 -0
  105. package/dist/context/context/webgl-checks.js +34 -0
  106. package/dist/context/context/webgl-checks.js.map +1 -0
  107. package/dist/context/parameters/unified-parameter-api.d.ts +30 -0
  108. package/dist/context/parameters/unified-parameter-api.d.ts.map +1 -0
  109. package/dist/context/parameters/unified-parameter-api.js +65 -0
  110. package/dist/context/parameters/unified-parameter-api.js.map +1 -0
  111. package/dist/context/parameters/webgl-parameter-tables.d.ts +169 -0
  112. package/dist/context/parameters/webgl-parameter-tables.d.ts.map +1 -0
  113. package/dist/context/parameters/webgl-parameter-tables.js +445 -0
  114. package/dist/context/parameters/webgl-parameter-tables.js.map +1 -0
  115. package/dist/context/parameters/webgl-parameters.d.ts +144 -0
  116. package/dist/context/parameters/webgl-parameters.d.ts.map +1 -0
  117. package/dist/context/parameters/webgl-parameters.js +2 -0
  118. package/dist/context/parameters/webgl-parameters.js.map +1 -0
  119. package/dist/context/polyfill/get-parameter-polyfill.d.ts +2 -0
  120. package/dist/context/polyfill/get-parameter-polyfill.d.ts.map +1 -0
  121. package/dist/context/polyfill/get-parameter-polyfill.js +91 -0
  122. package/dist/context/polyfill/get-parameter-polyfill.js.map +1 -0
  123. package/dist/context/polyfill/polyfill-context.d.ts +5 -0
  124. package/dist/context/polyfill/polyfill-context.d.ts.map +1 -0
  125. package/dist/context/polyfill/polyfill-context.js +91 -0
  126. package/dist/context/polyfill/polyfill-context.js.map +1 -0
  127. package/dist/context/polyfill/polyfill-table.d.ts +48 -0
  128. package/dist/context/polyfill/polyfill-table.d.ts.map +1 -0
  129. package/dist/context/polyfill/polyfill-table.js +160 -0
  130. package/dist/context/polyfill/polyfill-table.js.map +1 -0
  131. package/dist/context/polyfill/polyfill-vertex-array-object.d.ts +2 -0
  132. package/dist/context/polyfill/polyfill-vertex-array-object.d.ts.map +1 -0
  133. package/dist/context/polyfill/polyfill-vertex-array-object.js +335 -0
  134. package/dist/context/polyfill/polyfill-vertex-array-object.js.map +1 -0
  135. package/dist/context/state-tracker/deep-array-equal.d.ts +3 -0
  136. package/dist/context/state-tracker/deep-array-equal.d.ts.map +1 -0
  137. package/dist/context/state-tracker/deep-array-equal.js +21 -0
  138. package/dist/context/state-tracker/deep-array-equal.js.map +1 -0
  139. package/dist/context/state-tracker/track-context-state.d.ts +22 -0
  140. package/dist/context/state-tracker/track-context-state.d.ts.map +1 -0
  141. package/dist/context/state-tracker/track-context-state.js +169 -0
  142. package/dist/context/state-tracker/track-context-state.js.map +1 -0
  143. package/dist/context/state-tracker/with-parameters.d.ts +13 -0
  144. package/dist/context/state-tracker/with-parameters.d.ts.map +1 -0
  145. package/dist/context/state-tracker/with-parameters.js +36 -0
  146. package/dist/context/state-tracker/with-parameters.js.map +1 -0
  147. package/dist/debug/debug-uniforms.js +1 -1
  148. package/dist/debug/debug-uniforms.js.map +1 -1
  149. package/dist/debug/debug-vertex-array.js +2 -2
  150. package/dist/debug/debug-vertex-array.js.map +1 -1
  151. package/dist/device/check-glsl-extension.d.ts +4 -0
  152. package/dist/device/check-glsl-extension.d.ts.map +1 -0
  153. package/dist/device/check-glsl-extension.js +22 -0
  154. package/dist/device/check-glsl-extension.js.map +1 -0
  155. package/dist/device/device-features.d.ts +12 -0
  156. package/dist/device/device-features.d.ts.map +1 -0
  157. package/dist/device/device-features.js +123 -0
  158. package/dist/device/device-features.js.map +1 -0
  159. package/dist/device/device-limits.d.ts +51 -0
  160. package/dist/device/device-limits.d.ts.map +1 -0
  161. package/dist/device/device-limits.js +90 -0
  162. package/dist/device/device-limits.js.map +1 -0
  163. package/dist/device/get-device-info.d.ts +4 -0
  164. package/dist/device/get-device-info.d.ts.map +1 -0
  165. package/dist/device/get-device-info.js +44 -0
  166. package/dist/device/get-device-info.js.map +1 -0
  167. package/dist/device/webgl-device.d.ts +111 -0
  168. package/dist/device/webgl-device.d.ts.map +1 -0
  169. package/dist/device/webgl-device.js +208 -0
  170. package/dist/device/webgl-device.js.map +1 -0
  171. package/dist/es5/api/device2.js +42 -0
  172. package/dist/es5/api/device2.js.map +1 -0
  173. package/dist/es5/bundle.js +1 -1
  174. package/dist/es5/bundle.js.map +1 -1
  175. package/dist/es5/classes/accessor.js +104 -74
  176. package/dist/es5/classes/accessor.js.map +1 -1
  177. package/dist/es5/classes/accessor.ts.disabled +1 -1
  178. package/dist/es5/classes/clear.js +55 -34
  179. package/dist/es5/classes/clear.js.map +1 -1
  180. package/dist/es5/classes/copy-and-blit.js +175 -156
  181. package/dist/es5/classes/copy-and-blit.js.map +1 -1
  182. package/dist/es5/classes/framebuffer.js +647 -518
  183. package/dist/es5/classes/framebuffer.js.map +1 -1
  184. package/dist/es5/classes/program-configuration.js +138 -121
  185. package/dist/es5/classes/program-configuration.js.map +1 -1
  186. package/dist/es5/classes/program.js +368 -292
  187. package/dist/es5/classes/program.js.map +1 -1
  188. package/dist/es5/classes/query.js +172 -107
  189. package/dist/es5/classes/query.js.map +1 -1
  190. package/dist/es5/classes/renderbuffer-formats.js +126 -164
  191. package/dist/es5/classes/renderbuffer-formats.js.map +1 -1
  192. package/dist/es5/classes/renderbuffer.js +151 -98
  193. package/dist/es5/classes/renderbuffer.js.map +1 -1
  194. package/dist/es5/classes/texture-2d.js +44 -17
  195. package/dist/es5/classes/texture-2d.js.map +1 -1
  196. package/dist/es5/classes/texture-3d.js +107 -48
  197. package/dist/es5/classes/texture-3d.js.map +1 -1
  198. package/dist/es5/classes/texture-cube.js +169 -110
  199. package/dist/es5/classes/texture-cube.js.map +1 -1
  200. package/dist/es5/classes/texture-formats.js +42 -71
  201. package/dist/es5/classes/texture-formats.js.map +1 -1
  202. package/dist/es5/classes/texture.js +780 -665
  203. package/dist/es5/classes/texture.js.map +1 -1
  204. package/dist/es5/classes/transform-feedback.js +206 -150
  205. package/dist/es5/classes/transform-feedback.js.map +1 -1
  206. package/dist/es5/classes/uniform-buffer-layout.js +103 -89
  207. package/dist/es5/classes/uniform-buffer-layout.js.map +1 -1
  208. package/dist/es5/classes/uniforms.js +39 -80
  209. package/dist/es5/classes/uniforms.js.map +1 -1
  210. package/dist/es5/classes/vertex-array-object.js +268 -209
  211. package/dist/es5/classes/vertex-array-object.js.map +1 -1
  212. package/dist/es5/classes/vertex-array.js +348 -303
  213. package/dist/es5/classes/vertex-array.js.map +1 -1
  214. package/dist/es5/classes/webgl-buffer.js +374 -303
  215. package/dist/es5/classes/webgl-buffer.js.map +1 -1
  216. package/dist/es5/classes/webgl-resource.js +231 -161
  217. package/dist/es5/classes/webgl-resource.js.map +1 -1
  218. package/dist/es5/classes/webgl-shader.js +230 -134
  219. package/dist/es5/classes/webgl-shader.js.map +1 -1
  220. package/dist/es5/context/context/context-state.js +31 -0
  221. package/dist/es5/context/context/context-state.js.map +1 -0
  222. package/dist/es5/context/context/create-context.js +57 -0
  223. package/dist/es5/context/context/create-context.js.map +1 -0
  224. package/dist/es5/context/context/device-pixels.js +115 -0
  225. package/dist/es5/context/context/device-pixels.js.map +1 -0
  226. package/dist/es5/context/context/get-canvas.js +40 -0
  227. package/dist/es5/context/context/get-canvas.js.map +1 -0
  228. package/dist/es5/context/context/resize-context.js +23 -0
  229. package/dist/es5/context/context/resize-context.js.map +1 -0
  230. package/dist/es5/context/context/webgl-checks.js +54 -0
  231. package/dist/es5/context/context/webgl-checks.js.map +1 -0
  232. package/dist/es5/context/parameters/unified-parameter-api.js +95 -0
  233. package/dist/es5/context/parameters/unified-parameter-api.js.map +1 -0
  234. package/dist/es5/context/parameters/webgl-parameter-tables.js +392 -0
  235. package/dist/es5/context/parameters/webgl-parameter-tables.js.map +1 -0
  236. package/dist/es5/context/parameters/webgl-parameters.js +6 -0
  237. package/dist/es5/context/parameters/webgl-parameters.js.map +1 -0
  238. package/dist/es5/context/polyfill/get-parameter-polyfill.js +81 -0
  239. package/dist/es5/context/polyfill/get-parameter-polyfill.js.map +1 -0
  240. package/dist/es5/context/polyfill/polyfill-context.js +134 -0
  241. package/dist/es5/context/polyfill/polyfill-context.js.map +1 -0
  242. package/dist/es5/context/polyfill/polyfill-table.js +166 -0
  243. package/dist/es5/context/polyfill/polyfill-table.js.map +1 -0
  244. package/dist/es5/context/polyfill/polyfill-vertex-array-object.js +341 -0
  245. package/dist/es5/context/polyfill/polyfill-vertex-array-object.js.map +1 -0
  246. package/dist/es5/context/state-tracker/deep-array-equal.js +28 -0
  247. package/dist/es5/context/state-tracker/deep-array-equal.js.map +1 -0
  248. package/dist/es5/context/state-tracker/track-context-state.js +196 -0
  249. package/dist/es5/context/state-tracker/track-context-state.js.map +1 -0
  250. package/dist/es5/context/state-tracker/with-parameters.js +44 -0
  251. package/dist/es5/context/state-tracker/with-parameters.js.map +1 -0
  252. package/dist/es5/debug/debug-program-configuration.js +48 -20
  253. package/dist/es5/debug/debug-program-configuration.js.map +1 -1
  254. package/dist/es5/debug/debug-uniforms.js +110 -70
  255. package/dist/es5/debug/debug-uniforms.js.map +1 -1
  256. package/dist/es5/debug/debug-vertex-array.js +49 -54
  257. package/dist/es5/debug/debug-vertex-array.js.map +1 -1
  258. package/dist/es5/device/check-glsl-extension.js +33 -0
  259. package/dist/es5/device/check-glsl-extension.js.map +1 -0
  260. package/dist/es5/device/device-features.js +152 -0
  261. package/dist/es5/device/device-features.js.map +1 -0
  262. package/dist/es5/device/device-limits.js +64 -0
  263. package/dist/es5/device/device-limits.js.map +1 -0
  264. package/dist/es5/device/get-device-info.js +55 -0
  265. package/dist/es5/device/get-device-info.js.map +1 -0
  266. package/dist/es5/device/webgl-device.js +279 -0
  267. package/dist/es5/device/webgl-device.js.map +1 -0
  268. package/dist/es5/index.js +179 -189
  269. package/dist/es5/index.js.map +1 -1
  270. package/dist/es5/init.js +18 -14
  271. package/dist/es5/init.js.map +1 -1
  272. package/dist/es5/webgl-utils/attribute-utils.js +74 -87
  273. package/dist/es5/webgl-utils/attribute-utils.js.map +1 -1
  274. package/dist/es5/webgl-utils/constants-to-keys.js +7 -7
  275. package/dist/es5/webgl-utils/constants-to-keys.js.map +1 -1
  276. package/dist/es5/webgl-utils/format-utils.js +4 -4
  277. package/dist/es5/webgl-utils/format-utils.js.map +1 -1
  278. package/dist/es5/webgl-utils/get-error.js +18 -18
  279. package/dist/es5/webgl-utils/get-error.js.map +1 -1
  280. package/dist/es5/webgl-utils/index.js +10 -10
  281. package/dist/es5/webgl-utils/is-old-ie.js +16 -0
  282. package/dist/es5/webgl-utils/is-old-ie.js.map +1 -0
  283. package/dist/es5/webgl-utils/parse-shader-compiler-log.js +53 -25
  284. package/dist/es5/webgl-utils/parse-shader-compiler-log.js.map +1 -1
  285. package/dist/es5/webgl-utils/texture-utils.js +32 -36
  286. package/dist/es5/webgl-utils/texture-utils.js.map +1 -1
  287. package/dist/es5/webgl-utils/typed-array-utils.js +33 -32
  288. package/dist/es5/webgl-utils/typed-array-utils.js.map +1 -1
  289. package/dist/es5/webgl-utils/webgl-info.ts.disabled +135 -0
  290. package/dist/esm/api/device2.js +23 -0
  291. package/dist/esm/api/device2.js.map +1 -0
  292. package/dist/esm/classes/accessor.js +2 -2
  293. package/dist/esm/classes/accessor.js.map +1 -1
  294. package/dist/esm/classes/accessor.ts.disabled +1 -1
  295. package/dist/esm/classes/clear.js +7 -4
  296. package/dist/esm/classes/clear.js.map +1 -1
  297. package/dist/esm/classes/copy-and-blit.js +30 -25
  298. package/dist/esm/classes/copy-and-blit.js.map +1 -1
  299. package/dist/esm/classes/framebuffer.js +15 -15
  300. package/dist/esm/classes/framebuffer.js.map +1 -1
  301. package/dist/esm/classes/program-configuration.js +1 -1
  302. package/dist/esm/classes/program-configuration.js.map +1 -1
  303. package/dist/esm/classes/program.js +11 -9
  304. package/dist/esm/classes/program.js.map +1 -1
  305. package/dist/esm/classes/query.js +6 -5
  306. package/dist/esm/classes/query.js.map +1 -1
  307. package/dist/esm/classes/renderbuffer-formats.js +1 -1
  308. package/dist/esm/classes/renderbuffer-formats.js.map +1 -1
  309. package/dist/esm/classes/renderbuffer.js +4 -3
  310. package/dist/esm/classes/renderbuffer.js.map +1 -1
  311. package/dist/esm/classes/texture-2d.js +5 -8
  312. package/dist/esm/classes/texture-2d.js.map +1 -1
  313. package/dist/esm/classes/texture-3d.js +15 -6
  314. package/dist/esm/classes/texture-3d.js.map +1 -1
  315. package/dist/esm/classes/texture-cube.js +3 -4
  316. package/dist/esm/classes/texture-cube.js.map +1 -1
  317. package/dist/esm/classes/texture-formats.js +1 -1
  318. package/dist/esm/classes/texture-formats.js.map +1 -1
  319. package/dist/esm/classes/texture.js +19 -18
  320. package/dist/esm/classes/texture.js.map +1 -1
  321. package/dist/esm/classes/transform-feedback.js +5 -4
  322. package/dist/esm/classes/transform-feedback.js.map +1 -1
  323. package/dist/esm/classes/uniform-buffer-layout.js +1 -1
  324. package/dist/esm/classes/uniform-buffer-layout.js.map +1 -1
  325. package/dist/esm/classes/uniforms.js +1 -2
  326. package/dist/esm/classes/uniforms.js.map +1 -1
  327. package/dist/esm/classes/vertex-array-object.js +8 -9
  328. package/dist/esm/classes/vertex-array-object.js.map +1 -1
  329. package/dist/esm/classes/vertex-array.js +1 -2
  330. package/dist/esm/classes/vertex-array.js.map +1 -1
  331. package/dist/esm/classes/webgl-buffer.js +8 -5
  332. package/dist/esm/classes/webgl-buffer.js.map +1 -1
  333. package/dist/esm/classes/webgl-resource.js +12 -8
  334. package/dist/esm/classes/webgl-resource.js.map +1 -1
  335. package/dist/esm/classes/webgl-shader.js +7 -4
  336. package/dist/esm/classes/webgl-shader.js.map +1 -1
  337. package/dist/esm/context/context/context-state.js +26 -0
  338. package/dist/esm/context/context/context-state.js.map +1 -0
  339. package/dist/esm/context/context/create-context.js +37 -0
  340. package/dist/esm/context/context/create-context.js.map +1 -0
  341. package/dist/esm/context/context/device-pixels.js +98 -0
  342. package/dist/esm/context/context/device-pixels.js.map +1 -0
  343. package/dist/esm/context/context/get-canvas.js +31 -0
  344. package/dist/esm/context/context/get-canvas.js.map +1 -0
  345. package/dist/esm/context/context/resize-context.js +15 -0
  346. package/dist/esm/context/context/resize-context.js.map +1 -0
  347. package/dist/esm/context/context/webgl-checks.js +34 -0
  348. package/dist/esm/context/context/webgl-checks.js.map +1 -0
  349. package/dist/esm/context/parameters/unified-parameter-api.js +65 -0
  350. package/dist/esm/context/parameters/unified-parameter-api.js.map +1 -0
  351. package/dist/esm/context/parameters/webgl-parameter-tables.js +445 -0
  352. package/dist/esm/context/parameters/webgl-parameter-tables.js.map +1 -0
  353. package/dist/esm/context/parameters/webgl-parameters.js +2 -0
  354. package/dist/esm/context/parameters/webgl-parameters.js.map +1 -0
  355. package/dist/esm/context/polyfill/get-parameter-polyfill.js +91 -0
  356. package/dist/esm/context/polyfill/get-parameter-polyfill.js.map +1 -0
  357. package/dist/esm/context/polyfill/polyfill-context.js +91 -0
  358. package/dist/esm/context/polyfill/polyfill-context.js.map +1 -0
  359. package/dist/esm/context/polyfill/polyfill-table.js +160 -0
  360. package/dist/esm/context/polyfill/polyfill-table.js.map +1 -0
  361. package/dist/esm/context/polyfill/polyfill-vertex-array-object.js +335 -0
  362. package/dist/esm/context/polyfill/polyfill-vertex-array-object.js.map +1 -0
  363. package/dist/esm/context/state-tracker/deep-array-equal.js +21 -0
  364. package/dist/esm/context/state-tracker/deep-array-equal.js.map +1 -0
  365. package/dist/esm/context/state-tracker/track-context-state.js +169 -0
  366. package/dist/esm/context/state-tracker/track-context-state.js.map +1 -0
  367. package/dist/esm/context/state-tracker/with-parameters.js +36 -0
  368. package/dist/esm/context/state-tracker/with-parameters.js.map +1 -0
  369. package/dist/esm/debug/debug-uniforms.js +1 -1
  370. package/dist/esm/debug/debug-uniforms.js.map +1 -1
  371. package/dist/esm/debug/debug-vertex-array.js +2 -2
  372. package/dist/esm/debug/debug-vertex-array.js.map +1 -1
  373. package/dist/esm/device/check-glsl-extension.js +22 -0
  374. package/dist/esm/device/check-glsl-extension.js.map +1 -0
  375. package/dist/esm/device/device-features.js +123 -0
  376. package/dist/esm/device/device-features.js.map +1 -0
  377. package/dist/esm/device/device-limits.js +90 -0
  378. package/dist/esm/device/device-limits.js.map +1 -0
  379. package/dist/esm/device/get-device-info.js +44 -0
  380. package/dist/esm/device/get-device-info.js.map +1 -0
  381. package/dist/esm/device/webgl-device.js +208 -0
  382. package/dist/esm/device/webgl-device.js.map +1 -0
  383. package/dist/esm/index.js +22 -20
  384. package/dist/esm/index.js.map +1 -1
  385. package/dist/esm/init.js +11 -8
  386. package/dist/esm/init.js.map +1 -1
  387. package/dist/esm/webgl-utils/attribute-utils.js +1 -1
  388. package/dist/esm/webgl-utils/attribute-utils.js.map +1 -1
  389. package/dist/esm/webgl-utils/constants-to-keys.js +1 -1
  390. package/dist/esm/webgl-utils/constants-to-keys.js.map +1 -1
  391. package/dist/esm/webgl-utils/format-utils.js +1 -1
  392. package/dist/esm/webgl-utils/format-utils.js.map +1 -1
  393. package/dist/esm/{features/check-old-ie.js → webgl-utils/is-old-ie.js} +3 -3
  394. package/dist/esm/webgl-utils/is-old-ie.js.map +1 -0
  395. package/dist/esm/webgl-utils/texture-utils.js +2 -2
  396. package/dist/esm/webgl-utils/texture-utils.js.map +1 -1
  397. package/dist/esm/webgl-utils/typed-array-utils.js +22 -18
  398. package/dist/esm/webgl-utils/typed-array-utils.js.map +1 -1
  399. package/dist/esm/webgl-utils/webgl-info.ts.disabled +135 -0
  400. package/dist/index.d.ts +36 -20
  401. package/dist/index.d.ts.map +1 -1
  402. package/dist/index.js +22 -20
  403. package/dist/index.js.map +1 -1
  404. package/dist/init.d.ts.map +1 -1
  405. package/dist/init.js +11 -8
  406. package/dist/init.js.map +1 -1
  407. package/dist/webgl-utils/attribute-utils.d.ts +1 -1
  408. package/dist/webgl-utils/attribute-utils.js +1 -1
  409. package/dist/webgl-utils/attribute-utils.js.map +1 -1
  410. package/dist/webgl-utils/constants-to-keys.js +1 -1
  411. package/dist/webgl-utils/constants-to-keys.js.map +1 -1
  412. package/dist/webgl-utils/format-utils.d.ts +2 -2
  413. package/dist/webgl-utils/format-utils.js +1 -1
  414. package/dist/webgl-utils/format-utils.js.map +1 -1
  415. package/dist/webgl-utils/is-old-ie.d.ts +2 -0
  416. package/dist/webgl-utils/is-old-ie.d.ts.map +1 -0
  417. package/dist/{features/check-old-ie.js → webgl-utils/is-old-ie.js} +3 -3
  418. package/dist/webgl-utils/is-old-ie.js.map +1 -0
  419. package/dist/webgl-utils/texture-utils.d.ts +12 -8
  420. package/dist/webgl-utils/texture-utils.d.ts.map +1 -1
  421. package/dist/webgl-utils/texture-utils.js +2 -2
  422. package/dist/webgl-utils/texture-utils.js.map +1 -1
  423. package/dist/webgl-utils/typed-array-utils.d.ts +39 -32
  424. package/dist/webgl-utils/typed-array-utils.d.ts.map +1 -1
  425. package/dist/webgl-utils/typed-array-utils.js +22 -18
  426. package/dist/webgl-utils/typed-array-utils.js.map +1 -1
  427. package/dist/webgl-utils/webgl-info.ts.disabled +135 -0
  428. package/package.json +5 -6
  429. package/src/.DS_Store +0 -0
  430. package/src/api/device2.ts +71 -0
  431. package/src/classes/accessor.js +2 -2
  432. package/src/classes/accessor.ts.disabled +1 -1
  433. package/src/classes/clear.ts +9 -4
  434. package/src/classes/copy-and-blit.ts +49 -52
  435. package/src/classes/framebuffer.ts +38 -35
  436. package/src/classes/program-configuration.ts +6 -6
  437. package/src/classes/program.ts +21 -15
  438. package/src/classes/query.ts +6 -6
  439. package/src/classes/renderbuffer-formats.ts +1 -1
  440. package/src/classes/renderbuffer.ts +5 -4
  441. package/src/classes/texture-2d.ts +6 -11
  442. package/src/classes/texture-3d.ts +16 -11
  443. package/src/classes/texture-cube.ts +7 -7
  444. package/src/classes/texture-formats.ts +1 -1
  445. package/src/classes/texture.ts +39 -40
  446. package/src/classes/transform-feedback.ts +14 -13
  447. package/src/classes/uniform-buffer-layout.ts +1 -1
  448. package/src/classes/uniforms.ts +4 -10
  449. package/src/classes/vertex-array-object.ts +10 -14
  450. package/src/classes/vertex-array.ts +2 -3
  451. package/src/classes/webgl-buffer.ts +7 -5
  452. package/src/classes/webgl-resource.ts +20 -18
  453. package/src/classes/webgl-shader.ts +6 -4
  454. package/src/context/context/context-state.ts +39 -0
  455. package/src/context/context/create-context.ts +83 -0
  456. package/src/context/context/device-pixels.ts +147 -0
  457. package/src/context/context/get-canvas.ts +37 -0
  458. package/src/context/context/resize-context.ts +37 -0
  459. package/src/context/context/webgl-checks.ts +49 -0
  460. package/src/context/parameters/unified-parameter-api.ts +127 -0
  461. package/src/context/parameters/webgl-parameter-tables.ts +625 -0
  462. package/src/context/parameters/webgl-parameters.ts +197 -0
  463. package/src/context/polyfill/get-parameter-polyfill.ts +118 -0
  464. package/src/context/polyfill/polyfill-context.ts +98 -0
  465. package/src/context/polyfill/polyfill-table.ts +162 -0
  466. package/src/context/polyfill/polyfill-vertex-array-object.ts +360 -0
  467. package/src/context/state-tracker/deep-array-equal.ts +20 -0
  468. package/src/context/state-tracker/track-context-state.ts +250 -0
  469. package/src/context/state-tracker/with-parameters.ts +50 -0
  470. package/src/debug/debug-uniforms.ts +1 -1
  471. package/src/debug/debug-vertex-array.ts +2 -4
  472. package/src/device/check-glsl-extension.ts +44 -0
  473. package/src/device/device-features.ts +227 -0
  474. package/src/device/device-limits.ts +150 -0
  475. package/src/device/get-device-info.ts +49 -0
  476. package/src/device/webgl-device.ts +406 -0
  477. package/src/index.ts +76 -22
  478. package/src/init.ts +12 -9
  479. package/src/types.ts +1 -1
  480. package/src/webgl-utils/attribute-utils.ts +1 -1
  481. package/src/webgl-utils/constants-to-keys.ts +1 -1
  482. package/src/webgl-utils/format-utils.ts +1 -1
  483. package/src/{features/check-old-ie.ts → webgl-utils/is-old-ie.ts} +3 -3
  484. package/src/webgl-utils/{texture-utils.js → texture-utils.ts} +13 -10
  485. package/src/webgl-utils/{typed-array-utils.js → typed-array-utils.ts} +59 -16
  486. package/src/webgl-utils/webgl-info.ts.disabled +135 -0
  487. package/dist/context/gl-context.d.ts +0 -15
  488. package/dist/context/gl-context.d.ts.map +0 -1
  489. package/dist/context/gl-context.js +0 -32
  490. package/dist/context/gl-context.js.map +0 -1
  491. package/dist/context/luma-context-data.d.ts +0 -31
  492. package/dist/context/luma-context-data.d.ts.map +0 -1
  493. package/dist/context/luma-context-data.js +0 -5
  494. package/dist/context/luma-context-data.js.map +0 -1
  495. package/dist/es5/context/gl-context.js +0 -46
  496. package/dist/es5/context/gl-context.js.map +0 -1
  497. package/dist/es5/context/luma-context-data.js +0 -12
  498. package/dist/es5/context/luma-context-data.js.map +0 -1
  499. package/dist/es5/features/check-glsl-extension.js +0 -40
  500. package/dist/es5/features/check-glsl-extension.js.map +0 -1
  501. package/dist/es5/features/check-old-ie.js +0 -15
  502. package/dist/es5/features/check-old-ie.js.map +0 -1
  503. package/dist/es5/features/features.js +0 -85
  504. package/dist/es5/features/features.js.map +0 -1
  505. package/dist/es5/features/index.js +0 -64
  506. package/dist/es5/features/index.js.map +0 -1
  507. package/dist/es5/features/limits.js +0 -72
  508. package/dist/es5/features/limits.js.map +0 -1
  509. package/dist/es5/features/webgl-features-table.js +0 -84
  510. package/dist/es5/features/webgl-features-table.js.map +0 -1
  511. package/dist/es5/features/webgl-limits-table.js +0 -172
  512. package/dist/es5/features/webgl-limits-table.js.map +0 -1
  513. package/dist/es5/utils/array-utils-flat.js +0 -50
  514. package/dist/es5/utils/array-utils-flat.js.map +0 -1
  515. package/dist/es5/utils/assert.js +0 -13
  516. package/dist/es5/utils/assert.js.map +0 -1
  517. package/dist/es5/utils/check-props.js +0 -50
  518. package/dist/es5/utils/check-props.js.map +0 -1
  519. package/dist/es5/utils/format-value.js +0 -57
  520. package/dist/es5/utils/format-value.js.map +0 -1
  521. package/dist/es5/utils/index.js +0 -68
  522. package/dist/es5/utils/index.js.map +0 -1
  523. package/dist/es5/utils/is-old-ie.js +0 -13
  524. package/dist/es5/utils/is-old-ie.js.map +0 -1
  525. package/dist/es5/utils/load-file.js +0 -43
  526. package/dist/es5/utils/load-file.js.map +0 -1
  527. package/dist/es5/utils/stub-methods.js +0 -25
  528. package/dist/es5/utils/stub-methods.js.map +0 -1
  529. package/dist/es5/utils/utils.js +0 -31
  530. package/dist/es5/utils/utils.js.map +0 -1
  531. package/dist/es5/webgl-utils/texture-utils.d.ts +0 -11
  532. package/dist/es5/webgl-utils/typed-array-utils.d.ts +0 -36
  533. package/dist/esm/context/gl-context.js +0 -32
  534. package/dist/esm/context/gl-context.js.map +0 -1
  535. package/dist/esm/context/luma-context-data.js +0 -5
  536. package/dist/esm/context/luma-context-data.js.map +0 -1
  537. package/dist/esm/features/check-glsl-extension.js +0 -27
  538. package/dist/esm/features/check-glsl-extension.js.map +0 -1
  539. package/dist/esm/features/check-old-ie.js.map +0 -1
  540. package/dist/esm/features/features.js +0 -67
  541. package/dist/esm/features/features.js.map +0 -1
  542. package/dist/esm/features/index.js +0 -5
  543. package/dist/esm/features/index.js.map +0 -1
  544. package/dist/esm/features/limits.js +0 -55
  545. package/dist/esm/features/limits.js.map +0 -1
  546. package/dist/esm/features/webgl-features-table.js +0 -71
  547. package/dist/esm/features/webgl-features-table.js.map +0 -1
  548. package/dist/esm/features/webgl-limits-table.js +0 -161
  549. package/dist/esm/features/webgl-limits-table.js.map +0 -1
  550. package/dist/esm/utils/array-utils-flat.js +0 -39
  551. package/dist/esm/utils/array-utils-flat.js.map +0 -1
  552. package/dist/esm/utils/assert.js +0 -6
  553. package/dist/esm/utils/assert.js.map +0 -1
  554. package/dist/esm/utils/check-props.js +0 -38
  555. package/dist/esm/utils/check-props.js.map +0 -1
  556. package/dist/esm/utils/format-value.js +0 -50
  557. package/dist/esm/utils/format-value.js.map +0 -1
  558. package/dist/esm/utils/index.js +0 -7
  559. package/dist/esm/utils/index.js.map +0 -1
  560. package/dist/esm/utils/is-old-ie.js +0 -5
  561. package/dist/esm/utils/is-old-ie.js.map +0 -1
  562. package/dist/esm/utils/load-file.js +0 -30
  563. package/dist/esm/utils/load-file.js.map +0 -1
  564. package/dist/esm/utils/stub-methods.js +0 -16
  565. package/dist/esm/utils/stub-methods.js.map +0 -1
  566. package/dist/esm/utils/utils.js +0 -20
  567. package/dist/esm/utils/utils.js.map +0 -1
  568. package/dist/esm/webgl-utils/texture-utils.d.ts +0 -11
  569. package/dist/esm/webgl-utils/typed-array-utils.d.ts +0 -36
  570. package/dist/features/check-glsl-extension.d.ts +0 -2
  571. package/dist/features/check-glsl-extension.d.ts.map +0 -1
  572. package/dist/features/check-glsl-extension.js +0 -27
  573. package/dist/features/check-glsl-extension.js.map +0 -1
  574. package/dist/features/check-old-ie.d.ts +0 -2
  575. package/dist/features/check-old-ie.d.ts.map +0 -1
  576. package/dist/features/check-old-ie.js.map +0 -1
  577. package/dist/features/features.d.ts +0 -6
  578. package/dist/features/features.d.ts.map +0 -1
  579. package/dist/features/features.js +0 -67
  580. package/dist/features/features.js.map +0 -1
  581. package/dist/features/index.d.ts +0 -5
  582. package/dist/features/index.d.ts.map +0 -1
  583. package/dist/features/index.js +0 -5
  584. package/dist/features/index.js.map +0 -1
  585. package/dist/features/limits.d.ts +0 -28
  586. package/dist/features/limits.d.ts.map +0 -1
  587. package/dist/features/limits.js +0 -55
  588. package/dist/features/limits.js.map +0 -1
  589. package/dist/features/webgl-features-table.d.ts +0 -30
  590. package/dist/features/webgl-features-table.d.ts.map +0 -1
  591. package/dist/features/webgl-features-table.js +0 -71
  592. package/dist/features/webgl-features-table.js.map +0 -1
  593. package/dist/features/webgl-limits-table.d.ts +0 -161
  594. package/dist/features/webgl-limits-table.d.ts.map +0 -1
  595. package/dist/features/webgl-limits-table.js +0 -161
  596. package/dist/features/webgl-limits-table.js.map +0 -1
  597. package/dist/utils/array-utils-flat.d.ts +0 -9
  598. package/dist/utils/array-utils-flat.d.ts.map +0 -1
  599. package/dist/utils/array-utils-flat.js +0 -39
  600. package/dist/utils/array-utils-flat.js.map +0 -1
  601. package/dist/utils/assert.d.ts +0 -2
  602. package/dist/utils/assert.d.ts.map +0 -1
  603. package/dist/utils/assert.js +0 -6
  604. package/dist/utils/assert.js.map +0 -1
  605. package/dist/utils/check-props.d.ts +0 -2
  606. package/dist/utils/check-props.d.ts.map +0 -1
  607. package/dist/utils/check-props.js +0 -38
  608. package/dist/utils/check-props.js.map +0 -1
  609. package/dist/utils/format-value.d.ts +0 -5
  610. package/dist/utils/format-value.d.ts.map +0 -1
  611. package/dist/utils/format-value.js +0 -50
  612. package/dist/utils/format-value.js.map +0 -1
  613. package/dist/utils/index.d.ts +0 -7
  614. package/dist/utils/index.d.ts.map +0 -1
  615. package/dist/utils/index.js +0 -7
  616. package/dist/utils/index.js.map +0 -1
  617. package/dist/utils/is-old-ie.d.ts +0 -4
  618. package/dist/utils/is-old-ie.d.ts.map +0 -1
  619. package/dist/utils/is-old-ie.js +0 -5
  620. package/dist/utils/is-old-ie.js.map +0 -1
  621. package/dist/utils/load-file.d.ts +0 -4
  622. package/dist/utils/load-file.d.ts.map +0 -1
  623. package/dist/utils/load-file.js +0 -30
  624. package/dist/utils/load-file.js.map +0 -1
  625. package/dist/utils/stub-methods.d.ts +0 -2
  626. package/dist/utils/stub-methods.d.ts.map +0 -1
  627. package/dist/utils/stub-methods.js +0 -16
  628. package/dist/utils/stub-methods.js.map +0 -1
  629. package/dist/utils/utils.d.ts +0 -15
  630. package/dist/utils/utils.d.ts.map +0 -1
  631. package/dist/utils/utils.js +0 -20
  632. package/dist/utils/utils.js.map +0 -1
  633. package/src/context/gl-context.ts +0 -31
  634. package/src/context/luma-context-data.ts +0 -27
  635. package/src/features/check-glsl-extension.ts +0 -34
  636. package/src/features/features.ts +0 -80
  637. package/src/features/index.ts +0 -5
  638. package/src/features/limits.ts +0 -66
  639. package/src/features/webgl-features-table.ts +0 -104
  640. package/src/features/webgl-limits-table.ts +0 -51
  641. package/src/utils/array-utils-flat.ts +0 -56
  642. package/src/utils/assert.ts +0 -7
  643. package/src/utils/check-props.ts +0 -68
  644. package/src/utils/format-value.ts +0 -37
  645. package/src/utils/index.ts +0 -6
  646. package/src/utils/is-old-ie.ts +0 -6
  647. package/src/utils/load-file.ts +0 -40
  648. package/src/utils/stub-methods.ts +0 -20
  649. package/src/utils/utils.ts +0 -35
  650. package/src/webgl-utils/texture-utils.d.ts +0 -11
  651. package/src/webgl-utils/typed-array-utils.d.ts +0 -36
@@ -0,0 +1,44 @@
1
+ import GL from '@luma.gl/constants';
2
+ import { isWebGL2 } from '../context/context/webgl-checks';
3
+ export function getDeviceInfo(gl) {
4
+ const vendorMasked = gl.getParameter(GL.VENDOR);
5
+ const rendererMasked = gl.getParameter(GL.RENDERER);
6
+ const ext = gl.getExtension('WEBGL_debug_renderer_info');
7
+ const vendorUnmasked = gl.getParameter(ext ? ext.UNMASKED_VENDOR_WEBGL : GL.VENDOR);
8
+ const rendererUnmasked = gl.getParameter(ext ? ext.UNMASKED_RENDERER_WEBGL : GL.RENDERER);
9
+ const vendor = vendorUnmasked || vendorMasked;
10
+ const renderer = rendererUnmasked || rendererMasked;
11
+ const gpuVendor = identifyGPUVendor(vendor, renderer);
12
+ return {
13
+ type: isWebGL2(gl) ? 'webgl2' : 'webgl',
14
+ gpuVendor,
15
+ vendor: vendorUnmasked || vendorMasked,
16
+ renderer: rendererUnmasked || rendererMasked,
17
+ version: gl.getParameter(GL.VERSION),
18
+ shadingLanguages: ['glsl'],
19
+ shadingLanguageVersions: {
20
+ 'glsl': gl.getParameter(GL.SHADING_LANGUAGE_VERSION)
21
+ }
22
+ };
23
+ }
24
+
25
+ function identifyGPUVendor(vendor, renderer) {
26
+ if (vendor.match(/NVIDIA/i) || renderer.match(/NVIDIA/i)) {
27
+ return 'NVIDIA';
28
+ }
29
+
30
+ if (vendor.match(/INTEL/i) || renderer.match(/INTEL/i)) {
31
+ return 'INTEL';
32
+ }
33
+
34
+ if (vendor.match(/Apple/i) || renderer.match(/Apple/i)) {
35
+ return 'APPLE';
36
+ }
37
+
38
+ if (vendor.match(/AMD/i) || renderer.match(/AMD/i) || vendor.match(/ATI/i) || renderer.match(/ATI/i)) {
39
+ return 'AMD';
40
+ }
41
+
42
+ return 'UNKNOWN';
43
+ }
44
+ //# sourceMappingURL=get-device-info.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/device/get-device-info.ts"],"names":["GL","isWebGL2","getDeviceInfo","gl","vendorMasked","getParameter","VENDOR","rendererMasked","RENDERER","ext","getExtension","vendorUnmasked","UNMASKED_VENDOR_WEBGL","rendererUnmasked","UNMASKED_RENDERER_WEBGL","vendor","renderer","gpuVendor","identifyGPUVendor","type","version","VERSION","shadingLanguages","shadingLanguageVersions","SHADING_LANGUAGE_VERSION","match"],"mappings":"AACA,OAAOA,EAAP,MAAe,oBAAf;AACA,SAAQC,QAAR,QAAu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SAAb,KAA2BT,QAAQ,CAACS,KAAT,CAAe,SAAf,CAA/B,EAA0D;AACxD,WAAO,QAAP;AACD;;AACD,MAAIV,MAAM,CAACU,KAAP,CAAa,QAAb,KAA0BT,QAAQ,CAACS,KAAT,CAAe,QAAf,CAA9B,EAAwD;AACtD,WAAO,OAAP;AACD;;AACD,MAAIV,MAAM,CAACU,KAAP,CAAa,QAAb,KAA0BT,QAAQ,CAACS,KAAT,CAAe,QAAf,CAA9B,EAAwD;AACtD,WAAO,OAAP;AACD;;AACD,MACEV,MAAM,CAACU,KAAP,CAAa,MAAb,KACAT,QAAQ,CAACS,KAAT,CAAe,MAAf,CADA,IAEAV,MAAM,CAACU,KAAP,CAAa,MAAb,CAFA,IAGAT,QAAQ,CAACS,KAAT,CAAe,MAAf,CAJF,EAKE;AACA,WAAO,KAAP;AACD;;AACD,SAAO,SAAP;AACD","sourcesContent":["import {DeviceInfo} from '@luma.gl/api';\nimport GL from '@luma.gl/constants';\nimport {isWebGL2} from '../context/context/webgl-checks';\n \n/** @returns strings identifying the GPU vendor and driver. */\nexport function getDeviceInfo(gl: WebGLRenderingContext): DeviceInfo {\n const vendorMasked = gl.getParameter(GL.VENDOR);\n const rendererMasked = gl.getParameter(GL.RENDERER);\n // Get unmasked strings if available\n // https://www.khronos.org/registry/webgl/extensions/WEBGL_debug_renderer_info/\n const ext = gl.getExtension('WEBGL_debug_renderer_info');\n const vendorUnmasked = gl.getParameter(ext ? ext.UNMASKED_VENDOR_WEBGL : GL.VENDOR);\n const rendererUnmasked = gl.getParameter(ext ? ext.UNMASKED_RENDERER_WEBGL : GL.RENDERER);\n const vendor = vendorUnmasked || vendorMasked;\n const renderer = rendererUnmasked || rendererMasked;\n const gpuVendor = identifyGPUVendor(vendor, renderer);\n return {\n type: isWebGL2(gl) ? 'webgl2' : 'webgl',\n gpuVendor,\n vendor: vendorUnmasked || vendorMasked,\n renderer: rendererUnmasked || rendererMasked,\n version: gl.getParameter(GL.VERSION),\n shadingLanguages: ['glsl'],\n shadingLanguageVersions: {\n 'glsl': gl.getParameter(GL.SHADING_LANGUAGE_VERSION) as string\n }\n };\n}\n\nfunction identifyGPUVendor(vendor: string, renderer: string): 'NVIDIA' | 'INTEL' | 'APPLE' | 'AMD' | 'UNKNOWN' {\n if (vendor.match(/NVIDIA/i) || renderer.match(/NVIDIA/i)) {\n return 'NVIDIA';\n }\n if (vendor.match(/INTEL/i) || renderer.match(/INTEL/i)) {\n return 'INTEL';\n }\n if (vendor.match(/Apple/i) || renderer.match(/Apple/i)) {\n return 'APPLE';\n }\n if (\n vendor.match(/AMD/i) ||\n renderer.match(/AMD/i) ||\n vendor.match(/ATI/i) ||\n renderer.match(/ATI/i)\n ) {\n return 'AMD';\n }\n return 'UNKNOWN';\n}\n"],"file":"get-device-info.js"}
@@ -0,0 +1,111 @@
1
+ /// <reference types="offscreencanvas" />
2
+ import { Device, DeviceInfo, DeviceLimits } from '@luma.gl/api';
3
+ import { ContextState } from '../context/context/context-state';
4
+ import { Feature } from './device-features';
5
+ import { WebGLLimits } from './device-limits';
6
+ import type { BufferProps, ShaderProps } from '@luma.gl/api';
7
+ import WEBGLBuffer from '../classes/webgl-buffer';
8
+ import { WEBGLShader } from '../classes/webgl-shader';
9
+ import Texture2D, { Texture2DProps } from '../classes/texture-2d';
10
+ import type { default as Framebuffer } from '../classes/framebuffer';
11
+ import type { default as VertexArrayObject } from '../classes/vertex-array-object';
12
+ /** WebGLDevice options */
13
+ export declare type WebGLDeviceProps = {
14
+ canvas?: HTMLCanvasElement | OffscreenCanvas | string;
15
+ width?: number /** width is only used when creating a new canvas */;
16
+ height?: number /** height is only used when creating a new canvas */;
17
+ gl?: WebGLRenderingContext | WebGL2RenderingContext;
18
+ webgl2?: boolean;
19
+ webgl1?: boolean;
20
+ manageState?: boolean;
21
+ debug?: boolean;
22
+ break?: Array<any>;
23
+ onContextLost?: (event: Event) => void;
24
+ onContextRestored?: (event: Event) => void;
25
+ alpha?: boolean;
26
+ depth?: boolean;
27
+ stencil?: boolean;
28
+ antialias?: boolean;
29
+ premultipliedAlpha?: boolean;
30
+ preserveDrawingBuffer?: boolean;
31
+ failIfMajorPerformanceCaveat?: boolean;
32
+ };
33
+ export declare function getWebGLDevice(gl: WebGLRenderingContext | WebGL2RenderingContext): WebGLDevice | undefined;
34
+ /** WebGPU style Device API for a WebGL context */
35
+ export default class WebGLDevice extends Device implements ContextState {
36
+ /** A set like interface to test features */
37
+ readonly features: Set<Feature>;
38
+ readonly limits: DeviceLimits;
39
+ readonly info: DeviceInfo;
40
+ /** Promise that rejects when context is lost */
41
+ readonly lost: Promise<string>;
42
+ props: Required<WebGLDeviceProps>;
43
+ userData: {
44
+ [key: string]: any;
45
+ };
46
+ readonly isWebGL2: boolean;
47
+ readonly gl: WebGLRenderingContext;
48
+ readonly gl2: WebGL2RenderingContext;
49
+ /** Is this device attached to an offscreen context */
50
+ readonly offScreen: boolean;
51
+ readonly webglFeatures: Set<string>;
52
+ readonly webglLimits: WebGLLimits;
53
+ defaultFramebuffer?: Framebuffer;
54
+ defaultVertexArray?: VertexArrayObject;
55
+ _state: 'uninitialized' | 'initializing' | 'initialized';
56
+ readonly _canvasSizeInfo: {
57
+ clientWidth: number;
58
+ clientHeight: number;
59
+ devicePixelRatio: number;
60
+ };
61
+ readonly _extensions: Record<string, any>;
62
+ _polyfilled: boolean;
63
+ /**
64
+ *
65
+ */
66
+ static fromContext(gl: WebGLRenderingContext): WebGLDevice;
67
+ /**
68
+ * Get a device instance from a GL context
69
+ * Creates and instruments the device if not already created
70
+ * @param gl
71
+ * @returns
72
+ */
73
+ static attach(gl: Device | WebGLRenderingContext | WebGL2RenderingContext, props?: WebGLDeviceProps): WebGLDevice;
74
+ constructor(props: WebGLDeviceProps);
75
+ /**
76
+ * Destroys the context
77
+ * @note Has no effect for browser contexts, there is no browser API for destroying contexts
78
+ */
79
+ destroy(): void;
80
+ /**
81
+ * Resize the canvas' drawing buffer.
82
+ *
83
+ * Can match the canvas CSS size, and optionally also consider devicePixelRatio
84
+ * Can be called every frame
85
+ *
86
+ * Regardless of size, the drawing buffer will always be scaled to the viewport, but
87
+ * for best visual results, usually set to either:
88
+ * canvas CSS width x canvas CSS height
89
+ * canvas CSS width * devicePixelRatio x canvas CSS height * devicePixelRatio
90
+ * See http://webgl2fundamentals.org/webgl/lessons/webgl-resizing-the-canvas.html
91
+ */
92
+ resize(options?: {
93
+ width?: number;
94
+ height?: number;
95
+ useDevicePixels?: boolean | number;
96
+ }): void;
97
+ _createBuffer(props: BufferProps): WEBGLBuffer;
98
+ createTexture(props: Texture2DProps): Texture2D;
99
+ createShader(props: ShaderProps): WEBGLShader;
100
+ /**
101
+ * Offscreen Canvas Support: Commit the frame
102
+ * https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/commit
103
+ * Chrome's offscreen canvas does not require gl.commit
104
+ */
105
+ commit(): void;
106
+ /**
107
+ * Creates a context giving access to the WebGL API
108
+ */
109
+ _createContext(options?: WebGLDeviceProps): WebGLRenderingContext;
110
+ }
111
+ //# sourceMappingURL=webgl-device.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webgl-device.d.ts","sourceRoot":"","sources":["../../src/device/webgl-device.ts"],"names":[],"mappings":";AACA,OAAO,EAAC,MAAM,EAAE,UAAU,EAAE,YAAY,EAAM,MAAM,cAAc,CAAC;AAGnE,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAMhE,OAAO,EAAoB,OAAO,EAAC,MAAM,mBAAmB,CAAC;AAC7D,OAAO,EAAkC,WAAW,EAAC,MAAM,iBAAiB,CAAC;AAG7E,OAAO,KAAK,EAAC,WAAW,EAAE,WAAW,EAAC,MAAM,cAAc,CAAC;AAC3D,OAAO,WAAW,MAAM,yBAAyB,CAAC;AAClD,OAAO,EAAC,WAAW,EAAC,MAAM,yBAAyB,CAAC;AACpD,OAAO,SAAS,EAAE,EAAC,cAAc,EAAC,MAAM,uBAAuB,CAAC;AAChE,OAAO,KAAK,EAA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AE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,eAAe,CAAC,EAAE,OAAO,GAAG,MAAM,CAAA;KAAC,GAAG,IAAI;IAe7F,aAAa,CAAC,KAAK,EAAE,WAAW,GAAG,WAAW;IAI9C,aAAa,CAAC,KAAK,EAAE,cAAc,GAAG,SAAS;IAI/C,YAAY,CAAC,KAAK,EAAE,WAAW,GAAG,WAAW;IAI7C;;;;OAIG;IACH,MAAM,IAAI,IAAI;IAUd;;OAEG;IACH,cAAc,CAAC,OAAO,CAAC,EAAE,gBAAgB,GAAG,qBAAqB;CAOlE"}
@@ -0,0 +1,208 @@
1
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
+ import { Device, log } from '@luma.gl/api';
3
+ import { polyfillContext } from '../context/polyfill/polyfill-context';
4
+ import { trackContextState } from '../context/state-tracker/track-context-state';
5
+ import { getDevicePixelRatio, setDevicePixelRatio } from '../context/context/device-pixels';
6
+ import { createBrowserContext } from '../context/context/create-context';
7
+ import { getCanvas } from '../context/context/get-canvas';
8
+ import { isWebGL, isWebGL2 } from '../context/context/webgl-checks';
9
+ import { getDeviceInfo } from './get-device-info';
10
+ import { getDeviceFeatures } from './device-features';
11
+ import { getDeviceLimits, getWebGLLimits } from './device-limits';
12
+ import WEBGLBuffer from '../classes/webgl-buffer';
13
+ import { WEBGLShader } from '../classes/webgl-shader';
14
+ import Texture2D from '../classes/texture-2d';
15
+ const DEFAULT_DEVICE_PROPS = {
16
+ canvas: undefined,
17
+ gl: undefined,
18
+ webgl2: true,
19
+ webgl1: true,
20
+ manageState: true,
21
+ width: 800,
22
+ height: 600,
23
+ debug: false,
24
+ break: undefined,
25
+ onContextLost: () => console.error('WebGL context lost'),
26
+ onContextRestored: () => console.info('WebGL context restored'),
27
+ alpha: undefined,
28
+ depth: undefined,
29
+ stencil: undefined,
30
+ antialias: undefined,
31
+ premultipliedAlpha: undefined,
32
+ preserveDrawingBuffer: undefined,
33
+ failIfMajorPerformanceCaveat: undefined
34
+ };
35
+ const glToContextMap = new WeakMap();
36
+ export function getWebGLDevice(gl) {
37
+ return glToContextMap.get(gl);
38
+ }
39
+ let counter = 0;
40
+ export default class WebGLDevice extends Device {
41
+ static fromContext(gl) {
42
+ return gl.device;
43
+ }
44
+
45
+ static attach(gl, props) {
46
+ if (gl instanceof WebGLDevice) {
47
+ return gl;
48
+ }
49
+
50
+ if (!isWebGL(gl)) {
51
+ throw new Error('Invalid WebGLRenderingContext');
52
+ }
53
+
54
+ return new WebGLDevice({ ...props,
55
+ gl: gl
56
+ });
57
+ }
58
+
59
+ constructor(props) {
60
+ var _this$props$gl;
61
+
62
+ super();
63
+
64
+ _defineProperty(this, "features", void 0);
65
+
66
+ _defineProperty(this, "limits", void 0);
67
+
68
+ _defineProperty(this, "info", void 0);
69
+
70
+ _defineProperty(this, "lost", void 0);
71
+
72
+ _defineProperty(this, "props", void 0);
73
+
74
+ _defineProperty(this, "userData", void 0);
75
+
76
+ _defineProperty(this, "isWebGL2", void 0);
77
+
78
+ _defineProperty(this, "gl", void 0);
79
+
80
+ _defineProperty(this, "gl2", void 0);
81
+
82
+ _defineProperty(this, "offScreen", false);
83
+
84
+ _defineProperty(this, "webglFeatures", void 0);
85
+
86
+ _defineProperty(this, "webglLimits", void 0);
87
+
88
+ _defineProperty(this, "defaultFramebuffer", void 0);
89
+
90
+ _defineProperty(this, "defaultVertexArray", void 0);
91
+
92
+ _defineProperty(this, "_state", 'uninitialized');
93
+
94
+ _defineProperty(this, "_canvasSizeInfo", {
95
+ clientWidth: 0,
96
+ clientHeight: 0,
97
+ devicePixelRatio: 1
98
+ });
99
+
100
+ _defineProperty(this, "_extensions", {});
101
+
102
+ _defineProperty(this, "_polyfilled", false);
103
+
104
+ this.props = { ...DEFAULT_DEVICE_PROPS,
105
+ ...props
106
+ };
107
+ const device = (_this$props$gl = this.props.gl) === null || _this$props$gl === void 0 ? void 0 : _this$props$gl.device;
108
+
109
+ if (device) {
110
+ if (device._state !== 'initialized') {
111
+ log.error('recursive context');
112
+ throw new Error('recursive context');
113
+ }
114
+
115
+ return device;
116
+ }
117
+
118
+ this.offScreen = typeof OffscreenCanvas !== 'undefined' && props.canvas instanceof OffscreenCanvas;
119
+ this.gl = this.props.gl || this._createContext(props);
120
+ this.gl2 = this.gl;
121
+ this.isWebGL2 = isWebGL2(this.gl);
122
+ this._state = 'initializing';
123
+
124
+ if (this.gl.device) {
125
+ log.error('device already created');
126
+ throw new Error('device already created');
127
+ }
128
+
129
+ this.gl.device = this;
130
+ this.gl._version = typeof WebGL2RenderingContext !== 'undefined' && this.gl instanceof WebGL2RenderingContext ? 2 : 1;
131
+ glToContextMap.set(this.gl, this);
132
+ this.info = getDeviceInfo(this.gl);
133
+ const debug = this.gl.debug ? ' debug' : '';
134
+ const webGL = isWebGL2(this.gl) ? 'WebGL2' : 'WebGL1';
135
+ log.group(0, "".concat(webGL).concat(debug, " context: ").concat(this.info.vendor, ", ").concat(this.info.renderer))();
136
+ polyfillContext(this.gl);
137
+ log.probe(0, 'polyfilled context')();
138
+ trackContextState(this.gl, {
139
+ copyState: false,
140
+ log: (...args) => log.log(1, ...args)()
141
+ });
142
+ log.probe(0, 'instrumented context')();
143
+ this.features = getDeviceFeatures(this.gl);
144
+ log.probe(0, "queried device features ".concat(counter))();
145
+ this.limits = getDeviceLimits(this.gl);
146
+ log.probe(0, 'queried device limits')();
147
+ this.webglLimits = getWebGLLimits(this.gl);
148
+ log.probe(0, 'queried webgl limits')();
149
+ log.groupEnd(0)();
150
+ this._state = 'initialized';
151
+ }
152
+
153
+ destroy() {
154
+ let ext = this.gl.getExtension('STACKGL_destroy_context');
155
+
156
+ if (ext) {
157
+ ext.destroy();
158
+ }
159
+ }
160
+
161
+ resize(options) {
162
+ if (this.gl.canvas) {
163
+ const devicePixelRatio = getDevicePixelRatio(options === null || options === void 0 ? void 0 : options.useDevicePixels);
164
+ setDevicePixelRatio(this.gl, devicePixelRatio, options);
165
+ return;
166
+ }
167
+
168
+ const ext = this.gl.getExtension('STACKGL_resize_drawingbuffer');
169
+
170
+ if (ext && options && "width" in options && "height" in options) {
171
+ ext.resize(options.width, options.height);
172
+ }
173
+ }
174
+
175
+ _createBuffer(props) {
176
+ return new WEBGLBuffer(this.gl, props);
177
+ }
178
+
179
+ createTexture(props) {
180
+ return new Texture2D(this.gl, props);
181
+ }
182
+
183
+ createShader(props) {
184
+ return new WEBGLShader(this.gl, props);
185
+ }
186
+
187
+ commit() {
188
+ if (this.offScreen && this.gl.commit) {
189
+ this.gl.commit();
190
+ }
191
+ }
192
+
193
+ _createContext(options) {
194
+ const {
195
+ width,
196
+ height,
197
+ canvas
198
+ } = this.props;
199
+ const targetCanvas = getCanvas({
200
+ canvas,
201
+ width,
202
+ height
203
+ });
204
+ return createBrowserContext(targetCanvas, options);
205
+ }
206
+
207
+ }
208
+ //# sourceMappingURL=webgl-device.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/device/webgl-device.ts"],"names":["Device","log","polyfillContext","trackContextState","getDevicePixelRatio","setDevicePixelRatio","createBrowserContext","getCanvas","isWebGL","isWebGL2","getDeviceInfo","getDeviceFeatures","getDeviceLimits","getWebGLLimits","WEBGLBuffer","WEBGLShader","Texture2D","DEFAULT_DEVICE_PROPS","canvas","undefined","gl","webgl2","webgl1","manageState","width","height","debug","break","onContextLost","console","error","onContextRestored","info","alpha","depth","stencil","antialias","premultipliedAlpha","preserveDrawingBuffer","failIfMajorPerformanceCaveat","glToContextMap","WeakMap","getWebGLDevice","get","counter","WebGLDevice","fromContext","device","attach","props","Error","constructor","clientWidth","clientHeight","devicePixelRatio","_state","offScreen","OffscreenCanvas","_createContext","gl2","_version","WebGL2RenderingContext","set","webGL","group","vendor","renderer","probe","copyState","args","features","limits","webglLimits","groupEnd","destroy","ext","getExtension","resize","options","useDevicePixels","_createBuffer","createTexture","createShader","commit","targetCanvas"],"mappings":";AACA,SAAQA,MAAR,EAA0CC,GAA1C,QAAoD,cAApD;AACA,SA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DeviceLimits, log} from '@luma.gl/api';\nimport {polyfillContext} from '../context/polyfill/polyfill-context';\nimport {trackContextState} from '../context/state-tracker/track-context-state';\nimport { ContextState } from '../context/context/context-state';\nimport {getDevicePixelRatio, setDevicePixelRatio} from '../context/context/device-pixels';\nimport {createBrowserContext} from '../context/context/create-context';\nimport {getCanvas} from '../context/context/get-canvas';\nimport {isWebGL, isWebGL2} from '../context/context/webgl-checks';\nimport {getDeviceInfo} from './get-device-info';\nimport {getDeviceFeatures, Feature} from './device-features';\nimport {getDeviceLimits, getWebGLLimits, WebGLLimits} from './device-limits';\n\n// WebGL classes\nimport type {BufferProps, ShaderProps} from '@luma.gl/api';\nimport WEBGLBuffer from '../classes/webgl-buffer';\nimport {WEBGLShader} from '../classes/webgl-shader';\nimport Texture2D, {Texture2DProps} from '../classes/texture-2d';\nimport type {default as Framebuffer} from '../classes/framebuffer';\nimport type {default as VertexArrayObject} from '../classes/vertex-array-object';\n\n/** WebGLDevice options */\nexport type WebGLDeviceProps = {\n canvas?: HTMLCanvasElement | OffscreenCanvas | string; // A canvas element or a canvas string id\n width?: number /** width is only used when creating a new canvas */;\n height?: number /** height is only used when creating a new canvas */;\n // Attach to existing context\n gl?: WebGLRenderingContext | WebGL2RenderingContext;\n // COMMON CONTEXT PARAMETERS\n webgl2?: boolean; // Set to false to not create a WebGL2 context (force webgl1)\n webgl1?: boolean; // set to false to not create a WebGL1 context (fails if webgl2 not available)\n manageState?: boolean; // Set to false to disable WebGL state management instrumentation\n debug?: boolean; // Instrument context (at the expense of performance)\n break?: Array<any>; // TODO: types\n onContextLost?: (event: Event) => void;\n onContextRestored?: (event: Event) => void;\n // BROWSER CONTEXT PARAMETERS\n alpha?: boolean; // Default render target has an alpha buffer.\n depth?: boolean; // Default render target has a depth buffer of at least 16 bits.\n stencil?: boolean; // Default render target has a stencil buffer of at least 8 bits.\n antialias?: boolean; // Boolean that indicates whether or not to perform anti-aliasing.\n premultipliedAlpha?: boolean; // Boolean that indicates that the page compositor will assume the drawing buffer contains colors with pre-multiplied alpha.\n preserveDrawingBuffer?: boolean; // Default render target buffers will not be automatically cleared and will preserve their values until cleared or overwritten\n failIfMajorPerformanceCaveat?: boolean; // Do not create if the system performance is low.\n};\n\nconst DEFAULT_DEVICE_PROPS: Required<WebGLDeviceProps> = {\n canvas: undefined, // A canvas element or a canvas string id\n gl: undefined,\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 manageState: true,\n width: 800, // width are height are only used by headless gl\n height: 600,\n debug: false, // Instrument context (at the expense of performance)\n break: undefined,\n onContextLost: () => console.error('WebGL context lost'),\n onContextRestored: () => console.info('WebGL context restored'),\n\n alpha: undefined,\n depth: undefined,\n stencil: undefined,\n antialias: undefined,\n premultipliedAlpha: undefined,\n preserveDrawingBuffer: undefined,\n failIfMajorPerformanceCaveat: undefined\n};\n\n// TODO use weakmap instead of modifying context\nconst glToContextMap = new WeakMap<WebGLRenderingContext | WebGL2RenderingContext, WebGLDevice>();\n\nexport function getWebGLDevice(gl: WebGLRenderingContext | WebGL2RenderingContext): WebGLDevice | undefined {\n return glToContextMap.get(gl);\n}\n\nlet counter = 0;\n\n/** WebGPU style Device API for a WebGL context */\nexport default class WebGLDevice extends Device implements ContextState {\n // WebGPU style API\n\n /** A set like interface to test features */\n readonly features: Set<Feature>;\n readonly limits: DeviceLimits;\n readonly info: DeviceInfo;\n\n /** Promise that rejects when context is lost */\n readonly lost: Promise<string>;\n\n // Common API\n props: Required<WebGLDeviceProps>;\n userData: {[key: string]: any};\n\n // WebGL specific API\n readonly isWebGL2: boolean;\n readonly gl: WebGLRenderingContext;\n readonly gl2: WebGL2RenderingContext;\n /** Is this device attached to an offscreen context */\n readonly offScreen: boolean = false;\n\n readonly webglFeatures: Set<string>;\n readonly webglLimits: WebGLLimits;\n\n defaultFramebuffer?: Framebuffer;\n defaultVertexArray?: VertexArrayObject;\n\n // State used by luma.gl classes\n _state: 'uninitialized' | 'initializing' | 'initialized' = 'uninitialized';\n readonly _canvasSizeInfo = {clientWidth: 0, clientHeight: 0, devicePixelRatio: 1};\n readonly _extensions: Record<string, any> = {};\n _polyfilled: boolean = false;\n\n /**\n * \n */\n static fromContext(gl: WebGLRenderingContext): WebGLDevice {\n // @ts-expect-error\n return gl.device as WebGLDevice;\n }\n\n /**\n * Get a device instance from a GL context\n * Creates and instruments the device if not already created\n * @param gl\n * @returns\n */\n static attach(\n gl: Device | WebGLRenderingContext | WebGL2RenderingContext,\n props?: WebGLDeviceProps\n ): WebGLDevice {\n if (gl instanceof WebGLDevice) {\n return gl;\n } \n if (!isWebGL(gl)) {\n throw new Error('Invalid WebGLRenderingContext');\n }\n return new WebGLDevice({...props, gl: gl as WebGLRenderingContext});\n }\n\n\n constructor(props: WebGLDeviceProps) {\n super();\n \n this.props = {...DEFAULT_DEVICE_PROPS, ...props};\n\n // If attaching to an already attached context, return the attached device\n // @ts-expect-error device is attached to context\n const device: WebGLDevice | undefined = this.props.gl?.device;\n if (device) {\n if (device._state !== 'initialized') {\n log.error('recursive context');\n throw new Error('recursive context');\n }\n return device;\n }\n\n this.offScreen =\n typeof OffscreenCanvas !== 'undefined' &&\n props.canvas instanceof OffscreenCanvas;\n\n // Create an instrument context\n this.gl = (this.props.gl || this._createContext(props)) as WebGLRenderingContext;\n this.gl2 = this.gl as WebGL2RenderingContext;\n this.isWebGL2 = isWebGL2(this.gl);\n this._state = 'initializing';\n // Avoid multiple instrumentations\n // @ts-expect-error\n if (this.gl.device) {\n log.error('device already created');\n throw new Error('device already created'); // ASSERT this device;\n }\n // @ts-expect-error\n this.gl.device = this;\n // @ts-ignore\n this.gl._version = typeof WebGL2RenderingContext !== 'undefined' && this.gl instanceof WebGL2RenderingContext ? 2 : 1;\n // TODO - move to weak map indexing\n glToContextMap.set(this.gl, this);\n\n // Luma Device fields\n this.info = getDeviceInfo(this.gl);\n // Log some debug info about the newly created context\n // @ts-expect-error device is attached to context\n const debug = this.gl.debug ? ' debug' : '';\n const webGL = isWebGL2(this.gl) ? 'WebGL2' : 'WebGL1';\n log.group(0, `${webGL}${debug} context: ${this.info.vendor}, ${this.info.renderer}`)();\n\n polyfillContext(this.gl);\n log.probe(0, 'polyfilled context')();\n\n // Install context state tracking\n trackContextState(this.gl, {\n copyState: false,\n log: (...args) => log.log(1, ...args)()\n });\n log.probe(0, 'instrumented context')();\n\n // WebGPU Device fields\n this.features = getDeviceFeatures(this.gl);\n log.probe(0, `queried device features ${counter}`)();\n this.limits = getDeviceLimits(this.gl);\n log.probe(0, 'queried device limits')();\n\n // Add seer integration - TODO - currently removed\n\n // WEBGL specific fields\n this.webglLimits = getWebGLLimits(this.gl);\n log.probe(0, 'queried webgl limits')();\n\n // Add debug instrumentation to the context\n // if (isBrowser() && props.debug) {\n // // @ts-ignore\n // const {makeDebugContext} = global;\n // if (!makeDebugContext) {\n // log.warn('WebGL debug mode not activated. import \"@luma.gl/debug\" to enable.')();\n // } else {\n // // @ts-ignore\n // this.gl = global.makeDebugContext(this.gl, props);\n // this.gl2 = this.gl as WebGL2RenderingContext;\n // // Debug forces log level to at least 1\n // log.level = Math.max(log.level, 1);\n // }\n // }\n\n log.groupEnd(0)();\n this._state = 'initialized';\n }\n\n /**\n * Destroys the context\n * @note Has no effect for browser contexts, there is no browser API for destroying contexts\n */\n destroy() {\n let ext = this.gl.getExtension('STACKGL_destroy_context');\n if (ext) {\n ext.destroy();\n }\n // ext = this.gl.getExtension('WEBGL_lose_context');\n // if (ext) {\n // // TODO - disconnect context lost callbacks?\n // ext.loseContext();\n // }\n }\n\n // WEBGL SPECIFIC METHODS\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 resize(options?: {width?: number; height?: number; useDevicePixels?: boolean | number}): void {\n // Resize browser context .\n if (this.gl.canvas) {\n const devicePixelRatio = getDevicePixelRatio(options?.useDevicePixels);\n setDevicePixelRatio(this.gl, devicePixelRatio, options);\n return;\n }\n\n // Resize headless gl context\n const ext = this.gl.getExtension('STACKGL_resize_drawingbuffer');\n if (ext && options && `width` in options && `height` in options) {\n ext.resize(options.width, options.height);\n }\n }\n\n _createBuffer(props: BufferProps): WEBGLBuffer {\n return new WEBGLBuffer(this.gl, props);\n }\n\n createTexture(props: Texture2DProps): Texture2D {\n return new Texture2D(this.gl, props);\n }\n\n createShader(props: ShaderProps): WEBGLShader {\n return new WEBGLShader(this.gl, props);\n }\n\n /**\n * Offscreen Canvas Support: Commit the frame\n * https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/commit\n * Chrome's offscreen canvas does not require gl.commit\n */\n commit(): void {\n // @ts-expect-error gl.commit is not officially part of WebGLRenderingContext\n if (this.offScreen && this.gl.commit) {\n // @ts-expect-error gl.commit is not officially part of WebGLRenderingContext\n this.gl.commit();\n }\n }\n\n // PRIVATE METHODS\n\n /**\n * Creates a context giving access to the WebGL API\n */\n _createContext(options?: WebGLDeviceProps): WebGLRenderingContext {\n const {width, height, canvas} = this.props;\n // Get or create a canvas\n const targetCanvas = getCanvas({canvas, width, height});\n // Create a WebGL context in the canvas\n return createBrowserContext(targetCanvas, options);\n }\n}\n\n/*\nimport {\n isWebGL, isWebGL2,\n createGLContext,\n instrumentGLContext,\n getContextDebugInfo,\n resizeGLContext\n} from '@luma.gl/gltools';\n\n// prettier-ignore\nimport {\n Device, DeviceInfo, DeviceLimits,\n Buffer, BufferProps\n} from '@luma.gl/api';\n\nimport {getWebGLDeviceInfo} from '../converters/webgl-device-info';\nimport {getWebGLLimits} from '../converters/webgl-limits';\nimport {getWebGLFeatures} from '../converters/webgl-features';\n\nexport default class WEBGLDevice implements Device {\n readonly handle: WebGLRenderingContext;\n readonly gl: WebGLRenderingContext;\n readonly gl2: WebGL2RenderingContext | null;\n readonly canvas: HTMLCanvasElement;\n\n static isSupported(options: {canvas?: HTMLCanvasElement}): boolean {\n const {canvas} = options;\n let gl;\n try {\n gl = canvas && canvas.getContext(\"webgl\");\n gl = gl && canvas && canvas.getContext(\"experimental-webgl\");\n } catch (x) {\n gl = null;\n }\n return Boolean(gl);\n }\n\n constructor(props = {}) {\n const {canvas, swapChainFormat = \"bgra8unorm\"} = props;\n\n const gl = createGLContext(props);\n this.handle =\n this.gl = gl;\n this.gl2 = gl instanceof WebGL2RenderingContext ? gl : null;\n this.canvas = canvas;\n }\n\n resize(width, height) {\n resizeGLContext(this.gl);\n }\n\n getInfo(): DeviceInfo {\n return getWebGLDeviceInfo(this.gl);\n }\n\n getLimits(): DeviceLimits {\n return getWebGLLimits(this.gl, this.gl2);\n }\n\n getFeatures(): string[] {\n return getWebGLFeatures(this.gl);\n }\n\n createBuffer(props: WebGPUBufferProps): WEBGLBuffer {\n return new WEBGLBuffer(this.gl2 || this.gl, props);\n }\n\n createTexture(props: WebGPUTextureProps): WEBGLTexture {\n return new WEBGLTexture(this, props);\n }\n\n createSampler(props: WebGPUSamplerProps): WEBGLSampler {\n return new WEBGLSampler(this, props);\n }\n\n createShader(props: WebGPUShaderProps): WEBGLShader {\n return new WEBGLShader(this, props);\n }\n\n createRenderPipeline(props: WebGPURenderPipelineProps): WEBGLPipeline {\n return new WEBGLRenderPipeline(this, props);\n }\n\n createComputePipeline(props: WebGPUComputePipelineProps): WebGPUPipeline {\n return new WebGPUComputePipeline(this, props);\n }\n\n\n // PRIVATE\n\n _startFrame() {}\n\n _endFrame() {}\n}\n*/\n"],"file":"webgl-device.js"}
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.default = void 0;
9
+
10
+ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
11
+
12
+ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
13
+
14
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
15
+
16
+ var _stats = require("@probe.gl/stats");
17
+
18
+ var Device = function () {
19
+ function Device() {
20
+ (0, _classCallCheck2.default)(this, Device);
21
+ (0, _defineProperty2.default)(this, "stats", new Map());
22
+ (0, _defineProperty2.default)(this, "features", void 0);
23
+ (0, _defineProperty2.default)(this, "limits", void 0);
24
+ }
25
+
26
+ (0, _createClass2.default)(Device, [{
27
+ key: "getStats",
28
+ value: function getStats(name) {
29
+ if (!this.stats.has(name)) {
30
+ this.stats.set(name, new _stats.Stats({
31
+ id: name
32
+ }));
33
+ }
34
+
35
+ return this.stats.get(name);
36
+ }
37
+ }]);
38
+ return Device;
39
+ }();
40
+
41
+ exports.default = Device;
42
+ //# sourceMappingURL=device2.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/api/device2.ts"],"names":["Device","Map","name","stats","has","set","Stats","id","get"],"mappings":";;;;;;;;;;;;;;;AACA;;IA4C8BA,M;;;iDACZ,IAAIC,GAAJ,E;;;;;;;WAkBhB,kBAASC,IAAT,EAA8B;AAC5B,UAAI,CAAC,KAAKC,KAAL,CAAWC,GAAX,CAAeF,IAAf,CAAL,EAA2B;AACzB,aAAKC,KAAL,CAAWE,GAAX,CAAeH,IAAf,EAAqB,IAAII,YAAJ,CAAU;AAACC,UAAAA,EAAE,EAAEL;AAAL,SAAV,CAArB;AACD;;AACD,aAAO,KAAKC,KAAL,CAAWK,GAAX,CAAeN,IAAf,CAAP;AACD","sourcesContent":["\nimport {Stats} from '@probe.gl/stats';\n\nexport type DeviceInfo = {\n vendor: string,\n renderer: string,\n vendorMasked: string,\n rendererMasked: string,\n version: string,\n shadingLanguage: string\n};\n\n/** Limits for a device */\nexport type DeviceLimits = {\n readonly maxTextureDimension1D?: number;\n readonly maxTextureDimension2D?: number;\n readonly maxTextureDimension3D?: number;\n readonly maxTextureArrayLayers?: number;\n readonly maxBindGroups: number;\n readonly maxDynamicUniformBuffersPerPipelineLayout: number;\n readonly maxDynamicStorageBuffersPerPipelineLayout: number;\n readonly maxSampledTexturesPerShaderStage: number;\n readonly maxSamplersPerShaderStage: number;\n readonly maxStorageBuffersPerShaderStage: number;\n readonly maxStorageTexturesPerShaderStage: number;\n readonly maxUniformBuffersPerShaderStage: number;\n readonly maxUniformBufferBindingSize: number;\n readonly maxStorageBufferBindingSize?: number;\n readonly minUniformBufferOffsetAlignment?: number;\n readonly minStorageBufferOffsetAlignment?: number;\n readonly maxVertexBuffers?: number;\n readonly maxVertexAttributes?: number;\n readonly maxVertexBufferArrayStride?: number;\n readonly maxInterStageShaderComponents?: number;\n readonly maxComputeWorkgroupStorageSize?: number;\n readonly maxComputeInvocationsPerWorkgroup?: number;\n readonly maxComputeWorkgroupSizeX?: number;\n readonly maxComputeWorkgroupSizeY?: number;\n readonly maxComputeWorkgroupSizeZ?: number;\n readonly maxComputeWorkgroupsPerDimension?: number;\n};\n\n/**\n * WebGPU Device/WebGL context abstraction\n */\nexport default abstract class Device {\n private stats = new Map();\n\n // readonly canvas: HTMLCanvasElement;\n\n /** Check if this device type is supported on this platform */\n // static isSupported(): boolean;\n\n /** Create device of this type (asynchronous) */\n // static async create(props?: object): Promise<Device>;\n\n /** Attach to existing WebGPU device */\n // static attach(device: WebGPUDevice, props?: object): Device;\n\n /** Resize the context */\n // resize(width: number, height: number): void;\n abstract features: Set<string>;\n abstract limits: DeviceLimits;\n\n getStats(name: string): Stats {\n if (!this.stats.has(name)) {\n this.stats.set(name, new Stats({id: name}));\n }\n return this.stats.get(name);\n }\n}\n"],"file":"device2.js"}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
 
3
- const moduleExports = require('./index');
3
+ var moduleExports = require('./index');
4
4
 
5
5
  globalThis.luma = globalThis.luma || {};
6
6
  module.exports = Object.assign(globalThis.luma, moduleExports);
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/bundle.ts"],"names":["moduleExports","require","globalThis","luma","module","exports","Object","assign"],"mappings":";;AACA,MAAMA,aAAa,GAAGC,OAAO,CAAC,SAAD,CAA7B;;AACAC,UAAU,CAACC,IAAX,GAAkBD,UAAU,CAACC,IAAX,IAAmB,EAArC;AACAC,MAAM,CAACC,OAAP,GAAiBC,MAAM,CAACC,MAAP,CAAcL,UAAU,CAACC,IAAzB,EAA+BH,aAA/B,CAAjB","sourcesContent":["// @ts-nocheck\nconst moduleExports = require('./index');\nglobalThis.luma = globalThis.luma || {};\nmodule.exports = Object.assign(globalThis.luma, moduleExports);\n"],"file":"bundle.js"}
1
+ {"version":3,"sources":["../../src/bundle.ts"],"names":["moduleExports","require","globalThis","luma","module","exports","Object","assign"],"mappings":";;AACA,IAAMA,aAAa,GAAGC,OAAO,CAAC,SAAD,CAA7B;;AACAC,UAAU,CAACC,IAAX,GAAkBD,UAAU,CAACC,IAAX,IAAmB,EAArC;AACAC,MAAM,CAACC,OAAP,GAAiBC,MAAM,CAACC,MAAP,CAAcL,UAAU,CAACC,IAAzB,EAA+BH,aAA/B,CAAjB","sourcesContent":["// @ts-nocheck\nconst moduleExports = require('./index');\nglobalThis.luma = globalThis.luma || {};\nmodule.exports = Object.assign(globalThis.luma, moduleExports);\n"],"file":"bundle.js"}