@luma.gl/shadertools 9.1.0-alpha.1 → 9.1.0-alpha.12

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 (244) hide show
  1. package/dist/dist.dev.js +1005 -487
  2. package/dist/dist.min.js +2489 -1625
  3. package/dist/index.cjs +2864 -1817
  4. package/dist/index.cjs.map +4 -4
  5. package/dist/index.d.ts +29 -28
  6. package/dist/index.d.ts.map +1 -1
  7. package/dist/index.js +8 -12
  8. package/dist/lib/glsl-utils/shader-utils.d.ts.map +1 -1
  9. package/dist/lib/glsl-utils/shader-utils.js +2 -3
  10. package/dist/lib/shader-assembler.d.ts +3 -4
  11. package/dist/lib/shader-assembler.d.ts.map +1 -1
  12. package/dist/lib/shader-assembler.js +3 -2
  13. package/dist/lib/shader-assembly/assemble-shaders.d.ts +4 -3
  14. package/dist/lib/shader-assembly/assemble-shaders.d.ts.map +1 -1
  15. package/dist/lib/shader-assembly/assemble-shaders.js +46 -18
  16. package/dist/lib/shader-assembly/platform-defines.d.ts.map +1 -1
  17. package/dist/lib/shader-assembly/platform-defines.js +14 -6
  18. package/dist/lib/shader-module/shader-module-dependencies.d.ts +53 -0
  19. package/dist/lib/shader-module/shader-module-dependencies.d.ts.map +1 -0
  20. package/dist/lib/{shader-assembly/resolve-modules.js → shader-module/shader-module-dependencies.js} +38 -14
  21. package/dist/lib/shader-module/shader-module.d.ts +30 -12
  22. package/dist/lib/shader-module/shader-module.d.ts.map +1 -1
  23. package/dist/lib/shader-module/shader-module.js +76 -6
  24. package/dist/lib/shader-module/shader-pass.d.ts +3 -2
  25. package/dist/lib/shader-module/shader-pass.d.ts.map +1 -1
  26. package/dist/module-injectors.d.ts +2 -2
  27. package/dist/module-injectors.d.ts.map +1 -1
  28. package/dist/module-injectors.js +13 -10
  29. package/dist/modules/engine/geometry/geometry.d.ts.map +1 -1
  30. package/dist/modules/engine/geometry/geometry.js +12 -8
  31. package/dist/modules/engine/picking/picking.d.ts +9 -9
  32. package/dist/modules/engine/picking/picking.d.ts.map +1 -1
  33. package/dist/modules/engine/picking/picking.js +103 -66
  34. package/dist/modules/engine/project/project.d.ts +2 -2
  35. package/dist/modules/engine/project/project.d.ts.map +1 -1
  36. package/dist/modules/engine/project/project.js +36 -22
  37. package/dist/modules/engine/transform/transform.d.ts.map +1 -1
  38. package/dist/modules/engine/transform/transform.js +28 -16
  39. package/dist/modules/lighting/gouraud-material/gouraud-material.d.ts +10 -7
  40. package/dist/modules/lighting/gouraud-material/gouraud-material.d.ts.map +1 -1
  41. package/dist/modules/lighting/gouraud-material/gouraud-material.js +2 -0
  42. package/dist/modules/lighting/gouraud-material/gouraud-shaders-glsl.d.ts +2 -2
  43. package/dist/modules/lighting/gouraud-material/gouraud-shaders-glsl.d.ts.map +1 -1
  44. package/dist/modules/lighting/gouraud-material/gouraud-shaders-glsl.js +79 -53
  45. package/dist/modules/lighting/lights/lighting-uniforms-glsl.d.ts +1 -1
  46. package/dist/modules/lighting/lights/lighting-uniforms-glsl.d.ts.map +1 -1
  47. package/dist/modules/lighting/lights/lighting-uniforms-glsl.js +38 -23
  48. package/dist/modules/lighting/lights/lighting-uniforms-wgsl.d.ts +2 -0
  49. package/dist/modules/lighting/lights/lighting-uniforms-wgsl.d.ts.map +1 -0
  50. package/dist/modules/lighting/lights/lighting-uniforms-wgsl.js +56 -0
  51. package/dist/modules/lighting/lights/lighting.d.ts +5 -4
  52. package/dist/modules/lighting/lights/lighting.d.ts.map +1 -1
  53. package/dist/modules/lighting/lights/lighting.js +7 -5
  54. package/dist/modules/lighting/no-material/dirlight.d.ts +8 -8
  55. package/dist/modules/lighting/no-material/dirlight.d.ts.map +1 -1
  56. package/dist/modules/lighting/no-material/dirlight.js +34 -20
  57. package/dist/modules/lighting/pbr-material/pbr-fragment-glsl.d.ts +1 -1
  58. package/dist/modules/lighting/pbr-material/pbr-fragment-glsl.d.ts.map +1 -1
  59. package/dist/modules/lighting/pbr-material/pbr-fragment-glsl.js +304 -181
  60. package/dist/modules/lighting/pbr-material/pbr-material.d.ts +72 -69
  61. package/dist/modules/lighting/pbr-material/pbr-material.d.ts.map +1 -1
  62. package/dist/modules/lighting/pbr-material/pbr-material.js +4 -2
  63. package/dist/modules/lighting/pbr-material/pbr-uniforms-glsl.d.ts +1 -1
  64. package/dist/modules/lighting/pbr-material/pbr-uniforms-glsl.d.ts.map +1 -1
  65. package/dist/modules/lighting/pbr-material/pbr-uniforms-glsl.js +38 -20
  66. package/dist/modules/lighting/pbr-material/pbr-vertex-glsl.d.ts +1 -1
  67. package/dist/modules/lighting/pbr-material/pbr-vertex-glsl.d.ts.map +1 -1
  68. package/dist/modules/lighting/pbr-material/pbr-vertex-glsl.js +21 -16
  69. package/dist/modules/lighting/phong-material/phong-material.d.ts +14 -12
  70. package/dist/modules/lighting/phong-material/phong-material.d.ts.map +1 -1
  71. package/dist/modules/lighting/phong-material/phong-material.js +5 -3
  72. package/dist/modules/lighting/phong-material/phong-shaders-glsl.d.ts +2 -2
  73. package/dist/modules/lighting/phong-material/phong-shaders-glsl.d.ts.map +1 -1
  74. package/dist/modules/lighting/phong-material/phong-shaders-glsl.js +82 -54
  75. package/dist/modules/lighting/phong-material/phong-shaders-wgsl.d.ts +41 -0
  76. package/dist/modules/lighting/phong-material/phong-shaders-wgsl.d.ts.map +1 -0
  77. package/dist/modules/lighting/phong-material/phong-shaders-wgsl.js +130 -0
  78. package/dist/modules/math/fp32/fp32.d.ts.map +1 -1
  79. package/dist/modules/math/fp32/fp32.js +127 -100
  80. package/dist/modules/math/fp64/fp64-utils.d.ts +3 -3
  81. package/dist/modules/math/fp64/fp64-utils.d.ts.map +1 -1
  82. package/dist/modules/math/random/random.d.ts +1 -1
  83. package/dist/modules/math/random/random.d.ts.map +1 -1
  84. package/dist/modules/math/random/random.js +3 -3
  85. package/dist/modules/module-injectors.d.ts +2 -2
  86. package/dist/modules/module-injectors.d.ts.map +1 -1
  87. package/dist/modules/module-injectors.js +13 -10
  88. package/dist/modules/postprocessing/image-adjust-filters/brightnesscontrast.d.ts +4 -1
  89. package/dist/modules/postprocessing/image-adjust-filters/brightnesscontrast.d.ts.map +1 -1
  90. package/dist/modules/postprocessing/image-adjust-filters/brightnesscontrast.js +16 -12
  91. package/dist/modules/postprocessing/image-adjust-filters/denoise.d.ts +4 -1
  92. package/dist/modules/postprocessing/image-adjust-filters/denoise.d.ts.map +1 -1
  93. package/dist/modules/postprocessing/image-adjust-filters/denoise.js +21 -17
  94. package/dist/modules/postprocessing/image-adjust-filters/huesaturation.d.ts +5 -2
  95. package/dist/modules/postprocessing/image-adjust-filters/huesaturation.d.ts.map +1 -1
  96. package/dist/modules/postprocessing/image-adjust-filters/huesaturation.js +29 -22
  97. package/dist/modules/postprocessing/image-adjust-filters/noise.d.ts +4 -1
  98. package/dist/modules/postprocessing/image-adjust-filters/noise.d.ts.map +1 -1
  99. package/dist/modules/postprocessing/image-adjust-filters/noise.js +14 -10
  100. package/dist/modules/postprocessing/image-adjust-filters/sepia.d.ts +4 -1
  101. package/dist/modules/postprocessing/image-adjust-filters/sepia.d.ts.map +1 -1
  102. package/dist/modules/postprocessing/image-adjust-filters/sepia.js +17 -12
  103. package/dist/modules/postprocessing/image-adjust-filters/vibrance.d.ts +4 -1
  104. package/dist/modules/postprocessing/image-adjust-filters/vibrance.d.ts.map +1 -1
  105. package/dist/modules/postprocessing/image-adjust-filters/vibrance.js +12 -9
  106. package/dist/modules/postprocessing/image-adjust-filters/vignette.d.ts +4 -1
  107. package/dist/modules/postprocessing/image-adjust-filters/vignette.d.ts.map +1 -1
  108. package/dist/modules/postprocessing/image-adjust-filters/vignette.js +13 -10
  109. package/dist/modules/postprocessing/image-blur-filters/tiltshift.d.ts +5 -2
  110. package/dist/modules/postprocessing/image-blur-filters/tiltshift.d.ts.map +1 -1
  111. package/dist/modules/postprocessing/image-blur-filters/tiltshift.js +40 -26
  112. package/dist/modules/postprocessing/image-blur-filters/triangleblur.d.ts +5 -2
  113. package/dist/modules/postprocessing/image-blur-filters/triangleblur.d.ts.map +1 -1
  114. package/dist/modules/postprocessing/image-blur-filters/triangleblur.js +32 -19
  115. package/dist/modules/postprocessing/image-blur-filters/zoomblur.d.ts +4 -1
  116. package/dist/modules/postprocessing/image-blur-filters/zoomblur.d.ts.map +1 -1
  117. package/dist/modules/postprocessing/image-blur-filters/zoomblur.js +2 -0
  118. package/dist/modules/postprocessing/image-fun-filters/colorhalftone.d.ts +4 -1
  119. package/dist/modules/postprocessing/image-fun-filters/colorhalftone.d.ts.map +1 -1
  120. package/dist/modules/postprocessing/image-fun-filters/colorhalftone.js +31 -27
  121. package/dist/modules/postprocessing/image-fun-filters/dotscreen.d.ts +4 -1
  122. package/dist/modules/postprocessing/image-fun-filters/dotscreen.d.ts.map +1 -1
  123. package/dist/modules/postprocessing/image-fun-filters/dotscreen.js +19 -15
  124. package/dist/modules/postprocessing/image-fun-filters/edgework.d.ts +8 -5
  125. package/dist/modules/postprocessing/image-fun-filters/edgework.d.ts.map +1 -1
  126. package/dist/modules/postprocessing/image-fun-filters/edgework.js +53 -42
  127. package/dist/modules/postprocessing/image-fun-filters/hexagonalpixelate.d.ts +4 -1
  128. package/dist/modules/postprocessing/image-fun-filters/hexagonalpixelate.d.ts.map +1 -1
  129. package/dist/modules/postprocessing/image-fun-filters/hexagonalpixelate.js +41 -33
  130. package/dist/modules/postprocessing/image-fun-filters/ink.d.ts +4 -1
  131. package/dist/modules/postprocessing/image-fun-filters/ink.d.ts.map +1 -1
  132. package/dist/modules/postprocessing/image-fun-filters/ink.js +27 -25
  133. package/dist/modules/postprocessing/image-fun-filters/magnify.d.ts +2 -1
  134. package/dist/modules/postprocessing/image-fun-filters/magnify.d.ts.map +1 -1
  135. package/dist/modules/postprocessing/image-fun-filters/magnify.js +17 -16
  136. package/dist/modules/postprocessing/image-warp-filters/bulgepinch.d.ts +5 -2
  137. package/dist/modules/postprocessing/image-warp-filters/bulgepinch.d.ts.map +1 -1
  138. package/dist/modules/postprocessing/image-warp-filters/bulgepinch.js +24 -20
  139. package/dist/modules/postprocessing/image-warp-filters/swirl.d.ts +5 -2
  140. package/dist/modules/postprocessing/image-warp-filters/swirl.d.ts.map +1 -1
  141. package/dist/modules/postprocessing/image-warp-filters/swirl.js +26 -22
  142. package/dist/modules/postprocessing/image-warp-filters/warp.d.ts +2 -1
  143. package/dist/modules/postprocessing/image-warp-filters/warp.d.ts.map +1 -1
  144. package/dist/modules/postprocessing/image-warp-filters/warp.js +9 -8
  145. package/dist/modules-webgl1/geometry/geometry.d.ts.map +1 -1
  146. package/dist/modules-webgl1/geometry/geometry.js +12 -8
  147. package/dist/modules-webgl1/lighting/dirlight/dirlight.d.ts +2 -2
  148. package/dist/modules-webgl1/lighting/dirlight/dirlight.d.ts.map +1 -1
  149. package/dist/modules-webgl1/lighting/dirlight/dirlight.js +8 -5
  150. package/dist/modules-webgl1/lighting/lights/lights-glsl.d.ts +1 -1
  151. package/dist/modules-webgl1/lighting/lights/lights-glsl.d.ts.map +1 -1
  152. package/dist/modules-webgl1/lighting/lights/lights-glsl.js +19 -11
  153. package/dist/modules-webgl1/lighting/pbr/pbr-fragment-glsl.d.ts +1 -1
  154. package/dist/modules-webgl1/lighting/pbr/pbr-fragment-glsl.d.ts.map +1 -1
  155. package/dist/modules-webgl1/lighting/pbr/pbr-fragment-glsl.js +268 -157
  156. package/dist/modules-webgl1/lighting/pbr/pbr-vertex-glsl.d.ts +1 -1
  157. package/dist/modules-webgl1/lighting/pbr/pbr-vertex-glsl.d.ts.map +1 -1
  158. package/dist/modules-webgl1/lighting/pbr/pbr-vertex-glsl.js +16 -12
  159. package/dist/modules-webgl1/lighting/phong-lighting/phong-lighting-glsl.d.ts +1 -1
  160. package/dist/modules-webgl1/lighting/phong-lighting/phong-lighting-glsl.d.ts.map +1 -1
  161. package/dist/modules-webgl1/lighting/phong-lighting/phong-lighting-glsl.js +64 -55
  162. package/dist/modules-webgl1/math/fp64/fp64-arithmetic-glsl.d.ts +1 -1
  163. package/dist/modules-webgl1/math/fp64/fp64-arithmetic-glsl.d.ts.map +1 -1
  164. package/dist/modules-webgl1/math/fp64/fp64-arithmetic-glsl.js +113 -81
  165. package/dist/modules-webgl1/math/fp64/fp64-functions-glsl.d.ts +1 -1
  166. package/dist/modules-webgl1/math/fp64/fp64-functions-glsl.d.ts.map +1 -1
  167. package/dist/modules-webgl1/math/fp64/fp64-functions-glsl.js +588 -433
  168. package/dist/modules-webgl1/project/project.d.ts +2 -2
  169. package/dist/modules-webgl1/project/project.d.ts.map +1 -1
  170. package/dist/modules-webgl1/project/project.js +5 -4
  171. package/package.json +5 -5
  172. package/src/index.ts +78 -32
  173. package/src/lib/glsl-utils/shader-utils.ts +1 -3
  174. package/src/lib/shader-assembler.ts +7 -8
  175. package/src/lib/shader-assembly/assemble-shaders.ts +55 -22
  176. package/src/lib/shader-assembly/platform-defines.ts +5 -6
  177. package/src/lib/shader-module/shader-module-dependencies.ts +111 -0
  178. package/src/lib/shader-module/shader-module.ts +134 -19
  179. package/src/lib/shader-module/shader-pass.ts +3 -2
  180. package/src/module-injectors.ts +2 -4
  181. package/src/modules/engine/geometry/geometry.ts +2 -3
  182. package/src/modules/engine/picking/picking.ts +12 -10
  183. package/src/modules/engine/project/project.ts +2 -3
  184. package/src/modules/engine/transform/transform.ts +1 -3
  185. package/src/modules/lighting/gouraud-material/gouraud-material.ts +4 -0
  186. package/src/modules/lighting/gouraud-material/gouraud-shaders-glsl.ts +2 -4
  187. package/src/modules/lighting/lights/lighting-uniforms-glsl.ts +1 -3
  188. package/src/modules/lighting/lights/lighting-uniforms-wgsl.ts +57 -0
  189. package/src/modules/lighting/lights/lighting.ts +9 -5
  190. package/src/modules/lighting/no-material/dirlight.ts +30 -19
  191. package/src/modules/lighting/pbr-material/pbr-fragment-glsl.ts +1 -2
  192. package/src/modules/lighting/pbr-material/pbr-material.ts +44 -38
  193. package/src/modules/lighting/pbr-material/pbr-uniforms-glsl.ts +1 -3
  194. package/src/modules/lighting/pbr-material/pbr-vertex-glsl.ts +1 -3
  195. package/src/modules/lighting/phong-material/phong-material.ts +6 -3
  196. package/src/modules/lighting/phong-material/phong-shaders-glsl.ts +2 -4
  197. package/src/modules/lighting/phong-material/phong-shaders-wgsl.ts +132 -0
  198. package/src/modules/math/fp32/fp32.ts +1 -2
  199. package/src/modules/math/fp64/fp64-utils.ts +3 -3
  200. package/src/modules/math/random/random.ts +1 -2
  201. package/src/modules/module-injectors.ts +2 -4
  202. package/src/modules/postprocessing/image-adjust-filters/brightnesscontrast.ts +6 -2
  203. package/src/modules/postprocessing/image-adjust-filters/denoise.ts +7 -3
  204. package/src/modules/postprocessing/image-adjust-filters/huesaturation.ts +9 -4
  205. package/src/modules/postprocessing/image-adjust-filters/noise.ts +6 -2
  206. package/src/modules/postprocessing/image-adjust-filters/sepia.ts +6 -2
  207. package/src/modules/postprocessing/image-adjust-filters/vibrance.ts +5 -2
  208. package/src/modules/postprocessing/image-adjust-filters/vignette.ts +11 -4
  209. package/src/modules/postprocessing/image-blur-filters/tiltshift.ts +6 -2
  210. package/src/modules/postprocessing/image-blur-filters/triangleblur.ts +6 -2
  211. package/src/modules/postprocessing/image-blur-filters/zoomblur.ts +5 -0
  212. package/src/modules/postprocessing/image-fun-filters/colorhalftone.ts +6 -2
  213. package/src/modules/postprocessing/image-fun-filters/dotscreen.ts +6 -2
  214. package/src/modules/postprocessing/image-fun-filters/edgework.ts +10 -4
  215. package/src/modules/postprocessing/image-fun-filters/hexagonalpixelate.ts +6 -2
  216. package/src/modules/postprocessing/image-fun-filters/ink.ts +8 -3
  217. package/src/modules/postprocessing/image-fun-filters/magnify.ts +3 -2
  218. package/src/modules/postprocessing/image-warp-filters/bulgepinch.ts +6 -2
  219. package/src/modules/postprocessing/image-warp-filters/swirl.ts +8 -2
  220. package/src/modules/postprocessing/image-warp-filters/warp.ts +3 -2
  221. package/src/modules-webgl1/geometry/geometry.ts +2 -3
  222. package/src/modules-webgl1/lighting/dirlight/dirlight.ts +3 -4
  223. package/src/modules-webgl1/lighting/lights/lights-glsl.ts +1 -3
  224. package/src/modules-webgl1/lighting/pbr/pbr-fragment-glsl.ts +1 -2
  225. package/src/modules-webgl1/lighting/pbr/pbr-vertex-glsl.ts +1 -3
  226. package/src/modules-webgl1/lighting/phong-lighting/phong-lighting-glsl.ts +1 -3
  227. package/src/modules-webgl1/math/fp64/fp64-arithmetic-glsl.ts +1 -3
  228. package/src/modules-webgl1/math/fp64/fp64-functions-glsl.ts +1 -3
  229. package/src/modules-webgl1/project/project.ts +1 -2
  230. package/dist/lib/glsl-utils/highlight.d.ts +0 -6
  231. package/dist/lib/glsl-utils/highlight.d.ts.map +0 -1
  232. package/dist/lib/glsl-utils/highlight.js +0 -9
  233. package/dist/lib/shader-assembly/resolve-modules.d.ts +0 -40
  234. package/dist/lib/shader-assembly/resolve-modules.d.ts.map +0 -1
  235. package/dist/lib/shader-module/normalize-shader-module.d.ts +0 -3
  236. package/dist/lib/shader-module/normalize-shader-module.d.ts.map +0 -1
  237. package/dist/lib/shader-module/normalize-shader-module.js +0 -14
  238. package/dist/lib/shader-module/shader-module-instance.d.ts +0 -28
  239. package/dist/lib/shader-module/shader-module-instance.d.ts.map +0 -1
  240. package/dist/lib/shader-module/shader-module-instance.js +0 -126
  241. package/src/lib/glsl-utils/highlight.ts +0 -11
  242. package/src/lib/shader-assembly/resolve-modules.ts +0 -81
  243. package/src/lib/shader-module/normalize-shader-module.ts +0 -17
  244. package/src/lib/shader-module/shader-module-instance.ts +0 -167
