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

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 (367) hide show
  1. package/dist/adapter/converters/device-parameters.js +199 -136
  2. package/dist/adapter/converters/renderbuffer-formats.d.ts +1 -1
  3. package/dist/adapter/converters/renderbuffer-formats.d.ts.map +1 -1
  4. package/dist/adapter/converters/renderbuffer-formats.js +62 -176
  5. package/dist/adapter/converters/sampler-parameters.js +149 -206
  6. package/dist/adapter/converters/texture-formats.d.ts +2 -2
  7. package/dist/adapter/converters/texture-formats.d.ts.map +1 -1
  8. package/dist/adapter/converters/texture-formats.js +437 -890
  9. package/dist/adapter/converters/vertex-formats.js +15 -33
  10. package/dist/adapter/device-helpers/device-features.js +119 -100
  11. package/dist/adapter/device-helpers/device-limits.d.ts +1 -1
  12. package/dist/adapter/device-helpers/device-limits.d.ts.map +1 -1
  13. package/dist/adapter/device-helpers/device-limits.js +88 -86
  14. package/dist/adapter/device-helpers/get-device-info.js +42 -43
  15. package/dist/adapter/device-helpers/is-old-ie.js +9 -6
  16. package/dist/adapter/helpers/attribute-utils.js +50 -74
  17. package/dist/adapter/helpers/get-shader-info.d.ts +9 -0
  18. package/dist/adapter/helpers/get-shader-info.d.ts.map +1 -0
  19. package/dist/adapter/helpers/get-shader-info.js +27 -0
  20. package/dist/adapter/helpers/get-shader-layout.js +307 -296
  21. package/dist/adapter/helpers/parse-shader-compiler-log.d.ts +1 -1
  22. package/dist/adapter/helpers/parse-shader-compiler-log.d.ts.map +1 -1
  23. package/dist/adapter/helpers/parse-shader-compiler-log.js +32 -33
  24. package/dist/adapter/helpers/set-uniform.js +67 -110
  25. package/dist/adapter/helpers/uniforms.js +80 -85
  26. package/dist/adapter/objects/constants-to-keys.js +33 -33
  27. package/dist/adapter/objects/webgl-renderbuffer.d.ts +1 -1
  28. package/dist/adapter/objects/webgl-renderbuffer.d.ts.map +1 -1
  29. package/dist/adapter/objects/webgl-renderbuffer.js +67 -86
  30. package/dist/adapter/objects/webgl-resource.js +213 -205
  31. package/dist/adapter/objects/webgl-vertex-array-object.d.ts +1 -1
  32. package/dist/adapter/objects/webgl-vertex-array-object.d.ts.map +1 -1
  33. package/dist/adapter/objects/webgl-vertex-array-object.js +74 -76
  34. package/dist/adapter/resources/webgl-buffer.js +150 -147
  35. package/dist/adapter/resources/webgl-command-buffer.d.ts +5 -5
  36. package/dist/adapter/resources/webgl-command-buffer.d.ts.map +1 -1
  37. package/dist/adapter/resources/webgl-command-buffer.js +39 -55
  38. package/dist/adapter/resources/webgl-command-encoder.js +25 -49
  39. package/dist/adapter/resources/webgl-external-texture.js +91 -1
  40. package/dist/adapter/resources/webgl-framebuffer.d.ts +2 -2
  41. package/dist/adapter/resources/webgl-framebuffer.d.ts.map +1 -1
  42. package/dist/adapter/resources/webgl-framebuffer.js +231 -258
  43. package/dist/adapter/resources/webgl-render-pass.d.ts +1 -1
  44. package/dist/adapter/resources/webgl-render-pass.d.ts.map +1 -1
  45. package/dist/adapter/resources/webgl-render-pass.js +8 -18
  46. package/dist/adapter/resources/webgl-render-pipeline.js +316 -378
  47. package/dist/adapter/resources/webgl-sampler.js +42 -47
  48. package/dist/adapter/resources/webgl-shader.d.ts +1 -2
  49. package/dist/adapter/resources/webgl-shader.d.ts.map +1 -1
  50. package/dist/adapter/resources/webgl-shader.js +58 -68
  51. package/dist/adapter/resources/webgl-texture.d.ts +5 -5
  52. package/dist/adapter/resources/webgl-texture.d.ts.map +1 -1
  53. package/dist/adapter/resources/webgl-texture.js +661 -815
  54. package/dist/adapter/webgl-canvas-context.js +55 -49
  55. package/dist/adapter/webgl-device.js +288 -338
  56. package/dist/bundle.js +1 -2
  57. package/dist/classic/accessor.js +120 -127
  58. package/dist/classic/buffer.d.ts +1 -1
  59. package/dist/classic/buffer.d.ts.map +1 -1
  60. package/dist/classic/buffer.js +325 -356
  61. package/dist/classic/typed-array-utils.d.ts +1 -1
  62. package/dist/classic/typed-array-utils.d.ts.map +1 -1
  63. package/dist/classic/typed-array-utils.js +91 -101
  64. package/dist/context/context/create-browser-context.d.ts +1 -2
  65. package/dist/context/context/create-browser-context.d.ts.map +1 -1
  66. package/dist/context/context/create-browser-context.js +61 -52
  67. package/dist/context/context/create-headless-context.d.ts +1 -1
  68. package/dist/context/context/create-headless-context.d.ts.map +1 -1
  69. package/dist/context/context/create-headless-context.js +26 -33
  70. package/dist/context/context/webgl-checks.js +25 -20
  71. package/dist/context/debug/spector.d.ts +1 -2
  72. package/dist/context/debug/spector.d.ts.map +1 -1
  73. package/dist/context/debug/spector.js +53 -62
  74. package/dist/context/debug/webgl-developer-tools.d.ts +1 -1
  75. package/dist/context/debug/webgl-developer-tools.d.ts.map +1 -1
  76. package/dist/context/debug/webgl-developer-tools.js +106 -93
  77. package/dist/context/parameters/unified-parameter-api.js +91 -55
  78. package/dist/context/parameters/webgl-parameter-tables.d.ts +1 -1
  79. package/dist/context/parameters/webgl-parameter-tables.d.ts.map +1 -1
  80. package/dist/context/parameters/webgl-parameter-tables.js +462 -423
  81. package/dist/context/polyfill/context-data.js +16 -12
  82. package/dist/context/polyfill/get-parameter-polyfill.js +91 -76
  83. package/dist/context/polyfill/polyfill-context.js +75 -80
  84. package/dist/context/polyfill/polyfill-table.js +133 -139
  85. package/dist/context/polyfill/polyfill-vertex-array-object.js +255 -297
  86. package/dist/context/state-tracker/deep-array-equal.js +16 -18
  87. package/dist/context/state-tracker/track-context-state.js +183 -161
  88. package/dist/context/state-tracker/with-parameters.js +43 -35
  89. package/dist/dist.min.js +1 -0
  90. package/dist/es5/adapter/converters/device-parameters.js +3 -38
  91. package/dist/es5/adapter/converters/device-parameters.js.map +1 -1
  92. package/dist/es5/adapter/converters/renderbuffer-formats.js +2 -14
  93. package/dist/es5/adapter/converters/renderbuffer-formats.js.map +1 -1
  94. package/dist/es5/adapter/converters/sampler-parameters.js +2 -65
  95. package/dist/es5/adapter/converters/sampler-parameters.js.map +1 -1
  96. package/dist/es5/adapter/converters/texture-formats.js +9 -81
  97. package/dist/es5/adapter/converters/texture-formats.js.map +1 -1
  98. package/dist/es5/adapter/converters/vertex-formats.js +0 -12
  99. package/dist/es5/adapter/converters/vertex-formats.js.map +1 -1
  100. package/dist/es5/adapter/device-helpers/device-features.js +6 -40
  101. package/dist/es5/adapter/device-helpers/device-features.js.map +1 -1
  102. package/dist/es5/adapter/device-helpers/device-limits.js +0 -10
  103. package/dist/es5/adapter/device-helpers/device-limits.js.map +1 -1
  104. package/dist/es5/adapter/device-helpers/get-device-info.js +0 -10
  105. package/dist/es5/adapter/device-helpers/get-device-info.js.map +1 -1
  106. package/dist/es5/adapter/device-helpers/is-old-ie.js +0 -1
  107. package/dist/es5/adapter/device-helpers/is-old-ie.js.map +1 -1
  108. package/dist/es5/adapter/helpers/attribute-utils.js +3 -25
  109. package/dist/es5/adapter/helpers/attribute-utils.js.map +1 -1
  110. package/dist/es5/adapter/helpers/get-shader-info.js +31 -0
  111. package/dist/es5/adapter/helpers/get-shader-info.js.map +1 -0
  112. package/dist/es5/adapter/helpers/get-shader-layout.js +23 -101
  113. package/dist/es5/adapter/helpers/get-shader-layout.js.map +1 -1
  114. package/dist/es5/adapter/helpers/parse-shader-compiler-log.js +6 -24
  115. package/dist/es5/adapter/helpers/parse-shader-compiler-log.js.map +1 -1
  116. package/dist/es5/adapter/helpers/set-uniform.js +0 -33
  117. package/dist/es5/adapter/helpers/set-uniform.js.map +1 -1
  118. package/dist/es5/adapter/helpers/uniforms.js +13 -37
  119. package/dist/es5/adapter/helpers/uniforms.js.map +1 -1
  120. package/dist/es5/adapter/objects/constants-to-keys.js +1 -12
  121. package/dist/es5/adapter/objects/constants-to-keys.js.map +1 -1
  122. package/dist/es5/adapter/objects/webgl-renderbuffer.js +5 -33
  123. package/dist/es5/adapter/objects/webgl-renderbuffer.js.map +1 -1
  124. package/dist/es5/adapter/objects/webgl-resource.js +6 -60
  125. package/dist/es5/adapter/objects/webgl-resource.js.map +1 -1
  126. package/dist/es5/adapter/objects/webgl-vertex-array-object.js +7 -35
  127. package/dist/es5/adapter/objects/webgl-vertex-array-object.js.map +1 -1
  128. package/dist/es5/adapter/resources/webgl-buffer.js +20 -66
  129. package/dist/es5/adapter/resources/webgl-buffer.js.map +1 -1
  130. package/dist/es5/adapter/resources/webgl-command-buffer.js +6 -32
  131. package/dist/es5/adapter/resources/webgl-command-buffer.js.map +1 -1
  132. package/dist/es5/adapter/resources/webgl-command-encoder.js +0 -18
  133. package/dist/es5/adapter/resources/webgl-command-encoder.js.map +1 -1
  134. package/dist/es5/adapter/resources/webgl-external-texture.js.map +1 -1
  135. package/dist/es5/adapter/resources/webgl-framebuffer.js +10 -82
  136. package/dist/es5/adapter/resources/webgl-framebuffer.js.map +1 -1
  137. package/dist/es5/adapter/resources/webgl-render-pass.js +2 -19
  138. package/dist/es5/adapter/resources/webgl-render-pass.js.map +1 -1
  139. package/dist/es5/adapter/resources/webgl-render-pipeline.js +24 -133
  140. package/dist/es5/adapter/resources/webgl-render-pipeline.js.map +1 -1
  141. package/dist/es5/adapter/resources/webgl-sampler.js +2 -28
  142. package/dist/es5/adapter/resources/webgl-sampler.js.map +1 -1
  143. package/dist/es5/adapter/resources/webgl-shader.js +13 -52
  144. package/dist/es5/adapter/resources/webgl-shader.js.map +1 -1
  145. package/dist/es5/adapter/resources/webgl-texture.js +137 -291
  146. package/dist/es5/adapter/resources/webgl-texture.js.map +1 -1
  147. package/dist/es5/adapter/webgl-canvas-context.js +0 -24
  148. package/dist/es5/adapter/webgl-canvas-context.js.map +1 -1
  149. package/dist/es5/adapter/webgl-device.js +40 -127
  150. package/dist/es5/adapter/webgl-device.js.map +1 -1
  151. package/dist/es5/bundle.js +0 -1
  152. package/dist/es5/bundle.js.map +1 -1
  153. package/dist/es5/classic/accessor.js +1 -31
  154. package/dist/es5/classic/accessor.js.map +1 -1
  155. package/dist/es5/classic/buffer.js +32 -102
  156. package/dist/es5/classic/buffer.js.map +1 -1
  157. package/dist/es5/classic/typed-array-utils.js +10 -37
  158. package/dist/es5/classic/typed-array-utils.js.map +1 -1
  159. package/dist/es5/context/context/create-browser-context.js +4 -21
  160. package/dist/es5/context/context/create-browser-context.js.map +1 -1
  161. package/dist/es5/context/context/create-headless-context.js +8 -21
  162. package/dist/es5/context/context/create-headless-context.js.map +1 -1
  163. package/dist/es5/context/context/webgl-checks.js +4 -14
  164. package/dist/es5/context/context/webgl-checks.js.map +1 -1
  165. package/dist/es5/context/debug/spector.js +20 -54
  166. package/dist/es5/context/debug/spector.js.map +1 -1
  167. package/dist/es5/context/debug/webgl-developer-tools.js +19 -65
  168. package/dist/es5/context/debug/webgl-developer-tools.js.map +1 -1
  169. package/dist/es5/context/parameters/unified-parameter-api.js +3 -28
  170. package/dist/es5/context/parameters/unified-parameter-api.js.map +1 -1
  171. package/dist/es5/context/parameters/webgl-parameter-tables.js +18 -65
  172. package/dist/es5/context/parameters/webgl-parameter-tables.js.map +1 -1
  173. package/dist/es5/context/polyfill/context-data.js +0 -3
  174. package/dist/es5/context/polyfill/context-data.js.map +1 -1
  175. package/dist/es5/context/polyfill/get-parameter-polyfill.js +0 -12
  176. package/dist/es5/context/polyfill/get-parameter-polyfill.js.map +1 -1
  177. package/dist/es5/context/polyfill/polyfill-context.js +8 -33
  178. package/dist/es5/context/polyfill/polyfill-context.js.map +1 -1
  179. package/dist/es5/context/polyfill/polyfill-table.js +3 -27
  180. package/dist/es5/context/polyfill/polyfill-table.js.map +1 -1
  181. package/dist/es5/context/polyfill/polyfill-vertex-array-object.js +0 -70
  182. package/dist/es5/context/polyfill/polyfill-vertex-array-object.js.map +1 -1
  183. package/dist/es5/context/state-tracker/deep-array-equal.js +0 -5
  184. package/dist/es5/context/state-tracker/deep-array-equal.js.map +1 -1
  185. package/dist/es5/context/state-tracker/track-context-state.js +10 -53
  186. package/dist/es5/context/state-tracker/track-context-state.js.map +1 -1
  187. package/dist/es5/context/state-tracker/with-parameters.js +1 -13
  188. package/dist/es5/context/state-tracker/with-parameters.js.map +1 -1
  189. package/dist/es5/index.js +72 -99
  190. package/dist/es5/index.js.map +1 -1
  191. package/dist/es5/init.js +0 -3
  192. package/dist/es5/init.js.map +1 -1
  193. package/dist/es5/types/webgl.js +0 -1
  194. package/dist/es5/types/webgl.js.map +1 -1
  195. package/dist/es5/types.js.map +1 -1
  196. package/dist/esm/adapter/converters/device-parameters.js +0 -20
  197. package/dist/esm/adapter/converters/device-parameters.js.map +1 -1
  198. package/dist/esm/adapter/converters/renderbuffer-formats.js +0 -4
  199. package/dist/esm/adapter/converters/renderbuffer-formats.js.map +1 -1
  200. package/dist/esm/adapter/converters/sampler-parameters.js +2 -57
  201. package/dist/esm/adapter/converters/sampler-parameters.js.map +1 -1
  202. package/dist/esm/adapter/converters/texture-formats.js +8 -52
  203. package/dist/esm/adapter/converters/texture-formats.js.map +1 -1
  204. package/dist/esm/adapter/converters/vertex-formats.js +0 -9
  205. package/dist/esm/adapter/converters/vertex-formats.js.map +1 -1
  206. package/dist/esm/adapter/device-helpers/device-features.js +2 -19
  207. package/dist/esm/adapter/device-helpers/device-features.js.map +1 -1
  208. package/dist/esm/adapter/device-helpers/device-limits.js +0 -3
  209. package/dist/esm/adapter/device-helpers/device-limits.js.map +1 -1
  210. package/dist/esm/adapter/device-helpers/get-device-info.js +0 -6
  211. package/dist/esm/adapter/device-helpers/get-device-info.js.map +1 -1
  212. package/dist/esm/adapter/device-helpers/is-old-ie.js +2 -1
  213. package/dist/esm/adapter/device-helpers/is-old-ie.js.map +1 -1
  214. package/dist/esm/adapter/helpers/attribute-utils.js +0 -17
  215. package/dist/esm/adapter/helpers/attribute-utils.js.map +1 -1
  216. package/dist/esm/adapter/helpers/get-shader-info.js +25 -0
  217. package/dist/esm/adapter/helpers/get-shader-info.js.map +1 -0
  218. package/dist/esm/adapter/helpers/get-shader-layout.js +2 -48
  219. package/dist/esm/adapter/helpers/get-shader-layout.js.map +1 -1
  220. package/dist/esm/adapter/helpers/parse-shader-compiler-log.js +0 -7
  221. package/dist/esm/adapter/helpers/parse-shader-compiler-log.js.map +1 -1
  222. package/dist/esm/adapter/helpers/set-uniform.js +0 -30
  223. package/dist/esm/adapter/helpers/set-uniform.js.map +1 -1
  224. package/dist/esm/adapter/helpers/uniforms.js +0 -10
  225. package/dist/esm/adapter/helpers/uniforms.js.map +1 -1
  226. package/dist/esm/adapter/objects/constants-to-keys.js +0 -7
  227. package/dist/esm/adapter/objects/constants-to-keys.js.map +1 -1
  228. package/dist/esm/adapter/objects/webgl-renderbuffer.js +2 -18
  229. package/dist/esm/adapter/objects/webgl-renderbuffer.js.map +1 -1
  230. package/dist/esm/adapter/objects/webgl-resource.js +10 -57
  231. package/dist/esm/adapter/objects/webgl-resource.js.map +1 -1
  232. package/dist/esm/adapter/objects/webgl-vertex-array-object.js +5 -15
  233. package/dist/esm/adapter/objects/webgl-vertex-array-object.js.map +1 -1
  234. package/dist/esm/adapter/resources/webgl-buffer.js +12 -40
  235. package/dist/esm/adapter/resources/webgl-buffer.js.map +1 -1
  236. package/dist/esm/adapter/resources/webgl-command-buffer.js +2 -17
  237. package/dist/esm/adapter/resources/webgl-command-buffer.js.map +1 -1
  238. package/dist/esm/adapter/resources/webgl-command-encoder.js +0 -12
  239. package/dist/esm/adapter/resources/webgl-command-encoder.js.map +1 -1
  240. package/dist/esm/adapter/resources/webgl-external-texture.js.map +1 -1
  241. package/dist/esm/adapter/resources/webgl-framebuffer.js +0 -60
  242. package/dist/esm/adapter/resources/webgl-framebuffer.js.map +1 -1
  243. package/dist/esm/adapter/resources/webgl-render-pass.js +1 -8
  244. package/dist/esm/adapter/resources/webgl-render-pass.js.map +1 -1
  245. package/dist/esm/adapter/resources/webgl-render-pipeline.js +0 -89
  246. package/dist/esm/adapter/resources/webgl-render-pipeline.js.map +1 -1
  247. package/dist/esm/adapter/resources/webgl-sampler.js +0 -12
  248. package/dist/esm/adapter/resources/webgl-sampler.js.map +1 -1
  249. package/dist/esm/adapter/resources/webgl-shader.js +2 -16
  250. package/dist/esm/adapter/resources/webgl-shader.js.map +1 -1
  251. package/dist/esm/adapter/resources/webgl-texture.js +36 -154
  252. package/dist/esm/adapter/resources/webgl-texture.js.map +1 -1
  253. package/dist/esm/adapter/webgl-canvas-context.js +0 -14
  254. package/dist/esm/adapter/webgl-canvas-context.js.map +1 -1
  255. package/dist/esm/adapter/webgl-device.js +19 -89
  256. package/dist/esm/adapter/webgl-device.js.map +1 -1
  257. package/dist/esm/bundle.js +0 -1
  258. package/dist/esm/bundle.js.map +1 -1
  259. package/dist/esm/classic/accessor.js +10 -34
  260. package/dist/esm/classic/accessor.js.map +1 -1
  261. package/dist/esm/classic/buffer.js +15 -71
  262. package/dist/esm/classic/buffer.js.map +1 -1
  263. package/dist/esm/classic/typed-array-utils.js +0 -20
  264. package/dist/esm/classic/typed-array-utils.js.map +1 -1
  265. package/dist/esm/context/context/create-browser-context.js +6 -14
  266. package/dist/esm/context/context/create-browser-context.js.map +1 -1
  267. package/dist/esm/context/context/create-headless-context.js +2 -6
  268. package/dist/esm/context/context/create-headless-context.js.map +1 -1
  269. package/dist/esm/context/context/webgl-checks.js +0 -3
  270. package/dist/esm/context/context/webgl-checks.js.map +1 -1
  271. package/dist/esm/context/debug/spector.js +2 -14
  272. package/dist/esm/context/debug/spector.js.map +1 -1
  273. package/dist/esm/context/debug/webgl-developer-tools.js +4 -22
  274. package/dist/esm/context/debug/webgl-developer-tools.js.map +1 -1
  275. package/dist/esm/context/parameters/unified-parameter-api.js +2 -13
  276. package/dist/esm/context/parameters/unified-parameter-api.js.map +1 -1
  277. package/dist/esm/context/parameters/webgl-parameter-tables.js +0 -19
  278. package/dist/esm/context/parameters/webgl-parameter-tables.js.map +1 -1
  279. package/dist/esm/context/polyfill/context-data.js +0 -2
  280. package/dist/esm/context/polyfill/context-data.js.map +1 -1
  281. package/dist/esm/context/polyfill/get-parameter-polyfill.js +0 -5
  282. package/dist/esm/context/polyfill/get-parameter-polyfill.js.map +1 -1
  283. package/dist/esm/context/polyfill/polyfill-context.js +14 -21
  284. package/dist/esm/context/polyfill/polyfill-context.js.map +1 -1
  285. package/dist/esm/context/polyfill/polyfill-table.js +0 -23
  286. package/dist/esm/context/polyfill/polyfill-table.js.map +1 -1
  287. package/dist/esm/context/polyfill/polyfill-vertex-array-object.js +0 -70
  288. package/dist/esm/context/polyfill/polyfill-vertex-array-object.js.map +1 -1
  289. package/dist/esm/context/state-tracker/deep-array-equal.js +0 -4
  290. package/dist/esm/context/state-tracker/deep-array-equal.js.map +1 -1
  291. package/dist/esm/context/state-tracker/track-context-state.js +11 -45
  292. package/dist/esm/context/state-tracker/track-context-state.js.map +1 -1
  293. package/dist/esm/context/state-tracker/with-parameters.js +0 -6
  294. package/dist/esm/context/state-tracker/with-parameters.js.map +1 -1
  295. package/dist/esm/index.js.map +1 -1
  296. package/dist/esm/init.js.map +1 -1
  297. package/dist/esm/types/webgl.js.map +1 -1
  298. package/dist/esm/types.js.map +1 -1
  299. package/dist/index.js +39 -25
  300. package/dist/init.js +1 -2
  301. package/dist/types/webgl.d.ts +20 -20
  302. package/dist/types/webgl.d.ts.map +1 -1
  303. package/dist/types/webgl.js +0 -1
  304. package/dist/types.d.ts +1 -1
  305. package/dist/types.d.ts.map +1 -1
  306. package/dist/types.js +0 -1
  307. package/package.json +8 -8
  308. package/src/adapter/helpers/get-shader-info.ts +37 -0
  309. package/src/adapter/helpers/parse-shader-compiler-log.ts +1 -1
  310. package/src/adapter/resources/webgl-render-pass.ts +1 -1
  311. package/src/adapter/resources/webgl-shader.ts +2 -2
  312. package/src/adapter/webgl-device.ts +1 -1
  313. package/src/context/debug/webgl-developer-tools.ts +0 -1
  314. package/src/types/webgl.ts +4 -4
  315. package/dist/adapter/converters/device-parameters.js.map +0 -1
  316. package/dist/adapter/converters/renderbuffer-formats.js.map +0 -1
  317. package/dist/adapter/converters/sampler-parameters.js.map +0 -1
  318. package/dist/adapter/converters/texture-formats.js.map +0 -1
  319. package/dist/adapter/converters/vertex-formats.js.map +0 -1
  320. package/dist/adapter/device-helpers/device-features.js.map +0 -1
  321. package/dist/adapter/device-helpers/device-limits.js.map +0 -1
  322. package/dist/adapter/device-helpers/get-device-info.js.map +0 -1
  323. package/dist/adapter/device-helpers/is-old-ie.js.map +0 -1
  324. package/dist/adapter/helpers/attribute-utils.js.map +0 -1
  325. package/dist/adapter/helpers/get-shader-layout.js.map +0 -1
  326. package/dist/adapter/helpers/parse-shader-compiler-log.js.map +0 -1
  327. package/dist/adapter/helpers/set-uniform.js.map +0 -1
  328. package/dist/adapter/helpers/uniforms.js.map +0 -1
  329. package/dist/adapter/objects/constants-to-keys.js.map +0 -1
  330. package/dist/adapter/objects/webgl-renderbuffer.js.map +0 -1
  331. package/dist/adapter/objects/webgl-resource.js.map +0 -1
  332. package/dist/adapter/objects/webgl-vertex-array-object.js.map +0 -1
  333. package/dist/adapter/resources/webgl-buffer.js.map +0 -1
  334. package/dist/adapter/resources/webgl-command-buffer.js.map +0 -1
  335. package/dist/adapter/resources/webgl-command-encoder.js.map +0 -1
  336. package/dist/adapter/resources/webgl-external-texture.js.map +0 -1
  337. package/dist/adapter/resources/webgl-framebuffer.js.map +0 -1
  338. package/dist/adapter/resources/webgl-render-pass.js.map +0 -1
  339. package/dist/adapter/resources/webgl-render-pipeline.js.map +0 -1
  340. package/dist/adapter/resources/webgl-sampler.js.map +0 -1
  341. package/dist/adapter/resources/webgl-shader.js.map +0 -1
  342. package/dist/adapter/resources/webgl-texture.js.map +0 -1
  343. package/dist/adapter/webgl-canvas-context.js.map +0 -1
  344. package/dist/adapter/webgl-device.js.map +0 -1
  345. package/dist/bundle.js.map +0 -1
  346. package/dist/classic/accessor.js.map +0 -1
  347. package/dist/classic/buffer.js.map +0 -1
  348. package/dist/classic/typed-array-utils.js.map +0 -1
  349. package/dist/context/context/create-browser-context.js.map +0 -1
  350. package/dist/context/context/create-headless-context.js.map +0 -1
  351. package/dist/context/context/webgl-checks.js.map +0 -1
  352. package/dist/context/debug/spector.js.map +0 -1
  353. package/dist/context/debug/webgl-developer-tools.js.map +0 -1
  354. package/dist/context/parameters/unified-parameter-api.js.map +0 -1
  355. package/dist/context/parameters/webgl-parameter-tables.js.map +0 -1
  356. package/dist/context/polyfill/context-data.js.map +0 -1
  357. package/dist/context/polyfill/get-parameter-polyfill.js.map +0 -1
  358. package/dist/context/polyfill/polyfill-context.js.map +0 -1
  359. package/dist/context/polyfill/polyfill-table.js.map +0 -1
  360. package/dist/context/polyfill/polyfill-vertex-array-object.js.map +0 -1
  361. package/dist/context/state-tracker/deep-array-equal.js.map +0 -1
  362. package/dist/context/state-tracker/track-context-state.js.map +0 -1
  363. package/dist/context/state-tracker/with-parameters.js.map +0 -1
  364. package/dist/index.js.map +0 -1
  365. package/dist/init.js.map +0 -1
  366. package/dist/types/webgl.js.map +0 -1
  367. package/dist/types.js.map +0 -1
