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

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 (500) 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/texture-formats.d.ts +31 -42
  11. package/dist/adapter/converters/texture-formats.d.ts.map +1 -1
  12. package/dist/adapter/converters/texture-formats.js +163 -178
  13. package/dist/adapter/converters/texture-formats.js.map +1 -1
  14. package/dist/adapter/converters/vertex-formats.d.ts +2 -2
  15. package/dist/adapter/converters/vertex-formats.d.ts.map +1 -1
  16. package/dist/adapter/converters/vertex-formats.js +3 -9
  17. package/dist/adapter/converters/vertex-formats.js.map +1 -1
  18. package/dist/adapter/device-helpers/device-features.d.ts +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.d.ts +3 -3
  23. package/dist/adapter/device-helpers/device-limits.d.ts.map +1 -1
  24. package/dist/adapter/device-helpers/device-limits.js +2 -5
  25. package/dist/adapter/device-helpers/device-limits.js.map +1 -1
  26. package/dist/adapter/device-helpers/get-device-info.d.ts +1 -1
  27. package/dist/adapter/device-helpers/get-device-info.d.ts.map +1 -1
  28. package/dist/adapter/device-helpers/get-device-info.js +9 -11
  29. package/dist/adapter/device-helpers/get-device-info.js.map +1 -1
  30. package/dist/adapter/device-helpers/is-old-ie.js +2 -1
  31. package/dist/adapter/device-helpers/is-old-ie.js.map +1 -1
  32. package/dist/adapter/helpers/attribute-utils.d.ts +4 -4
  33. package/dist/adapter/helpers/attribute-utils.d.ts.map +1 -1
  34. package/dist/adapter/helpers/attribute-utils.js +1 -18
  35. package/dist/adapter/helpers/attribute-utils.js.map +1 -1
  36. package/dist/adapter/helpers/get-shader-info.d.ts +9 -0
  37. package/dist/adapter/helpers/get-shader-info.d.ts.map +1 -0
  38. package/dist/adapter/helpers/get-shader-info.js +25 -0
  39. package/dist/adapter/helpers/get-shader-info.js.map +1 -0
  40. package/dist/adapter/helpers/get-shader-layout.d.ts +10 -7
  41. package/dist/adapter/helpers/get-shader-layout.d.ts.map +1 -1
  42. package/dist/adapter/helpers/get-shader-layout.js +101 -84
  43. package/dist/adapter/helpers/get-shader-layout.js.map +1 -1
  44. package/dist/adapter/helpers/parse-shader-compiler-log.d.ts +1 -1
  45. package/dist/adapter/helpers/parse-shader-compiler-log.d.ts.map +1 -1
  46. package/dist/adapter/helpers/parse-shader-compiler-log.js +0 -7
  47. package/dist/adapter/helpers/parse-shader-compiler-log.js.map +1 -1
  48. package/dist/adapter/helpers/set-uniform.d.ts +2 -2
  49. package/dist/adapter/helpers/set-uniform.d.ts.map +1 -1
  50. package/dist/adapter/helpers/set-uniform.js +3 -33
  51. package/dist/adapter/helpers/set-uniform.js.map +1 -1
  52. package/dist/adapter/helpers/uniforms.d.ts +9 -10
  53. package/dist/adapter/helpers/uniforms.d.ts.map +1 -1
  54. package/dist/adapter/helpers/uniforms.js +8 -18
  55. package/dist/adapter/helpers/uniforms.js.map +1 -1
  56. package/dist/adapter/objects/constants-to-keys.d.ts +1 -3
  57. package/dist/adapter/objects/constants-to-keys.d.ts.map +1 -1
  58. package/dist/adapter/objects/constants-to-keys.js +1 -28
  59. package/dist/adapter/objects/constants-to-keys.js.map +1 -1
  60. package/dist/adapter/objects/webgl-renderbuffer.d.ts +15 -12
  61. package/dist/adapter/objects/webgl-renderbuffer.d.ts.map +1 -1
  62. package/dist/adapter/objects/webgl-renderbuffer.js +35 -41
  63. package/dist/adapter/objects/webgl-renderbuffer.js.map +1 -1
  64. package/dist/adapter/objects/webgl-resource.d.ts +6 -9
  65. package/dist/adapter/objects/webgl-resource.d.ts.map +1 -1
  66. package/dist/adapter/objects/webgl-resource.js +19 -75
  67. package/dist/adapter/objects/webgl-resource.js.map +1 -1
  68. package/dist/adapter/objects/webgl-vertex-array-object.d.ts +38 -11
  69. package/dist/adapter/objects/webgl-vertex-array-object.d.ts.map +1 -1
  70. package/dist/adapter/objects/webgl-vertex-array-object.js +122 -32
  71. package/dist/adapter/objects/webgl-vertex-array-object.js.map +1 -1
  72. package/dist/adapter/resources/webgl-buffer.d.ts +18 -10
  73. package/dist/adapter/resources/webgl-buffer.d.ts.map +1 -1
  74. package/dist/adapter/resources/webgl-buffer.js +43 -71
  75. package/dist/adapter/resources/webgl-buffer.js.map +1 -1
  76. package/dist/adapter/resources/webgl-command-buffer.d.ts +15 -9
  77. package/dist/adapter/resources/webgl-command-buffer.d.ts.map +1 -1
  78. package/dist/adapter/resources/webgl-command-buffer.js +169 -41
  79. package/dist/adapter/resources/webgl-command-buffer.js.map +1 -1
  80. package/dist/adapter/resources/webgl-command-encoder.d.ts +7 -6
  81. package/dist/adapter/resources/webgl-command-encoder.d.ts.map +1 -1
  82. package/dist/adapter/resources/webgl-command-encoder.js +8 -17
  83. package/dist/adapter/resources/webgl-command-encoder.js.map +1 -1
  84. package/dist/adapter/resources/webgl-external-texture.js.map +1 -1
  85. package/dist/adapter/resources/webgl-framebuffer.d.ts +21 -24
  86. package/dist/adapter/resources/webgl-framebuffer.d.ts.map +1 -1
  87. package/dist/adapter/resources/webgl-framebuffer.js +41 -149
  88. package/dist/adapter/resources/webgl-framebuffer.js.map +1 -1
  89. package/dist/adapter/resources/webgl-render-pass.d.ts +19 -4
  90. package/dist/adapter/resources/webgl-render-pass.d.ts.map +1 -1
  91. package/dist/adapter/resources/webgl-render-pass.js +88 -9
  92. package/dist/adapter/resources/webgl-render-pass.js.map +1 -1
  93. package/dist/adapter/resources/webgl-render-pipeline.d.ts +44 -11
  94. package/dist/adapter/resources/webgl-render-pipeline.d.ts.map +1 -1
  95. package/dist/adapter/resources/webgl-render-pipeline.js +90 -152
  96. package/dist/adapter/resources/webgl-render-pipeline.js.map +1 -1
  97. package/dist/adapter/resources/webgl-sampler.d.ts +6 -5
  98. package/dist/adapter/resources/webgl-sampler.d.ts.map +1 -1
  99. package/dist/adapter/resources/webgl-sampler.js +7 -15
  100. package/dist/adapter/resources/webgl-sampler.js.map +1 -1
  101. package/dist/adapter/resources/webgl-shader.d.ts +3 -4
  102. package/dist/adapter/resources/webgl-shader.d.ts.map +1 -1
  103. package/dist/adapter/resources/webgl-shader.js +9 -22
  104. package/dist/adapter/resources/webgl-shader.js.map +1 -1
  105. package/dist/adapter/resources/webgl-texture.d.ts +64 -44
  106. package/dist/adapter/resources/webgl-texture.d.ts.map +1 -1
  107. package/dist/adapter/resources/webgl-texture.js +98 -213
  108. package/dist/adapter/resources/webgl-texture.js.map +1 -1
  109. package/dist/adapter/webgl-canvas-context.d.ts +6 -7
  110. package/dist/adapter/webgl-canvas-context.d.ts.map +1 -1
  111. package/dist/adapter/webgl-canvas-context.js +8 -20
  112. package/dist/adapter/webgl-canvas-context.js.map +1 -1
  113. package/dist/adapter/webgl-device.d.ts +64 -41
  114. package/dist/adapter/webgl-device.d.ts.map +1 -1
  115. package/dist/adapter/webgl-device.js +133 -113
  116. package/dist/adapter/webgl-device.js.map +1 -1
  117. package/dist/classic/accessor.d.ts +3 -3
  118. package/dist/classic/accessor.d.ts.map +1 -1
  119. package/dist/classic/accessor.js +14 -38
  120. package/dist/classic/accessor.js.map +1 -1
  121. package/dist/classic/{buffer.d.ts → buffer-with-accessor.d.ts} +16 -28
  122. package/dist/classic/buffer-with-accessor.d.ts.map +1 -0
  123. package/dist/classic/{buffer.js → buffer-with-accessor.js} +54 -122
  124. package/dist/classic/buffer-with-accessor.js.map +1 -0
  125. package/dist/classic/clear.d.ts +22 -0
  126. package/dist/classic/clear.d.ts.map +1 -0
  127. package/dist/classic/clear.js +88 -0
  128. package/dist/classic/clear.js.map +1 -0
  129. package/dist/classic/copy-and-blit.d.ts +62 -0
  130. package/dist/classic/copy-and-blit.d.ts.map +1 -0
  131. package/dist/classic/copy-and-blit.js +202 -0
  132. package/dist/classic/copy-and-blit.js.map +1 -0
  133. package/dist/classic/format-utils.d.ts +3 -0
  134. package/dist/classic/format-utils.d.ts.map +1 -0
  135. package/dist/classic/format-utils.js +38 -0
  136. package/dist/classic/format-utils.js.map +1 -0
  137. package/dist/classic/typed-array-utils.d.ts +15 -17
  138. package/dist/classic/typed-array-utils.d.ts.map +1 -1
  139. package/dist/classic/typed-array-utils.js +1 -21
  140. package/dist/classic/typed-array-utils.js.map +1 -1
  141. package/dist/context/context/create-browser-context.d.ts +40 -0
  142. package/dist/context/context/create-browser-context.d.ts.map +1 -0
  143. package/dist/{esm/context/context/create-context.js → context/context/create-browser-context.js} +23 -19
  144. package/dist/context/context/create-browser-context.js.map +1 -0
  145. package/dist/context/context/create-headless-context.d.ts +9 -0
  146. package/dist/context/context/create-headless-context.d.ts.map +1 -0
  147. package/dist/context/context/create-headless-context.js +42 -0
  148. package/dist/context/context/create-headless-context.js.map +1 -0
  149. package/dist/context/context/webgl-checks.js +1 -4
  150. package/dist/context/context/webgl-checks.js.map +1 -1
  151. package/dist/context/debug/spector.d.ts +1 -2
  152. package/dist/context/debug/spector.d.ts.map +1 -1
  153. package/dist/context/debug/spector.js +8 -20
  154. package/dist/context/debug/spector.js.map +1 -1
  155. package/dist/context/debug/webgl-developer-tools.d.ts +2 -2
  156. package/dist/context/debug/webgl-developer-tools.d.ts.map +1 -1
  157. package/dist/context/debug/webgl-developer-tools.js +11 -34
  158. package/dist/context/debug/webgl-developer-tools.js.map +1 -1
  159. package/dist/context/parameters/unified-parameter-api.d.ts +8 -7
  160. package/dist/context/parameters/unified-parameter-api.d.ts.map +1 -1
  161. package/dist/context/parameters/unified-parameter-api.js +8 -18
  162. package/dist/context/parameters/unified-parameter-api.js.map +1 -1
  163. package/dist/context/parameters/webgl-parameter-tables.d.ts +105 -106
  164. package/dist/context/parameters/webgl-parameter-tables.d.ts.map +1 -1
  165. package/dist/context/parameters/webgl-parameter-tables.js +18 -36
  166. package/dist/context/parameters/webgl-parameter-tables.js.map +1 -1
  167. package/dist/context/polyfill/context-data.d.ts +13 -0
  168. package/dist/context/polyfill/context-data.d.ts.map +1 -0
  169. package/dist/context/polyfill/context-data.js +12 -0
  170. package/dist/context/polyfill/context-data.js.map +1 -0
  171. package/dist/context/polyfill/get-parameter-polyfill.d.ts +1 -1
  172. package/dist/context/polyfill/get-parameter-polyfill.d.ts.map +1 -1
  173. package/dist/context/polyfill/get-parameter-polyfill.js +4 -9
  174. package/dist/context/polyfill/get-parameter-polyfill.js.map +1 -1
  175. package/dist/context/polyfill/polyfill-context.js +21 -29
  176. package/dist/context/polyfill/polyfill-context.js.map +1 -1
  177. package/dist/context/polyfill/polyfill-table.d.ts +8 -8
  178. package/dist/context/polyfill/polyfill-table.d.ts.map +1 -1
  179. package/dist/context/polyfill/polyfill-table.js +10 -32
  180. package/dist/context/polyfill/polyfill-table.js.map +1 -1
  181. package/dist/context/polyfill/polyfill-vertex-array-object.d.ts.map +1 -1
  182. package/dist/context/polyfill/polyfill-vertex-array-object.js +0 -70
  183. package/dist/context/polyfill/polyfill-vertex-array-object.js.map +1 -1
  184. package/dist/context/state-tracker/deep-array-equal.js +0 -4
  185. package/dist/context/state-tracker/deep-array-equal.js.map +1 -1
  186. package/dist/context/state-tracker/track-context-state.d.ts.map +1 -1
  187. package/dist/context/state-tracker/track-context-state.js +16 -51
  188. package/dist/context/state-tracker/track-context-state.js.map +1 -1
  189. package/dist/context/state-tracker/with-parameters.d.ts +2 -1
  190. package/dist/context/state-tracker/with-parameters.d.ts.map +1 -1
  191. package/dist/context/state-tracker/with-parameters.js +7 -9
  192. package/dist/context/state-tracker/with-parameters.js.map +1 -1
  193. package/dist/dist.dev.js +10158 -0
  194. package/dist/index.cjs +6604 -0
  195. package/dist/index.d.ts +25 -22
  196. package/dist/index.d.ts.map +1 -1
  197. package/dist/index.js +27 -26
  198. package/dist/index.js.map +1 -1
  199. package/dist/types.d.ts +1 -1
  200. package/dist/types.d.ts.map +1 -1
  201. package/dist/types.js.map +1 -1
  202. package/dist.min.js +37 -0
  203. package/package.json +21 -9
  204. package/src/adapter/converters/device-parameters.ts +88 -35
  205. package/src/adapter/converters/sampler-parameters.ts +19 -9
  206. package/src/adapter/converters/texture-formats.ts +261 -178
  207. package/src/adapter/converters/vertex-formats.ts +3 -2
  208. package/src/adapter/device-helpers/device-features.ts +10 -3
  209. package/src/adapter/device-helpers/device-limits.ts +3 -3
  210. package/src/adapter/device-helpers/get-device-info.ts +14 -10
  211. package/src/adapter/helpers/attribute-utils.ts +4 -5
  212. package/src/adapter/helpers/get-shader-info.ts +40 -0
  213. package/src/adapter/helpers/get-shader-layout.ts +150 -68
  214. package/src/adapter/helpers/parse-shader-compiler-log.ts +2 -2
  215. package/src/adapter/helpers/set-uniform.ts +7 -6
  216. package/src/adapter/helpers/uniforms.ts +23 -13
  217. package/src/adapter/objects/constants-to-keys.ts +3 -25
  218. package/src/adapter/objects/webgl-renderbuffer.ts +40 -37
  219. package/src/adapter/objects/webgl-resource.ts +14 -23
  220. package/src/adapter/objects/webgl-vertex-array-object.ts +201 -37
  221. package/src/adapter/resources/webgl-buffer.ts +56 -58
  222. package/src/adapter/resources/webgl-command-buffer.ts +332 -25
  223. package/src/adapter/resources/webgl-command-encoder.ts +16 -11
  224. package/src/adapter/resources/webgl-external-texture.ts +2 -2
  225. package/src/adapter/resources/webgl-framebuffer.ts +88 -133
  226. package/src/adapter/resources/webgl-render-pass.ts +155 -4
  227. package/src/adapter/resources/webgl-render-pipeline.ts +161 -104
  228. package/src/adapter/resources/webgl-sampler.ts +13 -8
  229. package/src/adapter/resources/webgl-shader.ts +11 -10
  230. package/src/adapter/resources/webgl-texture.ts +113 -85
  231. package/src/adapter/webgl-canvas-context.ts +14 -14
  232. package/src/adapter/webgl-device.ts +192 -77
  233. package/src/classic/accessor.ts +4 -17
  234. package/src/classic/{buffer.ts → buffer-with-accessor.ts} +67 -75
  235. package/src/classic/clear.ts +110 -0
  236. package/src/classic/copy-and-blit.ts +308 -0
  237. package/src/classic/format-utils.ts +43 -0
  238. package/src/classic/typed-array-utils.ts +18 -27
  239. package/src/context/context/{create-context.ts → create-browser-context.ts} +48 -31
  240. package/src/context/context/create-headless-context.ts +48 -0
  241. package/src/context/context/webgl-checks.ts +1 -1
  242. package/src/context/debug/spector.ts +7 -6
  243. package/src/context/debug/webgl-developer-tools.ts +21 -15
  244. package/src/context/parameters/unified-parameter-api.ts +20 -14
  245. package/src/context/parameters/webgl-parameter-tables.ts +117 -98
  246. package/src/context/polyfill/context-data.ts +27 -0
  247. package/src/context/polyfill/get-parameter-polyfill.ts +8 -7
  248. package/src/context/polyfill/polyfill-context.ts +7 -9
  249. package/src/context/polyfill/polyfill-table.ts +18 -16
  250. package/src/context/polyfill/polyfill-vertex-array-object.ts +2 -0
  251. package/src/context/state-tracker/track-context-state.ts +14 -13
  252. package/src/context/state-tracker/with-parameters.ts +8 -2
  253. package/src/index.ts +42 -33
  254. package/dist/adapter/converters/renderbuffer-formats.d.ts +0 -16
  255. package/dist/adapter/converters/renderbuffer-formats.d.ts.map +0 -1
  256. package/dist/adapter/converters/renderbuffer-formats.js +0 -185
  257. package/dist/adapter/converters/renderbuffer-formats.js.map +0 -1
  258. package/dist/bundle.d.ts +0 -2
  259. package/dist/bundle.d.ts.map +0 -1
  260. package/dist/bundle.js +0 -5
  261. package/dist/bundle.js.map +0 -1
  262. package/dist/classic/buffer.d.ts.map +0 -1
  263. package/dist/classic/buffer.js.map +0 -1
  264. package/dist/context/context/context-state.d.ts +0 -18
  265. package/dist/context/context/context-state.d.ts.map +0 -1
  266. package/dist/context/context/context-state.js +0 -26
  267. package/dist/context/context/context-state.js.map +0 -1
  268. package/dist/context/context/create-context.d.ts +0 -41
  269. package/dist/context/context/create-context.d.ts.map +0 -1
  270. package/dist/context/context/create-context.js +0 -49
  271. package/dist/context/context/create-context.js.map +0 -1
  272. package/dist/context/context/device-pixels.d.ts +0 -25
  273. package/dist/context/context/device-pixels.d.ts.map +0 -1
  274. package/dist/context/context/device-pixels.js +0 -98
  275. package/dist/context/context/device-pixels.js.map +0 -1
  276. package/dist/es5/adapter/converters/device-parameters.js +0 -170
  277. package/dist/es5/adapter/converters/device-parameters.js.map +0 -1
  278. package/dist/es5/adapter/converters/renderbuffer-formats.js +0 -163
  279. package/dist/es5/adapter/converters/renderbuffer-formats.js.map +0 -1
  280. package/dist/es5/adapter/converters/sampler-parameters.js +0 -226
  281. package/dist/es5/adapter/converters/sampler-parameters.js.map +0 -1
  282. package/dist/es5/adapter/converters/texture-formats.js +0 -1031
  283. package/dist/es5/adapter/converters/texture-formats.js.map +0 -1
  284. package/dist/es5/adapter/converters/vertex-formats.js +0 -45
  285. package/dist/es5/adapter/converters/vertex-formats.js.map +0 -1
  286. package/dist/es5/adapter/device-helpers/device-features.js +0 -144
  287. package/dist/es5/adapter/device-helpers/device-features.js.map +0 -1
  288. package/dist/es5/adapter/device-helpers/device-limits.js +0 -64
  289. package/dist/es5/adapter/device-helpers/device-limits.js.map +0 -1
  290. package/dist/es5/adapter/device-helpers/get-device-info.js +0 -55
  291. package/dist/es5/adapter/device-helpers/get-device-info.js.map +0 -1
  292. package/dist/es5/adapter/device-helpers/is-old-ie.js +0 -16
  293. package/dist/es5/adapter/device-helpers/is-old-ie.js.map +0 -1
  294. package/dist/es5/adapter/helpers/attribute-utils.js +0 -91
  295. package/dist/es5/adapter/helpers/attribute-utils.js.map +0 -1
  296. package/dist/es5/adapter/helpers/get-shader-layout.js +0 -371
  297. package/dist/es5/adapter/helpers/get-shader-layout.js.map +0 -1
  298. package/dist/es5/adapter/helpers/parse-shader-compiler-log.js +0 -72
  299. package/dist/es5/adapter/helpers/parse-shader-compiler-log.js.map +0 -1
  300. package/dist/es5/adapter/helpers/set-uniform.js +0 -125
  301. package/dist/es5/adapter/helpers/set-uniform.js.map +0 -1
  302. package/dist/es5/adapter/helpers/uniforms.js +0 -112
  303. package/dist/es5/adapter/helpers/uniforms.js.map +0 -1
  304. package/dist/es5/adapter/objects/constants-to-keys.js +0 -54
  305. package/dist/es5/adapter/objects/constants-to-keys.js.map +0 -1
  306. package/dist/es5/adapter/objects/webgl-renderbuffer.js +0 -150
  307. package/dist/es5/adapter/objects/webgl-renderbuffer.js.map +0 -1
  308. package/dist/es5/adapter/objects/webgl-resource.js +0 -292
  309. package/dist/es5/adapter/objects/webgl-resource.js.map +0 -1
  310. package/dist/es5/adapter/objects/webgl-vertex-array-object.js +0 -137
  311. package/dist/es5/adapter/objects/webgl-vertex-array-object.js.map +0 -1
  312. package/dist/es5/adapter/resources/webgl-buffer.js +0 -243
  313. package/dist/es5/adapter/resources/webgl-buffer.js.map +0 -1
  314. package/dist/es5/adapter/resources/webgl-command-buffer.js +0 -96
  315. package/dist/es5/adapter/resources/webgl-command-buffer.js.map +0 -1
  316. package/dist/es5/adapter/resources/webgl-command-encoder.js +0 -98
  317. package/dist/es5/adapter/resources/webgl-command-encoder.js.map +0 -1
  318. package/dist/es5/adapter/resources/webgl-external-texture.js +0 -2
  319. package/dist/es5/adapter/resources/webgl-external-texture.js.map +0 -1
  320. package/dist/es5/adapter/resources/webgl-framebuffer.js +0 -345
  321. package/dist/es5/adapter/resources/webgl-framebuffer.js.map +0 -1
  322. package/dist/es5/adapter/resources/webgl-render-pass.js +0 -61
  323. package/dist/es5/adapter/resources/webgl-render-pass.js.map +0 -1
  324. package/dist/es5/adapter/resources/webgl-render-pipeline.js +0 -505
  325. package/dist/es5/adapter/resources/webgl-render-pipeline.js.map +0 -1
  326. package/dist/es5/adapter/resources/webgl-sampler.js +0 -96
  327. package/dist/es5/adapter/resources/webgl-sampler.js.map +0 -1
  328. package/dist/es5/adapter/resources/webgl-shader.js +0 -149
  329. package/dist/es5/adapter/resources/webgl-shader.js.map +0 -1
  330. package/dist/es5/adapter/resources/webgl-texture.js +0 -986
  331. package/dist/es5/adapter/resources/webgl-texture.js.map +0 -1
  332. package/dist/es5/adapter/webgl-canvas-context.js +0 -97
  333. package/dist/es5/adapter/webgl-canvas-context.js.map +0 -1
  334. package/dist/es5/adapter/webgl-device.js +0 -399
  335. package/dist/es5/adapter/webgl-device.js.map +0 -1
  336. package/dist/es5/bundle.js +0 -7
  337. package/dist/es5/bundle.js.map +0 -1
  338. package/dist/es5/classic/accessor.js +0 -181
  339. package/dist/es5/classic/accessor.js.map +0 -1
  340. package/dist/es5/classic/buffer.js +0 -470
  341. package/dist/es5/classic/buffer.js.map +0 -1
  342. package/dist/es5/classic/typed-array-utils.js +0 -126
  343. package/dist/es5/classic/typed-array-utils.js.map +0 -1
  344. package/dist/es5/context/context/context-state.js +0 -31
  345. package/dist/es5/context/context/context-state.js.map +0 -1
  346. package/dist/es5/context/context/create-context.js +0 -69
  347. package/dist/es5/context/context/create-context.js.map +0 -1
  348. package/dist/es5/context/context/device-pixels.js +0 -115
  349. package/dist/es5/context/context/device-pixels.js.map +0 -1
  350. package/dist/es5/context/context/webgl-checks.js +0 -54
  351. package/dist/es5/context/context/webgl-checks.js.map +0 -1
  352. package/dist/es5/context/debug/spector.js +0 -133
  353. package/dist/es5/context/debug/spector.js.map +0 -1
  354. package/dist/es5/context/debug/webgl-developer-tools.js +0 -198
  355. package/dist/es5/context/debug/webgl-developer-tools.js.map +0 -1
  356. package/dist/es5/context/parameters/unified-parameter-api.js +0 -97
  357. package/dist/es5/context/parameters/unified-parameter-api.js.map +0 -1
  358. package/dist/es5/context/parameters/webgl-parameter-tables.js +0 -392
  359. package/dist/es5/context/parameters/webgl-parameter-tables.js.map +0 -1
  360. package/dist/es5/context/polyfill/get-parameter-polyfill.js +0 -81
  361. package/dist/es5/context/polyfill/get-parameter-polyfill.js.map +0 -1
  362. package/dist/es5/context/polyfill/polyfill-context.js +0 -135
  363. package/dist/es5/context/polyfill/polyfill-context.js.map +0 -1
  364. package/dist/es5/context/polyfill/polyfill-table.js +0 -166
  365. package/dist/es5/context/polyfill/polyfill-table.js.map +0 -1
  366. package/dist/es5/context/polyfill/polyfill-vertex-array-object.js +0 -341
  367. package/dist/es5/context/polyfill/polyfill-vertex-array-object.js.map +0 -1
  368. package/dist/es5/context/state-tracker/deep-array-equal.js +0 -28
  369. package/dist/es5/context/state-tracker/deep-array-equal.js.map +0 -1
  370. package/dist/es5/context/state-tracker/track-context-state.js +0 -211
  371. package/dist/es5/context/state-tracker/track-context-state.js.map +0 -1
  372. package/dist/es5/context/state-tracker/with-parameters.js +0 -44
  373. package/dist/es5/context/state-tracker/with-parameters.js.map +0 -1
  374. package/dist/es5/index.js +0 -276
  375. package/dist/es5/index.js.map +0 -1
  376. package/dist/es5/init.js +0 -10
  377. package/dist/es5/init.js.map +0 -1
  378. package/dist/es5/types/webgl.js +0 -6
  379. package/dist/es5/types/webgl.js.map +0 -1
  380. package/dist/es5/types.js +0 -2
  381. package/dist/es5/types.js.map +0 -1
  382. package/dist/esm/adapter/converters/device-parameters.js +0 -155
  383. package/dist/esm/adapter/converters/device-parameters.js.map +0 -1
  384. package/dist/esm/adapter/converters/renderbuffer-formats.js +0 -185
  385. package/dist/esm/adapter/converters/renderbuffer-formats.js.map +0 -1
  386. package/dist/esm/adapter/converters/sampler-parameters.js +0 -208
  387. package/dist/esm/adapter/converters/sampler-parameters.js.map +0 -1
  388. package/dist/esm/adapter/converters/texture-formats.js +0 -954
  389. package/dist/esm/adapter/converters/texture-formats.js.map +0 -1
  390. package/dist/esm/adapter/converters/vertex-formats.js +0 -35
  391. package/dist/esm/adapter/converters/vertex-formats.js.map +0 -1
  392. package/dist/esm/adapter/device-helpers/device-features.js +0 -102
  393. package/dist/esm/adapter/device-helpers/device-features.js.map +0 -1
  394. package/dist/esm/adapter/device-helpers/device-limits.js +0 -91
  395. package/dist/esm/adapter/device-helpers/device-limits.js.map +0 -1
  396. package/dist/esm/adapter/device-helpers/get-device-info.js +0 -44
  397. package/dist/esm/adapter/device-helpers/get-device-info.js.map +0 -1
  398. package/dist/esm/adapter/device-helpers/is-old-ie.js +0 -8
  399. package/dist/esm/adapter/device-helpers/is-old-ie.js.map +0 -1
  400. package/dist/esm/adapter/helpers/attribute-utils.js +0 -81
  401. package/dist/esm/adapter/helpers/attribute-utils.js.map +0 -1
  402. package/dist/esm/adapter/helpers/get-shader-layout.js +0 -306
  403. package/dist/esm/adapter/helpers/get-shader-layout.js.map +0 -1
  404. package/dist/esm/adapter/helpers/parse-shader-compiler-log.js +0 -37
  405. package/dist/esm/adapter/helpers/parse-shader-compiler-log.js.map +0 -1
  406. package/dist/esm/adapter/helpers/set-uniform.js +0 -115
  407. package/dist/esm/adapter/helpers/set-uniform.js.map +0 -1
  408. package/dist/esm/adapter/helpers/uniforms.js +0 -99
  409. package/dist/esm/adapter/helpers/uniforms.js.map +0 -1
  410. package/dist/esm/adapter/objects/constants-to-keys.js +0 -42
  411. package/dist/esm/adapter/objects/constants-to-keys.js.map +0 -1
  412. package/dist/esm/adapter/objects/webgl-renderbuffer.js +0 -94
  413. package/dist/esm/adapter/objects/webgl-renderbuffer.js.map +0 -1
  414. package/dist/esm/adapter/objects/webgl-resource.js +0 -216
  415. package/dist/esm/adapter/objects/webgl-resource.js.map +0 -1
  416. package/dist/esm/adapter/objects/webgl-vertex-array-object.js +0 -84
  417. package/dist/esm/adapter/objects/webgl-vertex-array-object.js.map +0 -1
  418. package/dist/esm/adapter/resources/webgl-buffer.js +0 -164
  419. package/dist/esm/adapter/resources/webgl-buffer.js.map +0 -1
  420. package/dist/esm/adapter/resources/webgl-command-buffer.js +0 -65
  421. package/dist/esm/adapter/resources/webgl-command-buffer.js.map +0 -1
  422. package/dist/esm/adapter/resources/webgl-command-encoder.js +0 -53
  423. package/dist/esm/adapter/resources/webgl-command-encoder.js.map +0 -1
  424. package/dist/esm/adapter/resources/webgl-external-texture.js +0 -2
  425. package/dist/esm/adapter/resources/webgl-external-texture.js.map +0 -1
  426. package/dist/esm/adapter/resources/webgl-framebuffer.js +0 -265
  427. package/dist/esm/adapter/resources/webgl-framebuffer.js.map +0 -1
  428. package/dist/esm/adapter/resources/webgl-render-pass.js +0 -19
  429. package/dist/esm/adapter/resources/webgl-render-pass.js.map +0 -1
  430. package/dist/esm/adapter/resources/webgl-render-pipeline.js +0 -400
  431. package/dist/esm/adapter/resources/webgl-render-pipeline.js.map +0 -1
  432. package/dist/esm/adapter/resources/webgl-sampler.js +0 -50
  433. package/dist/esm/adapter/resources/webgl-sampler.js.map +0 -1
  434. package/dist/esm/adapter/resources/webgl-shader.js +0 -75
  435. package/dist/esm/adapter/resources/webgl-shader.js.map +0 -1
  436. package/dist/esm/adapter/resources/webgl-texture.js +0 -831
  437. package/dist/esm/adapter/resources/webgl-texture.js.map +0 -1
  438. package/dist/esm/adapter/webgl-canvas-context.js +0 -54
  439. package/dist/esm/adapter/webgl-canvas-context.js.map +0 -1
  440. package/dist/esm/adapter/webgl-device.js +0 -280
  441. package/dist/esm/adapter/webgl-device.js.map +0 -1
  442. package/dist/esm/bundle.js +0 -5
  443. package/dist/esm/bundle.js.map +0 -1
  444. package/dist/esm/classic/accessor.js +0 -144
  445. package/dist/esm/classic/accessor.js.map +0 -1
  446. package/dist/esm/classic/buffer.js +0 -384
  447. package/dist/esm/classic/buffer.js.map +0 -1
  448. package/dist/esm/classic/typed-array-utils.js +0 -112
  449. package/dist/esm/classic/typed-array-utils.js.map +0 -1
  450. package/dist/esm/context/context/context-state.js +0 -26
  451. package/dist/esm/context/context/context-state.js.map +0 -1
  452. package/dist/esm/context/context/create-context.js.map +0 -1
  453. package/dist/esm/context/context/device-pixels.js +0 -98
  454. package/dist/esm/context/context/device-pixels.js.map +0 -1
  455. package/dist/esm/context/context/webgl-checks.js +0 -34
  456. package/dist/esm/context/context/webgl-checks.js.map +0 -1
  457. package/dist/esm/context/debug/spector.js +0 -76
  458. package/dist/esm/context/debug/spector.js.map +0 -1
  459. package/dist/esm/context/debug/webgl-developer-tools.js +0 -121
  460. package/dist/esm/context/debug/webgl-developer-tools.js.map +0 -1
  461. package/dist/esm/context/parameters/unified-parameter-api.js +0 -65
  462. package/dist/esm/context/parameters/unified-parameter-api.js.map +0 -1
  463. package/dist/esm/context/parameters/webgl-parameter-tables.js +0 -445
  464. package/dist/esm/context/parameters/webgl-parameter-tables.js.map +0 -1
  465. package/dist/esm/context/polyfill/get-parameter-polyfill.js +0 -91
  466. package/dist/esm/context/polyfill/get-parameter-polyfill.js.map +0 -1
  467. package/dist/esm/context/polyfill/polyfill-context.js +0 -92
  468. package/dist/esm/context/polyfill/polyfill-context.js.map +0 -1
  469. package/dist/esm/context/polyfill/polyfill-table.js +0 -160
  470. package/dist/esm/context/polyfill/polyfill-table.js.map +0 -1
  471. package/dist/esm/context/polyfill/polyfill-vertex-array-object.js +0 -335
  472. package/dist/esm/context/polyfill/polyfill-vertex-array-object.js.map +0 -1
  473. package/dist/esm/context/state-tracker/deep-array-equal.js +0 -21
  474. package/dist/esm/context/state-tracker/deep-array-equal.js.map +0 -1
  475. package/dist/esm/context/state-tracker/track-context-state.js +0 -183
  476. package/dist/esm/context/state-tracker/track-context-state.js.map +0 -1
  477. package/dist/esm/context/state-tracker/with-parameters.js +0 -36
  478. package/dist/esm/context/state-tracker/with-parameters.js.map +0 -1
  479. package/dist/esm/index.js +0 -27
  480. package/dist/esm/index.js.map +0 -1
  481. package/dist/esm/init.js +0 -4
  482. package/dist/esm/init.js.map +0 -1
  483. package/dist/esm/types/webgl.js +0 -2
  484. package/dist/esm/types/webgl.js.map +0 -1
  485. package/dist/esm/types.js +0 -2
  486. package/dist/esm/types.js.map +0 -1
  487. package/dist/init.d.ts +0 -2
  488. package/dist/init.d.ts.map +0 -1
  489. package/dist/init.js +0 -4
  490. package/dist/init.js.map +0 -1
  491. package/dist/types/webgl.d.ts +0 -144
  492. package/dist/types/webgl.d.ts.map +0 -1
  493. package/dist/types/webgl.js +0 -2
  494. package/dist/types/webgl.js.map +0 -1
  495. package/src/adapter/converters/renderbuffer-formats.ts +0 -92
  496. package/src/bundle.ts +0 -4
  497. package/src/context/context/context-state.ts +0 -41
  498. package/src/context/context/device-pixels.ts +0 -152
  499. package/src/init.ts +0 -4
  500. package/src/types/webgl.ts +0 -283
