@luma.gl/webgl 9.0.0-alpha.16 → 9.0.0-alpha.19

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 (417) hide show
  1. package/dist/adapter/converters/device-parameters.d.ts.map +1 -1
  2. package/dist/adapter/converters/device-parameters.js +117 -200
  3. package/dist/adapter/converters/device-parameters.js.map +1 -0
  4. package/dist/adapter/converters/renderbuffer-formats.d.ts +1 -1
  5. package/dist/adapter/converters/renderbuffer-formats.d.ts.map +1 -1
  6. package/dist/adapter/converters/renderbuffer-formats.js +172 -62
  7. package/dist/adapter/converters/renderbuffer-formats.js.map +1 -0
  8. package/dist/adapter/converters/sampler-parameters.d.ts.map +1 -1
  9. package/dist/adapter/converters/sampler-parameters.js +151 -149
  10. package/dist/adapter/converters/sampler-parameters.js.map +1 -0
  11. package/dist/adapter/converters/texture-formats.d.ts +2 -2
  12. package/dist/adapter/converters/texture-formats.d.ts.map +1 -1
  13. package/dist/adapter/converters/texture-formats.js +847 -438
  14. package/dist/adapter/converters/texture-formats.js.map +1 -0
  15. package/dist/adapter/converters/vertex-formats.js +24 -15
  16. package/dist/adapter/converters/vertex-formats.js.map +1 -0
  17. package/dist/adapter/device-helpers/device-features.js +84 -120
  18. package/dist/adapter/device-helpers/device-features.js.map +1 -0
  19. package/dist/adapter/device-helpers/device-limits.d.ts +1 -1
  20. package/dist/adapter/device-helpers/device-limits.d.ts.map +1 -1
  21. package/dist/adapter/device-helpers/device-limits.js +83 -88
  22. package/dist/adapter/device-helpers/device-limits.js.map +1 -0
  23. package/dist/adapter/device-helpers/get-device-info.js +37 -42
  24. package/dist/adapter/device-helpers/get-device-info.js.map +1 -0
  25. package/dist/adapter/device-helpers/is-old-ie.js +8 -10
  26. package/dist/adapter/device-helpers/is-old-ie.js.map +1 -0
  27. package/dist/adapter/helpers/attribute-utils.js +57 -50
  28. package/dist/adapter/helpers/attribute-utils.js.map +1 -0
  29. package/dist/adapter/helpers/get-shader-info.d.ts +1 -1
  30. package/dist/adapter/helpers/get-shader-info.d.ts.map +1 -1
  31. package/dist/adapter/helpers/get-shader-info.js +19 -21
  32. package/dist/adapter/helpers/get-shader-info.js.map +1 -0
  33. package/dist/adapter/helpers/get-shader-layout.js +251 -310
  34. package/dist/adapter/helpers/get-shader-layout.js.map +1 -0
  35. package/dist/adapter/helpers/parse-shader-compiler-log.js +26 -32
  36. package/dist/adapter/helpers/parse-shader-compiler-log.js.map +1 -0
  37. package/dist/adapter/helpers/set-uniform.d.ts.map +1 -1
  38. package/dist/adapter/helpers/set-uniform.js +80 -67
  39. package/dist/adapter/helpers/set-uniform.js.map +1 -0
  40. package/dist/adapter/helpers/uniforms.js +75 -80
  41. package/dist/adapter/helpers/uniforms.js.map +1 -0
  42. package/dist/adapter/objects/constants-to-keys.js +26 -33
  43. package/dist/adapter/objects/constants-to-keys.js.map +1 -0
  44. package/dist/adapter/objects/webgl-renderbuffer.d.ts +1 -1
  45. package/dist/adapter/objects/webgl-renderbuffer.d.ts.map +1 -1
  46. package/dist/adapter/objects/webgl-renderbuffer.js +70 -67
  47. package/dist/adapter/objects/webgl-renderbuffer.js.map +1 -0
  48. package/dist/adapter/objects/webgl-resource.d.ts.map +1 -1
  49. package/dist/adapter/objects/webgl-resource.js +158 -213
  50. package/dist/adapter/objects/webgl-resource.js.map +1 -0
  51. package/dist/adapter/objects/webgl-vertex-array-object.d.ts +1 -1
  52. package/dist/adapter/objects/webgl-vertex-array-object.d.ts.map +1 -1
  53. package/dist/adapter/objects/webgl-vertex-array-object.js +66 -74
  54. package/dist/adapter/objects/webgl-vertex-array-object.js.map +1 -0
  55. package/dist/adapter/resources/webgl-buffer.d.ts.map +1 -1
  56. package/dist/adapter/resources/webgl-buffer.js +118 -150
  57. package/dist/adapter/resources/webgl-buffer.js.map +1 -0
  58. package/dist/adapter/resources/webgl-command-buffer.d.ts +5 -5
  59. package/dist/adapter/resources/webgl-command-buffer.d.ts.map +1 -1
  60. package/dist/adapter/resources/webgl-command-buffer.js +41 -40
  61. package/dist/adapter/resources/webgl-command-buffer.js.map +1 -0
  62. package/dist/adapter/resources/webgl-command-encoder.js +37 -26
  63. package/dist/adapter/resources/webgl-command-encoder.js.map +1 -0
  64. package/dist/adapter/resources/webgl-external-texture.js +1 -91
  65. package/dist/adapter/resources/webgl-external-texture.js.map +1 -0
  66. package/dist/adapter/resources/webgl-framebuffer.d.ts +2 -2
  67. package/dist/adapter/resources/webgl-framebuffer.d.ts.map +1 -1
  68. package/dist/adapter/resources/webgl-framebuffer.js +198 -231
  69. package/dist/adapter/resources/webgl-framebuffer.js.map +1 -0
  70. package/dist/adapter/resources/webgl-render-pass.js +11 -8
  71. package/dist/adapter/resources/webgl-render-pass.js.map +1 -0
  72. package/dist/adapter/resources/webgl-render-pipeline.d.ts.map +1 -1
  73. package/dist/adapter/resources/webgl-render-pipeline.js +289 -316
  74. package/dist/adapter/resources/webgl-render-pipeline.js.map +1 -0
  75. package/dist/adapter/resources/webgl-sampler.js +35 -42
  76. package/dist/adapter/resources/webgl-sampler.js.map +1 -0
  77. package/dist/adapter/resources/webgl-shader.d.ts.map +1 -1
  78. package/dist/adapter/resources/webgl-shader.js +53 -57
  79. package/dist/adapter/resources/webgl-shader.js.map +1 -0
  80. package/dist/adapter/resources/webgl-texture.d.ts +4 -4
  81. package/dist/adapter/resources/webgl-texture.d.ts.map +1 -1
  82. package/dist/adapter/resources/webgl-texture.js +697 -661
  83. package/dist/adapter/resources/webgl-texture.js.map +1 -0
  84. package/dist/adapter/webgl-canvas-context.d.ts.map +1 -1
  85. package/dist/adapter/webgl-canvas-context.js +35 -55
  86. package/dist/adapter/webgl-canvas-context.js.map +1 -0
  87. package/dist/adapter/webgl-device.d.ts +5 -0
  88. package/dist/adapter/webgl-device.d.ts.map +1 -1
  89. package/dist/adapter/webgl-device.js +270 -287
  90. package/dist/adapter/webgl-device.js.map +1 -0
  91. package/dist/classic/accessor.js +103 -120
  92. package/dist/classic/accessor.js.map +1 -0
  93. package/dist/classic/buffer.d.ts +1 -1
  94. package/dist/classic/buffer.d.ts.map +1 -1
  95. package/dist/classic/buffer.js +300 -325
  96. package/dist/classic/buffer.js.map +1 -0
  97. package/dist/classic/typed-array-utils.d.ts +1 -1
  98. package/dist/classic/typed-array-utils.d.ts.map +1 -1
  99. package/dist/classic/typed-array-utils.js +81 -91
  100. package/dist/classic/typed-array-utils.js.map +1 -0
  101. package/dist/context/context/create-browser-context.d.ts +3 -1
  102. package/dist/context/context/create-browser-context.d.ts.map +1 -1
  103. package/dist/context/context/create-browser-context.js +49 -66
  104. package/dist/context/context/create-browser-context.js.map +1 -0
  105. package/dist/context/context/create-headless-context.d.ts +1 -1
  106. package/dist/context/context/create-headless-context.d.ts.map +1 -1
  107. package/dist/context/context/create-headless-context.js +30 -24
  108. package/dist/context/context/create-headless-context.js.map +1 -0
  109. package/dist/context/context/webgl-checks.js +17 -25
  110. package/dist/context/context/webgl-checks.js.map +1 -0
  111. package/dist/context/debug/spector.d.ts +3 -1
  112. package/dist/context/debug/spector.d.ts.map +1 -1
  113. package/dist/context/debug/spector.js +50 -53
  114. package/dist/context/debug/spector.js.map +1 -0
  115. package/dist/context/debug/webgl-developer-tools.d.ts +1 -1
  116. package/dist/context/debug/webgl-developer-tools.d.ts.map +1 -1
  117. package/dist/context/debug/webgl-developer-tools.js +76 -107
  118. package/dist/context/debug/webgl-developer-tools.js.map +1 -0
  119. package/dist/context/parameters/unified-parameter-api.js +46 -93
  120. package/dist/context/parameters/unified-parameter-api.js.map +1 -0
  121. package/dist/context/parameters/webgl-parameter-tables.d.ts +1 -1
  122. package/dist/context/parameters/webgl-parameter-tables.d.ts.map +1 -1
  123. package/dist/context/parameters/webgl-parameter-tables.js +404 -462
  124. package/dist/context/parameters/webgl-parameter-tables.js.map +1 -0
  125. package/dist/context/polyfill/context-data.js +10 -16
  126. package/dist/context/polyfill/context-data.js.map +1 -0
  127. package/dist/context/polyfill/get-parameter-polyfill.js +71 -91
  128. package/dist/context/polyfill/get-parameter-polyfill.js.map +1 -0
  129. package/dist/context/polyfill/polyfill-context.js +73 -75
  130. package/dist/context/polyfill/polyfill-context.js.map +1 -0
  131. package/dist/context/polyfill/polyfill-table.d.ts.map +1 -1
  132. package/dist/context/polyfill/polyfill-table.js +116 -133
  133. package/dist/context/polyfill/polyfill-table.js.map +1 -0
  134. package/dist/context/polyfill/polyfill-vertex-array-object.d.ts.map +1 -1
  135. package/dist/context/polyfill/polyfill-vertex-array-object.js +227 -255
  136. package/dist/context/polyfill/polyfill-vertex-array-object.js.map +1 -0
  137. package/dist/context/state-tracker/deep-array-equal.js +14 -16
  138. package/dist/context/state-tracker/deep-array-equal.js.map +1 -0
  139. package/dist/context/state-tracker/track-context-state.d.ts.map +1 -1
  140. package/dist/context/state-tracker/track-context-state.js +127 -183
  141. package/dist/context/state-tracker/track-context-state.js.map +1 -0
  142. package/dist/context/state-tracker/with-parameters.d.ts.map +1 -1
  143. package/dist/context/state-tracker/with-parameters.js +29 -43
  144. package/dist/context/state-tracker/with-parameters.js.map +1 -0
  145. package/dist/dist.dev.js +9205 -0
  146. package/dist/index.cjs +5948 -0
  147. package/dist/index.d.ts +0 -2
  148. package/dist/index.d.ts.map +1 -1
  149. package/dist/index.js +25 -41
  150. package/dist/index.js.map +1 -0
  151. package/dist/types/webgl.d.ts +16 -16
  152. package/dist/types/webgl.d.ts.map +1 -1
  153. package/dist/types/webgl.js +1 -0
  154. package/dist/types/webgl.js.map +1 -0
  155. package/dist/types.d.ts +1 -1
  156. package/dist/types.d.ts.map +1 -1
  157. package/dist/types.js +1 -0
  158. package/dist/types.js.map +1 -0
  159. package/dist.min.js +36 -0
  160. package/package.json +18 -9
  161. package/src/adapter/converters/device-parameters.ts +5 -2
  162. package/src/adapter/converters/sampler-parameters.ts +4 -2
  163. package/src/adapter/converters/texture-formats.ts +3 -1
  164. package/src/adapter/device-helpers/get-device-info.ts +8 -8
  165. package/src/adapter/helpers/get-shader-info.ts +1 -1
  166. package/src/adapter/helpers/get-shader-layout.ts +4 -4
  167. package/src/adapter/helpers/parse-shader-compiler-log.ts +1 -1
  168. package/src/adapter/helpers/set-uniform.ts +2 -0
  169. package/src/adapter/objects/webgl-renderbuffer.ts +1 -1
  170. package/src/adapter/objects/webgl-resource.ts +1 -1
  171. package/src/adapter/objects/webgl-vertex-array-object.ts +1 -1
  172. package/src/adapter/resources/webgl-buffer.ts +6 -6
  173. package/src/adapter/resources/webgl-command-encoder.ts +1 -1
  174. package/src/adapter/resources/webgl-framebuffer.ts +3 -4
  175. package/src/adapter/resources/webgl-render-pipeline.ts +19 -20
  176. package/src/adapter/resources/webgl-shader.ts +1 -1
  177. package/src/adapter/resources/webgl-texture.ts +8 -9
  178. package/src/adapter/webgl-canvas-context.ts +2 -2
  179. package/src/adapter/webgl-device.ts +12 -2
  180. package/src/classic/accessor.ts +1 -1
  181. package/src/classic/buffer.ts +3 -3
  182. package/src/classic/typed-array-utils.ts +1 -1
  183. package/src/context/context/create-browser-context.ts +4 -2
  184. package/src/context/context/create-headless-context.ts +2 -2
  185. package/src/context/debug/spector.ts +5 -4
  186. package/src/context/debug/webgl-developer-tools.ts +1 -0
  187. package/src/context/polyfill/polyfill-table.ts +1 -0
  188. package/src/context/polyfill/polyfill-vertex-array-object.ts +2 -0
  189. package/src/context/state-tracker/track-context-state.ts +6 -5
  190. package/src/context/state-tracker/with-parameters.ts +1 -1
  191. package/src/index.ts +1 -5
  192. package/src/types/webgl.ts +2 -0
  193. package/dist/bundle.d.ts +0 -2
  194. package/dist/bundle.d.ts.map +0 -1
  195. package/dist/bundle.js +0 -4
  196. package/dist/dist.min.js +0 -1
  197. package/dist/es5/adapter/converters/device-parameters.js +0 -139
  198. package/dist/es5/adapter/converters/device-parameters.js.map +0 -1
  199. package/dist/es5/adapter/converters/renderbuffer-formats.js +0 -151
  200. package/dist/es5/adapter/converters/renderbuffer-formats.js.map +0 -1
  201. package/dist/es5/adapter/converters/sampler-parameters.js +0 -182
  202. package/dist/es5/adapter/converters/sampler-parameters.js.map +0 -1
  203. package/dist/es5/adapter/converters/texture-formats.js +0 -950
  204. package/dist/es5/adapter/converters/texture-formats.js.map +0 -1
  205. package/dist/es5/adapter/converters/vertex-formats.js +0 -36
  206. package/dist/es5/adapter/converters/vertex-formats.js.map +0 -1
  207. package/dist/es5/adapter/device-helpers/device-features.js +0 -121
  208. package/dist/es5/adapter/device-helpers/device-features.js.map +0 -1
  209. package/dist/es5/adapter/device-helpers/device-limits.js +0 -54
  210. package/dist/es5/adapter/device-helpers/device-limits.js.map +0 -1
  211. package/dist/es5/adapter/device-helpers/get-device-info.js +0 -49
  212. package/dist/es5/adapter/device-helpers/get-device-info.js.map +0 -1
  213. package/dist/es5/adapter/device-helpers/is-old-ie.js +0 -15
  214. package/dist/es5/adapter/device-helpers/is-old-ie.js.map +0 -1
  215. package/dist/es5/adapter/helpers/attribute-utils.js +0 -69
  216. package/dist/es5/adapter/helpers/attribute-utils.js.map +0 -1
  217. package/dist/es5/adapter/helpers/get-shader-info.js +0 -31
  218. package/dist/es5/adapter/helpers/get-shader-info.js.map +0 -1
  219. package/dist/es5/adapter/helpers/get-shader-layout.js +0 -311
  220. package/dist/es5/adapter/helpers/get-shader-layout.js.map +0 -1
  221. package/dist/es5/adapter/helpers/parse-shader-compiler-log.js +0 -54
  222. package/dist/es5/adapter/helpers/parse-shader-compiler-log.js.map +0 -1
  223. package/dist/es5/adapter/helpers/set-uniform.js +0 -92
  224. package/dist/es5/adapter/helpers/set-uniform.js.map +0 -1
  225. package/dist/es5/adapter/helpers/uniforms.js +0 -88
  226. package/dist/es5/adapter/helpers/uniforms.js.map +0 -1
  227. package/dist/es5/adapter/objects/constants-to-keys.js +0 -43
  228. package/dist/es5/adapter/objects/constants-to-keys.js.map +0 -1
  229. package/dist/es5/adapter/objects/webgl-renderbuffer.js +0 -122
  230. package/dist/es5/adapter/objects/webgl-renderbuffer.js.map +0 -1
  231. package/dist/es5/adapter/objects/webgl-resource.js +0 -233
  232. package/dist/es5/adapter/objects/webgl-resource.js.map +0 -1
  233. package/dist/es5/adapter/objects/webgl-vertex-array-object.js +0 -109
  234. package/dist/es5/adapter/objects/webgl-vertex-array-object.js.map +0 -1
  235. package/dist/es5/adapter/resources/webgl-buffer.js +0 -196
  236. package/dist/es5/adapter/resources/webgl-buffer.js.map +0 -1
  237. package/dist/es5/adapter/resources/webgl-command-buffer.js +0 -70
  238. package/dist/es5/adapter/resources/webgl-command-buffer.js.map +0 -1
  239. package/dist/es5/adapter/resources/webgl-command-encoder.js +0 -80
  240. package/dist/es5/adapter/resources/webgl-command-encoder.js.map +0 -1
  241. package/dist/es5/adapter/resources/webgl-external-texture.js +0 -2
  242. package/dist/es5/adapter/resources/webgl-external-texture.js.map +0 -1
  243. package/dist/es5/adapter/resources/webgl-framebuffer.js +0 -275
  244. package/dist/es5/adapter/resources/webgl-framebuffer.js.map +0 -1
  245. package/dist/es5/adapter/resources/webgl-render-pass.js +0 -45
  246. package/dist/es5/adapter/resources/webgl-render-pass.js.map +0 -1
  247. package/dist/es5/adapter/resources/webgl-render-pipeline.js +0 -385
  248. package/dist/es5/adapter/resources/webgl-render-pipeline.js.map +0 -1
  249. package/dist/es5/adapter/resources/webgl-sampler.js +0 -75
  250. package/dist/es5/adapter/resources/webgl-sampler.js.map +0 -1
  251. package/dist/es5/adapter/resources/webgl-shader.js +0 -111
  252. package/dist/es5/adapter/resources/webgl-shader.js.map +0 -1
  253. package/dist/es5/adapter/resources/webgl-texture.js +0 -826
  254. package/dist/es5/adapter/resources/webgl-texture.js.map +0 -1
  255. package/dist/es5/adapter/webgl-canvas-context.js +0 -72
  256. package/dist/es5/adapter/webgl-canvas-context.js.map +0 -1
  257. package/dist/es5/adapter/webgl-device.js +0 -387
  258. package/dist/es5/adapter/webgl-device.js.map +0 -1
  259. package/dist/es5/bundle.js +0 -6
  260. package/dist/es5/bundle.js.map +0 -1
  261. package/dist/es5/classic/accessor.js +0 -151
  262. package/dist/es5/classic/accessor.js.map +0 -1
  263. package/dist/es5/classic/buffer.js +0 -398
  264. package/dist/es5/classic/buffer.js.map +0 -1
  265. package/dist/es5/classic/typed-array-utils.js +0 -99
  266. package/dist/es5/classic/typed-array-utils.js.map +0 -1
  267. package/dist/es5/context/context/create-browser-context.js +0 -66
  268. package/dist/es5/context/context/create-browser-context.js.map +0 -1
  269. package/dist/es5/context/context/create-headless-context.js +0 -47
  270. package/dist/es5/context/context/create-headless-context.js.map +0 -1
  271. package/dist/es5/context/context/webgl-checks.js +0 -44
  272. package/dist/es5/context/context/webgl-checks.js.map +0 -1
  273. package/dist/es5/context/debug/spector.js +0 -99
  274. package/dist/es5/context/debug/spector.js.map +0 -1
  275. package/dist/es5/context/debug/webgl-developer-tools.js +0 -146
  276. package/dist/es5/context/debug/webgl-developer-tools.js.map +0 -1
  277. package/dist/es5/context/parameters/unified-parameter-api.js +0 -76
  278. package/dist/es5/context/parameters/unified-parameter-api.js.map +0 -1
  279. package/dist/es5/context/parameters/webgl-parameter-tables.js +0 -346
  280. package/dist/es5/context/parameters/webgl-parameter-tables.js.map +0 -1
  281. package/dist/es5/context/polyfill/context-data.js +0 -18
  282. package/dist/es5/context/polyfill/context-data.js.map +0 -1
  283. package/dist/es5/context/polyfill/get-parameter-polyfill.js +0 -69
  284. package/dist/es5/context/polyfill/get-parameter-polyfill.js.map +0 -1
  285. package/dist/es5/context/polyfill/polyfill-context.js +0 -109
  286. package/dist/es5/context/polyfill/polyfill-context.js.map +0 -1
  287. package/dist/es5/context/polyfill/polyfill-table.js +0 -143
  288. package/dist/es5/context/polyfill/polyfill-table.js.map +0 -1
  289. package/dist/es5/context/polyfill/polyfill-vertex-array-object.js +0 -271
  290. package/dist/es5/context/polyfill/polyfill-vertex-array-object.js.map +0 -1
  291. package/dist/es5/context/state-tracker/deep-array-equal.js +0 -23
  292. package/dist/es5/context/state-tracker/deep-array-equal.js.map +0 -1
  293. package/dist/es5/context/state-tracker/track-context-state.js +0 -167
  294. package/dist/es5/context/state-tracker/track-context-state.js.map +0 -1
  295. package/dist/es5/context/state-tracker/with-parameters.js +0 -40
  296. package/dist/es5/context/state-tracker/with-parameters.js.map +0 -1
  297. package/dist/es5/index.js +0 -249
  298. package/dist/es5/index.js.map +0 -1
  299. package/dist/es5/init.js +0 -7
  300. package/dist/es5/init.js.map +0 -1
  301. package/dist/es5/types/webgl.js +0 -5
  302. package/dist/es5/types/webgl.js.map +0 -1
  303. package/dist/es5/types.js +0 -2
  304. package/dist/es5/types.js.map +0 -1
  305. package/dist/esm/adapter/converters/device-parameters.js +0 -137
  306. package/dist/esm/adapter/converters/device-parameters.js.map +0 -1
  307. package/dist/esm/adapter/converters/renderbuffer-formats.js +0 -181
  308. package/dist/esm/adapter/converters/renderbuffer-formats.js.map +0 -1
  309. package/dist/esm/adapter/converters/sampler-parameters.js +0 -172
  310. package/dist/esm/adapter/converters/sampler-parameters.js.map +0 -1
  311. package/dist/esm/adapter/converters/texture-formats.js +0 -901
  312. package/dist/esm/adapter/converters/texture-formats.js.map +0 -1
  313. package/dist/esm/adapter/converters/vertex-formats.js +0 -29
  314. package/dist/esm/adapter/converters/vertex-formats.js.map +0 -1
  315. package/dist/esm/adapter/device-helpers/device-features.js +0 -95
  316. package/dist/esm/adapter/device-helpers/device-features.js.map +0 -1
  317. package/dist/esm/adapter/device-helpers/device-limits.js +0 -88
  318. package/dist/esm/adapter/device-helpers/device-limits.js.map +0 -1
  319. package/dist/esm/adapter/device-helpers/get-device-info.js +0 -42
  320. package/dist/esm/adapter/device-helpers/get-device-info.js.map +0 -1
  321. package/dist/esm/adapter/device-helpers/is-old-ie.js +0 -9
  322. package/dist/esm/adapter/device-helpers/is-old-ie.js.map +0 -1
  323. package/dist/esm/adapter/helpers/attribute-utils.js +0 -64
  324. package/dist/esm/adapter/helpers/attribute-utils.js.map +0 -1
  325. package/dist/esm/adapter/helpers/get-shader-info.js +0 -25
  326. package/dist/esm/adapter/helpers/get-shader-info.js.map +0 -1
  327. package/dist/esm/adapter/helpers/get-shader-layout.js +0 -282
  328. package/dist/esm/adapter/helpers/get-shader-layout.js.map +0 -1
  329. package/dist/esm/adapter/helpers/parse-shader-compiler-log.js +0 -30
  330. package/dist/esm/adapter/helpers/parse-shader-compiler-log.js.map +0 -1
  331. package/dist/esm/adapter/helpers/set-uniform.js +0 -85
  332. package/dist/esm/adapter/helpers/set-uniform.js.map +0 -1
  333. package/dist/esm/adapter/helpers/uniforms.js +0 -89
  334. package/dist/esm/adapter/helpers/uniforms.js.map +0 -1
  335. package/dist/esm/adapter/objects/constants-to-keys.js +0 -35
  336. package/dist/esm/adapter/objects/constants-to-keys.js.map +0 -1
  337. package/dist/esm/adapter/objects/webgl-renderbuffer.js +0 -78
  338. package/dist/esm/adapter/objects/webgl-renderbuffer.js.map +0 -1
  339. package/dist/esm/adapter/objects/webgl-resource.js +0 -163
  340. package/dist/esm/adapter/objects/webgl-resource.js.map +0 -1
  341. package/dist/esm/adapter/objects/webgl-vertex-array-object.js +0 -74
  342. package/dist/esm/adapter/objects/webgl-vertex-array-object.js.map +0 -1
  343. package/dist/esm/adapter/resources/webgl-buffer.js +0 -134
  344. package/dist/esm/adapter/resources/webgl-buffer.js.map +0 -1
  345. package/dist/esm/adapter/resources/webgl-command-buffer.js +0 -50
  346. package/dist/esm/adapter/resources/webgl-command-buffer.js.map +0 -1
  347. package/dist/esm/adapter/resources/webgl-command-encoder.js +0 -41
  348. package/dist/esm/adapter/resources/webgl-command-encoder.js.map +0 -1
  349. package/dist/esm/adapter/resources/webgl-external-texture.js +0 -2
  350. package/dist/esm/adapter/resources/webgl-external-texture.js.map +0 -1
  351. package/dist/esm/adapter/resources/webgl-framebuffer.js +0 -207
  352. package/dist/esm/adapter/resources/webgl-framebuffer.js.map +0 -1
  353. package/dist/esm/adapter/resources/webgl-render-pass.js +0 -14
  354. package/dist/esm/adapter/resources/webgl-render-pass.js.map +0 -1
  355. package/dist/esm/adapter/resources/webgl-render-pipeline.js +0 -311
  356. package/dist/esm/adapter/resources/webgl-render-pipeline.js.map +0 -1
  357. package/dist/esm/adapter/resources/webgl-sampler.js +0 -42
  358. package/dist/esm/adapter/resources/webgl-sampler.js.map +0 -1
  359. package/dist/esm/adapter/resources/webgl-shader.js +0 -62
  360. package/dist/esm/adapter/resources/webgl-shader.js.map +0 -1
  361. package/dist/esm/adapter/resources/webgl-texture.js +0 -714
  362. package/dist/esm/adapter/resources/webgl-texture.js.map +0 -1
  363. package/dist/esm/adapter/webgl-canvas-context.js +0 -41
  364. package/dist/esm/adapter/webgl-canvas-context.js.map +0 -1
  365. package/dist/esm/adapter/webgl-device.js +0 -276
  366. package/dist/esm/adapter/webgl-device.js.map +0 -1
  367. package/dist/esm/bundle.js +0 -4
  368. package/dist/esm/bundle.js.map +0 -1
  369. package/dist/esm/classic/accessor.js +0 -120
  370. package/dist/esm/classic/accessor.js.map +0 -1
  371. package/dist/esm/classic/buffer.js +0 -327
  372. package/dist/esm/classic/buffer.js.map +0 -1
  373. package/dist/esm/classic/typed-array-utils.js +0 -92
  374. package/dist/esm/classic/typed-array-utils.js.map +0 -1
  375. package/dist/esm/context/context/create-browser-context.js +0 -53
  376. package/dist/esm/context/context/create-browser-context.js.map +0 -1
  377. package/dist/esm/context/context/create-headless-context.js +0 -39
  378. package/dist/esm/context/context/create-headless-context.js.map +0 -1
  379. package/dist/esm/context/context/webgl-checks.js +0 -31
  380. package/dist/esm/context/context/webgl-checks.js.map +0 -1
  381. package/dist/esm/context/debug/spector.js +0 -64
  382. package/dist/esm/context/debug/spector.js.map +0 -1
  383. package/dist/esm/context/debug/webgl-developer-tools.js +0 -97
  384. package/dist/esm/context/debug/webgl-developer-tools.js.map +0 -1
  385. package/dist/esm/context/parameters/unified-parameter-api.js +0 -55
  386. package/dist/esm/context/parameters/unified-parameter-api.js.map +0 -1
  387. package/dist/esm/context/parameters/webgl-parameter-tables.js +0 -427
  388. package/dist/esm/context/parameters/webgl-parameter-tables.js.map +0 -1
  389. package/dist/esm/context/polyfill/context-data.js +0 -12
  390. package/dist/esm/context/polyfill/context-data.js.map +0 -1
  391. package/dist/esm/context/polyfill/get-parameter-polyfill.js +0 -86
  392. package/dist/esm/context/polyfill/get-parameter-polyfill.js.map +0 -1
  393. package/dist/esm/context/polyfill/polyfill-context.js +0 -84
  394. package/dist/esm/context/polyfill/polyfill-context.js.map +0 -1
  395. package/dist/esm/context/polyfill/polyfill-table.js +0 -138
  396. package/dist/esm/context/polyfill/polyfill-table.js.map +0 -1
  397. package/dist/esm/context/polyfill/polyfill-vertex-array-object.js +0 -265
  398. package/dist/esm/context/polyfill/polyfill-vertex-array-object.js.map +0 -1
  399. package/dist/esm/context/state-tracker/deep-array-equal.js +0 -17
  400. package/dist/esm/context/state-tracker/deep-array-equal.js.map +0 -1
  401. package/dist/esm/context/state-tracker/track-context-state.js +0 -148
  402. package/dist/esm/context/state-tracker/track-context-state.js.map +0 -1
  403. package/dist/esm/context/state-tracker/with-parameters.js +0 -34
  404. package/dist/esm/context/state-tracker/with-parameters.js.map +0 -1
  405. package/dist/esm/index.js +0 -27
  406. package/dist/esm/index.js.map +0 -1
  407. package/dist/esm/init.js +0 -4
  408. package/dist/esm/init.js.map +0 -1
  409. package/dist/esm/types/webgl.js +0 -2
  410. package/dist/esm/types/webgl.js.map +0 -1
  411. package/dist/esm/types.js +0 -2
  412. package/dist/esm/types.js.map +0 -1
  413. package/dist/init.d.ts +0 -2
  414. package/dist/init.d.ts.map +0 -1
  415. package/dist/init.js +0 -3
  416. package/src/bundle.ts +0 -4
  417. package/src/init.ts +0 -4