package/dist/index.d.ts CHANGED
@@ -2,15 +2,19 @@
2
2
  * Marks GLSL shaders for syntax highlighting: glsl`...`
3
3
  * Install https://marketplace.visualstudio.com/items?itemName=boyswan.glsl-literal
4
4
  */
5
- export { glsl } from "./lib/glsl-utils/highlight.js";
6
5
  export type { PlatformInfo } from "./lib/shader-assembly/platform-info.js";
7
6
  export type { ShaderModule } from "./lib/shader-module/shader-module.js";
8
7
  export type { ShaderPass } from "./lib/shader-module/shader-pass.js";
8
+ export { initializeShaderModule, initializeShaderModules } from "./lib/shader-module/shader-module.js";
9
+ export { getShaderModuleUniforms } from "./lib/shader-module/shader-module.js";
10
+ export { getShaderModuleDependencies } from "./lib/shader-module/shader-module-dependencies.js";
11
+ export { checkShaderModuleDeprecations } from "./lib/shader-module/shader-module.js";
12
+ export { getShaderModuleSource } from "./lib/shader-assembly/assemble-shaders.js";
13
+ export { resolveModules as _resolveModules } from "./lib/shader-module/shader-module-dependencies.js";
14
+ export { getDependencyGraph as _getDependencyGraph } from "./lib/shader-module/shader-module-dependencies.js";
15
+ export { ShaderAssembler } from "./lib/shader-assembler.js";
9
16
  export type { ShaderHook } from "./lib/shader-assembly/shader-hooks.js";
