@luma.gl/webgl 9.0.0-alpha.3 → 9.0.0-alpha.31

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 (512) hide show
  1. package/LICENSE +2 -1
  2. package/dist/adapter/converters/device-parameters.d.ts +14 -4
  3. package/dist/adapter/converters/device-parameters.d.ts.map +1 -1
  4. package/dist/adapter/converters/device-parameters.js +28 -46
  5. package/dist/adapter/converters/device-parameters.js.map +1 -1
  6. package/dist/adapter/converters/sampler-parameters.d.ts +5 -5
  7. package/dist/adapter/converters/sampler-parameters.d.ts.map +1 -1
  8. package/dist/adapter/converters/sampler-parameters.js +20 -56
  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 +53 -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 +165 -201
  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 +48 -16
  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 +13 -20
  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 +2 -5
  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 +9 -11
  33. package/dist/adapter/device-helpers/get-device-info.js.map +1 -1
  34. package/dist/adapter/device-helpers/is-old-ie.js +2 -1
  35. package/dist/adapter/device-helpers/is-old-ie.js.map +1 -1
  36. package/dist/adapter/helpers/decode-webgl-types.d.ts +26 -0
  37. package/dist/adapter/helpers/decode-webgl-types.d.ts.map +1 -0
  38. package/dist/adapter/helpers/{uniforms.js → decode-webgl-types.js} +20 -29
  39. package/dist/adapter/helpers/decode-webgl-types.js.map +1 -0
  40. package/dist/adapter/helpers/get-shader-info.d.ts +9 -0
  41. package/dist/adapter/helpers/get-shader-info.d.ts.map +1 -0
  42. package/dist/adapter/helpers/get-shader-info.js +25 -0
  43. package/dist/adapter/helpers/get-shader-info.js.map +1 -0
  44. package/dist/adapter/helpers/get-shader-layout.d.ts +1 -48
  45. package/dist/adapter/helpers/get-shader-layout.d.ts.map +1 -1
  46. package/dist/adapter/helpers/get-shader-layout.js +58 -113
  47. package/dist/adapter/helpers/get-shader-layout.js.map +1 -1
  48. package/dist/adapter/helpers/parse-shader-compiler-log.d.ts +1 -1
  49. package/dist/adapter/helpers/parse-shader-compiler-log.d.ts.map +1 -1
  50. package/dist/adapter/helpers/parse-shader-compiler-log.js +0 -7
  51. package/dist/adapter/helpers/parse-shader-compiler-log.js.map +1 -1
  52. package/dist/adapter/helpers/set-uniform.d.ts +2 -2
  53. package/dist/adapter/helpers/set-uniform.d.ts.map +1 -1
  54. package/dist/adapter/helpers/set-uniform.js +3 -33
  55. package/dist/adapter/helpers/set-uniform.js.map +1 -1
  56. package/dist/adapter/helpers/webgl-topology-utils.d.ts +11 -0
  57. package/dist/adapter/helpers/webgl-topology-utils.d.ts.map +1 -0
  58. package/dist/adapter/helpers/{attribute-utils.js → webgl-topology-utils.js} +2 -19
  59. package/dist/adapter/helpers/webgl-topology-utils.js.map +1 -0
  60. package/dist/adapter/objects/constants-to-keys.d.ts +1 -3
  61. package/dist/adapter/objects/constants-to-keys.d.ts.map +1 -1
  62. package/dist/adapter/objects/constants-to-keys.js +1 -28
  63. package/dist/adapter/objects/constants-to-keys.js.map +1 -1
  64. package/dist/adapter/objects/webgl-renderbuffer.d.ts +15 -12
  65. package/dist/adapter/objects/webgl-renderbuffer.d.ts.map +1 -1
  66. package/dist/adapter/objects/webgl-renderbuffer.js +35 -41
  67. package/dist/adapter/objects/webgl-renderbuffer.js.map +1 -1
  68. package/dist/adapter/objects/webgl-resource.d.ts +6 -9
  69. package/dist/adapter/objects/webgl-resource.d.ts.map +1 -1
  70. package/dist/adapter/objects/webgl-resource.js +19 -75
  71. package/dist/adapter/objects/webgl-resource.js.map +1 -1
  72. package/dist/adapter/objects/webgl-vertex-array-object.d.ts +39 -11
  73. package/dist/adapter/objects/webgl-vertex-array-object.d.ts.map +1 -1
  74. package/dist/adapter/objects/webgl-vertex-array-object.js +122 -32
  75. package/dist/adapter/objects/webgl-vertex-array-object.js.map +1 -1
  76. package/dist/adapter/resources/webgl-buffer.d.ts +18 -10
  77. package/dist/adapter/resources/webgl-buffer.d.ts.map +1 -1
  78. package/dist/adapter/resources/webgl-buffer.js +43 -71
  79. package/dist/adapter/resources/webgl-buffer.js.map +1 -1
  80. package/dist/adapter/resources/webgl-command-buffer.d.ts +15 -9
  81. package/dist/adapter/resources/webgl-command-buffer.d.ts.map +1 -1
  82. package/dist/adapter/resources/webgl-command-buffer.js +169 -41
  83. package/dist/adapter/resources/webgl-command-buffer.js.map +1 -1
  84. package/dist/adapter/resources/webgl-command-encoder.d.ts +7 -6
  85. package/dist/adapter/resources/webgl-command-encoder.d.ts.map +1 -1
  86. package/dist/adapter/resources/webgl-command-encoder.js +9 -18
  87. package/dist/adapter/resources/webgl-command-encoder.js.map +1 -1
  88. package/dist/adapter/resources/webgl-external-texture.js.map +1 -1
  89. package/dist/adapter/resources/webgl-framebuffer.d.ts +21 -24
  90. package/dist/adapter/resources/webgl-framebuffer.d.ts.map +1 -1
  91. package/dist/adapter/resources/webgl-framebuffer.js +41 -149
  92. package/dist/adapter/resources/webgl-framebuffer.js.map +1 -1
  93. package/dist/adapter/resources/webgl-render-pass.d.ts +19 -4
  94. package/dist/adapter/resources/webgl-render-pass.d.ts.map +1 -1
  95. package/dist/adapter/resources/webgl-render-pass.js +88 -9
  96. package/dist/adapter/resources/webgl-render-pass.js.map +1 -1
  97. package/dist/adapter/resources/webgl-render-pipeline.d.ts +52 -14
  98. package/dist/adapter/resources/webgl-render-pipeline.d.ts.map +1 -1
  99. package/dist/adapter/resources/webgl-render-pipeline.js +119 -182
  100. package/dist/adapter/resources/webgl-render-pipeline.js.map +1 -1
  101. package/dist/adapter/resources/webgl-sampler.d.ts +6 -5
  102. package/dist/adapter/resources/webgl-sampler.d.ts.map +1 -1
  103. package/dist/adapter/resources/webgl-sampler.js +7 -15
  104. package/dist/adapter/resources/webgl-sampler.js.map +1 -1
  105. package/dist/adapter/resources/webgl-shader.d.ts +3 -4
  106. package/dist/adapter/resources/webgl-shader.d.ts.map +1 -1
  107. package/dist/adapter/resources/webgl-shader.js +9 -22
  108. package/dist/adapter/resources/webgl-shader.js.map +1 -1
  109. package/dist/adapter/resources/webgl-texture.d.ts +64 -44
  110. package/dist/adapter/resources/webgl-texture.d.ts.map +1 -1
  111. package/dist/adapter/resources/webgl-texture.js +98 -213
  112. package/dist/adapter/resources/webgl-texture.js.map +1 -1
  113. package/dist/adapter/webgl-canvas-context.d.ts +6 -7
  114. package/dist/adapter/webgl-canvas-context.d.ts.map +1 -1
  115. package/dist/adapter/webgl-canvas-context.js +8 -20
  116. package/dist/adapter/webgl-canvas-context.js.map +1 -1
  117. package/dist/adapter/webgl-device.d.ts +64 -41
  118. package/dist/adapter/webgl-device.d.ts.map +1 -1
  119. package/dist/adapter/webgl-device.js +133 -113
  120. package/dist/adapter/webgl-device.js.map +1 -1
  121. package/dist/classic/accessor.d.ts +3 -3
  122. package/dist/classic/accessor.d.ts.map +1 -1
  123. package/dist/classic/accessor.js +14 -38
  124. package/dist/classic/accessor.js.map +1 -1
  125. package/dist/classic/{buffer.d.ts → buffer-with-accessor.d.ts} +16 -28
  126. package/dist/classic/buffer-with-accessor.d.ts.map +1 -0
  127. package/dist/classic/{buffer.js → buffer-with-accessor.js} +54 -122
  128. package/dist/classic/buffer-with-accessor.js.map +1 -0
  129. package/dist/classic/clear.d.ts +22 -0
  130. package/dist/classic/clear.d.ts.map +1 -0
  131. package/dist/classic/clear.js +88 -0
  132. package/dist/classic/clear.js.map +1 -0
  133. package/dist/classic/copy-and-blit.d.ts +62 -0
  134. package/dist/classic/copy-and-blit.d.ts.map +1 -0
  135. package/dist/classic/copy-and-blit.js +202 -0
  136. package/dist/classic/copy-and-blit.js.map +1 -0
  137. package/dist/classic/format-utils.d.ts +3 -0
  138. package/dist/classic/format-utils.d.ts.map +1 -0
  139. package/dist/classic/format-utils.js +38 -0
  140. package/dist/classic/format-utils.js.map +1 -0
  141. package/dist/classic/typed-array-utils.d.ts +15 -17
  142. package/dist/classic/typed-array-utils.d.ts.map +1 -1
  143. package/dist/classic/typed-array-utils.js +1 -21
  144. package/dist/classic/typed-array-utils.js.map +1 -1
  145. package/dist/context/context/create-browser-context.d.ts +40 -0
  146. package/dist/context/context/create-browser-context.d.ts.map +1 -0
  147. package/dist/{esm/context/context/create-context.js → context/context/create-browser-context.js} +23 -19
  148. package/dist/context/context/create-browser-context.js.map +1 -0
  149. package/dist/context/context/create-headless-context.d.ts +9 -0
  150. package/dist/context/context/create-headless-context.d.ts.map +1 -0
  151. package/dist/context/context/create-headless-context.js +42 -0
  152. package/dist/context/context/create-headless-context.js.map +1 -0
  153. package/dist/context/context/webgl-checks.js +1 -4
  154. package/dist/context/context/webgl-checks.js.map +1 -1
  155. package/dist/context/debug/spector.d.ts +1 -2
  156. package/dist/context/debug/spector.d.ts.map +1 -1
  157. package/dist/context/debug/spector.js +8 -20
  158. package/dist/context/debug/spector.js.map +1 -1
  159. package/dist/context/debug/webgl-developer-tools.d.ts +2 -2
  160. package/dist/context/debug/webgl-developer-tools.d.ts.map +1 -1
  161. package/dist/context/debug/webgl-developer-tools.js +11 -34
  162. package/dist/context/debug/webgl-developer-tools.js.map +1 -1
  163. package/dist/context/parameters/unified-parameter-api.d.ts +8 -7
  164. package/dist/context/parameters/unified-parameter-api.d.ts.map +1 -1
  165. package/dist/context/parameters/unified-parameter-api.js +8 -18
  166. package/dist/context/parameters/unified-parameter-api.js.map +1 -1
  167. package/dist/context/parameters/webgl-parameter-tables.d.ts +105 -106
  168. package/dist/context/parameters/webgl-parameter-tables.d.ts.map +1 -1
  169. package/dist/context/parameters/webgl-parameter-tables.js +18 -36
  170. package/dist/context/parameters/webgl-parameter-tables.js.map +1 -1
  171. package/dist/context/polyfill/context-data.d.ts +13 -0
  172. package/dist/context/polyfill/context-data.d.ts.map +1 -0
  173. package/dist/context/polyfill/context-data.js +12 -0
  174. package/dist/context/polyfill/context-data.js.map +1 -0
  175. package/dist/context/polyfill/get-parameter-polyfill.d.ts +1 -1
  176. package/dist/context/polyfill/get-parameter-polyfill.d.ts.map +1 -1
  177. package/dist/context/polyfill/get-parameter-polyfill.js +4 -9
  178. package/dist/context/polyfill/get-parameter-polyfill.js.map +1 -1
  179. package/dist/context/polyfill/polyfill-context.js +21 -29
  180. package/dist/context/polyfill/polyfill-context.js.map +1 -1
  181. package/dist/context/polyfill/polyfill-table.d.ts +8 -8
  182. package/dist/context/polyfill/polyfill-table.d.ts.map +1 -1
  183. package/dist/context/polyfill/polyfill-table.js +10 -32
  184. package/dist/context/polyfill/polyfill-table.js.map +1 -1
  185. package/dist/context/polyfill/polyfill-vertex-array-object.d.ts.map +1 -1
  186. package/dist/context/polyfill/polyfill-vertex-array-object.js +0 -70
  187. package/dist/context/polyfill/polyfill-vertex-array-object.js.map +1 -1
  188. package/dist/context/state-tracker/deep-array-equal.js +0 -4
  189. package/dist/context/state-tracker/deep-array-equal.js.map +1 -1
  190. package/dist/context/state-tracker/track-context-state.d.ts.map +1 -1
  191. package/dist/context/state-tracker/track-context-state.js +16 -51
  192. package/dist/context/state-tracker/track-context-state.js.map +1 -1
  193. package/dist/context/state-tracker/with-parameters.d.ts +2 -1
  194. package/dist/context/state-tracker/with-parameters.d.ts.map +1 -1
  195. package/dist/context/state-tracker/with-parameters.js +7 -9
  196. package/dist/context/state-tracker/with-parameters.js.map +1 -1
  197. package/dist/dist.dev.js +10245 -0
  198. package/dist/index.cjs +6550 -0
  199. package/dist/index.d.ts +25 -22
  200. package/dist/index.d.ts.map +1 -1
  201. package/dist/index.js +27 -26
  202. package/dist/index.js.map +1 -1
  203. package/dist/types.d.ts +3 -1
  204. package/dist/types.d.ts.map +1 -1
  205. package/dist/types.js.map +1 -1
  206. package/dist.min.js +37 -0
  207. package/package.json +21 -9
  208. package/src/adapter/converters/device-parameters.ts +88 -35
  209. package/src/adapter/converters/sampler-parameters.ts +19 -9
  210. package/src/adapter/converters/shader-formats.ts +41 -0
  211. package/src/adapter/converters/texture-formats.ts +264 -194
  212. package/src/adapter/converters/vertex-formats.ts +68 -10
  213. package/src/adapter/device-helpers/device-features.ts +10 -3
  214. package/src/adapter/device-helpers/device-limits.ts +3 -3
  215. package/src/adapter/device-helpers/get-device-info.ts +14 -10
  216. package/src/adapter/helpers/{uniforms.ts → decode-webgl-types.ts} +36 -21
  217. package/src/adapter/helpers/get-shader-info.ts +40 -0
  218. package/src/adapter/helpers/get-shader-layout.ts +120 -146
  219. package/src/adapter/helpers/parse-shader-compiler-log.ts +2 -2
  220. package/src/adapter/helpers/set-uniform.ts +7 -6
  221. package/src/adapter/helpers/{attribute-utils.ts → webgl-topology-utils.ts} +4 -5
  222. package/src/adapter/objects/constants-to-keys.ts +3 -25
  223. package/src/adapter/objects/webgl-renderbuffer.ts +40 -37
  224. package/src/adapter/objects/webgl-resource.ts +14 -23
  225. package/src/adapter/objects/webgl-vertex-array-object.ts +202 -37
  226. package/src/adapter/resources/webgl-buffer.ts +56 -58
  227. package/src/adapter/resources/webgl-command-buffer.ts +332 -25
  228. package/src/adapter/resources/webgl-command-encoder.ts +17 -12
  229. package/src/adapter/resources/webgl-external-texture.ts +2 -2
  230. package/src/adapter/resources/webgl-framebuffer.ts +88 -133
  231. package/src/adapter/resources/webgl-render-pass.ts +155 -4
  232. package/src/adapter/resources/webgl-render-pipeline.ts +232 -131
  233. package/src/adapter/resources/webgl-sampler.ts +13 -8
  234. package/src/adapter/resources/webgl-shader.ts +11 -10
  235. package/src/adapter/resources/webgl-texture.ts +113 -85
  236. package/src/adapter/webgl-canvas-context.ts +14 -14
  237. package/src/adapter/webgl-device.ts +192 -77
  238. package/src/classic/accessor.ts +4 -17
  239. package/src/classic/{buffer.ts → buffer-with-accessor.ts} +67 -75
  240. package/src/classic/clear.ts +110 -0
  241. package/src/classic/copy-and-blit.ts +308 -0
  242. package/src/classic/format-utils.ts +43 -0
  243. package/src/classic/typed-array-utils.ts +18 -27
  244. package/src/context/context/{create-context.ts → create-browser-context.ts} +48 -31
  245. package/src/context/context/create-headless-context.ts +48 -0
  246. package/src/context/context/webgl-checks.ts +1 -1
  247. package/src/context/debug/spector.ts +7 -6
  248. package/src/context/debug/webgl-developer-tools.ts +21 -15
  249. package/src/context/parameters/unified-parameter-api.ts +20 -14
  250. package/src/context/parameters/webgl-parameter-tables.ts +117 -98
  251. package/src/context/polyfill/context-data.ts +27 -0
  252. package/src/context/polyfill/get-parameter-polyfill.ts +8 -7
  253. package/src/context/polyfill/polyfill-context.ts +7 -9
  254. package/src/context/polyfill/polyfill-table.ts +18 -16
  255. package/src/context/polyfill/polyfill-vertex-array-object.ts +2 -0
  256. package/src/context/state-tracker/track-context-state.ts +14 -13
  257. package/src/context/state-tracker/with-parameters.ts +8 -2
  258. package/src/index.ts +42 -33
  259. package/src/types.ts +2 -0
  260. package/dist/adapter/converters/renderbuffer-formats.d.ts +0 -16
  261. package/dist/adapter/converters/renderbuffer-formats.d.ts.map +0 -1
  262. package/dist/adapter/converters/renderbuffer-formats.js +0 -185
  263. package/dist/adapter/converters/renderbuffer-formats.js.map +0 -1
  264. package/dist/adapter/helpers/attribute-utils.d.ts +0 -11
  265. package/dist/adapter/helpers/attribute-utils.d.ts.map +0 -1
  266. package/dist/adapter/helpers/attribute-utils.js.map +0 -1
  267. package/dist/adapter/helpers/uniforms.d.ts +0 -26
  268. package/dist/adapter/helpers/uniforms.d.ts.map +0 -1
  269. package/dist/adapter/helpers/uniforms.js.map +0 -1
  270. package/dist/bundle.d.ts +0 -2
  271. package/dist/bundle.d.ts.map +0 -1
  272. package/dist/bundle.js +0 -5
  273. package/dist/bundle.js.map +0 -1
  274. package/dist/classic/buffer.d.ts.map +0 -1
  275. package/dist/classic/buffer.js.map +0 -1
  276. package/dist/context/context/context-state.d.ts +0 -18
  277. package/dist/context/context/context-state.d.ts.map +0 -1
  278. package/dist/context/context/context-state.js +0 -26
  279. package/dist/context/context/context-state.js.map +0 -1
  280. package/dist/context/context/create-context.d.ts +0 -41
  281. package/dist/context/context/create-context.d.ts.map +0 -1
  282. package/dist/context/context/create-context.js +0 -49
  283. package/dist/context/context/create-context.js.map +0 -1
  284. package/dist/context/context/device-pixels.d.ts +0 -25
  285. package/dist/context/context/device-pixels.d.ts.map +0 -1
  286. package/dist/context/context/device-pixels.js +0 -98
  287. package/dist/context/context/device-pixels.js.map +0 -1
  288. package/dist/es5/adapter/converters/device-parameters.js +0 -170
  289. package/dist/es5/adapter/converters/device-parameters.js.map +0 -1
  290. package/dist/es5/adapter/converters/renderbuffer-formats.js +0 -163
  291. package/dist/es5/adapter/converters/renderbuffer-formats.js.map +0 -1
  292. package/dist/es5/adapter/converters/sampler-parameters.js +0 -226
  293. package/dist/es5/adapter/converters/sampler-parameters.js.map +0 -1
  294. package/dist/es5/adapter/converters/texture-formats.js +0 -1031
  295. package/dist/es5/adapter/converters/texture-formats.js.map +0 -1
  296. package/dist/es5/adapter/converters/vertex-formats.js +0 -45
  297. package/dist/es5/adapter/converters/vertex-formats.js.map +0 -1
  298. package/dist/es5/adapter/device-helpers/device-features.js +0 -144
  299. package/dist/es5/adapter/device-helpers/device-features.js.map +0 -1
  300. package/dist/es5/adapter/device-helpers/device-limits.js +0 -64
  301. package/dist/es5/adapter/device-helpers/device-limits.js.map +0 -1
  302. package/dist/es5/adapter/device-helpers/get-device-info.js +0 -55
  303. package/dist/es5/adapter/device-helpers/get-device-info.js.map +0 -1
  304. package/dist/es5/adapter/device-helpers/is-old-ie.js +0 -16
  305. package/dist/es5/adapter/device-helpers/is-old-ie.js.map +0 -1
  306. package/dist/es5/adapter/helpers/attribute-utils.js +0 -91
  307. package/dist/es5/adapter/helpers/attribute-utils.js.map +0 -1
  308. package/dist/es5/adapter/helpers/get-shader-layout.js +0 -371
  309. package/dist/es5/adapter/helpers/get-shader-layout.js.map +0 -1
  310. package/dist/es5/adapter/helpers/parse-shader-compiler-log.js +0 -72
  311. package/dist/es5/adapter/helpers/parse-shader-compiler-log.js.map +0 -1
  312. package/dist/es5/adapter/helpers/set-uniform.js +0 -125
  313. package/dist/es5/adapter/helpers/set-uniform.js.map +0 -1
  314. package/dist/es5/adapter/helpers/uniforms.js +0 -112
  315. package/dist/es5/adapter/helpers/uniforms.js.map +0 -1
  316. package/dist/es5/adapter/objects/constants-to-keys.js +0 -54
  317. package/dist/es5/adapter/objects/constants-to-keys.js.map +0 -1
  318. package/dist/es5/adapter/objects/webgl-renderbuffer.js +0 -150
  319. package/dist/es5/adapter/objects/webgl-renderbuffer.js.map +0 -1
  320. package/dist/es5/adapter/objects/webgl-resource.js +0 -292
  321. package/dist/es5/adapter/objects/webgl-resource.js.map +0 -1
  322. package/dist/es5/adapter/objects/webgl-vertex-array-object.js +0 -137
  323. package/dist/es5/adapter/objects/webgl-vertex-array-object.js.map +0 -1
  324. package/dist/es5/adapter/resources/webgl-buffer.js +0 -243
  325. package/dist/es5/adapter/resources/webgl-buffer.js.map +0 -1
  326. package/dist/es5/adapter/resources/webgl-command-buffer.js +0 -96
  327. package/dist/es5/adapter/resources/webgl-command-buffer.js.map +0 -1
  328. package/dist/es5/adapter/resources/webgl-command-encoder.js +0 -98
  329. package/dist/es5/adapter/resources/webgl-command-encoder.js.map +0 -1
  330. package/dist/es5/adapter/resources/webgl-external-texture.js +0 -2
  331. package/dist/es5/adapter/resources/webgl-external-texture.js.map +0 -1
  332. package/dist/es5/adapter/resources/webgl-framebuffer.js +0 -345
  333. package/dist/es5/adapter/resources/webgl-framebuffer.js.map +0 -1
  334. package/dist/es5/adapter/resources/webgl-render-pass.js +0 -61
  335. package/dist/es5/adapter/resources/webgl-render-pass.js.map +0 -1
  336. package/dist/es5/adapter/resources/webgl-render-pipeline.js +0 -505
  337. package/dist/es5/adapter/resources/webgl-render-pipeline.js.map +0 -1
  338. package/dist/es5/adapter/resources/webgl-sampler.js +0 -96
  339. package/dist/es5/adapter/resources/webgl-sampler.js.map +0 -1
  340. package/dist/es5/adapter/resources/webgl-shader.js +0 -149
  341. package/dist/es5/adapter/resources/webgl-shader.js.map +0 -1
  342. package/dist/es5/adapter/resources/webgl-texture.js +0 -986
  343. package/dist/es5/adapter/resources/webgl-texture.js.map +0 -1
  344. package/dist/es5/adapter/webgl-canvas-context.js +0 -97
  345. package/dist/es5/adapter/webgl-canvas-context.js.map +0 -1
  346. package/dist/es5/adapter/webgl-device.js +0 -399
  347. package/dist/es5/adapter/webgl-device.js.map +0 -1
  348. package/dist/es5/bundle.js +0 -7
  349. package/dist/es5/bundle.js.map +0 -1
  350. package/dist/es5/classic/accessor.js +0 -181
  351. package/dist/es5/classic/accessor.js.map +0 -1
  352. package/dist/es5/classic/buffer.js +0 -470
  353. package/dist/es5/classic/buffer.js.map +0 -1
  354. package/dist/es5/classic/typed-array-utils.js +0 -126
  355. package/dist/es5/classic/typed-array-utils.js.map +0 -1
  356. package/dist/es5/context/context/context-state.js +0 -31
  357. package/dist/es5/context/context/context-state.js.map +0 -1
  358. package/dist/es5/context/context/create-context.js +0 -69
  359. package/dist/es5/context/context/create-context.js.map +0 -1
  360. package/dist/es5/context/context/device-pixels.js +0 -115
  361. package/dist/es5/context/context/device-pixels.js.map +0 -1
  362. package/dist/es5/context/context/webgl-checks.js +0 -54
  363. package/dist/es5/context/context/webgl-checks.js.map +0 -1
  364. package/dist/es5/context/debug/spector.js +0 -133
  365. package/dist/es5/context/debug/spector.js.map +0 -1
  366. package/dist/es5/context/debug/webgl-developer-tools.js +0 -198
  367. package/dist/es5/context/debug/webgl-developer-tools.js.map +0 -1
  368. package/dist/es5/context/parameters/unified-parameter-api.js +0 -97
  369. package/dist/es5/context/parameters/unified-parameter-api.js.map +0 -1
  370. package/dist/es5/context/parameters/webgl-parameter-tables.js +0 -392
  371. package/dist/es5/context/parameters/webgl-parameter-tables.js.map +0 -1
  372. package/dist/es5/context/polyfill/get-parameter-polyfill.js +0 -81
  373. package/dist/es5/context/polyfill/get-parameter-polyfill.js.map +0 -1
  374. package/dist/es5/context/polyfill/polyfill-context.js +0 -135
  375. package/dist/es5/context/polyfill/polyfill-context.js.map +0 -1
  376. package/dist/es5/context/polyfill/polyfill-table.js +0 -166
  377. package/dist/es5/context/polyfill/polyfill-table.js.map +0 -1
  378. package/dist/es5/context/polyfill/polyfill-vertex-array-object.js +0 -341
  379. package/dist/es5/context/polyfill/polyfill-vertex-array-object.js.map +0 -1
  380. package/dist/es5/context/state-tracker/deep-array-equal.js +0 -28
  381. package/dist/es5/context/state-tracker/deep-array-equal.js.map +0 -1
  382. package/dist/es5/context/state-tracker/track-context-state.js +0 -211
  383. package/dist/es5/context/state-tracker/track-context-state.js.map +0 -1
  384. package/dist/es5/context/state-tracker/with-parameters.js +0 -44
  385. package/dist/es5/context/state-tracker/with-parameters.js.map +0 -1
  386. package/dist/es5/index.js +0 -276
  387. package/dist/es5/index.js.map +0 -1
  388. package/dist/es5/init.js +0 -10
  389. package/dist/es5/init.js.map +0 -1
  390. package/dist/es5/types/webgl.js +0 -6
  391. package/dist/es5/types/webgl.js.map +0 -1
  392. package/dist/es5/types.js +0 -2
  393. package/dist/es5/types.js.map +0 -1
  394. package/dist/esm/adapter/converters/device-parameters.js +0 -155
  395. package/dist/esm/adapter/converters/device-parameters.js.map +0 -1
  396. package/dist/esm/adapter/converters/renderbuffer-formats.js +0 -185
  397. package/dist/esm/adapter/converters/renderbuffer-formats.js.map +0 -1
  398. package/dist/esm/adapter/converters/sampler-parameters.js +0 -208
  399. package/dist/esm/adapter/converters/sampler-parameters.js.map +0 -1
  400. package/dist/esm/adapter/converters/texture-formats.js +0 -954
  401. package/dist/esm/adapter/converters/texture-formats.js.map +0 -1
  402. package/dist/esm/adapter/converters/vertex-formats.js +0 -35
  403. package/dist/esm/adapter/converters/vertex-formats.js.map +0 -1
  404. package/dist/esm/adapter/device-helpers/device-features.js +0 -102
  405. package/dist/esm/adapter/device-helpers/device-features.js.map +0 -1
  406. package/dist/esm/adapter/device-helpers/device-limits.js +0 -91
  407. package/dist/esm/adapter/device-helpers/device-limits.js.map +0 -1
  408. package/dist/esm/adapter/device-helpers/get-device-info.js +0 -44
  409. package/dist/esm/adapter/device-helpers/get-device-info.js.map +0 -1
  410. package/dist/esm/adapter/device-helpers/is-old-ie.js +0 -8
  411. package/dist/esm/adapter/device-helpers/is-old-ie.js.map +0 -1
  412. package/dist/esm/adapter/helpers/attribute-utils.js +0 -81
  413. package/dist/esm/adapter/helpers/attribute-utils.js.map +0 -1
  414. package/dist/esm/adapter/helpers/get-shader-layout.js +0 -306
  415. package/dist/esm/adapter/helpers/get-shader-layout.js.map +0 -1
  416. package/dist/esm/adapter/helpers/parse-shader-compiler-log.js +0 -37
  417. package/dist/esm/adapter/helpers/parse-shader-compiler-log.js.map +0 -1
  418. package/dist/esm/adapter/helpers/set-uniform.js +0 -115
  419. package/dist/esm/adapter/helpers/set-uniform.js.map +0 -1
  420. package/dist/esm/adapter/helpers/uniforms.js +0 -99
  421. package/dist/esm/adapter/helpers/uniforms.js.map +0 -1
  422. package/dist/esm/adapter/objects/constants-to-keys.js +0 -42
  423. package/dist/esm/adapter/objects/constants-to-keys.js.map +0 -1
  424. package/dist/esm/adapter/objects/webgl-renderbuffer.js +0 -94
  425. package/dist/esm/adapter/objects/webgl-renderbuffer.js.map +0 -1
  426. package/dist/esm/adapter/objects/webgl-resource.js +0 -216
  427. package/dist/esm/adapter/objects/webgl-resource.js.map +0 -1
  428. package/dist/esm/adapter/objects/webgl-vertex-array-object.js +0 -84
  429. package/dist/esm/adapter/objects/webgl-vertex-array-object.js.map +0 -1
  430. package/dist/esm/adapter/resources/webgl-buffer.js +0 -164
  431. package/dist/esm/adapter/resources/webgl-buffer.js.map +0 -1
  432. package/dist/esm/adapter/resources/webgl-command-buffer.js +0 -65
  433. package/dist/esm/adapter/resources/webgl-command-buffer.js.map +0 -1
  434. package/dist/esm/adapter/resources/webgl-command-encoder.js +0 -53
  435. package/dist/esm/adapter/resources/webgl-command-encoder.js.map +0 -1
  436. package/dist/esm/adapter/resources/webgl-external-texture.js +0 -2
  437. package/dist/esm/adapter/resources/webgl-external-texture.js.map +0 -1
  438. package/dist/esm/adapter/resources/webgl-framebuffer.js +0 -265
  439. package/dist/esm/adapter/resources/webgl-framebuffer.js.map +0 -1
  440. package/dist/esm/adapter/resources/webgl-render-pass.js +0 -19
  441. package/dist/esm/adapter/resources/webgl-render-pass.js.map +0 -1
  442. package/dist/esm/adapter/resources/webgl-render-pipeline.js +0 -400
  443. package/dist/esm/adapter/resources/webgl-render-pipeline.js.map +0 -1
  444. package/dist/esm/adapter/resources/webgl-sampler.js +0 -50
  445. package/dist/esm/adapter/resources/webgl-sampler.js.map +0 -1
  446. package/dist/esm/adapter/resources/webgl-shader.js +0 -75
  447. package/dist/esm/adapter/resources/webgl-shader.js.map +0 -1
  448. package/dist/esm/adapter/resources/webgl-texture.js +0 -831
  449. package/dist/esm/adapter/resources/webgl-texture.js.map +0 -1
  450. package/dist/esm/adapter/webgl-canvas-context.js +0 -54
  451. package/dist/esm/adapter/webgl-canvas-context.js.map +0 -1
  452. package/dist/esm/adapter/webgl-device.js +0 -280
  453. package/dist/esm/adapter/webgl-device.js.map +0 -1
  454. package/dist/esm/bundle.js +0 -5
  455. package/dist/esm/bundle.js.map +0 -1
  456. package/dist/esm/classic/accessor.js +0 -144
  457. package/dist/esm/classic/accessor.js.map +0 -1
  458. package/dist/esm/classic/buffer.js +0 -384
  459. package/dist/esm/classic/buffer.js.map +0 -1
  460. package/dist/esm/classic/typed-array-utils.js +0 -112
  461. package/dist/esm/classic/typed-array-utils.js.map +0 -1
  462. package/dist/esm/context/context/context-state.js +0 -26
  463. package/dist/esm/context/context/context-state.js.map +0 -1
  464. package/dist/esm/context/context/create-context.js.map +0 -1
  465. package/dist/esm/context/context/device-pixels.js +0 -98
  466. package/dist/esm/context/context/device-pixels.js.map +0 -1
  467. package/dist/esm/context/context/webgl-checks.js +0 -34
  468. package/dist/esm/context/context/webgl-checks.js.map +0 -1
  469. package/dist/esm/context/debug/spector.js +0 -76
  470. package/dist/esm/context/debug/spector.js.map +0 -1
  471. package/dist/esm/context/debug/webgl-developer-tools.js +0 -121
  472. package/dist/esm/context/debug/webgl-developer-tools.js.map +0 -1
  473. package/dist/esm/context/parameters/unified-parameter-api.js +0 -65
  474. package/dist/esm/context/parameters/unified-parameter-api.js.map +0 -1
  475. package/dist/esm/context/parameters/webgl-parameter-tables.js +0 -445
  476. package/dist/esm/context/parameters/webgl-parameter-tables.js.map +0 -1
  477. package/dist/esm/context/polyfill/get-parameter-polyfill.js +0 -91
  478. package/dist/esm/context/polyfill/get-parameter-polyfill.js.map +0 -1
  479. package/dist/esm/context/polyfill/polyfill-context.js +0 -92
  480. package/dist/esm/context/polyfill/polyfill-context.js.map +0 -1
  481. package/dist/esm/context/polyfill/polyfill-table.js +0 -160
  482. package/dist/esm/context/polyfill/polyfill-table.js.map +0 -1
  483. package/dist/esm/context/polyfill/polyfill-vertex-array-object.js +0 -335
  484. package/dist/esm/context/polyfill/polyfill-vertex-array-object.js.map +0 -1
  485. package/dist/esm/context/state-tracker/deep-array-equal.js +0 -21
  486. package/dist/esm/context/state-tracker/deep-array-equal.js.map +0 -1
  487. package/dist/esm/context/state-tracker/track-context-state.js +0 -183
  488. package/dist/esm/context/state-tracker/track-context-state.js.map +0 -1
  489. package/dist/esm/context/state-tracker/with-parameters.js +0 -36
  490. package/dist/esm/context/state-tracker/with-parameters.js.map +0 -1
  491. package/dist/esm/index.js +0 -27
  492. package/dist/esm/index.js.map +0 -1
  493. package/dist/esm/init.js +0 -4
  494. package/dist/esm/init.js.map +0 -1
  495. package/dist/esm/types/webgl.js +0 -2
  496. package/dist/esm/types/webgl.js.map +0 -1
  497. package/dist/esm/types.js +0 -2
  498. package/dist/esm/types.js.map +0 -1
  499. package/dist/init.d.ts +0 -2
  500. package/dist/init.d.ts.map +0 -1
  501. package/dist/init.js +0 -4
  502. package/dist/init.js.map +0 -1
  503. package/dist/types/webgl.d.ts +0 -144
  504. package/dist/types/webgl.d.ts.map +0 -1
  505. package/dist/types/webgl.js +0 -2
  506. package/dist/types/webgl.js.map +0 -1
  507. package/src/adapter/converters/renderbuffer-formats.ts +0 -92
  508. package/src/bundle.ts +0 -4
  509. package/src/context/context/context-state.ts +0 -41
  510. package/src/context/context/device-pixels.ts +0 -152
  511. package/src/init.ts +0 -4
  512. package/src/types/webgl.ts +0 -283
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/adapter/resources/webgl-command-buffer.ts"],"names":["GL","cast","value","CommandBuffer","submitCommands","device","commands","command","name","_copyBufferToBuffer","options","_copyBufferToTexture","_copyTextureToBuffer","_copyTextureToTexture","source","destination","gl2","bindBuffer","COPY_READ_BUFFER","handle","COPY_WRITE_BUFFER","copyBufferSubData","sourceOffset","destinationOffset","size","Error"],"mappings":";AAMA,OAAOA,EAAP,MAAe,oBAAf;;AAIA,SAASC,IAAT,CAAiBC,KAAjB,EAAoC;AAClC,SAAOA,KAAP;AACD;;AA4BD,eAAe,MAAMC,aAAN,CAAoB;AAAA;AAAA,sCACX,EADW;AAAA;;AAAA;AAInC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ACkB,gBAAlB,EAAoC,IAApC;AACAF,IAAAA,GAAG,CAACC,UAAJ,CAAejB,EAAE,CAACoB,iBAAlB,EAAqC,IAArC;AACD,GAdD,MAcO;AAGL,UAAM,IAAIK,KAAJ,CAAU,8CAAV,CAAN;AACD;AACF;;AAED,SAASd,oBAAT,CAA8BN,MAA9B,EAAmDK,OAAnD,EAA8F,CAAE;;AAEhG,SAASE,oBAAT,CAA8BP,MAA9B,EAAmDK,OAAnD,EAA8F,CAAE;;AAEhG,SAASG,qBAAT,CAA+BR,MAA/B,EAAoDK,OAApD,EAAgG,CAAE","sourcesContent":["import type {\n CopyBufferToBufferOptions,\n CopyBufferToTextureOptions,\n CopyTextureToBufferOptions,\n CopyTextureToTextureOptions\n} from '@luma.gl/api';\nimport GL from '@luma.gl/constants';\nimport WebGLDevice from '../webgl-device';\nimport WEBGLBuffer from './webgl-buffer';\n\nfunction cast<T>(value: unknown): T {\n return value as T;\n}\n\ntype CopyBufferToBufferCommand = {\n name: 'copy-buffer-to-buffer';\n options: CopyBufferToBufferOptions;\n};\n\ntype CopyBufferToTextureCommand = {\n name: 'copy-buffer-to-texture';\n options: CopyBufferToTextureOptions;\n};\n\ntype CopyTextureToBufferCommand = {\n name: 'copy-texture-to-buffer';\n options: CopyTextureToBufferOptions;\n};\n\ntype CopyTextureToTextureCommand = {\n name: 'copy-texture-to-texture';\n options: CopyTextureToTextureOptions;\n};\n\ntype Command =\n | CopyBufferToBufferCommand\n | CopyBufferToTextureCommand\n | CopyTextureToBufferCommand\n | CopyTextureToTextureCommand;\n\nexport default class CommandBuffer {\n commands: Command[] = [];\n}\n\nexport function submitCommands(device: WebGLDevice, commands: Command[] = []) {\n for (const command of commands) {\n switch (command.name) {\n case 'copy-buffer-to-buffer':\n _copyBufferToBuffer(device, command.options);\n break;\n case 'copy-buffer-to-texture':\n _copyBufferToTexture(device, command.options);\n break;\n case 'copy-texture-to-buffer':\n _copyTextureToBuffer(device, command.options);\n break;\n case 'copy-texture-to-texture':\n _copyTextureToTexture(device, command.options);\n break;\n }\n }\n}\n\nfunction _copyBufferToBuffer(device: WebGLDevice, options: CopyBufferToBufferOptions): void {\n const source = cast<WEBGLBuffer>(options.source);\n const destination = cast<WEBGLBuffer>(options.destination);\n\n const {gl2} = device;\n if (gl2) {\n // In WebGL2 we can perform the copy on the GPU\n // Use GL.COPY_READ_BUFFER+GL.COPY_WRITE_BUFFER avoid disturbing other targets and locking type\n gl2.bindBuffer(GL.COPY_READ_BUFFER, source.handle);\n gl2.bindBuffer(GL.COPY_WRITE_BUFFER, destination.handle);\n gl2.copyBufferSubData(\n GL.COPY_READ_BUFFER,\n GL.COPY_WRITE_BUFFER,\n options.sourceOffset ?? 0,\n options.destinationOffset ?? 0,\n options.size\n );\n gl2.bindBuffer(GL.COPY_READ_BUFFER, null);\n gl2.bindBuffer(GL.COPY_WRITE_BUFFER, null);\n } else {\n // TODO - in WebGL1 we would have to read back to CPU\n // read / write buffer from / to CPU\n throw new Error('copyBufferToBuffer not implemented in WebGL1');\n }\n}\n\nfunction _copyBufferToTexture(device: WebGLDevice, options: CopyBufferToTextureOptions): void {}\n\nfunction _copyTextureToBuffer(device: WebGLDevice, options: CopyTextureToBufferOptions): void {}\n\nfunction _copyTextureToTexture(device: WebGLDevice, options: CopyTextureToTextureOptions): void {}\n"],"file":"webgl-command-buffer.js"}
1
+ {"version":3,"file":"webgl-command-buffer.js","names":["CommandBuffer","Texture","GL","WEBGLTexture","cast","value","WEBGLCommandBuffer","constructor","device","_defineProperty","submitCommands","commands","arguments","length","undefined","command","name","_copyBufferToBuffer","options","_copyBufferToTexture","_copyTextureToBuffer","_copyTextureToTexture","source","destination","gl2","assertWebGL2","_options$sourceOffset","_options$destinationO","bindBuffer","COPY_READ_BUFFER","handle","COPY_WRITE_BUFFER","copyBufferSubData","sourceOffset","destinationOffset","size","Error","mipLevel","aspect","width","height","depthOrArrayLayers","origin","byteOffset","bytesPerRow","rowsPerImage","framebuffer","destroyFramebuffer","getFramebuffer","webglBuffer","sourceWidth","sourceHeight","sourceFormat","RGBA","sourceType","UNSIGNED_BYTE","PIXEL_PACK_BUFFER","bindFramebuffer","FRAMEBUFFER","readPixels","destroy","destinationMipmaplevel","destinationInternalFormat","sourceX","sourceY","isSubCopy","gl","texture","textureTarget","Number","isFinite","bind","copyTexImage2D","unbind","prevHandle","glFormatToComponents","format","ALPHA","R32F","RED","RG32F","RG","RGB","RGB32F","RGBA32F","glTypeToBytes","type","UNSIGNED_SHORT_5_6_5","UNSIGNED_SHORT_4_4_4_4","UNSIGNED_SHORT_5_5_5_1","FLOAT","id","createFramebuffer","concat","colorAttachments"],"sources":["../../../src/adapter/resources/webgl-command-buffer.ts"],"sourcesContent":["// luma.gl, MIT license\n\nimport type {\n CopyBufferToBufferOptions,\n CopyBufferToTextureOptions,\n CopyTextureToBufferOptions,\n CopyTextureToTextureOptions\n} from '@luma.gl/core';\nimport {\n CommandBuffer,\n Texture,\n // Buffer,\n Framebuffer\n} from '@luma.gl/core';\nimport {GL} from '@luma.gl/constants';\n\n// import {getTypedArrayFromGLType, getGLTypeFromTypedArray} from '../../classic/typed-array-utils';\nimport {WebGLDevice} from '../webgl-device';\nimport {WEBGLBuffer} from './webgl-buffer';\nimport {WEBGLTexture} from './webgl-texture';\nimport {WEBGLFramebuffer} from './webgl-framebuffer';\n\nfunction cast<T>(value: unknown): T {\n return value as T;\n}\n\ntype CopyBufferToBufferCommand = {\n name: 'copy-buffer-to-buffer';\n options: CopyBufferToBufferOptions;\n};\n\ntype CopyBufferToTextureCommand = {\n name: 'copy-buffer-to-texture';\n options: CopyBufferToTextureOptions;\n};\n\ntype CopyTextureToBufferCommand = {\n name: 'copy-texture-to-buffer';\n options: CopyTextureToBufferOptions;\n};\n\ntype CopyTextureToTextureCommand = {\n name: 'copy-texture-to-texture';\n options: CopyTextureToTextureOptions;\n};\n\ntype Command =\n | CopyBufferToBufferCommand\n | CopyBufferToTextureCommand\n | CopyTextureToBufferCommand\n | CopyTextureToTextureCommand;\n\nexport class WEBGLCommandBuffer extends CommandBuffer {\n device: WebGLDevice;\n commands: Command[] = [];\n\n constructor(device: WebGLDevice) {\n super({});\n this.device = device;\n }\n\n submitCommands(commands: Command[] = this.commands) {\n for (const command of commands) {\n switch (command.name) {\n case 'copy-buffer-to-buffer':\n _copyBufferToBuffer(this.device, command.options);\n break;\n case 'copy-buffer-to-texture':\n _copyBufferToTexture(this.device, command.options);\n break;\n case 'copy-texture-to-buffer':\n _copyTextureToBuffer(this.device, command.options);\n break;\n case 'copy-texture-to-texture':\n _copyTextureToTexture(this.device, command.options);\n break;\n }\n }\n }\n}\n\nfunction _copyBufferToBuffer(device: WebGLDevice, options: CopyBufferToBufferOptions): void {\n const source = cast<WEBGLBuffer>(options.source);\n const destination = cast<WEBGLBuffer>(options.destination);\n\n const gl2 = device.assertWebGL2();\n if (gl2) {\n // In WebGL2 we can perform the copy on the GPU\n // Use GL.COPY_READ_BUFFER+GL.COPY_WRITE_BUFFER avoid disturbing other targets and locking type\n gl2.bindBuffer(GL.COPY_READ_BUFFER, source.handle);\n gl2.bindBuffer(GL.COPY_WRITE_BUFFER, destination.handle);\n gl2.copyBufferSubData(\n GL.COPY_READ_BUFFER,\n GL.COPY_WRITE_BUFFER,\n options.sourceOffset ?? 0,\n options.destinationOffset ?? 0,\n options.size\n );\n gl2.bindBuffer(GL.COPY_READ_BUFFER, null);\n gl2.bindBuffer(GL.COPY_WRITE_BUFFER, null);\n } else {\n // TODO - in WebGL1 we would have to read back to CPU\n // read / write buffer from / to CPU\n throw new Error('copyBufferToBuffer not implemented in WebGL1');\n }\n}\n\n/**\n * Copies data from a Buffer object into a Texture object\n * NOTE: doesn't wait for copy to be complete\n */\nfunction _copyBufferToTexture(device: WebGLDevice, options: CopyBufferToTextureOptions): void {\n throw new Error('Not implemented');\n}\n\n/**\n * Copies data from a Texture object into a Buffer object.\n * NOTE: doesn't wait for copy to be complete\n */\nfunction _copyTextureToBuffer(device: WebGLDevice, options: CopyTextureToBufferOptions): void {\n const {\n /** Texture to copy to/from. */\n source,\n /** Mip-map level of the texture to copy to/from. (Default 0) */\n mipLevel = 0,\n /** Defines which aspects of the texture to copy to/from. */\n aspect = 'all',\n\n /** Width to copy */\n width = options.source.width,\n /** Height to copy */\n height = options.source.height,\n depthOrArrayLayers = 0,\n /** Defines the origin of the copy - the minimum corner of the texture sub-region to copy to/from. */\n origin = [0, 0],\n\n /** Destination buffer */\n destination,\n /** Offset, in bytes, from the beginning of the buffer to the start of the image data (default 0) */\n byteOffset = 0,\n /**\n * The stride, in bytes, between the beginning of each block row and the subsequent block row.\n * Required if there are multiple block rows (i.e. the copy height or depth is more than one block).\n */\n bytesPerRow,\n /**\n * Number of block rows per single image of the texture.\n * rowsPerImage &times; bytesPerRow is the stride, in bytes, between the beginning of each image of data and the subsequent image.\n * Required if there are multiple images (i.e. the copy depth is more than one).\n */\n rowsPerImage\n } = options;\n\n // TODO - Not possible to read just stencil or depth part in WebGL?\n if (aspect !== 'all') {\n throw new Error('not supported');\n }\n\n // TODO - mipLevels are set when attaching texture to framebuffer\n if (mipLevel !== 0 || depthOrArrayLayers !== undefined || bytesPerRow || rowsPerImage) {\n throw new Error('not implemented');\n }\n\n // Asynchronous read (PIXEL_PACK_BUFFER) is WebGL2 only feature\n const gl2 = device.assertWebGL2();\n\n const {framebuffer, destroyFramebuffer} = getFramebuffer(source);\n try {\n const webglBuffer = destination as WEBGLBuffer;\n const sourceWidth = width || framebuffer.width;\n const sourceHeight = height || framebuffer.height;\n\n // TODO - hack - should be deduced\n const sourceFormat = GL.RGBA;\n const sourceType = GL.UNSIGNED_BYTE;\n\n // if (!target) {\n // // Create new buffer with enough size\n // const components = glFormatToComponents(sourceFormat);\n // const byteCount = glTypeToBytes(sourceType);\n // const byteLength = byteOffset + sourceWidth * sourceHeight * components * byteCount;\n // target = device.createBuffer({byteLength});\n // }\n\n gl2.bindBuffer(GL.PIXEL_PACK_BUFFER, webglBuffer.handle);\n gl2.bindFramebuffer(GL.FRAMEBUFFER, framebuffer.handle);\n\n gl2.readPixels(\n origin[0],\n origin[1],\n sourceWidth,\n sourceHeight,\n sourceFormat,\n sourceType,\n byteOffset\n );\n } finally {\n gl2.bindBuffer(GL.PIXEL_PACK_BUFFER, null);\n gl2.bindFramebuffer(GL.FRAMEBUFFER, null);\n\n if (destroyFramebuffer) {\n framebuffer.destroy();\n }\n }\n}\n\n/**\n * Copies data from a Framebuffer or a Texture object into a Buffer object.\n * NOTE: doesn't wait for copy to be complete, it programs GPU to perform a DMA transfer.\nexport function readPixelsToBuffer(\n source: Framebuffer | Texture,\n options?: {\n sourceX?: number;\n sourceY?: number;\n sourceFormat?: number;\n target?: Buffer; // A new Buffer object is created when not provided.\n targetByteOffset?: number; // byte offset in buffer object\n // following parameters are auto deduced if not provided\n sourceWidth?: number;\n sourceHeight?: number;\n sourceType?: number;\n }\n): Buffer\n */\n\n/**\n * Copy a rectangle from a Framebuffer or Texture object into a texture (at an offset)\n */\n// eslint-disable-next-line complexity, max-statements\nfunction _copyTextureToTexture(device: WebGLDevice, options: CopyTextureToTextureOptions): void {\n const {\n /** Texture to copy to/from. */\n source,\n /** Mip-map level of the texture to copy to/from. (Default 0) */\n // mipLevel = 0,\n /** Defines which aspects of the texture to copy to/from. */\n // aspect = 'all',\n /** Defines the origin of the copy - the minimum corner of the texture sub-region to copy to/from. */\n origin = [0, 0],\n\n /** Texture to copy to/from. */\n destination,\n /** Mip-map level of the texture to copy to/from. (Default 0) */\n // destinationMipLevel = options.mipLevel,\n /** Defines the origin of the copy - the minimum corner of the texture sub-region to copy to/from. */\n // destinationOrigin = [0, 0],\n /** Defines which aspects of the texture to copy to/from. */\n // destinationAspect = options.aspect,\n\n } = options;\n\n let {\n width = options.destination.width,\n height = options.destination.width,\n // depthOrArrayLayers = 0\n } = options;\n\n const destinationMipmaplevel = 0;\n const destinationInternalFormat = GL.RGBA;\n\n const {framebuffer, destroyFramebuffer} = getFramebuffer(source);\n const [sourceX, sourceY] = origin;\n\n const isSubCopy = false;\n // typeof destinationX !== 'undefined' ||\n // typeof destinationY !== 'undefined' ||\n // typeof destinationZ !== 'undefined';\n\n // destinationX = destinationX || 0;\n // destinationY = destinationY || 0;\n // destinationZ = destinationZ || 0;\n device.gl.bindFramebuffer(GL.FRAMEBUFFER, framebuffer.handle);\n // TODO - support gl.readBuffer (WebGL2 only)\n // const prevBuffer = gl.readBuffer(attachment);\n\n let texture = null;\n let textureTarget: GL;\n if (destination instanceof WEBGLTexture) {\n texture = destination;\n width = Number.isFinite(width) ? width : texture.width;\n height = Number.isFinite(height) ? height : texture.height;\n texture.bind(0);\n textureTarget = texture.destination;\n } else {\n throw new Error('whoops');\n // textureTarget = destination;\n }\n\n if (!isSubCopy) {\n device.gl.copyTexImage2D(\n textureTarget,\n destinationMipmaplevel,\n destinationInternalFormat,\n sourceX,\n sourceY,\n width,\n height,\n 0 /* border must be 0 */\n );\n } else {\n // switch (textureTarget) {\n // case GL.TEXTURE_2D:\n // case GL.TEXTURE_CUBE_MAP:\n // device.gl.copyTexSubImage2D(\n // textureTarget,\n // destinationMipmaplevel,\n // destinationX,\n // destinationY,\n // sourceX,\n // sourceY,\n // width,\n // height\n // );\n // break;\n // case GL.TEXTURE_2D_ARRAY:\n // case GL.TEXTURE_3D:\n // const gl2 = device.assertWebGL2();\n // gl2.copyTexSubImage3D(\n // textureTarget,\n // destinationMipmaplevel,\n // destinationX,\n // destinationY,\n // destinationZ,\n // sourceX,\n // sourceY,\n // width,\n // height\n // );\n // break;\n // default:\n // }\n }\n if (texture) {\n texture.unbind();\n }\n // @ts-expect-error\n device.gl.bindFramebuffer(GL.FRAMEBUFFER, prevHandle || null);\n if (destroyFramebuffer) {\n framebuffer.destroy();\n }\n return texture;\n}\n\n// Returns number of components in a specific readPixels WebGL format\nexport function glFormatToComponents(format): 1 | 2 | 3 | 4 {\n switch (format) {\n case GL.ALPHA:\n case GL.R32F:\n case GL.RED:\n return 1;\n case GL.RG32F:\n case GL.RG:\n return 2;\n case GL.RGB:\n case GL.RGB32F:\n return 3;\n case GL.RGBA:\n case GL.RGBA32F:\n return 4;\n // TODO: Add support for additional WebGL2 formats\n default:\n throw new Error('GLFormat');\n }\n}\n\n// Return byte count for given readPixels WebGL type\nexport function glTypeToBytes(type: GL): 1 | 2 | 4 {\n switch (type) {\n case GL.UNSIGNED_BYTE:\n return 1;\n case GL.UNSIGNED_SHORT_5_6_5:\n case GL.UNSIGNED_SHORT_4_4_4_4:\n case GL.UNSIGNED_SHORT_5_5_5_1:\n return 2;\n case GL.FLOAT:\n return 4;\n // TODO: Add support for additional WebGL2 types\n default:\n throw new Error('GLType');\n }\n}\n\n// Helper methods\n\nfunction getFramebuffer(source: Texture | Framebuffer): {\n framebuffer: WEBGLFramebuffer;\n destroyFramebuffer: boolean;\n} {\n if (source instanceof Texture) {\n const {width, height, id} = source;\n const framebuffer = source.device.createFramebuffer({\n id: `framebuffer-for-${id}`,\n width,\n height,\n colorAttachments: [source]\n }) as unknown as WEBGLFramebuffer;\n\n return {framebuffer, destroyFramebuffer: true};\n }\n return {framebuffer: source as unknown as WEBGLFramebuffer, destroyFramebuffer: false};\n}\n"],"mappings":";AAQA,SACEA,aAAa,EACbC,OAAO,QAGF,eAAe;AACtB,SAAQC,EAAE,QAAO,oBAAoB;AAAC,SAK9BC,YAAY;AAGpB,SAASC,IAAIA,CAAIC,KAAc,EAAK;EAClC,OAAOA,KAAK;AACd;AA4BA,OAAO,MAAMC,kBAAkB,SAASN,aAAa,CAAC;EAIpDO,WAAWA,CAACC,MAAmB,EAAE;IAC/B,KAAK,CAAC,CAAC,CAAC,CAAC;IAACC,eAAA;IAAAA,eAAA,mBAHU,EAAE;IAItB,IAAI,CAACD,MAAM,GAAGA,MAAM;EACtB;EAEAE,cAAcA,CAAA,EAAsC;IAAA,IAArCC,QAAmB,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,IAAI,CAACD,QAAQ;IAChD,KAAK,MAAMI,OA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AE;EAAK,CAAC;AACxF"}
@@ -1,12 +1,13 @@
1
- import { CommandEncoder, CommandEncoderProps } from '@luma.gl/api';
2
- import type { CopyBufferToBufferOptions, CopyBufferToTextureOptions, CopyTextureToBufferOptions, CopyTextureToTextureOptions } from '@luma.gl/api';
3
- import CommandBuffer from './webgl-command-buffer';
4
- import WebGLDevice from '../webgl-device';
5
- export default class WEBGLCommandEncoder extends CommandEncoder {
1
+ import { CommandEncoder, CommandEncoderProps } from '@luma.gl/core';
2
+ import type { CopyBufferToBufferOptions, CopyBufferToTextureOptions, CopyTextureToBufferOptions, CopyTextureToTextureOptions } from '@luma.gl/core';
3
+ import { WEBGLCommandBuffer } from './webgl-command-buffer';
4
+ import { WebGLDevice } from '../webgl-device';
5
+ export declare class WEBGLCommandEncoder extends CommandEncoder {
6
6
  readonly device: WebGLDevice;
7
- readonly commandBuffer: CommandBuffer;
7
+ readonly commandBuffer: WEBGLCommandBuffer;
8
8
  constructor(device: WebGLDevice, props: CommandEncoderProps);
9
9
  destroy(): void;
10
+ finish(): void;
10
11
  copyBufferToBuffer(options: CopyBufferToBufferOptions): void;
11
12
  copyBufferToTexture(options: CopyBufferToTextureOptions): void;
12
13
  copyTextureToBuffer(options: CopyTextureToBufferOptions): void;
@@ -1 +1 @@
1
- {"version":3,"file":"webgl-command-encoder.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgl-command-encoder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,cAAc,EAAE,mBAAmB,EAAC,MAAM,cAAc,CAAC;AACjE,OAAO,KAAK,EACV,yBAAyB,EACzB,0BAA0B,EAC1B,0BAA0B,EAC1B,2BAA2B,EAC5B,MAAM,cAAc,CAAC;AAEtB,OAAO,aAAa,MAAM,wBAAwB,CAAC;AACnD,OAAO,WAAW,MAAM,iBAAiB,CAAC;AAE1C,MAAM,CAAC,OAAO,OAAO,mBAAoB,SAAQ,cAAc;IAC7D,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC;IAE7B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CAAC,UAAU,EAAE,MAAM,GAAG,IAAI;IACxC,aAAa;IAEb,iBAAiB,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI;CAWtD"}
@@ -1,53 +1,44 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
- import { CommandEncoder } from '@luma.gl/api';
3
- import CommandBuffer from './webgl-command-buffer';
4
- export default class WEBGLCommandEncoder extends CommandEncoder {
2
+ import { CommandEncoder } from '@luma.gl/core';
3
+ import { WEBGLCommandBuffer } from "./webgl-command-buffer.js";
4
+ export class WEBGLCommandEncoder extends CommandEncoder {
5
5
  constructor(device, props) {
6
- super(props);
7
-
6
+ super(device, props);
8
7
  _defineProperty(this, "device", void 0);
9
-
10
- _defineProperty(this, "commandBuffer", new CommandBuffer());
11
-
8
+ _defineProperty(this, "commandBuffer", void 0);
12
9
  this.device = device;
10
+ this.commandBuffer = new WEBGLCommandBuffer(device);
13
11
  }
14
-
15
12
  destroy() {}
16
-
13
+ finish() {
14
+ this.commandBuffer.submitCommands();
15
+ }
17
16
  copyBufferToBuffer(options) {
18
17
  this.commandBuffer.commands.push({
19
18
  name: 'copy-buffer-to-buffer',
20
19
  options
21
20
  });
22
21
  }
23
-
24
22
  copyBufferToTexture(options) {
25
23
  this.commandBuffer.commands.push({
26
24
  name: 'copy-buffer-to-texture',
27
25
  options
28
26
  });
29
27
  }
30
-
31
28
  copyTextureToBuffer(options) {
32
29
  this.commandBuffer.commands.push({
33
30
  name: 'copy-texture-to-buffer',
34
31
  options
35
32
  });
36
33
  }
37
-
38
34
  copyTextureToTexture(options) {
39
35
  this.commandBuffer.commands.push({
40
36
  name: 'copy-texture-to-texture',
41
37
  options
42
38
  });
43
39
  }
44
-
45
40
  pushDebugGroup(groupLabel) {}
46
-
47
41
  popDebugGroup() {}
48
-
49
42
  insertDebugMarker(markerLabel) {}
50
-
51
43
  }
52
- ;
53
44
  //# sourceMappingURL=webgl-command-encoder.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/adapter/resources/webgl-command-encoder.ts"],"names":["CommandEncoder","CommandBuffer","WEBGLCommandEncoder","constructor","device","props","destroy","copyBufferToBuffer","options","commandBuffer","commands","push","name","copyBufferToTexture","copyTextureToBuffer","copyTextureToTexture","pushDebugGroup","groupLabel","popDebugGroup","insertDebugMarker","markerLabel"],"mappings":";AAAA,SAAQA,cAAR,QAAkD,cAAlD;AAQA,OAAOC,aAAP,MAA0B,wBAA1B;AAGA,eAAe,MAAMC,mBAAN,SAAkCF,cAAlC,CAAiD;AAK9DG,EAAAA,WAAW,CAACC,MAAD,EAAsBC,KAAtB,EAAkD;AAC3D,UAAMA,KAAN;;AAD2D;;AAAA,2CAFpC,IAAIJ,aAAJ,EAEoC;;AAE3D,SAAKG,MAAL,GAAcA,MAAd;AACD;;AAEDE,EAAAA,OAAO,GAAG,CAAE;;AAMZC,EAAAA,kBAAkB,CAACC,OAAD,EAA2C;AAC3D,SAAKC,aAAL,CAAmBC,QAAnB,CAA4BC,IAA5B,CAAiC;AAACC,MAAAA,IAAI,EAAE,uBAAP;AAAgCJ,MAAAA;AAAhC,KAAjC;AACD;;AAEDK,EAAAA,mBAAmB,CAACL,OAAD,EAAsC;AACvD,SAAKC,aAAL,CAAmBC,QAAnB,CAA4BC,IAA5B,CAAiC;AAACC,MAAAA,IAAI,EAAE,wBAAP;AAAiCJ,MAAAA;AAAjC,KAAjC;AACD;;AAEDM,EAAAA,mBAAmB,CAACN,OAAD,EAA4C;AAC7D,SAAKC,aAAL,CAAmBC,QAAnB,CAA4BC,IAA5B,CAAiC;AAACC,MAAAA,IAAI,EAAE,wBAAP;AAAiCJ,MAAAA;AAAjC,KAAjC;AACD;;AAEDO,EAAAA,oBAAoB,CAACP,OAAD,EAA6C;AAC/D,SAAKC,aAAL,CAAmBC,QAAnB,CAA4BC,IAA5B,CAAiC;AAACC,MAAAA,IAAI,EAAE,yBAAP;AAAkCJ,MAAAA;AAAlC,KAAjC;AACD;;AAEDQ,EAAAA,cAAc,CAACC,UAAD,EAA2B,CAAE;;AAC3CC,EAAAA,aAAa,GAAG,CAAE;;AAElBC,EAAAA,iBAAiB,CAACC,WAAD,EAA4B,CAAE;;AAnCe;AA8C/D","sourcesContent":["import {CommandEncoder, CommandEncoderProps} from '@luma.gl/api';\nimport type {\n CopyBufferToBufferOptions,\n CopyBufferToTextureOptions,\n CopyTextureToBufferOptions,\n CopyTextureToTextureOptions\n} from '@luma.gl/api';\n\nimport CommandBuffer from './webgl-command-buffer';\nimport WebGLDevice from '../webgl-device';\n\nexport default class WEBGLCommandEncoder extends CommandEncoder {\n readonly device: WebGLDevice;\n\n readonly commandBuffer = new CommandBuffer();\n\n constructor(device: WebGLDevice, props: CommandEncoderProps) {\n super(props);\n this.device = device;\n }\n\n destroy() {}\n\n // beginRenderPass(GPURenderPassDescriptor descriptor): GPURenderPassEncoder;\n // beginComputePass(optional GPUComputePassDescriptor descriptor = {}): GPUComputePassEncoder;\n // finish(options?: {id?: string}): GPUCommandBuffer;\n\n copyBufferToBuffer(options: CopyBufferToBufferOptions): void {\n this.commandBuffer.commands.push({name: 'copy-buffer-to-buffer', options});\n }\n\n copyBufferToTexture(options: CopyBufferToTextureOptions) {\n this.commandBuffer.commands.push({name: 'copy-buffer-to-texture', options});\n }\n\n copyTextureToBuffer(options: CopyTextureToBufferOptions): void {\n this.commandBuffer.commands.push({name: 'copy-texture-to-buffer', options});\n }\n\n copyTextureToTexture(options: CopyTextureToTextureOptions): void {\n this.commandBuffer.commands.push({name: 'copy-texture-to-texture', options});\n }\n\n pushDebugGroup(groupLabel: string): void {}\n popDebugGroup() {}\n\n insertDebugMarker(markerLabel: string): void {}\n\n // writeTimestamp(querySet: Query, queryIndex: number): void {}\n\n // resolveQuerySet(options: {\n // querySet: GPUQuerySet,\n // firstQuery: number,\n // queryCount: number,\n // destination: Buffer,\n // destinationOffset?: number;\n // }): void;\n};\n"],"file":"webgl-command-encoder.js"}
1
+ {"version":3,"file":"webgl-command-encoder.js","names":["CommandEncoder","WEBGLCommandBuffer","WEBGLCommandEncoder","constructor","device","props","_defineProperty","commandBuffer","destroy","finish","submitCommands","copyBufferToBuffer","options","commands","push","name","copyBufferToTexture","copyTextureToBuffer","copyTextureToTexture","pushDebugGroup","groupLabel","popDebugGroup","insertDebugMarker","markerLabel"],"sources":["../../../src/adapter/resources/webgl-command-encoder.ts"],"sourcesContent":["import {CommandEncoder, CommandEncoderProps} from '@luma.gl/core';\nimport type {\n CopyBufferToBufferOptions,\n CopyBufferToTextureOptions,\n CopyTextureToBufferOptions,\n CopyTextureToTextureOptions\n} from '@luma.gl/core';\n\nimport {WEBGLCommandBuffer} from './webgl-command-buffer';\nimport {WebGLDevice} from '../webgl-device';\n\nexport class WEBGLCommandEncoder extends CommandEncoder {\n readonly device: WebGLDevice;\n\n readonly commandBuffer: WEBGLCommandBuffer;\n\n constructor(device: WebGLDevice, props: CommandEncoderProps) {\n super(device, props);\n this.device = device;\n this.commandBuffer = new WEBGLCommandBuffer(device);\n }\n\n override destroy(): void {}\n\n override finish(): void {\n this.commandBuffer.submitCommands();\n }\n\n // beginRenderPass(GPURenderPassDescriptor descriptor): GPURenderPassEncoder;\n // beginComputePass(optional GPUComputePassDescriptor descriptor = {}): GPUComputePassEncoder;\n // finish(options?: {id?: string}): GPUCommandBuffer;\n\n copyBufferToBuffer(options: CopyBufferToBufferOptions): void {\n this.commandBuffer.commands.push({name: 'copy-buffer-to-buffer', options});\n }\n\n copyBufferToTexture(options: CopyBufferToTextureOptions) {\n this.commandBuffer.commands.push({name: 'copy-buffer-to-texture', options});\n }\n\n copyTextureToBuffer(options: CopyTextureToBufferOptions): void {\n this.commandBuffer.commands.push({name: 'copy-texture-to-buffer', options});\n }\n\n copyTextureToTexture(options: CopyTextureToTextureOptions): void {\n this.commandBuffer.commands.push({name: 'copy-texture-to-texture', options});\n }\n\n override pushDebugGroup(groupLabel: string): void {}\n override popDebugGroup() {}\n\n override insertDebugMarker(markerLabel: string): void {}\n\n // writeTimestamp(querySet: Query, queryIndex: number): void {}\n\n // resolveQuerySet(options: {\n // querySet: GPUQuerySet,\n // firstQuery: number,\n // queryCount: number,\n // destination: Buffer,\n // destinationOffset?: number;\n // }): void;\n}\n"],"mappings":";AAAA,SAAQA,cAAc,QAA4B,eAAe;AAAC,SAQ1DC,kBAAkB;AAG1B,OAAO,MAAMC,mBAAmB,SAASF,cAAc,CAAC;EAKtDG,WAAWA,CAACC,MAAmB,EAAEC,KAA0B,EAAE;IAC3D,KAAK,CAACD,MAAM,EAAEC,KAAK,CAAC;IAACC,eAAA;IAAAA,eAAA;IACrB,IAAI,CAACF,MAAM,GAAGA,MAAM;IACpB,IAAI,CAACG,aAAa,GAAG,IAAIN,kBAAkB,CAACG,MAAM,CAAC;EACrD;EAESI,OAAOA,CAAA,EAAS,CAAC;EAEjBC,MAAMA,CAAA,EAAS;IACtB,IAAI,CAACF,aAAa,CAACG,cAAc,CAAC,CAAC;EACrC;EAMAC,kBAAkBA,CAACC,OAAkC,EAAQ;IAC3D,IAAI,CAACL,aAAa,CAACM,QAAQ,CAACC,IAAI,CAAC;MAACC,IAAI,EAAE,uBAAuB;MAAEH;IAAO,CAAC,CAAC;EAC5E;EAEAI,mBAAmBA,CAACJ,OAAmC,EAAE;IACvD,IAAI,CAACL,aAAa,CAACM,QAAQ,CAACC,IAAI,CAAC;MAACC,IAAI,EAAE,wBAAwB;MAAEH;IAAO,CAAC,CAAC;EAC7E;EAEAK,mBAAmBA,CAACL,OAAmC,EAAQ;IAC7D,IAAI,CAACL,aAAa,CAACM,QAAQ,CAACC,IAAI,CAAC;MAACC,IAAI,EAAE,wBAAwB;MAAEH;IAAO,CAAC,CAAC;EAC7E;EAEAM,oBAAoBA,CAACN,OAAoC,EAAQ;IAC/D,IAAI,CAACL,aAAa,CAACM,QAAQ,CAACC,IAAI,CAAC;MAACC,IAAI,EAAE,yBAAyB;MAAEH;IAAO,CAAC,CAAC;EAC9E;EAESO,cAAcA,CAACC,UAAkB,EAAQ,CAAC;EAC1CC,aAAaA,CAAA,EAAG,CAAC;EAEjBC,iBAAiBA,CAACC,WAAmB,EAAQ,CAAC;AAWzD"}
@@ -1 +1 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[],"file":"webgl-external-texture.js"}
1
+ {"version":3,"file":"webgl-external-texture.js","names":[],"sources":["../../../src/adapter/resources/webgl-external-texture.ts"],"sourcesContent":["/*\nexport class WEBGLExternalTexture extends WEBGLTexture {\n readonly device: WebGLDevice;\n readonly gl: WebGLRenderingContext;\n readonly gl2: WebGL2RenderingContext | null;\n readonly handle: WebGLTexture;\n\n data;\n\n width: number = undefined;\n height: number = undefined;\n depth: number = undefined;\n\n format = undefined;\n type = undefined;\n dataFormat = undefined;\n border = undefined;\n mipmaps: boolean = undefined;\n\n textureUnit: number = undefined;\n\n sampler: WEBGLSampler;\n\n // Program.draw() checks the loaded flag of all textures to avoid\n // Textures that are still loading from promises\n // Set to true as soon as texture has been initialized with valid data\n loaded = false;\n _video;\n\n readonly target: GL;\n // target cannot be modified by bind:\n // textures are special because when you first bind them to a target,\n // they get special information. When you first bind a texture as a\n // GL_TEXTURE_2D, you are actually setting special state in the texture.\n // You are saying that this texture is a 2D texture.\n // And it will always be a 2D texture; this state cannot be changed ever.\n // If you have a texture that was first bound as a GL_TEXTURE_2D,\n // you must always bind it as a GL_TEXTURE_2D;\n // attempting to bind it as GL_TEXTURE_3D will give rise to an error\n // (while run-time).\n\n static isSupported(device: WebGLDevice, options?: TextureSupportOptions): boolean {\n const {format, linearFiltering} = options;\n let supported = true;\n if (format) {\n supported = supported && isFormatSupported(device.gl, format);\n supported = supported && (!linearFiltering || isTextureFormatFilterable(device.gl, format));\n }\n return supported;\n }\n\n // eslint-disable-next-line max-statements\n constructor(device: Device | WebGLRenderingContext, props: TextureProps) {\n super(WebGLDevice.attach(device), {id: uid('texture'), ...props});\n\n this.glTarget = getWebGLTextureTarget(props);\n\n this.device = WebGLDevice.attach(device);\n this.gl = this.device.gl;\n this.gl2 = this.device.gl2;\n this.handle = this.props.handle || this.gl.createTexture();\n\n let data = props.data;\n\n const isVideo = typeof HTMLVideoElement !== 'undefined' && data instanceof HTMLVideoElement;\n // @ts-expect-error\n if (isVideo && data.readyState < HTMLVideoElement.HAVE_METADATA) {\n this._video = null; // Declare member before the object is sealed\n data.addEventListener('loadeddata', () => this.initialize(props));\n return this;\n }\n\n update(): this {\n if (this._video) {\n const {video, parameters, lastTime} = this._video;\n // @ts-expect-error\n if (lastTime === video.currentTime || video.readyState < HTMLVideoElement.HAVE_CURRENT_DATA) {\n return;\n }\n this.setSubImageData({\n data: video,\n parameters\n });\n if (this.mipmaps) {\n this.generateMipmap();\n }\n this._video.lastTime = video.currentTime;\n }\n }\n\n\n*/"],"mappings":""}
@@ -1,40 +1,37 @@
1
- import type { FramebufferProps, ColorTextureFormat } from '@luma.gl/api';
2
- import { Framebuffer, Texture } from '@luma.gl/api';
3
- import GL from '@luma.gl/constants';
4
- import WebGLDevice from '../webgl-device';
5
- import WebGLTexture from './webgl-texture';
6
- import Renderbuffer from '../objects/webgl-renderbuffer';
7
- export declare type TextureAttachment = [Texture, number?, number?];
8
- export declare type Attachment = WebGLTexture | Renderbuffer | TextureAttachment;
1
+ import type { FramebufferProps, TextureFormat } from '@luma.gl/core';
2
+ import { Framebuffer, Texture } from '@luma.gl/core';
3
+ import { GL } from '@luma.gl/constants';
4
+ import { WebGLDevice } from '../webgl-device';
5
+ import { WEBGLTexture } from './webgl-texture';
6
+ import { WEBGLRenderbuffer } from '../objects/webgl-renderbuffer';
7
+ export type TextureAttachment = [Texture, number?, number?];
8
+ export type Attachment = WEBGLTexture | WEBGLRenderbuffer | TextureAttachment;
9
9
  /** luma.gl Framebuffer, WebGL implementation */
10
- export default class WEBGLFramebuffer extends Framebuffer {
10
+ export declare class WEBGLFramebuffer extends Framebuffer {
11
11
  device: WebGLDevice;
12
12
  gl: WebGLRenderingContext;
13
13
  handle: WebGLFramebuffer;
14
- get texture(): WebGLTexture;
15
- readonly colorAttachments: WebGLTexture[];
16
- readonly depthStencilAttachment: WebGLTexture | undefined;
17
- protected _ownResources: (WebGLTexture | Renderbuffer)[];
14
+ get texture(): Texture<import("@luma.gl/core").TextureProps>;
18
15
  constructor(device: WebGLDevice, props: FramebufferProps);
16
+ /** destroys any auto created resources etc. */
19
17
  destroy(): void;
20
18
  /** Check the status */
21
19
  protected _checkStatus(): void;
22
- _createColorAttachments(): WebGLTexture[];
23
- /** Create a color attachment */
24
- protected _createColorAttachment(format: ColorTextureFormat, width: number, height: number): WebGLTexture;
25
- /** Create a depth stencil attachment GL.DEPTH24_STENCIL8 */
26
- protected _createDepthStencilAttachment(): Renderbuffer | WebGLTexture;
27
- /** Attachment resize is expected to be a noop if size is same */
28
- protected _resizeAttachments(width: number, height: number): this;
20
+ /** In WebGL we must use renderbuffers for depth/stencil attachments (unless we have extensions) */
21
+ protected createDepthStencilTexture(format: TextureFormat): Texture;
22
+ /**
23
+ * Attachment resize is expected to be a noop if size is same
24
+ */
25
+ protected resizeAttachments(width: number, height: number): this;
29
26
  /** Attach one attachment */
30
- protected _attachOne(attachmentPoint: GL, attachment: Attachment): WebGLTexture | Renderbuffer;
31
- protected _attachRenderbuffer(attachment: GL, renderbuffer: Renderbuffer): void;
27
+ protected _attachOne(attachmentPoint: GL, attachment: Attachment): WEBGLTexture | WEBGLRenderbuffer;
28
+ protected _attachWEBGLRenderbuffer(attachment: GL, renderbuffer: WEBGLRenderbuffer): void;
32
29
  /**
33
30
  * @param attachment
34
31
  * @param texture
35
- * @param layer = 0 - index into WebGLTextureArray and Texture3D or face for `TextureCubeMap`
32
+ * @param layer = 0 - index into WEBGLTextureArray and Texture3D or face for `TextureCubeMap`
36
33
  * @param level = 0 - mipmapLevel (must be 0 in WebGL1)
37
34
  */
38
- protected _attachTexture(attachment: GL, texture: WebGLTexture, layer: number, level: number): void;
35
+ protected _attachTexture(attachment: GL, texture: WEBGLTexture, layer: number, level: number): void;
39
36
  }
40
37
  //# sourceMappingURL=webgl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CAAC;IAC1B,MAAM,EAAE,gBAAgB,CAAC;IAEzB,IAAI,OAAO,kDAEV;gBAEW,MAAM,EAAE,WAAW,EAAE,KAAK,EAAE,gBAAgB;IA8CxD,+CAA+C;IACtC,OAAO,IAAI,IAAI;IAUxB,uBAAuB;IACvB,SAAS,CAAC,YAAY,IAAI,IAAI;IAW9B,mGAAmG;cAChF,yBAAyB,CAAC,MAAM,EAAE,aAAa,GAAG,OAAO;IAW5E;;OAEG;cACgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI;IA2BzE,4BAA4B;IAC5B,SAAS,CAAC,UAAU,CAClB,eAAe,EAAE,EAAE,EACnB,UAAU,EAAE,UAAU,GACrB,YAAY,GAAG,iBAAiB;IAenC,SAAS,CAAC,wBAAwB,CAAC,UAAU,EAAE,EAAE,EAAE,YAAY,EAAE,iBAAiB,GAAG,IAAI;IASzF;;;;;OAKG;IACH,SAAS,CAAC,cAAc,CACtB,UAAU,EAAE,EAAE,EACd,OAAO,EAAE,YAAY,EACrB,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,MAAM,GACZ,IAAI;CA2BR"}
@@ -1,75 +1,51 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
- import { Framebuffer, Texture, log, assert } from '@luma.gl/api';
3
- import GL from '@luma.gl/constants';
4
- import WebGLTexture from './webgl-texture';
5
- import Renderbuffer from '../objects/webgl-renderbuffer';
6
- import { getWebGLTextureFormat, getWebGLDepthStencilAttachment } from '../converters/texture-formats';
7
- export default class WEBGLFramebuffer extends Framebuffer {
2
+ import { Framebuffer, assert } from '@luma.gl/core';
3
+ import { GL } from '@luma.gl/constants';
4
+ import { WEBGLTexture } from "./webgl-texture.js";
5
+ import { WEBGLRenderbuffer } from "../objects/webgl-renderbuffer.js";
6
+ import { getDepthStencilAttachmentWebGL } from "../converters/texture-formats.js";
7
+ export class WEBGLFramebuffer extends Framebuffer {
8
8
  get texture() {
9
9
  return this.colorAttachments[0];
10
10
  }
11
-
12
11
  constructor(device, props) {
13
12
  super(device, props);
14
-
15
13
  _defineProperty(this, "device", void 0);
16
-
17
14
  _defineProperty(this, "gl", void 0);
18
-
19
15
  _defineProperty(this, "handle", void 0);
20
-
21
- _defineProperty(this, "colorAttachments", []);
22
-
23
- _defineProperty(this, "depthStencilAttachment", undefined);
24
-
25
- _defineProperty(this, "_ownResources", []);
26
-
16
+ const isDefaultFramebuffer = props.handle === null;
27
17
  this.device = device;
28
18
  this.gl = device.gl;
29
- this.handle = this.props.handle !== undefined ? this.props.handle : this.gl.createFramebuffer();
30
-
31
- if (this.handle) {
32
- this.handle.__SPECTOR_Metadata = {
19
+ this.handle = this.props.handle || isDefaultFramebuffer ? this.props.handle : this.gl.createFramebuffer();
20
+ if (!isDefaultFramebuffer) {
21
+ device.setSpectorMetadata(this.handle, {
33
22
  id: this.props.id,
34
23
  props: this.props
35
- };
36
- }
37
-
38
- this.colorAttachments = this._createColorAttachments();
39
- this.depthStencilAttachment = this._createDepthStencilAttachment();
40
- const prevHandle = this.gl.bindFramebuffer(GL.FRAMEBUFFER, this.handle);
41
-
42
- for (let i = 0; i < this.colorAttachments.length; ++i) {
43
- const attachment = this.colorAttachments[i];
44
- const attachmentPoint = GL.COLOR_ATTACHMENT0 + i;
45
-
46
- if (attachment) {
47
- this._attachOne(attachmentPoint, attachment);
24
+ });
25
+ this.autoCreateAttachmentTextures();
26
+ this.gl.bindFramebuffer(GL.FRAMEBUFFER, this.handle);
27
+ for (let i = 0; i < this.colorAttachments.length; ++i) {
28
+ const attachment = this.colorAttachments[i];
29
+ const attachmentPoint = GL.COLOR_ATTACHMENT0 + i;
30
+ if (attachment) {
31
+ this._attachOne(attachmentPoint, attachment);
32
+ }
48
33
  }
34
+ if (this.depthStencilAttachment) {
35
+ this._attachOne(getDepthStencilAttachmentWebGL(this.depthStencilAttachment.format), this.depthStencilAttachment);
36
+ }
37
+ this.gl.bindFramebuffer(GL.FRAMEBUFFER, null);
49
38
  }
50
-
51
- if (this.props.depthStencilAttachment) {
52
- this._attachOne(getWebGLDepthStencilAttachment(this.depthStencilAttachment.format), this.depthStencilAttachment);
53
- }
54
-
55
- this.gl.bindFramebuffer(GL.FRAMEBUFFER, prevHandle || null);
56
-
57
39
  if (props.check !== false) {
58
40
  this._checkStatus();
59
41
  }
60
42
  }
61
-
62
43
  destroy() {
63
- if (this.handle !== null) {
64
- for (const resource of this._ownResources) {
65
- resource.destroy();
66
- }
67
-
44
+ super.destroy();
45
+ if (!this.destroyed && this.handle !== null) {
68
46
  this.gl.deleteFramebuffer(this.handle);
69
- this.handle = null;
70
47
  }
71
48
  }
72
-
73
49
  _checkStatus() {
74
50
  const {
75
51
  gl
@@ -77,187 +53,103 @@ export default class WEBGLFramebuffer extends Framebuffer {
77
53
  const prevHandle = gl.bindFramebuffer(GL.FRAMEBUFFER, this.handle);
78
54
  const status = gl.checkFramebufferStatus(GL.FRAMEBUFFER);
79
55
  gl.bindFramebuffer(GL.FRAMEBUFFER, prevHandle || null);
80
-
81
56
  if (status !== gl.FRAMEBUFFER_COMPLETE) {
82
57
  throw new Error("Framebuffer ".concat(_getFrameBufferStatus(status)));
83
58
  }
84
59
  }
85
-
86
- _createColorAttachments() {
87
- return this.props.colorAttachments.map(colorAttachment => {
88
- if (!colorAttachment) {
89
- return undefined;
90
- }
91
-
92
- if (colorAttachment instanceof WebGLTexture) {
93
- return colorAttachment;
94
- }
95
-
96
- return this._createColorAttachment(colorAttachment, this.width, this.height);
97
- });
98
- }
99
-
100
- _createColorAttachment(format, width, height) {
101
- const texture = this.device._createTexture({
102
- id: "".concat(this.id, "-color"),
103
- data: null,
104
- format,
105
- width,
106
- height,
107
- mipmaps: false,
108
- sampler: {
109
- minFilter: 'linear',
110
- magFilter: 'linear',
111
- addressModeU: 'clamp-to-edge',
112
- addressModeV: 'clamp-to-edge'
113
- }
114
- });
115
-
116
- this._ownResources.push(texture);
117
-
118
- return texture;
119
- }
120
-
121
- _createDepthStencilAttachment() {
122
- if (!this.props.depthStencilAttachment) {
123
- return undefined;
124
- }
125
-
126
- if (this.props.depthStencilAttachment instanceof Renderbuffer) {
127
- return this.props.depthStencilAttachment;
128
- }
129
-
130
- if (this.props.depthStencilAttachment instanceof Texture) {
131
- return this.props.depthStencilAttachment;
132
- }
133
-
134
- const format = this.props.depthStencilAttachment;
135
- const webglFormat = getWebGLTextureFormat(this.gl, format);
136
- const texture = new Renderbuffer(this.device, {
60
+ createDepthStencilTexture(format) {
61
+ return new WEBGLRenderbuffer(this.device, {
137
62
  id: "".concat(this.id, "-depth-stencil"),
138
- format: webglFormat,
63
+ format,
139
64
  width: this.width,
140
65
  height: this.height
141
66
  });
142
-
143
- this._ownResources.push(texture);
144
-
145
- return texture;
146
67
  }
147
-
148
- _resizeAttachments(width, height) {
149
- var _this$depthStencilAtt;
150
-
68
+ resizeAttachments(width, height) {
151
69
  if (this.handle === null) {
152
70
  this.width = this.gl.drawingBufferWidth;
153
71
  this.height = this.gl.drawingBufferHeight;
154
72
  return this;
155
73
  }
156
-
157
74
  if (width === undefined) {
158
75
  width = this.gl.drawingBufferWidth;
159
76
  }
160
-
161
77
  if (height === undefined) {
162
78
  height = this.gl.drawingBufferHeight;
163
79
  }
164
-
165
- if (width !== this.width && height !== this.height) {
166
- log.log(2, "Resizing framebuffer ".concat(this.id, " to ").concat(width, "x").concat(height))();
167
- }
168
-
169
80
  for (const colorAttachment of this.colorAttachments) {
170
81
  colorAttachment.resize({
171
82
  width,
172
83
  height
173
84
  });
174
85
  }
175
-
176
- (_this$depthStencilAtt = this.depthStencilAttachment) === null || _this$depthStencilAtt === void 0 ? void 0 : _this$depthStencilAtt.resize({
177
- width,
178
- height
179
- });
86
+ if (this.depthStencilAttachment) {
87
+ this.depthStencilAttachment.resize({
88
+ width,
89
+ height
90
+ });
91
+ }
180
92
  return this;
181
93
  }
182
-
183
94
  _attachOne(attachmentPoint, attachment) {
184
- if (attachment instanceof Renderbuffer) {
185
- this._attachRenderbuffer(attachmentPoint, attachment);
186
-
95
+ if (attachment instanceof WEBGLRenderbuffer) {
96
+ this._attachWEBGLRenderbuffer(attachmentPoint, attachment);
187
97
  return attachment;
188
98
  } else if (Array.isArray(attachment)) {
189
99
  const [texture, layer = 0, level = 0] = attachment;
190
-
191
100
  this._attachTexture(attachmentPoint, texture, layer, level);
192
-
193
101
  return texture;
194
- } else if (attachment instanceof WebGLTexture) {
102
+ } else if (attachment instanceof WEBGLTexture) {
195
103
  this._attachTexture(attachmentPoint, attachment, 0, 0);
196
-
197
104
  return attachment;
198
105
  }
106
+ throw new Error('attach');
199
107
  }
200
-
201
- _attachRenderbuffer(attachment, renderbuffer) {
108
+ _attachWEBGLRenderbuffer(attachment, renderbuffer) {
202
109
  this.gl.framebufferRenderbuffer(GL.FRAMEBUFFER, attachment, GL.RENDERBUFFER, renderbuffer.handle);
203
110
  }
204
-
205
111
  _attachTexture(attachment, texture, layer, level) {
206
112
  const {
207
113
  gl,
208
114
  gl2
209
115
  } = this.device;
210
116
  gl.bindTexture(texture.target, texture.handle);
211
-
212
117
  switch (texture.target) {
213
118
  case GL.TEXTURE_2D_ARRAY:
214
119
  case GL.TEXTURE_3D:
215
120
  this.device.assertWebGL2();
216
- gl2.framebufferTextureLayer(GL.FRAMEBUFFER, attachment, texture.target, level, layer);
121
+ gl2 === null || gl2 === void 0 ? void 0 : gl2.framebufferTextureLayer(GL.FRAMEBUFFER, attachment, texture.target, level, layer);
217
122
  break;
218
-
219
123
  case GL.TEXTURE_CUBE_MAP:
220
124
  const face = mapIndexToCubeMapFace(layer);
221
125
  gl.framebufferTexture2D(GL.FRAMEBUFFER, attachment, face, texture.handle, level);
222
126
  break;
223
-
224
127
  case GL.TEXTURE_2D:
225
128
  gl.framebufferTexture2D(GL.FRAMEBUFFER, attachment, GL.TEXTURE_2D, texture.handle, level);
226
129
  break;
227
-
228
130
  default:
229
131
  assert(false, 'Illegal texture type');
230
132
  }
231
-
232
133
  gl.bindTexture(texture.target, null);
233
134
  }
234
-
235
135
  }
236
-
237
136
  function mapIndexToCubeMapFace(layer) {
238
137
  return layer < GL.TEXTURE_CUBE_MAP_POSITIVE_X ? layer + GL.TEXTURE_CUBE_MAP_POSITIVE_X : layer;
239
138
  }
240
-
241
139
  function _getFrameBufferStatus(status) {
242
140
  switch (status) {
243
141
  case GL.FRAMEBUFFER_COMPLETE:
244
142
  return 'success';
245
-
246
143
  case GL.FRAMEBUFFER_INCOMPLETE_ATTACHMENT:
247
144
  return 'Mismatched attachments';
248
-
249
145
  case GL.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT:
250
146
  return 'No attachments';
251
-
252
147
  case GL.FRAMEBUFFER_INCOMPLETE_DIMENSIONS:
253
148
  return 'Height/width mismatch';
254
-
255
149
  case GL.FRAMEBUFFER_UNSUPPORTED:
256
150
  return 'Unsupported or split attachments';
257
-
258
151
  case GL.FRAMEBUFFER_INCOMPLETE_MULTISAMPLE:
259
152
  return 'Samples mismatch';
260
-
261
153
  default:
262
154
  return "".concat(status);
263
155
  }