@@ -5,52 +5,41 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.polyfillVertexArrayObject = polyfillVertexArrayObject;
7
7
  var glErrorShadow = {};
8
-
9
8
  function error(msg) {
10
9
  if (globalThis.console && globalThis.console.error) {
11
10
  globalThis.console.error(msg);
12
11
  }
13
12
  }
14
-
15
13
  function log(msg) {
16
14
  if (globalThis.console && globalThis.console.log) {
17
15
  globalThis.console.log(msg);
18
16
  }
19
17
  }
20
-
21
18
  function synthesizeGLError(err, opt_msg) {
22
19
  glErrorShadow[err] = true;
23
-
24
20
  if (opt_msg !== undefined) {
25
21
  error(opt_msg);
26
22
  }
27
23
  }
28
-
29
24
  function wrapGLError(gl) {
30
25
  var f = gl.getError;
31
-
32
26
  gl.getError = function getError() {
33
27
  var err;
34
-
35
28
  do {
36
29
  err = f.apply(gl);
37
-
38
30
  if (err !== gl.NO_ERROR) {
39
31
  glErrorShadow[err] = true;
40
32
  }
41
33
  } while (err !== gl.NO_ERROR);
42
-
43
34
  for (err in glErrorShadow) {
44
35
  if (glErrorShadow[err]) {
45
36
  delete glErrorShadow[err];
46
37
  return parseInt(err, 10);
47
38
  }
48
39
  }
49
-
50
40
  return gl.NO_ERROR;
51
41
  };
52
42
  }