10
17
  export type { ShaderInjection } from "./lib/shader-assembly/shader-injections.js";
11
- export { ShaderModuleInstance } from "./lib/shader-module/shader-module-instance.js";
12
- export { ShaderAssembler } from "./lib/shader-assembler.js";
13
- export { normalizeShaderModule } from "./lib/shader-module/normalize-shader-module.js";
14
18
  export { getShaderInfo } from "./lib/glsl-utils/get-shader-info.js";
15
19
  export { getQualifierDetails, getPassthroughFS, typeToChannelSuffix, typeToChannelCount, convertToVec4 } from "./lib/glsl-utils/shader-utils.js";
16
20
  export type { ShaderGenerationOptions } from "./lib/shader-generator/generate-shader.js";
@@ -18,18 +22,15 @@ export { generateShaderForModule } from "./lib/shader-generator/generate-shader.
18
22
  export { capitalize } from "./lib/shader-generator/utils/capitalize.js";
19
23
  export { preprocess } from "./lib/preprocessor/preprocessor.js";
20
24
  export { assembleGLSLShaderPair } from "./lib/shader-assembly/assemble-shaders.js";
21
- export { ShaderModuleInstance as _ShaderModuleInstance } from "./lib/shader-module/shader-module-instance.js";
22
25
  export { combineInjects } from "./lib/shader-assembly/shader-injections.js";