@@ -1,296 +1,279 @@
1
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
1
2
  import { Device, CanvasContext, log, uid } from '@luma.gl/api';
2
3
  import { isBrowser } from '@probe.gl/env';
3
- import { polyfillContext } from '../context/polyfill/polyfill-context.js';
4
- import { popContextState, pushContextState, trackContextState } from '../context/state-tracker/track-context-state.js';
5
- import { createBrowserContext } from '../context/context/create-browser-context.js';
6
- import { createHeadlessContext, isHeadlessGLRegistered } from '../context/context/create-headless-context.js';
7
- import { getDeviceInfo } from './device-helpers/get-device-info.js';
8
- import { getDeviceFeatures } from './device-helpers/device-features.js';
9
- import { getDeviceLimits, getWebGLLimits } from './device-helpers/device-limits.js';
10
- import WebGLCanvasContext from './webgl-canvas-context.js';
11
- import { loadSpectorJS, initializeSpectorJS } from '../context/debug/spector.js';
12
- import { loadWebGLDeveloperTools, makeDebugContext } from '../context/debug/webgl-developer-tools.js';
13
- import { isTextureFormatSupported, isTextureFormatRenderable, isTextureFormatFilterable } from './converters/texture-formats.js';
14
- import ClassicBuffer from '../classic/buffer.js';
15
- import WEBGLShader from './resources/webgl-shader.js';
16
- import WEBGLSampler from './resources/webgl-sampler.js';
17
- import WEBGLTexture from './resources/webgl-texture.js';
18
- import WEBGLFramebuffer from './resources/webgl-framebuffer.js';
19
- import WEBGLRenderPass from './resources/webgl-render-pass.js';
20
- import WEBGLRenderPipeline from './resources/webgl-render-pipeline.js';
4
+ import { polyfillContext } from "../context/polyfill/polyfill-context.js";
5
+ import { popContextState, pushContextState, trackContextState } from "../context/state-tracker/track-context-state.js";
6
+ import { createBrowserContext } from "../context/context/create-browser-context.js";
7
+ import { createHeadlessContext, isHeadlessGLRegistered } from "../context/context/create-headless-context.js";
8
+ import { getDeviceInfo } from "./device-helpers/get-device-info.js";
9
+ import { getDeviceFeatures } from "./device-helpers/device-features.js";
10
+ import { getDeviceLimits, getWebGLLimits } from "./device-helpers/device-limits.js";
11
+ import WebGLCanvasContext from "./webgl-canvas-context.js";
12
+ import { loadSpectorJS, initializeSpectorJS } from "../context/debug/spector.js";
13
+ import { loadWebGLDeveloperTools, makeDebugContext } from "../context/debug/webgl-developer-tools.js";
14
+ import { isTextureFormatSupported, isTextureFormatRenderable, isTextureFormatFilterable } from "./converters/texture-formats.js";
15
+ import ClassicBuffer from "../classic/buffer.js";
16
+ import WEBGLShader from "./resources/webgl-shader.js";
17
+ import WEBGLSampler from "./resources/webgl-sampler.js";
18
+ import WEBGLTexture from "./resources/webgl-texture.js";
19
+ import WEBGLFramebuffer from "./resources/webgl-framebuffer.js";
20
+ import WEBGLRenderPass from "./resources/webgl-render-pass.js";
21
+ import WEBGLRenderPipeline from "./resources/webgl-render-pipeline.js";
21
22
  const LOG_LEVEL = 1;
