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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (531) hide show
  1. package/LICENSE +3 -1
  2. package/dist/adapter/converters/device-parameters.d.ts +23 -4
  3. package/dist/adapter/converters/device-parameters.d.ts.map +1 -1
  4. package/dist/adapter/converters/device-parameters.js +101 -73
  5. package/dist/adapter/converters/device-parameters.js.map +1 -1
  6. package/dist/adapter/converters/sampler-parameters.d.ts +6 -6
  7. package/dist/adapter/converters/sampler-parameters.d.ts.map +1 -1
  8. package/dist/adapter/converters/sampler-parameters.js +74 -111
  9. package/dist/adapter/converters/sampler-parameters.js.map +1 -1
  10. package/dist/adapter/converters/shader-formats.d.ts +9 -0
  11. package/dist/adapter/converters/shader-formats.d.ts.map +1 -0
  12. package/dist/adapter/converters/shader-formats.js +52 -0
  13. package/dist/adapter/converters/shader-formats.js.map +1 -0
  14. package/dist/adapter/converters/texture-formats.d.ts +32 -44
  15. package/dist/adapter/converters/texture-formats.d.ts.map +1 -1
  16. package/dist/adapter/converters/texture-formats.js +309 -346
  17. package/dist/adapter/converters/texture-formats.js.map +1 -1
  18. package/dist/adapter/converters/vertex-formats.d.ts +9 -3
  19. package/dist/adapter/converters/vertex-formats.d.ts.map +1 -1
  20. package/dist/adapter/converters/vertex-formats.js +53 -22
  21. package/dist/adapter/converters/vertex-formats.js.map +1 -1
  22. package/dist/adapter/device-helpers/device-features.d.ts +1 -1
  23. package/dist/adapter/device-helpers/device-features.d.ts.map +1 -1
  24. package/dist/adapter/device-helpers/device-features.js +17 -23
  25. package/dist/adapter/device-helpers/device-features.js.map +1 -1
  26. package/dist/adapter/device-helpers/device-limits.d.ts +3 -3
  27. package/dist/adapter/device-helpers/device-limits.d.ts.map +1 -1
  28. package/dist/adapter/device-helpers/device-limits.js +54 -58
  29. package/dist/adapter/device-helpers/device-limits.js.map +1 -1
  30. package/dist/adapter/device-helpers/get-device-info.d.ts +1 -1
  31. package/dist/adapter/device-helpers/get-device-info.d.ts.map +1 -1
  32. package/dist/adapter/device-helpers/get-device-info.js +31 -22
  33. package/dist/adapter/device-helpers/get-device-info.js.map +1 -1
  34. package/dist/adapter/device-helpers/is-old-ie.d.ts.map +1 -1
  35. package/dist/adapter/device-helpers/is-old-ie.js +2 -1
  36. package/dist/adapter/device-helpers/is-old-ie.js.map +1 -1
  37. package/dist/adapter/helpers/decode-webgl-types.d.ts +26 -0
  38. package/dist/adapter/helpers/decode-webgl-types.d.ts.map +1 -0
  39. package/dist/adapter/helpers/decode-webgl-types.js +89 -0
  40. package/dist/adapter/helpers/decode-webgl-types.js.map +1 -0
  41. package/dist/adapter/helpers/get-shader-info.d.ts +9 -0
  42. package/dist/adapter/helpers/get-shader-info.d.ts.map +1 -0
  43. package/dist/adapter/helpers/get-shader-info.js +25 -0
  44. package/dist/adapter/helpers/get-shader-info.js.map +1 -0
  45. package/dist/adapter/helpers/get-shader-layout.d.ts +1 -48
  46. package/dist/adapter/helpers/get-shader-layout.d.ts.map +1 -1
  47. package/dist/adapter/helpers/get-shader-layout.js +87 -143
  48. package/dist/adapter/helpers/get-shader-layout.js.map +1 -1
  49. package/dist/adapter/helpers/parse-shader-compiler-log.d.ts +1 -1
  50. package/dist/adapter/helpers/parse-shader-compiler-log.d.ts.map +1 -1
  51. package/dist/adapter/helpers/parse-shader-compiler-log.js +16 -11
  52. package/dist/adapter/helpers/parse-shader-compiler-log.js.map +1 -1
  53. package/dist/adapter/helpers/set-uniform.d.ts +3 -2
  54. package/dist/adapter/helpers/set-uniform.d.ts.map +1 -1
  55. package/dist/adapter/helpers/set-uniform.js +51 -82
  56. package/dist/adapter/helpers/set-uniform.js.map +1 -1
  57. package/dist/adapter/helpers/webgl-topology-utils.d.ts +16 -0
  58. package/dist/adapter/helpers/webgl-topology-utils.d.ts.map +1 -0
  59. package/dist/adapter/helpers/webgl-topology-utils.js +103 -0
  60. package/dist/adapter/helpers/webgl-topology-utils.js.map +1 -0
  61. package/dist/adapter/objects/constants-to-keys.d.ts +1 -3
  62. package/dist/adapter/objects/constants-to-keys.d.ts.map +1 -1
  63. package/dist/adapter/objects/constants-to-keys.js +2 -29
  64. package/dist/adapter/objects/constants-to-keys.js.map +1 -1
  65. package/dist/adapter/objects/webgl-renderbuffer.d.ts +15 -12
  66. package/dist/adapter/objects/webgl-renderbuffer.d.ts.map +1 -1
  67. package/dist/adapter/objects/webgl-renderbuffer.js +36 -44
  68. package/dist/adapter/objects/webgl-renderbuffer.js.map +1 -1
  69. package/dist/adapter/objects/webgl-resource.d.ts +6 -9
  70. package/dist/adapter/objects/webgl-resource.d.ts.map +1 -1
  71. package/dist/adapter/objects/webgl-resource.js +26 -83
  72. package/dist/adapter/objects/webgl-resource.js.map +1 -1
  73. package/dist/adapter/resources/webgl-buffer.d.ts +19 -11
  74. package/dist/adapter/resources/webgl-buffer.d.ts.map +1 -1
  75. package/dist/adapter/resources/webgl-buffer.js +60 -88
  76. package/dist/adapter/resources/webgl-buffer.js.map +1 -1
  77. package/dist/adapter/resources/webgl-command-buffer.d.ts +15 -9
  78. package/dist/adapter/resources/webgl-command-buffer.d.ts.map +1 -1
  79. package/dist/adapter/resources/webgl-command-buffer.js +175 -48
  80. package/dist/adapter/resources/webgl-command-buffer.js.map +1 -1
  81. package/dist/adapter/resources/webgl-command-encoder.d.ts +7 -6
  82. package/dist/adapter/resources/webgl-command-encoder.d.ts.map +1 -1
  83. package/dist/adapter/resources/webgl-command-encoder.js +10 -20
  84. package/dist/adapter/resources/webgl-command-encoder.js.map +1 -1
  85. package/dist/adapter/resources/webgl-external-texture.js.map +1 -1
  86. package/dist/adapter/resources/webgl-framebuffer.d.ts +21 -24
  87. package/dist/adapter/resources/webgl-framebuffer.d.ts.map +1 -1
  88. package/dist/adapter/resources/webgl-framebuffer.js +63 -173
  89. package/dist/adapter/resources/webgl-framebuffer.js.map +1 -1
  90. package/dist/adapter/resources/webgl-render-pass.d.ts +19 -4
  91. package/dist/adapter/resources/webgl-render-pass.d.ts.map +1 -1
  92. package/dist/adapter/resources/webgl-render-pass.js +99 -11
  93. package/dist/adapter/resources/webgl-render-pass.js.map +1 -1
  94. package/dist/adapter/resources/webgl-render-pipeline.d.ts +55 -21
  95. package/dist/adapter/resources/webgl-render-pipeline.d.ts.map +1 -1
  96. package/dist/adapter/resources/webgl-render-pipeline.js +108 -270
  97. package/dist/adapter/resources/webgl-render-pipeline.js.map +1 -1
  98. package/dist/adapter/resources/webgl-sampler.d.ts +6 -5
  99. package/dist/adapter/resources/webgl-sampler.d.ts.map +1 -1
  100. package/dist/adapter/resources/webgl-sampler.js +11 -21
  101. package/dist/adapter/resources/webgl-sampler.js.map +1 -1
  102. package/dist/adapter/resources/webgl-shader.d.ts +3 -4
  103. package/dist/adapter/resources/webgl-shader.d.ts.map +1 -1
  104. package/dist/adapter/resources/webgl-shader.js +21 -34
  105. package/dist/adapter/resources/webgl-shader.js.map +1 -1
  106. package/dist/adapter/resources/webgl-texture.d.ts +62 -42
  107. package/dist/adapter/resources/webgl-texture.d.ts.map +1 -1
  108. package/dist/adapter/resources/webgl-texture.js +137 -256
  109. package/dist/adapter/resources/webgl-texture.js.map +1 -1
  110. package/dist/adapter/resources/webgl-transform-feedback.d.ts +47 -0
  111. package/dist/adapter/resources/webgl-transform-feedback.d.ts.map +1 -0
  112. package/dist/adapter/resources/webgl-transform-feedback.js +164 -0
  113. package/dist/adapter/resources/webgl-transform-feedback.js.map +1 -0
  114. package/dist/adapter/resources/webgl-vertex-array.d.ts +67 -0
  115. package/dist/adapter/resources/webgl-vertex-array.d.ts.map +1 -0
  116. package/dist/adapter/resources/webgl-vertex-array.js +167 -0
  117. package/dist/adapter/resources/webgl-vertex-array.js.map +1 -0
  118. package/dist/adapter/webgl-canvas-context.d.ts +6 -7
  119. package/dist/adapter/webgl-canvas-context.d.ts.map +1 -1
  120. package/dist/adapter/webgl-canvas-context.js +10 -23
  121. package/dist/adapter/webgl-canvas-context.js.map +1 -1
  122. package/dist/adapter/webgl-device.d.ts +76 -41
  123. package/dist/adapter/webgl-device.d.ts.map +1 -1
  124. package/dist/adapter/webgl-device.js +219 -129
  125. package/dist/adapter/webgl-device.js.map +1 -1
  126. package/dist/classic/accessor.d.ts +3 -3
  127. package/dist/classic/accessor.d.ts.map +1 -1
  128. package/dist/classic/accessor.js +26 -52
  129. package/dist/classic/accessor.js.map +1 -1
  130. package/dist/classic/clear.d.ts +22 -0
  131. package/dist/classic/clear.d.ts.map +1 -0
  132. package/dist/classic/clear.js +88 -0
  133. package/dist/classic/clear.js.map +1 -0
  134. package/dist/classic/copy-and-blit.d.ts +62 -0
  135. package/dist/classic/copy-and-blit.d.ts.map +1 -0
  136. package/dist/classic/copy-and-blit.js +191 -0
  137. package/dist/classic/copy-and-blit.js.map +1 -0
  138. package/dist/classic/format-utils.d.ts +3 -0
  139. package/dist/classic/format-utils.d.ts.map +1 -0
  140. package/dist/classic/format-utils.js +37 -0
  141. package/dist/classic/format-utils.js.map +1 -0
  142. package/dist/classic/typed-array-utils.d.ts +17 -17
  143. package/dist/classic/typed-array-utils.d.ts.map +1 -1
  144. package/dist/classic/typed-array-utils.js +18 -39
  145. package/dist/classic/typed-array-utils.js.map +1 -1
  146. package/dist/context/context/create-browser-context.d.ts +40 -0
  147. package/dist/context/context/create-browser-context.d.ts.map +1 -0
  148. package/dist/context/context/create-browser-context.js +53 -0
  149. package/dist/context/context/create-browser-context.js.map +1 -0
  150. package/dist/context/context/create-headless-context.d.ts +9 -0
  151. package/dist/context/context/create-headless-context.d.ts.map +1 -0
  152. package/dist/context/context/create-headless-context.js +42 -0
  153. package/dist/context/context/create-headless-context.js.map +1 -0
  154. package/dist/context/context/webgl-checks.d.ts.map +1 -1
  155. package/dist/context/context/webgl-checks.js +1 -4
  156. package/dist/context/context/webgl-checks.js.map +1 -1
  157. package/dist/context/debug/spector.d.ts +1 -2
  158. package/dist/context/debug/spector.d.ts.map +1 -1
  159. package/dist/context/debug/spector.js +8 -20
  160. package/dist/context/debug/spector.js.map +1 -1
  161. package/dist/context/debug/webgl-developer-tools.d.ts +2 -2
  162. package/dist/context/debug/webgl-developer-tools.d.ts.map +1 -1
  163. package/dist/context/debug/webgl-developer-tools.js +15 -39
  164. package/dist/context/debug/webgl-developer-tools.js.map +1 -1
  165. package/dist/context/parameters/unified-parameter-api.d.ts +9 -8
  166. package/dist/context/parameters/unified-parameter-api.d.ts.map +1 -1
  167. package/dist/context/parameters/unified-parameter-api.js +9 -19
  168. package/dist/context/parameters/unified-parameter-api.js.map +1 -1
  169. package/dist/context/parameters/webgl-parameter-tables.d.ts +105 -106
  170. package/dist/context/parameters/webgl-parameter-tables.d.ts.map +1 -1
  171. package/dist/context/parameters/webgl-parameter-tables.js +267 -286
  172. package/dist/context/parameters/webgl-parameter-tables.js.map +1 -1
  173. package/dist/context/polyfill/context-data.d.ts +13 -0
  174. package/dist/context/polyfill/context-data.d.ts.map +1 -0
  175. package/dist/context/polyfill/context-data.js +12 -0
  176. package/dist/context/polyfill/context-data.js.map +1 -0
  177. package/dist/context/polyfill/get-parameter-polyfill.d.ts +1 -1
  178. package/dist/context/polyfill/get-parameter-polyfill.d.ts.map +1 -1
  179. package/dist/context/polyfill/get-parameter-polyfill.js +37 -43
  180. package/dist/context/polyfill/get-parameter-polyfill.js.map +1 -1
  181. package/dist/context/polyfill/polyfill-context.d.ts.map +1 -1
  182. package/dist/context/polyfill/polyfill-context.js +22 -30
  183. package/dist/context/polyfill/polyfill-context.js.map +1 -1
  184. package/dist/context/polyfill/polyfill-table.d.ts +8 -8
  185. package/dist/context/polyfill/polyfill-table.d.ts.map +1 -1
  186. package/dist/context/polyfill/polyfill-table.js +18 -41
  187. package/dist/context/polyfill/polyfill-table.js.map +1 -1
  188. package/dist/context/polyfill/polyfill-vertex-array-object.d.ts.map +1 -1
  189. package/dist/context/polyfill/polyfill-vertex-array-object.js +17 -87
  190. package/dist/context/polyfill/polyfill-vertex-array-object.js.map +1 -1
  191. package/dist/context/state-tracker/deep-array-equal.d.ts.map +1 -1
  192. package/dist/context/state-tracker/deep-array-equal.js +0 -4
  193. package/dist/context/state-tracker/deep-array-equal.js.map +1 -1
  194. package/dist/context/state-tracker/track-context-state.d.ts.map +1 -1
  195. package/dist/context/state-tracker/track-context-state.js +26 -62
  196. package/dist/context/state-tracker/track-context-state.js.map +1 -1
  197. package/dist/context/state-tracker/with-parameters.d.ts +2 -1
  198. package/dist/context/state-tracker/with-parameters.d.ts.map +1 -1
  199. package/dist/context/state-tracker/with-parameters.js +8 -10
  200. package/dist/context/state-tracker/with-parameters.js.map +1 -1
  201. package/dist/dist.dev.js +8555 -0
  202. package/dist/index.cjs +6602 -0
  203. package/dist/index.d.ts +26 -24
  204. package/dist/index.d.ts.map +1 -1
  205. package/dist/index.js +27 -26
  206. package/dist/index.js.map +1 -1
  207. package/dist/types.d.ts +3 -1
  208. package/dist/types.d.ts.map +1 -1
  209. package/dist/types.js.map +1 -1
  210. package/dist.min.js +49 -0
  211. package/package.json +21 -9
  212. package/src/adapter/converters/device-parameters.ts +144 -41
  213. package/src/adapter/converters/sampler-parameters.ts +103 -41
  214. package/src/adapter/converters/shader-formats.ts +44 -0
  215. package/src/adapter/converters/texture-formats.ts +268 -195
  216. package/src/adapter/converters/vertex-formats.ts +71 -10
  217. package/src/adapter/device-helpers/device-features.ts +14 -3
  218. package/src/adapter/device-helpers/device-limits.ts +5 -3
  219. package/src/adapter/device-helpers/get-device-info.ts +53 -18
  220. package/src/adapter/device-helpers/is-old-ie.ts +3 -0
  221. package/src/adapter/helpers/{uniforms.ts → decode-webgl-types.ts} +39 -21
  222. package/src/adapter/helpers/get-shader-info.ts +41 -0
  223. package/src/adapter/helpers/get-shader-layout.ts +121 -146
  224. package/src/adapter/helpers/parse-shader-compiler-log.ts +24 -8
  225. package/src/adapter/helpers/set-uniform.ts +39 -35
  226. package/src/adapter/helpers/webgl-topology-utils.ts +103 -0
  227. package/src/adapter/objects/constants-to-keys.ts +6 -25
  228. package/src/adapter/objects/webgl-renderbuffer.ts +43 -37
  229. package/src/adapter/objects/webgl-resource.ts +16 -23
  230. package/src/adapter/resources/webgl-buffer.ts +67 -62
  231. package/src/adapter/resources/webgl-command-buffer.ts +327 -25
  232. package/src/adapter/resources/webgl-command-encoder.ts +20 -12
  233. package/src/adapter/resources/webgl-external-texture.ts +5 -2
  234. package/src/adapter/resources/webgl-framebuffer.ts +90 -134
  235. package/src/adapter/resources/webgl-render-pass.ts +166 -4
  236. package/src/adapter/resources/webgl-render-pipeline.ts +256 -192
  237. package/src/adapter/resources/webgl-sampler.ts +16 -10
  238. package/src/adapter/resources/webgl-shader.ts +14 -11
  239. package/src/adapter/resources/webgl-texture.ts +138 -99
  240. package/src/adapter/resources/webgl-transform-feedback.ts +202 -0
  241. package/src/adapter/resources/webgl-vertex-array.ts +283 -0
  242. package/src/adapter/webgl-canvas-context.ts +16 -14
  243. package/src/adapter/webgl-device.ts +328 -79
  244. package/src/classic/accessor.ts +8 -18
  245. package/src/classic/clear.ts +113 -0
  246. package/src/classic/copy-and-blit.ts +311 -0
  247. package/src/classic/format-utils.ts +46 -0
  248. package/src/classic/typed-array-utils.ts +21 -27
  249. package/src/context/context/create-browser-context.ts +140 -0
  250. package/src/context/context/create-headless-context.ts +51 -0
  251. package/src/context/context/webgl-checks.ts +3 -1
  252. package/src/context/debug/spector.ts +9 -6
  253. package/src/context/debug/webgl-developer-tools.ts +23 -15
  254. package/src/context/parameters/unified-parameter-api.ts +23 -14
  255. package/src/context/parameters/webgl-parameter-tables.ts +120 -98
  256. package/src/context/polyfill/context-data.ts +30 -0
  257. package/src/context/polyfill/get-parameter-polyfill.ts +11 -7
  258. package/src/context/polyfill/polyfill-context.ts +10 -9
  259. package/src/context/polyfill/polyfill-table.ts +21 -16
  260. package/src/context/polyfill/polyfill-vertex-array-object.ts +5 -0
  261. package/src/context/state-tracker/deep-array-equal.ts +2 -0
  262. package/src/context/state-tracker/track-context-state.ts +14 -11
  263. package/src/context/state-tracker/with-parameters.ts +13 -4
  264. package/src/index.ts +70 -35
  265. package/src/types.ts +5 -0
  266. package/dist/adapter/converters/renderbuffer-formats.d.ts +0 -16
  267. package/dist/adapter/converters/renderbuffer-formats.d.ts.map +0 -1
  268. package/dist/adapter/converters/renderbuffer-formats.js +0 -185
  269. package/dist/adapter/converters/renderbuffer-formats.js.map +0 -1
  270. package/dist/adapter/helpers/attribute-utils.d.ts +0 -11
  271. package/dist/adapter/helpers/attribute-utils.d.ts.map +0 -1
  272. package/dist/adapter/helpers/attribute-utils.js +0 -81
  273. package/dist/adapter/helpers/attribute-utils.js.map +0 -1
  274. package/dist/adapter/helpers/uniforms.d.ts +0 -26
  275. package/dist/adapter/helpers/uniforms.d.ts.map +0 -1
  276. package/dist/adapter/helpers/uniforms.js +0 -99
  277. package/dist/adapter/helpers/uniforms.js.map +0 -1
  278. package/dist/adapter/objects/webgl-vertex-array-object.d.ts +0 -27
  279. package/dist/adapter/objects/webgl-vertex-array-object.d.ts.map +0 -1
  280. package/dist/adapter/objects/webgl-vertex-array-object.js +0 -84
  281. package/dist/adapter/objects/webgl-vertex-array-object.js.map +0 -1
  282. package/dist/bundle.d.ts +0 -2
  283. package/dist/bundle.d.ts.map +0 -1
  284. package/dist/bundle.js +0 -5
  285. package/dist/bundle.js.map +0 -1
  286. package/dist/classic/buffer.d.ts +0 -95
  287. package/dist/classic/buffer.d.ts.map +0 -1
  288. package/dist/classic/buffer.js +0 -384
  289. package/dist/classic/buffer.js.map +0 -1
  290. package/dist/context/context/context-state.d.ts +0 -18
  291. package/dist/context/context/context-state.d.ts.map +0 -1
  292. package/dist/context/context/context-state.js +0 -26
  293. package/dist/context/context/context-state.js.map +0 -1
  294. package/dist/context/context/create-context.d.ts +0 -41
  295. package/dist/context/context/create-context.d.ts.map +0 -1
  296. package/dist/context/context/create-context.js +0 -49
  297. package/dist/context/context/create-context.js.map +0 -1
  298. package/dist/context/context/device-pixels.d.ts +0 -25
  299. package/dist/context/context/device-pixels.d.ts.map +0 -1
  300. package/dist/context/context/device-pixels.js +0 -98
  301. package/dist/context/context/device-pixels.js.map +0 -1
  302. package/dist/es5/adapter/converters/device-parameters.js +0 -170
  303. package/dist/es5/adapter/converters/device-parameters.js.map +0 -1
  304. package/dist/es5/adapter/converters/renderbuffer-formats.js +0 -163
  305. package/dist/es5/adapter/converters/renderbuffer-formats.js.map +0 -1
  306. package/dist/es5/adapter/converters/sampler-parameters.js +0 -226
  307. package/dist/es5/adapter/converters/sampler-parameters.js.map +0 -1
  308. package/dist/es5/adapter/converters/texture-formats.js +0 -1031
  309. package/dist/es5/adapter/converters/texture-formats.js.map +0 -1
  310. package/dist/es5/adapter/converters/vertex-formats.js +0 -45
  311. package/dist/es5/adapter/converters/vertex-formats.js.map +0 -1
  312. package/dist/es5/adapter/device-helpers/device-features.js +0 -144
  313. package/dist/es5/adapter/device-helpers/device-features.js.map +0 -1
  314. package/dist/es5/adapter/device-helpers/device-limits.js +0 -64
  315. package/dist/es5/adapter/device-helpers/device-limits.js.map +0 -1
  316. package/dist/es5/adapter/device-helpers/get-device-info.js +0 -55
  317. package/dist/es5/adapter/device-helpers/get-device-info.js.map +0 -1
  318. package/dist/es5/adapter/device-helpers/is-old-ie.js +0 -16
  319. package/dist/es5/adapter/device-helpers/is-old-ie.js.map +0 -1
  320. package/dist/es5/adapter/helpers/attribute-utils.js +0 -91
  321. package/dist/es5/adapter/helpers/attribute-utils.js.map +0 -1
  322. package/dist/es5/adapter/helpers/get-shader-layout.js +0 -371
  323. package/dist/es5/adapter/helpers/get-shader-layout.js.map +0 -1
  324. package/dist/es5/adapter/helpers/parse-shader-compiler-log.js +0 -72
  325. package/dist/es5/adapter/helpers/parse-shader-compiler-log.js.map +0 -1
  326. package/dist/es5/adapter/helpers/set-uniform.js +0 -125
  327. package/dist/es5/adapter/helpers/set-uniform.js.map +0 -1
  328. package/dist/es5/adapter/helpers/uniforms.js +0 -112
  329. package/dist/es5/adapter/helpers/uniforms.js.map +0 -1
  330. package/dist/es5/adapter/objects/constants-to-keys.js +0 -54
  331. package/dist/es5/adapter/objects/constants-to-keys.js.map +0 -1
  332. package/dist/es5/adapter/objects/webgl-renderbuffer.js +0 -150
  333. package/dist/es5/adapter/objects/webgl-renderbuffer.js.map +0 -1
  334. package/dist/es5/adapter/objects/webgl-resource.js +0 -292
  335. package/dist/es5/adapter/objects/webgl-resource.js.map +0 -1
  336. package/dist/es5/adapter/objects/webgl-vertex-array-object.js +0 -137
  337. package/dist/es5/adapter/objects/webgl-vertex-array-object.js.map +0 -1
  338. package/dist/es5/adapter/resources/webgl-buffer.js +0 -243
  339. package/dist/es5/adapter/resources/webgl-buffer.js.map +0 -1
  340. package/dist/es5/adapter/resources/webgl-command-buffer.js +0 -96
  341. package/dist/es5/adapter/resources/webgl-command-buffer.js.map +0 -1
  342. package/dist/es5/adapter/resources/webgl-command-encoder.js +0 -98
  343. package/dist/es5/adapter/resources/webgl-command-encoder.js.map +0 -1
  344. package/dist/es5/adapter/resources/webgl-external-texture.js +0 -2
  345. package/dist/es5/adapter/resources/webgl-external-texture.js.map +0 -1
  346. package/dist/es5/adapter/resources/webgl-framebuffer.js +0 -345
  347. package/dist/es5/adapter/resources/webgl-framebuffer.js.map +0 -1
  348. package/dist/es5/adapter/resources/webgl-render-pass.js +0 -61
  349. package/dist/es5/adapter/resources/webgl-render-pass.js.map +0 -1
  350. package/dist/es5/adapter/resources/webgl-render-pipeline.js +0 -505
  351. package/dist/es5/adapter/resources/webgl-render-pipeline.js.map +0 -1
  352. package/dist/es5/adapter/resources/webgl-sampler.js +0 -96
  353. package/dist/es5/adapter/resources/webgl-sampler.js.map +0 -1
  354. package/dist/es5/adapter/resources/webgl-shader.js +0 -149
  355. package/dist/es5/adapter/resources/webgl-shader.js.map +0 -1
  356. package/dist/es5/adapter/resources/webgl-texture.js +0 -986
  357. package/dist/es5/adapter/resources/webgl-texture.js.map +0 -1
  358. package/dist/es5/adapter/webgl-canvas-context.js +0 -97
  359. package/dist/es5/adapter/webgl-canvas-context.js.map +0 -1
  360. package/dist/es5/adapter/webgl-device.js +0 -399
  361. package/dist/es5/adapter/webgl-device.js.map +0 -1
  362. package/dist/es5/bundle.js +0 -7
  363. package/dist/es5/bundle.js.map +0 -1
  364. package/dist/es5/classic/accessor.js +0 -181
  365. package/dist/es5/classic/accessor.js.map +0 -1
  366. package/dist/es5/classic/buffer.js +0 -470
  367. package/dist/es5/classic/buffer.js.map +0 -1
  368. package/dist/es5/classic/typed-array-utils.js +0 -126
  369. package/dist/es5/classic/typed-array-utils.js.map +0 -1
  370. package/dist/es5/context/context/context-state.js +0 -31
  371. package/dist/es5/context/context/context-state.js.map +0 -1
  372. package/dist/es5/context/context/create-context.js +0 -69
  373. package/dist/es5/context/context/create-context.js.map +0 -1
  374. package/dist/es5/context/context/device-pixels.js +0 -115
  375. package/dist/es5/context/context/device-pixels.js.map +0 -1
  376. package/dist/es5/context/context/webgl-checks.js +0 -54
  377. package/dist/es5/context/context/webgl-checks.js.map +0 -1
  378. package/dist/es5/context/debug/spector.js +0 -133
  379. package/dist/es5/context/debug/spector.js.map +0 -1
  380. package/dist/es5/context/debug/webgl-developer-tools.js +0 -198
  381. package/dist/es5/context/debug/webgl-developer-tools.js.map +0 -1
  382. package/dist/es5/context/parameters/unified-parameter-api.js +0 -97
  383. package/dist/es5/context/parameters/unified-parameter-api.js.map +0 -1
  384. package/dist/es5/context/parameters/webgl-parameter-tables.js +0 -392
  385. package/dist/es5/context/parameters/webgl-parameter-tables.js.map +0 -1
  386. package/dist/es5/context/polyfill/get-parameter-polyfill.js +0 -81
  387. package/dist/es5/context/polyfill/get-parameter-polyfill.js.map +0 -1
  388. package/dist/es5/context/polyfill/polyfill-context.js +0 -135
  389. package/dist/es5/context/polyfill/polyfill-context.js.map +0 -1
  390. package/dist/es5/context/polyfill/polyfill-table.js +0 -166
  391. package/dist/es5/context/polyfill/polyfill-table.js.map +0 -1
  392. package/dist/es5/context/polyfill/polyfill-vertex-array-object.js +0 -341
  393. package/dist/es5/context/polyfill/polyfill-vertex-array-object.js.map +0 -1
  394. package/dist/es5/context/state-tracker/deep-array-equal.js +0 -28
  395. package/dist/es5/context/state-tracker/deep-array-equal.js.map +0 -1
  396. package/dist/es5/context/state-tracker/track-context-state.js +0 -211
  397. package/dist/es5/context/state-tracker/track-context-state.js.map +0 -1
  398. package/dist/es5/context/state-tracker/with-parameters.js +0 -44
  399. package/dist/es5/context/state-tracker/with-parameters.js.map +0 -1
  400. package/dist/es5/index.js +0 -276
  401. package/dist/es5/index.js.map +0 -1
  402. package/dist/es5/init.js +0 -10
  403. package/dist/es5/init.js.map +0 -1
  404. package/dist/es5/types/webgl.js +0 -6
  405. package/dist/es5/types/webgl.js.map +0 -1
  406. package/dist/es5/types.js +0 -2
  407. package/dist/es5/types.js.map +0 -1
  408. package/dist/esm/adapter/converters/device-parameters.js +0 -155
  409. package/dist/esm/adapter/converters/device-parameters.js.map +0 -1
  410. package/dist/esm/adapter/converters/renderbuffer-formats.js +0 -185
  411. package/dist/esm/adapter/converters/renderbuffer-formats.js.map +0 -1
  412. package/dist/esm/adapter/converters/sampler-parameters.js +0 -208
  413. package/dist/esm/adapter/converters/sampler-parameters.js.map +0 -1
  414. package/dist/esm/adapter/converters/texture-formats.js +0 -954
  415. package/dist/esm/adapter/converters/texture-formats.js.map +0 -1
  416. package/dist/esm/adapter/converters/vertex-formats.js +0 -35
  417. package/dist/esm/adapter/converters/vertex-formats.js.map +0 -1
  418. package/dist/esm/adapter/device-helpers/device-features.js +0 -102
  419. package/dist/esm/adapter/device-helpers/device-features.js.map +0 -1
  420. package/dist/esm/adapter/device-helpers/device-limits.js +0 -91
  421. package/dist/esm/adapter/device-helpers/device-limits.js.map +0 -1
  422. package/dist/esm/adapter/device-helpers/get-device-info.js +0 -44
  423. package/dist/esm/adapter/device-helpers/get-device-info.js.map +0 -1
  424. package/dist/esm/adapter/device-helpers/is-old-ie.js +0 -8
  425. package/dist/esm/adapter/device-helpers/is-old-ie.js.map +0 -1
  426. package/dist/esm/adapter/helpers/attribute-utils.js +0 -81
  427. package/dist/esm/adapter/helpers/attribute-utils.js.map +0 -1
  428. package/dist/esm/adapter/helpers/get-shader-layout.js +0 -306
  429. package/dist/esm/adapter/helpers/get-shader-layout.js.map +0 -1
  430. package/dist/esm/adapter/helpers/parse-shader-compiler-log.js +0 -37
  431. package/dist/esm/adapter/helpers/parse-shader-compiler-log.js.map +0 -1
  432. package/dist/esm/adapter/helpers/set-uniform.js +0 -115
  433. package/dist/esm/adapter/helpers/set-uniform.js.map +0 -1
  434. package/dist/esm/adapter/helpers/uniforms.js +0 -99
  435. package/dist/esm/adapter/helpers/uniforms.js.map +0 -1
  436. package/dist/esm/adapter/objects/constants-to-keys.js +0 -42
  437. package/dist/esm/adapter/objects/constants-to-keys.js.map +0 -1
  438. package/dist/esm/adapter/objects/webgl-renderbuffer.js +0 -94
  439. package/dist/esm/adapter/objects/webgl-renderbuffer.js.map +0 -1
  440. package/dist/esm/adapter/objects/webgl-resource.js +0 -216
  441. package/dist/esm/adapter/objects/webgl-resource.js.map +0 -1
  442. package/dist/esm/adapter/objects/webgl-vertex-array-object.js +0 -84
  443. package/dist/esm/adapter/objects/webgl-vertex-array-object.js.map +0 -1
  444. package/dist/esm/adapter/resources/webgl-buffer.js +0 -164
  445. package/dist/esm/adapter/resources/webgl-buffer.js.map +0 -1
  446. package/dist/esm/adapter/resources/webgl-command-buffer.js +0 -65
  447. package/dist/esm/adapter/resources/webgl-command-buffer.js.map +0 -1
  448. package/dist/esm/adapter/resources/webgl-command-encoder.js +0 -53
  449. package/dist/esm/adapter/resources/webgl-command-encoder.js.map +0 -1
  450. package/dist/esm/adapter/resources/webgl-external-texture.js +0 -2
  451. package/dist/esm/adapter/resources/webgl-external-texture.js.map +0 -1
  452. package/dist/esm/adapter/resources/webgl-framebuffer.js +0 -265
  453. package/dist/esm/adapter/resources/webgl-framebuffer.js.map +0 -1
  454. package/dist/esm/adapter/resources/webgl-render-pass.js +0 -19
  455. package/dist/esm/adapter/resources/webgl-render-pass.js.map +0 -1
  456. package/dist/esm/adapter/resources/webgl-render-pipeline.js +0 -400
  457. package/dist/esm/adapter/resources/webgl-render-pipeline.js.map +0 -1
  458. package/dist/esm/adapter/resources/webgl-sampler.js +0 -50
  459. package/dist/esm/adapter/resources/webgl-sampler.js.map +0 -1
  460. package/dist/esm/adapter/resources/webgl-shader.js +0 -75
  461. package/dist/esm/adapter/resources/webgl-shader.js.map +0 -1
  462. package/dist/esm/adapter/resources/webgl-texture.js +0 -833
  463. package/dist/esm/adapter/resources/webgl-texture.js.map +0 -1
  464. package/dist/esm/adapter/webgl-canvas-context.js +0 -54
  465. package/dist/esm/adapter/webgl-canvas-context.js.map +0 -1
  466. package/dist/esm/adapter/webgl-device.js +0 -280
  467. package/dist/esm/adapter/webgl-device.js.map +0 -1
  468. package/dist/esm/bundle.js +0 -5
  469. package/dist/esm/bundle.js.map +0 -1
  470. package/dist/esm/classic/accessor.js +0 -144
  471. package/dist/esm/classic/accessor.js.map +0 -1
  472. package/dist/esm/classic/buffer.js +0 -384
  473. package/dist/esm/classic/buffer.js.map +0 -1
  474. package/dist/esm/classic/typed-array-utils.js +0 -112
  475. package/dist/esm/classic/typed-array-utils.js.map +0 -1
  476. package/dist/esm/context/context/context-state.js +0 -26
  477. package/dist/esm/context/context/context-state.js.map +0 -1
  478. package/dist/esm/context/context/create-context.js +0 -49
  479. package/dist/esm/context/context/create-context.js.map +0 -1
  480. package/dist/esm/context/context/device-pixels.js +0 -98
  481. package/dist/esm/context/context/device-pixels.js.map +0 -1
  482. package/dist/esm/context/context/webgl-checks.js +0 -34
  483. package/dist/esm/context/context/webgl-checks.js.map +0 -1
  484. package/dist/esm/context/debug/spector.js +0 -76
  485. package/dist/esm/context/debug/spector.js.map +0 -1
  486. package/dist/esm/context/debug/webgl-developer-tools.js +0 -121
  487. package/dist/esm/context/debug/webgl-developer-tools.js.map +0 -1
  488. package/dist/esm/context/parameters/unified-parameter-api.js +0 -65
  489. package/dist/esm/context/parameters/unified-parameter-api.js.map +0 -1
  490. package/dist/esm/context/parameters/webgl-parameter-tables.js +0 -445
  491. package/dist/esm/context/parameters/webgl-parameter-tables.js.map +0 -1
  492. package/dist/esm/context/polyfill/get-parameter-polyfill.js +0 -91
  493. package/dist/esm/context/polyfill/get-parameter-polyfill.js.map +0 -1
  494. package/dist/esm/context/polyfill/polyfill-context.js +0 -92
  495. package/dist/esm/context/polyfill/polyfill-context.js.map +0 -1
  496. package/dist/esm/context/polyfill/polyfill-table.js +0 -160
  497. package/dist/esm/context/polyfill/polyfill-table.js.map +0 -1
  498. package/dist/esm/context/polyfill/polyfill-vertex-array-object.js +0 -335
  499. package/dist/esm/context/polyfill/polyfill-vertex-array-object.js.map +0 -1
  500. package/dist/esm/context/state-tracker/deep-array-equal.js +0 -21
  501. package/dist/esm/context/state-tracker/deep-array-equal.js.map +0 -1
  502. package/dist/esm/context/state-tracker/track-context-state.js +0 -183
  503. package/dist/esm/context/state-tracker/track-context-state.js.map +0 -1
  504. package/dist/esm/context/state-tracker/with-parameters.js +0 -36
  505. package/dist/esm/context/state-tracker/with-parameters.js.map +0 -1
  506. package/dist/esm/index.js +0 -27
  507. package/dist/esm/index.js.map +0 -1
  508. package/dist/esm/init.js +0 -4
  509. package/dist/esm/init.js.map +0 -1
  510. package/dist/esm/types/webgl.js +0 -2
  511. package/dist/esm/types/webgl.js.map +0 -1
  512. package/dist/esm/types.js +0 -2
  513. package/dist/esm/types.js.map +0 -1
  514. package/dist/init.d.ts +0 -2
  515. package/dist/init.d.ts.map +0 -1
  516. package/dist/init.js +0 -4
  517. package/dist/init.js.map +0 -1
  518. package/dist/types/webgl.d.ts +0 -145
  519. package/dist/types/webgl.d.ts.map +0 -1
  520. package/dist/types/webgl.js +0 -2
  521. package/dist/types/webgl.js.map +0 -1
  522. package/src/adapter/converters/renderbuffer-formats.ts +0 -92
  523. package/src/adapter/helpers/attribute-utils.ts +0 -61
  524. package/src/adapter/objects/webgl-vertex-array-object.ts +0 -111
  525. package/src/bundle.ts +0 -4
  526. package/src/classic/buffer.ts +0 -474
  527. package/src/context/context/context-state.ts +0 -41
  528. package/src/context/context/create-context.ts +0 -110
  529. package/src/context/context/device-pixels.ts +0 -152
  530. package/src/init.ts +0 -4
  531. package/src/types/webgl.ts +0 -284