23
- export { resolveModules as _resolveModules } from "./lib/shader-assembly/resolve-modules.js";
24
- export { getDependencyGraph as _getDependencyGraph } from "./lib/shader-assembly/resolve-modules.js";
25
26
  export { getShaderLayoutFromWGSL } from "./lib/wgsl/get-shader-layout-wgsl.js";
26
27
  export { toHalfFloat, fromHalfFloat } from "./modules/math/fp16/fp16-utils.js";
27
28
  export { fp64ify, fp64LowPart, fp64ifyMatrix4 } from "./modules/math/fp64/fp64-utils.js";
28
29
  export { random } from "./modules/math/random/random.js";
29
30
  export { fp32 } from "./modules/math/fp32/fp32.js";
30
- export type { PickingProps } from "./modules/engine/picking/picking.js";
31
+ export type { PickingProps, PickingUniforms } from "./modules/engine/picking/picking.js";
31
32
  export { picking } from "./modules/engine/picking/picking.js";
32
- export type { LightingProps } from "./modules/lighting/lights/lighting.js";
33
+ export type { LightingProps, LightingUniforms } from "./modules/lighting/lights/lighting.js";
33
34
  export { lighting } from "./modules/lighting/lights/lighting.js";
34
35
  export { dirlight } from "./modules/lighting/no-material/dirlight.js";
35
36
  export type { PhongMaterialUniforms as GouraudMaterialUniforms } from "./modules/lighting/phong-material/phong-material.js";
@@ -37,44 +38,44 @@ export { gouraudMaterial } from "./modules/lighting/gouraud-material/gouraud-mat
37
38
  export type { PhongMaterialUniforms } from "./modules/lighting/phong-material/phong-material.js";
38
39
  export { phongMaterial } from "./modules/lighting/phong-material/phong-material.js";
39
40
  export { pbrMaterial } from "./modules/lighting/pbr-material/pbr-material.js";
40
- export type { BrightnessContrastProps } from "./modules/postprocessing/image-adjust-filters/brightnesscontrast.js";
41
+ export type { BrightnessContrastProps, BrightnessContrastUniforms } from "./modules/postprocessing/image-adjust-filters/brightnesscontrast.js";
41
42
  export { brightnessContrast } from "./modules/postprocessing/image-adjust-filters/brightnesscontrast.js";
42
- export type { DenoiseProps } from "./modules/postprocessing/image-adjust-filters/denoise.js";
43
+ export type { DenoiseProps, DenoiseUniforms } from "./modules/postprocessing/image-adjust-filters/denoise.js";
43
44
  export { denoise } from "./modules/postprocessing/image-adjust-filters/denoise.js";
44
- export type { HueSaturationProps } from "./modules/postprocessing/image-adjust-filters/huesaturation.js";
45
+ export type { HueSaturationProps, HueSaturationUniforms } from "./modules/postprocessing/image-adjust-filters/huesaturation.js";
45
46
  export { hueSaturation } from "./modules/postprocessing/image-adjust-filters/huesaturation.js";
46
- export type { NoiseProps } from "./modules/postprocessing/image-adjust-filters/noise.js";
47
+ export type { NoiseProps, NoiseUniforms } from "./modules/postprocessing/image-adjust-filters/noise.js";
47
48
  export { noise } from "./modules/postprocessing/image-adjust-filters/noise.js";
48
- export type { SepiaProps } from "./modules/postprocessing/image-adjust-filters/sepia.js";
49
+ export type { SepiaProps, SepiaUniforms } from "./modules/postprocessing/image-adjust-filters/sepia.js";
49
50
  export { sepia } from "./modules/postprocessing/image-adjust-filters/sepia.js";
50
- export type { VibranceProps } from "./modules/postprocessing/image-adjust-filters/vibrance.js";
51
+ export type { VibranceProps, VibranceUniforms } from "./modules/postprocessing/image-adjust-filters/vibrance.js";
51
52
  export { vibrance } from "./modules/postprocessing/image-adjust-filters/vibrance.js";
52
- export type { VignetteProps } from "./modules/postprocessing/image-adjust-filters/vignette.js";
53
+ export type { VignetteProps, VignetteUniforms } from "./modules/postprocessing/image-adjust-filters/vignette.js";
53
54
  export { vignette } from "./modules/postprocessing/image-adjust-filters/vignette.js";
54
- export type { TiltShiftProps } from "./modules/postprocessing/image-blur-filters/tiltshift.js";
55
+ export type { TiltShiftProps, TiltShiftUniforms } from "./modules/postprocessing/image-blur-filters/tiltshift.js";
55
56
  export { tiltShift } from "./modules/postprocessing/image-blur-filters/tiltshift.js";
56
- export type { TriangleBlurProps } from "./modules/postprocessing/image-blur-filters/triangleblur.js";
57
+ export type { TriangleBlurProps, TriangleBlurUniforms } from "./modules/postprocessing/image-blur-filters/triangleblur.js";
57
58
  export { triangleBlur } from "./modules/postprocessing/image-blur-filters/triangleblur.js";
58
- export type { ZoomBlurProps } from "./modules/postprocessing/image-blur-filters/zoomblur.js";
59
+ export type { ZoomBlurProps, ZoomBlurUniforms } from "./modules/postprocessing/image-blur-filters/zoomblur.js";
59
60
  export { zoomBlur } from "./modules/postprocessing/image-blur-filters/zoomblur.js";
60
- export type { ColorHalftoneProps } from "./modules/postprocessing/image-fun-filters/colorhalftone.js";
61
+ export type { ColorHalftoneProps, ColorHalftoneUniforms } from "./modules/postprocessing/image-fun-filters/colorhalftone.js";
61
62
  export { colorHalftone } from "./modules/postprocessing/image-fun-filters/colorhalftone.js";
62
- export type { DotScreenProps } from "./modules/postprocessing/image-fun-filters/dotscreen.js";
63
+ export type { DotScreenProps, DotScreenUniforms } from "./modules/postprocessing/image-fun-filters/dotscreen.js";
63
64
  export { dotScreen } from "./modules/postprocessing/image-fun-filters/dotscreen.js";
64
- export type { EdgeWorkProps } from "./modules/postprocessing/image-fun-filters/edgework.js";
65
+ export type { EdgeWorkProps, EdgeWorkUniforms } from "./modules/postprocessing/image-fun-filters/edgework.js";
65
66
  export { edgeWork } from "./modules/postprocessing/image-fun-filters/edgework.js";
66
- export type { HexagonalPixelateProps } from "./modules/postprocessing/image-fun-filters/hexagonalpixelate.js";
67
+ export type { HexagonalPixelateProps, HexagonalPixelateUniforms } from "./modules/postprocessing/image-fun-filters/hexagonalpixelate.js";
67
68
  export { hexagonalPixelate } from "./modules/postprocessing/image-fun-filters/hexagonalpixelate.js";
68
- export type { InkProps } from "./modules/postprocessing/image-fun-filters/ink.js";
69
+ export type { InkProps, InkUniforms } from "./modules/postprocessing/image-fun-filters/ink.js";
69
70
  export { ink } from "./modules/postprocessing/image-fun-filters/ink.js";
70
- export type { MagnifyProps } from "./modules/postprocessing/image-fun-filters/magnify.js";
71
+ export type { MagnifyProps, MagnifyUniforms } from "./modules/postprocessing/image-fun-filters/magnify.js";
71
72
  export { magnify } from "./modules/postprocessing/image-fun-filters/magnify.js";
