@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
@@ -1,37 +1,36 @@
1
1
  const MESSAGE_TYPES = ['warning', 'error', 'info'];
2
+ /**
3
+ * Parse a WebGL-format GLSL compilation log into an array of WebGPU style message records.
4
+ * This follows documented WebGL conventions for compilation logs.
5
+ * Based on https://github.com/wwwtyro/gl-format-compiler-error (public domain)
6
+ */
2
7
  export function parseShaderCompilerLog(errLog) {
3
- const lines = errLog.split(/\r?\n/);
4
- const messages = [];
5
-
6
- for (const line of lines) {
7
- if (line.length <= 1) {
8
- continue;
8
+ // Parse the error - note: browser and driver dependent
9
+ const lines = errLog.split(/\r?\n/);
10
+ const messages = [];
11
+ for (const line of lines) {
12
+ if (line.length <= 1) {
13
+ continue;
14
+ }
15
+ const segments = line.split(':');
16
+ const [messageType, linePosition, lineNumber, ...rest] = segments;
17
+ let lineNum = parseInt(lineNumber, 10);
18
+ if (isNaN(lineNum)) {
19
+ lineNum = 0;
20
+ }
21
+ let linePos = parseInt(linePosition, 10);
22
+ if (isNaN(linePos)) {
23
+ linePos = 0;
24
+ }
25
+ // Ensure supported type
26
+ const lowerCaseType = messageType.toLowerCase();
27
+ const type = (MESSAGE_TYPES.includes(lowerCaseType) ? lowerCaseType : 'info');
28
+ messages.push({
29
+ message: rest.join(':').trim(),
30
+ type,
31
+ lineNum,
32
+ linePos // TODO
33
+ });
9
34
  }
10
-
11
- const segments = line.split(':');
12
- const [messageType, linePosition, lineNumber, ...rest] = segments;
13
- let lineNum = parseInt(lineNumber, 10);
14
-
15
- if (isNaN(lineNum)) {
16
- lineNum = 0;
17
- }
18
-
19
- let linePos = parseInt(linePosition, 10);
20
-
21
- if (isNaN(linePos)) {
22
- linePos = 0;
23
- }
24
-
25
- const lowerCaseType = messageType.toLowerCase();
26
- const type = MESSAGE_TYPES.includes(lowerCaseType) ? lowerCaseType : 'info';
27
- messages.push({
28
- message: rest.join(':').trim(),
29
- type,
30
- lineNum,
31
- linePos
32
- });
33
- }
34
-
35
- return messages;
35
+ return messages;
36
36
  }
37
- //# sourceMappingURL=parse-shader-compiler-log.js.map
@@ -1,115 +1,72 @@
1
+ // Uniforms
1
2
  import GL from '@luma.gl/constants';
3
+ /** Set a raw uniform (without type conversion and caching) */
4
+ /* eslint-disable max-len */
2
5
  export function setUniform(gl, location, type, value) {
3
- const gl2 = gl;
4
-
5
- if (typeof value === 'number') {
6
+ const gl2 = gl;
7
+ if (typeof value === 'number') {
8
+ // prettier-ignore
9
+ switch (type) {
10
+ // WebGL1 samplers
11
+ case GL.SAMPLER_2D:
12
+ case GL.SAMPLER_CUBE:
13
+ // WebGL2 samplers
14
+ case GL.SAMPLER_3D:
15
+ case GL.SAMPLER_2D_SHADOW:
16
+ case GL.SAMPLER_2D_ARRAY:
17
+ case GL.SAMPLER_2D_ARRAY_SHADOW:
18
+ case GL.SAMPLER_CUBE_SHADOW:
19
+ case GL.INT_SAMPLER_2D:
20
+ case GL.INT_SAMPLER_3D:
21
+ case GL.INT_SAMPLER_CUBE:
22
+ case GL.INT_SAMPLER_2D_ARRAY:
23
+ case GL.UNSIGNED_INT_SAMPLER_2D:
24
+ case GL.UNSIGNED_INT_SAMPLER_3D:
25
+ case GL.UNSIGNED_INT_SAMPLER_CUBE:
26
+ case GL.UNSIGNED_INT_SAMPLER_2D_ARRAY:
27
+ return gl.uniform1i(location, value);
28
+ }
29
+ }
30
+ // @ts-expect-error
31
+ if (value === true) {
32
+ value = 1;
33
+ }
34
+ // @ts-expect-error
35
+ if (value === false) {
36
+ value = 1;
37
+ }
38
+ const arrayValue = (typeof value === 'number') ? [value] : value;
39
+ // prettier-ignore
6
40
  switch (type) {
7
- case GL.SAMPLER_2D:
8
- case GL.SAMPLER_CUBE:
9
- case GL.SAMPLER_3D:
10
- case GL.SAMPLER_2D_SHADOW:
11
- case GL.SAMPLER_2D_ARRAY:
12
- case GL.SAMPLER_2D_ARRAY_SHADOW:
13
- case GL.SAMPLER_CUBE_SHADOW:
14
- case GL.INT_SAMPLER_2D:
15
- case GL.INT_SAMPLER_3D:
16
- case GL.INT_SAMPLER_CUBE:
17
- case GL.INT_SAMPLER_2D_ARRAY:
18
- case GL.UNSIGNED_INT_SAMPLER_2D:
19
- case GL.UNSIGNED_INT_SAMPLER_3D:
20
- case GL.UNSIGNED_INT_SAMPLER_CUBE:
21
- case GL.UNSIGNED_INT_SAMPLER_2D_ARRAY:
22
- return gl.uniform1i(location, value);
41
+ case GL.FLOAT: return gl.uniform1fv(location, arrayValue);
42
+ case GL.FLOAT_VEC2: return gl.uniform2fv(location, arrayValue);
43
+ case GL.FLOAT_VEC3: return gl.uniform3fv(location, arrayValue);
44
+ case GL.FLOAT_VEC4: return gl.uniform4fv(location, arrayValue);
45
+ case GL.INT: return gl.uniform1iv(location, arrayValue);
46
+ case GL.INT_VEC2: return gl.uniform2iv(location, arrayValue);
47
+ case GL.INT_VEC3: return gl.uniform3iv(location, arrayValue);
48
+ case GL.INT_VEC4: return gl.uniform4iv(location, arrayValue);
49
+ case GL.BOOL: return gl.uniform1iv(location, arrayValue);
50
+ case GL.BOOL_VEC2: return gl.uniform2iv(location, arrayValue);
51
+ case GL.BOOL_VEC3: return gl.uniform3iv(location, arrayValue);
52
+ case GL.BOOL_VEC4: return gl.uniform4iv(location, arrayValue);
53
+ // WEBGL2 - unsigned integers
54
+ case GL.UNSIGNED_INT: return gl2.uniform1uiv(location, arrayValue, 1);
55
+ case GL.UNSIGNED_INT_VEC2: return gl2.uniform2uiv(location, arrayValue, 2);
56
+ case GL.UNSIGNED_INT_VEC3: return gl2.uniform3uiv(location, arrayValue, 3);
57
+ case GL.UNSIGNED_INT_VEC4: return gl2.uniform4uiv(location, arrayValue, 4);
58
+ // WebGL2 - quadratic matrices
59
+ // false: don't transpose the matrix
60
+ case GL.FLOAT_MAT2: return gl.uniformMatrix2fv(location, false, arrayValue);
61
+ case GL.FLOAT_MAT3: return gl.uniformMatrix3fv(location, false, arrayValue);
62
+ case GL.FLOAT_MAT4: return gl.uniformMatrix4fv(location, false, arrayValue);
63
+ // WebGL2 - rectangular matrices
64
+ case GL.FLOAT_MAT2x3: return gl2.uniformMatrix2x3fv(location, false, arrayValue);
65
+ case GL.FLOAT_MAT2x4: return gl2.uniformMatrix2x4fv(location, false, arrayValue);
66
+ case GL.FLOAT_MAT3x2: return gl2.uniformMatrix3x2fv(location, false, arrayValue);
67
+ case GL.FLOAT_MAT3x4: return gl2.uniformMatrix3x4fv(location, false, arrayValue);
68
+ case GL.FLOAT_MAT4x2: return gl2.uniformMatrix4x2fv(location, false, arrayValue);
69
+ case GL.FLOAT_MAT4x3: return gl2.uniformMatrix4x3fv(location, false, arrayValue);
23
70
  }
24
- }
25
-
26
- if (value === true) {
27
- value = 1;
28
- }
29
-
30
- if (value === false) {
31
- value = 1;
32
- }
33
-
34
- const arrayValue = typeof value === 'number' ? [value] : value;
35
-
36
- switch (type) {
37
- case GL.FLOAT:
38
- return gl.uniform1fv(location, arrayValue);
39
-
40
- case GL.FLOAT_VEC2:
41
- return gl.uniform2fv(location, arrayValue);
42
-
43
- case GL.FLOAT_VEC3:
44
- return gl.uniform3fv(location, arrayValue);
45
-
46
- case GL.FLOAT_VEC4:
47
- return gl.uniform4fv(location, arrayValue);
48
-
49
- case GL.INT:
50
- return gl.uniform1iv(location, arrayValue);
51
-
52
- case GL.INT_VEC2:
53
- return gl.uniform2iv(location, arrayValue);
54
-
55
- case GL.INT_VEC3:
56
- return gl.uniform3iv(location, arrayValue);
57
-
58
- case GL.INT_VEC4:
59
- return gl.uniform4iv(location, arrayValue);
60
-
61
- case GL.BOOL:
62
- return gl.uniform1iv(location, arrayValue);
63
-
64
- case GL.BOOL_VEC2:
65
- return gl.uniform2iv(location, arrayValue);
66
-
67
- case GL.BOOL_VEC3:
68
- return gl.uniform3iv(location, arrayValue);
69
-
70
- case GL.BOOL_VEC4:
71
- return gl.uniform4iv(location, arrayValue);
72
-
73
- case GL.UNSIGNED_INT:
74
- return gl2.uniform1uiv(location, arrayValue, 1);
75
-
76
- case GL.UNSIGNED_INT_VEC2:
77
- return gl2.uniform2uiv(location, arrayValue, 2);
78
-
79
- case GL.UNSIGNED_INT_VEC3:
80
- return gl2.uniform3uiv(location, arrayValue, 3);
81
-
82
- case GL.UNSIGNED_INT_VEC4:
83
- return gl2.uniform4uiv(location, arrayValue, 4);
84
-
85
- case GL.FLOAT_MAT2:
86
- return gl.uniformMatrix2fv(location, false, arrayValue);
87
-
88
- case GL.FLOAT_MAT3:
89
- return gl.uniformMatrix3fv(location, false, arrayValue);
90
-
91
- case GL.FLOAT_MAT4:
92
- return gl.uniformMatrix4fv(location, false, arrayValue);
93
-
94
- case GL.FLOAT_MAT2x3:
95
- return gl2.uniformMatrix2x3fv(location, false, arrayValue);
96
-
97
- case GL.FLOAT_MAT2x4:
98
- return gl2.uniformMatrix2x4fv(location, false, arrayValue);
99
-
100
- case GL.FLOAT_MAT3x2:
101
- return gl2.uniformMatrix3x2fv(location, false, arrayValue);
102
-
103
- case GL.FLOAT_MAT3x4:
104
- return gl2.uniformMatrix3x4fv(location, false, arrayValue);
105
-
106
- case GL.FLOAT_MAT4x2:
107
- return gl2.uniformMatrix4x2fv(location, false, arrayValue);
108
-
109
- case GL.FLOAT_MAT4x3:
110
- return gl2.uniformMatrix4x3fv(location, false, arrayValue);
111
- }
112
-
113
- throw new Error('Illegal uniform');
71
+ throw new Error('Illegal uniform');
114
72
  }
115
- //# sourceMappingURL=set-uniform.js.map
@@ -1,99 +1,94 @@
1
1
  import GL from '@luma.gl/constants';
2
+ /** Check is uniform is of sampler type */
2
3
  export function isSamplerUniform(type) {
3
- return SAMPLER_TYPES.includes(type);
4
+ return SAMPLER_TYPES.includes(type);
4
5
  }
5
- const SAMPLER_TYPES = [GL.SAMPLER_2D, GL.SAMPLER_CUBE, GL.SAMPLER_3D, GL.SAMPLER_2D_SHADOW, GL.SAMPLER_2D_ARRAY, GL.SAMPLER_2D_ARRAY_SHADOW, GL.SAMPLER_CUBE_SHADOW, GL.INT_SAMPLER_2D, GL.INT_SAMPLER_3D, GL.INT_SAMPLER_CUBE, GL.INT_SAMPLER_2D_ARRAY, GL.UNSIGNED_INT_SAMPLER_2D, GL.UNSIGNED_INT_SAMPLER_3D, GL.UNSIGNED_INT_SAMPLER_CUBE, GL.UNSIGNED_INT_SAMPLER_2D_ARRAY];
6
+ const SAMPLER_TYPES = [
7
+ GL.SAMPLER_2D,
8
+ GL.SAMPLER_CUBE,
9
+ GL.SAMPLER_3D,
10
+ GL.SAMPLER_2D_SHADOW,
11
+ GL.SAMPLER_2D_ARRAY,
12
+ GL.SAMPLER_2D_ARRAY_SHADOW,
13
+ GL.SAMPLER_CUBE_SHADOW,
14
+ GL.INT_SAMPLER_2D,
15
+ GL.INT_SAMPLER_3D,
16
+ GL.INT_SAMPLER_CUBE,
17
+ GL.INT_SAMPLER_2D_ARRAY,
18
+ GL.UNSIGNED_INT_SAMPLER_2D,
19
+ GL.UNSIGNED_INT_SAMPLER_3D,
20
+ GL.UNSIGNED_INT_SAMPLER_CUBE,
21
+ GL.UNSIGNED_INT_SAMPLER_2D_ARRAY
22
+ ];
23
+ // Composite types table
6
24
  const COMPOSITE_GL_TYPES = {
7
- [GL.FLOAT]: [GL.FLOAT, 1, 'float', 'f32', 'float32'],
8
- [GL.FLOAT_VEC2]: [GL.FLOAT, 2, 'vec2', 'vec2<f32>', 'float32x2'],
9
- [GL.FLOAT_VEC3]: [GL.FLOAT, 3, 'vec3', 'vec3<f32>', 'float32x3'],
10
- [GL.FLOAT_VEC4]: [GL.FLOAT, 4, 'vec4', 'vec4<f32>', 'float32x4'],
11
- [GL.INT]: [GL.INT, 1, 'int', 'i32', 'sint32'],
12
- [GL.INT_VEC2]: [GL.INT, 2, 'ivec2', 'vec2<i32>', 'sint32x2'],
13
- [GL.INT_VEC3]: [GL.INT, 3, 'ivec3', 'vec3<i32>', 'sint32x3'],
14
- [GL.INT_VEC4]: [GL.INT, 4, 'ivec4', 'vec4<i32>', 'sint32x4'],
15
- [GL.UNSIGNED_INT]: [GL.UNSIGNED_INT, 1, 'uint', 'u32', 'uint32'],
16
- [GL.UNSIGNED_INT_VEC2]: [GL.UNSIGNED_INT, 2, 'uvec2', 'vec2<u32>', 'uint32x2'],
17
- [GL.UNSIGNED_INT_VEC3]: [GL.UNSIGNED_INT, 3, 'uvec3', 'vec3<u32>', 'uint32x3'],
18
- [GL.UNSIGNED_INT_VEC4]: [GL.UNSIGNED_INT, 4, 'uvec4', 'vec4<u32>', 'uint32x4'],
19
- [GL.BOOL]: [GL.FLOAT, 1, 'bool', 'f32', 'float32x2'],
20
- [GL.BOOL_VEC2]: [GL.FLOAT, 2, 'bvec2', 'vec2<f32>'],
21
- [GL.BOOL_VEC3]: [GL.FLOAT, 3, 'bvec3', 'vec3<f32>'],
22
- [GL.BOOL_VEC4]: [GL.FLOAT, 4, 'bvec4', 'vec4<f32>'],
23
- [GL.FLOAT_MAT2]: [GL.FLOAT, 8, 'mat2', 'mat2x2<f32>'],
24
- [GL.FLOAT_MAT2x3]: [GL.FLOAT, 8, 'mat2x3', 'mat2x3<f32>'],
25
- [GL.FLOAT_MAT2x4]: [GL.FLOAT, 8, 'mat2x4', 'mat2x4<f32>'],
26
- [GL.FLOAT_MAT3x2]: [GL.FLOAT, 12, 'mat3x2', 'mat3x2<f32>'],
27
- [GL.FLOAT_MAT3]: [GL.FLOAT, 12, 'mat3', 'mat3x3<f32>'],
28
- [GL.FLOAT_MAT3x4]: [GL.FLOAT, 12, 'mat3x4', 'mat3x4<f32>'],
29
- [GL.FLOAT_MAT4x2]: [GL.FLOAT, 16, 'mat4x2', 'mat4x2<f32>'],
30
- [GL.FLOAT_MAT4x3]: [GL.FLOAT, 16, 'mat4x3', 'mat4x3<f32>'],
31
- [GL.FLOAT_MAT4]: [GL.FLOAT, 16, 'mat4', 'mat4x4<f32>']
25
+ [GL.FLOAT]: [GL.FLOAT, 1, 'float', 'f32', 'float32'],
26
+ [GL.FLOAT_VEC2]: [GL.FLOAT, 2, 'vec2', 'vec2<f32>', 'float32x2'],
27
+ [GL.FLOAT_VEC3]: [GL.FLOAT, 3, 'vec3', 'vec3<f32>', 'float32x3'],
28
+ [GL.FLOAT_VEC4]: [GL.FLOAT, 4, 'vec4', 'vec4<f32>', 'float32x4'],
29
+ [GL.INT]: [GL.INT, 1, 'int', 'i32', 'sint32'],
30
+ [GL.INT_VEC2]: [GL.INT, 2, 'ivec2', 'vec2<i32>', 'sint32x2'],
31
+ [GL.INT_VEC3]: [GL.INT, 3, 'ivec3', 'vec3<i32>', 'sint32x3'],
32
+ [GL.INT_VEC4]: [GL.INT, 4, 'ivec4', 'vec4<i32>', 'sint32x4'],
33
+ [GL.UNSIGNED_INT]: [GL.UNSIGNED_INT, 1, 'uint', 'u32', 'uint32'],
34
+ [GL.UNSIGNED_INT_VEC2]: [GL.UNSIGNED_INT, 2, 'uvec2', 'vec2<u32>', 'uint32x2'],
35
+ [GL.UNSIGNED_INT_VEC3]: [GL.UNSIGNED_INT, 3, 'uvec3', 'vec3<u32>', 'uint32x3'],
36
+ [GL.UNSIGNED_INT_VEC4]: [GL.UNSIGNED_INT, 4, 'uvec4', 'vec4<u32>', 'uint32x4'],
37
+ [GL.BOOL]: [GL.FLOAT, 1, 'bool', 'f32', 'float32x2'],
38
+ [GL.BOOL_VEC2]: [GL.FLOAT, 2, 'bvec2', 'vec2<f32>'],
39
+ [GL.BOOL_VEC3]: [GL.FLOAT, 3, 'bvec3', 'vec3<f32>'],
40
+ [GL.BOOL_VEC4]: [GL.FLOAT, 4, 'bvec4', 'vec4<f32>'],
41
+ [GL.FLOAT_MAT2]: [GL.FLOAT, 8, 'mat2', 'mat2x2<f32>'],
42
+ [GL.FLOAT_MAT2x3]: [GL.FLOAT, 8, 'mat2x3', 'mat2x3<f32>'],
43
+ [GL.FLOAT_MAT2x4]: [GL.FLOAT, 8, 'mat2x4', 'mat2x4<f32>'],
44
+ [GL.FLOAT_MAT3x2]: [GL.FLOAT, 12, 'mat3x2', 'mat3x2<f32>'],
45
+ [GL.FLOAT_MAT3]: [GL.FLOAT, 12, 'mat3', 'mat3x3<f32>'],
46
+ [GL.FLOAT_MAT3x4]: [GL.FLOAT, 12, 'mat3x4', 'mat3x4<f32>'],
47
+ [GL.FLOAT_MAT4x2]: [GL.FLOAT, 16, 'mat4x2', 'mat4x2<f32>'],
48
+ [GL.FLOAT_MAT4x3]: [GL.FLOAT, 16, 'mat4x3', 'mat4x3<f32>'],
49
+ [GL.FLOAT_MAT4]: [GL.FLOAT, 16, 'mat4', 'mat4x4<f32>'] // 16
32
50
  };
51
+ /** Decomposes a composite type GL.VEC3 into a basic type (GL.FLOAT) and components (3) */
33
52
  export function decodeUniformType(uniformType) {
34
- const typeAndSize = COMPOSITE_GL_TYPES[uniformType];
35
-
36
- if (!typeAndSize) {
37
- throw new Error('uniform');
38
- }
39
-
40
- const [glType, components,, format] = typeAndSize;
41
- return {
42
- format,
43
- components,
44
- glType
45
- };
53
+ const typeAndSize = COMPOSITE_GL_TYPES[uniformType];
54
+ if (!typeAndSize) {
55
+ throw new Error('uniform');
56
+ }
57
+ const [glType, components, , format] = typeAndSize;
58
+ return { format, components, glType };
46
59
  }
47
60
  export function decodeAttributeType(attributeType) {
48
- const typeAndSize = COMPOSITE_GL_TYPES[attributeType];
49
-
50
- if (!typeAndSize) {
51
- throw new Error('attribute');
52
- }
53
-
54
- const [glType, components,,, format] = typeAndSize;
55
- return {
56
- format,
57
- components,
58
- glType
59
- };
61
+ const typeAndSize = COMPOSITE_GL_TYPES[attributeType];
62
+ if (!typeAndSize) {
63
+ throw new Error('attribute');
64
+ }
65
+ const [glType, components, , , format] = typeAndSize;
66
+ return { format, components, glType };
60
67
  }
68
+ /** Decomposes a composite type GL.VEC3 into a basic type (GL.FLOAT) and components (3) */
61
69
  export function decomposeCompositeGLType(compositeGLType) {
62
- const typeAndSize = COMPOSITE_GL_TYPES[compositeGLType];
63
-
64
- if (!typeAndSize) {
65
- return null;
66
- }
67
-
68
- const [type, components] = typeAndSize;
69
- return {
70
- type,
71
- components
72
- };
70
+ const typeAndSize = COMPOSITE_GL_TYPES[compositeGLType];
71
+ if (!typeAndSize) {
72
+ return null;
73
+ }
74
+ const [type, components] = typeAndSize;
75
+ return { type, components };
73
76
  }
74
77
  export function getCompositeGLType(type, components) {
75
- switch (type) {
76
- case GL.BYTE:
77
- case GL.UNSIGNED_BYTE:
78
- case GL.SHORT:
79
- case GL.UNSIGNED_SHORT:
80
- type = GL.FLOAT;
81
- break;
82
-
83
- default:
84
- }
85
-
86
- for (const glType in COMPOSITE_GL_TYPES) {
87
- const [compType, compComponents, name] = COMPOSITE_GL_TYPES[glType];
88
-
89
- if (compType === type && compComponents === components) {
90
- return {
91
- glType: Number(glType),
92
- name
93
- };
78
+ switch (type) {
79
+ case GL.BYTE:
80
+ case GL.UNSIGNED_BYTE:
81
+ case GL.SHORT:
82
+ case GL.UNSIGNED_SHORT:
83
+ type = GL.FLOAT;
84
+ break;
85
+ default:
86
+ }
87
+ for (const glType in COMPOSITE_GL_TYPES) {
88
+ const [compType, compComponents, name] = COMPOSITE_GL_TYPES[glType];
89
+ if (compType === type && compComponents === components) {
90
+ return { glType: Number(glType), name };
91
+ }
94
92
  }
95
- }
96
-
97
- return null;
93
+ return null;
98
94
  }
99
- //# sourceMappingURL=uniforms.js.map
@@ -1,42 +1,42 @@
1
1
  import { assert } from '@luma.gl/api';
2
+ // Resolve a WebGL enumeration name (returns itself if already a number)
2
3
  export function getKeyValue(gl, name) {
3
- if (typeof name !== 'string') {
4
- return name;
5
- }
6
-
7
- const number = Number(name);
8
-
9
- if (!isNaN(number)) {
10
- return number;
11
- }
12
-
13
- name = name.replace(/^.*\./, '');
14
- const value = gl[name];
15
- assert(value !== undefined, "Accessing undefined constant GL.".concat(name));
16
- return value;
4
+ // If not a string, return (assume number)
5
+ if (typeof name !== 'string') {
6
+ return name;
7
+ }
8
+ // If string converts to number, return number
9
+ const number = Number(name);
10
+ if (!isNaN(number)) {
11
+ return number;
12
+ }
13
+ // Look up string, after removing any 'GL.' or 'gl.' prefix
14
+ name = name.replace(/^.*\./, '');
15
+ // @ts-ignore expect-error depends on settings
16
+ const value = gl[name];
17
+ assert(value !== undefined, `Accessing undefined constant GL.${name}`);
18
+ return value;
17
19
  }
18
20
  export function getKey(gl, value) {
19
- gl = gl.gl || gl;
20
- value = Number(value);
21
-
22
- for (const key in gl) {
23
- if (gl[key] === value) {
24
- return "GL.".concat(key);
21
+ // @ts-ignore expect-error depends on settings
22
+ gl = gl.gl || gl;
23
+ value = Number(value);
24
+ for (const key in gl) {
25
+ // @ts-ignore expect-error depends on settings
26
+ if (gl[key] === value) {
27
+ return `GL.${key}`;
28
+ }
25
29
  }
26
- }
27
-
28
- return String(value);
30
+ return String(value);
29
31
  }
30
32
  export function getKeyType(gl, value) {
31
- assert(value !== undefined, 'undefined key');
32
- value = Number(value);
33
-
34
- for (const key in gl) {
35
- if (gl[key] === value) {
36
- return "GL.".concat(key);
33
+ assert(value !== undefined, 'undefined key');
34
+ value = Number(value);
35
+ for (const key in gl) {
36
+ // @ts-ignore expect-error depends on settings
37
+ if (gl[key] === value) {
38
+ return `GL.${key}`;
39
+ }
37
40
  }
38
- }
39
-
40
- return String(value);
41
+ return String(value);
41
42
  }
42
- //# sourceMappingURL=constants-to-keys.js.map
@@ -1,7 +1,7 @@
1
1
  import { ResourceProps } from '@luma.gl/api';
2
2
  import WebGLDevice from '../webgl-device';
3
3
  import WebGLResource from './webgl-resource';
4
- export declare type RenderbufferProps = ResourceProps & {
4
+ export type RenderbufferProps = ResourceProps & {
5
5
  format: number;
6
6
  width?: number;
7
7
  height?: number;
@@ -1 +1 @@
1
- {"version":3,"file":"webgl-renderbuffer.d.ts","sourceRoot":"","sources":["../../../src/adapter/objects/webgl-renderbuffer.ts"],"names":[],"mappings":"AACA,OAAO,EAAS,aAAa,EAAC,MAAM,cAAc,CAAC;AAEnD,OAAO,WAAW,MAAM,iBAAiB,CAAC;AAC1C,OAAO,aAAa,MAAM,kBAAkB,CAAC;AAK7C,oBAAY,iBAAiB,GAAG,aAAa,GAAG;IAC9C,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAYF;;;;;;;;;GASG;AACH,MAAM,CAAC,OAAO,OAAO,iBAAkB,SAAQ,aAAa,CAAC,iBAAiB,CAAC;IAC9E,IAAa,CAAC,MAAM,CAAC,WAAW,CAAC,IAAI,MAAM,CAA2B;IAErE,IAAI,KAAK,IAAI,MAAM,CAA6B;IAChD,IAAI,MAAM,IAAI,MAAM,CAA8B;IAClD,IAAI,MAAM,IAAI,MAAM,CAA+B;IACnD,IAAI,OAAO,IAAI,MAAM,CAA+B;IAEpD,MAAM,CAAC,WAAW,CAAC,EAAE,EAAE,qBAAqB,EAAE,OAAO,CAAC,EAAE;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAC,GAAG,OAAO;gBAIvE,MAAM,EAAE,WAAW,EAAE,KAAK,EAAE,iBAAiB;IAKzD,MAAM,CAAC,IAAI,EAAE;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAC,GAAG,IAAI;IAWnD,iEAAiE;IACjE,SAAS,CAAC,WAAW,CAAC,KAAK,EAAE,QAAQ,CAAC,iBAAiB,CAAC;IA0B/C,aAAa;IAIb,aAAa,IAAI,IAAI;IAKrB,WAAW,CAAC,MAAM,EAAE,iBAAiB,GAAG,IAAI;CAGtD"}
1
+ {"version":3,"file":"webgl-renderbuffer.d.ts","sourceRoot":"","sources":["../../../src/adapter/objects/webgl-renderbuffer.ts"],"names":[],"mappings":"AACA,OAAO,EAAS,aAAa,EAAC,MAAM,cAAc,CAAC;AAEnD,OAAO,WAAW,MAAM,iBAAiB,CAAC;AAC1C,OAAO,aAAa,MAAM,kBAAkB,CAAC;AAK7C,MAAM,MAAM,iBAAiB,GAAG,aAAa,GAAG;IAC9C,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAYF;;;;;;;;;GASG;AACH,MAAM,CAAC,OAAO,OAAO,iBAAkB,SAAQ,aAAa,CAAC,iBAAiB,CAAC;IAC9E,IAAa,CAAC,MAAM,CAAC,WAAW,CAAC,IAAI,MAAM,CAA2B;IAErE,IAAI,KAAK,IAAI,MAAM,CAA6B;IAChD,IAAI,MAAM,IAAI,MAAM,CAA8B;IAClD,IAAI,MAAM,IAAI,MAAM,CAA+B;IACnD,IAAI,OAAO,IAAI,MAAM,CAA+B;IAEpD,MAAM,CAAC,WAAW,CAAC,EAAE,EAAE,qBAAqB,EAAE,OAAO,CAAC,EAAE;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAC,GAAG,OAAO;gBAIvE,MAAM,EAAE,WAAW,EAAE,KAAK,EAAE,iBAAiB;IAKzD,MAAM,CAAC,IAAI,EAAE;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAC,GAAG,IAAI;IAWnD,iEAAiE;IACjE,SAAS,CAAC,WAAW,CAAC,KAAK,EAAE,QAAQ,CAAC,iBAAiB,CAAC;IA0B/C,aAAa;IAIb,aAAa,IAAI,IAAI;IAKrB,WAAW,CAAC,MAAM,EAAE,iBAAiB,GAAG,IAAI;CAGtD"}