@luma.gl/core 9.2.6 → 9.3.0-alpha.11

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 (282) hide show
  1. package/dist/adapter/canvas-context.d.ts +6 -162
  2. package/dist/adapter/canvas-context.d.ts.map +1 -1
  3. package/dist/adapter/canvas-context.js +5 -419
  4. package/dist/adapter/canvas-context.js.map +1 -1
  5. package/dist/adapter/canvas-observer.d.ts +32 -0
  6. package/dist/adapter/canvas-observer.d.ts.map +1 -0
  7. package/dist/adapter/canvas-observer.js +90 -0
  8. package/dist/adapter/canvas-observer.js.map +1 -0
  9. package/dist/adapter/canvas-surface.d.ts +150 -0
  10. package/dist/adapter/canvas-surface.d.ts.map +1 -0
  11. package/dist/adapter/canvas-surface.js +392 -0
  12. package/dist/adapter/canvas-surface.js.map +1 -0
  13. package/dist/adapter/device.d.ts +81 -16
  14. package/dist/adapter/device.d.ts.map +1 -1
  15. package/dist/adapter/device.js +193 -11
  16. package/dist/adapter/device.js.map +1 -1
  17. package/dist/adapter/luma.d.ts.map +1 -1
  18. package/dist/adapter/luma.js +2 -1
  19. package/dist/adapter/luma.js.map +1 -1
  20. package/dist/adapter/presentation-context.d.ts +11 -0
  21. package/dist/adapter/presentation-context.d.ts.map +1 -0
  22. package/dist/adapter/presentation-context.js +12 -0
  23. package/dist/adapter/presentation-context.js.map +1 -0
  24. package/dist/adapter/resources/buffer.d.ts +1 -1
  25. package/dist/adapter/resources/buffer.d.ts.map +1 -1
  26. package/dist/adapter/resources/buffer.js +14 -6
  27. package/dist/adapter/resources/buffer.js.map +1 -1
  28. package/dist/adapter/resources/command-buffer.d.ts +3 -1
  29. package/dist/adapter/resources/command-buffer.d.ts.map +1 -1
  30. package/dist/adapter/resources/command-buffer.js +3 -1
  31. package/dist/adapter/resources/command-buffer.js.map +1 -1
  32. package/dist/adapter/resources/command-encoder.d.ts +30 -7
  33. package/dist/adapter/resources/command-encoder.d.ts.map +1 -1
  34. package/dist/adapter/resources/command-encoder.js +68 -2
  35. package/dist/adapter/resources/command-encoder.js.map +1 -1
  36. package/dist/adapter/resources/compute-pipeline.d.ts +2 -2
  37. package/dist/adapter/resources/compute-pipeline.d.ts.map +1 -1
  38. package/dist/adapter/resources/fence.d.ts +16 -0
  39. package/dist/adapter/resources/fence.d.ts.map +1 -0
  40. package/dist/adapter/resources/fence.js +17 -0
  41. package/dist/adapter/resources/fence.js.map +1 -0
  42. package/dist/adapter/resources/framebuffer.d.ts +1 -1
  43. package/dist/adapter/resources/framebuffer.d.ts.map +1 -1
  44. package/dist/adapter/resources/framebuffer.js +15 -12
  45. package/dist/adapter/resources/framebuffer.js.map +1 -1
  46. package/dist/adapter/resources/query-set.d.ts +17 -1
  47. package/dist/adapter/resources/query-set.d.ts.map +1 -1
  48. package/dist/adapter/resources/query-set.js.map +1 -1
  49. package/dist/adapter/resources/render-pipeline.d.ts +28 -10
  50. package/dist/adapter/resources/render-pipeline.d.ts.map +1 -1
  51. package/dist/adapter/resources/render-pipeline.js +21 -2
  52. package/dist/adapter/resources/render-pipeline.js.map +1 -1
  53. package/dist/adapter/resources/resource.d.ts +13 -0
  54. package/dist/adapter/resources/resource.d.ts.map +1 -1
  55. package/dist/adapter/resources/resource.js +243 -14
  56. package/dist/adapter/resources/resource.js.map +1 -1
  57. package/dist/adapter/resources/shader.js +27 -25
  58. package/dist/adapter/resources/shader.js.map +1 -1
  59. package/dist/adapter/resources/shared-render-pipeline.d.ts +22 -0
  60. package/dist/adapter/resources/shared-render-pipeline.d.ts.map +1 -0
  61. package/dist/adapter/resources/shared-render-pipeline.js +25 -0
  62. package/dist/adapter/resources/shared-render-pipeline.js.map +1 -0
  63. package/dist/adapter/resources/texture-view.d.ts +1 -1
  64. package/dist/adapter/resources/texture-view.d.ts.map +1 -1
  65. package/dist/adapter/resources/texture.d.ts +168 -28
  66. package/dist/adapter/resources/texture.d.ts.map +1 -1
  67. package/dist/adapter/resources/texture.js +284 -25
  68. package/dist/adapter/resources/texture.js.map +1 -1
  69. package/dist/adapter/types/attachments.d.ts +1 -1
  70. package/dist/adapter/types/attachments.d.ts.map +1 -1
  71. package/dist/adapter/types/buffer-layout.d.ts +1 -1
  72. package/dist/adapter/types/buffer-layout.d.ts.map +1 -1
  73. package/dist/adapter/types/parameters.d.ts +3 -1
  74. package/dist/adapter/types/parameters.d.ts.map +1 -1
  75. package/dist/adapter/types/parameters.js +1 -0
  76. package/dist/adapter/types/parameters.js.map +1 -1
  77. package/dist/adapter/types/shader-layout.d.ts +10 -6
  78. package/dist/adapter/types/shader-layout.d.ts.map +1 -1
  79. package/dist/adapter/types/uniforms.d.ts +6 -0
  80. package/dist/adapter/types/uniforms.d.ts.map +1 -1
  81. package/dist/adapter-utils/bind-groups.d.ts +9 -0
  82. package/dist/adapter-utils/bind-groups.d.ts.map +1 -0
  83. package/dist/adapter-utils/bind-groups.js +41 -0
  84. package/dist/adapter-utils/bind-groups.js.map +1 -0
  85. package/dist/adapter-utils/format-compiler-log.d.ts.map +1 -1
  86. package/dist/adapter-utils/format-compiler-log.js +23 -15
  87. package/dist/adapter-utils/format-compiler-log.js.map +1 -1
  88. package/dist/adapter-utils/get-attribute-from-layouts.d.ts +2 -2
  89. package/dist/adapter-utils/get-attribute-from-layouts.d.ts.map +1 -1
  90. package/dist/adapter-utils/get-attribute-from-layouts.js +6 -6
  91. package/dist/adapter-utils/get-attribute-from-layouts.js.map +1 -1
  92. package/dist/dist.dev.js +2734 -644
  93. package/dist/dist.min.js +10 -9
  94. package/dist/factories/bind-group-factory.d.ts +20 -0
  95. package/dist/factories/bind-group-factory.d.ts.map +1 -0
  96. package/dist/factories/bind-group-factory.js +88 -0
  97. package/dist/factories/bind-group-factory.js.map +1 -0
  98. package/dist/factories/core-module-state.d.ts +7 -0
  99. package/dist/factories/core-module-state.d.ts.map +1 -0
  100. package/dist/{shadertypes/data-types/shader-types.js → factories/core-module-state.js} +1 -1
  101. package/dist/factories/core-module-state.js.map +1 -0
  102. package/dist/factories/pipeline-factory.d.ts +54 -0
  103. package/dist/factories/pipeline-factory.d.ts.map +1 -0
  104. package/dist/factories/pipeline-factory.js +270 -0
  105. package/dist/factories/pipeline-factory.js.map +1 -0
  106. package/dist/factories/shader-factory.d.ts +20 -0
  107. package/dist/factories/shader-factory.d.ts.map +1 -0
  108. package/dist/factories/shader-factory.js +84 -0
  109. package/dist/factories/shader-factory.js.map +1 -0
  110. package/dist/index.cjs +2447 -534
  111. package/dist/index.cjs.map +4 -4
  112. package/dist/index.d.ts +30 -14
  113. package/dist/index.d.ts.map +1 -1
  114. package/dist/index.js +19 -7
  115. package/dist/index.js.map +1 -1
  116. package/dist/portable/shader-block-writer.d.ts +51 -0
  117. package/dist/portable/shader-block-writer.d.ts.map +1 -0
  118. package/dist/portable/shader-block-writer.js +185 -0
  119. package/dist/portable/shader-block-writer.js.map +1 -0
  120. package/dist/portable/uniform-block.d.ts +1 -1
  121. package/dist/portable/uniform-block.d.ts.map +1 -1
  122. package/dist/portable/uniform-store.d.ts +55 -24
  123. package/dist/portable/uniform-store.d.ts.map +1 -1
  124. package/dist/portable/uniform-store.js +73 -25
  125. package/dist/portable/uniform-store.js.map +1 -1
  126. package/dist/shadertypes/data-types/data-type-decoder.d.ts +20 -0
  127. package/dist/shadertypes/data-types/data-type-decoder.d.ts.map +1 -0
  128. package/dist/shadertypes/data-types/data-type-decoder.js +79 -0
  129. package/dist/shadertypes/data-types/data-type-decoder.js.map +1 -0
  130. package/dist/shadertypes/data-types/data-types.d.ts +31 -12
  131. package/dist/shadertypes/data-types/data-types.d.ts.map +1 -1
  132. package/dist/shadertypes/data-types/decode-data-types.d.ts.map +1 -1
  133. package/dist/shadertypes/data-types/decode-data-types.js +4 -3
  134. package/dist/shadertypes/data-types/decode-data-types.js.map +1 -1
  135. package/dist/{image-utils → shadertypes/image-types}/image-types.d.ts +0 -6
  136. package/dist/shadertypes/image-types/image-types.d.ts.map +1 -0
  137. package/dist/shadertypes/image-types/image-types.js.map +1 -0
  138. package/dist/shadertypes/shader-types/shader-block-layout.d.ts +72 -0
  139. package/dist/shadertypes/shader-types/shader-block-layout.d.ts.map +1 -0
  140. package/dist/shadertypes/shader-types/shader-block-layout.js +209 -0
  141. package/dist/shadertypes/shader-types/shader-block-layout.js.map +1 -0
  142. package/dist/shadertypes/shader-types/shader-type-decoder.d.ts +41 -0
  143. package/dist/shadertypes/shader-types/shader-type-decoder.d.ts.map +1 -0
  144. package/dist/shadertypes/{data-types/decode-shader-types.js → shader-types/shader-type-decoder.js} +43 -4
  145. package/dist/shadertypes/shader-types/shader-type-decoder.js.map +1 -0
  146. package/dist/shadertypes/shader-types/shader-types.d.ts +101 -0
  147. package/dist/shadertypes/shader-types/shader-types.d.ts.map +1 -0
  148. package/dist/shadertypes/shader-types/shader-types.js +30 -0
  149. package/dist/shadertypes/shader-types/shader-types.js.map +1 -0
  150. package/dist/shadertypes/texture-types/pixel-utils.d.ts.map +1 -0
  151. package/dist/shadertypes/{textures → texture-types}/pixel-utils.js +4 -4
  152. package/dist/shadertypes/texture-types/pixel-utils.js.map +1 -0
  153. package/dist/shadertypes/texture-types/texture-format-decoder.d.ts +36 -0
  154. package/dist/shadertypes/texture-types/texture-format-decoder.d.ts.map +1 -0
  155. package/dist/shadertypes/{textures → texture-types}/texture-format-decoder.js +110 -38
  156. package/dist/shadertypes/texture-types/texture-format-decoder.js.map +1 -0
  157. package/dist/shadertypes/texture-types/texture-format-generics.d.ts +34 -0
  158. package/dist/shadertypes/texture-types/texture-format-generics.d.ts.map +1 -0
  159. package/dist/shadertypes/texture-types/texture-format-generics.js.map +1 -0
  160. package/dist/shadertypes/texture-types/texture-format-table.d.ts.map +1 -0
  161. package/dist/shadertypes/{textures → texture-types}/texture-format-table.js +12 -11
  162. package/dist/shadertypes/texture-types/texture-format-table.js.map +1 -0
  163. package/dist/shadertypes/{textures → texture-types}/texture-formats.d.ts +51 -17
  164. package/dist/shadertypes/texture-types/texture-formats.d.ts.map +1 -0
  165. package/dist/shadertypes/{textures → texture-types}/texture-formats.js +1 -0
  166. package/dist/shadertypes/texture-types/texture-formats.js.map +1 -0
  167. package/dist/shadertypes/texture-types/texture-layout.d.ts +5 -0
  168. package/dist/shadertypes/texture-types/texture-layout.d.ts.map +1 -0
  169. package/dist/shadertypes/texture-types/texture-layout.js +41 -0
  170. package/dist/shadertypes/texture-types/texture-layout.js.map +1 -0
  171. package/dist/shadertypes/vertex-types/vertex-format-decoder.d.ts +24 -0
  172. package/dist/shadertypes/vertex-types/vertex-format-decoder.d.ts.map +1 -0
  173. package/dist/shadertypes/vertex-types/vertex-format-decoder.js +144 -0
  174. package/dist/shadertypes/vertex-types/vertex-format-decoder.js.map +1 -0
  175. package/dist/shadertypes/vertex-types/vertex-formats.d.ts +50 -0
  176. package/dist/shadertypes/vertex-types/vertex-formats.d.ts.map +1 -0
  177. package/dist/shadertypes/vertex-types/vertex-formats.js.map +1 -0
  178. package/dist/utils/array-equal.d.ts +1 -1
  179. package/dist/utils/array-equal.d.ts.map +1 -1
  180. package/dist/utils/array-equal.js +15 -9
  181. package/dist/utils/array-equal.js.map +1 -1
  182. package/dist/utils/assert.d.ts +5 -0
  183. package/dist/utils/assert.d.ts.map +1 -0
  184. package/dist/utils/assert.js +17 -0
  185. package/dist/utils/assert.js.map +1 -0
  186. package/dist/utils/stats-manager.d.ts.map +1 -1
  187. package/dist/utils/stats-manager.js +61 -1
  188. package/dist/utils/stats-manager.js.map +1 -1
  189. package/package.json +6 -6
  190. package/src/adapter/canvas-context.ts +7 -556
  191. package/src/adapter/canvas-observer.ts +130 -0
  192. package/src/adapter/canvas-surface.ts +521 -0
  193. package/src/adapter/device.ts +311 -25
  194. package/src/adapter/luma.ts +1 -0
  195. package/src/adapter/presentation-context.ts +16 -0
  196. package/src/adapter/resources/buffer.ts +13 -5
  197. package/src/adapter/resources/command-buffer.ts +4 -2
  198. package/src/adapter/resources/command-encoder.ts +101 -10
  199. package/src/adapter/resources/compute-pipeline.ts +2 -2
  200. package/src/adapter/resources/fence.ts +32 -0
  201. package/src/adapter/resources/framebuffer.ts +16 -13
  202. package/src/adapter/resources/query-set.ts +17 -1
  203. package/src/adapter/resources/render-pipeline.ts +52 -16
  204. package/src/adapter/resources/resource.ts +289 -14
  205. package/src/adapter/resources/shader.ts +28 -28
  206. package/src/adapter/resources/shared-render-pipeline.ts +40 -0
  207. package/src/adapter/resources/texture-view.ts +1 -1
  208. package/src/adapter/resources/texture.ts +427 -49
  209. package/src/adapter/types/attachments.ts +1 -1
  210. package/src/adapter/types/buffer-layout.ts +1 -1
  211. package/src/adapter/types/parameters.ts +4 -1
  212. package/src/adapter/types/shader-layout.ts +15 -9
  213. package/src/adapter/types/uniforms.ts +12 -0
  214. package/src/adapter-utils/bind-groups.ts +71 -0
  215. package/src/adapter-utils/format-compiler-log.ts +23 -15
  216. package/src/adapter-utils/get-attribute-from-layouts.ts +8 -11
  217. package/src/factories/bind-group-factory.ts +157 -0
  218. package/src/factories/core-module-state.ts +11 -0
  219. package/src/factories/pipeline-factory.ts +328 -0
  220. package/src/factories/shader-factory.ts +103 -0
  221. package/src/index.ts +70 -26
  222. package/src/portable/shader-block-writer.ts +254 -0
  223. package/src/portable/uniform-block.ts +1 -1
  224. package/src/portable/uniform-store.ts +98 -40
  225. package/src/shadertypes/data-types/data-type-decoder.ts +105 -0
  226. package/src/shadertypes/data-types/data-types.ts +100 -48
  227. package/src/shadertypes/data-types/decode-data-types.ts +4 -3
  228. package/src/{image-utils → shadertypes/image-types}/image-types.ts +0 -7
  229. package/src/shadertypes/shader-types/shader-block-layout.ts +340 -0
  230. package/src/shadertypes/{data-types/decode-shader-types.ts → shader-types/shader-type-decoder.ts} +88 -14
  231. package/src/shadertypes/shader-types/shader-types.ts +207 -0
  232. package/src/shadertypes/{textures → texture-types}/pixel-utils.ts +4 -4
  233. package/src/shadertypes/{textures → texture-types}/texture-format-decoder.ts +167 -46
  234. package/src/shadertypes/{textures → texture-types}/texture-format-generics.ts +42 -48
  235. package/src/shadertypes/{textures → texture-types}/texture-format-table.ts +12 -11
  236. package/src/shadertypes/{textures → texture-types}/texture-formats.ts +73 -17
  237. package/src/shadertypes/texture-types/texture-layout.ts +60 -0
  238. package/src/shadertypes/vertex-types/vertex-format-decoder.ts +175 -0
  239. package/src/shadertypes/vertex-types/vertex-formats.ts +196 -0
  240. package/src/utils/array-equal.ts +21 -9
  241. package/src/utils/assert.ts +18 -0
  242. package/src/utils/stats-manager.ts +76 -2
  243. package/dist/image-utils/image-types.d.ts.map +0 -1
  244. package/dist/image-utils/image-types.js.map +0 -1
  245. package/dist/portable/uniform-buffer-layout.d.ts +0 -28
  246. package/dist/portable/uniform-buffer-layout.d.ts.map +0 -1
  247. package/dist/portable/uniform-buffer-layout.js +0 -96
  248. package/dist/portable/uniform-buffer-layout.js.map +0 -1
  249. package/dist/shadertypes/data-types/decode-shader-types.d.ts +0 -17
  250. package/dist/shadertypes/data-types/decode-shader-types.d.ts.map +0 -1
  251. package/dist/shadertypes/data-types/decode-shader-types.js.map +0 -1
  252. package/dist/shadertypes/data-types/shader-types.d.ts +0 -45
  253. package/dist/shadertypes/data-types/shader-types.d.ts.map +0 -1
  254. package/dist/shadertypes/data-types/shader-types.js.map +0 -1
  255. package/dist/shadertypes/textures/pixel-utils.d.ts.map +0 -1
  256. package/dist/shadertypes/textures/pixel-utils.js.map +0 -1
  257. package/dist/shadertypes/textures/texture-format-decoder.d.ts +0 -18
  258. package/dist/shadertypes/textures/texture-format-decoder.d.ts.map +0 -1
  259. package/dist/shadertypes/textures/texture-format-decoder.js.map +0 -1
  260. package/dist/shadertypes/textures/texture-format-generics.d.ts +0 -33
  261. package/dist/shadertypes/textures/texture-format-generics.d.ts.map +0 -1
  262. package/dist/shadertypes/textures/texture-format-generics.js.map +0 -1
  263. package/dist/shadertypes/textures/texture-format-table.d.ts.map +0 -1
  264. package/dist/shadertypes/textures/texture-format-table.js.map +0 -1
  265. package/dist/shadertypes/textures/texture-formats.d.ts.map +0 -1
  266. package/dist/shadertypes/textures/texture-formats.js.map +0 -1
  267. package/dist/shadertypes/vertex-arrays/decode-vertex-format.d.ts +0 -18
  268. package/dist/shadertypes/vertex-arrays/decode-vertex-format.d.ts.map +0 -1
  269. package/dist/shadertypes/vertex-arrays/decode-vertex-format.js +0 -100
  270. package/dist/shadertypes/vertex-arrays/decode-vertex-format.js.map +0 -1
  271. package/dist/shadertypes/vertex-arrays/vertex-formats.d.ts +0 -27
  272. package/dist/shadertypes/vertex-arrays/vertex-formats.d.ts.map +0 -1
  273. package/dist/shadertypes/vertex-arrays/vertex-formats.js.map +0 -1
  274. package/src/portable/uniform-buffer-layout.ts +0 -118
  275. package/src/shadertypes/data-types/shader-types.ts +0 -87
  276. package/src/shadertypes/vertex-arrays/decode-vertex-format.ts +0 -124
  277. package/src/shadertypes/vertex-arrays/vertex-formats.ts +0 -91
  278. /package/dist/{image-utils → shadertypes/image-types}/image-types.js +0 -0
  279. /package/dist/shadertypes/{textures → texture-types}/pixel-utils.d.ts +0 -0
  280. /package/dist/shadertypes/{textures → texture-types}/texture-format-generics.js +0 -0
  281. /package/dist/shadertypes/{textures → texture-types}/texture-format-table.d.ts +0 -0
  282. /package/dist/shadertypes/{vertex-arrays → vertex-types}/vertex-formats.js +0 -0