72
- export type { BulgePinchProps } from "./modules/postprocessing/image-warp-filters/bulgepinch.js";
73
+ export type { BulgePinchProps, BulgePinchUniforms } from "./modules/postprocessing/image-warp-filters/bulgepinch.js";
73
74
  export { bulgePinch } from "./modules/postprocessing/image-warp-filters/bulgepinch.js";
74
- export type { SwirlProps } from "./modules/postprocessing/image-warp-filters/swirl.js";
75
+ export type { SwirlProps, SwirlUniforms } from "./modules/postprocessing/image-warp-filters/swirl.js";
75
76
  export { swirl } from "./modules/postprocessing/image-warp-filters/swirl.js";
76
77
  export { fxaa } from "./modules/postprocessing/fxaa/fxaa.js";
77
- export type { WarpProps } from "./modules/postprocessing/image-warp-filters/warp.js";
78
+ export type { WarpProps, WarpUniforms } from "./modules/postprocessing/image-warp-filters/warp.js";
78
79
  export { warp as _warp } from "./modules/postprocessing/image-warp-filters/warp.js";
79
80
  export { fp64, fp64arithmetic } from "./modules-webgl1/math/fp64/fp64.js";
80
81
  export { geometry as geometry1 } from "./modules-webgl1/geometry/geometry.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAMA;;;GAGG;AACH,OAAO,EAAC,IAAI,EAAC,sCAAmC;AAEhD,YAAY,EAAC,YAAY,EAAC,+CAA4C;AAEtE,YAAY,EAAC,YAAY,EAAC,6CAA0C;AACpE,YAAY,EAAC,UAAU,EAAC,2CAAwC;AAChE,YAAY,EAAC,UAAU,EAAC,8CAA2C;AACnE,YAAY,EAAC,eAAe,EAAC,mDAAgD;AAC7E,OAAO,EAAC,oBAAoB,EAAC,sDAAmD;AAGhF,OAAO,EAAC,eAAe,EAAC,kCAA+B;AAEvD,OAAO,EAAC,qBAAqB,EAAC,uDAAoD;AAKlF,OAAO,EAAC,aAAa,EAAC,4CAAyC;AAC/D,OAAO,EACL,mBAAmB,EACnB,gBAAgB,EAChB,mBAAmB,EACnB,kBAAkB,EAClB,aAAa,EACd,yCAAsC;AAGvC,YAAY,EAAC,uBAAuB,EAAC,kDAA+C;AACpF,OAAO,EAAC,uBAAuB,EAAC,kDAA+C;AAC/E,OAAO,EAAC,UAAU,EAAC,mDAAgD;AAGnE,OAAO,EAAC,UAAU,EAAC,2CAAwC;AAC3D,OAAO,EAAC,sBAAsB,EAAC,kDAA+C;AAC9E,OAAO,EAAC,oBAAoB,IAAI,qBAAqB,EAAC,sDAAmD;AACzG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IAAI,IAAI,KAAK,EAAC,4DAAyD;AAK/E,OAAO,EAAC,IAAI,EAAE,cAAc,EAAC,2CAAwC;AAGrE,OAAO,EAAC,QAAQ,IAAI,SAAS,EAAC,8CAA2C;AACzE,OAAO,EAAC,OAAO,IAAI,QAAQ,EAAC,4CAAyC;AAErE,OAAO,EAAC,MAAM,IAAI,OAAO,EAAC,mDAAgD;AAC1E,OAAO,EAAC,QAAQ,IAAI,SAAS,EAAC,uDAAoD;AAClF,OAAO,EACL,eAAe,EACf,aAAa,EACd,mEAAgE;AACjE,OAAO,EAAC,GAAG,EAAC,6CAA0C"}
package/dist/index.js CHANGED
@@ -1,16 +1,15 @@
1
1
  // luma.gl
2
2
  // SPDX-License-Identifier: MIT
3
3
  // Copyright (c) vis.gl contributors
4
- // shadertools exports
5
- /**
6
- * Marks GLSL shaders for syntax highlighting: glsl`...`
7
- * Install https://marketplace.visualstudio.com/items?itemName=boyswan.glsl-literal
8
- */
9
- export { glsl } from "./lib/glsl-utils/highlight.js";
10
- export { ShaderModuleInstance } from "./lib/shader-module/shader-module-instance.js";
4
+ export { initializeShaderModule, initializeShaderModules } from "./lib/shader-module/shader-module.js";
5
+ export { getShaderModuleUniforms } from "./lib/shader-module/shader-module.js";
6
+ export { getShaderModuleDependencies } from "./lib/shader-module/shader-module-dependencies.js";
7
+ export { checkShaderModuleDeprecations } from "./lib/shader-module/shader-module.js";
8
+ export { getShaderModuleSource } from "./lib/shader-assembly/assemble-shaders.js";
9
+ export { resolveModules as _resolveModules } from "./lib/shader-module/shader-module-dependencies.js";
10
+ export { getDependencyGraph as _getDependencyGraph } from "./lib/shader-module/shader-module-dependencies.js";
11
11
  // ShaderAssembler
12
12
  export { ShaderAssembler } from "./lib/shader-assembler.js";
13
- export { normalizeShaderModule } from "./lib/shader-module/normalize-shader-module.js";
14
13
  // SHADER HELPERS
15
14
  // Shader source introspection
16
15
  export { getShaderInfo } from "./lib/glsl-utils/get-shader-info.js";
@@ -20,10 +19,7 @@ export { capitalize } from "./lib/shader-generator/utils/capitalize.js";
20
19
  // TEST EXPORTS - Do not use in production applications
21
20
  export { preprocess } from "./lib/preprocessor/preprocessor.js";
22
21
  export { assembleGLSLShaderPair } from "./lib/shader-assembly/assemble-shaders.js";
23
- export { ShaderModuleInstance as _ShaderModuleInstance } from "./lib/shader-module/shader-module-instance.js";
24
22
  export { combineInjects } from "./lib/shader-assembly/shader-injections.js";
25
- export { resolveModules as _resolveModules } from "./lib/shader-assembly/resolve-modules.js";
26
- export { getDependencyGraph as _getDependencyGraph } from "./lib/shader-assembly/resolve-modules.js";
27
23
  // EXPERIMENTAL WGSL
28
24
  export { getShaderLayoutFromWGSL } from "./lib/wgsl/get-shader-layout-wgsl.js";
29
25
  // data utils
@@ -58,7 +54,7 @@ export { magnify } from "./modules/postprocessing/image-fun-filters/magnify.js";
58
54
  export { bulgePinch } from "./modules/postprocessing/image-warp-filters/bulgepinch.js";
59
55
  export { swirl } from "./modules/postprocessing/image-warp-filters/swirl.js";
60
56
  // Postprocessing modules
61
- // export type {FXAAProps} from './modules/postprocessing/fxaa/fxaa';
57
+ // export type {FXAAProps, FXAAUniforms} from './modules/postprocessing/fxaa/fxaa';
62
58
  export { fxaa } from "./modules/postprocessing/fxaa/fxaa.js";
63
59
  export { warp as _warp } from "./modules/postprocessing/image-warp-filters/warp.js";
64
60
  // DEPRECATED - v8 legacy shader modules (non-uniform buffer)
@@ -1 +1 @@
1
- {"version":3,"file":"shader-utils.d.ts","sourceRoot":"","sources":["../../../src/lib/glsl-utils/shader-utils.ts"],"names":[],"mappings":"AAaA,KAAK,aAAa,GAAG;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAGF,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,MAAM,EACZ,UAAU,EAAE,MAAM,GAAG,MAAM,EAAE,GAC5B,aAAa,GAAG,IAAI,CAUtB;AAED;;;GAGG;A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AI,GAAG,KAAK,GAAG,MAAM,CAU7E;AAED,yCAAyC;AACzC,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAU9D;AAaD,sDAAsD;AACtD,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,MAAM,CAU/E"}
@@ -1,11 +1,10 @@
1
1
  // luma.gl
2
2
  // SPDX-License-Identifier: MIT
3
3
  // Copyright (c) vis.gl contributors
4
- import { glsl } from "./highlight.js";
5
- const FS_GLES = `\
4
+ const FS_GLES = /* glsl */ `\
6
5
  out vec4 transform_output;
