@luma.gl/webgl 9.0.0-alpha.2 → 9.0.0-alpha.21

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 (468) hide show
  1. package/dist/adapter/converters/device-parameters.d.ts +11 -1
  2. package/dist/adapter/converters/device-parameters.d.ts.map +1 -1
  3. package/dist/adapter/converters/device-parameters.js +17 -35
  4. package/dist/adapter/converters/device-parameters.js.map +1 -1
  5. package/dist/adapter/converters/renderbuffer-formats.d.ts +2 -2
  6. package/dist/adapter/converters/renderbuffer-formats.d.ts.map +1 -1
  7. package/dist/adapter/converters/renderbuffer-formats.js +2 -7
  8. package/dist/adapter/converters/renderbuffer-formats.js.map +1 -1
  9. package/dist/adapter/converters/sampler-parameters.d.ts +4 -4
  10. package/dist/adapter/converters/sampler-parameters.d.ts.map +1 -1
  11. package/dist/adapter/converters/sampler-parameters.js +19 -55
  12. package/dist/adapter/converters/sampler-parameters.js.map +1 -1
  13. package/dist/adapter/converters/texture-formats.d.ts.map +1 -1
  14. package/dist/adapter/converters/texture-formats.js +13 -66
  15. package/dist/adapter/converters/texture-formats.js.map +1 -1
  16. package/dist/adapter/converters/vertex-formats.d.ts.map +1 -1
  17. package/dist/adapter/converters/vertex-formats.js +2 -8
  18. package/dist/adapter/converters/vertex-formats.js.map +1 -1
  19. package/dist/adapter/device-helpers/device-features.d.ts.map +1 -1
  20. package/dist/adapter/device-helpers/device-features.js +13 -20
  21. package/dist/adapter/device-helpers/device-features.js.map +1 -1
  22. package/dist/adapter/device-helpers/device-limits.js +1 -4
  23. package/dist/adapter/device-helpers/device-limits.js.map +1 -1
  24. package/dist/adapter/device-helpers/get-device-info.js +8 -10
  25. package/dist/adapter/device-helpers/get-device-info.js.map +1 -1
  26. package/dist/adapter/device-helpers/is-old-ie.js +2 -1
  27. package/dist/adapter/device-helpers/is-old-ie.js.map +1 -1
  28. package/dist/adapter/helpers/attribute-utils.js +0 -17
  29. package/dist/adapter/helpers/attribute-utils.js.map +1 -1
  30. package/dist/adapter/helpers/get-shader-info.d.ts +9 -0
  31. package/dist/adapter/helpers/get-shader-info.d.ts.map +1 -0
  32. package/dist/adapter/helpers/get-shader-info.js +25 -0
  33. package/dist/adapter/helpers/get-shader-info.js.map +1 -0
  34. package/dist/adapter/helpers/get-shader-layout.d.ts +1 -1
  35. package/dist/adapter/helpers/get-shader-layout.d.ts.map +1 -1
  36. package/dist/adapter/helpers/get-shader-layout.js +41 -67
  37. package/dist/adapter/helpers/get-shader-layout.js.map +1 -1
  38. package/dist/adapter/helpers/parse-shader-compiler-log.d.ts +1 -1
  39. package/dist/adapter/helpers/parse-shader-compiler-log.d.ts.map +1 -1
  40. package/dist/adapter/helpers/parse-shader-compiler-log.js +0 -7
  41. package/dist/adapter/helpers/parse-shader-compiler-log.js.map +1 -1
  42. package/dist/adapter/helpers/set-uniform.d.ts.map +1 -1
  43. package/dist/adapter/helpers/set-uniform.js +1 -31
  44. package/dist/adapter/helpers/set-uniform.js.map +1 -1
  45. package/dist/adapter/helpers/uniforms.d.ts +1 -1
  46. package/dist/adapter/helpers/uniforms.d.ts.map +1 -1
  47. package/dist/adapter/helpers/uniforms.js +4 -14
  48. package/dist/adapter/helpers/uniforms.js.map +1 -1
  49. package/dist/adapter/objects/constants-to-keys.d.ts.map +1 -1
  50. package/dist/adapter/objects/constants-to-keys.js +0 -7
  51. package/dist/adapter/objects/constants-to-keys.js.map +1 -1
  52. package/dist/adapter/objects/webgl-renderbuffer.d.ts +3 -3
  53. package/dist/adapter/objects/webgl-renderbuffer.d.ts.map +1 -1
  54. package/dist/adapter/objects/webgl-renderbuffer.js +6 -22
  55. package/dist/adapter/objects/webgl-renderbuffer.js.map +1 -1
  56. package/dist/adapter/objects/webgl-resource.d.ts +3 -5
  57. package/dist/adapter/objects/webgl-resource.d.ts.map +1 -1
  58. package/dist/adapter/objects/webgl-resource.js +15 -68
  59. package/dist/adapter/objects/webgl-resource.js.map +1 -1
  60. package/dist/adapter/objects/webgl-vertex-array-object.d.ts +6 -6
  61. package/dist/adapter/objects/webgl-vertex-array-object.d.ts.map +1 -1
  62. package/dist/adapter/objects/webgl-vertex-array-object.js +7 -17
  63. package/dist/adapter/objects/webgl-vertex-array-object.js.map +1 -1
  64. package/dist/adapter/resources/webgl-buffer.d.ts +3 -4
  65. package/dist/adapter/resources/webgl-buffer.d.ts.map +1 -1
  66. package/dist/adapter/resources/webgl-buffer.js +18 -49
  67. package/dist/adapter/resources/webgl-buffer.js.map +1 -1
  68. package/dist/adapter/resources/webgl-command-buffer.d.ts +2 -2
  69. package/dist/adapter/resources/webgl-command-buffer.d.ts.map +1 -1
  70. package/dist/adapter/resources/webgl-command-buffer.js +3 -18
  71. package/dist/adapter/resources/webgl-command-buffer.js.map +1 -1
  72. package/dist/adapter/resources/webgl-command-encoder.d.ts +3 -3
  73. package/dist/adapter/resources/webgl-command-encoder.d.ts.map +1 -1
  74. package/dist/adapter/resources/webgl-command-encoder.js +2 -15
  75. package/dist/adapter/resources/webgl-command-encoder.js.map +1 -1
  76. package/dist/adapter/resources/webgl-external-texture.js.map +1 -1
  77. package/dist/adapter/resources/webgl-framebuffer.d.ts +16 -16
  78. package/dist/adapter/resources/webgl-framebuffer.d.ts.map +1 -1
  79. package/dist/adapter/resources/webgl-framebuffer.js +17 -75
  80. package/dist/adapter/resources/webgl-framebuffer.js.map +1 -1
  81. package/dist/adapter/resources/webgl-render-pass.d.ts +3 -3
  82. package/dist/adapter/resources/webgl-render-pass.d.ts.map +1 -1
  83. package/dist/adapter/resources/webgl-render-pass.js +3 -8
  84. package/dist/adapter/resources/webgl-render-pass.js.map +1 -1
  85. package/dist/adapter/resources/webgl-render-pipeline.d.ts +5 -5
  86. package/dist/adapter/resources/webgl-render-pipeline.d.ts.map +1 -1
  87. package/dist/adapter/resources/webgl-render-pipeline.js +51 -140
  88. package/dist/adapter/resources/webgl-render-pipeline.js.map +1 -1
  89. package/dist/adapter/resources/webgl-sampler.d.ts +5 -4
  90. package/dist/adapter/resources/webgl-sampler.d.ts.map +1 -1
  91. package/dist/adapter/resources/webgl-sampler.js +5 -13
  92. package/dist/adapter/resources/webgl-sampler.js.map +1 -1
  93. package/dist/adapter/resources/webgl-shader.d.ts +3 -4
  94. package/dist/adapter/resources/webgl-shader.d.ts.map +1 -1
  95. package/dist/adapter/resources/webgl-shader.js +8 -21
  96. package/dist/adapter/resources/webgl-shader.js.map +1 -1
  97. package/dist/adapter/resources/webgl-texture.d.ts +26 -26
  98. package/dist/adapter/resources/webgl-texture.d.ts.map +1 -1
  99. package/dist/adapter/resources/webgl-texture.js +66 -183
  100. package/dist/adapter/resources/webgl-texture.js.map +1 -1
  101. package/dist/adapter/webgl-canvas-context.d.ts +3 -3
  102. package/dist/adapter/webgl-canvas-context.d.ts.map +1 -1
  103. package/dist/adapter/webgl-canvas-context.js +6 -19
  104. package/dist/adapter/webgl-canvas-context.js.map +1 -1
  105. package/dist/adapter/webgl-device.d.ts +53 -37
  106. package/dist/adapter/webgl-device.d.ts.map +1 -1
  107. package/dist/adapter/webgl-device.js +108 -109
  108. package/dist/adapter/webgl-device.js.map +1 -1
  109. package/dist/classic/accessor.d.ts +1 -1
  110. package/dist/classic/accessor.d.ts.map +1 -1
  111. package/dist/classic/accessor.js +12 -36
  112. package/dist/classic/accessor.js.map +1 -1
  113. package/dist/classic/buffer.d.ts +3 -4
  114. package/dist/classic/buffer.d.ts.map +1 -1
  115. package/dist/classic/buffer.js +30 -87
  116. package/dist/classic/buffer.js.map +1 -1
  117. package/dist/classic/typed-array-utils.d.ts +1 -1
  118. package/dist/classic/typed-array-utils.d.ts.map +1 -1
  119. package/dist/classic/typed-array-utils.js +0 -20
  120. package/dist/classic/typed-array-utils.js.map +1 -1
  121. package/dist/context/context/{create-context.d.ts → create-browser-context.d.ts} +2 -1
  122. package/dist/context/context/create-browser-context.d.ts.map +1 -0
  123. package/dist/context/context/{create-context.js → create-browser-context.js} +19 -15
  124. package/dist/context/context/create-browser-context.js.map +1 -0
  125. package/dist/context/context/create-headless-context.d.ts +9 -0
  126. package/dist/context/context/create-headless-context.d.ts.map +1 -0
  127. package/dist/context/context/create-headless-context.js +42 -0
  128. package/dist/context/context/create-headless-context.js.map +1 -0
  129. package/dist/context/context/webgl-checks.js +0 -3
  130. package/dist/context/context/webgl-checks.js.map +1 -1
  131. package/dist/context/debug/spector.d.ts +1 -0
  132. package/dist/context/debug/spector.d.ts.map +1 -1
  133. package/dist/context/debug/spector.js +7 -19
  134. package/dist/context/debug/spector.js.map +1 -1
  135. package/dist/context/debug/webgl-developer-tools.d.ts +1 -1
  136. package/dist/context/debug/webgl-developer-tools.d.ts.map +1 -1
  137. package/dist/context/debug/webgl-developer-tools.js +8 -32
  138. package/dist/context/debug/webgl-developer-tools.js.map +1 -1
  139. package/dist/context/parameters/unified-parameter-api.d.ts +6 -5
  140. package/dist/context/parameters/unified-parameter-api.d.ts.map +1 -1
  141. package/dist/context/parameters/unified-parameter-api.js +8 -18
  142. package/dist/context/parameters/unified-parameter-api.js.map +1 -1
  143. package/dist/context/parameters/webgl-parameter-tables.d.ts +103 -103
  144. package/dist/context/parameters/webgl-parameter-tables.d.ts.map +1 -1
  145. package/dist/context/parameters/webgl-parameter-tables.js +16 -34
  146. package/dist/context/parameters/webgl-parameter-tables.js.map +1 -1
  147. package/dist/context/polyfill/context-data.d.ts +13 -0
  148. package/dist/context/polyfill/context-data.d.ts.map +1 -0
  149. package/dist/context/polyfill/context-data.js +12 -0
  150. package/dist/context/polyfill/context-data.js.map +1 -0
  151. package/dist/context/polyfill/get-parameter-polyfill.d.ts +1 -1
  152. package/dist/context/polyfill/get-parameter-polyfill.d.ts.map +1 -1
  153. package/dist/context/polyfill/get-parameter-polyfill.js +1 -6
  154. package/dist/context/polyfill/get-parameter-polyfill.js.map +1 -1
  155. package/dist/context/polyfill/polyfill-context.js +20 -28
  156. package/dist/context/polyfill/polyfill-context.js.map +1 -1
  157. package/dist/context/polyfill/polyfill-table.d.ts +8 -8
  158. package/dist/context/polyfill/polyfill-table.d.ts.map +1 -1
  159. package/dist/context/polyfill/polyfill-table.js +8 -30
  160. package/dist/context/polyfill/polyfill-table.js.map +1 -1
  161. package/dist/context/polyfill/polyfill-vertex-array-object.d.ts.map +1 -1
  162. package/dist/context/polyfill/polyfill-vertex-array-object.js +0 -70
  163. package/dist/context/polyfill/polyfill-vertex-array-object.js.map +1 -1
  164. package/dist/context/state-tracker/deep-array-equal.js +0 -4
  165. package/dist/context/state-tracker/deep-array-equal.js.map +1 -1
  166. package/dist/context/state-tracker/track-context-state.d.ts.map +1 -1
  167. package/dist/context/state-tracker/track-context-state.js +15 -50
  168. package/dist/context/state-tracker/track-context-state.js.map +1 -1
  169. package/dist/context/state-tracker/with-parameters.d.ts +2 -1
  170. package/dist/context/state-tracker/with-parameters.d.ts.map +1 -1
  171. package/dist/context/state-tracker/with-parameters.js +7 -9
  172. package/dist/context/state-tracker/with-parameters.js.map +1 -1
  173. package/dist/dist.dev.js +9204 -0
  174. package/dist/index.cjs +5948 -0
  175. package/dist/index.d.ts +19 -19
  176. package/dist/index.d.ts.map +1 -1
  177. package/dist/index.js +24 -26
  178. package/dist/index.js.map +1 -1
  179. package/dist/types/webgl.d.ts +8 -7
  180. package/dist/types/webgl.d.ts.map +1 -1
  181. package/dist/types/webgl.js.map +1 -1
  182. package/dist/types.js.map +1 -1
  183. package/dist.min.js +36 -0
  184. package/package.json +18 -9
  185. package/src/.DS_Store +0 -0
  186. package/src/adapter/.DS_Store +0 -0
  187. package/src/adapter/converters/device-parameters.ts +45 -16
  188. package/src/adapter/converters/renderbuffer-formats.ts +1 -3
  189. package/src/adapter/converters/sampler-parameters.ts +18 -7
  190. package/src/adapter/converters/texture-formats.ts +18 -16
  191. package/src/adapter/converters/vertex-formats.ts +1 -0
  192. package/src/adapter/device-helpers/device-features.ts +9 -2
  193. package/src/adapter/device-helpers/device-limits.ts +1 -1
  194. package/src/adapter/device-helpers/get-device-info.ts +12 -8
  195. package/src/adapter/helpers/get-shader-info.ts +37 -0
  196. package/src/adapter/helpers/get-shader-layout.ts +59 -37
  197. package/src/adapter/helpers/parse-shader-compiler-log.ts +2 -2
  198. package/src/adapter/helpers/set-uniform.ts +3 -1
  199. package/src/adapter/helpers/uniforms.ts +21 -10
  200. package/src/adapter/objects/constants-to-keys.ts +4 -1
  201. package/src/adapter/objects/webgl-renderbuffer.ts +8 -8
  202. package/src/adapter/objects/webgl-resource.ts +8 -13
  203. package/src/adapter/objects/webgl-vertex-array-object.ts +10 -10
  204. package/src/adapter/resources/webgl-buffer.ts +16 -16
  205. package/src/adapter/resources/webgl-command-buffer.ts +3 -3
  206. package/src/adapter/resources/webgl-command-encoder.ts +8 -8
  207. package/src/adapter/resources/webgl-external-texture.ts +1 -1
  208. package/src/adapter/resources/webgl-framebuffer.ts +36 -33
  209. package/src/adapter/resources/webgl-render-pass.ts +4 -3
  210. package/src/adapter/resources/webgl-render-pipeline.ts +89 -77
  211. package/src/adapter/resources/webgl-sampler.ts +12 -6
  212. package/src/adapter/resources/webgl-shader.ts +10 -9
  213. package/src/adapter/resources/webgl-texture.ts +55 -45
  214. package/src/adapter/webgl-canvas-context.ts +8 -9
  215. package/src/adapter/webgl-device.ts +153 -69
  216. package/src/classic/accessor.ts +2 -15
  217. package/src/classic/buffer.ts +18 -25
  218. package/src/classic/typed-array-utils.ts +4 -2
  219. package/src/context/.DS_Store +0 -0
  220. package/src/context/context/{create-context.ts → create-browser-context.ts} +17 -7
  221. package/src/context/context/create-headless-context.ts +48 -0
  222. package/src/context/debug/spector.ts +6 -5
  223. package/src/context/debug/webgl-developer-tools.ts +13 -13
  224. package/src/context/parameters/unified-parameter-api.ts +18 -12
  225. package/src/context/parameters/webgl-parameter-tables.ts +113 -94
  226. package/src/context/polyfill/context-data.ts +27 -0
  227. package/src/context/polyfill/get-parameter-polyfill.ts +7 -6
  228. package/src/context/polyfill/polyfill-context.ts +6 -8
  229. package/src/context/polyfill/polyfill-table.ts +16 -14
  230. package/src/context/polyfill/polyfill-vertex-array-object.ts +2 -0
  231. package/src/context/state-tracker/track-context-state.ts +13 -12
  232. package/src/context/state-tracker/with-parameters.ts +8 -2
  233. package/src/index.ts +28 -26
  234. package/src/types/webgl.ts +10 -7
  235. package/dist/bundle.d.ts +0 -2
  236. package/dist/bundle.d.ts.map +0 -1
  237. package/dist/bundle.js +0 -5
  238. package/dist/bundle.js.map +0 -1
  239. package/dist/context/context/context-state.d.ts +0 -18
  240. package/dist/context/context/context-state.d.ts.map +0 -1
  241. package/dist/context/context/context-state.js +0 -26
  242. package/dist/context/context/context-state.js.map +0 -1
  243. package/dist/context/context/create-context.d.ts.map +0 -1
  244. package/dist/context/context/create-context.js.map +0 -1
  245. package/dist/context/context/device-pixels.d.ts +0 -25
  246. package/dist/context/context/device-pixels.d.ts.map +0 -1
  247. package/dist/context/context/device-pixels.js +0 -98
  248. package/dist/context/context/device-pixels.js.map +0 -1
  249. package/dist/es5/adapter/converters/device-parameters.js +0 -170
  250. package/dist/es5/adapter/converters/device-parameters.js.map +0 -1
  251. package/dist/es5/adapter/converters/renderbuffer-formats.js +0 -163
  252. package/dist/es5/adapter/converters/renderbuffer-formats.js.map +0 -1
  253. package/dist/es5/adapter/converters/sampler-parameters.js +0 -226
  254. package/dist/es5/adapter/converters/sampler-parameters.js.map +0 -1
  255. package/dist/es5/adapter/converters/texture-formats.js +0 -1031
  256. package/dist/es5/adapter/converters/texture-formats.js.map +0 -1
  257. package/dist/es5/adapter/converters/vertex-formats.js +0 -45
  258. package/dist/es5/adapter/converters/vertex-formats.js.map +0 -1
  259. package/dist/es5/adapter/device-helpers/device-features.js +0 -144
  260. package/dist/es5/adapter/device-helpers/device-features.js.map +0 -1
  261. package/dist/es5/adapter/device-helpers/device-limits.js +0 -64
  262. package/dist/es5/adapter/device-helpers/device-limits.js.map +0 -1
  263. package/dist/es5/adapter/device-helpers/get-device-info.js +0 -55
  264. package/dist/es5/adapter/device-helpers/get-device-info.js.map +0 -1
  265. package/dist/es5/adapter/device-helpers/is-old-ie.js +0 -16
  266. package/dist/es5/adapter/device-helpers/is-old-ie.js.map +0 -1
  267. package/dist/es5/adapter/helpers/attribute-utils.js +0 -91
  268. package/dist/es5/adapter/helpers/attribute-utils.js.map +0 -1
  269. package/dist/es5/adapter/helpers/get-shader-layout.js +0 -371
  270. package/dist/es5/adapter/helpers/get-shader-layout.js.map +0 -1
  271. package/dist/es5/adapter/helpers/parse-shader-compiler-log.js +0 -72
  272. package/dist/es5/adapter/helpers/parse-shader-compiler-log.js.map +0 -1
  273. package/dist/es5/adapter/helpers/set-uniform.js +0 -125
  274. package/dist/es5/adapter/helpers/set-uniform.js.map +0 -1
  275. package/dist/es5/adapter/helpers/uniforms.js +0 -112
  276. package/dist/es5/adapter/helpers/uniforms.js.map +0 -1
  277. package/dist/es5/adapter/objects/constants-to-keys.js +0 -54
  278. package/dist/es5/adapter/objects/constants-to-keys.js.map +0 -1
  279. package/dist/es5/adapter/objects/webgl-renderbuffer.js +0 -150
  280. package/dist/es5/adapter/objects/webgl-renderbuffer.js.map +0 -1
  281. package/dist/es5/adapter/objects/webgl-resource.js +0 -292
  282. package/dist/es5/adapter/objects/webgl-resource.js.map +0 -1
  283. package/dist/es5/adapter/objects/webgl-vertex-array-object.js +0 -137
  284. package/dist/es5/adapter/objects/webgl-vertex-array-object.js.map +0 -1
  285. package/dist/es5/adapter/resources/webgl-buffer.js +0 -243
  286. package/dist/es5/adapter/resources/webgl-buffer.js.map +0 -1
  287. package/dist/es5/adapter/resources/webgl-command-buffer.js +0 -96
  288. package/dist/es5/adapter/resources/webgl-command-buffer.js.map +0 -1
  289. package/dist/es5/adapter/resources/webgl-command-encoder.js +0 -98
  290. package/dist/es5/adapter/resources/webgl-command-encoder.js.map +0 -1
  291. package/dist/es5/adapter/resources/webgl-external-texture.js +0 -2
  292. package/dist/es5/adapter/resources/webgl-external-texture.js.map +0 -1
  293. package/dist/es5/adapter/resources/webgl-framebuffer.js +0 -345
  294. package/dist/es5/adapter/resources/webgl-framebuffer.js.map +0 -1
  295. package/dist/es5/adapter/resources/webgl-render-pass.js +0 -61
  296. package/dist/es5/adapter/resources/webgl-render-pass.js.map +0 -1
  297. package/dist/es5/adapter/resources/webgl-render-pipeline.js +0 -505
  298. package/dist/es5/adapter/resources/webgl-render-pipeline.js.map +0 -1
  299. package/dist/es5/adapter/resources/webgl-sampler.js +0 -96
  300. package/dist/es5/adapter/resources/webgl-sampler.js.map +0 -1
  301. package/dist/es5/adapter/resources/webgl-shader.js +0 -149
  302. package/dist/es5/adapter/resources/webgl-shader.js.map +0 -1
  303. package/dist/es5/adapter/resources/webgl-texture.js +0 -986
  304. package/dist/es5/adapter/resources/webgl-texture.js.map +0 -1
  305. package/dist/es5/adapter/webgl-canvas-context.js +0 -97
  306. package/dist/es5/adapter/webgl-canvas-context.js.map +0 -1
  307. package/dist/es5/adapter/webgl-device.js +0 -399
  308. package/dist/es5/adapter/webgl-device.js.map +0 -1
  309. package/dist/es5/bundle.js +0 -7
  310. package/dist/es5/bundle.js.map +0 -1
  311. package/dist/es5/classic/accessor.js +0 -181
  312. package/dist/es5/classic/accessor.js.map +0 -1
  313. package/dist/es5/classic/buffer.js +0 -470
  314. package/dist/es5/classic/buffer.js.map +0 -1
  315. package/dist/es5/classic/typed-array-utils.js +0 -126
  316. package/dist/es5/classic/typed-array-utils.js.map +0 -1
  317. package/dist/es5/context/context/context-state.js +0 -31
  318. package/dist/es5/context/context/context-state.js.map +0 -1
  319. package/dist/es5/context/context/create-context.js +0 -69
  320. package/dist/es5/context/context/create-context.js.map +0 -1
  321. package/dist/es5/context/context/device-pixels.js +0 -115
  322. package/dist/es5/context/context/device-pixels.js.map +0 -1
  323. package/dist/es5/context/context/webgl-checks.js +0 -54
  324. package/dist/es5/context/context/webgl-checks.js.map +0 -1
  325. package/dist/es5/context/debug/spector.js +0 -133
  326. package/dist/es5/context/debug/spector.js.map +0 -1
  327. package/dist/es5/context/debug/webgl-developer-tools.js +0 -198
  328. package/dist/es5/context/debug/webgl-developer-tools.js.map +0 -1
  329. package/dist/es5/context/parameters/unified-parameter-api.js +0 -97
  330. package/dist/es5/context/parameters/unified-parameter-api.js.map +0 -1
  331. package/dist/es5/context/parameters/webgl-parameter-tables.js +0 -392
  332. package/dist/es5/context/parameters/webgl-parameter-tables.js.map +0 -1
  333. package/dist/es5/context/polyfill/get-parameter-polyfill.js +0 -81
  334. package/dist/es5/context/polyfill/get-parameter-polyfill.js.map +0 -1
  335. package/dist/es5/context/polyfill/polyfill-context.js +0 -135
  336. package/dist/es5/context/polyfill/polyfill-context.js.map +0 -1
  337. package/dist/es5/context/polyfill/polyfill-table.js +0 -166
  338. package/dist/es5/context/polyfill/polyfill-table.js.map +0 -1
  339. package/dist/es5/context/polyfill/polyfill-vertex-array-object.js +0 -341
  340. package/dist/es5/context/polyfill/polyfill-vertex-array-object.js.map +0 -1
  341. package/dist/es5/context/state-tracker/deep-array-equal.js +0 -28
  342. package/dist/es5/context/state-tracker/deep-array-equal.js.map +0 -1
  343. package/dist/es5/context/state-tracker/track-context-state.js +0 -211
  344. package/dist/es5/context/state-tracker/track-context-state.js.map +0 -1
  345. package/dist/es5/context/state-tracker/with-parameters.js +0 -44
  346. package/dist/es5/context/state-tracker/with-parameters.js.map +0 -1
  347. package/dist/es5/index.js +0 -276
  348. package/dist/es5/index.js.map +0 -1
  349. package/dist/es5/init.js +0 -10
  350. package/dist/es5/init.js.map +0 -1
  351. package/dist/es5/types/webgl.js +0 -6
  352. package/dist/es5/types/webgl.js.map +0 -1
  353. package/dist/es5/types.js +0 -2
  354. package/dist/es5/types.js.map +0 -1
  355. package/dist/esm/adapter/converters/device-parameters.js +0 -155
  356. package/dist/esm/adapter/converters/device-parameters.js.map +0 -1
  357. package/dist/esm/adapter/converters/renderbuffer-formats.js +0 -185
  358. package/dist/esm/adapter/converters/renderbuffer-formats.js.map +0 -1
  359. package/dist/esm/adapter/converters/sampler-parameters.js +0 -208
  360. package/dist/esm/adapter/converters/sampler-parameters.js.map +0 -1
  361. package/dist/esm/adapter/converters/texture-formats.js +0 -954
  362. package/dist/esm/adapter/converters/texture-formats.js.map +0 -1
  363. package/dist/esm/adapter/converters/vertex-formats.js +0 -35
  364. package/dist/esm/adapter/converters/vertex-formats.js.map +0 -1
  365. package/dist/esm/adapter/device-helpers/device-features.js +0 -102
  366. package/dist/esm/adapter/device-helpers/device-features.js.map +0 -1
  367. package/dist/esm/adapter/device-helpers/device-limits.js +0 -91
  368. package/dist/esm/adapter/device-helpers/device-limits.js.map +0 -1
  369. package/dist/esm/adapter/device-helpers/get-device-info.js +0 -44
  370. package/dist/esm/adapter/device-helpers/get-device-info.js.map +0 -1
  371. package/dist/esm/adapter/device-helpers/is-old-ie.js +0 -8
  372. package/dist/esm/adapter/device-helpers/is-old-ie.js.map +0 -1
  373. package/dist/esm/adapter/helpers/attribute-utils.js +0 -81
  374. package/dist/esm/adapter/helpers/attribute-utils.js.map +0 -1
  375. package/dist/esm/adapter/helpers/get-shader-layout.js +0 -306
  376. package/dist/esm/adapter/helpers/get-shader-layout.js.map +0 -1
  377. package/dist/esm/adapter/helpers/parse-shader-compiler-log.js +0 -37
  378. package/dist/esm/adapter/helpers/parse-shader-compiler-log.js.map +0 -1
  379. package/dist/esm/adapter/helpers/set-uniform.js +0 -115
  380. package/dist/esm/adapter/helpers/set-uniform.js.map +0 -1
  381. package/dist/esm/adapter/helpers/uniforms.js +0 -99
  382. package/dist/esm/adapter/helpers/uniforms.js.map +0 -1
  383. package/dist/esm/adapter/objects/constants-to-keys.js +0 -42
  384. package/dist/esm/adapter/objects/constants-to-keys.js.map +0 -1
  385. package/dist/esm/adapter/objects/webgl-renderbuffer.js +0 -94
  386. package/dist/esm/adapter/objects/webgl-renderbuffer.js.map +0 -1
  387. package/dist/esm/adapter/objects/webgl-resource.js +0 -216
  388. package/dist/esm/adapter/objects/webgl-resource.js.map +0 -1
  389. package/dist/esm/adapter/objects/webgl-vertex-array-object.js +0 -84
  390. package/dist/esm/adapter/objects/webgl-vertex-array-object.js.map +0 -1
  391. package/dist/esm/adapter/resources/webgl-buffer.js +0 -164
  392. package/dist/esm/adapter/resources/webgl-buffer.js.map +0 -1
  393. package/dist/esm/adapter/resources/webgl-command-buffer.js +0 -65
  394. package/dist/esm/adapter/resources/webgl-command-buffer.js.map +0 -1
  395. package/dist/esm/adapter/resources/webgl-command-encoder.js +0 -53
  396. package/dist/esm/adapter/resources/webgl-command-encoder.js.map +0 -1
  397. package/dist/esm/adapter/resources/webgl-external-texture.js +0 -2
  398. package/dist/esm/adapter/resources/webgl-external-texture.js.map +0 -1
  399. package/dist/esm/adapter/resources/webgl-framebuffer.js +0 -265
  400. package/dist/esm/adapter/resources/webgl-framebuffer.js.map +0 -1
  401. package/dist/esm/adapter/resources/webgl-render-pass.js +0 -19
  402. package/dist/esm/adapter/resources/webgl-render-pass.js.map +0 -1
  403. package/dist/esm/adapter/resources/webgl-render-pipeline.js +0 -400
  404. package/dist/esm/adapter/resources/webgl-render-pipeline.js.map +0 -1
  405. package/dist/esm/adapter/resources/webgl-sampler.js +0 -50
  406. package/dist/esm/adapter/resources/webgl-sampler.js.map +0 -1
  407. package/dist/esm/adapter/resources/webgl-shader.js +0 -75
  408. package/dist/esm/adapter/resources/webgl-shader.js.map +0 -1
  409. package/dist/esm/adapter/resources/webgl-texture.js +0 -831
  410. package/dist/esm/adapter/resources/webgl-texture.js.map +0 -1
  411. package/dist/esm/adapter/webgl-canvas-context.js +0 -54
  412. package/dist/esm/adapter/webgl-canvas-context.js.map +0 -1
  413. package/dist/esm/adapter/webgl-device.js +0 -280
  414. package/dist/esm/adapter/webgl-device.js.map +0 -1
  415. package/dist/esm/bundle.js +0 -5
  416. package/dist/esm/bundle.js.map +0 -1
  417. package/dist/esm/classic/accessor.js +0 -144
  418. package/dist/esm/classic/accessor.js.map +0 -1
  419. package/dist/esm/classic/buffer.js +0 -384
  420. package/dist/esm/classic/buffer.js.map +0 -1
  421. package/dist/esm/classic/typed-array-utils.js +0 -112
  422. package/dist/esm/classic/typed-array-utils.js.map +0 -1
  423. package/dist/esm/context/context/context-state.js +0 -26
  424. package/dist/esm/context/context/context-state.js.map +0 -1
  425. package/dist/esm/context/context/create-context.js +0 -49
  426. package/dist/esm/context/context/create-context.js.map +0 -1
  427. package/dist/esm/context/context/device-pixels.js +0 -98
  428. package/dist/esm/context/context/device-pixels.js.map +0 -1
  429. package/dist/esm/context/context/webgl-checks.js +0 -34
  430. package/dist/esm/context/context/webgl-checks.js.map +0 -1
  431. package/dist/esm/context/debug/spector.js +0 -76
  432. package/dist/esm/context/debug/spector.js.map +0 -1
  433. package/dist/esm/context/debug/webgl-developer-tools.js +0 -121
  434. package/dist/esm/context/debug/webgl-developer-tools.js.map +0 -1
  435. package/dist/esm/context/parameters/unified-parameter-api.js +0 -65
  436. package/dist/esm/context/parameters/unified-parameter-api.js.map +0 -1
  437. package/dist/esm/context/parameters/webgl-parameter-tables.js +0 -445
  438. package/dist/esm/context/parameters/webgl-parameter-tables.js.map +0 -1
  439. package/dist/esm/context/polyfill/get-parameter-polyfill.js +0 -91
  440. package/dist/esm/context/polyfill/get-parameter-polyfill.js.map +0 -1
  441. package/dist/esm/context/polyfill/polyfill-context.js +0 -92
  442. package/dist/esm/context/polyfill/polyfill-context.js.map +0 -1
  443. package/dist/esm/context/polyfill/polyfill-table.js +0 -160
  444. package/dist/esm/context/polyfill/polyfill-table.js.map +0 -1
  445. package/dist/esm/context/polyfill/polyfill-vertex-array-object.js +0 -335
  446. package/dist/esm/context/polyfill/polyfill-vertex-array-object.js.map +0 -1
  447. package/dist/esm/context/state-tracker/deep-array-equal.js +0 -21
  448. package/dist/esm/context/state-tracker/deep-array-equal.js.map +0 -1
  449. package/dist/esm/context/state-tracker/track-context-state.js +0 -183
  450. package/dist/esm/context/state-tracker/track-context-state.js.map +0 -1
  451. package/dist/esm/context/state-tracker/with-parameters.js +0 -36
  452. package/dist/esm/context/state-tracker/with-parameters.js.map +0 -1
  453. package/dist/esm/index.js +0 -27
  454. package/dist/esm/index.js.map +0 -1
  455. package/dist/esm/init.js +0 -4
  456. package/dist/esm/init.js.map +0 -1
  457. package/dist/esm/types/webgl.js +0 -2
  458. package/dist/esm/types/webgl.js.map +0 -1
  459. package/dist/esm/types.js +0 -2
  460. package/dist/esm/types.js.map +0 -1
  461. package/dist/init.d.ts +0 -2
  462. package/dist/init.d.ts.map +0 -1
  463. package/dist/init.js +0 -4
  464. package/dist/init.js.map +0 -1
  465. package/src/bundle.ts +0 -4
  466. package/src/context/context/context-state.ts +0 -41
  467. package/src/context/context/device-pixels.ts +0 -152
  468. package/src/init.ts +0 -4