@@ -0,0 +1,167 @@
1
+ let _Symbol$toStringTag;
2
+ import { VertexArray, getScratchArray, fillArray } from '@luma.gl/core';
3
+ import { getBrowser } from '@probe.gl/env';
4
+ import { getGLFromVertexType } from "../converters/vertex-formats.js";
5
+ _Symbol$toStringTag = Symbol.toStringTag;
6
+ export class WEBGLVertexArray extends VertexArray {
7
+ get [_Symbol$toStringTag]() {
8
+ return 'VertexArray';
9
+ }
10
+ static isConstantAttributeZeroSupported(device) {
11
+ return device.info.type === 'webgl2' || getBrowser() === 'Chrome';
12
+ }
13
+ constructor(device, props) {
14
+ super(device, props);
15
+ this.device = void 0;
16
+ this.handle = void 0;
17
+ this.buffer = null;
18
+ this.bufferValue = null;
19
+ this.init = false;
20
+ this.device = device;
21
+ this.handle = this.device.gl2.createVertexArray();
22
+ }
23
+ destroy() {
24
+ super.destroy();
25
+ if (this.buffer) {
26
+ var _this$buffer;
27
+ (_this$buffer = this.buffer) === null || _this$buffer === void 0 ? void 0 : _this$buffer.destroy();
28
+ }
29
+ if (this.handle) {
30
+ this.device.gl2.deleteVertexArray(this.handle);
31
+ this.handle = undefined;
32
+ }
33
+ }
34
+ setIndexBuffer(indexBuffer) {
35
+ const buffer = indexBuffer;
36
+ if (buffer && buffer.glTarget !== 34963) {
37
+ throw new Error('Use .setBuffer()');
38
+ }
39
+ this.device.gl2.bindVertexArray(this.handle);
40
+ this.device.gl2.bindBuffer(34963, buffer ? buffer.handle : null);
41
+ this.indexBuffer = buffer;
42
+ }
43
+ setBuffer(location, attributeBuffer) {
44
+ const buffer = attributeBuffer;
45
+ if (buffer.glTarget === 34963) {
46
+ throw new Error('Use .setIndexBuffer()');
47
+ }
48
+ const {
49
+ size,
50
+ type,
51
+ stride,
52
+ offset,
53
+ normalized,
54
+ integer,
55
+ divisor
56
+ } = this._getAccessor(location);
57
+ this.device.gl2.bindVertexArray(this.handle);
58
+ this.device.gl.bindBuffer(34962, buffer.handle);
59
+ if (integer) {
60
+ this.device.assertWebGL2();
61
+ this.device.gl2.vertexAttribIPointer(location, size, type, stride, offset);
62
+ } else {
63
+ this.device.gl.vertexAttribPointer(location, size, type, normalized, stride, offset);
64
+ }
65
+ this.device.gl.enableVertexAttribArray(location);
66
+ this.device.gl2.vertexAttribDivisor(location, divisor || 0);
67
+ this.attributes[location] = buffer;
68
+ }
69
+ setConstant(location, value) {
70
+ this._enable(location, false);
71
+ this.attributes[location] = value;
72
+ }
73
+ bindBeforeRender() {
74
+ this.device.gl2.bindVertexArray(this.handle);
75
+ if (!this.init) {
76
+ const webglBuffer = this.indexBuffer;
77
+ this.device.gl2.bindBuffer(34963, (webglBuffer === null || webglBuffer === void 0 ? void 0 : webglBuffer.handle) || null);
78
+ this.init = true;
79
+ }
80
+ this._applyConstantAttributes();
81
+ }
82
+ unbindAfterRender() {
83
+ this.device.gl2.bindVertexArray(null);
84
+ }
85
+ _applyConstantAttributes() {
86
+ for (let location = 0; location < this.maxVertexAttributes; ++location) {
87
+ const constant = this.attributes[location];
88
+ if (ArrayBuffer.isView(constant)) {
89
+ this.device.setConstantAttribute(location, constant);
90
+ }
91
+ }
92
+ }
93
+ _getAccessor(location) {
94
+ const attributeInfo = this.attributeInfos[location];
95
+ if (!attributeInfo) {
96
+ throw new Error(`Unknown attribute location ${location}`);
97
+ }
98
+ const glType = getGLFromVertexType(attributeInfo.bufferDataType);
99
+ return {
100
+ size: attributeInfo.bufferComponents,
101
+ type: glType,
102
+ stride: attributeInfo.byteStride,
103
+ offset: attributeInfo.byteOffset,
104
+ normalized: attributeInfo.normalized,
105
+ integer: attributeInfo.integer,
106
+ divisor: attributeInfo.stepMode === 'instance' ? 1 : 0
107
+ };
108
+ }
109
+ _enable(location) {
110
+ let enable = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
111
+ const canDisableAttributeZero = WEBGLVertexArray.isConstantAttributeZeroSupported(this.device);
112
+ const canDisableAttribute = canDisableAttributeZero || location !== 0;
113
+ if (enable || canDisableAttribute) {
114
+ location = Number(location);
115
+ this.device.gl2.bindVertexArray(this.handle);
116
+ if (enable) {
117
+ this.device.gl.enableVertexAttribArray(location);
118
+ } else {
119
+ this.device.gl.disableVertexAttribArray(location);
120
+ }
121
+ this.device.gl2.bindVertexArray(null);
122
+ }
123
+ }
124
+ getConstantBuffer(elementCount, value) {
125
+ const constantValue = normalizeConstantArrayValue(value);
126
+ const byteLength = constantValue.byteLength * elementCount;
127
+ const length = constantValue.length * elementCount;
128
+ if (this.buffer && byteLength !== this.buffer.byteLength) {
129
+ throw new Error(`Buffer size is immutable, byte length ${byteLength} !== ${this.buffer.byteLength}.`);
130
+ }
131
+ let updateNeeded = !this.buffer;
132
+ this.buffer = this.buffer || this.device.createBuffer({
133
+ byteLength
134
+ });
135
+ updateNeeded = updateNeeded || !compareConstantArrayValues(constantValue, this.bufferValue);
136
+ if (updateNeeded) {
137
+ const typedArray = getScratchArray(value.constructor, length);
138
+ fillArray({
139
+ target: typedArray,
140
+ source: constantValue,
141
+ start: 0,
142
+ count: length
143
+ });
144
+ this.buffer.write(typedArray);
145
+ this.bufferValue = value;
146
+ }
147
+ return this.buffer;
148
+ }
149
+ }
150
+ function normalizeConstantArrayValue(arrayValue) {
151
+ if (Array.isArray(arrayValue)) {
152
+ return new Float32Array(arrayValue);
153
+ }
154
+ return arrayValue;
155
+ }
156
+ function compareConstantArrayValues(v1, v2) {
157
+ if (!v1 || !v2 || v1.length !== v2.length || v1.constructor !== v2.constructor) {
158
+ return false;
159
+ }
160
+ for (let i = 0; i < v1.length; ++i) {
161
+ if (v1[i] !== v2[i]) {
162
+ return false;
163
+ }
164
+ }
165
+ return true;
166
+ }
167
+ //# sourceMappingURL=webgl-vertex-array.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webgl-vertex-array.js","names":["VertexArray","getScratchArray","fillArray","getBrowser","getGLFromVertexType","_Symbol$toStringTag","Symbol","toStringTag","WEBGLVertexArray","isConstantAttributeZeroSupported","device","info","type","constructor","props","handle","buffer","bufferValue","init","gl2","createVertexArray","destroy","_this$buffer","deleteVertexArray","undefined","setIndexBuffer","indexBuffer","glTarget","Error","bindVertexArray","bindBuffer","setBuffer","location","attributeBuffer","size","stride","offset","normalized","integer","divisor","_getAccessor","gl","assertWebGL2","vertexAttribIPointer","vertexAttribPointer","enableVertexAttribArray","vertexAttribDivisor","attributes","setConstant","value","_enable","bindBeforeRender","webglBuffer","_applyConstantAttributes","unbindAfterRender","maxVertexAttributes","constant","ArrayBuffer","isView","setConstantAttribute","attributeInfo","attributeInfos","glType","bufferDataType","bufferComponents","byteStride","byteOffset","stepMode","enable","arguments","length","canDisableAttributeZero","canDisableAttribute","Number","disableVertexAttribArray","getConstantBuffer","elementCount","constantValue","normalizeConstantArrayValue","byteLength","updateNeeded","createBuffer","compareConstantArrayValues","typedArray","target","source","start","count","write","arrayValue","Array","isArray","Float32Array","v1","v2","i"],"sources":["../../../src/adapter/resources/webgl-vertex-array.ts"],"sourcesContent":["// luma.gl, MIT license\n// Copyright (c) vis.gl contributors\n\nimport type {Device, Buffer, VertexArrayProps, TypedArray, NumberArray} from '@luma.gl/core';\nimport {VertexArray, getScratchArray, fillArray} from '@luma.gl/core';\nimport {GL} from '@luma.gl/constants';\nimport {getBrowser} from '@probe.gl/env';\n\nimport {WebGLDevice} from '../webgl-device';\nimport {WEBGLBuffer} from '../resources/webgl-buffer';\n\nimport {getGLFromVertexType} from '../converters/vertex-formats';\n// import {AccessorObject} from '../..';\n// import {getGLFromVertexType} from '../converters/vertex-formats';\n\n/** VertexArrayObject wrapper */\nexport class WEBGLVertexArray extends VertexArray {\n override get [Symbol.toStringTag](): string {\n return 'VertexArray';\n }\n\n readonly device: WebGLDevice;\n readonly handle: WebGLVertexArrayObject;\n\n /** Attribute 0 buffer constant */\n private buffer: WEBGLBuffer | null = null;\n private bufferValue = null;\n\n /** * Attribute 0 can not be disable on most desktop OpenGL based browsers */\n static isConstantAttributeZeroSupported(device: Device): boolean {\n return device.info.type === 'webgl2' || getBrowser() === 'Chrome';\n }\n\n // Create a VertexArray\n constructor(device: WebGLDevice, props?: VertexArrayProps) {\n super(device, props);\n this.device = device;\n this.handle = this.device.gl2.createVertexArray();\n }\n\n override destroy(): void {\n super.destroy();\n if (this.buffer) {\n this.buffer?.destroy();\n }\n if (this.handle) {\n this.device.gl2.deleteVertexArray(this.handle);\n // @ts-expect-error read-only/undefined\n this.handle = undefined!;\n }\n\n // Auto-delete elements?\n // return [this.elements];\n }\n\n /**\n // Set (bind/unbind) an elements buffer, for indexed rendering.\n // Must be a Buffer bound to GL.ELEMENT_ARRAY_BUFFER or null. Constants not supported\n * \n * @param elementBuffer \n */\n setIndexBuffer(indexBuffer: Buffer | null): void {\n const buffer = indexBuffer as WEBGLBuffer;\n // Explicitly allow `null` to support clearing the index buffer\n if (buffer && buffer.glTarget !== GL.ELEMENT_ARRAY_BUFFER) {\n throw new Error('Use .setBuffer()');\n }\n // In WebGL The GL.ELEMENT_ARRAY_BUFFER_BINDING is stored on the VertexArrayObject\n this.device.gl2.bindVertexArray(this.handle);\n // TODO - this initial binding does not seem to take effect? see bindBeforeRender()\n this.device.gl2.bindBuffer(GL.ELEMENT_ARRAY_BUFFER, buffer ? buffer.handle : null);\n // log.log(1, 'VertexArray.setIndexBuffer', indexBuffer)();\n // log.log(1, `Binding vertex array ${this.id}`, buffer?.id)();\n\n this.indexBuffer = buffer;\n }\n\n /** Set a location in vertex attributes array to a buffer, enables the location, sets divisor */\n setBuffer(location: number, attributeBuffer: Buffer): void {\n const buffer = attributeBuffer as WEBGLBuffer;\n // Sanity check target\n if (buffer.glTarget === GL.ELEMENT_ARRAY_BUFFER) {\n throw new Error('Use .setIndexBuffer()');\n }\n\n const {size, type, stride, offset, normalized, integer, divisor} = this._getAccessor(location);\n\n this.device.gl2.bindVertexArray(this.handle);\n // A non-zero buffer object must be bound to the GL_ARRAY_BUFFER target\n this.device.gl.bindBuffer(GL.ARRAY_BUFFER, buffer.handle);\n\n // WebGL2 supports *integer* data formats, i.e. GPU will see integer values\n if (integer) {\n this.device.assertWebGL2();\n this.device.gl2.vertexAttribIPointer(location, size, type, stride, offset);\n } else {\n // Attaches ARRAY_BUFFER with specified buffer format to location\n this.device.gl.vertexAttribPointer(location, size, type, normalized, stride, offset);\n }\n\n // Mark as non-constant\n this.device.gl.enableVertexAttribArray(location);\n // Set the step mode 0=vertex, 1=instance\n this.device.gl2.vertexAttribDivisor(location, divisor || 0);\n\n this.attributes[location] = buffer;\n }\n\n /** Set a location in vertex attributes array to a constant value, disables the location */\n override setConstant(location: number, value: TypedArray): void {\n this._enable(location, false);\n this.attributes[location] = value;\n }\n\n init = false;\n\n override bindBeforeRender(): void {\n this.device.gl2.bindVertexArray(this.handle);\n // TODO - the initial bind does not seem to take effect.\n if (!this.init) {\n // log.log(1, `Binding vertex array ${this.id}`, this.indexBuffer?.id)();\n const webglBuffer = this.indexBuffer as WEBGLBuffer;\n this.device.gl2.bindBuffer(GL.ELEMENT_ARRAY_BUFFER, webglBuffer?.handle || null);\n this.init = true;\n }\n this._applyConstantAttributes();\n }\n\n override unbindAfterRender(): void {\n // log.log(1, `Unbinding vertex array ${this.id}`)();\n // TODO technically this is not necessary, but we might be interfacing\n // with code that does not use vertex array objects\n this.device.gl2.bindVertexArray(null);\n // this.device.gl2.bindBuffer(GL.ELEMENT_ARRAY_BUFFER, null);\n }\n\n // Internal methods\n\n /**\n * Constant attributes need to be reset before every draw call\n * Any attribute that is disabled in the current vertex array object\n * is read from the context's global constant value for that attribute location.\n * @note Constant attributes are only supported in WebGL, not in WebGPU\n */\n protected _applyConstantAttributes(): void {\n for (let location = 0; location < this.maxVertexAttributes; ++location) {\n const constant = this.attributes[location];\n // A typed array means this is a constant\n if (ArrayBuffer.isView(constant)) {\n this.device.setConstantAttribute(location, constant);\n }\n }\n }\n\n /**\n * Set a location in vertex attributes array to a buffer, enables the location, sets divisor\n * @note requires vertex array to be bound\n */\n // protected _setAttributeLayout(location: number): void {\n // const {size, type, stride, offset, normalized, integer, divisor} = this._getAccessor(location);\n\n // // WebGL2 supports *integer* data formats, i.e. GPU will see integer values\n // if (integer) {\n // this.device.assertWebGL2();\n // this.device.gl2.vertexAttribIPointer(location, size, type, stride, offset);\n // } else {\n // // Attaches ARRAY_BUFFER with specified buffer format to location\n // this.device.gl.vertexAttribPointer(location, size, type, normalized, stride, offset);\n // }\n // this.device.gl2.vertexAttribDivisor(location, divisor || 0);\n // }\n\n /** Get an accessor from the */\n protected _getAccessor(location: number) {\n const attributeInfo = this.attributeInfos[location];\n if (!attributeInfo) {\n throw new Error(`Unknown attribute location ${location}`);\n }\n const glType = getGLFromVertexType(attributeInfo.bufferDataType);\n return {\n size: attributeInfo.bufferComponents,\n type: glType,\n stride: attributeInfo.byteStride,\n offset: attributeInfo.byteOffset,\n normalized: attributeInfo.normalized,\n // it is the shader attribute declaration, not the vertex memory format,\n // that determines if the data in the buffer will be treated as integers.\n //\n // Also note that WebGL supports assigning non-normalized integer data to floating point attributes,\n // but as far as we can tell, WebGPU does not.\n integer: attributeInfo.integer,\n divisor: attributeInfo.stepMode === 'instance' ? 1 : 0\n };\n }\n\n /**\n * Enabling an attribute location makes it reference the currently bound buffer\n * Disabling an attribute location makes it reference the global constant value\n * TODO - handle single values for size 1 attributes?\n * TODO - convert classic arrays based on known type?\n */\n protected _enable(location: number, enable = true): void {\n // Attribute 0 cannot be disabled in most desktop OpenGL based browsers...\n const canDisableAttributeZero = WEBGLVertexArray.isConstantAttributeZeroSupported(this.device);\n const canDisableAttribute = canDisableAttributeZero || location !== 0;\n\n if (enable || canDisableAttribute) {\n location = Number(location);\n this.device.gl2.bindVertexArray(this.handle);\n if (enable) {\n this.device.gl.enableVertexAttribArray(location);\n } else {\n this.device.gl.disableVertexAttribArray(location);\n }\n this.device.gl2.bindVertexArray(null);\n }\n }\n\n /**\n * Provide a means to create a buffer that is equivalent to a constant.\n * NOTE: Desktop OpenGL cannot disable attribute 0.\n * https://stackoverflow.com/questions/20305231/webgl-warning-attribute-0-is-disabled-\n * this-has-significant-performance-penalty\n */\n getConstantBuffer(elementCount: number, value: TypedArray): Buffer {\n // Create buffer only when needed, and reuse it (avoids inflating buffer creation statistics)\n\n const constantValue = normalizeConstantArrayValue(value);\n\n const byteLength = constantValue.byteLength * elementCount;\n const length = constantValue.length * elementCount;\n\n if (this.buffer && byteLength !== this.buffer.byteLength) {\n throw new Error(\n `Buffer size is immutable, byte length ${byteLength} !== ${this.buffer.byteLength}.`\n );\n }\n let updateNeeded = !this.buffer;\n\n this.buffer = this.buffer || this.device.createBuffer({byteLength});\n\n // Reallocate and update contents if needed\n updateNeeded = updateNeeded || !compareConstantArrayValues(constantValue, this.bufferValue);\n\n if (updateNeeded) {\n // Create a typed array that is big enough, and fill it with the required data\n const typedArray = getScratchArray(value.constructor, length);\n fillArray({target: typedArray, source: constantValue, start: 0, count: length});\n this.buffer.write(typedArray);\n this.bufferValue = value;\n }\n\n return this.buffer;\n }\n}\n\n// HELPER FUNCTIONS\n\n/**\n * TODO - convert Arrays based on known type? (read type from accessor, don't assume Float32Array)\n * TODO - handle single values for size 1 attributes?\n */\nfunction normalizeConstantArrayValue(arrayValue: NumberArray) {\n if (Array.isArray(arrayValue)) {\n return new Float32Array(arrayValue);\n }\n return arrayValue;\n}\n\n/**\n *\n */\nfunction compareConstantArrayValues(v1: NumberArray, v2: NumberArray): boolean {\n if (!v1 || !v2 || v1.length !== v2.length || v1.constructor !== v2.constructor) {\n return false;\n }\n for (let i = 0; i < v1.length; ++i) {\n if (v1[i] !== v2[i]) {\n return false;\n }\n }\n return true;\n}\n"],"mappings":";AAIA,SAAQA,WAAW,EAAEC,eAAe,EAAEC,SAAS,QAAO,eAAe;AAErE,SAAQC,UAAU,QAAO,eAAe;AAA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B,OAAO,IAAIG,YAAY,CAACH,UAAU,CAAC;EACrC;EACA,OAAOA,UAAU;AACnB;AAKA,SAASP,0BAA0BA,CAACW,EAAe,EAAEC,EAAe,EAAW;EAC7E,IAAI,CAACD,EAAE,IAAI,CAACC,EAAE,IAAID,EAAE,CAACvB,MAAM,KAAKwB,EAAE,CAACxB,MAAM,IAAIuB,EAAE,CAAChF,WAAW,KAAKiF,EAAE,CAACjF,WAAW,EAAE;IAC9E,OAAO,KAAK;EACd;EACA,KAAK,IAAIkF,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGF,EAAE,CAACvB,MAAM,EAAE,EAAEyB,CAAC,EAAE;IAClC,IAAIF,EAAE,CAACE,CAAC,CAAC,KAAKD,EAAE,CAACC,CAAC,CAAC,EAAE;MACnB,OAAO,KAAK;IACd;EACF;EACA,OAAO,IAAI;AACb"}
@@ -1,12 +1,11 @@
1
- import type { CanvasContextProps } from '@luma.gl/api';
2
- import { CanvasContext } from '@luma.gl/api';
3
- import WebGLDevice from './webgl-device';
4
- import WEBGLFramebuffer from './resources/webgl-framebuffer';
1
+ import type { CanvasContextProps } from '@luma.gl/core';
2
+ import { CanvasContext } from '@luma.gl/core';
3
+ import { WebGLDevice } from './webgl-device';
4
+ import { WEBGLFramebuffer } from './resources/webgl-framebuffer';
5
5
  /**
6
- * Holds a WebGL Canvas Context which will handle drawing buffer resizing etc
7
- * @todo This class is WIP, intended to replace the old gltools-based context size tracking
6
+ * A WebGL Canvas Context which manages the canvas and handles drawing buffer resizing etc
8
7
  */