7
6
  void main() {
8
- transform_output = vec4(0);
7
+ transform_output = vec4(0);
9
8
  }`;
10
9
  const FS300 = `#version 300 es\n${FS_GLES}`;
11
10
  // Prase given glsl line and return qualifier details or null
@@ -1,5 +1,4 @@
1
1
  import type { ShaderModule } from "./shader-module/shader-module.js";
2
- import { ShaderModuleInstance } from "./shader-module/shader-module-instance.js";
3
2
  import { AssembleShaderProps, GetUniformsFunc } from "./shader-assembly/assemble-shaders.js";
4
3
  /**
5
4
  * A stateful version of `assembleShaders` that can be used to assemble shaders.
@@ -40,7 +39,7 @@ export declare class ShaderAssembler {
40
39
  assembleWGSLShader(props: AssembleShaderProps): {
41
40
  source: string;
42
41
  getUniforms: GetUniformsFunc;
43
- modules: ShaderModuleInstance[];
42
+ modules: ShaderModule[];
44
43
  };
45
44
  /**
46
45
  * Assemble a pair of shaders into a single shader program
@@ -52,11 +51,11 @@ export declare class ShaderAssembler {
52
51
  vs: string;
53
52
  fs: string;
54
53
  getUniforms: GetUniformsFunc;
55
- modules: ShaderModuleInstance[];
54
+ modules: ShaderModule[];
56
55
  };
57
56
  /**
58
57
  * Dedupe and combine with default modules
59
58
  */
60
- _getModuleList(appModules?: (ShaderModule | ShaderModuleInstance)[]): ShaderModuleInstance[];
59
+ _getModuleList(appModules?: ShaderModule[]): ShaderModule[];
61
60
  }
62
61
  //# sourceMappingURL=shader-assembler.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"shader-assembler.d.ts","sourceRoot":"","sources":["../../src/lib/shader-assembler.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,YAAY,EAAC,yCAAsC;AAChE,OAAO,EAAC,oBAAoB,EAAC,kDAA+C;AAC5E,OAAO,EACL,mBAAmB,EACnB,eAAe,EAGhB,8CAA2C;AAG5C;;;GAGG;AACH,qBAAa,eAAe;IAC1B,uCAAuC;IACvC,MAAM,CAAC,sBAAsB,EAAE,eAAe,CAAC;IAC/C,qBAAqB;IACrB,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAa;IAC5C,qBAAqB;IACrB,OAAO,CAAC,eAAe,CAAsB;IAE7C;;;OAGG;IACH,MAAM,CAAC,yBAAyB,IAAI,eAAe;IAMnD;;OAEG;IACH,gBAAgB,CAAC,MAAM,EAAE,YAAY,GAAG,IAAI;IAU5C;;OAEG;IACH,mBAAmB,CAAC,MAAM,EAAE,YAAY,GAAG,IAAI;IAK/C;;;;OAIG;IACH,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,GAAG,GAAG,IAAI;IAO7C;;;;;OAKG;IACH,kBAAkB,CAAC,KAAK,EAAE,mBAAmB,GAAG;QAC9C,MAAM,EAAE,MAAM,CAAC;QACf,WAAW,EAAE,eAAe,CAAC;QAC7B,OAAO,EAAE,oBAAoB,EAAE,CAAC;KACjC;IAgBD;;;;;OAKG;IACH,sBAAsB,CAAC,KAAK,EAAE,mBAAmB,GAAG;QAClD,EAAE,EAAE,MAAM,CAAC;QACX,EAAE,EAAE,MAAM,CAAC;QACX,WAAW,EAAE,eAAe,CAAC;QAC7B,OAAO,EAAE,oBAAoB,EAAE,CAAC;KACjC;IAgBD;;OAEG;IACH,cAAc,CAAC,UAAU,GAAE,CAAC,YAAY,GAAG,oBAAoB,CAAC,EAAO,GAAG,oBAAoB,EAAE;CA2BjG"}