53
-
54
43
  var WebGLVertexArrayObjectOES = function WebGLVertexArrayObjectOES(ext) {
55
44
  var gl = ext.gl;
56
45
  this.ext = ext;
@@ -58,15 +47,12 @@ var WebGLVertexArrayObjectOES = function WebGLVertexArrayObjectOES(ext) {
58
47
  this.hasBeenBound = false;
59
48
  this.elementArrayBuffer = null;
60
49
  this.attribs = new Array(ext.maxVertexAttribs);
61
-
62
50
  for (var n = 0; n < this.attribs.length; n++) {
63
51
  var attrib = new WebGLVertexArrayObjectOES.VertexAttrib(gl);
64
52
  this.attribs[n] = attrib;
65
53
  }
66
-
67
54
  this.maxAttrib = 0;
68
55
  };
69
-
70
56
  WebGLVertexArrayObjectOES.VertexAttrib = function VertexAttrib(gl) {
71
57
  this.enabled = false;
72
58
  this.buffer = null;
@@ -78,11 +64,9 @@ WebGLVertexArrayObjectOES.VertexAttrib = function VertexAttrib(gl) {
78
64
  this.cached = '';
79
65
  this.recache();
80
66
  };
81
-
82
67
  WebGLVertexArrayObjectOES.VertexAttrib.prototype.recache = function recache() {
83
68
  this.cached = [this.size, this.type, this.normalized, this.stride, this.offset].join(':');
84
69
  };
85
-
86
70
  var OESVertexArrayObject = function OESVertexArrayObject(gl) {
87
71
  var self = this;
88
72
  this.gl = gl;
@@ -95,19 +79,15 @@ var OESVertexArrayObject = function OESVertexArrayObject(gl) {
95
79
  getVertexAttrib: gl.getVertexAttrib,
96
80
  vertexAttribPointer: gl.vertexAttribPointer
97
81
  };
98
-
99
82
  gl.getParameter = function getParameter(pname) {
100
83
  if (pname === self.VERTEX_ARRAY_BINDING_OES) {
101
84
  if (self.currentVertexArrayObject === self.defaultVertexArrayObject) {
102
85
  return null;
103
86
  }
104
-
105
87
  return self.currentVertexArrayObject;
106
88
  }
107
-
108
89
  return original.getParameter.apply(this, arguments);
109
90
  };
110
-
111
91
  gl.enableVertexAttribArray = function enableVertexAttribArray(index) {
112
92
  var vao = self.currentVertexArrayObject;
113
93
  vao.maxAttrib = Math.max(vao.maxAttrib, index);
@@ -115,7 +95,6 @@ var OESVertexArrayObject = function OESVertexArrayObject(gl) {
115
95
  attrib.enabled = true;
116
96
  return original.enableVertexAttribArray.apply(this, arguments);
117
97
  };
118
-
119
98
  gl.disableVertexAttribArray = function disableVertexAttribArray(index) {
120
99
  var vao = self.currentVertexArrayObject;
121
100
  vao.maxAttrib = Math.max(vao.maxAttrib, index);
@@ -123,51 +102,38 @@ var OESVertexArrayObject = function OESVertexArrayObject(gl) {
123
102
  attrib.enabled = false;
124
103
  return original.disableVertexAttribArray.apply(this, arguments);
125
104
  };
126
-
127
105
  gl.bindBuffer = function bindBuffer(target, buffer) {
128
106
  switch (target) {
129
107
  case gl.ARRAY_BUFFER:
130
108
  self.currentArrayBuffer = buffer;
131
109
  break;
132
-
133
110
  case gl.ELEMENT_ARRAY_BUFFER:
134
111
  self.currentVertexArrayObject.elementArrayBuffer = buffer;
135
112
  break;
136
-
137
113
  default:
138
114
  }
139
-
140
115
  return original.bindBuffer.apply(this, arguments);
141
116
  };
142
-
143
117
  gl.getVertexAttrib = function getVertexAttrib(index, pname) {
144
118
  var vao = self.currentVertexArrayObject;
145
119
  var attrib = vao.attribs[index];
146
-
147
120
  switch (pname) {
148
121
  case gl.VERTEX_ATTRIB_ARRAY_BUFFER_BINDING:
149
122
  return attrib.buffer;
150
-
151
123
  case gl.VERTEX_ATTRIB_ARRAY_ENABLED:
152
124
  return attrib.enabled;
153
-
154
125
  case gl.VERTEX_ATTRIB_ARRAY_SIZE:
155
126
  return attrib.size;
156
-
157
127
  case gl.VERTEX_ATTRIB_ARRAY_STRIDE:
158
128
  return attrib.stride;
159
-
160
129
  case gl.VERTEX_ATTRIB_ARRAY_TYPE:
161
130
  return attrib.type;
162
-
163
131
  case gl.VERTEX_ATTRIB_ARRAY_NORMALIZED:
164
132
  return attrib.normalized;
165
-
166
133
  default:
167
134
  return original.getVertexAttrib.apply(this, arguments);
168
135
  }
169
136
  };
170
-
171
137
  gl.vertexAttribPointer = function vertexAttribPointer(indx, size, type, normalized, stride, offset) {
172
138
  var vao = self.currentVertexArrayObject;
173
139
  vao.maxAttrib = Math.max(vao.maxAttrib, indx);
@@ -181,32 +147,25 @@ var OESVertexArrayObject = function OESVertexArrayObject(gl) {
181
147
  attrib.recache();
182
148
  return original.vertexAttribPointer.apply(this, arguments);
183
149
  };
184
-
185
150
  if (gl.instrumentExtension) {
186
151
  gl.instrumentExtension(this, 'OES_vertex_array_object');
187
152
  }
188
-
189
153
  if (gl.canvas) {
190
154
  gl.canvas.addEventListener('webglcontextrestored', function () {
191
155
  log('OESVertexArrayObject emulation library context restored');
192
156
  self.reset_();
193
157
  }, true);
194
158
  }
195
-
196
159
  this.reset_();
197
160
  };
198
-
199
161
  OESVertexArrayObject.prototype.VERTEX_ARRAY_BINDING_OES = 0x85b5;
200
-
201
162
  OESVertexArrayObject.prototype.reset_ = function reset_() {
202
163
  var contextWasLost = this.vertexArrayObjects !== undefined;
203
-
204
164
  if (contextWasLost) {
205
165
  for (var ii = 0; ii < this.vertexArrayObjects.length; ++ii) {
206
166
  this.vertexArrayObjects.isAlive = false;
207
167
  }
208
168
  }
209
-
210
169
  var gl = this.gl;
211
170
  this.maxVertexAttribs = gl.getParameter(gl.MAX_VERTEX_ATTRIBS);
212
171
  this.defaultVertexArrayObject = new WebGLVertexArrayObjectOES(this);
@@ -215,61 +174,48 @@ OESVertexArrayObject.prototype.reset_ = function reset_() {
215
174
  this.vertexArrayObjects = [this.defaultVertexArrayObject];
216
175
  this.bindVertexArrayOES(null);
217
176
  };
218
-
219
177
  OESVertexArrayObject.prototype.createVertexArrayOES = function createVertexArrayOES() {
220
178
  var arrayObject = new WebGLVertexArrayObjectOES(this);
221
179
  this.vertexArrayObjects.push(arrayObject);
222
180
  return arrayObject;
223
181
  };
224
-
225
182
  OESVertexArrayObject.prototype.deleteVertexArrayOES = function deleteVertexArrayOES(arrayObject) {
226
183
  arrayObject.isAlive = false;
227
184
  this.vertexArrayObjects.splice(this.vertexArrayObjects.indexOf(arrayObject), 1);
228
-
229
185
  if (this.currentVertexArrayObject === arrayObject) {
230
186
  this.bindVertexArrayOES(null);
231
187
  }
232
188
  };
233
-
234
189
  OESVertexArrayObject.prototype.isVertexArrayOES = function isVertexArrayOES(arrayObject) {
235
190
  if (arrayObject && arrayObject instanceof WebGLVertexArrayObjectOES) {
236
191
  if (arrayObject.hasBeenBound && arrayObject.ext === this) {
237
192
  return true;
238
193
  }
239
194
  }
240
-
241
195
  return false;
242
196
  };
243
-
244
197
  OESVertexArrayObject.prototype.bindVertexArrayOES = function bindVertexArrayOES(arrayObject) {
245
198
  var gl = this.gl;
246
-
247
199
  if (arrayObject && !arrayObject.isAlive) {
248
200
  synthesizeGLError(gl.INVALID_OPERATION, 'bindVertexArrayOES: attempt to bind deleted arrayObject');
249
201
  return;
250
202
  }
251
-
252
203
  var original = this.original;
253
204
  var oldVAO = this.currentVertexArrayObject;
254
205
  this.currentVertexArrayObject = arrayObject || this.defaultVertexArrayObject;
255
206
  this.currentVertexArrayObject.hasBeenBound = true;
256
207
  var newVAO = this.currentVertexArrayObject;
257
-
258
208
  if (oldVAO === newVAO) {
259
209
  return;
260
210
  }
261
-
262
211
  if (!oldVAO || newVAO.elementArrayBuffer !== oldVAO.elementArrayBuffer) {
263
212
  original.bindBuffer.call(gl, gl.ELEMENT_ARRAY_BUFFER, newVAO.elementArrayBuffer);
264
213
  }
265
-
266
214
  var currentBinding = this.currentArrayBuffer;
267
215
  var maxAttrib = Math.max(oldVAO ? oldVAO.maxAttrib : 0, newVAO.maxAttrib);
268
-
269
216
  for (var n = 0; n <= maxAttrib; n++) {
270
217
  var attrib = newVAO.attribs[n];
271
218
  var oldAttrib = oldVAO ? oldVAO.attribs[n] : null;
272
-
273
219
  if (!oldVAO || attrib.enabled !== oldAttrib.enabled) {
274
220
  if (attrib.enabled) {
275
221
  original.enableVertexAttribArray.call(gl, n);
@@ -277,64 +223,48 @@ OESVertexArrayObject.prototype.bindVertexArrayOES = function bindVertexArrayOES(
277
223
  original.disableVertexAttribArray.call(gl, n);
278
224
  }
279
225
  }
280
-
281
226
  if (attrib.enabled) {
282
227
  var bufferChanged = false;
283
-
284
228
  if (!oldVAO || attrib.buffer !== oldAttrib.buffer) {
285
229
  if (currentBinding !== attrib.buffer) {
286
230
  original.bindBuffer.call(gl, gl.ARRAY_BUFFER, attrib.buffer);
287
231
  currentBinding = attrib.buffer;
288
232
  }
289
-
290
233
  bufferChanged = true;
291
234
  }
292
-
293
235
  if (bufferChanged || attrib.cached !== oldAttrib.cached) {
294
236
  original.vertexAttribPointer.call(gl, n, attrib.size, attrib.type, attrib.normalized, attrib.stride, attrib.offset);
295
237
  }
296
238
  }
297
239
  }
298
-
299
240
  if (this.currentArrayBuffer !== currentBinding) {
300
241
  original.bindBuffer.call(gl, gl.ARRAY_BUFFER, this.currentArrayBuffer);
301
242
  }
302
243
  };
303
-
304
244
  function polyfillVertexArrayObject(gl) {
305
245
  if (typeof gl.createVertexArray === 'function') {
306
246
  return;
307
247
  }
308
-
309
248
  var original_getSupportedExtensions = gl.getSupportedExtensions;
310
-
311
249
  gl.getSupportedExtensions = function getSupportedExtensions() {
312
250
  var list = original_getSupportedExtensions.call(this) || [];
313
-
314
251
  if (list.indexOf('OES_vertex_array_object') < 0) {
315
252
  list.push('OES_vertex_array_object');
316
253
  }
317
-
318
254
  return list;
319
255
  };
320
-
321
256
  var original_getExtension = gl.getExtension;
322
-
323
257
  gl.getExtension = function getExtension(name) {
324
258
  var ext = original_getExtension.call(this, name);
325
-
326
259
  if (ext) {
327
260
  return ext;
328
261
  }
329
-
330
262
  if (name !== 'OES_vertex_array_object') {
331
263
  return null;
332
264
  }
333
-
334
265
  if (!gl.__OESVertexArrayObject) {
335
266
  this.__OESVertexArrayObject = new OESVertexArrayObject(this);
336
267
  }
337
-
338
268
  return this.__OESVertexArrayObject;
339
269
  };
340
270
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/context/polyfill/polyfill-vertex-array-object.ts"],"names":["glErrorShadow","error","msg","globalThis","console","log","synthesizeGLError","err","opt_msg","undefined","wrapGLError","gl","f","getError","apply","NO_ERROR","parseInt","WebGLVertexArrayObjectOES","ext","isAlive","hasBeenBound","elementArrayBuffer","attribs","Array","maxVertexAttribs","n","length","attrib","VertexAttrib","maxAttrib","enabled","buffer","size","type","FLOAT","normalized","stride","offset","cached","recache","prototype","join","OESVertexArrayObject","self","original","getParameter","enableVertexAttribArray","disableVertexAttribArray","bindBuffer","getVertexAttrib","vertexAttribPointer","pname","VERTEX_ARRAY_BINDING_OES","currentVertexArrayObject","defaultVertexArrayObject","arguments","index","vao","Math","max","target","ARRAY_BUFFER","currentArrayBuffer","ELEMENT_ARRAY_BUFFER","VERTEX_ATTRIB_ARRAY_BUFFER_BINDING","VERTEX_ATTRIB_ARRAY_ENABLED","VERTEX_ATTRIB_ARRAY_SIZE","VERTEX_ATTRIB_ARRAY_STRIDE","VERTEX_ATTRIB_ARRAY_TYPE","VERTEX_ATTRIB_ARRAY_NORMALIZED","indx","instrumentExtension","canvas","addEventListener","reset_","contextWasLost","vertexArrayObjects","ii","MAX_VERTEX_ATTRIBS","bindVertexArrayOES","createVertexArrayOES","arrayObject","push","deleteVertexArrayOES","splice","indexOf","isVertexArrayOES","INVALID_OPERATION","oldVAO","newVAO","call","currentBinding","oldAttrib","bufferChanged","polyfillVertexArrayObject","createVertexArray","original_getSupportedExtensions","getSupportedExtensions","list","original_getExtension","getExtension","name","__OESVertexArrayObject"],"mappings":";;;;;;AA4BA,IAAMA,aAAa,GAAG,EAAtB;;AAEA,SAASC,KAAT,CAAeC,GAAf,EAAoB;AAClB,MAAIC,UAAU,CAACC,OAAX,IAAsBD,UAAU,CAACC,OAAX,CAAmBH,KAA7C,EAAoD;AAClDE,IAAAA,UAAU,CAACC,OAAX,CAAmBH,KAAnB,CAAyBC,GAAzB;AACD;AACF;;AAED,SAASG,GAAT,CAAa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AAtB,CAA2B,IAA3B,EAAiCW,IAAjC,CAAZ;;AACA,QAAInF,GAAJ,EAAS;AACP,aAAOA,GAAP;AACD;;AACD,QAAImF,IAAI,KAAK,yBAAb,EAAwC;AACtC,aAAO,IAAP;AACD;;AAED,QAAI,CAAC1F,EAAE,CAAC2F,sBAAR,EAAgC;AAC9B,WAAKA,sBAAL,GAA8B,IAAI5D,oBAAJ,CAAyB,IAAzB,CAA9B;AACD;;AACD,WAAO,KAAK4D,sBAAZ;AACD,GAbD;AAcD","sourcesContent":["/*\n ** Copyright (c) 2015 The Khronos Group Inc.\n **\n ** Permission is hereby granted, free of charge, to any person obtaining a\n ** copy of this software and/or associated documentation files (the\n ** \"Materials\"), to deal in the Materials without restriction, including\n ** without limitation the rights to use, copy, modify, merge, publish,\n ** distribute, sublicense, and/or sell copies of the Materials, and to\n ** permit persons to whom the Materials are furnished to do so, subject to\n ** the following conditions:\n **\n ** The above copyright notice and this permission notice shall be included\n ** in all copies or substantial portions of the Materials.\n **\n ** THE MATERIALS ARE PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n ** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n ** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\n ** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\n ** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\n ** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n ** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.\n */\n\n// Modified to use ES6 and polyfill a provided context rather than\n// the global class.\n\n// @ts-nocheck external code\n\nconst glErrorShadow = {};\n\nfunction error(msg) {\n if (globalThis.console && globalThis.console.error) {\n globalThis.console.error(msg);\n }\n}\n\nfunction log(msg) {\n if (globalThis.console && globalThis.console.log) {\n globalThis.console.log(msg);\n }\n}\n\nfunction synthesizeGLError(err, opt_msg) {\n glErrorShadow[err] = true;\n if (opt_msg !== undefined) {\n error(opt_msg);\n }\n}\n\nfunction wrapGLError(gl) {\n const f = gl.getError;\n gl.getError = function getError() {\n let err;\n do {\n err = f.apply(gl);\n if (err !== gl.NO_ERROR) {\n glErrorShadow[err] = true;\n }\n } while (err !== gl.NO_ERROR);\n\n for (err in glErrorShadow) {\n if (glErrorShadow[err]) {\n delete glErrorShadow[err];\n return parseInt(err, 10);\n }\n }\n\n return gl.NO_ERROR;\n };\n}\n\nconst WebGLVertexArrayObjectOES = function WebGLVertexArrayObjectOES(ext) {\n const gl = ext.gl;\n\n this.ext = ext;\n this.isAlive = true;\n this.hasBeenBound = false;\n\n this.elementArrayBuffer = null;\n this.attribs = new Array(ext.maxVertexAttribs);\n for (let n = 0; n < this.attribs.length; n++) {\n const attrib = new WebGLVertexArrayObjectOES.VertexAttrib(gl);\n this.attribs[n] = attrib;\n }\n\n this.maxAttrib = 0;\n};\n\nWebGLVertexArrayObjectOES.VertexAttrib = function VertexAttrib(gl) {\n this.enabled = false;\n this.buffer = null;\n this.size = 4;\n this.type = gl.FLOAT;\n this.normalized = false;\n this.stride = 16;\n this.offset = 0;\n\n this.cached = '';\n this.recache();\n};\nWebGLVertexArrayObjectOES.VertexAttrib.prototype.recache = function recache() {\n this.cached = [this.size, this.type, this.normalized, this.stride, this.offset].join(':');\n};\n\nconst OESVertexArrayObject = function OESVertexArrayObject(gl) {\n const self = this;\n this.gl = gl;\n\n wrapGLError(gl);\n\n const original = (this.original = {\n getParameter: gl.getParameter,\n enableVertexAttribArray: gl.enableVertexAttribArray,\n disableVertexAttribArray: gl.disableVertexAttribArray,\n bindBuffer: gl.bindBuffer,\n getVertexAttrib: gl.getVertexAttrib,\n vertexAttribPointer: gl.vertexAttribPointer\n });\n\n gl.getParameter = function getParameter(pname) {\n if (pname === self.VERTEX_ARRAY_BINDING_OES) {\n if (self.currentVertexArrayObject === self.defaultVertexArrayObject) {\n return null;\n }\n return self.currentVertexArrayObject;\n }\n return original.getParameter.apply(this, arguments);\n };\n\n gl.enableVertexAttribArray = function enableVertexAttribArray(index) {\n const vao = self.currentVertexArrayObject;\n vao.maxAttrib = Math.max(vao.maxAttrib, index);\n const attrib = vao.attribs[index];\n attrib.enabled = true;\n return original.enableVertexAttribArray.apply(this, arguments);\n };\n gl.disableVertexAttribArray = function disableVertexAttribArray(index) {\n const vao = self.currentVertexArrayObject;\n vao.maxAttrib = Math.max(vao.maxAttrib, index);\n const attrib = vao.attribs[index];\n attrib.enabled = false;\n return original.disableVertexAttribArray.apply(this, arguments);\n };\n\n gl.bindBuffer = function bindBuffer(target, buffer) {\n switch (target) {\n case gl.ARRAY_BUFFER:\n self.currentArrayBuffer = buffer;\n break;\n case gl.ELEMENT_ARRAY_BUFFER:\n self.currentVertexArrayObject.elementArrayBuffer = buffer;\n break;\n default:\n }\n return original.bindBuffer.apply(this, arguments);\n };\n\n gl.getVertexAttrib = function getVertexAttrib(index, pname) {\n const vao = self.currentVertexArrayObject;\n const attrib = vao.attribs[index];\n switch (pname) {\n case gl.VERTEX_ATTRIB_ARRAY_BUFFER_BINDING:\n return attrib.buffer;\n case gl.VERTEX_ATTRIB_ARRAY_ENABLED:\n return attrib.enabled;\n case gl.VERTEX_ATTRIB_ARRAY_SIZE:\n return attrib.size;\n case gl.VERTEX_ATTRIB_ARRAY_STRIDE:\n return attrib.stride;\n case gl.VERTEX_ATTRIB_ARRAY_TYPE:\n return attrib.type;\n case gl.VERTEX_ATTRIB_ARRAY_NORMALIZED:\n return attrib.normalized;\n default:\n return original.getVertexAttrib.apply(this, arguments);\n }\n };\n\n // eslint-disable-next-line max-params\n gl.vertexAttribPointer = function vertexAttribPointer(\n indx,\n size,\n type,\n normalized,\n stride,\n offset\n ) {\n const vao = self.currentVertexArrayObject;\n vao.maxAttrib = Math.max(vao.maxAttrib, indx);\n const attrib = vao.attribs[indx];\n attrib.buffer = self.currentArrayBuffer;\n attrib.size = size;\n attrib.type = type;\n attrib.normalized = normalized;\n attrib.stride = stride;\n attrib.offset = offset;\n attrib.recache();\n return original.vertexAttribPointer.apply(this, arguments);\n };\n\n if (gl.instrumentExtension) {\n gl.instrumentExtension(this, 'OES_vertex_array_object');\n }\n\n // undefined for headless gl\n if (gl.canvas) {\n gl.canvas.addEventListener(\n 'webglcontextrestored',\n () => {\n log('OESVertexArrayObject emulation library context restored');\n self.reset_();\n },\n true\n );\n }\n\n this.reset_();\n};\n\nOESVertexArrayObject.prototype.VERTEX_ARRAY_BINDING_OES = 0x85b5;\n\nOESVertexArrayObject.prototype.reset_ = function reset_() {\n const contextWasLost = this.vertexArrayObjects !== undefined;\n if (contextWasLost) {\n for (let ii = 0; ii < this.vertexArrayObjects.length; ++ii) {\n this.vertexArrayObjects.isAlive = false;\n }\n }\n const gl = this.gl;\n this.maxVertexAttribs = gl.getParameter(gl.MAX_VERTEX_ATTRIBS);\n\n this.defaultVertexArrayObject = new WebGLVertexArrayObjectOES(this);\n this.currentVertexArrayObject = null;\n this.currentArrayBuffer = null;\n this.vertexArrayObjects = [this.defaultVertexArrayObject];\n\n this.bindVertexArrayOES(null);\n};\n\nOESVertexArrayObject.prototype.createVertexArrayOES = function createVertexArrayOES() {\n const arrayObject = new WebGLVertexArrayObjectOES(this);\n this.vertexArrayObjects.push(arrayObject);\n return arrayObject;\n};\n\nOESVertexArrayObject.prototype.deleteVertexArrayOES = function deleteVertexArrayOES(arrayObject) {\n arrayObject.isAlive = false;\n this.vertexArrayObjects.splice(this.vertexArrayObjects.indexOf(arrayObject), 1);\n if (this.currentVertexArrayObject === arrayObject) {\n this.bindVertexArrayOES(null);\n }\n};\n\nOESVertexArrayObject.prototype.isVertexArrayOES = function isVertexArrayOES(arrayObject) {\n if (arrayObject && arrayObject instanceof WebGLVertexArrayObjectOES) {\n if (arrayObject.hasBeenBound && arrayObject.ext === this) {\n return true;\n }\n }\n return false;\n};\n\nOESVertexArrayObject.prototype.bindVertexArrayOES = function bindVertexArrayOES(arrayObject) {\n const gl = this.gl;\n if (arrayObject && !arrayObject.isAlive) {\n synthesizeGLError(\n gl.INVALID_OPERATION,\n 'bindVertexArrayOES: attempt to bind deleted arrayObject'\n );\n return;\n }\n const original = this.original;\n\n const oldVAO = this.currentVertexArrayObject;\n this.currentVertexArrayObject = arrayObject || this.defaultVertexArrayObject;\n this.currentVertexArrayObject.hasBeenBound = true;\n const newVAO = this.currentVertexArrayObject;\n\n if (oldVAO === newVAO) {\n return;\n }\n\n if (!oldVAO || newVAO.elementArrayBuffer !== oldVAO.elementArrayBuffer) {\n original.bindBuffer.call(gl, gl.ELEMENT_ARRAY_BUFFER, newVAO.elementArrayBuffer);\n }\n\n let currentBinding = this.currentArrayBuffer;\n const maxAttrib = Math.max(oldVAO ? oldVAO.maxAttrib : 0, newVAO.maxAttrib);\n for (let n = 0; n <= maxAttrib; n++) {\n const attrib = newVAO.attribs[n];\n const oldAttrib = oldVAO ? oldVAO.attribs[n] : null;\n\n if (!oldVAO || attrib.enabled !== oldAttrib.enabled) {\n if (attrib.enabled) {\n original.enableVertexAttribArray.call(gl, n);\n } else {\n original.disableVertexAttribArray.call(gl, n);\n }\n }\n\n if (attrib.enabled) {\n let bufferChanged = false;\n if (!oldVAO || attrib.buffer !== oldAttrib.buffer) {\n if (currentBinding !== attrib.buffer) {\n original.bindBuffer.call(gl, gl.ARRAY_BUFFER, attrib.buffer);\n currentBinding = attrib.buffer;\n }\n bufferChanged = true;\n }\n\n if (bufferChanged || attrib.cached !== oldAttrib.cached) {\n original.vertexAttribPointer.call(\n gl,\n n,\n attrib.size,\n attrib.type,\n attrib.normalized,\n attrib.stride,\n attrib.offset\n );\n }\n }\n }\n\n if (this.currentArrayBuffer !== currentBinding) {\n original.bindBuffer.call(gl, gl.ARRAY_BUFFER, this.currentArrayBuffer);\n }\n};\n\nexport function polyfillVertexArrayObject(gl) {\n if (typeof gl.createVertexArray === 'function') {\n // VAOs directly supported on object (i.e. WebGL 2 context)\n return;\n }\n\n const original_getSupportedExtensions = gl.getSupportedExtensions;\n gl.getSupportedExtensions = function getSupportedExtensions() {\n const list = original_getSupportedExtensions.call(this) || [];\n if (list.indexOf('OES_vertex_array_object') < 0) {\n list.push('OES_vertex_array_object');\n }\n return list;\n };\n\n const original_getExtension = gl.getExtension;\n gl.getExtension = function getExtension(name) {\n const ext = original_getExtension.call(this, name);\n if (ext) {\n return ext;\n }\n if (name !== 'OES_vertex_array_object') {\n return null;\n }\n\n if (!gl.__OESVertexArrayObject) {\n this.__OESVertexArrayObject = new OESVertexArrayObject(this);\n }\n return this.__OESVertexArrayObject;\n };\n}\n"],"file":"polyfill-vertex-array-object.js"}
1
+ {"version":3,"file":"polyfill-vertex-array-object.js","names":["glErrorShadow","error","msg","globalThis","console","log","synthesizeGLError","err","opt_msg","undefined","wrapGLError","gl","f","getError","apply","NO_ERROR","parseInt","WebGLVertexArrayObjectOES","ext","isAlive","hasBeenBound","elementArrayBuffer","attribs","Array","maxVertexAttribs","n","length","attrib","VertexAttrib","maxAttrib","enabled","buffer","size","type","FLOAT","normalized","stride","offset","cached","recache","prototype","join","OESVertexArrayObject","self","original","getParameter","enableVertexAttribArray","disableVertexAttribArray","bindBuffer","getVertexAttrib","vertexAttribPointer","pname","VERTEX_ARRAY_BINDING_OES","currentVertexArrayObject","defaultVertexArrayObject","arguments","index","vao","Math","max","target","ARRAY_BUFFER","currentArrayBuffer","ELEMENT_ARRAY_BUFFER","VERTEX_ATTRIB_ARRAY_BUFFER_BINDING","VERTEX_ATTRIB_ARRAY_ENABLED","VERTEX_ATTRIB_ARRAY_SIZE","VERTEX_ATTRIB_ARRAY_STRIDE","VERTEX_ATTRIB_ARRAY_TYPE","VERTEX_ATTRIB_ARRAY_NORMALIZED","indx","instrumentExtension","canvas","addEventListener","reset_","contextWasLost","vertexArrayObjects","ii","MAX_VERTEX_ATTRIBS","bindVertexArrayOES","createVertexArrayOES","arrayObject","push","deleteVertexArrayOES","splice","indexOf","isVertexArrayOES","INVALID_OPERATION","oldVAO","newVAO","call","currentBinding","oldAttrib","bufferChanged","polyfillVertexArrayObject","createVertexArray","original_getSupportedExtensions","getSupportedExtensions","list","original_getExtension","getExtension","name","__OESVertexArrayObject"],"sources":["../../../../src/context/polyfill/polyfill-vertex-array-object.ts"],"sourcesContent":["/*\n ** Copyright (c) 2015 The Khronos Group Inc.\n **\n ** Permission is hereby granted, free of charge, to any person obtaining a\n ** copy of this software and/or associated documentation files (the\n ** \"Materials\"), to deal in the Materials without restriction, including\n ** without limitation the rights to use, copy, modify, merge, publish,\n ** distribute, sublicense, and/or sell copies of the Materials, and to\n ** permit persons to whom the Materials are furnished to do so, subject to\n ** the following conditions:\n **\n ** The above copyright notice and this permission notice shall be included\n ** in all copies or substantial portions of the Materials.\n **\n ** THE MATERIALS ARE PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n ** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n ** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\n ** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\n ** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\n ** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n ** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.\n */\n\n// Modified to use ES6 and polyfill a provided context rather than\n// the global class.\n\n// @ts-nocheck external code\n\nconst glErrorShadow = {};\n\nfunction error(msg) {\n if (globalThis.console && globalThis.console.error) {\n globalThis.console.error(msg);\n }\n}\n\nfunction log(msg) {\n if (globalThis.console && globalThis.console.log) {\n globalThis.console.log(msg);\n }\n}\n\nfunction synthesizeGLError(err, opt_msg) {\n glErrorShadow[err] = true;\n if (opt_msg !== undefined) {\n error(opt_msg);\n }\n}\n\nfunction wrapGLError(gl) {\n const f = gl.getError;\n gl.getError = function getError() {\n let err;\n do {\n err = f.apply(gl);\n if (err !== gl.NO_ERROR) {\n glErrorShadow[err] = true;\n }\n } while (err !== gl.NO_ERROR);\n\n for (err in glErrorShadow) {\n if (glErrorShadow[err]) {\n delete glErrorShadow[err];\n return parseInt(err, 10);\n }\n }\n\n return gl.NO_ERROR;\n };\n}\n\nconst WebGLVertexArrayObjectOES = function WebGLVertexArrayObjectOES(ext) {\n const gl = ext.gl;\n\n this.ext = ext;\n this.isAlive = true;\n this.hasBeenBound = false;\n\n this.elementArrayBuffer = null;\n this.attribs = new Array(ext.maxVertexAttribs);\n for (let n = 0; n < this.attribs.length; n++) {\n const attrib = new WebGLVertexArrayObjectOES.VertexAttrib(gl);\n this.attribs[n] = attrib;\n }\n\n this.maxAttrib = 0;\n};\n\nWebGLVertexArrayObjectOES.VertexAttrib = function VertexAttrib(gl) {\n this.enabled = false;\n this.buffer = null;\n this.size = 4;\n this.type = gl.FLOAT;\n this.normalized = false;\n this.stride = 16;\n this.offset = 0;\n\n this.cached = '';\n this.recache();\n};\nWebGLVertexArrayObjectOES.VertexAttrib.prototype.recache = function recache() {\n this.cached = [this.size, this.type, this.normalized, this.stride, this.offset].join(':');\n};\n\nconst OESVertexArrayObject = function OESVertexArrayObject(gl) {\n const self = this;\n this.gl = gl;\n\n wrapGLError(gl);\n\n const original = (this.original = {\n getParameter: gl.getParameter,\n enableVertexAttribArray: gl.enableVertexAttribArray,\n disableVertexAttribArray: gl.disableVertexAttribArray,\n bindBuffer: gl.bindBuffer,\n getVertexAttrib: gl.getVertexAttrib,\n vertexAttribPointer: gl.vertexAttribPointer\n });\n\n gl.getParameter = function getParameter(pname) {\n if (pname === self.VERTEX_ARRAY_BINDING_OES) {\n if (self.currentVertexArrayObject === self.defaultVertexArrayObject) {\n return null;\n }\n return self.currentVertexArrayObject;\n }\n return original.getParameter.apply(this, arguments);\n };\n\n gl.enableVertexAttribArray = function enableVertexAttribArray(index) {\n const vao = self.currentVertexArrayObject;\n vao.maxAttrib = Math.max(vao.maxAttrib, index);\n const attrib = vao.attribs[index];\n attrib.enabled = true;\n return original.enableVertexAttribArray.apply(this, arguments);\n };\n gl.disableVertexAttribArray = function disableVertexAttribArray(index) {\n const vao = self.currentVertexArrayObject;\n vao.maxAttrib = Math.max(vao.maxAttrib, index);\n const attrib = vao.attribs[index];\n attrib.enabled = false;\n return original.disableVertexAttribArray.apply(this, arguments);\n };\n\n gl.bindBuffer = function bindBuffer(target, buffer) {\n switch (target) {\n case gl.ARRAY_BUFFER:\n self.currentArrayBuffer = buffer;\n break;\n case gl.ELEMENT_ARRAY_BUFFER:\n self.currentVertexArrayObject.elementArrayBuffer = buffer;\n break;\n default:\n }\n return original.bindBuffer.apply(this, arguments);\n };\n\n gl.getVertexAttrib = function getVertexAttrib(index, pname) {\n const vao = self.currentVertexArrayObject;\n const attrib = vao.attribs[index];\n switch (pname) {\n case gl.VERTEX_ATTRIB_ARRAY_BUFFER_BINDING:\n return attrib.buffer;\n case gl.VERTEX_ATTRIB_ARRAY_ENABLED:\n return attrib.enabled;\n case gl.VERTEX_ATTRIB_ARRAY_SIZE:\n return attrib.size;\n case gl.VERTEX_ATTRIB_ARRAY_STRIDE:\n return attrib.stride;\n case gl.VERTEX_ATTRIB_ARRAY_TYPE:\n return attrib.type;\n case gl.VERTEX_ATTRIB_ARRAY_NORMALIZED:\n return attrib.normalized;\n default:\n return original.getVertexAttrib.apply(this, arguments);\n }\n };\n\n // eslint-disable-next-line max-params\n gl.vertexAttribPointer = function vertexAttribPointer(\n indx,\n size,\n type,\n normalized,\n stride,\n offset\n ) {\n const vao = self.currentVertexArrayObject;\n vao.maxAttrib = Math.max(vao.maxAttrib, indx);\n const attrib = vao.attribs[indx];\n attrib.buffer = self.currentArrayBuffer;\n attrib.size = size;\n attrib.type = type;\n attrib.normalized = normalized;\n attrib.stride = stride;\n attrib.offset = offset;\n attrib.recache();\n return original.vertexAttribPointer.apply(this, arguments);\n };\n\n if (gl.instrumentExtension) {\n gl.instrumentExtension(this, 'OES_vertex_array_object');\n }\n\n // undefined for headless gl\n if (gl.canvas) {\n gl.canvas.addEventListener(\n 'webglcontextrestored',\n () => {\n log('OESVertexArrayObject emulation library context restored');\n self.reset_();\n },\n true\n );\n }\n\n this.reset_();\n};\n\nOESVertexArrayObject.prototype.VERTEX_ARRAY_BINDING_OES = 0x85b5;\n\nOESVertexArrayObject.prototype.reset_ = function reset_() {\n const contextWasLost = this.vertexArrayObjects !== undefined;\n if (contextWasLost) {\n for (let ii = 0; ii < this.vertexArrayObjects.length; ++ii) {\n this.vertexArrayObjects.isAlive = false;\n }\n }\n const gl = this.gl;\n this.maxVertexAttribs = gl.getParameter(gl.MAX_VERTEX_ATTRIBS);\n\n this.defaultVertexArrayObject = new WebGLVertexArrayObjectOES(this);\n this.currentVertexArrayObject = null;\n this.currentArrayBuffer = null;\n this.vertexArrayObjects = [this.defaultVertexArrayObject];\n\n this.bindVertexArrayOES(null);\n};\n\nOESVertexArrayObject.prototype.createVertexArrayOES = function createVertexArrayOES() {\n const arrayObject = new WebGLVertexArrayObjectOES(this);\n this.vertexArrayObjects.push(arrayObject);\n return arrayObject;\n};\n\nOESVertexArrayObject.prototype.deleteVertexArrayOES = function deleteVertexArrayOES(arrayObject) {\n arrayObject.isAlive = false;\n this.vertexArrayObjects.splice(this.vertexArrayObjects.indexOf(arrayObject), 1);\n if (this.currentVertexArrayObject === arrayObject) {\n this.bindVertexArrayOES(null);\n }\n};\n\nOESVertexArrayObject.prototype.isVertexArrayOES = function isVertexArrayOES(arrayObject) {\n if (arrayObject && arrayObject instanceof WebGLVertexArrayObjectOES) {\n if (arrayObject.hasBeenBound && arrayObject.ext === this) {\n return true;\n }\n }\n return false;\n};\n\nOESVertexArrayObject.prototype.bindVertexArrayOES = function bindVertexArrayOES(arrayObject) {\n const gl = this.gl;\n if (arrayObject && !arrayObject.isAlive) {\n synthesizeGLError(\n gl.INVALID_OPERATION,\n 'bindVertexArrayOES: attempt to bind deleted arrayObject'\n );\n return;\n }\n const original = this.original;\n\n const oldVAO = this.currentVertexArrayObject;\n this.currentVertexArrayObject = arrayObject || this.defaultVertexArrayObject;\n this.currentVertexArrayObject.hasBeenBound = true;\n const newVAO = this.currentVertexArrayObject;\n\n if (oldVAO === newVAO) {\n return;\n }\n\n if (!oldVAO || newVAO.elementArrayBuffer !== oldVAO.elementArrayBuffer) {\n original.bindBuffer.call(gl, gl.ELEMENT_ARRAY_BUFFER, newVAO.elementArrayBuffer);\n }\n\n let currentBinding = this.currentArrayBuffer;\n const maxAttrib = Math.max(oldVAO ? oldVAO.maxAttrib : 0, newVAO.maxAttrib);\n for (let n = 0; n <= maxAttrib; n++) {\n const attrib = newVAO.attribs[n];\n const oldAttrib = oldVAO ? oldVAO.attribs[n] : null;\n\n if (!oldVAO || attrib.enabled !== oldAttrib.enabled) {\n if (attrib.enabled) {\n original.enableVertexAttribArray.call(gl, n);\n } else {\n original.disableVertexAttribArray.call(gl, n);\n }\n }\n\n if (attrib.enabled) {\n let bufferChanged = false;\n if (!oldVAO || attrib.buffer !== oldAttrib.buffer) {\n if (currentBinding !== attrib.buffer) {\n original.bindBuffer.call(gl, gl.ARRAY_BUFFER, attrib.buffer);\n currentBinding = attrib.buffer;\n }\n bufferChanged = true;\n }\n\n if (bufferChanged || attrib.cached !== oldAttrib.cached) {\n original.vertexAttribPointer.call(\n gl,\n n,\n attrib.size,\n attrib.type,\n attrib.normalized,\n attrib.stride,\n attrib.offset\n );\n }\n }\n }\n\n if (this.currentArrayBuffer !== currentBinding) {\n original.bindBuffer.call(gl, gl.ARRAY_BUFFER, this.currentArrayBuffer);\n }\n};\n\nexport function polyfillVertexArrayObject(gl) {\n if (typeof gl.createVertexArray === 'function') {\n // VAOs directly supported on object (i.e. WebGL 2 context)\n return;\n }\n\n const original_getSupportedExtensions = gl.getSupportedExtensions;\n gl.getSupportedExtensions = function getSupportedExtensions() {\n const list = original_getSupportedExtensions.call(this) || [];\n if (list.indexOf('OES_vertex_array_object') < 0) {\n list.push('OES_vertex_array_object');\n }\n return list;\n };\n\n const original_getExtension = gl.getExtension;\n gl.getExtension = function getExtension(name) {\n const ext = original_getExtension.call(this, name);\n if (ext) {\n return ext;\n }\n if (name !== 'OES_vertex_array_object') {\n return null;\n }\n\n if (!gl.__OESVertexArrayObject) {\n this.__OESVertexArrayObject = new OESVertexArrayObject(this);\n }\n return this.__OESVertexArrayObject;\n };\n}\n"],"mappings":";;;;;;AA4BA,IAAMA,aAAa,GAAG,CAAC,CAAC;AAExB,SAASC,KAAKA,CAACC,GAAG,EAAE;EAClB,IAAIC,UAAU,CAACC,OAAO,IAAID,UAAU,CAACC,OAAO,CAACH,KAAK,EAAE;IAClDE,UAAU,CAACC,OAAO,CAACH,KAAK,CAACC,GAAG,CAAC;EAC/B;AACF;AAEA,SAASG,GAAGA,CAACH,GAAG,EAAE;EAChB,IAAIC,UAAU,CAACC,OAAO,IAAID,UAAU,CAACC,OAAO,CAACC,GAAG,EAAE;IAChDF,UAAU,CAACC,OAAO,CAACC,GAAG,CAACH,GAAG,CAAC;EAC7B;AACF;AAEA,SAASI,iBAAiBA,CAACC,GAAG,EAAEC,OAAO,EAAE;EACvCR,aAAa,CAACO,GAAG,CAAC,GAAG,IAAI;EACzB,IAAIC,OAAO,KAAKC,SAAS,EAAE;IACzBR,KAAK,CAACO,OAAO,CAAC;EAChB;AACF;AAEA,SAASE,WAAWA,CAACC,EAAE,EAAE;EACvB,IAAMC,CAAC,GAAGD,EAAE,CAACE,QAAQ;EACrBF,EAAE,CAACE,QAAQ,GAAG,SAASA,QAAQA,CAAA,EAAG;IAChC,IAAIN,GAAG;IACP,GAAG;MACDA,GAAG,GAAGK,CAAC,CAACE,KAAK,CAACH,EAAE,CAAC;MACjB,IAAIJ,GAAG,KAAKI,EAAE,CAACI,QAAQ,EAAE;QACvBf,aAAa,CAACO,GAAG,CAAC,GAAG,IAAI;MAC3B;IACF,CAAC,QAAQA,GAAG,KAAKI,EAAE,CAACI,QAAQ;IAE5B,KAAKR,GAAG,I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AG,CAAC,EAAE;MAC/Ca,IAAI,CAAChB,IAAI,CAAC,yBAAyB,CAAC;IACtC;IACA,OAAOgB,IAAI;EACb,CAAC;EAED,IAAMC,qBAAqB,GAAGxF,EAAE,CAACyF,YAAY;EAC7CzF,EAAE,CAACyF,YAAY,GAAG,SAASA,YAAYA,CAACC,IAAI,EAAE;IAC5C,IAAMnF,GAAG,GAAGiF,qBAAqB,CAACT,IAAI,CAAC,IAAI,EAAEW,IAAI,CAAC;IAClD,IAAInF,GAAG,EAAE;MACP,OAAOA,GAAG;IACZ;IACA,IAAImF,IAAI,KAAK,yBAAyB,EAAE;MACtC,OAAO,IAAI;IACb;IAEA,IAAI,CAAC1F,EAAE,CAAC2F,sBAAsB,EAAE;MAC9B,IAAI,CAACA,sBAAsB,GAAG,IAAI5D,oBAAoB,CAAC,IAAI,CAAC;IAC9D;IACA,OAAO,IAAI,CAAC4D,sBAAsB;EACpC,CAAC;AACH"}
@@ -4,25 +4,20 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.deepArrayEqual = deepArrayEqual;
7
-
8
7
  function deepArrayEqual(x, y) {
9
8
  if (x === y) {
10
9
  return true;
11
10
  }
12
-
13
11
  var isArrayX = Array.isArray(x) || ArrayBuffer.isView(x);
14
12
  var isArrayY = Array.isArray(y) || ArrayBuffer.isView(y);
15
-
16
13
  if (isArrayX && isArrayY && x.length === y.length) {
17
14
  for (var i = 0; i < x.length; ++i) {
18
15
  if (x[i] !== y[i]) {
19
16
  return false;
20
17
  }
21
18
  }
22
-
23
19
  return true;
24
20
  }
25
-
26
21
  return false;
27
22
  }
28
23
  //# sourceMappingURL=deep-array-equal.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/context/state-tracker/deep-array-equal.ts"],"names":["deepArrayEqual","x","y","isArrayX","Array","isArray","ArrayBuffer","isView","isArrayY","length","i"],"mappings":";;;;;;;AAEO,SAASA,cAAT,CAAwBC,CAAxB,EAAgCC,CAAhC,EAAiD;AACtD,MAAID,CAAC,KAAKC,CAAV,EAAa;AACX,WAAO,IAAP;AACD;;AACD,MAAMC,QAAQ,GAAGC,KAAK,CAACC,OAAN,CAAcJ,CAAd,KAAoBK,WAAW,CAACC,MAAZ,CAAmBN,CAAnB,CAArC;AACA,MAAMO,QAAQ,GAAGJ,KAAK,CAACC,OAAN,CAAcH,CAAd,KAAoBI,WAAW,CAACC,MAAZ,CAAmBL,CAAnB,CAArC;;AAEA,MAAIC,QAAQ,IAAIK,QAAZ,IAAwBP,CAAC,CAACQ,MAAF,KAAaP,CAAC,CAACO,MAA3C,EAAmD;AAEjD,SAAK,IAAIC,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAGT,CAAC,CAACQ,MAAtB,EAA8B,EAAEC,CAAhC,EAAmC;AACjC,UAAIT,CAAC,CAACS,CAAD,CAAD,KAASR,CAAC,CAACQ,CAAD,CAAd,EAAmB;AACjB,eAAO,KAAP;AACD;AACF;;AACD,WAAO,IAAP;AACD;;AACD,SAAO,KAAP;AACD","sourcesContent":["\n/** deeply compare two arrays */\nexport function deepArrayEqual(x: any, y: any): boolean {\n if (x === y) {\n return true;\n }\n const isArrayX = Array.isArray(x) || ArrayBuffer.isView(x);\n const isArrayY = Array.isArray(y) || ArrayBuffer.isView(y);\n // @ts-expect-error TODO fix\n if (isArrayX && isArrayY && x.length === y.length) {\n // @ts-expect-error TODO fix\n for (let i = 0; i < x.length; ++i) {\n if (x[i] !== y[i]) {\n return false;\n }\n }\n return true;\n }\n return false;\n}\n"],"file":"deep-array-equal.js"}
1
+ {"version":3,"file":"deep-array-equal.js","names":["deepArrayEqual","x","y","isArrayX","Array","isArray","ArrayBuffer","isView","isArrayY","length","i"],"sources":["../../../../src/context/state-tracker/deep-array-equal.ts"],"sourcesContent":["\n/** deeply compare two arrays */\nexport function deepArrayEqual(x: any, y: any): boolean {\n if (x === y) {\n return true;\n }\n const isArrayX = Array.isArray(x) || ArrayBuffer.isView(x);\n const isArrayY = Array.isArray(y) || ArrayBuffer.isView(y);\n // @ts-expect-error TODO fix\n if (isArrayX && isArrayY && x.length === y.length) {\n // @ts-expect-error TODO fix\n for (let i = 0; i < x.length; ++i) {\n if (x[i] !== y[i]) {\n return false;\n }\n }\n return true;\n }\n return false;\n}\n"],"mappings":";;;;;;AAEO,SAASA,cAAcA,CAACC,CAAM,EAAEC,CAAM,EAAW;EACtD,IAAID,CAAC,KAAKC,CAAC,EAAE;IACX,OAAO,IAAI;EACb;EACA,IAAMC,QAAQ,GAAGC,KAAK,CAACC,OAAO,CAACJ,CAAC,CAAC,IAAIK,WAAW,CAACC,MAAM,CAACN,CAAC,CAAC;EAC1D,IAAMO,QAAQ,GAAGJ,KAAK,CAACC,OAAO,CAACH,CAAC,CAAC,IAAII,WAAW,CAACC,MAAM,CAACL,CAAC,CAAC;EAE1D,IAAIC,QAAQ,IAAIK,QAAQ,IAAIP,CAAC,CAACQ,MAAM,KAAKP,CAAC,CAACO,MAAM,EAAE;IAEjD,KAAK,IAAIC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGT,CAAC,CAACQ,MAAM,EAAE,EAAEC,CAAC,EAAE;MACjC,IAAIT,CAAC,CAACS,CAAC,CAAC,KAAKR,CAAC,CAACQ,CAAC,CAAC,EAAE;QACjB,OAAO,KAAK;MACd;IACF;IACA,OAAO,IAAI;EACb;EACA,OAAO,KAAK;AACd"}
@@ -1,36 +1,26 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
- exports.trackContextState = trackContextState;
9
- exports.pushContextState = pushContextState;
10
7
  exports.popContextState = popContextState;
11
-
8
+ exports.pushContextState = pushContextState;
9
+ exports.trackContextState = trackContextState;
12
10
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
13
-
14
11
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
15
-
16
12
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
17
-
18
13
  var _api = require("@luma.gl/api");
19
-
20
14
  var _webglParameterTables = require("../parameters/webgl-parameter-tables");
21
-
22
15
  var _unifiedParameterApi = require("../parameters/unified-parameter-api");
23
-
24
16
  var _deepArrayEqual = require("./deep-array-equal");
25
-
26
17
  var GLState = function () {
27
18
  function GLState(gl) {
28
19
  var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
29
- _ref$copyState = _ref.copyState,
30
- copyState = _ref$copyState === void 0 ? false : _ref$copyState,
31
- _ref$log = _ref.log,
32
- log = _ref$log === void 0 ? function () {} : _ref$log;
33
-
20
+ _ref$copyState = _ref.copyState,
21
+ copyState = _ref$copyState === void 0 ? false : _ref$copyState,
22
+ _ref$log = _ref.log,
23
+ log = _ref$log === void 0 ? function () {} : _ref$log;
34
24
  (0, _classCallCheck2.default)(this, GLState);
35
25
  (0, _defineProperty2.default)(this, "gl", void 0);
36
26
  (0, _defineProperty2.default)(this, "program", null);
@@ -44,7 +34,6 @@ var GLState = function () {
44
34
  this._updateCache = this._updateCache.bind(this);
45
35
  Object.seal(this);
46
36
  }
47
-
48
37
  (0, _createClass2.default)(GLState, [{
49
38
  key: "push",
50
39
  value: function push() {
@@ -65,24 +54,19 @@ var GLState = function () {
65
54
  var valueChanged = false;
66
55
  var oldValue;
67
56
  var oldValues = this.stateStack.length > 0 ? this.stateStack[this.stateStack.length - 1] : null;
68
-
69
57
  for (var _key in values) {
70
58
  (0, _api.assert)(_key !== undefined);
71
59
  var value = values[_key];
72
60
  var cached = this.cache[_key];
73
-
74
61
  if (!(0, _deepArrayEqual.deepArrayEqual)(value, cached)) {
75
62
  valueChanged = true;
76
63
  oldValue = cached;
77
-
78
64
  if (oldValues && !(_key in oldValues)) {
79
65
  oldValues[_key] = cached;
80
66
  }
81
-
82
67
  this.cache[_key] = value;
83
68
  }
84
69
  }
85
-
86
70
  return {
87
71
  valueChanged: valueChanged,
88
72
  oldValue: oldValue
@@ -91,116 +75,89 @@ var GLState = function () {
91
75
  }]);
92
76
  return GLState;
93
77
  }();
94
-
95
78
  function getContextState(gl) {
96
79
  return gl.state;
97
80
  }
98
-
99
81
  function trackContextState(gl, options) {
100
82
  var _options$enable = options.enable,
101
- enable = _options$enable === void 0 ? true : _options$enable,
102
- copyState = options.copyState;
83
+ enable = _options$enable === void 0 ? true : _options$enable,
84
+ copyState = options.copyState;
103
85
  (0, _api.assert)(copyState !== undefined);
104
-
105
86
  if (!gl.state) {
106
87
  gl.state = new GLState(gl, {
107
88
  copyState: copyState
108
89
  });
109
90
  installProgramSpy(gl);
110
-
111
91
  for (var _key2 in _webglParameterTables.GL_HOOKED_SETTERS) {
112
92
  var setter = _webglParameterTables.GL_HOOKED_SETTERS[_key2];
113
93
  installSetterSpy(gl, _key2, setter);
114
94
  }
115
-
116
95
  installGetterOverride(gl, 'getParameter');
117
96
  installGetterOverride(gl, 'isEnabled');
118
97
  }
119
-
120
98
  var glState = getContextState(gl);
121
99
  glState.enable = enable;
122
100
  return gl;
123
101
  }
124
-
125
102
  function pushContextState(gl) {
126
103
  var glState = getContextState(gl);
127
-
128
104
  if (!glState) {
129
105
  trackContextState(gl, {
130
106
  copyState: false
131
107
  });
132
108
  glState = getContextState(gl);
133
109
  }
134
-
135
110
  glState.push();
136
111
  }
137
-
138
112
  function popContextState(gl) {
139
113
  var glState = getContextState(gl);
140
114
  (0, _api.assert)(glState);
141
115
  glState.pop();
142
116
  }
143
-
144
117
  function installGetterOverride(gl, functionName) {
145
118
  var originalGetterFunc = gl[functionName].bind(gl);
146
-
147
119
  gl[functionName] = function get(pname) {
148
120
  if (pname === undefined || _webglParameterTables.NON_CACHE_PARAMETERS.has(pname)) {
149
121
  return originalGetterFunc(pname);
150
122
  }
151
-
152
123
  var glState = getContextState(gl);
153
-
154
124
  if (!(pname in glState.cache)) {
155
125
  glState.cache[pname] = originalGetterFunc(pname);
156
126
  }
157
-
158
127
  return glState.enable ? glState.cache[pname] : originalGetterFunc(pname);
159
128
  };
160
-
161
129
  Object.defineProperty(gl[functionName], 'name', {
162
130
  value: "".concat(functionName, "-from-cache"),
163
131
  configurable: false
164
132
  });
165
133
  }
166
-
167
134
  function installSetterSpy(gl, functionName, setter) {
168
135
  if (!gl[functionName]) {
169
136
  return;
170
137
  }
171
-
172
138
  var originalSetterFunc = gl[functionName].bind(gl);
173
-
174
139
  gl[functionName] = function set() {
175
140
  var glState = getContextState(gl);
176
-
177
141
  for (var _len = arguments.length, params = new Array(_len), _key3 = 0; _key3 < _len; _key3++) {
178
142
  params[_key3] = arguments[_key3];
179
143
  }
180
-
181
144
  var _setter = setter.apply(void 0, [glState._updateCache].concat(params)),
182
- valueChanged = _setter.valueChanged,
183
- oldValue = _setter.oldValue;
184
-
145
+ valueChanged = _setter.valueChanged,
146
+ oldValue = _setter.oldValue;
185
147
  if (valueChanged) {
186
148
  originalSetterFunc.apply(void 0, params);
187
149
  }
188
-
189
150
  return oldValue;
190
151
  };
191
-
192
152
  Object.defineProperty(gl[functionName], 'name', {
193
153
  value: "".concat(functionName, "-to-cache"),
194
154
  configurable: false
195
155
  });
196
156
  }
197
-
198
157
  function installProgramSpy(gl) {
199
158
  var originalUseProgram = gl.useProgram.bind(gl);
200
-
201
159
  gl.useProgram = function useProgramLuma(handle) {
202
160
  var glState = getContextState(gl);
203
-
204
161
  if (glState.program !== handle) {
205
162
  originalUseProgram(handle);
206
163
  glState.program = handle;