9
- export default class WebGLCanvasContext extends CanvasContext {
8
+ export declare class WebGLCanvasContext extends CanvasContext {
10
9
  readonly device: WebGLDevice;
11
10
  presentationSize: [number, number];
12
11
  private _framebuffer;
@@ -1 +1 @@
1
- {"version":3,"file":"webgl-canvas-context.d.ts","sourceRoot":"","sources":["../../src/adapter/webgl-canvas-context.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,cAAc,CA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C,sDAAsD;IACtD,MAAM;IAQN;;;;;;;;;;;OAWG;IACH,MAAM,CAAC,OAAO,CAAC,EAAE;QAAC,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,eAAe,CAAC,EAAE,OAAO,GAAG,MAAM,CAAA;KAAC,GAAG,IAAI;IAe7F,MAAM;CAOP"}
@@ -1,22 +1,16 @@
1
- import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
- import { CanvasContext } from '@luma.gl/api';
3
- import { getDevicePixelRatio, setDevicePixelRatio } from '../context/context/device-pixels';
4
- import WEBGLFramebuffer from './resources/webgl-framebuffer';
5
- export default class WebGLCanvasContext extends CanvasContext {
1
+ import { CanvasContext } from '@luma.gl/core';
2
+ import { WEBGLFramebuffer } from "./resources/webgl-framebuffer.js";
3
+ export class WebGLCanvasContext extends CanvasContext {
6
4
  constructor(device, props) {
7
5
  super(props);
8
-
9
- _defineProperty(this, "device", void 0);
10
-
11
- _defineProperty(this, "presentationSize", void 0);
12
-
13
- _defineProperty(this, "_framebuffer", void 0);
14
-
6
+ this.device = void 0;
7
+ this.presentationSize = void 0;
8
+ this._framebuffer = null;
15
9
  this.device = device;
16
10
  this.presentationSize = [-1, -1];
11
+ this._setAutoCreatedCanvasId(`${this.device.id}-canvas`);
17
12
  this.update();
18
13
  }
19
-
20
14
  getCurrentFramebuffer() {
21
15
  this.update();
22
16
  this._framebuffer = this._framebuffer || new WEBGLFramebuffer(this.device, {
@@ -24,31 +18,24 @@ export default class WebGLCanvasContext extends CanvasContext {
24
18
  });
25
19
  return this._framebuffer;
26
20
  }
27
-
28
21
  update() {
29
22
  const size = this.getPixelSize();
30
23
  const sizeChanged = size[0] !== this.presentationSize[0] || size[1] !== this.presentationSize[1];
31
-
32
24
  if (sizeChanged) {
33
25
  this.presentationSize = size;
34
26
  }
35
27
  }
36
-
37
28
  resize(options) {
38
29
  if (this.canvas) {
39
- const devicePixelRatio = getDevicePixelRatio(options === null || options === void 0 ? void 0 : options.useDevicePixels);
40
- setDevicePixelRatio(this.device.gl, devicePixelRatio, options);
30
+ const devicePixelRatio = this.getDevicePixelRatio(options === null || options === void 0 ? void 0 : options.useDevicePixels);
31
+ this.setDevicePixelRatio(devicePixelRatio, options);
41
32
  return;
42
33
  }
43
-
44
34
  const ext = this.device.gl.getExtension('STACKGL_resize_drawingbuffer');
45
-
46
- if (ext && options && "width" in options && "height" in options) {
35
+ if (ext && options && 'width' in options && 'height' in options) {
47
36
  ext.resize(options.width, options.height);
48
37
  }
49
38
  }
50
-
51
39
  commit() {}
52
-
53
40
  }
54
41
  //# sourceMappingURL=webgl-canvas-context.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/adapter/webgl-canvas-context.ts"],"names":["CanvasContext","getDevicePixelRatio","setDevicePixelRatio","WEBGLFramebuffer","WebGLCanvasContext","constructor","device","props","presentationSize","update","getCurrentFramebuffer","_framebuffer","handle","size","getPixelSize","sizeChanged","resize","options","canvas","devicePixelRatio","useDevicePixels","gl","ext","getExtension","width","height","commit"],"mappings":";AAEA,SAAQA,aAAR,QAA4B,cAA5B;AACA,SAAQC,mBAAR,EAA6BC,mBAA7B,QAAuD,kCAAvD;AAEA,OAAOC,gBAAP,MAA6B,+BAA7B;AAMA,eAAe,MAAMC,kBAAN,SAAiCJ,aAAjC,CAA+C;AAK5DK,EAAAA,WAAW,CAACC,MAAD,EAAsBC,KAAtB,EAAiD;AAE1D,UAAMA,KAAN;;AAF0D;;AAAA;;AAAA;;AAG1D,SAAKD,MAAL,GAAcA,MAAd;AACA,SAAKE,gBAAL,GAAwB,CAAC,CAAC,CAAF,EAAK,CAAC,CAAN,CAAxB;AACA,SAAKC,MAAL;AACD;;AAEDC,EAAAA,qBAAqB,GAAqB;AACxC,SAAKD,MAAL;AACA,SAAKE,YAAL,GAAoB,KAAKA,YAAL,IAAqB,IAAIR,gBAAJ,CAAqB,KAAKG,MAA1B,EAAkC;AAACM,MAAAA,MAAM,EAAE;AAAT,KAAlC,CAAzC;AACA,WAAO,KAAKD,YAAZ;AACD;;AAGDF,EAAAA,MAAM,GAAG;AACP,UAAMI,IAAI,GAAG,KAAKC,YAAL,EAAb;AACA,UAAMC,WAAW,GAAGF,IAAI,CAAC,CAAD,CAAJ,KAAY,KAAKL,gBAAL,CAAsB,CAAtB,CAAZ,IAAwCK,IAAI,CAAC,CAAD,CAAJ,KAAY,KAAKL,gBAAL,CAAsB,CAAtB,CAAxE;;AACA,QAAIO,WAAJ,EAAiB;AACf,WAAKP,gBAAL,GAAwBK,IAAxB;AACD;AACF;;AAcAG,EAAAA,MAAM,CAACC,OAAD,EAAwF;AAE7F,QAAI,KAAKC,MAAT,EAAiB;AACf,YAAMC,gBAAgB,GAAGlB,mBAAmB,CAACgB,OAAD,aAACA,OAAD,uBAACA,OAAO,CAAEG,eAAV,CAA5C;AACAlB,MAAAA,mBAAmB,CAAC,KAAKI,MAAL,CAAYe,EAAb,EAAiBF,gBAAjB,EAAmCF,OAAnC,CAAnB;AACA;AACD;;AAGD,UAAMK,GAAG,GAAG,KAAKhB,MAAL,CAAYe,EAAZ,CAAeE,YAAf,CAA4B,8BAA5B,CAAZ;;AACA,QAAID,GAAG,IAAIL,OAAP,IAAkB,WAAWA,OAA7B,IAAwC,YAAYA,OAAxD,EAAiE;AAC/DK,MAAAA,GAAG,CAACN,MAAJ,CAAWC,OAAO,CAACO,KAAnB,EAA0BP,OAAO,CAACQ,MAAlC;AACD;AACF;;AAEDC,EAAAA,MAAM,GAAG,CAMR;;AA7D2D","sourcesContent":["// luma.gl, MIT license\nimport type {CanvasContextProps} from '@luma.gl/api';\nimport {CanvasContext} from '@luma.gl/api';\nimport {getDevicePixelRatio, setDevicePixelRatio} from '../context/context/device-pixels';\nimport WebGLDevice from './webgl-device';\nimport WEBGLFramebuffer from './resources/webgl-framebuffer';\n\n/** \n * Holds a WebGL Canvas Context which will handle drawing buffer resizing etc \n * @todo This class is WIP, intended to replace the old gltools-based context size tracking\n */\nexport default class WebGLCanvasContext extends CanvasContext {\n readonly device: WebGLDevice;\n presentationSize: [number, number];\n private _framebuffer: WEBGLFramebuffer;\n\n constructor(device: WebGLDevice, props: CanvasContextProps) {\n // Note: Base class creates / looks up the canvas (unless under Node.js)\n super(props);\n this.device = device;\n this.presentationSize = [-1, -1];\n this.update();\n }\n\n getCurrentFramebuffer(): WEBGLFramebuffer {\n this.update();\n this._framebuffer = this._framebuffer || new WEBGLFramebuffer(this.device, {handle: null});\n return this._framebuffer;\n }\n\n /** Resizes and updates render targets if necessary */\n update() {\n const size = this.getPixelSize();\n const sizeChanged = size[0] !== this.presentationSize[0] || size[1] !== this.presentationSize[1];\n if (sizeChanged) {\n this.presentationSize = size;\n }\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 resize(options?: {width?: number; height?: number; useDevicePixels?: boolean | number}): void {\n // Resize browser context .\n if (this.canvas) {\n const devicePixelRatio = getDevicePixelRatio(options?.useDevicePixels);\n setDevicePixelRatio(this.device.gl, devicePixelRatio, options);\n return;\n }\n\n // Resize headless gl context\n const ext = this.device.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 commit() {\n // gl.commit was ultimately removed from standard??\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"],"file":"webgl-canvas-context.js"}
1
+ {"version":3,"file":"webgl-canvas-context.js","names":["CanvasContext","WEBGLFramebuffer","WebGLCanvasContext","constructor","device","props","presentationSize","_framebuffer","_setAutoCreatedCanvasId","id","update","getCurrentFramebuffer","handle","size","getPixelSize","sizeChanged","resize","options","canvas","devicePixelRatio","getDevicePixelRatio","useDevicePixels","setDevicePixelRatio","ext","gl","getExtension","width","height","commit"],"sources":["../../src/adapter/webgl-canvas-context.ts"],"sourcesContent":["// luma.gl, MIT license\n// Copyright (c) vis.gl contributors\n\nimport type {CanvasContextProps} from '@luma.gl/core';\nimport {CanvasContext} from '@luma.gl/core';\nimport {WebGLDevice} from './webgl-device';\nimport {WEBGLFramebuffer} from './resources/webgl-framebuffer';\n\n/** \n * A WebGL Canvas Context which manages the canvas and handles drawing buffer resizing etc \n */\nexport class WebGLCanvasContext extends CanvasContext {\n readonly device: WebGLDevice;\n presentationSize: [number, number];\n private _framebuffer: WEBGLFramebuffer | null = null;\n\n constructor(device: WebGLDevice, props: CanvasContextProps) {\n // Note: Base class creates / looks up the canvas (unless under Node.js)\n super(props);\n this.device = device;\n this.presentationSize = [-1, -1];\n this._setAutoCreatedCanvasId(`${this.device.id}-canvas`);\n this.update();\n }\n\n getCurrentFramebuffer(): WEBGLFramebuffer {\n this.update();\n // Setting handle to null returns a reference to the default framebuffer\n this._framebuffer = this._framebuffer || new WEBGLFramebuffer(this.device, {handle: null});\n return this._framebuffer;\n }\n\n /** Resizes and updates render targets if necessary */\n update() {\n const size = this.getPixelSize();\n const sizeChanged = size[0] !== this.presentationSize[0] || size[1] !== this.presentationSize[1];\n if (sizeChanged) {\n this.presentationSize = size;\n }\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 resize(options?: {width?: number; height?: number; useDevicePixels?: boolean | number}): void {\n // Resize browser context .\n if (this.canvas) {\n const devicePixelRatio = this.getDevicePixelRatio(options?.useDevicePixels);\n this.setDevicePixelRatio(devicePixelRatio, options);\n return;\n }\n\n // Resize headless gl context\n const ext = this.device.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 commit() {\n // gl.commit was ultimately removed from the WebGL standard??\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"],"mappings":"AAIA,SAAQA,aAAa,QAAO,eAAe;AAAC,SAEpCC,gBAAgB;AAKxB,OAAO,MAAMC,kBAAkB,SAASF,aAAa,CAAC;EAKpDG,WAAWA,CAACC,MAAmB,EAAEC,KAAyB,EAAE;IAE1D,KAAK,CAACA,KAAK,CAAC;IAAC,KANND,MAAM;IAAA,KACfE,gBAAgB;IAAA,KACRC,YAAY,GAA4B,IAAI;IAKlD,IAAI,CAACH,MAAM,GAAGA,MAAM;IACpB,IAAI,CAACE,gBAAgB,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAChC,IAAI,CAACE,uBAAuB,CAAE,GAAE,IAAI,CAACJ,MAAM,CAACK,EAAG,SAAQ,CAAC;IACxD,IAAI,CAACC,MAAM,CAAC,CAAC;EACf;EAEAC,qBAAqBA,CAAA,EAAqB;IACxC,IAAI,CAACD,MAAM,CAAC,CAAC;IAEb,IAAI,CAACH,YAAY,GAAG,IAAI,CAACA,YAAY,IAAI,IAAIN,gBAAgB,CAAC,IAAI,CAACG,MAAM,EAAE;MAACQ,MAAM,EAAE;IAAI,CAAC,CAAC;IAC1F,OAAO,IAAI,CAACL,YAAY;EAC1B;EAGAG,MAAMA,CAAA,EAAG;IACP,MAAMG,IAAI,GAAG,IAAI,CAACC,YAAY,CAAC,CAAC;IAChC,MAAMC,WAAW,GAAGF,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAACP,gBAAgB,CAAC,CAAC,CAAC,IAAIO,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAACP,gBAAgB,CAAC,CAAC,CAAC;IAChG,IAAIS,WAAW,EAAE;MACf,IAAI,CAACT,gBAAgB,GAAGO,IAAI;IAC9B;EACF;EAcAG,MAAMA,CAACC,OAA+E,EAAQ;IAE5F,IAAI,IAAI,CAACC,MAAM,EAAE;MACf,MAAMC,gBAAgB,GAAG,IAAI,CAACC,mBAAmB,CAACH,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEI,eAAe,CAAC;MAC3E,IAAI,CAACC,mBAAmB,CAACH,gBAAgB,EAAEF,OAAO,CAAC;MACnD;IACF;IAGA,MAAMM,GAAG,GAAG,IAAI,CAACnB,MAAM,CAACoB,EAAE,CAACC,YAAY,CAAC,8BAA8B,CAAC;IACvE,IAAIF,GAAG,IAAIN,OAAO,IAAI,OAAO,IAAIA,OAAO,IAAI,QAAQ,IAAIA,OAAO,EAAE;MAC/DM,GAAG,CAACP,MAAM,CAACC,OAAO,CAACS,KAAK,EAAET,OAAO,CAACU,MAAM,CAAC;IAC3C;EACF;EAEAC,MAAMA,CAAA,EAAG,CAMT;AACF"}
@@ -1,53 +1,33 @@
1
- import type { DeviceProps, DeviceInfo, DeviceLimits, DeviceFeature, CanvasContextProps, TextureFormat } from '@luma.gl/api';
2
- import { Device, CanvasContext } from '@luma.gl/api';
3
- import { ContextState } from '../context/context/context-state';
1
+ import type { DeviceProps, DeviceInfo, DeviceLimits, DeviceFeature, CanvasContextProps, TextureFormat, VertexArray, VertexArrayProps, TypedArray } from '@luma.gl/core';
2
+ import { Device, CanvasContext } from '@luma.gl/core';
4
3
  import { WebGLLimits } from './device-helpers/device-limits';
5
- import WebGLCanvasContext from './webgl-canvas-context';
6
- import type { BufferProps, ShaderProps, SamplerProps, TextureProps, ExternalTexture, ExternalTextureProps, FramebufferProps, RenderPipelineProps, ComputePipeline, ComputePipelineProps, RenderPassProps, ComputePass, ComputePassProps } from '@luma.gl/api';
7
- import WEBGLBuffer from './resources/webgl-buffer';
8
- import WEBGLShader from './resources/webgl-shader';
9
- import WEBGLSampler from './resources/webgl-sampler';
10
- import WEBGLTexture from './resources/webgl-texture';
11
- import WEBGLFramebuffer from './resources/webgl-framebuffer';
12
- import WEBGLRenderPass from './resources/webgl-render-pass';
13
- import WEBGLRenderPipeline from './resources/webgl-render-pipeline';
4
+ import { WebGLCanvasContext } from './webgl-canvas-context';
5
+ import type { BufferProps, ShaderProps, SamplerProps, TextureProps, ExternalTexture, ExternalTextureProps, FramebufferProps, RenderPipelineProps, ComputePipeline, ComputePipelineProps, RenderPassProps, ComputePass, ComputePassProps, CommandEncoderProps, TransformFeedbackProps } from '@luma.gl/core';
6
+ import { WEBGLBuffer } from './resources/webgl-buffer';
7
+ import { WEBGLShader } from './resources/webgl-shader';
8
+ import { WEBGLSampler } from './resources/webgl-sampler';
9
+ import { WEBGLTexture } from './resources/webgl-texture';
10
+ import { WEBGLFramebuffer } from './resources/webgl-framebuffer';
11
+ import { WEBGLRenderPass } from './resources/webgl-render-pass';
12
+ import { WEBGLRenderPipeline } from './resources/webgl-render-pipeline';
13
+ import { WEBGLCommandEncoder } from './resources/webgl-command-encoder';
14
+ import { WEBGLTransformFeedback } from './resources/webgl-transform-feedback';
14
15
  /** WebGPU style Device API for a WebGL context */
15
- export default class WebGLDevice extends Device implements ContextState {
16
+ export declare class WebGLDevice extends Device {
16
17
  static type: string;
17
18
  static isSupported(): boolean;
18
19
  readonly info: DeviceInfo;
19
20
  readonly canvasContext: WebGLCanvasContext;
21
+ readonly handle: WebGLRenderingContext;
22
+ get features(): Set<DeviceFeature>;
23
+ get limits(): DeviceLimits;
20
24
  readonly lost: Promise<{
21
25
  reason: 'destroyed';
22
26
  message: string;
23
27
  }>;
24
- readonly handle: WebGLRenderingContext;
25
- get features(): Set<DeviceFeature>;
26
- get limits(): DeviceLimits;
27
- /** WebGL1 typed context. Can always be used. */
28
- readonly gl: WebGLRenderingContext;
29
- /** WebGL2 typed context. Need to check isWebGL2 or isWebGL1 before using. */
30
- readonly gl2: WebGL2RenderingContext;
31
- readonly debug: boolean;
32
- /** `true` if this is a WebGL1 context. @note `false` if WebGL2 */
33
- readonly isWebGL1: boolean;
34
- /** `true` if this is a WebGL2 context. @note `false` if WebGL1 */
35
- readonly isWebGL2: boolean;
36
- get webglLimits(): WebGLLimits;
37
- private _features;
38
- private _limits;
39
- private _webglLimits;
40
- /** State used by luma.gl classes: TODO - move to canvasContext*/
41
- readonly _canvasSizeInfo: {
42
- clientWidth: number;
43
- clientHeight: number;
44
- devicePixelRatio: number;
45
- };
46
- /** State used by luma.gl classes */
47
- readonly _extensions: Record<string, any>;
48
- _polyfilled: boolean;
49
- /** Instance of Spector.js (if initialized) */
50
- spector: any;
28
+ private _resolveContextLost?;
29
+ private _features?;
30
+ private _limits?;
51
31
  /**
52
32
  * Get a device instance from a GL context
53
33
  * Creates and instruments the device if not already created
@@ -70,23 +50,78 @@ export default class WebGLDevice extends Device implements ContextState {
70
50
  /** Returns a WebGL2RenderingContext or throws an error */
71
51
  assertWebGL2(): WebGL2RenderingContext;
72
52
  createCanvasContext(props?: CanvasContextProps): CanvasContext;
73
- _createBuffer(props: BufferProps): WEBGLBuffer;
53
+ createBuffer(props: BufferProps | ArrayBuffer | ArrayBufferView): WEBGLBuffer;
74
54
  _createTexture(props: TextureProps): WEBGLTexture;
75
55
  createExternalTexture(props: ExternalTextureProps): ExternalTexture;
76
56
  createSampler(props: SamplerProps): WEBGLSampler;
77
57
  createShader(props: ShaderProps): WEBGLShader;
78
58
  createFramebuffer(props: FramebufferProps): WEBGLFramebuffer;
79
59
  createRenderPipeline(props: RenderPipelineProps): WEBGLRenderPipeline;
60
+ createVertexArray(props: VertexArrayProps): VertexArray;
80
61
  beginRenderPass(props: RenderPassProps): WEBGLRenderPass;
81
62
  createComputePipeline(props?: ComputePipelineProps): ComputePipeline;
82
63
  beginComputePass(props: ComputePassProps): ComputePass;
64
+ createTransformFeedback(props: TransformFeedbackProps): WEBGLTransformFeedback;
83
65
  private renderPass;
84
66
  getDefaultRenderPass(): WEBGLRenderPass;
67
+ createCommandEncoder(props?: CommandEncoderProps): WEBGLCommandEncoder;
85
68
  /**
86
69
  * Offscreen Canvas Support: Commit the frame
87
70
  * https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/commit
88
71
  * Chrome's offscreen canvas does not require gl.commit
89
72
  */
90
73
  submit(): void;
74
+ /** WebGL1 typed context. Can always be used. */
75
+ readonly gl: WebGLRenderingContext;
76
+ /** WebGL2 typed context. Need to check isWebGL2 or isWebGL1 before using. */
77
+ readonly gl2: WebGL2RenderingContext | null;
78
+ readonly debug: boolean;
79
+ /** `true` if this is a WebGL1 context. @note `false` if WebGL2 */
80
+ readonly isWebGL1: boolean;
81
+ /** `true` if this is a WebGL2 context. @note `false` if WebGL1 */
82
+ readonly isWebGL2: boolean;
83
+ /** State used by luma.gl classes: TODO - move to canvasContext*/
84
+ readonly _canvasSizeInfo: {
85
+ clientWidth: number;
86
+ clientHeight: number;
87
+ devicePixelRatio: number;
88
+ };
89
+ /** State used by luma.gl classes - TODO - not used? */
90
+ readonly _extensions: Record<string, any>;
91
+ _polyfilled: boolean;
92
+ /** Instance of Spector.js (if initialized) */
93
+ spector: any;
94
+ private _webglLimits?;
95
+ /** Return WebGL specific limits */
96
+ get webglLimits(): WebGLLimits;
97
+ /**
98
+ * Triggers device (or WebGL context) loss.
99
+ * @note primarily intended for testing how application reacts to device loss
100
+ */
101
+ loseDevice(): boolean;
102
+ /** Save current WebGL context state onto an internal stack */
103
+ pushState(): void;
104
+ /** Restores previously saved context state */
105
+ popState(): void;
106
+ /**
107
+ * Storing data on a special field on WebGLObjects makes that data visible in SPECTOR chrome debug extension
108
+ * luma.gl ids and props can be inspected
109
+ */
110
+ setSpectorMetadata(handle: unknown, props: Record<string, unknown>): void;
111
+ /**
112
+ * Returns the GL.<KEY> constant that corresponds to a numeric value of a GL constant
113
+ * Be aware that there are some duplicates especially for constants that are 0,
114
+ * so this isn't guaranteed to return the right key in all cases.
115
+ */
116
+ getGLKey(value: unknown, gl?: WebGLRenderingContext): string;
117
+ /** Store constants */
118
+ _constants: (TypedArray | null)[];
119
+ /**
120
+ * Set a constant value for a location. Disabled attributes at that location will read from this value
121
+ * @note WebGL constants are stored globally on the WebGL context, not the VertexArray
122
+ * so they need to be updated before every render
123
+ * @todo - remember/cache values to avoid setting them unnecessarily?
124
+ */
125
+ setConstantAttribute(location: number, constant: TypedArray): void;
91
126
  }
92
127
  //# sourceMappingURL=webgl-device.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"webgl-device.d.ts","sourceRoot":"","sources":["../../src/adapter/webgl-device.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,WAAW,EACX,UAAU,EACV,YAAY,EACZ,aAAa,EACb,kBAAkB,EAClB,aAAa,EACd,MAAM,cAAc,CAAC;AACtB,OAAO,EAAC,MAAM,EAAE,aAAa,EAAc,MAAM,cAAc,CAAC;AAIhE,OAAO,EAAC,YAAY,EAAC,MAAM,kCAAkC,CAAC;AAI9D,OAAO,EAAkC,WAAW,EAAC,MAAM,gCAAgC,CAAC;AAC5F,OAAO,kBAAkB,MAAM,wBAAwB,CAAC;AAUxD,OAAO,KAAK,EACV,WAAW,EACX,WAAW,EAEX,YAAY,EACZ,YAAY,EACZ,eAAe,EACf,oBAAoB,EACpB,gBAAgB,EAEhB,mBAAmB,EACnB,eAAe,EACf,oBAAoB,EAEpB,eAAe,EACf,WAAW,EACX,gBAAgB,EACjB,MAAM,cAAc,CAAC;AAGtB,OAAO,WAAW,MAAM,0BAA0B,CAAC;AACnD,OAAO,WAAW,MAAM,0BAA0B,CAAC;AACnD,OAAO,YAAY,MAAM,2BAA2B,CAAC;AACrD,OAAO,YAAY,MAAM,2BAA2B,CAAC;AACrD,OAAO,gBAAgB,MAAM,+BAA+B,CAAC;AAC7D,OAAO,eAAe,MAAM,+BAA+B,CAAC;AAC5D,OAAO,mBAAmB,MAA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