@@ -1,52 +1,43 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
- import GL from '@luma.gl/constants';
3
-
2
+ import { CommandBuffer, Texture } from '@luma.gl/core';
3
+ import { GL } from '@luma.gl/constants';
4
+ import { WEBGLTexture } from "./webgl-texture.js";
4
5
  function cast(value) {
5
6
  return value;
6
7
  }
7
-
8
- export default class CommandBuffer {
9
- constructor() {
8
+ export class WEBGLCommandBuffer extends CommandBuffer {
9
+ constructor(device) {
10
+ super({});
11
+ _defineProperty(this, "device", void 0);
10
12
  _defineProperty(this, "commands", []);
13
+ this.device = device;
11
14
  }
12
-
13
- }
14
- export function submitCommands(device, commands = []) {
15
- for (const command of commands) {
16
- switch (command.name) {
17
- case 'copy-buffer-to-buffer':
18
- _copyBufferToBuffer(device, command.options);
19
-
20
- break;
21
-
22
- case 'copy-buffer-to-texture':
23
- _copyBufferToTexture(device, command.options);
24
-
25
- break;
26
-
27
- case 'copy-texture-to-buffer':
28
- _copyTextureToBuffer(device, command.options);
29
-
30
- break;
31
-
32
- case 'copy-texture-to-texture':
33
- _copyTextureToTexture(device, command.options);
34
-
35
- break;
15
+ submitCommands() {
16
+ let commands = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.commands;
17
+ for (const command of commands) {
18
+ switch (command.name) {
19
+ case 'copy-buffer-to-buffer':
20
+ _copyBufferToBuffer(this.device, command.options);
21
+ break;
22
+ case 'copy-buffer-to-texture':
23
+ _copyBufferToTexture(this.device, command.options);
24
+ break;
25
+ case 'copy-texture-to-buffer':
26
+ _copyTextureToBuffer(this.device, command.options);
27
+ break;
28
+ case 'copy-texture-to-texture':
29
+ _copyTextureToTexture(this.device, command.options);
30
+ break;
31
+ }
36
32
  }
37
33
  }
38
34
  }
39
-
40
35
  function _copyBufferToBuffer(device, options) {
41
36
  const source = cast(options.source);
42
37
  const destination = cast(options.destination);
43
- const {
44
- gl2
45
- } = device;
46
-
38
+ const gl2 = device.assertWebGL2();
47
39
  if (gl2) {
48
40
  var _options$sourceOffset, _options$destinationO;
49
-
50
41
  gl2.bindBuffer(GL.COPY_READ_BUFFER, source.handle);
51
42
  gl2.bindBuffer(GL.COPY_WRITE_BUFFER, destination.handle);
52
43
  gl2.copyBufferSubData(GL.COPY_READ_BUFFER, GL.COPY_WRITE_BUFFER, (_options$sourceOffset = options.sourceOffset) !== null && _options$sourceOffset !== void 0 ? _options$sourceOffset : 0, (_options$destinationO = options.destinationOffset) !== null && _options$destinationO !== void 0 ? _options$destinationO : 0, options.size);
@@ -56,10 +47,147 @@ function _copyBufferToBuffer(device, options) {
56
47
  throw new Error('copyBufferToBuffer not implemented in WebGL1');
57
48
  }
58
49
  }
59
-
60
- function _copyBufferToTexture(device, options) {}
61
-
62
- function _copyTextureToBuffer(device, options) {}
63
-
64
- function _copyTextureToTexture(device, options) {}
50
+ function _copyBufferToTexture(device, options) {
51
+ throw new Error('Not implemented');
52
+ }
53
+ function _copyTextureToBuffer(device, options) {
54
+ const {
55
+ source,
56
+ mipLevel = 0,
57
+ aspect = 'all',
58
+ width = options.source.width,
59
+ height = options.source.height,
60
+ depthOrArrayLayers = 0,
61
+ origin = [0, 0],
62
+ destination,
63
+ byteOffset = 0,
64
+ bytesPerRow,
65
+ rowsPerImage
66
+ } = options;
67
+ if (aspect !== 'all') {
68
+ throw new Error('not supported');
69
+ }
70
+ if (mipLevel !== 0 || depthOrArrayLayers !== undefined || bytesPerRow || rowsPerImage) {
71
+ throw new Error('not implemented');
72
+ }
73
+ const gl2 = device.assertWebGL2();
74
+ const {
75
+ framebuffer,
76
+ destroyFramebuffer
77
+ } = getFramebuffer(source);
78
+ try {
79
+ const webglBuffer = destination;
80
+ const sourceWidth = width || framebuffer.width;
81
+ const sourceHeight = height || framebuffer.height;
82
+ const sourceFormat = GL.RGBA;
83
+ const sourceType = GL.UNSIGNED_BYTE;
84
+ gl2.bindBuffer(GL.PIXEL_PACK_BUFFER, webglBuffer.handle);
85
+ gl2.bindFramebuffer(GL.FRAMEBUFFER, framebuffer.handle);
86
+ gl2.readPixels(origin[0], origin[1], sourceWidth, sourceHeight, sourceFormat, sourceType, byteOffset);
87
+ } finally {
88
+ gl2.bindBuffer(GL.PIXEL_PACK_BUFFER, null);
89
+ gl2.bindFramebuffer(GL.FRAMEBUFFER, null);
90
+ if (destroyFramebuffer) {
91
+ framebuffer.destroy();
92
+ }
93
+ }
94
+ }
95
+ function _copyTextureToTexture(device, options) {
96
+ const {
97
+ source,
98
+ origin = [0, 0],
99
+ destination
100
+ } = options;
101
+ let {
102
+ width = options.destination.width,
103
+ height = options.destination.width
104
+ } = options;
105
+ const destinationMipmaplevel = 0;
106
+ const destinationInternalFormat = GL.RGBA;
107
+ const {
108
+ framebuffer,
109
+ destroyFramebuffer
110
+ } = getFramebuffer(source);
111
+ const [sourceX, sourceY] = origin;
112
+ const isSubCopy = false;
113
+ device.gl.bindFramebuffer(GL.FRAMEBUFFER, framebuffer.handle);
114
+ let texture = null;
115
+ let textureTarget;
116
+ if (destination instanceof WEBGLTexture) {
117
+ texture = destination;
118
+ width = Number.isFinite(width) ? width : texture.width;
119
+ height = Number.isFinite(height) ? height : texture.height;
120
+ texture.bind(0);
121
+ textureTarget = texture.destination;
122
+ } else {
123
+ throw new Error('whoops');
124
+ }
125
+ if (!isSubCopy) {
126
+ device.gl.copyTexImage2D(textureTarget, destinationMipmaplevel, destinationInternalFormat, sourceX, sourceY, width, height, 0);
127
+ } else {}
128
+ if (texture) {
129
+ texture.unbind();
130
+ }
131
+ device.gl.bindFramebuffer(GL.FRAMEBUFFER, prevHandle || null);
132
+ if (destroyFramebuffer) {
133
+ framebuffer.destroy();
134
+ }
135
+ return texture;
136
+ }
137
+ export function glFormatToComponents(format) {
138
+ switch (format) {
139
+ case GL.ALPHA:
140
+ case GL.R32F:
141
+ case GL.RED:
142
+ return 1;
143
+ case GL.RG32F:
144
+ case GL.RG:
145
+ return 2;
146
+ case GL.RGB:
147
+ case GL.RGB32F:
148
+ return 3;
149
+ case GL.RGBA:
150
+ case GL.RGBA32F:
151
+ return 4;
152
+ default:
153
+ throw new Error('GLFormat');
154
+ }
155
+ }
156
+ export function glTypeToBytes(type) {
157
+ switch (type) {
158
+ case GL.UNSIGNED_BYTE:
159
+ return 1;
160
+ case GL.UNSIGNED_SHORT_5_6_5:
161
+ case GL.UNSIGNED_SHORT_4_4_4_4:
162
+ case GL.UNSIGNED_SHORT_5_5_5_1:
163
+ return 2;
164
+ case GL.FLOAT:
165
+ return 4;
166
+ default:
167
+ throw new Error('GLType');
168
+ }
169
+ }
170
+ function getFramebuffer(source) {
171
+ if (source instanceof Texture) {
172
+ const {
173
+ width,
174
+ height,
175
+ id
176
+ } = source;
177
+ const framebuffer = source.device.createFramebuffer({
178
+ id: "framebuffer-for-".concat(id),
179
+ width,
180
+ height,
181
+ colorAttachments: [source]
182
+ });
183
+ return {
184
+ framebuffer,
185
+ destroyFramebuffer: true
186
+ };
187
+ }
188
+ return {
189
+ framebuffer: source,
190
+ destroyFramebuffer: false
191
+ };
192
+ }
65
193
  //# sourceMappingURL=webgl-command-buffer.js.map
@@ -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;;A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AHV,yEAG0B,CAH1B,2BAIEZ,OAAO,CAACa,iBAJV,yEAI+B,CAJ/B,EAKEb,OAAO,CAACc,IALV;AAOAR,IAAAA,GAAG,CAACC,UAAJ,CAAejB,EAAE,CAACkB,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,E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3B,CAAC,CAAgC;IAEjC,OAAO;MAACwB,WAAW;MAAEC,kBAAkB,EAAE;IAAI,CAAC;EAChD;EACA,OAAO;IAACD,WAAW,EAAExB,MAAqC;IAAEyB,kBAAkB,EAAE;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;AAC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AO,EAAE,0BAA0B;IAIvD,mBAAmB,CAAC,OAAO,EAAE,0BAA0B,GAAG,IAAI;IAI9D,oBAAoB,CAAC,OAAO,EAAE,2BAA2B,GAAG,IAAI;IAIvD,cAAc,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
6
  super(props);
7
-
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(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,CAACA,KAAK,CAAC;IAACC,eAAA;IAAAA,eAAA;IACb,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-framebuffer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"webgl-framebuffer.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgl-framebuffer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,gBAAgB,EAA6B,kBAAkB,EAAC,MAAM,cAAc,CAAC;AAClG,OAAO,EAAC,WAAW,EAAE,OAAO,EAAc,MAAM,cAAc,CAAC;AAC/D,OAAO,EAAE,MAAM,oBAAoB,CAAC;AACpC,OAAO,WAAW,MAAM,iBAAiB,CAAC;AAC1C,OAAO,YAAY,MAAM,iBAAiB,CAAC;AAC3C,OAAO,YAAY,MAAM,+BAA+B,CAAC;AAGzD,oBAAY,iBAAiB,GAAG,CAAC,OAAO,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC;AAC5D,oBAAY,UAAU,GAAG,YAAY,GAAG,YAAY,GAAG,iBAAiB,CAAC;AAEzE,iDAAiD;AACjD,MAAM,CAAC,OAAO,OAAO,gBAAiB,SAAQ,WAAW;IACvD,MAAM,EAAE,WAAW,CAAC;IACpB,EAAE,EAAE,qBAAqB,CAAC;IAC1B,MAAM,EAAE,gBAAgB,CAAC;IAEzB,IAAI,OAAO,iBAAuC;IAClD,QAAQ,CAAC,gBAAgB,EAAE,YAAY,EAAE,CAAM;IAC/C,QAAQ,CAAC,sBAAsB,EAAE,YAAY,GAAG,SAAS,CAAa;IACtE,SAAS,CAAC,aAAa,EAAE,CAAC,YAAY,GAAG,YAAY,CAAC,EAAE,CAAM;gBAElD,MAAM,EAAE,WAAW,EAAE,KAAK,EAAE,gBAAgB;IAwCxD,OAAO;IAYP,uBAAuB;IACvB,SAAS,CAAC,YAAY,IAAI,IAAI;IAW9B,uBAAuB,IAAI,YAAY,EAAE;IAgBzC,gCAAgC;IAChC,SAA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