22
- /** WebGPU style Device API for a WebGL context */
23
- class WebGLDevice extends Device {
24
- static isSupported() {
25
- return typeof WebGLRenderingContext !== 'undefined' || isHeadlessGLRegistered();
26
- }
27
- get features() {
28
- this._features = this._features || getDeviceFeatures(this.gl);
29
- return this._features;
30
- }
31
- get limits() {
32
- this._limits = this._limits || getDeviceLimits(this.gl);
33
- return this._limits;
34
- }
35
- //
36
- // Static methods, expected to be present by `luma.createDevice()`
37
- //
38
- /**
39
- * Get a device instance from a GL context
40
- * Creates and instruments the device if not already created
41
- * @param gl
42
- * @returns
43
- */
44
- static attach(gl) {
45
- if (gl instanceof WebGLDevice) {
46
- return gl;
47
- }
48
- // @ts-expect-error
49
- if (gl?.device instanceof Device) {
50
- // @ts-expect-error
51
- return gl.device;
52
- }
53
- if (!isWebGL(gl)) {
54
- throw new Error('Invalid WebGLRenderingContext');
55
- }
56
- return new WebGLDevice({ gl: gl });
57
- }
58
- static async create(props = {}) {
59
- log.groupCollapsed(LOG_LEVEL, 'WebGLDevice created');
60
- // Wait for page to load. Only wait when props. canvas is string
61
- // to avoid setting page onload callback unless necessary
62
- if (typeof props.canvas === 'string') {
63
- await CanvasContext.pageLoaded;
64
- }
65
- // Load webgl and spector debug scripts from CDN if requested
66
- if (props.debug) {
67
- await loadWebGLDeveloperTools();
68
- }
69
- // @ts-expect-error spector not on props
70
- if (props.spector) {
71
- await loadSpectorJS();
72
- }
73
- log.probe(LOG_LEVEL + 1, 'DOM is loaded')();
74
- // @ts-expect-error
75
- if (props.gl && props.gl.device) {
76
- return WebGLDevice.attach(props.gl);
77
- }
78
- return new WebGLDevice(props);
79
- }
80
- //
81
- // Public API
82
- //
83
- constructor(props) {
84
- super({ ...props, id: props.id || uid('webgl-device') });
85
- this.renderPass = null;
86
- /** WebGL2 typed context. Need to check isWebGL2 or isWebGL1 before using. */
87
- this.gl2 = null;
88
- this.debug = false;
89
- /** State used by luma.gl classes: TODO - move to canvasContext*/
90
- this._canvasSizeInfo = { clientWidth: 0, clientHeight: 0, devicePixelRatio: 1 };
91
- /** State used by luma.gl classes - TODO - not used? */
92
- this._extensions = {};
93
- this._polyfilled = false;
94
- // If attaching to an already attached context, return the attached device
95
- // @ts-expect-error device is attached to context
96
- const device = props.gl?.device;
97
- if (device) {
98
- throw new Error(`WebGL context already attached to device ${device.id}`);
99
- }
100
- // Create and instrument context
101
- this.canvasContext = new WebGLCanvasContext(this, props);
102
- this.lost = new Promise((resolve) => {
103
- this._resolveContextLost = resolve;
104
- });
105
- const onContextLost = (event) => this._resolveContextLost?.({
106
- reason: 'destroyed',
107
- message: 'Computer entered sleep mode, or too many apps or browser tabs are using the GPU.'
108
- });
109
- let gl = props.gl || null;
110
- gl =
111
- gl ||
112
- (isBrowser() ? createBrowserContext(this.canvasContext.canvas, { ...props, onContextLost }) : null);
113
- gl = gl || (!isBrowser() ? createHeadlessContext({ ...props, onContextLost }) : null);
114
- if (!gl) {
115
- throw new Error('WebGL context creation failed');
116
- }
117
- this.handle = gl;
118
- this.gl = this.handle;
119
- this.gl2 = this.gl;
120
- this.isWebGL2 = isWebGL2(this.gl);
121
- this.isWebGL1 = !this.isWebGL2;
122
- // luma Device fields
123
- this.info = getDeviceInfo(this.gl);
124
- // @ts-expect-error Link webgl context back to device
125
- this.gl.device = this;
126
- // @ts-expect-error Annotate webgl context to handle
127
- this.gl._version = this.isWebGL2 ? 2 : 1;
128
- // Add subset of WebGL2 methods to WebGL1 context
129
- polyfillContext(this.gl);
130
- // Install context state tracking
131
- // @ts-expect-error - hidden parameters
132
- const { enable = true, copyState = false } = props;
133
- trackContextState(this.gl, {
134
- enable,
135
- copyState,
136
- log: (...args) => log.log(1, ...args)()
137
- });
138
- // DEBUG contexts: Add debug instrumentation to the context, force log level to at least 1
139
- if (isBrowser() && props.debug) {
140
- this.gl = makeDebugContext(this.gl, { ...props, webgl2: this.isWebGL2, throwOnError: true });
141
- this.gl2 = this.gl;
142
- this.debug = true;
143
- log.level = Math.max(log.level, 1);
144
- log.warn('WebGL debug mode activated. Performance reduced.')();
145
- }
146
- // @ts-expect-error spector not on props
147
- if (isBrowser() && props.spector) {
148
- const canvas = this.handle.canvas || props.canvas;
149
- this.spector = initializeSpectorJS({ ...this.props, canvas });
150
- }
151
- // Log some debug info about the newly created context
152
- const message = `\
153
- Created ${this.info.type}${this.debug ? ' debug' : ''} context: \
154
- ${this.info.vendor}, ${this.info.renderer} for canvas: ${this.canvasContext.id}`;
155
- log.probe(LOG_LEVEL, message)();
156
- log.groupEnd(LOG_LEVEL)();
157
- }
158
- /**
159
- * Destroys the context
160
- * @note Has no effect for browser contexts, there is no browser API for destroying contexts
161
- */
162
- destroy() {
163
- const ext = this.gl.getExtension('STACKGL_destroy_context');
164
- if (ext) {
165
- ext.destroy();
166
- }
167
- }
168
- get isLost() {
169
- return this.gl.isContextLost();
170
- }
171
- getSize() {
172
- return [this.gl.drawingBufferWidth, this.gl.drawingBufferHeight];
173
- }
174
- isTextureFormatSupported(format) {
175
- return isTextureFormatSupported(this.gl, format);
176
- }
177
- isTextureFormatFilterable(format) {
178
- return isTextureFormatFilterable(this.gl, format);
179
- }
180
- isTextureFormatRenderable(format) {
181
- return isTextureFormatRenderable(this.gl, format);
182
- }
183
- // WEBGL SPECIFIC METHODS
184
- /** Returns a WebGL2RenderingContext or throws an error */
185
- assertWebGL2() {
186
- if (!this.gl2) {
187
- throw new Error('Requires WebGL2');
23
+ export default class WebGLDevice extends Device {
24
+ static isSupported() {
25
+ return typeof WebGLRenderingContext !== 'undefined' || isHeadlessGLRegistered();
26
+ }
27
+ get features() {
28
+ this._features = this._features || getDeviceFeatures(this.gl);
29
+ return this._features;
30
+ }
31
+ get limits() {
32
+ this._limits = this._limits || getDeviceLimits(this.gl);
33
+ return this._limits;
34
+ }
35
+ static attach(gl) {
36
+ if (gl instanceof WebGLDevice) {
37
+ return gl;
38
+ }
39
+ if ((gl === null || gl === void 0 ? void 0 : gl.device) instanceof Device) {
40
+ return gl.device;
41
+ }
42
+ if (!isWebGL(gl)) {
43
+ throw new Error('Invalid WebGLRenderingContext');
44
+ }
45
+ return new WebGLDevice({
46
+ gl: gl
47
+ });
48
+ }
49
+ static async create() {
50
+ let props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
51
+ log.groupCollapsed(LOG_LEVEL, 'WebGLDevice created');
52
+ if (typeof props.canvas === 'string') {
53
+ await CanvasContext.pageLoaded;
54
+ }
55
+ if (props.debug) {
56
+ await loadWebGLDeveloperTools();
57
+ }
58
+ if (props.spector) {
59
+ await loadSpectorJS();
60
+ }
61
+ log.probe(LOG_LEVEL + 1, 'DOM is loaded')();
62
+ if (props.gl && props.gl.device) {
63
+ return WebGLDevice.attach(props.gl);
64
+ }
65
+ return new WebGLDevice(props);
66
+ }
67
+ constructor(props) {
68
+ var _props$gl;
69
+ super({
70
+ ...props,
71
+ id: props.id || uid('webgl-device')
72
+ });
73
+ _defineProperty(this, "info", void 0);
74
+ _defineProperty(this, "canvasContext", void 0);
75
+ _defineProperty(this, "handle", void 0);
76
+ _defineProperty(this, "lost", void 0);
77
+ _defineProperty(this, "_resolveContextLost", void 0);
78
+ _defineProperty(this, "_features", void 0);
79
+ _defineProperty(this, "_limits", void 0);
80
+ _defineProperty(this, "renderPass", null);
81
+ _defineProperty(this, "gl", void 0);
82
+ _defineProperty(this, "gl2", null);
83
+ _defineProperty(this, "debug", false);
84
+ _defineProperty(this, "isWebGL1", void 0);
85
+ _defineProperty(this, "isWebGL2", void 0);
86
+ _defineProperty(this, "_canvasSizeInfo", {
87
+ clientWidth: 0,
88
+ clientHeight: 0,
89
+ devicePixelRatio: 1
90
+ });
91
+ _defineProperty(this, "_extensions", {});
92
+ _defineProperty(this, "_polyfilled", false);
93
+ _defineProperty(this, "spector", void 0);
94
+ _defineProperty(this, "_webglLimits", void 0);
95
+ const device = (_props$gl = props.gl) === null || _props$gl === void 0 ? void 0 : _props$gl.device;
96
+ if (device) {
97
+ throw new Error("WebGL context already attached to device ".concat(device.id));
98
+ }
99
+ this.canvasContext = new WebGLCanvasContext(this, props);
100
+ this.lost = new Promise(resolve => {
101
+ this._resolveContextLost = resolve;
102
+ });
103
+ const onContextLost = event => {
104
+ var _this$_resolveContext;
105
+ return (_this$_resolveContext = this._resolveContextLost) === null || _this$_resolveContext === void 0 ? void 0 : _this$_resolveContext.call(this, {
106
+ reason: 'destroyed',
107
+ message: 'Computer entered sleep mode, or too many apps or browser tabs are using the GPU.'
108
+ });
109
+ };
110
+ let gl = props.gl || null;
111
+ gl = gl || (isBrowser() ? createBrowserContext(this.canvasContext.canvas, {
112
+ ...props,
113
+ onContextLost
114
+ }) : null);
115
+ gl = gl || (!isBrowser() ? createHeadlessContext({
116
+ ...props,
117
+ onContextLost
118
+ }) : null);
119
+ if (!gl) {
120
+ throw new Error('WebGL context creation failed');
121
+ }
122
+ this.handle = gl;
123
+ this.gl = this.handle;
124
+ this.gl2 = this.gl;
125
+ this.isWebGL2 = isWebGL2(this.gl);
126
+ this.isWebGL1 = !this.isWebGL2;
127
+ this.info = getDeviceInfo(this.gl);
128
+ this.gl.device = this;
129
+ this.gl._version = this.isWebGL2 ? 2 : 1;
130
+ polyfillContext(this.gl);
131
+ const {
132
+ enable = true,
133
+ copyState = false
134
+ } = props;
135
+ trackContextState(this.gl, {
136
+ enable,
137
+ copyState,
138
+ log: function () {
139
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
140
+ args[_key] = arguments[_key];
188
141
  }
189
- return this.gl2;
190
- }
191
- // IMPLEMENTATION OF ABSTRACT DEVICE
192
- createCanvasContext(props) {
193
- throw new Error('WebGL only supports a single canvas');
194
- }
195
- _createBuffer(props) {
196
- return new ClassicBuffer(this, props);
197
- }
198
- _createTexture(props) {
199
- return new WEBGLTexture(this, props);
200
- }
201
- createExternalTexture(props) {
202
- throw new Error('createExternalTexture() not implemented'); // return new Program(props);
203
- }
204
- createSampler(props) {
205
- return new WEBGLSampler(this, props);
206
- }
207
- createShader(props) {
208
- return new WEBGLShader(this, props);
209
- }
210
- createFramebuffer(props) {
211
- return new WEBGLFramebuffer(this, props);
212
- }
213
- createRenderPipeline(props) {
214
- return new WEBGLRenderPipeline(this, props);
215
- }
216
- beginRenderPass(props) {
217
- return new WEBGLRenderPass(this, props);
218
- }
219
- createComputePipeline(props) {
220
- throw new Error('ComputePipeline not supported in WebGL');
221
- }
222
- beginComputePass(props) {
223
- throw new Error('compute shaders not supported in WebGL');
224
- }
225
- getDefaultRenderPass() {
226
- this.renderPass =
227
- this.renderPass ||
228
- this.beginRenderPass({
229
- framebuffer: this.canvasContext.getCurrentFramebuffer()
230
- });
231
- return this.renderPass;
232
- }
233
- /**
234
- * Offscreen Canvas Support: Commit the frame
235
- * https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/commit
236
- * Chrome's offscreen canvas does not require gl.commit
237
- */
238
- submit() {
239
- this.renderPass?.end();
240
- this.renderPass = null;
241
- // this.canvasContext.commit();
242
- }
243
- /** Return WebGL specific limits */
244
- get webglLimits() {
245
- this._webglLimits = this._webglLimits || getWebGLLimits(this.gl);
246
- return this._webglLimits;
247
- }
248
- /**
249
- * Loses the context
250
- * @note Triggers context loss, mainly for testing
251
- * @todo Promote to `Device` API?
252
- */
253
- loseDevice() {
254
- const ext = this.gl.getExtension('WEBGL_lose_context');
255
- if (ext) {
256
- ext.loseContext();
257
- }
258
- // loseContext should trigger context loss callback but
259
- this._resolveContextLost?.({
260
- reason: 'destroyed',
261
- message: 'Application triggered context loss'
262
- });
263
- }
264
- /** Save current WebGL context state onto an internal stack */
265
- pushState() {
266
- pushContextState(this.gl);
267
- }
268
- /** Restores previously saved context state */
269
- popState() {
270
- popContextState(this.gl);
271
- }
142
+ return log.log(1, ...args)();
143
+ }
144
+ });
145
+ if (isBrowser() && props.debug) {
146
+ this.gl = makeDebugContext(this.gl, {
147
+ ...props,
148
+ webgl2: this.isWebGL2,
149
+ throwOnError: true
150
+ });
151
+ this.gl2 = this.gl;
152
+ this.debug = true;
153
+ log.level = Math.max(log.level, 1);
154
+ log.warn('WebGL debug mode activated. Performance reduced.')();
155
+ }
156
+ if (isBrowser() && props.spector) {
157
+ const canvas = this.handle.canvas || props.canvas;
158
+ this.spector = initializeSpectorJS({
159
+ ...this.props,
160
+ canvas
161
+ });
162
+ }
163
+ const message = "Created ".concat(this.info.type).concat(this.debug ? ' debug' : '', " context: ").concat(this.info.vendor, ", ").concat(this.info.renderer, " for canvas: ").concat(this.canvasContext.id);
164
+ log.probe(LOG_LEVEL, message)();
165
+ log.groupEnd(LOG_LEVEL)();
166
+ }
167
+ destroy() {
168
+ const ext = this.gl.getExtension('STACKGL_destroy_context');
169
+ if (ext) {
170
+ ext.destroy();
171
+ }
172
+ }
173
+ get isLost() {
174
+ return this.gl.isContextLost();
175
+ }
176
+ getSize() {
177
+ return [this.gl.drawingBufferWidth, this.gl.drawingBufferHeight];
178
+ }
179
+ isTextureFormatSupported(format) {
180
+ return isTextureFormatSupported(this.gl, format);
181
+ }
182
+ isTextureFormatFilterable(format) {
183
+ return isTextureFormatFilterable(this.gl, format);
184
+ }
185
+ isTextureFormatRenderable(format) {
186
+ return isTextureFormatRenderable(this.gl, format);
187
+ }
188
+ assertWebGL2() {
189
+ if (!this.gl2) {
190
+ throw new Error('Requires WebGL2');
191
+ }
192
+ return this.gl2;
193
+ }
194
+ createCanvasContext(props) {
195
+ throw new Error('WebGL only supports a single canvas');
196
+ }
197
+ _createBuffer(props) {
198
+ return new ClassicBuffer(this, props);
199
+ }
200
+ _createTexture(props) {
201
+ return new WEBGLTexture(this, props);
202
+ }
203
+ createExternalTexture(props) {
204
+ throw new Error('createExternalTexture() not implemented');
205
+ }
206
+ createSampler(props) {
207
+ return new WEBGLSampler(this, props);
208
+ }
209
+ createShader(props) {
210
+ return new WEBGLShader(this, props);
211
+ }
212
+ createFramebuffer(props) {
213
+ return new WEBGLFramebuffer(this, props);
214
+ }
215
+ createRenderPipeline(props) {
216
+ return new WEBGLRenderPipeline(this, props);
217
+ }
218
+ beginRenderPass(props) {
219
+ return new WEBGLRenderPass(this, props);
220
+ }
221
+ createComputePipeline(props) {
222
+ throw new Error('ComputePipeline not supported in WebGL');
223
+ }
224
+ beginComputePass(props) {
225
+ throw new Error('compute shaders not supported in WebGL');
226
+ }
227
+ getDefaultRenderPass() {
228
+ this.renderPass = this.renderPass || this.beginRenderPass({
229
+ framebuffer: this.canvasContext.getCurrentFramebuffer()
230
+ });
231
+ return this.renderPass;
232
+ }
233
+ submit() {
234
+ var _this$renderPass;
235
+ (_this$renderPass = this.renderPass) === null || _this$renderPass === void 0 ? void 0 : _this$renderPass.end();
236
+ this.renderPass = null;
237
+ }
238
+ get webglLimits() {
239
+ this._webglLimits = this._webglLimits || getWebGLLimits(this.gl);
240
+ return this._webglLimits;
241
+ }
242
+ loseDevice() {
243
+ var _this$_resolveContext2;
244
+ const ext = this.gl.getExtension('WEBGL_lose_context');
245
+ if (ext) {
246
+ ext.loseContext();
247
+ }
248
+ (_this$_resolveContext2 = this._resolveContextLost) === null || _this$_resolveContext2 === void 0 ? void 0 : _this$_resolveContext2.call(this, {
249
+ reason: 'destroyed',
250
+ message: 'Application triggered context loss'
251
+ });
252
+ }
253
+ pushState() {
254
+ pushContextState(this.gl);
255
+ }
256
+ popState() {
257
+ popContextState(this.gl);
258
+ }
259
+ setSpectorMetadata(handle, props) {
260
+ handle.__SPECTOR_Metadata = props;
261
+ }
272
262
  }
273
- //
274
- // Public `Device` API
275
- //
276
- WebGLDevice.type = 'webgl';
277
- export default WebGLDevice;
278
- /** Check if supplied parameter is a WebGLRenderingContext */
263
+ _defineProperty(WebGLDevice, "type", 'webgl');
279
264
  function isWebGL(gl) {
280
- if (typeof WebGLRenderingContext !== 'undefined' && gl instanceof WebGLRenderingContext) {
281
- return true;
282
- }
283
- if (typeof WebGL2RenderingContext !== 'undefined' && gl instanceof WebGL2RenderingContext) {
284
- return true;
285
- }
286
- // Look for debug contexts, headless gl etc
287
- return Boolean(gl && Number.isFinite(gl._version));
265
+ if (typeof WebGLRenderingContext !== 'undefined' && gl instanceof WebGLRenderingContext) {
266
+ return true;
267
+ }
268
+ if (typeof WebGL2RenderingContext !== 'undefined' && gl instanceof WebGL2RenderingContext) {
269
+ return true;
270
+ }
271
+ return Boolean(gl && Number.isFinite(gl._version));
288
272
  }
289
- /** Check if supplied parameter is a WebGL2RenderingContext */
290
273
  function isWebGL2(gl) {
291
- if (typeof WebGL2RenderingContext !== 'undefined' && gl instanceof WebGL2RenderingContext) {
292
- return true;
293
- }
294
- // Look for debug contexts, headless gl etc
295
- return Boolean(gl && gl._version === 2);
274
+ if (typeof WebGL2RenderingContext !== 'undefined' && gl instanceof WebGL2RenderingContext) {
275
+ return true;
276
+ }
277
+ return Boolean(gl && gl._version === 2);
296
278
  }
279
+ //# sourceMappingURL=webgl-device.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webgl-device.js","names":["Device","CanvasContext","log","uid","isBrowser","polyfillContext","popContextState","pushContextState","trackContextState","createBrowserContext","createHeadlessContext","isHeadlessGLRegistered","getDeviceInfo","getDeviceFeatures","getDeviceLimits","getWebGLLimits","WebGLCanvasContext","loadSpectorJS","initializeSpectorJS","loadWebGLDeveloperTools","makeDebugContext","isTextureFormatSupported","isTextureFormatRenderable","isTextureFormatFilterable","ClassicBuffer","WEBGLShader","WEBGLSampler","WEBGLTexture","WEBGLFramebuffer","WEBGLRenderPass","WEBGLRenderPipeline","LOG_LEVEL","WebGLDevice","isSupported","WebGLRenderingContext","features","_features","gl","limits","_limits","attach","device","isWebGL","Error","create","props","arguments","length","undefined","groupCollapsed","canvas","pageLoaded","debug","spector","probe","constructor","_props$gl","id","_defineProperty","clientWidth","clientHeight","devicePixelRatio","concat","canvasContext","lost","Promise","resolve","_resolveContextLost","onContextLost","event","_this$_resolveContext","call","reason","message","handle","gl2","isWebGL2","isWebGL1","info","_version","enable","copyState","_len","args","Array","_key","webgl2","throwOnError","level","Math","max","warn","type","vendor","renderer","groupEnd","destroy","ext","getExtension","isLost","isContextLost","getSize","drawingBufferWidth","drawingBufferHeight","format","assertWebGL2","createCanvasContext","_createBuffer","_createTexture","createExternalTexture","createSampler","createShader","createFramebuffer","createRenderPipeline","beginRenderPass","createComputePipeline","beginComputePass","getDefaultRenderPass","renderPass","framebuffer","getCurrentFramebuffer","submit","_this$renderPass","end","webglLimits","_webglLimits","loseDevice","_this$_resolveContext2","loseContext","pushState","popState","setSpectorMetadata","__SPECTOR_Metadata","WebGL2RenderingContext","Boolean","Number","isFinite"],"sources":["../../src/adapter/webgl-device.ts"],"sourcesContent":["// luma.gl, MIT license\nimport type {\n DeviceProps,\n DeviceInfo,\n DeviceLimits,\n DeviceFeature,\n CanvasContextProps,\n TextureFormat\n} from '@luma.gl/api';\nimport {Device, CanvasContext, log, uid} from '@luma.gl/api';\nimport {isBrowser} from '@probe.gl/env';\nimport {polyfillContext} from '../context/polyfill/polyfill-context';\nimport {popContextState, pushContextState, trackContextState} from '../context/state-tracker/track-context-state';\nimport {createBrowserContext} from '../context/context/create-browser-context';\nimport {\n createHeadlessContext,\n isHeadlessGLRegistered\n} from '../context/context/create-headless-context';\nimport {getDeviceInfo} from './device-helpers/get-device-info';\nimport {getDeviceFeatures} from './device-helpers/device-features';\nimport {getDeviceLimits, getWebGLLimits, WebGLLimits} from './device-helpers/device-limits';\nimport WebGLCanvasContext from './webgl-canvas-context';\nimport {loadSpectorJS, initializeSpectorJS} from '../context/debug/spector';\nimport {loadWebGLDeveloperTools, makeDebugContext} from '../context/debug/webgl-developer-tools';\nimport {\n isTextureFormatSupported,\n isTextureFormatRenderable,\n isTextureFormatFilterable\n} from './converters/texture-formats';\n\n// WebGL classes\nimport type {\n BufferProps,\n ShaderProps,\n // Sampler,\n SamplerProps,\n TextureProps,\n ExternalTexture,\n ExternalTextureProps,\n FramebufferProps,\n // RenderPipeline,\n RenderPipelineProps,\n ComputePipeline,\n ComputePipelineProps,\n // RenderPass,\n RenderPassProps,\n ComputePass,\n ComputePassProps\n} from '@luma.gl/api';\n\nimport ClassicBuffer from '../classic/buffer';\nimport WEBGLBuffer from './resources/webgl-buffer';\nimport WEBGLShader from './resources/webgl-shader';\nimport WEBGLSampler from './resources/webgl-sampler';\nimport WEBGLTexture from './resources/webgl-texture';\nimport WEBGLFramebuffer from './resources/webgl-framebuffer';\nimport WEBGLRenderPass from './resources/webgl-render-pass';\nimport WEBGLRenderPipeline from './resources/webgl-render-pipeline';\n\nconst LOG_LEVEL = 1;\n\n/** WebGPU style Device API for a WebGL context */\nexport default class WebGLDevice extends Device {\n //\n // Public `Device` API\n //\n\n static type: string = 'webgl';\n\n static isSupported(): boolean {\n return typeof WebGLRenderingContext !== 'undefined' || isHeadlessGLRegistered();\n }\n\n readonly info: DeviceInfo;\n readonly canvasContext: WebGLCanvasContext;\n\n readonly handle: WebGLRenderingContext;\n\n get features(): Set<DeviceFeature> {\n this._features = this._features || getDeviceFeatures(this.gl);\n return this._features;\n }\n\n get limits(): DeviceLimits {\n this._limits = this._limits || getDeviceLimits(this.gl);\n return this._limits;\n }\n\n readonly lost: Promise<{reason: 'destroyed'; message: string}>;\n\n private _resolveContextLost?: (value: {reason: 'destroyed'; message: string}) => void;\n private _features?: Set<DeviceFeature>;\n private _limits?: DeviceLimits;\n\n //\n // Static methods, expected to be present by `luma.createDevice()`\n //\n\n /**\n * Get a device instance from a GL context\n * Creates and instruments the device if not already created\n * @param gl\n * @returns\n */\n static attach(gl: Device | WebGLRenderingContext | WebGL2RenderingContext): WebGLDevice {\n if (gl instanceof WebGLDevice) {\n return gl;\n }\n // @ts-expect-error\n if (gl?.device instanceof Device) {\n // @ts-expect-error\n return gl.device as WebGLDevice;\n }\n if (!isWebGL(gl)) {\n throw new Error('Invalid WebGLRenderingContext');\n }\n return new WebGLDevice({gl: gl as WebGLRenderingContext});\n }\n\n static async create(props: DeviceProps = {}): Promise<WebGLDevice> {\n log.groupCollapsed(LOG_LEVEL, 'WebGLDevice created');\n\n // Wait for page to load. Only wait when props. canvas is string\n // to avoid setting page onload callback unless necessary\n if (typeof props.canvas === 'string') {\n await CanvasContext.pageLoaded;\n }\n\n // Load webgl and spector debug scripts from CDN if requested\n if (props.debug) {\n await loadWebGLDeveloperTools();\n }\n // @ts-expect-error spector not on props\n if (props.spector) {\n await loadSpectorJS();\n }\n\n log.probe(LOG_LEVEL + 1, 'DOM is loaded')();\n\n // @ts-expect-error\n if (props.gl && props.gl.device) {\n return WebGLDevice.attach(props.gl);\n }\n\n return new WebGLDevice(props);\n }\n\n //\n // Public API\n //\n\n constructor(props: DeviceProps) {\n super({...props, id: props.id || uid('webgl-device')});\n\n // If attaching to an already attached context, return the attached device\n // @ts-expect-error device is attached to context\n const device: WebGLDevice | undefined = props.gl?.device;\n if (device) {\n throw new Error(`WebGL context already attached to device ${device.id}`);\n }\n\n // Create and instrument context\n this.canvasContext = new WebGLCanvasContext(this, props);\n\n this.lost = new Promise<{reason: 'destroyed'; message: string}>((resolve) => {\n this._resolveContextLost = resolve;\n });\n\n const onContextLost = (event: Event) =>\n this._resolveContextLost?.({\n reason: 'destroyed',\n message: 'Computer entered sleep mode, or too many apps or browser tabs are using the GPU.'\n });\n\n let gl: WebGLRenderingContext | WebGL2RenderingContext | null = props.gl || null;\n gl =\n gl ||\n (isBrowser() ? createBrowserContext(this.canvasContext.canvas, {...props, onContextLost}) : null);\n gl = gl || (!isBrowser() ? createHeadlessContext({...props, onContextLost}) : null);\n\n if (!gl) {\n throw new Error('WebGL context creation failed');\n }\n\n this.handle = gl;\n this.gl = this.handle;\n this.gl2 = this.gl as WebGL2RenderingContext;\n this.isWebGL2 = isWebGL2(this.gl);\n this.isWebGL1 = !this.isWebGL2;\n\n // luma Device fields\n this.info = getDeviceInfo(this.gl);\n\n // @ts-expect-error Link webgl context back to device\n this.gl.device = this;\n // @ts-expect-error Annotate webgl context to handle\n this.gl._version = this.isWebGL2 ? 2 : 1;\n\n // Add subset of WebGL2 methods to WebGL1 context\n polyfillContext(this.gl);\n\n // Install context state tracking\n // @ts-expect-error - hidden parameters\n const {enable = true, copyState = false} = props;\n trackContextState(this.gl, {\n enable,\n copyState,\n log: (...args: any[]) => log.log(1, ...args)()\n });\n\n // DEBUG contexts: Add debug instrumentation to the context, force log level to at least 1\n if (isBrowser() && props.debug) {\n this.gl = makeDebugContext(this.gl, {...props, webgl2: this.isWebGL2, throwOnError: true});\n this.gl2 = this.gl as WebGL2RenderingContext;\n this.debug = true;\n log.level = Math.max(log.level, 1);\n log.warn('WebGL debug mode activated. Performance reduced.')();\n }\n\n // @ts-expect-error spector not on props\n if (isBrowser() && props.spector) {\n const canvas = this.handle.canvas || (props.canvas as HTMLCanvasElement);\n this.spector = initializeSpectorJS({...this.props, canvas});\n }\n\n // Log some debug info about the newly created context\n const message = `\\\nCreated ${this.info.type}${this.debug ? ' debug' : ''} context: \\\n${this.info.vendor}, ${this.info.renderer} for canvas: ${this.canvasContext.id}`;\n log.probe(LOG_LEVEL, message)();\n\n log.groupEnd(LOG_LEVEL)();\n }\n\n /**\n * Destroys the context\n * @note Has no effect for browser contexts, there is no browser API for destroying contexts\n */\n destroy(): void {\n const ext = this.gl.getExtension('STACKGL_destroy_context');\n if (ext) {\n ext.destroy();\n }\n }\n\n get isLost(): boolean {\n return this.gl.isContextLost();\n }\n\n getSize(): [number, number] {\n return [this.gl.drawingBufferWidth, this.gl.drawingBufferHeight];\n }\n\n isTextureFormatSupported(format: TextureFormat): boolean {\n return isTextureFormatSupported(this.gl, format);\n }\n\n isTextureFormatFilterable(format: TextureFormat): boolean {\n return isTextureFormatFilterable(this.gl, format);\n }\n\n isTextureFormatRenderable(format: TextureFormat): boolean {\n return isTextureFormatRenderable(this.gl, format);\n }\n\n // WEBGL SPECIFIC METHODS\n\n /** Returns a WebGL2RenderingContext or throws an error */\n assertWebGL2(): WebGL2RenderingContext {\n if (!this.gl2) {\n throw new Error('Requires WebGL2');\n }\n return this.gl2;\n }\n\n // IMPLEMENTATION OF ABSTRACT DEVICE\n\n createCanvasContext(props?: CanvasContextProps): CanvasContext {\n throw new Error('WebGL only supports a single canvas');\n }\n\n _createBuffer(props: BufferProps): WEBGLBuffer {\n return new ClassicBuffer(this, props);\n }\n\n _createTexture(props: TextureProps): WEBGLTexture {\n return new WEBGLTexture(this, props);\n }\n\n createExternalTexture(props: ExternalTextureProps): ExternalTexture {\n throw new Error('createExternalTexture() not implemented'); // return new Program(props);\n }\n\n createSampler(props: SamplerProps): WEBGLSampler {\n return new WEBGLSampler(this, props);\n }\n\n createShader(props: ShaderProps): WEBGLShader {\n return new WEBGLShader(this, props);\n }\n\n createFramebuffer(props: FramebufferProps): WEBGLFramebuffer {\n return new WEBGLFramebuffer(this, props);\n }\n\n createRenderPipeline(props: RenderPipelineProps): WEBGLRenderPipeline {\n return new WEBGLRenderPipeline(this, props);\n }\n\n beginRenderPass(props: RenderPassProps): WEBGLRenderPass {\n return new WEBGLRenderPass(this, props);\n }\n\n createComputePipeline(props?: ComputePipelineProps): ComputePipeline {\n throw new Error('ComputePipeline not supported in WebGL');\n }\n\n beginComputePass(props: ComputePassProps): ComputePass {\n throw new Error('compute shaders not supported in WebGL');\n }\n\n private renderPass: WEBGLRenderPass | null = null;\n\n getDefaultRenderPass(): WEBGLRenderPass {\n this.renderPass =\n this.renderPass ||\n this.beginRenderPass({\n framebuffer: this.canvasContext.getCurrentFramebuffer()\n });\n return this.renderPass;\n }\n\n /**\n * Offscreen Canvas Support: Commit the frame\n * https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/commit\n * Chrome's offscreen canvas does not require gl.commit\n */\n submit(): void {\n this.renderPass?.end();\n this.renderPass = null;\n // this.canvasContext.commit();\n }\n\n //\n // WebGL-only API (not part of `Device` API)\n //\n\n /** WebGL1 typed context. Can always be used. */\n readonly gl: WebGLRenderingContext;\n /** WebGL2 typed context. Need to check isWebGL2 or isWebGL1 before using. */\n readonly gl2: WebGL2RenderingContext | null = null;\n readonly debug: boolean = false;\n\n /** `true` if this is a WebGL1 context. @note `false` if WebGL2 */\n readonly isWebGL1: boolean;\n /** `true` if this is a WebGL2 context. @note `false` if WebGL1 */\n readonly isWebGL2: boolean;\n\n /** State used by luma.gl classes: TODO - move to canvasContext*/\n readonly _canvasSizeInfo = {clientWidth: 0, clientHeight: 0, devicePixelRatio: 1};\n\n /** State used by luma.gl classes - TODO - not used? */\n readonly _extensions: Record<string, any> = {};\n _polyfilled: boolean = false;\n\n /** Instance of Spector.js (if initialized) */\n spector;\n\n private _webglLimits?: WebGLLimits;\n\n /** Return WebGL specific limits */\n get webglLimits() : WebGLLimits {\n this._webglLimits = this._webglLimits || getWebGLLimits(this.gl);\n return this._webglLimits;\n }\n\n /**\n * Loses the context\n * @note Triggers context loss, mainly for testing\n * @todo Promote to `Device` API?\n */\n loseDevice(): void {\n const ext = this.gl.getExtension('WEBGL_lose_context');\n if (ext) {\n ext.loseContext();\n }\n // loseContext should trigger context loss callback but \n this._resolveContextLost?.({\n reason: 'destroyed',\n message: 'Application triggered context loss'\n });\n }\n\n /** Save current WebGL context state onto an internal stack */\n pushState(): void {\n pushContextState(this.gl);\n }\n\n /** Restores previously saved context state */\n popState(): void {\n popContextState(this.gl);\n }\n\n /** \n * Storing data on a special field on WebGLObjects makes that data visible in SPECTOR chrome debug extension \n * luma.gl ids and props can be inspected\n */\n setSpectorMetadata(handle: unknown, props: Record<string, unknown>) {\n // @ts-expect-error\n // eslint-disable-next-line camelcase\n handle.__SPECTOR_Metadata = props;\n }\n}\n\n/** Check if supplied parameter is a WebGLRenderingContext */\nfunction isWebGL(gl: any): boolean {\n if (typeof WebGLRenderingContext !== 'undefined' && gl instanceof WebGLRenderingContext) {\n return true;\n }\n if (typeof WebGL2RenderingContext !== 'undefined' && gl instanceof WebGL2RenderingContext) {\n return true;\n }\n // Look for debug contexts, headless gl etc\n return Boolean(gl && Number.isFinite(gl._version));\n}\n\n/** Check if supplied parameter is a WebGL2RenderingContext */\nfunction isWebGL2(gl: any): boolean {\n if (typeof WebGL2RenderingContext !== 'undefined' && gl instanceof WebGL2RenderingContext) {\n return true;\n }\n // Look for debug contexts, headless gl etc\n return Boolean(gl && gl._version === 2);\n}\n"],"mappings":";AASA,SAAQA,MAAM,EAAEC,aAAa,EAAEC,GAAG,EAAEC,GAAG,QAAO,cAAc;AAC5D,SAAQC,SAAS,QAAO,eAAe;AAAC,SAChCC,eAAe;AAAA,SACfC,eAAe,EAAEC,gBAAgB,EAAEC,iBAAiB;AAAA,SACpDC,oBAAoB;AAAA,SAE1BC,qBAAqB,EACrBC,sBAAsB;AAAA,SAEhBC,aAAa;AAAA,SACbC,iBAAiB;AAAA,SACjBC,eAAe,EAAEC,cAAc;AAAA,OAChCC,kBAAkB;AAAA,SACjBC,aAAa,EAAEC,mBAAmB;AAAA,SAClCC,uBAAuB,EAAEC,gBAAgB;AAAA,SAE/CC,wBAAwB,EACxBC,yBAAyB,EACzBC,yBAAyB;AAAA,OAuBpBC,aAAa;AAAA,OAEbC,WAAW;AAAA,OACXC,YAAY;AAAA,OACZC,YAAY;AAAA,OACZC,gBAAgB;AAAA,OAChBC,eAAe;AAAA,OACfC,mBAAmB;AAE1B,MAAMC,SAAS,GAAG,CAAC;AAGnB,eAAe,MAAMC,WAAW,SAAShC,MAAM,CAAC;EAO9C,OAAOiC,WAAWA,CAAA,EAAY;IAC5B,OAAO,OAAOC,qBAAqB,KAAK,WAAW,IAAIvB,sBAAsB,EAAE;EACjF;EAOA,IAAIwB,QAAQA,CAAA,EAAuB;IACjC,IAAI,CAACC,SAAS,GAAG,IAAI,CAACA,SAAS,IAAIvB,iBAAiB,CAAC,IAAI,CAACwB,EAAE,CAAC;IAC7D,OAAO,IAAI,CAACD,SAAS;EACvB;EAEA,IAAIE,MAAMA,CAAA,EAAiB;IACzB,IAAI,CAACC,OAAO,GAAG,IAAI,CAACA,OAAO,IAAIzB,e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