@@ -1,7 +1,7 @@
1
1
  import { assert } from '@luma.gl/api';
2
2
  import GL from '@luma.gl/constants';
3
- import WebGLResource from './webgl-resource';
4
- import { isRenderbufferFormatSupported, getRenderbufferFormatBytesPerPixel } from '../converters/renderbuffer-formats';
3
+ import { WebGLResource } from "./webgl-resource.js";
4
+ import { isRenderbufferFormatSupported, getRenderbufferFormatBytesPerPixel } from "../converters/renderbuffer-formats.js";
5
5
  const DEFAULT_RENDERBUFFER_PROPS = {
6
6
  id: undefined,
7
7
  handle: undefined,
@@ -11,50 +11,40 @@ const DEFAULT_RENDERBUFFER_PROPS = {
11
11
  height: 1,
12
12
  samples: 0
13
13
  };
14
- export default class WEBGLRenderbuffer extends WebGLResource {
14
+ export class WEBGLRenderbuffer extends WebGLResource {
15
15
  get [Symbol.toStringTag]() {
16
16
  return 'Renderbuffer';
17
17
  }
18
-
19
18
  get width() {
20
19
  return this.props.width;
21
20
  }
22
-
23
21
  get height() {
24
22
  return this.props.height;
25
23
  }
26
-
27
24
  get format() {
28
25
  return this.props.format;
29
26
  }
30
-
31
27
  get samples() {
32
28
  return this.props.samples;
33
29
  }
34
-
35
30
  static isSupported(gl, options) {
36
- return !options.format || isRenderbufferFormatSupported(gl, options.format);
31
+ return !(options !== null && options !== void 0 && options.format) || isRenderbufferFormatSupported(gl, options.format);
37
32
  }
38
-
39
33
  constructor(device, props) {
40
34
  super(device, props, DEFAULT_RENDERBUFFER_PROPS);
41
-
42
35
  this._initialize(this.props);
43
36
  }
44
-
45
37
  resize(size) {
46
38
  if (size.width !== this.width || size.height !== this.height) {
47
- Object.assign(this.props, { ...size,
39
+ Object.assign(this.props, {
40
+ ...size,
48
41
  format: this.format,
49
42
  samples: this.samples
50
43
  });
51
-
52
44
  this._initialize(this.props);
53
45
  }
54
-
55
46
  return this;
56
47
  }
57
-
58
48
  _initialize(props) {
59
49
  const {
60
50
  format,
@@ -65,30 +55,24 @@ export default class WEBGLRenderbuffer extends WebGLResource {
65
55
  assert(format, 'Needs format');
66
56
  this.trackDeallocatedMemory();
67
57
  this.gl.bindRenderbuffer(GL.RENDERBUFFER, this.handle);
68
-
69
58
  if (samples !== 0 && this.device.isWebGL2) {
70
59
  this.gl.renderbufferStorageMultisample(GL.RENDERBUFFER, samples, format, width, height);
71
60
  } else {
72
61
  this.gl.renderbufferStorage(GL.RENDERBUFFER, format, width, height);
73
62
  }
74
-
75
63
  this.gl.bindRenderbuffer(GL.RENDERBUFFER, null);
76
64
  this.trackAllocatedMemory(width * height * (samples || 1) * getRenderbufferFormatBytesPerPixel(format));
77
65
  return this;
78
66
  }
79
-
80
67
  _createHandle() {
81
68
  return this.gl.createRenderbuffer();
82
69
  }
83
-
84
70
  _deleteHandle() {
85
71
  this.gl.deleteRenderbuffer(this.handle);
86
72
  this.trackDeallocatedMemory();
87
73
  }
88
-
89
74
  _bindHandle(handle) {
90
75
  this.gl.bindRenderbuffer(GL.RENDERBUFFER, handle);
91
76
  }
92
-
93
77
  }
94
78
  //# sourceMappingURL=webgl-renderbuffer.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/adapter/objects/webgl-renderbuffer.ts"],"names":["assert","GL","WebGLResource","isRenderbufferFormatSupported","getRenderbufferFormatBytesPerPixel","DEFAULT_RENDERBUFFER_PROPS","id","undefined","handle","userData","format","width","height","samples","WEBGLRenderbuffer","Symbol","toStringTag","props","isSupported","gl","options","constructor","device","_initialize","resize","size","Object","assign","trackDeallocatedMemory","bindRenderbuffer","RENDERBUFFER","isWebGL2","renderbufferStorageMultisample","renderbufferStorage","trackAllocatedMemory","_createHandle","createRenderbuffer","_deleteHandle","deleteRenderbuffer","_bindHandle"],"mappings":"AACA,SAAQA,MAAR,QAAoC,cAApC;AACA,OAAOC,EAAP,MAAe,oBAAf;AAEA,OAAOC,aAAP,MAA0B,kBAA1B;AACA,SACEC,6BADF,EACiCC,kCADjC,QAEO,oCAFP;AAWA,MAAMC,0BAAuD,GAAG;AAC9DC,EAAAA,EAAE,EAAEC,SAD0D;AAE9DC,EAAAA,MAAM,EAAED,SAFsD;AAG9DE,EAAAA,QAAQ,EAAEF,SAHoD;AAI9DG,EAAAA,MAAM,EAAE,CAJsD;AAK9DC,EAAAA,KAAK,EAAE,CALuD;AAM9DC,EAAAA,MAAM,EAAE,CANsD;AAO9DC,EAAAA,OAAO,EAAE;AAPqD,CAAhE;AAoBA,eAAe,MAAMC,iBAAN,SAAgCZ,aAAhC,CAAiE;AACvD,OAAlBa,MAAM,CAACC,WAAW,IAAY;AAAE,WAAO,cAAP;AAAwB;;AAEpD,MAALL,KAAK,GAAW;AAAE,WAAO,KAAKM,KAAL,CAAWN,KAAlB;AAA0B;;AACtC,MAANC,MAAM,GAAW;AAAE,WAAO,KAAKK,KAAL,CAAWL,MAAlB;AAA2B;;AACxC,MAANF,MAAM,GAAY;AAAE,WAAO,KAAKO,KAAL,CAAWP,MAAlB;AAA2B;;AACxC,MAAPG,OAAO,GAAW;AAAE,WAAO,KAAKI,KAAL,CAAWJ,OAAlB;AAA4B;;AAElC,SAAXK,WAAW,CAACC,EAAD,EAA4BC,OAA5B,EAAkE;AAClF,WAAO,CAACA,OAAO,CAACV,MAAT,IAAmBP,6BAA6B,CAACgB,EAAD,EAAKC,OAAO,CAACV,MAAb,CAAvD;AACD;;AAEDW,EAAAA,WAAW,CAACC,MAAD,EAAsBL,KAAtB,EAAgD;AACzD,UAAMK,MAAN,EAAcL,KA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AAR,IAAkBC,OAAO,IAAI,CAA7B,IAAkCT,kCAAkC,CAACM,MAAD,CADtE;AAIA,WAAO,IAAP;AACD;;AAIDyB,EAAAA,aAAa,GAAG;AACd,WAAO,KAAKhB,EAAL,CAAQiB,kBAAR,EAAP;AACD;;AAEDC,EAAAA,aAAa,GAAS;AACpB,SAAKlB,EAAL,CAAQmB,kBAAR,CAA2B,KAAK9B,MAAhC;AACA,SAAKoB,sBAAL;AACD;;AAEDW,EAAAA,WAAW,CAAC/B,MAAD,EAAkC;AAC3C,SAAKW,EAAL,CAAQU,gBAAR,CAAyB5B,EAAE,CAAC6B,YAA5B,EAA0CtB,MAA1C;AACD;;AAlE6E","sourcesContent":["/* eslint-disable no-inline-comments */\nimport {assert, ResourceProps} from '@luma.gl/api';\nimport GL from '@luma.gl/constants';\nimport WebGLDevice from '../webgl-device';\nimport WebGLResource from './webgl-resource';\nimport {\n isRenderbufferFormatSupported, getRenderbufferFormatBytesPerPixel\n} from '../converters/renderbuffer-formats';\n\nexport type RenderbufferProps = ResourceProps & {\n format: number;\n width?: number;\n height?: number;\n samples?: number;\n};\n\nconst DEFAULT_RENDERBUFFER_PROPS: Required<RenderbufferProps> = {\n id: undefined,\n handle: undefined,\n userData: undefined,\n format: 0,\n width: 1, \n height: 1, \n samples: 0\n};\n\n/**\n * Renderbuffers are GPU objects that contain images.\n * In contrast to Textures they are optimized for use as render targets, with Framebuffers.\n * while Textures may not be, and are the logical choice when\n * you do not need to sample (i.e. in a post-pass shader)\n * from the produced image. If you need to resample\n * (such as when reading depth back in a second shader pass),\n * use Textures instead.\n * Renderbuffer objects also natively accommodate Multisampling (MSAA).\n */\nexport default class WEBGLRenderbuffer extends WebGLResource<RenderbufferProps> {\n get [Symbol.toStringTag](): string { return 'Renderbuffer'; }\n\n get width(): number { return this.props.width; }\n get height(): number { return this.props.height; }\n get format(): number { return this.props.format; }\n get samples(): number { return this.props.samples; }\n\n static isSupported(gl: WebGLRenderingContext, options?: {format?: number}): boolean {\n return !options.format || isRenderbufferFormatSupported(gl, options.format);\n }\n\n constructor(device: WebGLDevice, props: RenderbufferProps) {\n super(device, props, DEFAULT_RENDERBUFFER_PROPS);\n this._initialize(this.props);\n }\n\n resize(size: {width: number, height: number}): this {\n // Don't resize if width/height haven't changed\n if (size.width !== this.width || size.height !== this.height) {\n Object.assign(this.props, {...size, format: this.format, samples: this.samples});\n this._initialize(this.props);\n }\n return this;\n }\n\n // PRIVATE METHODS\n\n /** Creates and initializes a renderbuffer object's data store */\n protected _initialize(props: Required<RenderbufferProps>) {\n const {format, width, height, samples} = props;\n assert(format, 'Needs format');\n\n this.trackDeallocatedMemory();\n\n this.gl.bindRenderbuffer(GL.RENDERBUFFER, this.handle);\n\n if (samples !== 0 && this.device.isWebGL2) {\n // @ts-expect-error\n this.gl.renderbufferStorageMultisample(GL.RENDERBUFFER, samples, format, width, height);\n } else {\n this.gl.renderbufferStorage(GL.RENDERBUFFER, format, width, height);\n }\n\n this.gl.bindRenderbuffer(GL.RENDERBUFFER, null);\n\n this.trackAllocatedMemory(\n width * height * (samples || 1) * getRenderbufferFormatBytesPerPixel(format)\n );\n\n return this;\n }\n\n // RESOURCE IMPLEMENTATION\n\n _createHandle() {\n return this.gl.createRenderbuffer();\n }\n\n _deleteHandle(): void {\n this.gl.deleteRenderbuffer(this.handle);\n this.trackDeallocatedMemory();\n }\n\n _bindHandle(handle: WEBGLRenderbuffer): void {\n this.gl.bindRenderbuffer(GL.RENDERBUFFER, handle);\n }\n}\n"],"file":"webgl-renderbuffer.js"}
1
+ {"version":3,"file":"webgl-renderbuffer.js","names":["assert","GL","WebGLResource","isRenderbufferFormatSupported","getRenderbufferFormatBytesPerPixel","DEFAULT_RENDERBUFFER_PROPS","id","undefined","handle","userData","format","width","height","samples","WEBGLRenderbuffer","Symbol","toStringTag","props","isSupported","gl","options","constructor","device","_initialize","resize","size","Object","assign","trackDeallocatedMemory","bindRenderbuffer","RENDERBUFFER","isWebGL2","renderbufferStorageMultisample","renderbufferStorage","trackAllocatedMemory","_createHandle","createRenderbuffer","_deleteHandle","deleteRenderbuffer","_bindHandle"],"sources":["../../../src/adapter/objects/webgl-renderbuffer.ts"],"sourcesContent":["/* eslint-disable no-inline-comments */\nimport {assert, ResourceProps} from '@luma.gl/api';\nimport GL from '@luma.gl/constants';\nimport {WebGLDevice} from '../webgl-device';\nimport {WebGLResource} from './webgl-resource';\nimport {\n isRenderbufferFormatSupported, getRenderbufferFormatBytesPerPixel\n} from '../converters/renderbuffer-formats';\n\nexport type RenderbufferProps = ResourceProps & {\n format: number;\n width?: number;\n height?: number;\n samples?: number;\n};\n\nconst DEFAULT_RENDERBUFFER_PROPS: Required<RenderbufferProps> = {\n id: undefined,\n handle: undefined,\n userData: undefined,\n format: 0,\n width: 1, \n height: 1, \n samples: 0\n};\n\n/**\n * Renderbuffers are GPU objects that contain images.\n * In contrast to Textures they are optimized for use as render targets, with Framebuffers.\n * while Textures may not be, and are the logical choice when\n * you do not need to sample (i.e. in a post-pass shader)\n * from the produced image. If you need to resample\n * (such as when reading depth back in a second shader pass),\n * use Textures instead.\n * Renderbuffer objects also natively accommodate Multisampling (MSAA).\n */\nexport class WEBGLRenderbuffer extends WebGLResource<RenderbufferProps> {\n override get [Symbol.toStringTag](): string { return 'Renderbuffer'; }\n\n get width(): number { return this.props.width; }\n get height(): number { return this.props.height; }\n get format(): number { return this.props.format; }\n get samples(): number { return this.props.samples; }\n\n static isSupported(gl: WebGLRenderingContext, options?: {format?: number}): boolean {\n return !options?.format || isRenderbufferFormatSupported(gl, options.format);\n }\n\n constructor(device: WebGLDevice, props: RenderbufferProps) {\n super(device, props, DEFAULT_RENDERBUFFER_PROPS);\n this._initialize(this.props);\n }\n\n resize(size: {width: number, height: number}): this {\n // Don't resize if width/height haven't changed\n if (size.width !== this.width || size.height !== this.height) {\n Object.assign(this.props, {...size, format: this.format, samples: this.samples});\n this._initialize(this.props);\n }\n return this;\n }\n\n // PRIVATE METHODS\n\n /** Creates and initializes a renderbuffer object's data store */\n protected _initialize(props: Required<RenderbufferProps>) {\n const {format, width, height, samples} = props;\n assert(format, 'Needs format');\n\n this.trackDeallocatedMemory();\n\n this.gl.bindRenderbuffer(GL.RENDERBUFFER, this.handle);\n\n if (samples !== 0 && this.device.isWebGL2) {\n // @ts-expect-error\n this.gl.renderbufferStorageMultisample(GL.RENDERBUFFER, samples, format, width, height);\n } else {\n this.gl.renderbufferStorage(GL.RENDERBUFFER, format, width, height);\n }\n\n this.gl.bindRenderbuffer(GL.RENDERBUFFER, null);\n\n this.trackAllocatedMemory(\n width * height * (samples || 1) * getRenderbufferFormatBytesPerPixel(format)\n );\n\n return this;\n }\n\n // RESOURCE IMPLEMENTATION\n\n override _createHandle() {\n return this.gl.createRenderbuffer();\n }\n\n override _deleteHandle(): void {\n this.gl.deleteRenderbuffer(this.handle);\n this.trackDeallocatedMemory();\n }\n\n override _bindHandle(handle: WEBGLRenderbuffer): void {\n this.gl.bindRenderbuffer(GL.RENDERBUFFER, handle);\n }\n}\n"],"mappings":"AACA,SAAQA,MAAM,QAAsB,cAAc;AAClD,OAAOC,EAAE,MAAM,oBAAoB;AAAC,SAE5BC,aAAa;AAAA,SAEnBC,6BAA6B,EAAEC,kCAAkC;AAUnE,MAAMC,0BAAuD,GAAG;EAC9DC,EAAE,EAAEC,SAAS;EACbC,MAAM,EAAED,SAAS;EACjBE,QAAQ,EAAEF,SAAS;EACnBG,MAAM,EAAE,CAAC;EACTC,KAAK,EAAE,CAAC;EACRC,MAAM,EAAE,CAAC;EACTC,OAAO,EAAE;AACX,CAAC;AAYD,OAAO,MAAMC,iBAAiB,SAASZ,aAAa,CAAoB;EACtE,KAAca,MAAM,CAACC,WAAW,IAAY;IAAE,OAAO,cAAc;EAAE;EAErE,IAAIL,KAAKA,CAAA,EAAW;IAAE,OAAO,IAAI,CAACM,KAAK,CAACN,KAAK;EAAE;EAC/C,IAAIC,MAAMA,CAAA,EAAW;IAAE,OAAO,IAAI,CAACK,KAAK,CAACL,MAAM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OAAO,KAAK,CAAC,IAAI,IAAI,CAACS,MAAM,CAACS,QAAQ,EAAE;MAEzC,IAAI,CAACZ,EAAE,CAACa,8BAA8B,CAAC/B,EAAE,CAAC6B,YAAY,EAAEjB,OAAO,EAAEH,MAAM,EAAEC,KAAK,EAAEC,MAAM,CAAC;IACzF,CAAC,MAAM;MACL,IAAI,CAACO,EAAE,CAACc,mBAAmB,CAAChC,EAAE,CAAC6B,YAAY,EAAEpB,MAAM,EAAEC,KAAK,EAAEC,MAAM,CAAC;IACrE;IAEA,IAAI,CAACO,EAAE,CAACU,gBAAgB,CAAC5B,EAAE,CAAC6B,YAAY,EAAE,IAAI,CAAC;IAE/C,IAAI,CAACI,oBAAoB,CACvBvB,KAAK,GAAGC,MAAM,IAAIC,OAAO,IAAI,CAAC,CAAC,GAAGT,kCAAkC,CAACM,MAAM,CAAC,CAC7E;IAED,OAAO,IAAI;EACb;EAISyB,aAAaA,CAAA,EAAG;IACvB,OAAO,IAAI,CAAChB,EAAE,CAACiB,kBAAkB,EAAE;EACrC;EAESC,aAAaA,CAAA,EAAS;IAC7B,IAAI,CAAClB,EAAE,CAACmB,kBAAkB,CAAC,IAAI,CAAC9B,MAAM,CAAC;IACvC,IAAI,CAACoB,sBAAsB,EAAE;EAC/B;EAESW,WAAWA,CAAC/B,MAAyB,EAAQ;IACpD,IAAI,CAACW,EAAE,CAACU,gBAAgB,CAAC5B,EAAE,CAAC6B,YAAY,EAAEtB,MAAM,CAAC;EACnD;AACF"}
@@ -1,13 +1,11 @@
1
1
  import { Resource } from '@luma.gl/api';
2
2
  import type { Device, ResourceProps } from '@luma.gl/api';
3
3
  import GL from '@luma.gl/constants';
4
- import WebGLDevice from '../webgl-device';
4
+ import { WebGLDevice } from '../webgl-device';
5
5
  /**
6
6
  * Base class for WebGL object wrappers
7
7
  */
8
- export default abstract class WebGLResource<Props> extends Resource<Props> {
9
- id: string;
10
- userData: any;
8
+ export declare abstract class WebGLResource<Props extends ResourceProps> extends Resource<Props> {
11
9
  readonly device: WebGLDevice;
12
10
  readonly gl: WebGLRenderingContext;
13
11
  readonly gl2: WebGL2RenderingContext;
@@ -29,7 +27,7 @@ export default abstract class WebGLResource<Props> extends Resource<Props> {
29
27
  * @param name
30
28
  * @return param
31
29
  */
32
- getParameter(pname: number, props?: {}): any;
30
+ getParameter(pname: number, props?: any): any;
33
31
  getParameters(options?: {
34
32
  parameters?: any;
35
33
  keys?: any;
@@ -1 +1 @@
1
- {"version":3,"file":"webgl-resource.d.ts","sourceRoot":"","sources":["../../../src/adapter/objects/webgl-resource.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,QAAQ,EAAkC,MAAM,cAAc,CAAC;AACvE,OAAO,KAAK,EAAC,MAAM,EAAE,aAAa,EAAC,MAAM,cAAc,CAAC;AACxD,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAEpC,OAAO,WAAW,MAAM,iBAAiB,CAAC;AAO1C;;GAEG;AACF,MAAM,CAAC,OAAO,CAAC,QAAQ,OAAO,aAAa,CAAC,KAAK,CAAE,SAAQ,QAAQ,CAAC,KAAK,CAAC;IACzE,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,GAAG,CAAC;IACd,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC;IAC7B,QAAQ,CAAC,EAAE,EAAE,qBAAqB,CAAC;IACnC,QAAQ,CAAC,GAAG,EAAE,sBAAsB,CAAC;IACrC,OAAO,CAAC,OAAO,CAAM;IAErB,OAAO,CAAC,MAAM,CAAS;IAEvB,UAAU,SAAK;gBAEH,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,YAAY,EAAE,QAAQ,CAAC,KAAK,CAAC;IAgCvE,QAAQ,IAAI,MAAM;IAIlB,IAAI,MAAM,QAWT;IAED,OAAO,IAAI,IAAI;IAIf,MAAM,CAAC,EAAC,cAAsB,EAAC;;KAAK;IAmBpC,IAAI,CAAC,YAAY,MAAc;IAuB/B,MAAM;IAIN;;;;;OAKG;IACH,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import { isWebGL2, assertWebGLContext } from '../../context/context/webgl-checks';
4
- import WebGLDevice from '../webgl-device';
5
- import { getKey, getKeyValue } from './constants-to-keys';
3
+ import { isWebGL2, assertWebGLContext } from "../../context/context/webgl-checks.js";
4
+ import { WebGLDevice } from "../webgl-device.js";
5
+ import { getKey, getKeyValue } from "./constants-to-keys.js";
6
6
  const ERR_RESOURCE_METHOD_UNDEFINED = 'Resource subclass must define virtual methods';
7
- export default class WebGLResource extends Resource {
7
+ export class WebGLResource extends Resource {
8
8
  constructor(device, props, defaultProps) {
9
9
  super(device, props, defaultProps);
10
-
11
- _defineProperty(this, "id", void 0);
12
-
13
- _defineProperty(this, "userData", void 0);
14
-
15
10
  _defineProperty(this, "device", void 0);
16
-
17
11
  _defineProperty(this, "gl", void 0);
18
-
19
12
  _defineProperty(this, "gl2", void 0);
20
-
21
13
  _defineProperty(this, "_handle", void 0);
22
-
23
14
  _defineProperty(this, "_bound", false);
24
-
25
15
  _defineProperty(this, "byteLength", 0);
26
-
27
16
  this.device = WebGLDevice.attach(device);
28
17
  const gl = this.device.gl;
29
18
  assertWebGLContext(gl);
30
19
  const {
31
- id,
32
- userData = {}
20
+ id
33
21
  } = props || {};
34
22
  this.gl = gl;
35
23
  this.gl2 = gl;
36
24
  this.id = id || uid(this.constructor.name);
37
- this.userData = userData;
38
25
  this._handle = props === null || props === void 0 ? void 0 : props.handle;
39
-
40
26
  if (this._handle === undefined) {
41
27
  this._handle = this._createHandle();
42
28
  }
43
-
44
29
  this.byteLength = 0;
45
30
  }
46
-
47
31
  toString() {
48
32
  return "".concat(this.constructor.name, "(").concat(this.id, ")");
49
33
  }
50
-
51
34
  get handle() {
52
35
  return this._handle;
53
36
  }
54
-
55
37
  destroy() {
56
38
  this.delete();
57
39
  }
58
-
59
- delete({
60
- deleteChildren = false
61
- } = {}) {
40
+ delete() {
41
+ let {
42
+ deleteChildren = false
43
+ } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
62
44
  const children = this._handle && this._deleteHandle(this._handle);
63
-
64
45
  if (this._handle) {
65
46
  this.removeStats();
66
47
  }
67
-
68
48
  this._handle = null;
69
-
70
49
  if (children && deleteChildren) {
71
50
  children.filter(Boolean).forEach(child => child.delete());
72
51
  }
73
-
74
52
  return this;
75
53
  }
76
-
77
- bind(funcOrHandle = this.handle) {
54
+ bind() {
55
+ let funcOrHandle = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.handle;
78
56
  if (typeof funcOrHandle !== 'function') {
79
57
  this._bindHandle(funcOrHandle);
80
-
81
58
  return this;
82
59
  }
83
-
84
60
  let value;
85
-
86
61
  if (!this._bound) {
87
62
  this._bindHandle(this.handle);
88
-
89
63
  this._bound = true;
90
64
  value = funcOrHandle();
91
65
  this._bound = false;
92
-
93
66
  this._bindHandle(null);
94
67
  } else {
95
68
  value = funcOrHandle();
96
69
  }
97
-
98
70
  return value;
99
71
  }
100
-
101
72
  unbind() {
102
73
  this.bind(null);
103
74
  }
104
-
105
- getParameter(pname, props = {}) {
75
+ getParameter(pname) {
76
+ let props = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
106
77
  pname = getKeyValue(this.gl, pname);
107
78
  assert(pname);
108
79
  const parameters = this.constructor.PARAMETERS || {};
109
80
  const parameter = parameters[pname];
110
-
111
81
  if (parameter) {
112
82
  const isWebgl2 = isWebGL2(this.gl);
113
83
  const parameterAvailable = (!('webgl2' in parameter) || isWebgl2) && (!('extension' in parameter) || this.gl.getExtension(parameter.extension));
114
-
115
84
  if (!parameterAvailable) {
116
85
  const webgl1Default = parameter.webgl1;
117
86
  const webgl2Default = 'webgl2' in parameter ? parameter.webgl2 : parameter.webgl1;
@@ -119,11 +88,10 @@ export default class WebGLResource extends Resource {
119
88
  return defaultValue;
120
89
  }
121
90
  }
122
-
123
91
  return this._getParameter(pname, props);
124
92
  }
125
-
126
- getParameters(options = {}) {
93
+ getParameters() {
94
+ let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
127
95
  const {
128
96
  parameters,
129
97
  keys
@@ -132,85 +100,64 @@ export default class WebGLResource extends Resource {
132
100
  const isWebgl2 = isWebGL2(this.gl);
133
101
  const values = {};
134
102
  const parameterKeys = parameters || Object.keys(PARAMETERS);
135
-
136
103
  for (const pname of parameterKeys) {
137
104
  const parameter = PARAMETERS[pname];
138
105
  const parameterAvailable = parameter && (!('webgl2' in parameter) || isWebgl2) && (!('extension' in parameter) || this.gl.getExtension(parameter.extension));
139
-
140
106
  if (parameterAvailable) {
141
107
  const key = keys ? getKey(this.gl, pname) : pname;
142
108
  values[key] = this.getParameter(pname, options);
143
-
144
109
  if (keys && parameter.type === 'GLenum') {
145
110
  values[key] = getKey(this.gl, values[key]);
146
111
  }
147
112
  }
148
113
  }
149
-
150
114
  return values;
151
115
  }
152
-
153
116
  setParameter(pname, value) {
154
117
  pname = getKeyValue(this.gl, pname);
155
118
  assert(pname);
156
119
  const parameters = this.constructor.PARAMETERS || {};
157
120
  const parameter = parameters[pname];
158
-
159
121
  if (parameter) {
160
122
  const isWebgl2 = isWebGL2(this.gl);
161
123
  const parameterAvailable = (!('webgl2' in parameter) || isWebgl2) && (!('extension' in parameter) || this.gl.getExtension(parameter.extension));
162
-
163
124
  if (!parameterAvailable) {
164
125
  throw new Error('Parameter not available on this platform');
165
126
  }
166
-
167
127
  if (parameter.type === 'GLenum') {
168
128
  value = getKeyValue(value);
169
129
  }
170
130
  }
171
-
172
131
  this._setParameter(pname, value);
173
-
174
132
  return this;
175
133
  }
176
-
177
134
  setParameters(parameters) {
178
135
  for (const pname in parameters) {
179
136
  this.setParameter(pname, parameters[pname]);
180
137
  }
181
-
182
138
  return this;
183
139
  }
184
-
185
140
  stubRemovedMethods(className, version, methodNames) {
186
141
  return stubRemovedMethods(this, className, version, methodNames);
187
142
  }
188
-
189
143
  initialize(props) {}
190
-
191
144
  _createHandle() {
192
145
  throw new Error(ERR_RESOURCE_METHOD_UNDEFINED);
193
146
  }
194
-
195
147
  _deleteHandle() {
196
148
  throw new Error(ERR_RESOURCE_METHOD_UNDEFINED);
197
149
  }
198
-
199
150
  _bindHandle(handle) {
200
151
  throw new Error(ERR_RESOURCE_METHOD_UNDEFINED);
201
152
  }
202
-
203
153
  _getOptsFromHandle() {
204
154
  throw new Error(ERR_RESOURCE_METHOD_UNDEFINED);
205
155
  }
206
-
207
156
  _getParameter(pname, props) {
208
157
  throw new Error(ERR_RESOURCE_METHOD_UNDEFINED);
209
158
  }
210
-
211
159
  _setParameter(pname, value) {
212
160
  throw new Error(ERR_RESOURCE_METHOD_UNDEFINED);
213
161
  }
214
-
215
162
  }
216
163
  //# sourceMappingURL=webgl-resource.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/adapter/objects/webgl-resource.ts"],"names":["Resource","assert","uid","stubRemovedMethods","isWebGL2","assertWebGLContext","WebGLDevice","getKey","getKeyValue","ERR_RESOURCE_METHOD_UNDEFINED","WebGLResource","constructor","device","props","defaultProps","attach","gl","id","userData","gl2","name","_handle","handle","undefined","_createHandle","byteLength","toString","destroy","delete","deleteChildren","children","_deleteHandle","removeStats","filter","Boolean","forEach","child","bind","funcOrHandle","_bindHandle","value","_bound","unbind","getParameter","pname","parameters","PARAMETERS","parameter","isWebgl2","parameterAvailable","getExtension","extension","webgl1Default","webgl1","webgl2Default","webgl2","defaultValue","_getParameter","getParameters","options","keys","values","parameterKeys","Object","key","type","setParameter","Error","_setParameter","setParameters","className","version","methodNames","initialize","_getOptsFromHandle"],"mappings":";AACA,SAAQA,QAAR,EAAkBC,MAAlB,EAA0BC,GAA1B,EAA+BC,kBAA/B,QAAwD,cAAxD;AAGA,SAAQC,QAAR,EAAkBC,kBAAlB,QAA2C,oCAA3C;AACA,OAAOC,WAAP,MAAwB,iBAAxB;AAGA,SAAQC,MAAR,EAAgBC,WAAhB,QAAkC,qBAAlC;AAEA,MAAMC,6BAA6B,GAAG,+CAAtC;AAKC,eAAe,MAAeC,aAAf,SAA4CV,QAA5C,CAA4D;AAY1EW,EAAAA,W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AACzC,SAAK,MAAMD,KAAX,IAAoBC,UAApB,EAAgC;AAC9B,WAAKqB,YAAL,CAAkBtB,KAAlB,EAAyBC,UAAU,CAACD,KAAD,CAAnC;AACD;;AACD,WAAO,IAAP;AACD;;AAGDzC,EAAAA,kBAAkB,CAACmE,SAAD,EAAoBC,OAApB,EAAqCC,WAArC,EAA4D;AAC5E,WAAOrE,kBAAkB,CAAC,IAAD,EAAOmE,SAAP,EAAkBC,OAAlB,EAA2BC,WAA3B,CAAzB;AACD;;AAGDC,EAAAA,UAAU,CAAC5D,KAAD,EAAuB,CAAE;;AAGnCW,EAAAA,aAAa,GAAG;AACd,UAAM,IAAI2C,KAAJ,CAAU1D,6BAAV,CAAN;AACD;;AAEDsB,EAAAA,aAAa,GAAG;AACd,UAAM,IAAIoC,KAAJ,CAAU1D,6BAAV,CAAN;AACD;;AAED8B,EAAAA,WAAW,CAACjB,MAAD,EAAc;AACvB,UAAM,IAAI6C,KAAJ,CAAU1D,6BAAV,CAAN;AACD;;AAEDiE,EAAAA,kBAAkB,GAAG;AACnB,UAAM,IAAIP,KAAJ,CAAU1D,6BAAV,CAAN;AACD;;AAEDgD,EAAAA,aAAa,CAACb,KAAD,EAAY/B,KAAZ,EAAgD;AAC3D,UAAM,IAAIsD,KAAJ,CAAU1D,6BAAV,CAAN;AACD;;AAED2D,EAAAA,aAAa,CAACxB,KAAD,EAAqBJ,KAArB,EAAiC;AAC5C,UAAM,IAAI2B,KAAJ,CAAU1D,6BAAV,CAAN;AACD;;AA9QyE","sourcesContent":["// luma.gl, MIT license\nimport {Resource, assert, uid, stubRemovedMethods} from '@luma.gl/api';\nimport type {Device, ResourceProps} from '@luma.gl/api';\nimport GL from '@luma.gl/constants';\nimport {isWebGL2, assertWebGLContext} from '../../context/context/webgl-checks';\nimport WebGLDevice from '../webgl-device';\n\n// Requires full GL enum to be bundled... Make these bindings dependent on dynamic import (debug)?\nimport {getKey, getKeyValue} from './constants-to-keys';\n\nconst ERR_RESOURCE_METHOD_UNDEFINED = 'Resource subclass must define virtual methods';\n\n/**\n * Base class for WebGL object wrappers\n */\n export default abstract class WebGLResource<Props> extends Resource<Props> {\n id: string;\n userData: any;\n readonly device: WebGLDevice;\n readonly gl: WebGLRenderingContext;\n readonly gl2: WebGL2RenderingContext;\n private _handle: any;\n\n private _bound = false;\n // Only meaningful for resources that allocate GPU memory\n byteLength = 0;\n\n constructor(device: Device, props: Props, defaultProps: Required<Props>) {\n super(device, props, defaultProps);\n\n this.device = WebGLDevice.attach(device);\n const gl = this.device.gl;\n\n assertWebGLContext(gl);\n\n // extends \n // @ts-expect-error\n const {id, userData = {}} = props || {};\n this.gl = gl;\n this.gl2 = gl as WebGL2RenderingContext;\n this.id = id || uid(this.constructor.name);\n this.userData = userData;\n\n // Set the handle\n // If handle was provided, use it, otherwise create a new handle\n\n // TODO - Stores the handle with context loss information\n // this.glCount = glGetContextLossCount(this.gl);\n\n // Default VertexArray needs to be created with null handle, so compare against undefined\n // @ts-expect-error\n this._handle = props?.handle;\n if (this._handle === undefined) {\n this._handle = this._createHandle();\n }\n\n this.byteLength = 0;\n }\n\n toString(): string {\n return `${this.constructor.name}(${this.id})`;\n }\n\n get handle() {\n // TODO - Add context loss handling\n // Will regenerate and reinitialize the handle if necessary\n // const glCount = glGetContextLossCount(this.gl);\n // if (this.glCount !== glCount) {\n // this._handle = this._createHandle(this.props);\n // this._glCount = glCount;\n // // Reinitialize object\n // this.initialize(this.props);\n // }\n return this._handle;\n }\n\n destroy(): void {\n this.delete();\n }\n\n delete({deleteChildren = false} = {}) {\n // Delete this object, and get refs to any children\n // @ts-expect-error\n const children = this._handle && this._deleteHandle(this._handle);\n if (this._handle) {\n this.removeStats();\n }\n this._handle = null;\n\n // Optionally, recursively delete the children\n // @ts-expect-error\n if (children && deleteChildren) {\n // @ts-expect-error\n children.filter(Boolean).forEach((child) => child.delete());\n }\n\n return this;\n }\n\n bind(funcOrHandle = this.handle) {\n if (typeof funcOrHandle !== 'function') {\n this._bindHandle(funcOrHandle);\n return this;\n }\n\n let value;\n\n if (!this._bound) {\n this._bindHandle(this.handle);\n this._bound = true;\n\n value = funcOrHandle();\n\n this._bound = false;\n this._bindHandle(null);\n } else {\n value = funcOrHandle();\n }\n\n return value;\n }\n\n unbind() {\n this.bind(null);\n }\n\n /**\n * Query a Resource parameter\n *\n * @param name\n * @return param\n */\n getParameter(pname: number, props = {}): any {\n pname = getKeyValue(this.gl, pname);\n assert(pname);\n\n // @ts-expect-error\n const parameters = this.constructor.PARAMETERS || {};\n\n // Use parameter definitions to handle unsupported parameters\n const parameter = parameters[pname];\n if (parameter) {\n const isWebgl2 = isWebGL2(this.gl);\n\n // Check if we can query for this parameter\n const parameterAvailable =\n (!('webgl2' in parameter) || isWebgl2) &&\n (!('extension' in parameter) || this.gl.getExtension(parameter.extension));\n\n if (!parameterAvailable) {\n const webgl1Default = parameter.webgl1;\n const webgl2Default = 'webgl2' in parameter ? parameter.webgl2 : parameter.webgl1;\n const defaultValue = isWebgl2 ? webgl2Default : webgl1Default;\n return defaultValue;\n }\n }\n\n // If unknown parameter - Could be a valid parameter not covered by PARAMS\n // Attempt to query for it and let WebGL report errors\n return this._getParameter(pname, props);\n }\n\n // Many resources support a getParameter call -\n // getParameters will get all parameters - slow but useful for debugging\n // eslint-disable-next-line complexity\n getParameters(options: {parameters?, keys?} = {}) {\n const {parameters, keys} = options;\n\n // Get parameter definitions for this Resource\n // @ts-expect-error\n const PARAMETERS = this.constructor.PARAMETERS || {};\n\n const isWebgl2 = isWebGL2(this.gl);\n\n const values: Record<string, any> = {};\n\n // Query all parameters if no list provided\n const parameterKeys = parameters || Object.keys(PARAMETERS);\n\n // WEBGL limits\n for (const pname of parameterKeys) {\n const parameter = PARAMETERS[pname];\n\n // Check if this parameter is available on this platform\n const parameterAvailable =\n parameter &&\n (!('webgl2' in parameter) || isWebgl2) &&\n (!('extension' in parameter) || this.gl.getExtension(parameter.extension));\n\n if (parameterAvailable) {\n const key = keys ? getKey(this.gl, pname) : pname;\n values[key] = this.getParameter(pname, options);\n if (keys && parameter.type === 'GLenum') {\n values[key] = getKey(this.gl, values[key]);\n }\n }\n }\n\n return values;\n }\n\n /**\n * Update a Resource setting\n *\n * @todo - cache parameter to avoid issuing WebGL calls?\n *\n * @param pname - parameter (GL constant, value or key)\n * @param value {GLint|GLfloat|GLenum} \n * @return returns self to enable chaining\n */\n setParameter(pname: GL | string, value: any): this {\n pname = getKeyValue(this.gl, pname);\n assert(pname);\n\n // @ts-expect-error\n const parameters = this.constructor.PARAMETERS || {};\n\n const parameter = parameters[pname];\n if (parameter) {\n const isWebgl2 = isWebGL2(this.gl);\n\n // Check if this parameter is available on this platform\n const parameterAvailable =\n (!('webgl2' in parameter) || isWebgl2) &&\n (!('extension' in parameter) || this.gl.getExtension(parameter.extension));\n\n if (!parameterAvailable) {\n throw new Error('Parameter not available on this platform');\n }\n\n // Handle string keys\n if (parameter.type === 'GLenum') {\n // @ts-expect-error\n value = getKeyValue(value);\n }\n }\n\n // If unknown parameter - Could be a valid parameter not covered by PARAMS\n // attempt to set it and let WebGL report errors\n this._setParameter(pname, value);\n return this;\n }\n\n /*\n * Batch update resource parameters\n * Assumes the subclass supports a setParameter call\n */\n setParameters(parameters: Record<GL, any>) {\n for (const pname in parameters) {\n this.setParameter(pname, parameters[pname]);\n }\n return this;\n }\n\n // Install stubs for removed methods\n stubRemovedMethods(className: string, version: string, methodNames: string[]) {\n return stubRemovedMethods(this, className, version, methodNames);\n }\n\n // PUBLIC VIRTUAL METHODS\n initialize(props: ResourceProps) {}\n\n // PROTECTED METHODS - These must be overridden by subclass\n _createHandle() {\n throw new Error(ERR_RESOURCE_METHOD_UNDEFINED);\n }\n\n _deleteHandle() {\n throw new Error(ERR_RESOURCE_METHOD_UNDEFINED);\n }\n\n _bindHandle(handle: any) {\n throw new Error(ERR_RESOURCE_METHOD_UNDEFINED);\n }\n\n _getOptsFromHandle() {\n throw new Error(ERR_RESOURCE_METHOD_UNDEFINED);\n }\n\n _getParameter(pname: GL, props: Record<string, any>): number {\n throw new Error(ERR_RESOURCE_METHOD_UNDEFINED);\n }\n\n _setParameter(pname: GL | string, value: any) {\n throw new Error(ERR_RESOURCE_METHOD_UNDEFINED);\n }\n\n // PRIVATE METHODS\n\n /*\n _addStats() {\n const name = this.constructor.name;\n const stats = lumaStats.get('Resource Counts');\n\n stats.get('Resources Created').incrementCount();\n stats.get(`${name}s Created`).incrementCount();\n stats.get(`${name}s Active`).incrementCount();\n }\n\n _removeStats() {\n const name = this.constructor.name;\n const stats = lumaStats.get('Resource Counts');\n\n stats.get(`${name}s Active`).decrementCount();\n }\n\n trackAllocatedMemory(bytes, name = this.constructor.name) {\n const stats = lumaStats.get('Memory Usage');\n\n stats.get('GPU Memory').addCount(bytes);\n stats.get(`${name} Memory`).addCount(bytes);\n this.byteLength = bytes;\n }\n\n trackDeallocatedMemory(name = this.constructor.name) {\n const stats = lumaStats.get('Memory Usage');\n\n stats.get('GPU Memory').subtractCount(this.byteLength);\n stats.get(`${name} Memory`).subtractCount(this.byteLength);\n this.byteLength = 0;\n }\n */\n}\n"],"file":"webgl-resource.js"}
1
+ {"version":3,"file":"webgl-resource.js","names":["Resource","assert","uid","stubRemovedMethods","isWebGL2","assertWebGLContext","WebGLDevice","getKey","getKeyValue","ERR_RESOURCE_METHOD_UNDEFINED","WebGLResource","constructor","device","props","defaultProps","_defineProperty","attach","gl","id","gl2","name","_handle","handle","undefined","_createHandle","byteLength","toString","concat","destroy","delete","deleteChildren","arguments","length","children","_deleteHandle","removeStats","filter","Boolean","forEach","child","bind","funcOrHandle","_bindHandle","value","_bound","unbind","getParameter","pname","parameters","PARAMETERS","parameter","isWebgl2","parameterAvailable","getExtension","extension","webgl1Default","webgl1","webgl2Default","webgl2","defaultValue","_getParameter","getParameters","options","keys","values","parameterKeys","Object","key","type","setParameter","Error","_setParameter","setParameters","className","version","methodNames","initialize","_getOptsFromHandle"],"sources":["../../../src/adapter/objects/webgl-resource.ts"],"sourcesContent":["// luma.gl, MIT license\nimport {Resource, assert, uid, stubRemovedMethods} from '@luma.gl/api';\nimport type {Device, ResourceProps} from '@luma.gl/api';\nimport GL from '@luma.gl/constants';\nimport {isWebGL2, assertWebGLContext} from '../../context/context/webgl-checks';\nimport {WebGLDevice} from '../webgl-device';\n\n// Requires full GL enum to be bundled... Make these bindings dependent on dynamic import (debug)?\nimport {getKey, getKeyValue} from './constants-to-keys';\n\nconst ERR_RESOURCE_METHOD_UNDEFINED = 'Resource subclass must define virtual methods';\n\n/**\n * Base class for WebGL object wrappers\n */\nexport abstract class WebGLResource<Props extends ResourceProps> extends Resource<Props> {\n readonly device: WebGLDevice;\n readonly gl: WebGLRenderingContext;\n readonly gl2: WebGL2RenderingContext;\n private _handle: any;\n\n private _bound = false;\n // Only meaningful for resources that allocate GPU memory\n byteLength = 0;\n\n constructor(device: Device, props: Props, defaultProps: Required<Props>) {\n super(device, props, defaultProps);\n\n this.device = WebGLDevice.attach(device);\n const gl = this.device.gl;\n\n assertWebGLContext(gl);\n\n // extends \n const {id} = props || {};\n this.gl = gl;\n this.gl2 = gl as WebGL2RenderingContext;\n this.id = id || uid(this.constructor.name);\n\n // Set the handle\n // If handle was provided, use it, otherwise create a new handle\n\n // TODO - Stores the handle with context loss information\n // this.glCount = glGetContextLossCount(this.gl);\n\n // Default VertexArray needs to be created with null handle, so compare against undefined\n this._handle = props?.handle;\n if (this._handle === undefined) {\n this._handle = this._createHandle();\n }\n\n this.byteLength = 0;\n }\n\n override toString(): string {\n return `${this.constructor.name}(${this.id})`;\n }\n\n get handle() {\n // TODO - Add context loss handling\n // Will regenerate and reinitialize the handle if necessary\n // const glCount = glGetContextLossCount(this.gl);\n // if (this.glCount !== glCount) {\n // this._handle = this._createHandle(this.props);\n // this._glCount = glCount;\n // // Reinitialize object\n // this.initialize(this.props);\n // }\n return this._handle;\n }\n\n override destroy(): void {\n this.delete();\n }\n\n override delete({deleteChildren = false} = {}) {\n // Delete this object, and get refs to any children\n // @ts-expect-error\n const children = this._handle && this._deleteHandle(this._handle);\n if (this._handle) {\n this.removeStats();\n }\n this._handle = null;\n\n // Optionally, recursively delete the children\n // @ts-expect-error\n if (children && deleteChildren) {\n // @ts-expect-error\n children.filter(Boolean).forEach((child) => child.delete());\n }\n\n return this;\n }\n\n bind(funcOrHandle = this.handle) {\n if (typeof funcOrHandle !== 'function') {\n this._bindHandle(funcOrHandle);\n return this;\n }\n\n let value;\n\n if (!this._bound) {\n this._bindHandle(this.handle);\n this._bound = true;\n\n value = funcOrHandle();\n\n this._bound = false;\n this._bindHandle(null);\n } else {\n value = funcOrHandle();\n }\n\n return value;\n }\n\n unbind() {\n this.bind(null);\n }\n\n /**\n * Query a Resource parameter\n *\n * @param name\n * @return param\n */\n getParameter(pname: number, props: any = {}): any {\n pname = getKeyValue(this.gl, pname);\n assert(pname);\n\n // @ts-expect-error\n const parameters = this.constructor.PARAMETERS || {};\n\n // Use parameter definitions to handle unsupported parameters\n const parameter = parameters[pname];\n if (parameter) {\n const isWebgl2 = isWebGL2(this.gl);\n\n // Check if we can query for this parameter\n const parameterAvailable =\n (!('webgl2' in parameter) || isWebgl2) &&\n (!('extension' in parameter) || this.gl.getExtension(parameter.extension));\n\n if (!parameterAvailable) {\n const webgl1Default = parameter.webgl1;\n const webgl2Default = 'webgl2' in parameter ? parameter.webgl2 : parameter.webgl1;\n const defaultValue = isWebgl2 ? webgl2Default : webgl1Default;\n return defaultValue;\n }\n }\n\n // If unknown parameter - Could be a valid parameter not covered by PARAMS\n // Attempt to query for it and let WebGL report errors\n return this._getParameter(pname, props);\n }\n\n // Many resources support a getParameter call -\n // getParameters will get all parameters - slow but useful for debugging\n // eslint-disable-next-line complexity\n getParameters(options: {parameters?: any, keys?: any} = {}) {\n const {parameters, keys} = options;\n\n // Get parameter definitions for this Resource\n // @ts-expect-error\n const PARAMETERS = this.constructor.PARAMETERS || {};\n\n const isWebgl2 = isWebGL2(this.gl);\n\n const values: Record<string, any> = {};\n\n // Query all parameters if no list provided\n const parameterKeys = parameters || Object.keys(PARAMETERS);\n\n // WEBGL limits\n for (const pname of parameterKeys) {\n const parameter = PARAMETERS[pname];\n\n // Check if this parameter is available on this platform\n const parameterAvailable =\n parameter &&\n (!('webgl2' in parameter) || isWebgl2) &&\n (!('extension' in parameter) || this.gl.getExtension(parameter.extension));\n\n if (parameterAvailable) {\n const key = keys ? getKey(this.gl, pname) : pname;\n values[key] = this.getParameter(pname, options);\n if (keys && parameter.type === 'GLenum') {\n values[key] = getKey(this.gl, values[key]);\n }\n }\n }\n\n return values;\n }\n\n /**\n * Update a Resource setting\n *\n * @todo - cache parameter to avoid issuing WebGL calls?\n *\n * @param pname - parameter (GL constant, value or key)\n * @param value {GLint|GLfloat|GLenum} \n * @return returns self to enable chaining\n */\n setParameter(pname: GL | string, value: any): this {\n pname = getKeyValue(this.gl, pname);\n assert(pname);\n\n // @ts-expect-error\n const parameters = this.constructor.PARAMETERS || {};\n\n const parameter = parameters[pname];\n if (parameter) {\n const isWebgl2 = isWebGL2(this.gl);\n\n // Check if this parameter is available on this platform\n const parameterAvailable =\n (!('webgl2' in parameter) || isWebgl2) &&\n (!('extension' in parameter) || this.gl.getExtension(parameter.extension));\n\n if (!parameterAvailable) {\n throw new Error('Parameter not available on this platform');\n }\n\n // Handle string keys\n if (parameter.type === 'GLenum') {\n // @ts-expect-error\n value = getKeyValue(value);\n }\n }\n\n // If unknown parameter - Could be a valid parameter not covered by PARAMS\n // attempt to set it and let WebGL report errors\n this._setParameter(pname, value);\n return this;\n }\n\n /*\n * Batch update resource parameters\n * Assumes the subclass supports a setParameter call\n */\n setParameters(parameters: Record<GL, any>) {\n for (const pname in parameters) {\n this.setParameter(pname, parameters[pname]);\n }\n return this;\n }\n\n // Install stubs for removed methods\n stubRemovedMethods(className: string, version: string, methodNames: string[]) {\n return stubRemovedMethods(this, className, version, methodNames);\n }\n\n // PUBLIC VIRTUAL METHODS\n initialize(props: ResourceProps) {}\n\n // PROTECTED METHODS - These must be overridden by subclass\n _createHandle() {\n throw new Error(ERR_RESOURCE_METHOD_UNDEFINED);\n }\n\n _deleteHandle() {\n throw new Error(ERR_RESOURCE_METHOD_UNDEFINED);\n }\n\n _bindHandle(handle: any) {\n throw new Error(ERR_RESOURCE_METHOD_UNDEFINED);\n }\n\n _getOptsFromHandle() {\n throw new Error(ERR_RESOURCE_METHOD_UNDEFINED);\n }\n\n _getParameter(pname: GL, props: Record<string, any>): number {\n throw new Error(ERR_RESOURCE_METHOD_UNDEFINED);\n }\n\n _setParameter(pname: GL | string, value: any) {\n throw new Error(ERR_RESOURCE_METHOD_UNDEFINED);\n }\n\n // PRIVATE METHODS\n\n /*\n _addStats() {\n const name = this.constructor.name;\n const stats = lumaStats.get('Resource Counts');\n\n stats.get('Resources Created').incrementCount();\n stats.get(`${name}s Created`).incrementCount();\n stats.get(`${name}s Active`).incrementCount();\n }\n\n _removeStats() {\n const name = this.constructor.name;\n const stats = lumaStats.get('Resource Counts');\n\n stats.get(`${name}s Active`).decrementCount();\n }\n\n trackAllocatedMemory(bytes, name = this.constructor.name) {\n const stats = lumaStats.get('Memory Usage');\n\n stats.get('GPU Memory').addCount(bytes);\n stats.get(`${name} Memory`).addCount(bytes);\n this.byteLength = bytes;\n }\n\n trackDeallocatedMemory(name = this.constructor.name) {\n const stats = lumaStats.get('Memory Usage');\n\n stats.get('GPU Memory').subtractCount(this.byteLength);\n stats.get(`${name} Memory`).subtractCount(this.byteLength);\n this.byteLength = 0;\n }\n */\n}\n"],"mappings":";AACA,SAAQA,QAAQ,EAAEC,MAAM,EAAEC,GAAG,EAAEC,kBAAkB,QAAO,cAAc;AAAC,SAG/DC,QAAQ,EAAEC,kBAAkB;AAAA,SAC5BC,WAAW;AAAA,SAGXC,MAAM,EAAEC,WAAW;AAE3B,MAAMC,6BAA6B,GAAG,+CAA+C;AAKrF,OAAO,MAAeC,aAAa,SAAsCV,QAAQ,CAAQ;EAUvFW,WAAWA,CAACC,MAAc,EAAEC,KAAY,EAAEC,YAA6B,EAAE;IAC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,KAAU,EAAE;IAC5C,MAAM,IAAI2B,KAAK,CAAC7D,6BAA6B,CAAC;EAChD;AAqCF"}
@@ -1,21 +1,21 @@
1
1
  import { ResourceProps } from '@luma.gl/api';
2
- import WebGLDevice from '../webgl-device';
3
- import WebGLResource from './webgl-resource';
4
- import Buffer from '../resources/webgl-buffer';
2
+ import { WebGLDevice } from '../webgl-device';
3
+ import { WebGLResource } from './webgl-resource';
4
+ import { WEBGLBuffer } from '../resources/webgl-buffer';
5
5
  /**
6
6
  * VertexArrayObject properties
7
7
  */
8
8
  export declare type VertexArrayObjectProps = ResourceProps & {};
9
9
  /** VertexArrayObject wrapper */
10
- export default class WEBGLVertexArrayObject extends WebGLResource<VertexArrayObjectProps> {
10
+ export declare class WEBGLVertexArrayObject extends WebGLResource<VertexArrayObjectProps> {
11
11
  get [Symbol.toStringTag](): string;
12
12
  constructor(device: WebGLDevice, props?: VertexArrayObjectProps);
13
13
  _createHandle(): WebGLVertexArrayObject;
14
14
  _deleteHandle(): void;
15
15
  _bindHandle(handle: WEBGLVertexArrayObject): void;
16
- setElementBuffer(elementBuffer?: Buffer, opts?: {}): this;
16
+ setElementBuffer(elementBuffer?: WEBGLBuffer | null, opts?: {}): this;
17
17
  /** Set a location in vertex attributes array to a buffer, enables the location, sets divisor */
18
- setBuffer(location: number, buffer: Buffer, accessor: any): this;
18
+ setBuffer(location: number, buffer: WEBGLBuffer, accessor: any): this;
19
19
  /**
20
20
  * Enabling an attribute location makes it reference the currently bound buffer
21
21
  * Disabling an attribute location makes it reference the global constant value
@@ -1 +1 @@
1
- {"version":3,"file":"webgl-vertex-array-object.d.ts","sourceRoot":"","sources":["../../../src/adapter/objects/webgl-vertex-array-object.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,aAAa,EAAC,MAAM,cAAc,CAAC;AAInD,OAAO,WAAW,MAAM,iBAAiB,CAAC;AAC1C,OAAO,aAAa,MAAM,kBAAkB,CAAC;AAE7C,OAAO,MAAM,MAAM,2BAA2B,C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AAW,CAAC,MAAM,EAAE,sBAAsB,GAAG,IAAI;IAM1D,gBAAgB,CAAC,aAAa,GAAE,WAAW,GAAG,IAAW,EAAE,IAAI,KAAK;IAWpE,gGAAgG;IAChG,SAAS,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,QAAQ,EAAE,GAAG,GAAG,IAAI;IAgCrE;;;;;OAKG;IACH,MAAM,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,UAAO,GAAG,IAAI;CAe9C"}
@@ -1,43 +1,38 @@
1
1
  import { assert } from '@luma.gl/api';
2
2
  import GL from '@luma.gl/constants';
3
3
  import { getBrowser } from '@probe.gl/env';
4
- import WebGLResource from './webgl-resource';
4
+ import { WebGLResource } from "./webgl-resource.js";
5
5
  const ERR_ELEMENTS = 'elements must be GL.ELEMENT_ARRAY_BUFFER';
6
- export default class WEBGLVertexArrayObject extends WebGLResource {
6
+ export class WEBGLVertexArrayObject extends WebGLResource {
7
7
  get [Symbol.toStringTag]() {
8
8
  return 'BaseVertexArrayObject';
9
9
  }
10
-
11
10
  constructor(device, props) {
12
11
  super(device, props, {});
13
12
  }
14
-
15
13
  _createHandle() {
16
14
  return this.gl2.createVertexArray();
17
15
  }
18
-
19
16
  _deleteHandle() {
20
17
  this.gl2.deleteVertexArray(this.handle);
21
18
  return [this.elements];
22
19
  }
23
-
24
20
  _bindHandle(handle) {
25
21
  this.gl2.bindVertexArray(handle);
26
22
  }
27
-
28
- setElementBuffer(elementBuffer = null, opts = {}) {
23
+ setElementBuffer() {
24
+ let elementBuffer = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
25
+ let opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
29
26
  assert(!elementBuffer || elementBuffer.target === GL.ELEMENT_ARRAY_BUFFER, ERR_ELEMENTS);
30
27
  this.bind(() => {
31
28
  this.gl.bindBuffer(GL.ELEMENT_ARRAY_BUFFER, elementBuffer ? elementBuffer.handle : null);
32
29
  });
33
30
  return this;
34
31
  }
35
-
36
32
  setBuffer(location, buffer, accessor) {
37
33
  if (buffer.target === GL.ELEMENT_ARRAY_BUFFER) {
38
34
  return this.setElementBuffer(buffer, accessor);
39
35
  }
40
-
41
36
  const {
42
37
  size,
43
38
  type,
@@ -54,31 +49,26 @@ export default class WEBGLVertexArrayObject extends WebGLResource {
54
49
  location = Number(location);
55
50
  this.bind(() => {
56
51
  gl.bindBuffer(gl.ARRAY_BUFFER, buffer.handle);
57
-
58
52
  if (integer) {
59
53
  this.device.assertWebGL2();
60
54
  gl2.vertexAttribIPointer(location, size, type, stride, offset);
61
55
  } else {
62
56
  gl.vertexAttribPointer(location, size, type, normalized, stride, offset);
63
57
  }
64
-
65
58
  gl.enableVertexAttribArray(location);
66
59
  gl2.vertexAttribDivisor(location, divisor || 0);
67
60
  });
68
61
  return this;
69
62
  }
70
-
71
- enable(location, enable = true) {
63
+ enable(location) {
64
+ let enable = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
72
65
  const canDisableAttributeZero = this.device.isWebGL2 || getBrowser() === 'Chrome';
73
66
  const canDisableAttribute = canDisableAttributeZero || location !== 0;
74
-
75
67
  if (enable || canDisableAttribute) {
76
68
  location = Number(location);
77
69
  this.bind(() => enable ? this.gl.enableVertexAttribArray(location) : this.gl.disableVertexAttribArray(location));
78
70
  }
79
-
80
71
  return this;
81
72
  }
82
-
83
73
  }
84
74
  //# sourceMappingURL=webgl-vertex-array-object.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/adapter/objects/webgl-vertex-array-object.ts"],"names":["assert","GL","getBrowser","WebGLResource","ERR_ELEMENTS","WEBGLVertexArrayObject","Symbol","toStringTag","constructor","device","props","_createHandle","gl2","createVertexArray","_deleteHandle","deleteVertexArray","handle","elements","_bindHandle","bindVertexArray","setElementBuffer","elementBuffer","opts","target","ELEMENT_ARRAY_BUFFER","bind","gl","bindBuffer","setBuffer","location","buffer","accessor","size","type","stride","offset","normalized","integer","divisor","Number","ARRAY_BUFFER","assertWebGL2","vertexAttribIPointer","vertexAttribPointer","enableVertexAttribArray","vertexAttribDivisor","enable","canDisableAttributeZero","isWebGL2","canDisableAttribute","disableVertexAttribArray"],"mappings":"AAAA,SAAQA,MAAR,QAAoC,cAApC;AACA,OAAOC,EAAP,MAAe,oBAAf;AACA,SAAQC,UAAR,QAAyB,eAAzB;AAGA,OAAOC,aAAP,MAA0B,kBAA1B;AAIA,MAAMC,YAAY,GAAG,0CAArB;AASA,eAAe,MAAMC,sBAAN,SAAqCF,aAArC,CAA2E;AACjE,OAAlBG,MAAM,CAACC,WAAW,IAAY;AACjC,WAAO,uBAAP;AACD;;AAEDC,EAAAA,WAAW,CAACC,MAAD,EAAsBC,KAAtB,EAAsD;AAE/D,UAAMD,MAAN,EAAcC,KAAd,EAAqB,EAArB;AACD;;AAEDC,EAAAA,aAAa,GAAG;AACd,WAAO,KAAKC,GAAL,CAASC,iBAAT,EAAP;AACD;;AAEDC,EAAAA,aAAa,GAAS;AACpB,SAAKF,GAAL,CAASG,iBAAT,CAA2B,KAAKC,MAAhC;AAEA,WAAO,CAAC,KAAKC,QAAN,CAAP;AAED;;AAEDC,EAAAA,WAAW,CAACF,MAAD,EAAuC;AAChD,SAAKJ,GAAL,CAASO,eAAT,CAAyBH,MAAzB;AACD;;AAIDI,EAAAA,gBAAgB,CAACC,aAAqB,GAAG,IAAzB,EAA+BC,IAAI,GAAG,EAAtC,EAA0C;AACxDtB,IAAAA,MAAM,CAAC,CAACqB,aAAD,IAAkBA,aAAa,CAACE,MAAd,KAAyBtB,EAAE,CAACuB,oBAA/C,EAAqEpB,YAArE,CAAN;AAGA,SAAKqB,IAAL,CAAU,MAAM;AACd,WAAKC,EAAL,CAAQC,UAAR,CAAmB1B,EAAE,CAACuB,oBAAtB,EAA4CH,aAAa,GAAGA,aAAa,CAACL,MAAjB,GAA0B,IAAnF;AACD,KAFD;AAIA,WAAO,IAAP;AACD;;AAGDY,EAAAA,SAAS,CAACC,QAAD,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C,UAAU,OAAO,QAAzE;AACA,UAAM+C,mBAAmB,GAAGF,uBAAuB,IAAIlB,QAAQ,KAAK,CAApE;;AAEA,QAAIiB,MAAM,IAAIG,mBAAd,EAAmC;AACjCpB,MAAAA,QAAQ,GAAGU,MAAM,CAACV,QAAD,CAAjB;AACA,WAAKJ,IAAL,CAAU,MACRqB,MAAM,GACF,KAAKpB,EAAL,CAAQkB,uBAAR,CAAgCf,QAAhC,CADE,GAEF,KAAKH,EAAL,CAAQwB,wBAAR,CAAiCrB,QAAjC,CAHN;AAKD;;AACD,WAAO,IAAP;AACD;;AA3FuF","sourcesContent":["import {assert, ResourceProps} from '@luma.gl/api';\nimport GL from '@luma.gl/constants';\nimport {getBrowser} from '@probe.gl/env';\n\nimport WebGLDevice from '../webgl-device';\nimport WebGLResource from './webgl-resource';\n\nimport Buffer from '../resources/webgl-buffer';\n\nconst ERR_ELEMENTS = 'elements must be GL.ELEMENT_ARRAY_BUFFER';\n\n/**\n * VertexArrayObject properties\n */\nexport type VertexArrayObjectProps = ResourceProps & {\n};\n\n/** VertexArrayObject wrapper */\nexport default class WEBGLVertexArrayObject extends WebGLResource<VertexArrayObjectProps> {\n get [Symbol.toStringTag](): string {\n return 'BaseVertexArrayObject';\n }\n\n constructor(device: WebGLDevice, props?: VertexArrayObjectProps) {\n // @ts-expect-error\n super(device, props, {});\n }\n\n _createHandle() {\n return this.gl2.createVertexArray();\n }\n\n _deleteHandle(): void {\n this.gl2.deleteVertexArray(this.handle);\n // @ts-expect-error\n return [this.elements];\n // return [this.elements, ...this.buffers];\n }\n\n _bindHandle(handle: WEBGLVertexArrayObject): void {\n this.gl2.bindVertexArray(handle);\n }\n\n // Set (bind) an elements buffer, for indexed rendering.\n // Must be a Buffer bound to GL.ELEMENT_ARRAY_BUFFER. Constants not supported\n setElementBuffer(elementBuffer: Buffer = null, opts = {}) {\n assert(!elementBuffer || elementBuffer.target === GL.ELEMENT_ARRAY_BUFFER, ERR_ELEMENTS);\n\n // The GL.ELEMENT_ARRAY_BUFFER_BINDING is stored on the VertexArrayObject...\n this.bind(() => {\n this.gl.bindBuffer(GL.ELEMENT_ARRAY_BUFFER, elementBuffer ? elementBuffer.handle : null);\n });\n\n return this;\n }\n\n /** Set a location in vertex attributes array to a buffer, enables the location, sets divisor */\n setBuffer(location: number, buffer: Buffer, accessor: any): this {\n // Check target\n if (buffer.target === GL.ELEMENT_ARRAY_BUFFER) {\n return this.setElementBuffer(buffer, accessor);\n }\n\n const {size, type, stride, offset, normalized, integer, divisor} = accessor;\n\n const {gl, gl2} = this;\n location = Number(location);\n\n this.bind(() => {\n // A non-zero buffer object must be bound to the GL_ARRAY_BUFFER target\n 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 gl2.vertexAttribIPointer(location, size, type, stride, offset);\n } else {\n // Attaches ARRAY_BUFFER with specified buffer format to location\n gl.vertexAttribPointer(location, size, type, normalized, stride, offset);\n }\n gl.enableVertexAttribArray(location);\n gl2.vertexAttribDivisor(location, divisor || 0);\n\n // NOTE We don't unbind buffer here, typically another buffer will be bound just after\n });\n\n return this;\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 enable(location: number, enable = true): this {\n // Attribute 0 cannot be disabled in most desktop OpenGL based browsers...\n const canDisableAttributeZero = this.device.isWebGL2 || getBrowser() === 'Chrome';\n const canDisableAttribute = canDisableAttributeZero || location !== 0;\n\n if (enable || canDisableAttribute) {\n location = Number(location);\n this.bind(() =>\n enable\n ? this.gl.enableVertexAttribArray(location)\n : this.gl.disableVertexAttribArray(location)\n );\n }\n return this;\n }\n}\n"],"file":"webgl-vertex-array-object.js"}
1
+ {"version":3,"file":"webgl-vertex-array-object.js","names":["assert","GL","getBrowser","WebGLResource","ERR_ELEMENTS","WEBGLVertexArrayObject","Symbol","toStringTag","constructor","device","props","_createHandle","gl2","createVertexArray","_deleteHandle","deleteVertexArray","handle","elements","_bindHandle","bindVertexArray","setElementBuffer","elementBuffer","arguments","length","undefined","opts","target","ELEMENT_ARRAY_BUFFER","bind","gl","bindBuffer","setBuffer","location","buffer","accessor","size","type","stride","offset","normalized","integer","divisor","Number","ARRAY_BUFFER","assertWebGL2","vertexAttribIPointer","vertexAttribPointer","enableVertexAttribArray","vertexAttribDivisor","enable","canDisableAttributeZero","isWebGL2","canDisableAttribute","disableVertexAttribArray"],"sources":["../../../src/adapter/objects/webgl-vertex-array-object.ts"],"sourcesContent":["import {assert, ResourceProps} from '@luma.gl/api';\nimport GL from '@luma.gl/constants';\nimport {getBrowser} from '@probe.gl/env';\n\nimport {WebGLDevice} from '../webgl-device';\nimport {WebGLResource} from './webgl-resource';\n\nimport {WEBGLBuffer} from '../resources/webgl-buffer';\n\nconst ERR_ELEMENTS = 'elements must be GL.ELEMENT_ARRAY_BUFFER';\n\n/**\n * VertexArrayObject properties\n */\nexport type VertexArrayObjectProps = ResourceProps & {\n};\n\n/** VertexArrayObject wrapper */\nexport class WEBGLVertexArrayObject extends WebGLResource<VertexArrayObjectProps> {\n override get [Symbol.toStringTag](): string {\n return 'BaseVertexArrayObject';\n }\n\n constructor(device: WebGLDevice, props?: VertexArrayObjectProps) {\n // @ts-expect-error\n super(device, props, {});\n }\n\n override _createHandle() {\n return this.gl2.createVertexArray();\n }\n\n override _deleteHandle(): void {\n this.gl2.deleteVertexArray(this.handle);\n // @ts-expect-error\n return [this.elements];\n // return [this.elements, ...this.buffers];\n }\n\n override _bindHandle(handle: WEBGLVertexArrayObject): void {\n this.gl2.bindVertexArray(handle);\n }\n\n // Set (bind) an elements buffer, for indexed rendering.\n // Must be a Buffer bound to GL.ELEMENT_ARRAY_BUFFER. Constants not supported\n setElementBuffer(elementBuffer: WEBGLBuffer | null = null, opts = {}) {\n assert(!elementBuffer || elementBuffer.target === GL.ELEMENT_ARRAY_BUFFER, ERR_ELEMENTS);\n\n // The GL.ELEMENT_ARRAY_BUFFER_BINDING is stored on the VertexArrayObject...\n this.bind(() => {\n this.gl.bindBuffer(GL.ELEMENT_ARRAY_BUFFER, elementBuffer ? elementBuffer.handle : null);\n });\n\n return this;\n }\n\n /** Set a location in vertex attributes array to a buffer, enables the location, sets divisor */\n setBuffer(location: number, buffer: WEBGLBuffer, accessor: any): this {\n // Check target\n if (buffer.target === GL.ELEMENT_ARRAY_BUFFER) {\n return this.setElementBuffer(buffer, accessor);\n }\n\n const {size, type, stride, offset, normalized, integer, divisor} = accessor;\n\n const {gl, gl2} = this;\n location = Number(location);\n\n this.bind(() => {\n // A non-zero buffer object must be bound to the GL_ARRAY_BUFFER target\n 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 gl2.vertexAttribIPointer(location, size, type, stride, offset);\n } else {\n // Attaches ARRAY_BUFFER with specified buffer format to location\n gl.vertexAttribPointer(location, size, type, normalized, stride, offset);\n }\n gl.enableVertexAttribArray(location);\n gl2.vertexAttribDivisor(location, divisor || 0);\n\n // NOTE We don't unbind buffer here, typically another buffer will be bound just after\n });\n\n return this;\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 enable(location: number, enable = true): this {\n // Attribute 0 cannot be disabled in most desktop OpenGL based browsers...\n const canDisableAttributeZero = this.device.isWebGL2 || getBrowser() === 'Chrome';\n const canDisableAttribute = canDisableAttributeZero || location !== 0;\n\n if (enable || canDisableAttribute) {\n location = Number(location);\n this.bind(() =>\n enable\n ? this.gl.enableVertexAttribArray(location)\n : this.gl.disableVertexAttribArray(location)\n );\n }\n return this;\n }\n}\n"],"mappings":"AAAA,SAAQA,MAAM,QAAsB,cAAc;AAClD,OAAOC,EAAE,MA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