1
+ {"version":3,"file":"shader-assembler.d.ts","sourceRoot":"","sources":["../../src/lib/shader-assembler.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,YAAY,EAAC,yCAAsC;AAEhE,OAAO,EACL,mBAAmB,EACnB,eAAe,EAGhB,8CAA2C;AAG5C;;;GAGG;AACH,qBAAa,eAAe;IAC1B,uCAAuC;IACvC,MAAM,CAAC,sBAAsB,EAAE,eAAe,CAAC;IAC/C,qBAAqB;IACrB,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAa;IAC5C,qBAAqB;IACrB,OAAO,CAAC,eAAe,CAAsB;IAE7C;;;OAGG;IACH,MAAM,CAAC,yBAAyB,IAAI,eAAe;IAMnD;;OAEG;IACH,gBAAgB,CAAC,MAAM,EAAE,YAAY,GAAG,IAAI;IAU5C;;OAEG;IACH,mBAAmB,CAAC,MAAM,EAAE,YAAY,GAAG,IAAI;IAK/C;;;;OAIG;IACH,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,GAAG,GAAG,IAAI;IAO7C;;;;;OAKG;IACH,kBAAkB,CAAC,KAAK,EAAE,mBAAmB,GAAG;QAC9C,MAAM,EAAE,MAAM,CAAC;QACf,WAAW,EAAE,eAAe,CAAC;QAC7B,OAAO,EAAE,YAAY,EAAE,CAAC;KACzB;IAgBD;;;;;OAKG;IACH,sBAAsB,CAAC,KAAK,EAAE,mBAAmB,GAAG;QAClD,EAAE,EAAE,MAAM,CAAC;QACX,EAAE,EAAE,MAAM,CAAC;QACX,WAAW,EAAE,eAAe,CAAC;QAC7B,OAAO,EAAE,YAAY,EAAE,CAAC;KACzB;IAgBD;;OAEG;IACH,cAAc,CAAC,UAAU,GAAE,YAAY,EAAO,GAAG,YAAY,EAAE;CA0BhE"}
@@ -1,7 +1,7 @@
1
1
  // luma.gl
2
2
  // SPDX-License-Identifier: MIT
3
3
  // Copyright (c) vis.gl contributors
4
- import { ShaderModuleInstance } from "./shader-module/shader-module-instance.js";
4
+ import { initializeShaderModules } from "./shader-module/shader-module.js";
5
5
  import { assembleWGSLShader, assembleGLSLShaderPair } from "./shader-assembly/assemble-shaders.js";
6
6
  import { preprocess } from "./preprocessor/preprocessor.js";
7
7
  /**
@@ -112,6 +112,7 @@ export class ShaderAssembler {
112
112
  }
113
113
  }
114
114
  modules.length = count;
115
- return ShaderModuleInstance.instantiateModules(modules);
115
+ initializeShaderModules(modules);
116
+ return modules;
116
117
  }
117
118
  }
@@ -1,5 +1,4 @@
1
1
  import { PlatformInfo } from "./platform-info.js";
2
- import { ShaderModuleInstance } from "../shader-module/shader-module-instance.js";
3
2
  import type { ShaderInjection } from "./shader-injections.js";
4
3
  import type { ShaderModule } from "../shader-module/shader-module.js";
5
4
  import { ShaderHook } from "./shader-hooks.js";
@@ -23,7 +22,7 @@ export type AssembleShaderOptions = {
23
22
  /** Inject shader id #defines */
24
23
  id?: string;
25
24
  /** Modules to be injected */
26
- modules?: (ShaderModule | ShaderModuleInstance)[];
25
+ modules?: ShaderModule[];
27
26
  /** Defines to be injected */
28
27
  defines?: Record<string, ShaderDefine>;
29
28
  /** Hook functions */
@@ -103,6 +102,8 @@ export declare function assembleShaderWGSL(platformInfo: PlatformInfo, options:
103
102
  * @param modules
104
103
  * @returns
105
104
  */
106
- export declare function assembleGetUniforms(modules: ShaderModuleInstance[]): (opts: Record<string, any>) => Record<string, any>;
105
+ export declare function assembleGetUniforms(modules: ShaderModule[]): (opts: Record<string, any>) => Record<string, any>;
106
+ /** Extracts the source code chunk for the specified shader type from the named shader module */
107
+ export declare function getShaderModuleSource(module: ShaderModule, stage: 'vertex' | 'fragment' | 'wgsl'): string;
107
108
  export {};
108
109
  //# sourceMappingURL=assemble-shaders.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"assemble-shaders.d.ts","sourceRoot":"","sources":["../../../src/lib/shader-assembly/assemble-shaders.ts"],"names":[],"mappings":"AAMA,OAAO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AAG;IAC/B,yBAAyB;IACzB,MAAM,EAAE,MAAM,CAAC;CAChB,GACA;IACD,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,eAAe,CAAC;CAC9B,CAYA;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CACpC,OAAO,EAAE,qBAAqB,GAAG;IAC/B,oBAAoB;IACpB,EAAE,EAAE,MAAM,CAAC;IACX,sBAAsB;IACtB,EAAE,CAAC,EAAE,MAAM,CAAC;CACb,GACA;IACD,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,WAAW,EAAE,eAAe,CAAC;CAC9B,CAoBA;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,YAAY,EAAE,YAAY,EAAE,OAAO,EAAE,oBAAoB,UA6G3F;AA8JD;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,YAAY,EAAE,UACvB,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,KAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAU5E;AAgCD,gGAAgG;AAChG,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,YAAY,EACpB,KAAK,EAAE,QAAQ,GAAG,UAAU,GAAG,MAAM,GACpC,MAAM,CA6BR"}
@@ -1,11 +1,11 @@
1
1
  // luma.gl
2
2
  // SPDX-License-Identifier: MIT
3
3
  // Copyright (c) vis.gl contributors
4
- import { glsl } from "../glsl-utils/highlight.js";
5
- import { resolveModules } from "./resolve-modules.js";
4
+ import { getShaderModuleDependencies } from "../shader-module/shader-module-dependencies.js";
6
5
  import { getPlatformShaderDefines } from "./platform-defines.js";
7
6
  import { injectShader, DECLARATION_INJECT_MARKER } from "./shader-injections.js";
8
7
  import { transpileGLSLShader } from "../shader-transpiler/transpile-glsl-shader.js";
8
+ import { checkShaderModuleDeprecations } from "../shader-module/shader-module.js";
9
9
  import { normalizeShaderHooks, getShaderHooks } from "./shader-hooks.js";
10
10
  import { assert } from "../utils/assert.js";
11
11
  import { getShaderInfo } from "../glsl-utils/get-shader-info.js";
@@ -14,14 +14,14 @@ const INJECT_SHADER_DECLARATIONS = `\n\n${DECLARATION_INJECT_MARKER}\n`;
14
14
  * Precision prologue to inject before functions are injected in shader
15
15
  * TODO - extract any existing prologue in the fragment source and move it up...
16
16
  */
17
- const FRAGMENT_SHADER_PROLOGUE = `\
17
+ const FRAGMENT_SHADER_PROLOGUE = /* glsl */ `\
18
18
  precision highp float;
19
19
  `;
20
20
  /**
21
21
  * Inject a list of shader modules into a single shader source for WGSL
22
22
  */
23
23
  export function assembleWGSLShader(options) {
24
- const modules = resolveModules(options.modules || []);
24
+ const modules = getShaderModuleDependencies(options.modules || []);
25
25
  return {
26
26
  source: assembleShaderWGSL(options.platformInfo, {
27
27
  ...options,
@@ -37,7 +37,7 @@ export function assembleWGSLShader(options) {
37
37
  */
38
38
  export function assembleGLSLShaderPair(options) {
39
39
  const { vs, fs } = options;
40
- const modules = resolveModules(options.modules || []);
40
+ const modules = getShaderModuleDependencies(options.modules || []);
41
41
  return {
42
42
  vs: assembleShaderGLSL(options.platformInfo, {
43
43
  ...options,
@@ -120,15 +120,15 @@ export function assembleShaderWGSL(platformInfo, options) {
120
120
  }
121
121
  }
122
122
  // TODO - hack until shadertool modules support WebGPU
123
- const modulesToInject = platformInfo.type !== 'webgpu' ? modules : [];
123
+ const modulesToInject = modules;
124
124
  for (const module of modulesToInject) {
125
125
  if (log) {
126
- module.checkDeprecations(coreSource, log);
126
+ checkShaderModuleDeprecations(module, coreSource, log);
127
127
  }
128
- const moduleSource = module.getModuleSource(stage, 'wgsl');
128
+ const moduleSource = getShaderModuleSource(module, 'wgsl');
129
129
  // Add the module source, and a #define that declares it presence
130
130
  assembledSource += moduleSource;
131
- const injections = module.injections[stage];
131
+ const injections = module.injections?.[stage] || {};
132
132
  for (const key in injections) {
133
133
  const match = /^(v|f)s:#([\w-]+)$/.exec(key);
134
134
  if (match) {
@@ -172,7 +172,7 @@ function assembleShaderGLSL(platformInfo, options) {
172
172
  // Combine Module and Application Defines
173
173
  const allDefines = {};
174
174
  modules.forEach(module => {
175
- Object.assign(allDefines, module.getDefines());
175
+ Object.assign(allDefines, module.defines);
176
176
  });
177
177
  Object.assign(allDefines, defines);
178
178
  // Add platform defines (use these to work around platform-specific bugs and limitations)
@@ -190,6 +190,7 @@ ${sourceVersionDirective}
190
190
  // ----- PROLOGUE -------------------------
191
191
  ${getShaderNameDefine({ id, source, stage })}
192
192
  ${`#define SHADER_TYPE_${stage.toUpperCase()}`}
193
+
193
194
  ${getPlatformShaderDefines(platformInfo)}
194
195
  ${stage === 'fragment' ? FRAGMENT_SHADER_PROLOGUE : ''}
195
196
 
@@ -208,7 +209,6 @@ ${getApplicationDefines(allDefines)}
208
209
  const declInjections = {};
209
210
  const mainInjections = {};
210
211
  for (const key in inject) {
211
- // @ts-expect-error
212
212
  const injection = typeof inject[key] === 'string' ? { injection: inject[key], order: 0 } : inject[key];
213
213
  const match = /^(v|f)s:(#)?([\w-]+)$/.exec(key);
214
214
  if (match) {
@@ -233,12 +233,12 @@ ${getApplicationDefines(allDefines)}
233
233
  }
234
234
  for (const module of modules) {
235
235
  if (log) {
236
- module.checkDeprecations(coreSource, log);
236
+ checkShaderModuleDeprecations(module, coreSource, log);
237
237
  }
238
- const moduleSource = module.getModuleSource(stage);
238
+ const moduleSource = getShaderModuleSource(module, stage);
239
239
  // Add the module source, and a #define that declares it presence
240
240
  assembledSource += moduleSource;
241
- const injections = module.injections[stage];
241
+ const injections = module.instance?.normalizedInjections[stage] || {};
242
242
  for (const key in injections) {
243
243
  const match = /^(v|f)s:#([\w-]+)$/.exec(key);
244
244
  if (match) {
@@ -281,7 +281,7 @@ export function assembleGetUniforms(modules) {
281
281
  for (const module of modules) {
282
282
  // `modules` is already sorted by dependency level. This guarantees that
283
283
  // modules have access to the uniforms that are generated by their dependencies.
284
- const moduleUniforms = module.getUniforms(opts, uniforms);
284
+ const moduleUniforms = module.getUniforms?.(opts, uniforms);
285
285
  Object.assign(uniforms, moduleUniforms);
286
286
  }
287
287
  return uniforms;
@@ -297,9 +297,7 @@ function getShaderNameDefine(options) {
297
297
  const injectShaderName = id && source.indexOf('SHADER_NAME') === -1;
298
298
  return injectShaderName
299
299
  ? `
300
- #define SHADER_NAME ${id}_${stage}
301
-
302
- `
300
+ #define SHADER_NAME ${id}_${stage}`
303
301
  : '';
304
302
  }
305
303
  /** Generates application defines from an object of key value pairs */
@@ -313,6 +311,36 @@ function getApplicationDefines(defines = {}) {
313
311
  }
314
312
  return sourceText;
315
313
  }
314
+ /** Extracts the source code chunk for the specified shader type from the named shader module */
315
+ export function getShaderModuleSource(module, stage) {
316
+ let moduleSource;
317
+ switch (stage) {
318
+ case 'vertex':
319
+ moduleSource = module.vs || '';
320
+ break;
321
+ case 'fragment':
322
+ moduleSource = module.fs || '';
323
+ break;
324
+ case 'wgsl':
325
+ moduleSource = module.source || '';
326
+ break;
327
+ default:
328
+ assert(false);
329
+ }
330
+ if (!module.name) {
331
+ throw new Error('Shader module must have a name');
332
+ }
333
+ const moduleName = module.name.toUpperCase().replace(/[^0-9a-z]/gi, '_');
334
+ let source = `\
335
+ // ----- MODULE ${module.name} ---------------
336
+
337
+ `;
338
+ if (stage !== 'wgsl') {
339
+ source += `#define MODULE_${moduleName}\n`;
340
+ }
341
+ source += `${moduleSource}\n`;
342
+ return source;
343
+ }
316
344
  /*
317
345
  function getHookFunctions(
318
346
  hookFunctions: Record<string, HookFunction>,
@@ -1 +1 @@
1
- {"version":3,"file":"platform-defines.d.ts","sourceRoot":"","sources":["../../../src/lib/shader-assembly/platform-defines.ts"],"names":[],"mappings":"AAKA,OAAO,EAAC,YAAY,EAAC,2BAAwB;AAE7C,gEAAgE;AAChE,wBAAgB,wBAAwB,CAAC,YAAY,EAAE,YAAY,GAAG,MAAM,CAkD3E"}
1
+ {"version":3,"file":"platform-defines.d.ts","sourceRoot":"","sources":["../../../src/lib/shader-assembly/platform-defines.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,YAAY,EAAC,2BAAwB;AAE7C,gEAAgE;AAChE,wBAAgB,wBAAwB,CAAC,YAAY,EAAE,YAAY,GAAG,MAAM,CAkD3E"}
@@ -1,42 +1,50 @@
1
1
  // luma.gl
2
2
  // SPDX-License-Identifier: MIT
3
3
  // Copyright (c) vis.gl contributors
4
- import { glsl } from "../glsl-utils/highlight.js";
5
4
  /** Adds defines to help identify GPU architecture / platform */
6
5
  export function getPlatformShaderDefines(platformInfo) {
7
6
  switch (platformInfo?.gpu.toLowerCase()) {
8
7
  case 'apple':
9
- return `\
8
+ return /* glsl */ `\
10
9
  #define APPLE_GPU
10
+ // Apple optimizes away the calculation necessary for emulated fp64
11
11
  #define LUMA_FP64_CODE_ELIMINATION_WORKAROUND 1
12
12
  #define LUMA_FP32_TAN_PRECISION_WORKAROUND 1
13
+ // Intel GPU doesn't have full 32 bits precision in same cases, causes overflow
13
14
  #define LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND 1
14
15
  `;
15
16
  case 'nvidia':
16
- return `\
17
+ return /* glsl */ `\
17
18
  #define NVIDIA_GPU
19
+ // Nvidia optimizes away the calculation necessary for emulated fp64
18
20
  #define LUMA_FP64_CODE_ELIMINATION_WORKAROUND 1
19
21
  `;
20
22
  case 'intel':
21
- return `\
23
+ return /* glsl */ `\
22
24
  #define INTEL_GPU
25
+ // Intel optimizes away the calculation necessary for emulated fp64
23
26
  #define LUMA_FP64_CODE_ELIMINATION_WORKAROUND 1
27
+ // Intel's built-in 'tan' function doesn't have acceptable precision
24
28
  #define LUMA_FP32_TAN_PRECISION_WORKAROUND 1
29
+ // Intel GPU doesn't have full 32 bits precision in same cases, causes overflow
25
30
  #define LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND 1
26
31
  `;
27
32
  case 'amd':
28
33
  // AMD Does not eliminate fp64 code
29
- return `\
34
+ return /* glsl */ `\
30
35
  #define AMD_GPU
31
36
  `;
32
37
  default:
33
38
  // We don't know what GPU it is, could be that the GPU driver or
34
39
  // browser is not implementing UNMASKED_RENDERER constant and not
35
40
  // reporting a correct name
36
- return `\
41
+ return /* glsl */ `\
37
42
  #define DEFAULT_GPU
43
+ // Prevent driver from optimizing away the calculation necessary for emulated fp64
38
44
  #define LUMA_FP64_CODE_ELIMINATION_WORKAROUND 1
45
+ // Headless Chrome's software shader 'tan' function doesn't have acceptable precision
39
46
  #define LUMA_FP32_TAN_PRECISION_WORKAROUND 1
47
+ // If the GPU doesn't have full 32 bits precision, will causes overflow
40
48
  #define LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND 1
41
49
  `;
42
50
  }
@@ -0,0 +1,53 @@
1
+ import { ShaderModule } from "./shader-module.js";
2
+ type AbstractModule = {
3
+ name: string;
4
+ dependencies?: AbstractModule[];
5
+ };
6
+ /**
7
+ * Takes a list of shader module names and returns a new list of
8
+ * shader module names that includes all dependencies, sorted so
9
+ * that modules that are dependencies of other modules come first.
10
+ *
11
+ * If the shader glsl code from the returned modules is concatenated
12
+ * in the reverse order, it is guaranteed that all functions be resolved and
13
+ * that all function and variable definitions come before use.
14
+ *
15
+ * @param modules - Array of modules (inline modules or module names)
16
+ * @return - Array of modules
17
+ */
18
+ export declare function getShaderModuleDependencies<T extends AbstractModule>(modules: T[]): T[];
19
+ /**
20
+ * Recursively checks module dependencies to calculate dependency level of each module.
21
+ *
22
+ * @param options.modules - Array of modules
23
+ * @param options.level - Current level
24
+ * @param options.moduleMap -
25
+ * @param options.moduleDepth - Current level
26
+ * @return - Map of module name to its level
27
+ */
28
+ export declare function getDependencyGraph<T extends AbstractModule>(options: {
29
+ modules: T[];
30
+ level: number;
31
+ moduleMap: Record<string, T>;
32
+ moduleDepth: Record<string, number>;
33
+ }): void;
34
+ /**
35
+ * Takes a list of shader module names and returns a new list of
36
+ * shader module names that includes all dependencies, sorted so
37
+ * that modules that are dependencies of other modules come first.
38
+ *
39
+ * If the shader glsl code from the returned modules is concatenated
40
+ * in the reverse order, it is guaranteed that all functions be resolved and
41
+ * that all function and variable definitions come before use.
42
+ *
43
+ * @param modules - Array of modules (inline modules or module names)
44
+ * @return - Array of modules
45
+ */
46
+ export declare function getShaderDependencies(modules: ShaderModule[]): ShaderModule[];
47
+ /**
48
+ * Instantiate shader modules and resolve any dependencies
49
+ * @deprecated Use getShaderDpendencies
50
+ */
51
+ export declare function resolveModules(modules: ShaderModule[]): ShaderModule[];
52
+ export {};
53
+ //# sourceMappingURL=shader-module-dependencies.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shader-module-dependencies.d.ts","sourceRoot":"","sources":["../../../src/lib/shader-module/shader-module-dependencies.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,YAAY,EAA0B,2BAAwB;AAItE,KAAK,cAAc,GAAG;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,CAAC,EAAE,cAAc,EAAE,CAAC;CACjC,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,wBAAgB,2BAA2B,CAAC,CAAC,SAAS,cAAc,EAAE,OAAO,EAAE,CAAC,EAAE,GAAG,CAAC,EAAE,CAYvF;AAED;;;;;;;;GAQG;AAEH,wBAAgB,kBAAkB,CAAC,CAAC,SAAS,cAAc,EAAE,OAAO,EAAE;IACpE,OAAO,EAAE,CAAC,EAAE,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;IAC7B,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACrC,QAoBA;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,YAAY,EAAE,GAAG,YAAY,EAAE,CAY7E;AAID;;;GAGG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,GAAG,YAAY,EAAE,CAEtE"}