@@ -1,8 +1,8 @@
1
1
  import { Device } from "../device.js";
2
2
  import { Resource, ResourceProps } from "./resource.js";
3
+ import { QuerySet } from "./query-set.js";
3
4
  import { Buffer } from "./buffer.js";
4
5
  import { Texture } from "./texture.js";
5
- import { QuerySet } from "./query-set.js";
6
6
  import type { RenderPass, RenderPassProps } from "./render-pass.js";
7
7
  import type { ComputePass, ComputePassProps } from "./compute-pass.js";
8
8
  import type { CommandBuffer, CommandBufferProps } from "./command-buffer.js";
@@ -18,11 +18,11 @@ export type CopyBufferToTextureOptions = {
18
18
  byteOffset?: number;
19
19
  destinationTexture: Texture;
20
20
  mipLevel?: number;
21
- origin?: [number, number, number] | number[];
21
+ origin?: [number, number, number];
22
22
  aspect?: 'all' | 'stencil-only' | 'depth-only';
23
23
  bytesPerRow: number;
24
24
  rowsPerImage: number;
25
- size: [number, number, number] | number[];
25
+ size: [number, number, number];
26
26
  };
27
27
  export type CopyTextureToBufferOptions = {
28
28
  /** Texture to copy to/from. */
@@ -38,7 +38,7 @@ export type CopyTextureToBufferOptions = {
38
38
  width?: number;
39
39
  height?: number;
40
40
  depthOrArrayLayers?: number;
41
- origin?: number[];
41
+ origin?: [number, number, number];
42
42
  /** Destination buffer */
43
43
  destinationBuffer: Buffer;
44
44
  /** Offset, in bytes, from the beginning of the buffer to the start of the image data (default 0) */
@@ -61,7 +61,7 @@ export type CopyTextureToTextureOptions = {
61
61
  /** Mip-map level of the texture to copy to/from. (Default 0) */
62
62
  mipLevel?: number;
63
63
  /** Defines the origin of the copy - the minimum corner of the texture sub-region to copy from. */
64
- origin?: number[];
64
+ origin?: [number, number, number];
65
65
  /** Defines which aspects of the {@link GPUImageCopyTexture#texture} to copy to/from. */
66
66
  aspect?: 'all' | 'stencil-only' | 'depth-only';
67
67
  /** Texture to copy to/from. */
@@ -69,7 +69,7 @@ export type CopyTextureToTextureOptions = {
69
69
  /** Mip-map level of the texture to copy to/from. (Default 0) */
70
70
  destinationMipLevel?: number;
71
71
  /** Defines the origin of the copy - the minimum corner of the texture sub-region to copy to. */
72
- destinationOrigin?: number[];
72
+ destinationOrigin?: [number, number, number];
73
73
  /** Defines which aspects of the {@link GPUImageCopyTexture#texture} to copy to/from. */
74
74
  destinationAspect?: 'all' | 'stencil-only' | 'depth-only';
75
75
  /** Width to copy */
@@ -88,12 +88,23 @@ export type ClearTextureOptions = {
88
88
  };
89
89
  export type CommandEncoderProps = ResourceProps & {
90
90
  measureExecutionTime?: boolean;
91
+ timeProfilingQuerySet?: QuerySet | null;
92
+ };
93
+ type PassWithTimestamps = {
94
+ timestampQuerySet?: QuerySet;
95
+ beginTimestampIndex?: number;
96
+ endTimestampIndex?: number;
91
97
  };
92
98
  /**
93
- * Encodes commands to queue that can be executed later
99
+ * Records commands onto a single backend command encoder and can finish them into one command
100
+ * buffer. Resource helpers invoked through a CommandEncoder must record onto that encoder rather
101
+ * than allocating hidden encoders or submitting work eagerly.
94
102
  */
95
103
  export declare abstract class CommandEncoder extends Resource<CommandEncoderProps> {
96
104
  get [Symbol.toStringTag](): string;
105
+ protected _timeProfilingQuerySet: QuerySet | null;
106
+ protected _timeProfilingSlotCount: number;
107
+ _gpuTimeMs?: number;
97
108
  constructor(device: Device, props: CommandEncoderProps);
98
109
  /** Completes recording of the commands sequence */
99
110
  abstract finish(props?: CommandBufferProps): CommandBuffer;
@@ -116,6 +127,17 @@ export declare abstract class CommandEncoder extends Resource<CommandEncoderProp
116
127
  queryCount?: number;
117
128
  destinationOffset?: number;
118
129
  }): void;
130
+ /**
131
+ * Reads all resolved timestamp pairs on the current profiler query set and caches the sum
132
+ * as milliseconds on this encoder.
133
+ */
134
+ resolveTimeProfilingQuerySet(): Promise<void>;
135
+ /** Returns the number of query slots consumed by automatic pass profiling on this encoder. */
136
+ getTimeProfilingSlotCount(): number;
137
+ getTimeProfilingQuerySet(): QuerySet | null;
138
+ /** Internal helper for auto-assigning timestamp slots to render/compute passes on this encoder. */
139
+ protected _applyTimeProfilingToPassProps<P extends PassWithTimestamps>(props?: P): P;
140
+ protected _supportsTimestampQueries(): boolean;
119
141
  /** Begins a labeled debug group containing subsequent commands */
120
142
  abstract pushDebugGroup(groupLabel: string): void;
121
143
  /** Ends the labeled debug group most recently started by pushDebugGroup() */
@@ -124,4 +146,5 @@ export declare abstract class CommandEncoder extends Resource<CommandEncoderProp
124
146
  abstract insertDebugMarker(markerLabel: string): void;
125
147
  static defaultProps: Required<CommandEncoderProps>;
126
148
  }
149
+ export {};
127
150
  //# sourceMappingURL=command-encoder.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"command-encoder.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/command-encoder.ts"],"names":[],"mappings":"AAKA,OAAO,EAAC,MAAM,EAAC,qBAAkB;AACjC,O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ACH"}
@@ -3,21 +3,87 @@
3
3
  // Copyright (c) vis.gl contributors
4
4
  import { Resource } from "./resource.js";
5
5
  /**
6
- * Encodes commands to queue that can be executed later
6
+ * Records commands onto a single backend command encoder and can finish them into one command
7
+ * buffer. Resource helpers invoked through a CommandEncoder must record onto that encoder rather
8
+ * than allocating hidden encoders or submitting work eagerly.
7
9
  */
8
10
  export class CommandEncoder extends Resource {
9
11
  get [Symbol.toStringTag]() {
10
12
  return 'CommandEncoder';
11
13
  }
14
+ _timeProfilingQuerySet = null;
15
+ _timeProfilingSlotCount = 0;
16
+ _gpuTimeMs;
12
17
  constructor(device, props) {
13
18
  super(device, props, CommandEncoder.defaultProps);
19
+ this._timeProfilingQuerySet = props.timeProfilingQuerySet ?? null;
20
+ this._timeProfilingSlotCount = 0;
21
+ this._gpuTimeMs = undefined;
22
+ }
23
+ /**
24
+ * Reads all resolved timestamp pairs on the current profiler query set and caches the sum
25
+ * as milliseconds on this encoder.
26
+ */
27
+ async resolveTimeProfilingQuerySet() {
28
+ this._gpuTimeMs = undefined;
29
+ if (!this._timeProfilingQuerySet) {
30
+ return;
31
+ }
32
+ const pairCount = Math.floor(this._timeProfilingSlotCount / 2);
33
+ if (pairCount <= 0) {
34
+ return;
35
+ }
36
+ const queryCount = pairCount * 2;
37
+ const results = await this._timeProfilingQuerySet.readResults({
38
+ firstQuery: 0,
39
+ queryCount
40
+ });
41
+ let totalDurationNanoseconds = 0n;
42
+ for (let queryIndex = 0; queryIndex < queryCount; queryIndex += 2) {
43
+ totalDurationNanoseconds += results[queryIndex + 1] - results[queryIndex];
44
+ }
45
+ this._gpuTimeMs = Number(totalDurationNanoseconds) / 1e6;
46
+ }
47
+ /** Returns the number of query slots consumed by automatic pass profiling on this encoder. */
48
+ getTimeProfilingSlotCount() {
49
+ return this._timeProfilingSlotCount;
50
+ }
51
+ getTimeProfilingQuerySet() {
52
+ return this._timeProfilingQuerySet;
53
+ }
54
+ /** Internal helper for auto-assigning timestamp slots to render/compute passes on this encoder. */
55
+ _applyTimeProfilingToPassProps(props) {
56
+ const passProps = (props || {});
57
+ if (!this._supportsTimestampQueries() || !this._timeProfilingQuerySet) {
58
+ return passProps;
59
+ }
60
+ if (passProps.timestampQuerySet !== undefined ||
61
+ passProps.beginTimestampIndex !== undefined ||
62
+ passProps.endTimestampIndex !== undefined) {
63
+ return passProps;
64
+ }
65
+ const beginTimestampIndex = this._timeProfilingSlotCount;
66
+ if (beginTimestampIndex + 1 >= this._timeProfilingQuerySet.props.count) {
67
+ return passProps;
68
+ }
69
+ this._timeProfilingSlotCount += 2;
70
+ return {
71
+ ...passProps,
72
+ timestampQuerySet: this._timeProfilingQuerySet,
73
+ beginTimestampIndex,
74
+ endTimestampIndex: beginTimestampIndex + 1
75
+ };
76
+ }
77
+ _supportsTimestampQueries() {
78
+ return this.device.features.has('timestamp-query');
14
79
  }
15
80
  // TODO - luma.gl has these on the device, should we align with WebGPU API?
16
81
  // beginRenderPass(GPURenderPassDescriptor descriptor): GPURenderPassEncoder;
17
82
  // beginComputePass(optional GPUComputePassDescriptor descriptor = {}): GPUComputePassEncoder;
18
83
  static defaultProps = {
19
84
  ...Resource.defaultProps,
20
- measureExecutionTime: undefined
85
+ measureExecutionTime: undefined,
86
+ timeProfilingQuerySet: undefined
21
87
  };
22
88
  }
23
89
  //# sourceMappingURL=command-encoder.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"command-encoder.js","sourceRoot":"","sources":["../../../src/adapter/resources/command-encoder.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,+BAA+B;AAC/B,oCAAoC;AAIpC,OAAO,EAAC,QAAQ,EAAgB,sBAAmB;AA8HnD;;GAEG;AACH,MAAM,OAAgB,cAAe,SAAQ,QAA6B;IACxE,IAAa,CAAC,MAAM,CAAC,WAAW,CAAC;QAC/B,OAAO,gBAAgB,CAAC;IAC1B,CAAC;IAED,YAAY,MAAc,EAAE,KAA0B;QACpD,KAAK,CAAC,MAAM,EAAE,KAAK,EAAE,cAAc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iBAAiB,EAAE,IAAI,CAAC,sBAAsB;YAC9C,mBAAmB;YACnB,iBAAiB,EAAE,mBAAmB,GAAG,CAAC;SAC3C,CAAC;IACJ,CAAC;IAES,yBAAyB;QACjC,OAAO,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;IACrD,CAAC;IASD,2EAA2E;IAC3E,6EAA6E;IAC7E,8FAA8F;IAE9F,MAAM,CAAU,YAAY,GAAkC;QAC5D,GAAG,QAAQ,CAAC,YAAY;QACxB,oBAAoB,EAAE,SAAU;QAChC,qBAAqB,EAAE,SAAU;KAClC,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import { Resource, ResourceProps } from "./resource.js";
2
- import type { ComputeShaderLayout, Binding } from "../types/shader-layout.js";
2
+ import type { ComputeShaderLayout, Bindings, BindingsByGroup } from "../types/shader-layout.js";
3
3
  import type { Device } from "../device.js";
4
4
  import type { Shader } from "./shader.js";
5
5
  /**
@@ -29,7 +29,7 @@ export declare abstract class ComputePipeline extends Resource<ComputePipelinePr
29
29
  * @todo Use renderpass.setBindings() ?
30
30
  * @todo Do we want to expose BindGroups in the API and remove this?
31
31
  */
32
- abstract setBindings(bindings: Record<string, Binding>): void;
32
+ abstract setBindings(bindings: Bindings | BindingsByGroup): void;
33
33
  static defaultProps: Required<ComputePipelineProps>;
34
34
  }
35
35
  //# sourceMappingURL=compute-pipeline.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"compute-pipeline.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/compute-pipeline.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,QAAQ,EAAE,aAAa,EAAC,sBAAmB;AACnD,OAAO,KAAK,EAAC,mBAAmB,EAAE,OAAO,EAAC,kCAA+B;AACzE,OAAO,KAAK,EAAC,MAAM,EAAC,qBAAkB;AACtC,OAAO,KAAK,EAAC,MAAM,EAAC,oBAAiB;AAErC;;GAEG;AACH,MAAM,MAAM,oBAAoB,GA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AC;IACpB,iHAAiH;IACjH,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACnC,+EAA+E;IAC/E,YAAY,CAAC,EAAE,mBAAmB,GAAG,IAAI,CAAC;CAC3C,CAAC;AAEF;;GAEG;AACH,8BAAsB,eAAgB,SAAQ,QAAQ,CAAC,oBAAoB,CAAC;IAC1E,IAAa,CAAC,MAAM,CAAC,WAAW,CAAC,IAAI,MAAM,CAE1C;IAED,IAAI,EAAE,MAAM,CAAM;IAClB,+BAA+B;IAC/B,YAAY,EAAE,mBAAmB,CAAC;gBAEtB,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,oBAAoB;IAKvD;;;OAGG;IACH,QAAQ,CAAC,WAAW,CAAC,QAAQ,EAAE,QAAQ,GAAG,eAAe,GAAG,IAAI;IAEhE,OAAgB,YAAY,EAAE,QAAQ,CAAC,oBAAoB,CAAC,CAM1D;CACH"}
@@ -0,0 +1,16 @@
1
+ import type { Device } from "../device.js";
2
+ import { Resource, type ResourceProps } from "./resource.js";
3
+ export type FenceProps = ResourceProps;
4
+ /** Synchronization primitive that resolves when GPU work is completed */
5
+ export declare abstract class Fence extends Resource<FenceProps> {
6
+ static defaultProps: Required<FenceProps>;
7
+ get [Symbol.toStringTag](): string;
8
+ /** Promise that resolves when the fence is signaled */
9
+ abstract readonly signaled: Promise<void>;
10
+ constructor(device: Device, props?: FenceProps);
11
+ /** Destroy the fence and release any resources */
12
+ abstract destroy(): void;
13
+ /** Check if the fence has been signaled */
14
+ abstract isSignaled(): boolean;
15
+ }
16
+ //# sourceMappingURL=fence.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fence.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/fence.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,MAAM,EAAC,qBAAkB;AACtC,OAAO,EAAC,QAAQ,EAAE,KAAK,aAAa,EAAC,sBAAmB;AAExD,MAAM,MAAM,UAAU,GAAG,aAAa,CAAC;AAEvC,yEAAyE;AACzE,8BAAsB,KAAM,SAAQ,QAAQ,CAAC,UAAU,CAAC;IACtD,OAAgB,YAAY,EAAE,QAAQ,CAAC,UAAU,CAAC,CAEhD;IAEF,IAAa,CAAC,MAAM,CAAC,WAAW,CAAC,IAAI,MAAM,CAE1C;IAED,uDAAuD;IACvD,QAAQ,CAAC,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;gBAE9B,MAAM,EAAE,MAAM,EAAE,KAAK,GAAE,UAAe;IAIlD,kDAAkD;aAChC,OAAO,IAAI,IAAI;IAEjC,2CAA2C;IAC3C,QAAQ,CAAC,UAAU,IAAI,OAAO;CAC/B"}
@@ -0,0 +1,17 @@
1
+ // luma.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (c) vis.gl contributors
4
+ import { Resource } from "./resource.js";
5
+ /** Synchronization primitive that resolves when GPU work is completed */
6
+ export class Fence extends Resource {
7
+ static defaultProps = {
8
+ ...Resource.defaultProps
9
+ };
10
+ get [Symbol.toStringTag]() {
11
+ return 'Fence';
12
+ }
13
+ constructor(device, props = {}) {
14
+ super(device, props, Fence.defaultProps);
15
+ }
16
+ }
17
+ //# sourceMappingURL=fence.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fence.js","sourceRoot":"","sources":["../../../src/adapter/resources/fence.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,+BAA+B;AAC/B,oCAAoC;AAGpC,OAAO,EAAC,QAAQ,EAAqB,sBAAmB;AAIxD,yEAAyE;AACzE,MAAM,OAAgB,KAAM,SAAQ,QAAoB;IACtD,MAAM,CAAU,YAAY,GAAyB;QACnD,GAAG,QAAQ,CAAC,YAAY;KACzB,CAAC;IAEF,IAAa,CAAC,MAAM,CAAC,WAAW,CAAC;QAC/B,OAAO,OAAO,CAAC;IACjB,CAAC;IAKD,YAAY,MAAc,EAAE,QAAoB,EAAE;QAChD,KAAK,CAAC,MAAM,EAAE,KAAK,EAAE,KAAK,CAAC,YAAY,CAAC,CAAC;IAC3C,CAAC"}
@@ -1,4 +1,4 @@
1
- import type { TextureFormatColor, TextureFormatDepthStencil, TextureFormat } from "../../shadertypes/textures/texture-formats.js";
1
+ import type { TextureFormatColor, TextureFormatDepthStencil, TextureFormat } from "../../shadertypes/texture-types/texture-formats.js";
2
2
  import type { Device } from "../device.js";
3
3
  import { Resource, ResourceProps } from "./resource.js";
4
4
  import { Texture } from "./texture.js";
@@ -1 +1 @@
1
- {"version":3,"file":"framebuffer.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/framebuffer.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACV,kBAAkB,EAClB,yBAAyB,EACzB,aAAa,EACd,sDAAmD;AACpD,OAAO,KAAK,EAAC,MAAM,EAAC,qBAAkB;AACtC,OAAO,EAAC,QAAQ,EAAE,aAAa,EAAC,sBAAmB;AACnD,OAAO,EAAC,OAAO,EAAC,qBAAkB;AAClC,OAAO,EAAC,WAAW,EAAC,0BAAuB;AAG3C,MAAM,MAAM,gBAAgB,GAAG,aAAa,GAAG;IAC7C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,gBAAgB,CAAC,EAAE,CAAC,WAAW,GAAG,OAAO,GAAG,kBAAkB,CAAC,EAAE,CAAC;IAClE,sBAAsB,CAAC,EAAE,CAAC,WAAW,GAAG,OAAO,GAAG,yBAAyB,CAAC,GAAG,IAAI,CAAC;CACrF,CAAC;AAEF;;;GAGG;AACH,8BAAsB,WAAY,SAAQ,QAAQ,CAAC,gBAAgB,CAAC;IAClE,IAAa,CAAC,MAAM,CAAC,WAAW,CAAC,IAAI,MAAM,CAE1C;IAED,mDAAmD;IACnD,KAAK,EAAE,MAAM,CAAC;IACd,oDAAoD;IACpD,MAAM,EAAE,MAAM,CAAC;IACf,wBAAwB;IACxB,QAAQ,CAAC,gBAAgB,EAAE,WAAW,EAAE,CAAC;IACzC,4CAA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AAkB,CAAC,MAAM,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO;IAe3E,mCAAmC;IACnC,SAAS,CAAC,yBAAyB,CAAC,MAAM,EAAE,aAAa,GAAG,OAAO;IAUnE;;;;OAIG;IACH,SAAS,CAAC,iBAAiB,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI;IAwBhE,iGAAiG;IACjG,SAAS,CAAC,QAAQ,CAAC,iBAAiB,IAAI,IAAI;IAE5C,OAAgB,YAAY,EAAE,QAAQ,CAAC,gBAAgB,CAAC,CAMtD;CACH"}
@@ -28,7 +28,12 @@ export class Framebuffer extends Resource {
28
28
  clone(size) {
29
29
  const colorAttachments = this.colorAttachments.map(colorAttachment => colorAttachment.texture.clone(size));
30
30
  const depthStencilAttachment = this.depthStencilAttachment && this.depthStencilAttachment.texture.clone(size);
31
- return this.device.createFramebuffer({ ...this.props, colorAttachments, depthStencilAttachment });
31
+ return this.device.createFramebuffer({
32
+ ...this.props,
33
+ ...size,
34
+ colorAttachments,
35
+ depthStencilAttachment
36
+ });
32
37
  }
33
38
  resize(size) {
34
39
  let updateSize = !size;
@@ -105,17 +110,15 @@ export class Framebuffer extends Resource {
105
110
  * and destroys existing textures if owned
106
111
  */
107
112
  resizeAttachments(width, height) {
108
- for (let i = 0; i < this.colorAttachments.length; ++i) {
109
- if (this.colorAttachments[i]) {
110
- const resizedTexture = this.colorAttachments[i].texture.clone({
111
- width,
112
- height
113
- });
114
- this.destroyAttachedResource(this.colorAttachments[i]);
115
- this.colorAttachments[i] = resizedTexture.view;
116
- this.attachResource(resizedTexture.view);
117
- }
118
- }
113
+ this.colorAttachments.forEach((colorAttachment, i) => {
114
+ const resizedTexture = colorAttachment.texture.clone({
115
+ width,
116
+ height
117
+ });
118
+ this.destroyAttachedResource(colorAttachment);
119
+ this.colorAttachments[i] = resizedTexture.view;
120
+ this.attachResource(resizedTexture.view);
121
+ });
119
122
  if (this.depthStencilAttachment) {
120
123
  const resizedTexture = this.depthStencilAttachment.texture.clone({
121
124
  width,
@@ -1 +1 @@
1
- {"version":3,"file":"framebuffer.js","sourceRoot":"","sources":["../../../src/adapter/resources/framebuffer.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,+BAA+B;AAC/B,oCAAoC;AAQpC,OAAO,EAAC,QAAQ,EAAgB,sBAAmB;AACnD,OAAO,EAAC,OAAO,EAAC,qBAAkB;AAElC,OAAO,EAAC,GAAG,EAAC,2BAAwB;AASpC;;;GAGG;AACH,MAAM,OAAgB,WAAY,SAAQ,QAA0B;IAClE,IAAa,CAAC,MAAM,CAAC,WAAW,CAAC;QAC/B,OAAO,aAAa,CAAC;IACvB,CAAC;IAED,mDAAmD;IACnD,KAAK,CAAS;IACd,oDAAoD;IACpD,MAAM,CAAS;IAMf,YAAY,MAAc,EAAE,QAA0B,EAAE;QACtD,KAAK,CAAC,MAAM,EAAE,KAAK,EAAE,WAAW,CAAC,YAAY,CAAC,CAAC;QAC/C,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC;QAC9B,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC;IAClC,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,IAAsC;QAC1C,MAAM,gBAAgB,GAAG,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,eAAe,CAAC,EAAE,CACnE,eAAe,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CACpC,CAAC;QAEF,MAAM,sBAAsB,GAC1B,IAAI,CAAC,sBAAsB,IAAI,IAAI,CAAC,sBAAsB,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAEjF,OAAO,IAAI,CAAC,MAAM,CAAC,iBAAiB,CAAC,EAAC,GAAG,IAAI,CAAC,KAAK,EAAE,gBAAgB,EAAE,sBAAsB,EAAC,CAAC,CAAC;IAClG,CAAC;IAUD,MAAM,CAAC,IAAw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GAA+B;QACzD,GAAG,QAAQ,CAAC,YAAY;QACxB,KAAK,EAAE,CAAC;QACR,MAAM,EAAE,CAAC;QACT,gBAAgB,EAAE,EAAE,EAAE,kBAAkB;QACxC,sBAAsB,EAAE,IAAI,CAAC,yBAAyB;KACvD,CAAC"}
@@ -11,7 +11,8 @@ export type QuerySetProps = ResourceProps & {
11
11
  /**
12
12
  * The type of query set
13
13
  * occlusion - query the number of fragment samples that pass all the per-fragment tests for a set of drawing commands, including scissor, sample mask, alpha to coverage, stencil, and depth tests
14
- * timestamp - query the GPU timestamp counter at the start and end of render passes
14
+ * timestamp - query the GPU timestamp counter. Timestamp queries are available if the
15
+ * `timestamp-query` feature is present.
15
16
  */
16
17
  type: 'occlusion' | 'timestamp';
17
18
  /** The number of queries managed by the query set */
@@ -22,5 +23,20 @@ export declare abstract class QuerySet extends Resource<QuerySetProps> {
22
23
  get [Symbol.toStringTag](): string;
23
24
  constructor(device: Device, props: QuerySetProps);
24
25
  static defaultProps: Required<QuerySetProps>;
26
+ /**
27
+ * Returns true if the requested result has been captured and can be read without blocking.
28
+ * Backends may implement this conservatively.
29
+ */
30
+ abstract isResultAvailable(queryIndex?: number): boolean;
31
+ /** Reads query results as 64-bit values. */
32
+ abstract readResults(options?: {
33
+ firstQuery?: number;
34
+ queryCount?: number;
35
+ }): Promise<bigint[]>;
36
+ /**
37
+ * Reads a timestamp duration in milliseconds between a begin and end query index.
38
+ * Portable duration profiling requires adjacent indices that identify one logical pair.
39
+ */
40
+ abstract readTimestampDuration(beginIndex: number, endIndex: number): Promise<number>;
25
41
  }
26
42
  //# sourceMappingURL=query-set.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"query-set.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/query-set.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,MAAM,EAAC,qBAAkB;AACtC,OAAO,EAAC,QAAQ,EAAE,aAAa,EAAC,sBAAmB;AAEnD;;;;;;GAMG;AACH,MAAM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,CAAC;IAE7F;;;OAGG;IACH,QAAQ,CAAC,qBAAqB,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;CACtF"}
@@ -1 +1 @@
1
- {"version":3,"file":"query-set.js","sourceRoot":"","sources":["../../../src/adapter/resources/query-set.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,+BAA+B;AAC/B,oCAAoC;AAGpC,OAAO,EAAC,QAAQ,EAAgB,sBAAmB;AAoBnD,gCAAgC;AAChC,MAAM,OAAgB,QAAS,SAAQ,QAAuB;IAC5D,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC;QACtB,OAAO,UAAU,CAAC;IACpB,CAAC;IAED,YAAY,MAAc,EAAE,KAAoB;QAC9C,KAAK,CAAC,MAAM,EAAE,KAAK,EAAE,QAAQ,CAAC,YAAY,CAAC,CAAC;IAC9C,CAAC;IAED,MAAM,CAAU,YAAY,GAA4B;QACtD,GAAG,QAAQ,CAAC,YAAY;QACxB,IAAI,EAAE,SAAU;QAChB,KAAK,EAAE,SAAU;KAClB,CAAC"}
1
+ {"version":3,"file":"query-set.js","sourceRoot":"","sources":["../../../src/adapter/resources/query-set.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,+BAA+B;AAC/B,oCAAoC;AAGpC,OAAO,EAAC,QAAQ,EAAgB,sBAAmB;AAqBnD,gCAAgC;AAChC,MAAM,OAAgB,QAAS,SAAQ,QAAuB;IAC5D,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC;QACtB,OAAO,UAAU,CAAC;IACpB,CAAC;IAED,YAAY,MAAc,EAAE,KAAoB;QAC9C,KAAK,CAAC,MAAM,EAAE,KAAK,EAAE,QAAQ,CAAC,YAAY,CAAC,CAAC;IAC9C,CAAC;IAED,MAAM,CAAU,YAAY,GAA4B;QACtD,GAAG,QAAQ,CAAC,YAAY;QACxB,IAAI,EAAE,SAAU;QAChB,KAAK,EAAE,SAAU;KAClB,CAAC"}
@@ -1,10 +1,10 @@
1
1
  import type { Device } from "../device.js";
2
- import type { UniformValue } from "../types/uniforms.js";
3
2
  import type { PrimitiveTopology, RenderPipelineParameters } from "../types/parameters.js";
4
- import type { ShaderLayout, Binding } from "../types/shader-layout.js";
3
+ import type { ShaderLayout, Bindings, BindingsByGroup } from "../types/shader-layout.js";
5
4
  import type { BufferLayout } from "../types/buffer-layout.js";
6
- import type { TextureFormatColor, TextureFormatDepthStencil } from '@luma.gl/core/shadertypes/textures/texture-formats';
5
+ import type { TextureFormatColor, TextureFormatDepthStencil } from '@luma.gl/core/shadertypes/texture-types/texture-formats';
7
6
  import type { Shader } from "./shader.js";
7
+ import type { SharedRenderPipeline } from "./shared-render-pipeline.js";
8
8
  import type { RenderPass } from "./render-pass.js";
9
9
  import { Resource, ResourceProps } from "./resource.js";
10
10
  import { VertexArray } from "./vertex-array.js";
@@ -34,10 +34,18 @@ export type RenderPipelineProps = ResourceProps & {
34
34
  depthStencilAttachmentFormat?: TextureFormatDepthStencil;
35
35
  /** Parameters that are controlled by pipeline */
36
36
  parameters?: RenderPipelineParameters;
37
+ /** Transform feedback varyings captured when linking a WebGL render pipeline. WebGL only. */
38
+ varyings?: string[];
39
+ /** Transform feedback buffer mode used when linking a WebGL render pipeline. WebGL only. */
40
+ bufferMode?: number;
41
+ /** Some applications intentionally supply unused attributes and bindings, and want to disable warnings */
42
+ disableWarnings?: boolean;
43
+ /** Internal hook for backend-specific shared pipeline implementations. */
44
+ _sharedRenderPipeline?: SharedRenderPipeline;
37
45
  /** Buffers, Textures, Samplers for the shader bindings */
38
- bindings?: Record<string, Binding>;
39
- /** @deprecated uniforms (WebGL only) */
40
- uniforms?: Record<string, UniformValue>;
46
+ bindings?: Bindings;
47
+ /** Bindings grouped by bind-group index */
48
+ bindGroups?: BindingsByGroup;
41
49
  };
42
50
  /**
43
51
  * A compiled and linked shader program
@@ -54,11 +62,13 @@ export declare abstract class RenderPipeline extends Resource<RenderPipelineProp
54
62
  linkStatus: 'pending' | 'success' | 'error';
55
63
  /** The hash of the pipeline */
56
64
  hash: string;
65
+ /** Optional shared backend implementation */
66
+ sharedRenderPipeline: SharedRenderPipeline | null;
67
+ /** Whether shader or pipeline compilation/linking is still in progress */
68
+ get isPending(): boolean;
69
+ /** Whether shader or pipeline compilation/linking has failed */
70
+ get isErrored(): boolean;
57
71
  constructor(device: Device, props: RenderPipelineProps);
58
- /** Set bindings (stored on pipeline and set before each call) */
59
- abstract setBindings(bindings: Record<string, Binding>, options?: {
60
- disableWarnings?: boolean;
61
- }): void;
62
72
  /** Draw call. Returns false if the draw call was aborted (due to resources still initializing) */
63
73
  abstract draw(options: {
64
74
  /** Render pass to draw into (targeting screen or framebuffer) */
@@ -86,6 +96,14 @@ export declare abstract class RenderPipeline extends Resource<RenderPipelineProp
86
96
  baseVertex?: number;
87
97
  /** Transform feedback. WebGL only. */
88
98
  transformFeedback?: TransformFeedback;
99
+ /** Bindings applied for this draw (textures, samplers, uniform buffers) */
100
+ bindings?: Bindings;
101
+ /** Bindings grouped by bind-group index */
102
+ bindGroups?: BindingsByGroup;
103
+ /** Optional stable cache keys for backend bind-group reuse */
104
+ _bindGroupCacheKeys?: Partial<Record<number, object>>;
105
+ /** WebGL-only uniforms */
106
+ uniforms?: Record<string, unknown>;
89
107
  }): boolean;
90
108
  static defaultProps: Required<RenderPipelineProps>;
91
109
  }
@@ -1 +1 @@
1
- {"version":3,"file":"render-pipeline.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/render-pipeline.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,MAAM,EAAC,qBAAkB;AACtC,OAAO,KAAK,EAAC,YAAY,EAAC,6BAA0B;AACpD,OAAO,KAAK,EAAC,iBAAiB,EAAE,wBAAwB,EAAC,+BAA4B;AACrF,OAAO,KAAK,EAAC,YAAY,EAAE,OAAO,EAAC,kCAA+B;AAClE,OAAO,KAAK,EAAC,YAAY,EAAC,kCAA+B;AACzD,OAAO,KAAK,EACV,kBAAkB,EAClB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AAE,MAAM,CAAC,CAAC,CAAC;QACtD,0BAA0B;QAC1B,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;KACpC,GAAG,OAAO;IAEX,OAAgB,YAAY,EAAE,QAAQ,CAAC,mBAAmB,CAAC,CAyBzD;CACH"}
@@ -17,10 +17,25 @@ export class RenderPipeline extends Resource {
17
17
  linkStatus = 'pending';
18
18
  /** The hash of the pipeline */
19
19
  hash = '';
20
+ /** Optional shared backend implementation */
21
+ sharedRenderPipeline = null;
22
+ /** Whether shader or pipeline compilation/linking is still in progress */
23
+ get isPending() {
24
+ return (this.linkStatus === 'pending' ||
25
+ this.vs.compilationStatus === 'pending' ||
26
+ this.fs?.compilationStatus === 'pending');
27
+ }
28
+ /** Whether shader or pipeline compilation/linking has failed */
29
+ get isErrored() {
30
+ return (this.linkStatus === 'error' ||
31
+ this.vs.compilationStatus === 'error' ||
32
+ this.fs?.compilationStatus === 'error');
33
+ }
20
34
  constructor(device, props) {
21
35
  super(device, props, RenderPipeline.defaultProps);
22
36
  this.shaderLayout = this.props.shaderLayout;
23
37
  this.bufferLayout = this.props.bufferLayout || [];
38
+ this.sharedRenderPipeline = this.props._sharedRenderPipeline || null;
24
39
  }
25
40
  static defaultProps = {
26
41
  ...Resource.defaultProps,
@@ -36,8 +51,12 @@ export class RenderPipeline extends Resource {
36
51
  colorAttachmentFormats: undefined,
37
52
  depthStencilAttachmentFormat: undefined,
38
53
  parameters: {},
39
- bindings: {},
40
- uniforms: {}
54
+ varyings: undefined,
55
+ bufferMode: undefined,
56
+ disableWarnings: false,
57
+ _sharedRenderPipeline: undefined,
58
+ bindings: undefined,
59
+ bindGroups: undefined
41
60
  };
42
61
  }
43
62
  //# sourceMappingURL=render-pipeline.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"render-pipeline.js","sourceRoot":"","sources":["../../../src/adapter/resources/render-pipeline.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,+BAA+B;AAC/B,o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QACR,kBAAkB,EAAE,cAAc;QAClC,WAAW,EAAE,EAAE;QAEf,YAAY,EAAE,IAAI;QAClB,YAAY,EAAE,EAAE;QAChB,QAAQ,EAAE,eAAe;QAEzB,sBAAsB,EAAE,SAAU;QAClC,4BAA4B,EAAE,SAAU;QAExC,UAAU,EAAE,EAAE;QACd,QAAQ,EAAE,SAAU;QACpB,UAAU,EAAE,SAAU;QACtB,eAAe,EAAE,KAAK;QACtB,qBAAqB,EAAE,SAAU;QACjC,QAAQ,EAAE,SAAU;QACpB,UAAU,EAAE,SAAU;KACvB,CAAC"}
@@ -19,15 +19,22 @@ export declare abstract class Resource<Props extends ResourceProps> {
19
19
  toString(): string;
20
20
  /** props.id, for debugging. */
21
21
  id: string;
22
+ /** The props that this resource was created with */
22
23
  readonly props: Required<Props>;
24
+ /** User data object, reserved for the application */
23
25
  readonly userData: Record<string, unknown>;
26
+ /** The device that this resource is associated with */
24
27
  abstract readonly device: Device;
28
+ /** The handle for the underlying resource, e.g. WebGL object or WebGPU handle */
25
29
  abstract readonly handle: unknown;
30
+ /** The device that this resource is associated with - TODO can we remove this dup? */
26
31
  private _device;
27
32
  /** Whether this resource has been destroyed */
28
33
  destroyed: boolean;
29
34
  /** For resources that allocate GPU memory */
30
35
  private allocatedBytes;
36
+ /** Stats bucket currently holding the tracked allocation */
37
+ private allocatedBytesName;
31
38
  /** Attached resources will be destroyed when this resource is destroyed. Tracks auto-created "sub" resources. */
32
39
  private _attachedResources;
33
40
  /**
@@ -66,9 +73,15 @@ export declare abstract class Resource<Props extends ResourceProps> {
66
73
  protected removeStats(): void;
67
74
  /** Called by subclass to track memory allocations */
68
75
  protected trackAllocatedMemory(bytes: number, name?: string): void;
76
+ /** Called by subclass to track handle-backed memory allocations separately from owned allocations */
77
+ protected trackReferencedMemory(bytes: number, name?: string): void;
69
78
  /** Called by subclass to track memory deallocations */
70
79
  protected trackDeallocatedMemory(name?: string): void;
80
+ /** Called by subclass to deallocate handle-backed memory tracked via trackReferencedMemory() */
81
+ protected trackDeallocatedReferencedMemory(name?: string): void;
71
82
  /** Called by resource constructor to track object creation */
72
83
  private addStats;
84
+ /** Canonical resource name used for stats buckets. */
85
+ protected getStatsName(): string;
73
86
  }
74
87
  //# sourceMappingURL=resource.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"resource.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/resource.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,MAAM,EAAC,qBAAkB;AAGtC,MAAM,MAAM,aAAa,GAAG;IAC1B,sGAAsG;IACtG,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,0EAA0E;IAC1E,MAAM,CAAC,EAAE,GAAG,CAAC;IACb,kDAAkD;IAClD,QAAQ,CAAC,EAAE;QAAC,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KAAC,CAAC;CACjC,CAAC;AAEF;;GAEG;AACH,8BAAsB,QAAQ,CAAC,KAAK,SAAS,aAAa;IACxD,sCAAsC;IACtC,MAAM,CAAC,YAAY,EAAE,QAAQ,CAAC,aAAa,CAAC,CAI1C;IAEF,QAAQ,KAAK,CAAC,MAAM,CAAC,WAAW,CAAC,IAAI,MAAM,CAAC;IAE5C,QAAQ,IAAI,MAAM;IAIlB,+BAA+B;IAC/B,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC,KAAK,CAAC,CAAC;IAChC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAM;IAChD,QAAQ,CAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACjC,QAAQ,CAAC,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IAClC,OAAO,CAAC,OAAO,CAAS;IAExB,+CAA+C;IAC/C,SAAS,EAAE,OAAO,CAAS;IAC3B,6CAA6C;IAC7C,OAAO,CAAC,cAAc,CAAa;IACnC,iHAAiH;IACjH,OAAO,CAAC,k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