@flighthq/render-wgpu 0.5.1-next.973.788d3d7 → 0.6.0

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 (407) hide show
  1. package/README.md +2 -2
  2. package/dist/.tsbuildinfo.compressed-texture-decoder-contract +1 -0
  3. package/dist/.tsbuildinfo.contract +1 -0
  4. package/dist/.tsbuildinfo.runtime +1 -0
  5. package/dist/compressed-texture-decoder-contract/WgpuCompressedTextureDecoder.d.ts +3 -0
  6. package/dist/compressed-texture-decoder-contract/WgpuCompressedTextureDecoder.d.ts.map +1 -0
  7. package/dist/compressed-texture-decoder-contract/WgpuCompressedTextureDecoder.js +2 -0
  8. package/dist/compressed-texture-decoder-contract/WgpuCompressedTextureDecoder.js.map +1 -0
  9. package/dist/compressed-texture-decoder-contract/compressedTextureDecoderContract.d.ts +2 -0
  10. package/dist/compressed-texture-decoder-contract/compressedTextureDecoderContract.d.ts.map +1 -0
  11. package/dist/compressed-texture-decoder-contract/compressedTextureDecoderContract.js +2 -0
  12. package/dist/compressed-texture-decoder-contract/compressedTextureDecoderContract.js.map +1 -0
  13. package/dist/contract.d.ts +32 -34
  14. package/dist/contract.d.ts.map +1 -1
  15. package/dist/contract.js +32 -34
  16. package/dist/contract.js.map +1 -1
  17. package/dist/contract.render-wgpu-types.d.ts +55 -0
  18. package/dist/contract.render-wgpu-types.d.ts.map +1 -0
  19. package/dist/contract.render-wgpu-types.js +5 -0
  20. package/dist/contract.render-wgpu-types.js.map +1 -0
  21. package/dist/enableWgpuTextureResolverGuards.d.ts +3 -2
  22. package/dist/enableWgpuTextureResolverGuards.d.ts.map +1 -1
  23. package/dist/enableWgpuTextureResolverGuards.js +12 -9
  24. package/dist/enableWgpuTextureResolverGuards.js.map +1 -1
  25. package/dist/explainWgpuTextureResolution.d.ts +2 -1
  26. package/dist/explainWgpuTextureResolution.d.ts.map +1 -1
  27. package/dist/explainWgpuTextureResolution.js +2 -5
  28. package/dist/explainWgpuTextureResolution.js.map +1 -1
  29. package/dist/explainWgpuUniformEndianness.d.ts +3 -0
  30. package/dist/explainWgpuUniformEndianness.d.ts.map +1 -0
  31. package/dist/explainWgpuUniformEndianness.js +25 -0
  32. package/dist/explainWgpuUniformEndianness.js.map +1 -0
  33. package/dist/index.d.ts +20 -1
  34. package/dist/index.d.ts.map +1 -1
  35. package/dist/index.js +20 -1
  36. package/dist/index.js.map +1 -1
  37. package/dist/types/Host.d.ts +5 -0
  38. package/dist/types/Host.d.ts.map +1 -0
  39. package/dist/types/Host.js +2 -0
  40. package/dist/types/Host.js.map +1 -0
  41. package/dist/types/WgpuAdapter.d.ts +14 -0
  42. package/dist/types/WgpuAdapter.d.ts.map +1 -0
  43. package/dist/types/WgpuAdapter.js +2 -0
  44. package/dist/types/WgpuAdapter.js.map +1 -0
  45. package/dist/types/WgpuAdapterCapabilities.d.ts +7 -0
  46. package/dist/types/WgpuAdapterCapabilities.d.ts.map +1 -0
  47. package/dist/types/WgpuAdapterCapabilities.js +2 -0
  48. package/dist/types/WgpuAdapterCapabilities.js.map +1 -0
  49. package/dist/types/WgpuBindGroup.d.ts +23 -0
  50. package/dist/types/WgpuBindGroup.d.ts.map +1 -0
  51. package/dist/types/WgpuBindGroup.js +2 -0
  52. package/dist/types/WgpuBindGroup.js.map +1 -0
  53. package/dist/types/WgpuBindGroupLayout.d.ts +45 -0
  54. package/dist/types/WgpuBindGroupLayout.d.ts.map +1 -0
  55. package/dist/types/WgpuBindGroupLayout.js +7 -0
  56. package/dist/types/WgpuBindGroupLayout.js.map +1 -0
  57. package/dist/types/WgpuBuffer.d.ts +34 -0
  58. package/dist/types/WgpuBuffer.d.ts.map +1 -0
  59. package/dist/types/WgpuBuffer.js +19 -0
  60. package/dist/types/WgpuBuffer.js.map +1 -0
  61. package/dist/types/WgpuCanvasContext.d.ts +17 -0
  62. package/dist/types/WgpuCanvasContext.d.ts.map +1 -0
  63. package/dist/types/WgpuCanvasContext.js +2 -0
  64. package/dist/types/WgpuCanvasContext.js.map +1 -0
  65. package/dist/types/WgpuColorAdjustmentMaterialFeature.d.ts +14 -0
  66. package/dist/types/WgpuColorAdjustmentMaterialFeature.d.ts.map +1 -0
  67. package/dist/types/WgpuColorAdjustmentMaterialFeature.js +2 -0
  68. package/dist/types/WgpuColorAdjustmentMaterialFeature.js.map +1 -0
  69. package/dist/types/WgpuCommandBuffer.d.ts +5 -0
  70. package/dist/types/WgpuCommandBuffer.d.ts.map +1 -0
  71. package/dist/types/WgpuCommandBuffer.js +2 -0
  72. package/dist/types/WgpuCommandBuffer.js.map +1 -0
  73. package/dist/types/WgpuCommandEncoder.d.ts +12 -0
  74. package/dist/types/WgpuCommandEncoder.d.ts.map +1 -0
  75. package/dist/types/WgpuCommandEncoder.js +2 -0
  76. package/dist/types/WgpuCommandEncoder.js.map +1 -0
  77. package/dist/types/WgpuCompressedTextureSupport.d.ts +6 -0
  78. package/dist/types/WgpuCompressedTextureSupport.d.ts.map +1 -0
  79. package/dist/types/WgpuCompressedTextureSupport.js +2 -0
  80. package/dist/types/WgpuCompressedTextureSupport.js.map +1 -0
  81. package/dist/types/WgpuCompressedTextureUploader.d.ts +6 -0
  82. package/dist/types/WgpuCompressedTextureUploader.d.ts.map +1 -0
  83. package/dist/types/WgpuCompressedTextureUploader.js +2 -0
  84. package/dist/types/WgpuCompressedTextureUploader.js.map +1 -0
  85. package/dist/types/WgpuCustomMaterialShaderSource.d.ts +2 -0
  86. package/dist/types/WgpuCustomMaterialShaderSource.d.ts.map +1 -0
  87. package/dist/types/WgpuCustomMaterialShaderSource.js +2 -0
  88. package/dist/types/WgpuCustomMaterialShaderSource.js.map +1 -0
  89. package/dist/types/WgpuDevice.d.ts +76 -0
  90. package/dist/types/WgpuDevice.d.ts.map +1 -0
  91. package/dist/types/WgpuDevice.js +2 -0
  92. package/dist/types/WgpuDevice.js.map +1 -0
  93. package/dist/types/WgpuDeviceRuntime.d.ts +53 -0
  94. package/dist/types/WgpuDeviceRuntime.d.ts.map +1 -0
  95. package/dist/types/WgpuDeviceRuntime.js +2 -0
  96. package/dist/types/WgpuDeviceRuntime.js.map +1 -0
  97. package/dist/types/WgpuDeviceSignals.d.ts +6 -0
  98. package/dist/types/WgpuDeviceSignals.d.ts.map +1 -0
  99. package/dist/types/WgpuDeviceSignals.js +2 -0
  100. package/dist/types/WgpuDeviceSignals.js.map +1 -0
  101. package/dist/types/WgpuDeviceState.d.ts +7 -0
  102. package/dist/types/WgpuDeviceState.d.ts.map +1 -0
  103. package/dist/types/WgpuDeviceState.js +2 -0
  104. package/dist/types/WgpuDeviceState.js.map +1 -0
  105. package/dist/types/WgpuEffectState.d.ts +19 -0
  106. package/dist/types/WgpuEffectState.d.ts.map +1 -0
  107. package/dist/types/WgpuEffectState.js +2 -0
  108. package/dist/types/WgpuEffectState.js.map +1 -0
  109. package/dist/types/WgpuExternalImageSource.d.ts +18 -0
  110. package/dist/types/WgpuExternalImageSource.d.ts.map +1 -0
  111. package/dist/types/WgpuExternalImageSource.js +2 -0
  112. package/dist/types/WgpuExternalImageSource.js.map +1 -0
  113. package/dist/types/WgpuFullscreenPipeline.d.ts +14 -0
  114. package/dist/types/WgpuFullscreenPipeline.d.ts.map +1 -0
  115. package/dist/types/WgpuFullscreenPipeline.js +2 -0
  116. package/dist/types/WgpuFullscreenPipeline.js.map +1 -0
  117. package/dist/types/WgpuGpu.d.ts +7 -0
  118. package/dist/types/WgpuGpu.d.ts.map +1 -0
  119. package/dist/types/WgpuGpu.js +2 -0
  120. package/dist/types/WgpuGpu.js.map +1 -0
  121. package/dist/types/WgpuHost.d.ts +44 -0
  122. package/dist/types/WgpuHost.d.ts.map +1 -0
  123. package/dist/types/WgpuHost.js +2 -0
  124. package/dist/types/WgpuHost.js.map +1 -0
  125. package/dist/types/WgpuMeshMaterialRenderer.d.ts +11 -0
  126. package/dist/types/WgpuMeshMaterialRenderer.d.ts.map +1 -0
  127. package/dist/types/WgpuMeshMaterialRenderer.js +2 -0
  128. package/dist/types/WgpuMeshMaterialRenderer.js.map +1 -0
  129. package/dist/types/WgpuModifierSnippet.d.ts +16 -0
  130. package/dist/types/WgpuModifierSnippet.d.ts.map +1 -0
  131. package/dist/types/WgpuModifierSnippet.js +2 -0
  132. package/dist/types/WgpuModifierSnippet.js.map +1 -0
  133. package/dist/types/WgpuParticleResources.d.ts +12 -0
  134. package/dist/types/WgpuParticleResources.d.ts.map +1 -0
  135. package/dist/types/WgpuParticleResources.js +2 -0
  136. package/dist/types/WgpuParticleResources.js.map +1 -0
  137. package/dist/types/WgpuPipelineLayout.d.ts +8 -0
  138. package/dist/types/WgpuPipelineLayout.d.ts.map +1 -0
  139. package/dist/types/WgpuPipelineLayout.js +2 -0
  140. package/dist/types/WgpuPipelineLayout.js.map +1 -0
  141. package/dist/types/WgpuQuadBatchResources.d.ts +12 -0
  142. package/dist/types/WgpuQuadBatchResources.d.ts.map +1 -0
  143. package/dist/types/WgpuQuadBatchResources.js +2 -0
  144. package/dist/types/WgpuQuadBatchResources.js.map +1 -0
  145. package/dist/types/WgpuQuadMaterialRenderer.d.ts +9 -0
  146. package/dist/types/WgpuQuadMaterialRenderer.d.ts.map +1 -0
  147. package/dist/types/WgpuQuadMaterialRenderer.js +2 -0
  148. package/dist/types/WgpuQuadMaterialRenderer.js.map +1 -0
  149. package/dist/types/WgpuQueue.d.ts +12 -0
  150. package/dist/types/WgpuQueue.d.ts.map +1 -0
  151. package/dist/types/WgpuQueue.js +2 -0
  152. package/dist/types/WgpuQueue.js.map +1 -0
  153. package/dist/types/WgpuRenderOptions.d.ts +14 -0
  154. package/dist/types/WgpuRenderOptions.d.ts.map +1 -0
  155. package/dist/types/WgpuRenderOptions.js +2 -0
  156. package/dist/types/WgpuRenderOptions.js.map +1 -0
  157. package/dist/types/WgpuRenderPass.d.ts +31 -0
  158. package/dist/types/WgpuRenderPass.d.ts.map +1 -0
  159. package/dist/types/WgpuRenderPass.js +2 -0
  160. package/dist/types/WgpuRenderPass.js.map +1 -0
  161. package/dist/types/WgpuRenderPassEncoder.d.ts +52 -0
  162. package/dist/types/WgpuRenderPassEncoder.d.ts.map +1 -0
  163. package/dist/types/WgpuRenderPassEncoder.js +2 -0
  164. package/dist/types/WgpuRenderPassEncoder.js.map +1 -0
  165. package/dist/types/WgpuRenderPipeline.d.ts +96 -0
  166. package/dist/types/WgpuRenderPipeline.d.ts.map +1 -0
  167. package/dist/types/WgpuRenderPipeline.js +9 -0
  168. package/dist/types/WgpuRenderPipeline.js.map +1 -0
  169. package/dist/types/WgpuRenderState.d.ts +249 -0
  170. package/dist/types/WgpuRenderState.d.ts.map +1 -0
  171. package/dist/types/WgpuRenderState.js +2 -0
  172. package/dist/types/WgpuRenderState.js.map +1 -0
  173. package/dist/types/WgpuRenderStateOptions.d.ts +31 -0
  174. package/dist/types/WgpuRenderStateOptions.d.ts.map +1 -0
  175. package/dist/types/WgpuRenderStateOptions.js +2 -0
  176. package/dist/types/WgpuRenderStateOptions.js.map +1 -0
  177. package/dist/types/WgpuRenderTarget.d.ts +62 -0
  178. package/dist/types/WgpuRenderTarget.d.ts.map +1 -0
  179. package/dist/types/WgpuRenderTarget.js +2 -0
  180. package/dist/types/WgpuRenderTarget.js.map +1 -0
  181. package/dist/types/WgpuRenderTexture.d.ts +25 -0
  182. package/dist/types/WgpuRenderTexture.d.ts.map +1 -0
  183. package/dist/types/WgpuRenderTexture.js +2 -0
  184. package/dist/types/WgpuRenderTexture.js.map +1 -0
  185. package/dist/types/WgpuSampler.d.ts +19 -0
  186. package/dist/types/WgpuSampler.d.ts.map +1 -0
  187. package/dist/types/WgpuSampler.js +2 -0
  188. package/dist/types/WgpuSampler.js.map +1 -0
  189. package/dist/types/WgpuScene3DRuntime.d.ts +6 -0
  190. package/dist/types/WgpuScene3DRuntime.d.ts.map +1 -0
  191. package/dist/types/WgpuScene3DRuntime.js +2 -0
  192. package/dist/types/WgpuScene3DRuntime.js.map +1 -0
  193. package/dist/types/WgpuShaderModule.d.ts +6 -0
  194. package/dist/types/WgpuShaderModule.d.ts.map +1 -0
  195. package/dist/types/WgpuShaderModule.js +2 -0
  196. package/dist/types/WgpuShaderModule.js.map +1 -0
  197. package/dist/types/WgpuShapeMesh.d.ts +7 -0
  198. package/dist/types/WgpuShapeMesh.d.ts.map +1 -0
  199. package/dist/types/WgpuShapeMesh.js +2 -0
  200. package/dist/types/WgpuShapeMesh.js.map +1 -0
  201. package/dist/types/WgpuSkinningAdapter.d.ts +18 -0
  202. package/dist/types/WgpuSkinningAdapter.d.ts.map +1 -0
  203. package/dist/types/WgpuSkinningAdapter.js +2 -0
  204. package/dist/types/WgpuSkinningAdapter.js.map +1 -0
  205. package/dist/types/WgpuSurface.d.ts +5 -0
  206. package/dist/types/WgpuSurface.d.ts.map +1 -0
  207. package/dist/types/WgpuSurface.js +2 -0
  208. package/dist/types/WgpuSurface.js.map +1 -0
  209. package/dist/types/WgpuTexture.d.ts +58 -0
  210. package/dist/types/WgpuTexture.d.ts.map +1 -0
  211. package/dist/types/WgpuTexture.js +9 -0
  212. package/dist/types/WgpuTexture.js.map +1 -0
  213. package/dist/types/WgpuTextureFormat.d.ts +2 -0
  214. package/dist/types/WgpuTextureFormat.d.ts.map +1 -0
  215. package/dist/types/WgpuTextureFormat.js +2 -0
  216. package/dist/types/WgpuTextureFormat.js.map +1 -0
  217. package/dist/types/WgpuTextureResolver.d.ts +4 -0
  218. package/dist/types/WgpuTextureResolver.d.ts.map +1 -0
  219. package/dist/types/WgpuTextureResolver.js +2 -0
  220. package/dist/types/WgpuTextureResolver.js.map +1 -0
  221. package/dist/types/WgpuTextureView.d.ts +16 -0
  222. package/dist/types/WgpuTextureView.d.ts.map +1 -0
  223. package/dist/types/WgpuTextureView.js +2 -0
  224. package/dist/types/WgpuTextureView.js.map +1 -0
  225. package/dist/types/WgpuUniformEndianness.d.ts +7 -0
  226. package/dist/types/WgpuUniformEndianness.d.ts.map +1 -0
  227. package/dist/types/WgpuUniformEndianness.js +2 -0
  228. package/dist/types/WgpuUniformEndianness.js.map +1 -0
  229. package/dist/types/WgpuVelocityWriter.d.ts +11 -0
  230. package/dist/types/WgpuVelocityWriter.d.ts.map +1 -0
  231. package/dist/types/WgpuVelocityWriter.js +2 -0
  232. package/dist/types/WgpuVelocityWriter.js.map +1 -0
  233. package/dist/wgpuAdapterCapabilities.d.ts +2 -2
  234. package/dist/wgpuAdapterCapabilities.d.ts.map +1 -1
  235. package/dist/wgpuAdapterCapabilities.js.map +1 -1
  236. package/dist/wgpuCompressedTexture.d.ts +7 -5
  237. package/dist/wgpuCompressedTexture.d.ts.map +1 -1
  238. package/dist/wgpuCompressedTexture.js +10 -18
  239. package/dist/wgpuCompressedTexture.js.map +1 -1
  240. package/dist/wgpuDeviceLoss.d.ts +2 -2
  241. package/dist/wgpuDeviceLoss.d.ts.map +1 -1
  242. package/dist/wgpuDeviceLoss.js +1 -1
  243. package/dist/wgpuDeviceLoss.js.map +1 -1
  244. package/dist/wgpuDraw.d.ts +11 -5
  245. package/dist/wgpuDraw.d.ts.map +1 -1
  246. package/dist/wgpuDraw.js +21 -20
  247. package/dist/wgpuDraw.js.map +1 -1
  248. package/dist/wgpuExternalImageSource.d.ts +3 -2
  249. package/dist/wgpuExternalImageSource.d.ts.map +1 -1
  250. package/dist/wgpuExternalImageSource.js.map +1 -1
  251. package/dist/wgpuExternalTexture.d.ts +7 -3
  252. package/dist/wgpuExternalTexture.d.ts.map +1 -1
  253. package/dist/wgpuExternalTexture.js +5 -5
  254. package/dist/wgpuExternalTexture.js.map +1 -1
  255. package/dist/wgpuFrame.d.ts +23 -0
  256. package/dist/wgpuFrame.d.ts.map +1 -0
  257. package/dist/{wgpuBackground.js → wgpuFrame.js} +67 -122
  258. package/dist/wgpuFrame.js.map +1 -0
  259. package/dist/wgpuFullscreenPass.d.ts +5 -4
  260. package/dist/wgpuFullscreenPass.d.ts.map +1 -1
  261. package/dist/wgpuFullscreenPass.js +22 -8
  262. package/dist/wgpuFullscreenPass.js.map +1 -1
  263. package/dist/wgpuHost.d.ts +4 -7
  264. package/dist/wgpuHost.d.ts.map +1 -1
  265. package/dist/wgpuHost.js +81 -70
  266. package/dist/wgpuHost.js.map +1 -1
  267. package/dist/wgpuMipmap.d.ts +2 -2
  268. package/dist/wgpuMipmap.d.ts.map +1 -1
  269. package/dist/wgpuMipmap.js +4 -3
  270. package/dist/wgpuMipmap.js.map +1 -1
  271. package/dist/wgpuQuadMaterialRegistry.d.ts +7 -0
  272. package/dist/wgpuQuadMaterialRegistry.d.ts.map +1 -0
  273. package/dist/wgpuQuadMaterialRegistry.js +33 -0
  274. package/dist/wgpuQuadMaterialRegistry.js.map +1 -0
  275. package/dist/wgpuRenderPass.d.ts +9 -0
  276. package/dist/wgpuRenderPass.d.ts.map +1 -0
  277. package/dist/wgpuRenderPass.js +210 -0
  278. package/dist/wgpuRenderPass.js.map +1 -0
  279. package/dist/wgpuRenderState.d.ts +16 -12
  280. package/dist/wgpuRenderState.d.ts.map +1 -1
  281. package/dist/wgpuRenderState.js +104 -149
  282. package/dist/wgpuRenderState.js.map +1 -1
  283. package/dist/wgpuRenderTarget.d.ts +13 -29
  284. package/dist/wgpuRenderTarget.d.ts.map +1 -1
  285. package/dist/wgpuRenderTarget.js +20 -253
  286. package/dist/wgpuRenderTarget.js.map +1 -1
  287. package/dist/wgpuRenderTargetPool.d.ts +8 -6
  288. package/dist/wgpuRenderTargetPool.d.ts.map +1 -1
  289. package/dist/wgpuRenderTargetPool.js +9 -9
  290. package/dist/wgpuRenderTargetPool.js.map +1 -1
  291. package/dist/wgpuRenderTexture.d.ts +7 -4
  292. package/dist/wgpuRenderTexture.d.ts.map +1 -1
  293. package/dist/wgpuRenderTexture.js +15 -17
  294. package/dist/wgpuRenderTexture.js.map +1 -1
  295. package/dist/wgpuRenderTexturePool.d.ts +3 -1
  296. package/dist/wgpuRenderTexturePool.d.ts.map +1 -1
  297. package/dist/wgpuRenderTexturePool.js +5 -7
  298. package/dist/wgpuRenderTexturePool.js.map +1 -1
  299. package/dist/wgpuScissor.d.ts +3 -3
  300. package/dist/wgpuScissor.d.ts.map +1 -1
  301. package/dist/wgpuScissor.js +8 -5
  302. package/dist/wgpuScissor.js.map +1 -1
  303. package/dist/wgpuScreenAntialias.d.ts +3 -0
  304. package/dist/wgpuScreenAntialias.d.ts.map +1 -0
  305. package/dist/wgpuScreenAntialias.js +120 -0
  306. package/dist/wgpuScreenAntialias.js.map +1 -0
  307. package/dist/wgpuScreenCapture.d.ts +6 -0
  308. package/dist/wgpuScreenCapture.d.ts.map +1 -0
  309. package/dist/wgpuScreenCapture.js +138 -0
  310. package/dist/wgpuScreenCapture.js.map +1 -0
  311. package/dist/wgpuScreenRenderTarget.d.ts +11 -0
  312. package/dist/wgpuScreenRenderTarget.d.ts.map +1 -0
  313. package/dist/wgpuScreenRenderTarget.js +121 -0
  314. package/dist/wgpuScreenRenderTarget.js.map +1 -0
  315. package/dist/wgpuShader.d.ts +11 -8
  316. package/dist/wgpuShader.d.ts.map +1 -1
  317. package/dist/wgpuShader.js +11 -10
  318. package/dist/wgpuShader.js.map +1 -1
  319. package/dist/wgpuShaderBinding.d.ts +3 -1
  320. package/dist/wgpuShaderBinding.d.ts.map +1 -1
  321. package/dist/wgpuShaderBinding.js +1 -1
  322. package/dist/wgpuShaderBinding.js.map +1 -1
  323. package/dist/wgpuShaderRegistry.d.ts +1 -1
  324. package/dist/wgpuShaderRegistry.d.ts.map +1 -1
  325. package/dist/wgpuShaderRegistry.js +1 -1
  326. package/dist/wgpuShaderRegistry.js.map +1 -1
  327. package/dist/wgpuTestHelper.d.ts +11 -2
  328. package/dist/wgpuTestHelper.d.ts.map +1 -1
  329. package/dist/wgpuTestHelper.js +50 -38
  330. package/dist/wgpuTestHelper.js.map +1 -1
  331. package/dist/wgpuTextureRenderTarget.d.ts +22 -0
  332. package/dist/wgpuTextureRenderTarget.d.ts.map +1 -0
  333. package/dist/wgpuTextureRenderTarget.js +123 -0
  334. package/dist/wgpuTextureRenderTarget.js.map +1 -0
  335. package/dist/wgpuTextureResolver.d.ts +5 -1
  336. package/dist/wgpuTextureResolver.d.ts.map +1 -1
  337. package/dist/wgpuTextureResolver.js +13 -12
  338. package/dist/wgpuTextureResolver.js.map +1 -1
  339. package/dist/wgpuTextureUpload.d.ts +5 -4
  340. package/dist/wgpuTextureUpload.d.ts.map +1 -1
  341. package/dist/wgpuTextureUpload.js +1 -1
  342. package/dist/wgpuTextureUpload.js.map +1 -1
  343. package/package.json +33 -13
  344. package/src/enableWgpuTextureResolverGuards.test.ts +40 -19
  345. package/src/explainWgpuTextureResolution.test.ts +6 -6
  346. package/src/explainWgpuUniformEndianness.test.ts +11 -0
  347. package/src/types/WgpuBindGroupLayout.test.ts +9 -0
  348. package/src/types/WgpuBuffer.test.ts +26 -0
  349. package/src/types/WgpuGpu.test.ts +56 -0
  350. package/src/types/WgpuRenderPipeline.test.ts +12 -0
  351. package/src/types/WgpuTexture.test.ts +15 -0
  352. package/src/wgpuAdapterCapabilities.test.ts +5 -4
  353. package/src/wgpuCompressedTexture.test.ts +31 -37
  354. package/src/wgpuDeviceLoss.test.ts +31 -24
  355. package/src/wgpuDraw.test.ts +21 -24
  356. package/src/wgpuExternalImageSource.test.ts +12 -11
  357. package/src/wgpuExternalTexture.test.ts +7 -6
  358. package/src/{wgpuBackground.test.ts → wgpuFrame.test.ts} +47 -29
  359. package/src/wgpuFullscreenPass.test.ts +8 -8
  360. package/src/wgpuHost.test.ts +57 -186
  361. package/src/wgpuMipmap.test.ts +15 -9
  362. package/src/wgpuQuadMaterialRegistry.test.ts +132 -0
  363. package/src/wgpuRenderPass.test.ts +239 -0
  364. package/src/wgpuRenderState.test.ts +215 -550
  365. package/src/wgpuRenderTarget.test.ts +44 -220
  366. package/src/wgpuRenderTargetPool.test.ts +23 -23
  367. package/src/wgpuRenderTexture.test.ts +21 -18
  368. package/src/wgpuRenderTexturePool.test.ts +3 -3
  369. package/src/wgpuScissor.test.ts +50 -19
  370. package/src/wgpuScreenAntialias.test.ts +65 -0
  371. package/src/wgpuScreenCapture.test.ts +165 -0
  372. package/src/wgpuScreenRenderTarget.test.ts +172 -0
  373. package/src/wgpuShader.test.ts +12 -11
  374. package/src/wgpuShaderBinding.test.ts +4 -4
  375. package/src/wgpuShaderRegistry.test.ts +4 -5
  376. package/src/wgpuTestHelper.test.ts +8 -7
  377. package/src/wgpuTextureRenderTarget.test.ts +129 -0
  378. package/src/wgpuTextureResolver.test.ts +25 -14
  379. package/src/wgpuTextureUpload.test.ts +15 -10
  380. package/dist/wgpuAntialias.d.ts +0 -14
  381. package/dist/wgpuAntialias.d.ts.map +0 -1
  382. package/dist/wgpuAntialias.js +0 -155
  383. package/dist/wgpuAntialias.js.map +0 -1
  384. package/dist/wgpuBackground.d.ts +0 -20
  385. package/dist/wgpuBackground.d.ts.map +0 -1
  386. package/dist/wgpuBackground.js.map +0 -1
  387. package/dist/wgpuElement.d.ts +0 -7
  388. package/dist/wgpuElement.d.ts.map +0 -1
  389. package/dist/wgpuElement.js +0 -20
  390. package/dist/wgpuElement.js.map +0 -1
  391. package/dist/wgpuMaterialRegistry.d.ts +0 -5
  392. package/dist/wgpuMaterialRegistry.d.ts.map +0 -1
  393. package/dist/wgpuMaterialRegistry.js +0 -32
  394. package/dist/wgpuMaterialRegistry.js.map +0 -1
  395. package/dist/wgpuPipeline.d.ts +0 -6
  396. package/dist/wgpuPipeline.d.ts.map +0 -1
  397. package/dist/wgpuPipeline.js +0 -33
  398. package/dist/wgpuPipeline.js.map +0 -1
  399. package/dist/wgpuSurface.d.ts +0 -6
  400. package/dist/wgpuSurface.d.ts.map +0 -1
  401. package/dist/wgpuSurface.js +0 -155
  402. package/dist/wgpuSurface.js.map +0 -1
  403. package/src/wgpuAntialias.test.ts +0 -239
  404. package/src/wgpuElement.test.ts +0 -145
  405. package/src/wgpuMaterialRegistry.test.ts +0 -100
  406. package/src/wgpuPipeline.test.ts +0 -62
  407. package/src/wgpuSurface.test.ts +0 -141
@@ -1,30 +1,12 @@
1
- import { acquireWgpuSurfaceAntialiasView, clearWgpuSurfacePresentation, encodeWgpuSurfaceAntialiasResolve, } from './wgpuAntialias';
2
- import { getWgpuRenderStateRuntime } from './wgpuRenderState';
3
- import { acquireWgpuFrameCaptureTexture, encodeWgpuFrameCapture } from './wgpuSurface';
4
- function ensureWgpuDepthStencil(state, width, height) {
5
- const runtime = getWgpuRenderStateRuntime(state);
6
- if (runtime.depthStencilTexture !== null &&
7
- runtime.depthStencilWidth === width &&
8
- runtime.depthStencilHeight === height) {
9
- return;
10
- }
11
- runtime.depthStencilTexture?.destroy();
12
- const texture = state.device.createTexture({
13
- size: [Math.max(1, width), Math.max(1, height), 1],
14
- format: 'depth24plus-stencil8',
15
- usage: GPUTextureUsage.RENDER_ATTACHMENT,
16
- });
17
- runtime.depthStencilTexture = texture;
18
- runtime.depthStencilView = texture.createView();
19
- runtime.depthStencilWidth = width;
20
- runtime.depthStencilHeight = height;
21
- }
1
+ import { getWgpuRenderStateRuntime } from './wgpuRenderState.js';
2
+ import { endWgpuScreenRenderTargetFrame } from './wgpuScreenRenderTarget.js';
22
3
  /**
23
- * Opens the command encoder for a WebGPU frame without opening the canvas render pass.
4
+ * Opens the command encoder a frame records into, without opening any render pass.
24
5
  *
25
- * Recipes with prerequisite GPU work (for example a directional-shadow depth pass) call this first,
26
- * record that work, then call renderWgpuBackground to open the forward canvas pass on the same encoder.
27
- * Ordinary render loops can keep calling renderWgpuBackground directly; it begins a frame lazily.
6
+ * beginWgpuRenderPass calls this itself, and the pass that opened the frame submits it at end — so an
7
+ * ordinary render loop never names either function. Call it explicitly when several passes must land in
8
+ * ONE submit (a shadow depth pass before the screen pass): the frame is then yours, and you finish it
9
+ * with submitWgpuFrame.
28
10
  */
29
11
  export function beginWgpuFrame(state) {
30
12
  const runtime = getWgpuRenderStateRuntime(state);
@@ -37,64 +19,7 @@ export function beginWgpuFrame(state) {
37
19
  runtime.quadBatchWriterBufferCursor = 0;
38
20
  runtime.meshInstanceBufferCursor = 0;
39
21
  runtime.currentBlendMode = null;
40
- runtime.currentRenderTarget = null;
41
- runtime.currentMaskDepth = 0;
42
- runtime.maskWriteMode = false;
43
- runtime.currentScissorRect = null;
44
- runtime.scissorStack = [];
45
- }
46
- export function renderWgpuBackground(state) {
47
- const runtime = getWgpuRenderStateRuntime(state);
48
- // End any previous open pass (safety guard).
49
- if (runtime.renderPass !== null) {
50
- runtime.renderPass.end();
51
- runtime.renderPass = null;
52
- }
53
- // Preserve prerequisite work and its uniform-ring allocations when a recipe opened the frame
54
- // explicitly. The common path still creates and resets the frame here.
55
- beginWgpuFrame(state);
56
- const surface = state.surface;
57
- const context = state.context;
58
- const width = surface.width;
59
- const height = surface.height;
60
- // With frame capture on, render into an offscreen COPY_SRC texture instead of the swapchain: software/
61
- // headless adapters never present the swapchain and its texture reads back as zeros, so the readable
62
- // copy must be the render target itself.
63
- const presentationTexture = acquireWgpuFrameCaptureTexture(state) ?? context.getCurrentTexture();
64
- const presentationView = presentationTexture.createView();
65
- const antialiasView = acquireWgpuSurfaceAntialiasView(state, presentationView);
66
- const renderWidth = antialiasView === null ? width : width * 2;
67
- const renderHeight = antialiasView === null ? height : height * 2;
68
- ensureWgpuDepthStencil(state, renderWidth, renderHeight);
69
- const canvasView = antialiasView ?? presentationView;
70
- runtime.canvasTextureView = canvasView;
71
- runtime.canvasViewCleared = true;
72
- // The canvas (and the capture texture, when capture is on) is the canvas format; scene pipelines key on this.
73
- runtime.currentColorFormat = state.format;
74
- runtime.renderTargetViewport = null;
75
- const rgba = state.backgroundColorRgba;
76
- const clearValue = rgba.length >= 4 && rgba[3] > 0 ? { r: rgba[0], g: rgba[1], b: rgba[2], a: rgba[3] } : { r: 0, g: 0, b: 0, a: 0 };
77
- const renderPass = runtime.commandEncoder.beginRenderPass({
78
- colorAttachments: [
79
- {
80
- view: canvasView,
81
- clearValue,
82
- loadOp: 'clear',
83
- storeOp: 'store',
84
- },
85
- ],
86
- depthStencilAttachment: {
87
- view: runtime.depthStencilView,
88
- depthClearValue: 1.0,
89
- depthLoadOp: 'clear',
90
- depthStoreOp: 'discard',
91
- stencilClearValue: 0,
92
- stencilLoadOp: 'clear',
93
- stencilStoreOp: 'discard',
94
- },
95
- });
96
- renderPass.setViewport(0, 0, renderWidth, renderHeight, 0, 1);
97
- runtime.renderPass = renderPass;
22
+ runtime.frameScreenTarget = null;
98
23
  }
99
24
  // Hands a buffer to the post-submit retirement list instead of destroying it now — the buffer sibling of
100
25
  // retireWgpuTexture below, and subject to the same rule for the same reason: a frame records into one
@@ -112,34 +37,38 @@ export function retireWgpuBuffer(state, buffer) {
112
37
  // submit, and the symptom is an ENTIRELY BLANK FRAME with a console warning naming a texture rather than
113
38
  // a call site — a cost-to-diagnose far out of proportion to the one line that causes it. Callers that
114
39
  // replace a texture during recording (a grown palette arena, a resized rasterization cache, a cache entry
115
- // rewritten on a payload version bump) retire it here; submitWgpuRenderPass frees it once the frame is
40
+ // rewritten on a payload version bump) retire it here; submitWgpuFrame frees it once the frame is
116
41
  // safely on the queue.
117
42
  export function retireWgpuTexture(state, texture) {
118
43
  const runtime = getWgpuRenderStateRuntime(state);
119
44
  (runtime.retiredTextures ?? (runtime.retiredTextures = [])).push(texture);
120
45
  }
121
- export function submitWgpuRenderPass(state) {
46
+ // Finishes the frame: uploads the used part of the uniform ring, resolves a supersampled screen target,
47
+ // encodes its capture copy, and submits the command buffer. The pass that opened the frame calls this at
48
+ // its end, so an ordinary render loop never names it; a caller that opened the frame with beginWgpuFrame
49
+ // finishes it here.
50
+ export function submitWgpuFrame(state) {
122
51
  const runtime = getWgpuRenderStateRuntime(state);
123
- const { renderPass, commandEncoder, uniformBuffer, uniformData, uniformOffset } = runtime;
52
+ const { commandEncoder, uniformBuffer, uniformData, uniformOffset } = runtime;
124
53
  const device = state.device;
125
- if (renderPass !== null) {
126
- renderPass.end();
127
- runtime.renderPass = null;
128
- }
54
+ endWgpuFramePasses(state);
55
+ const screen = runtime.frameScreenTarget;
129
56
  if (commandEncoder !== null) {
130
57
  // Upload used portion of the uniform ring buffer before submission.
131
58
  // writeBuffer is a queue operation that completes before the subsequent submit.
132
59
  if (uniformOffset > 0) {
133
60
  device.queue.writeBuffer(uniformBuffer, 0, uniformData.buffer, 0, uniformOffset);
134
61
  }
135
- // Resolve the optional 2× main surface into the presentation target before capture reads it back.
136
- encodeWgpuSurfaceAntialiasResolve(state, commandEncoder);
137
- // Copy the offscreen capture texture into the readback buffer within this frame's encoder; on the
138
- // adapters capture exists for, GPU work queued in a later task does not land.
139
- // A standalone offscreen frame (for example a render-cache bake) has no canvas view and must not
62
+ // A frame that only drew into texture targets has no screen to resolve or capture, and must not
140
63
  // overwrite the capture buffer with the previous visible frame's retained capture texture.
141
- if (runtime.canvasTextureView !== null)
142
- encodeWgpuFrameCapture(state, commandEncoder);
64
+ if (screen !== null) {
65
+ // Resolve the optional 2x supersample into the presentation view before capture reads it back, then
66
+ // copy the capture texture into the readback buffer within this frame's encoder — on the adapters
67
+ // capture exists for, GPU work queued in a later task does not land. Both arrive as slots the
68
+ // opt-in modules install, so a frame that uses neither pulls in neither.
69
+ screen.encodeAntialiasResolve?.(state, screen, commandEncoder);
70
+ screen.encodeCapture?.(screen, commandEncoder);
71
+ }
143
72
  device.queue.submit([commandEncoder.finish()]);
144
73
  runtime.commandEncoder = null;
145
74
  // Now that the frame is submitted, free the buffers retired mid-frame (clip pops, grown particle
@@ -157,14 +86,17 @@ export function submitWgpuRenderPass(state) {
157
86
  retiredTextures.length = 0;
158
87
  }
159
88
  }
160
- runtime.canvasTextureView = null;
161
- runtime.canvasViewCleared = false;
162
- clearWgpuSurfacePresentation(state);
89
+ if (screen !== null)
90
+ endWgpuScreenRenderTargetFrame(screen);
91
+ runtime.frameScreenTarget = null;
163
92
  }
164
93
  /**
165
- * Temporarily records an offscreen state's work into a presentation state's live command encoder.
94
+ * Temporarily records an offscreen state's work into another state's live command encoder.
166
95
  * The borrower keeps its own uniform ring, batch buffers, traversal counters, and GPU resources; only
167
96
  * the frame encoder/pass boundary is borrowed, and this callback bracket always returns it.
97
+ *
98
+ * The open pass stack is borrowed by reference, so a pass the borrower opens suspends and resumes the
99
+ * owner's innermost pass exactly as one opened on the owner would.
168
100
  */
169
101
  export function withWgpuFrameBorrow(ownerState, borrowerState, callback) {
170
102
  if (borrowerState.device !== ownerState.device) {
@@ -180,16 +112,12 @@ export function withWgpuFrameBorrow(ownerState, borrowerState, callback) {
180
112
  const saved = captureBorrowerFrameState(borrower);
181
113
  borrower.commandEncoder = owner.commandEncoder;
182
114
  borrower.renderPass = owner.renderPass;
183
- borrower.canvasTextureView = owner.canvasTextureView;
184
- borrower.canvasViewCleared = owner.canvasViewCleared;
185
- borrower.depthStencilTexture = owner.depthStencilTexture;
186
- borrower.depthStencilView = owner.depthStencilView;
187
- borrower.depthStencilWidth = owner.depthStencilWidth;
188
- borrower.depthStencilHeight = owner.depthStencilHeight;
115
+ borrower.frameScreenTarget = owner.frameScreenTarget;
116
+ borrower.passStack = owner.passStack;
189
117
  borrower.currentColorFormat = owner.currentColorFormat;
190
118
  borrower.currentRenderTarget = owner.currentRenderTarget;
191
119
  borrower.renderTargetViewport = owner.renderTargetViewport;
192
- borrower.borrowedSurfaceExtent = { height: ownerState.surface.height, width: ownerState.surface.width };
120
+ borrower.borrowedSurfaceExtent = owner.renderTargetViewport;
193
121
  borrower.uniformOffset = 0;
194
122
  borrower.quadBatchWriterBufferCursor = 0;
195
123
  borrower.meshInstanceBufferCursor = 0;
@@ -202,33 +130,50 @@ export function withWgpuFrameBorrow(ownerState, borrowerState, callback) {
202
130
  }
203
131
  owner.commandEncoder = borrower.commandEncoder;
204
132
  owner.renderPass = borrower.renderPass;
205
- owner.canvasTextureView = borrower.canvasTextureView;
206
- owner.canvasViewCleared = borrower.canvasViewCleared;
207
- owner.depthStencilTexture = borrower.depthStencilTexture;
208
- owner.depthStencilView = borrower.depthStencilView;
209
- owner.depthStencilWidth = borrower.depthStencilWidth;
210
- owner.depthStencilHeight = borrower.depthStencilHeight;
133
+ owner.frameScreenTarget = borrower.frameScreenTarget;
211
134
  owner.currentColorFormat = borrower.currentColorFormat;
212
135
  owner.currentRenderTarget = borrower.currentRenderTarget;
213
136
  owner.renderTargetViewport = borrower.renderTargetViewport;
214
137
  transferRetiredWgpuResources(borrower, owner);
215
138
  restoreBorrowerFrameState(borrower, saved);
216
139
  if (ownsFrame)
217
- submitWgpuRenderPass(ownerState);
140
+ submitWgpuFrame(ownerState);
141
+ }
142
+ }
143
+ // A frame submit closes everything the frame recorded. A pass still open here is a caller that never
144
+ // ended its bracket — the encoder cannot survive into the next frame, so the stack is unwound to the
145
+ // state the outermost begin saved. Those handles are dropped rather than pooled: this is the abnormal
146
+ // path, and returning a handle the caller may still be holding is worse than letting one be collected.
147
+ function endWgpuFramePasses(state) {
148
+ const runtime = getWgpuRenderStateRuntime(state);
149
+ const stack = runtime.passStack;
150
+ if (runtime.renderPass !== null) {
151
+ runtime.renderPass.end();
152
+ runtime.renderPass = null;
218
153
  }
154
+ if (stack.length === 0)
155
+ return;
156
+ for (let i = stack.length - 1; i >= 0; i--)
157
+ stack[i].encoder = null;
158
+ const saved = stack[0].saved;
159
+ runtime.currentRenderTarget = saved.renderTarget;
160
+ runtime.currentColorFormat = saved.colorFormat;
161
+ runtime.renderTargetViewport = saved.renderTargetViewport;
162
+ runtime.clipForms = saved.clipForms;
163
+ runtime.currentMaskDepth = saved.currentMaskDepth;
164
+ runtime.maskWriteMode = saved.maskWriteMode;
165
+ runtime.currentScissorRect = saved.currentScissorRect;
166
+ runtime.scissorStack = saved.scissorStack;
167
+ stack.length = 0;
219
168
  }
220
169
  function captureBorrowerFrameState(runtime) {
221
170
  return {
222
- canvasTextureView: runtime.canvasTextureView,
223
- canvasViewCleared: runtime.canvasViewCleared,
224
171
  borrowedSurfaceExtent: runtime.borrowedSurfaceExtent,
225
172
  commandEncoder: runtime.commandEncoder,
226
173
  currentColorFormat: runtime.currentColorFormat,
227
174
  currentRenderTarget: runtime.currentRenderTarget,
228
- depthStencilHeight: runtime.depthStencilHeight,
229
- depthStencilTexture: runtime.depthStencilTexture,
230
- depthStencilView: runtime.depthStencilView,
231
- depthStencilWidth: runtime.depthStencilWidth,
175
+ frameScreenTarget: runtime.frameScreenTarget,
176
+ passStack: runtime.passStack,
232
177
  renderPass: runtime.renderPass,
233
178
  renderTargetViewport: runtime.renderTargetViewport,
234
179
  };
@@ -246,4 +191,4 @@ function transferRetiredWgpuResources(borrower, owner) {
246
191
  borrower.retiredTextures.length = 0;
247
192
  }
248
193
  }
249
- //# sourceMappingURL=wgpuBackground.js.map
194
+ //# sourceMappingURL=wgpuFrame.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wgpuFrame.js","sourceRoot":"","sources":["../src/wgpuFrame.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAC;AACjE,OAAO,EAAE,8BAA8B,EAAE,MAAM,6BAA6B,CAAC;AAE7E;;;;;;;GAOG;AACH,MAAM,UAAU,cAAc,CAAC,KAAsB;IACnD,MAAM,OAAO,GAAG,yBAAyB,CAAC,KAAK,CAAC,CAAC;IACjD,IAAI,OAAO,CAAC,cAAc,KAAK,IAAI;QAAE,OAAO;IAE5C,OAAO,CAAC,cAAc,GAAG,KAAK,CAAC,MAAM,CAAC,oBAAoB,EAAE,CAAC;IAC7D,OAAO,CAAC,aAAa,GAAG,CAAC,CAAC;IAC1B,sGAAsG;IACtG,8CAA8C;IAC9C,OAAO,CAAC,2BAA2B,GAAG,CAAC,CAAC;IACxC,OAAO,CAAC,wBAAwB,GAAG,CAAC,CAAC;IACrC,OAAO,CAAC,gBAAgB,GAAG,IAAI,CAAC;IAChC,OAAO,CAAC,iBAAiB,GAAG,IAAI,CAAC;AACnC,CAAC;AAED,yGAAyG;AACzG,sGAAsG;AACtG,2GAA2G;AAC3G,sEAAsE;AACtE,MAAM,UAAU,gBAAgB,CAAC,KAAsB,EAAE,MAAkB;IACzE,MAAM,OAAO,GAAG,yBAAyB,CAAC,KAAK,CAAC,CAAC;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cAAc,KAAK,SAAS,IAAI,QAAQ,CAAC,cAAc,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAChF,CAAC,KAAK,CAAC,cAAc,IAAI,CAAC,KAAK,CAAC,cAAc,GAAG,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC,cAAc,CAAC,CAAC;QACvF,QAAQ,CAAC,cAAc,CAAC,MAAM,GAAG,CAAC,CAAC;IACrC,CAAC;IACD,IAAI,QAAQ,CAAC,eAAe,KAAK,SAAS,IAAI,QAAQ,CAAC,eAAe,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAClF,CAAC,KAAK,CAAC,eAAe,IAAI,CAAC,KAAK,CAAC,eAAe,GAAG,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC,eAAe,CAAC,CAAC;QAC1F,QAAQ,CAAC,eAAe,CAAC,MAAM,GAAG,CAAC,CAAC;IACtC,CAAC;AACH,CAAC"}
@@ -1,6 +1,7 @@
1
- import type { EntityConstruction, WgpuFullscreenPipeline, WgpuRenderState, WgpuRenderTarget } from '@flighthq/types/contract';
2
- export declare function createWgpuFullscreenPipeline(state: WgpuRenderState, fragmentWgsl: string, textureInputCount?: number, format?: GPUTextureFormat): WgpuFullscreenPipeline;
1
+ import type { EntityConstruction } from '@flighthq/entity/contract';
2
+ import type { WgpuBindGroup, WgpuBindGroupLayout, WgpuFullscreenPipeline, WgpuRenderState, WgpuTextureFormat, WgpuTextureRenderTarget } from './contract.render-wgpu-types.ts';
3
+ export declare function createWgpuFullscreenPipeline(state: WgpuRenderState, fragmentWgsl: string, textureInputCount?: number, format?: WgpuTextureFormat): WgpuFullscreenPipeline;
3
4
  export declare function destroyWgpuFullscreenPipeline(_state: WgpuRenderState, _pipeline: WgpuFullscreenPipeline): void;
4
- export declare function drawWgpuFullscreenPass(state: WgpuRenderState, wgpuPipeline: Readonly<WgpuFullscreenPipeline>, inputs: ReadonlyArray<Readonly<WgpuRenderTarget>>, setUniforms: ((state: WgpuRenderState, uniformBindGroupLayout: GPUBindGroupLayout) => GPUBindGroup) | null): void;
5
- export declare function initializeWgpuFullscreenPipeline(out: EntityConstruction<WgpuFullscreenPipeline>, state: WgpuRenderState, fragmentWgsl: string, textureInputCount?: number, format?: GPUTextureFormat): void;
5
+ export declare function drawWgpuFullscreenPass(state: WgpuRenderState, wgpuPipeline: Readonly<WgpuFullscreenPipeline>, inputs: ReadonlyArray<Readonly<WgpuTextureRenderTarget>>, setUniforms: ((state: WgpuRenderState, uniformBindGroupLayout: WgpuBindGroupLayout) => WgpuBindGroup) | null): void;
6
+ export declare function initializeWgpuFullscreenPipeline(out: EntityConstruction<WgpuFullscreenPipeline>, state: WgpuRenderState, fragmentWgsl: string, textureInputCount?: number, format?: WgpuTextureFormat): void;
6
7
  //# sourceMappingURL=wgpuFullscreenPass.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"wgpuFullscreenPass.d.ts","sourceRoot":"","sources":["../src/wgpuFullscreenPass.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,kBAAkB,EAClB,sBAAsB,EACtB,eAAe,EACf,gBAAgB,EACjB,MAAM,0BAA0B,CAAC;AAIlC,wBAAgB,4BAA4B,CAC1C,KAAK,EAAE,eAAe,EACtB,YAAY,EAAE,MAAM,EACpB,iBAAiB,SAAI,EACrB,MAAM,GAAE,gBAA+B,GACtC,sBAAsB,CAIxB;AAKD,wBAAgB,6BAA6B,CAAC,MAAM,EAAE,eAAe,EAAE,SAAS,EAAE,sBAAsB,GAAG,IAAI,CAG9G;AAQD,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,eAAe,EACtB,YAAY,EAAE,QAAQ,CAAC,sBAAsB,CAAC,EAC9C,MAAM,EAAE,aAAa,CAAC,QAAQ,CAAC,gBAAgB,CAAC,CAAC,EACjD,WAAW,EAAE,CAAC,CAAC,KAAK,EAAE,eAAe,EAAE,sBAAsB,EAAE,kBAAkB,KAAK,YAAY,CAAC,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, finishEntity } from '@flighthq/entity/contract';
2
- import { getWgpuRenderStateRuntime } from './wgpuRenderState';
1
+ import { allocateEntity } from '@flighthq/entity/contract';
2
+ import { WgpuBufferUsage, WgpuShaderStage } from './contract.render-wgpu-types.js';
3
+ import { getWgpuRenderStateRuntime } from './wgpuRenderState.js';
3
4
  export function createWgpuFullscreenPipeline(state, fragmentWgsl, textureInputCount = 1, format = state.format) {
4
5
  const out = allocateEntity();
5
6
  initializeWgpuFullscreenPipeline(out, state, fragmentWgsl, textureInputCount, format);
6
- return finishEntity(out);
7
+ return out;
7
8
  }
8
9
  // Destroys a fullscreen pipeline's GPU resources. The pipeline and layouts are GC-managed in
9
10
  // WebGPU and have no explicit destroy(); this function is a no-op but kept for API symmetry with
@@ -16,8 +17,7 @@ export function destroyWgpuFullscreenPipeline(_state, _pipeline) {
16
17
  // @group(1+i) @binding(0), calls `setUniforms` for per-pass uploads (pass null if the shader
17
18
  // declares no uniforms), then draws 3 vertices.
18
19
  //
19
- // Requires an open render pass (renderWgpuBackground or beginWgpuRenderPass must have been
20
- // called first). The destination is fixed when the caller opens the render pass.
20
+ // Requires an open render pass: beginWgpuRenderPass fixes the destination, and this draws into it.
21
21
  export function drawWgpuFullscreenPass(state, wgpuPipeline, inputs, setUniforms) {
22
22
  const runtime = getWgpuRenderStateRuntime(state);
23
23
  const pass = runtime.renderPass;
@@ -29,6 +29,9 @@ export function drawWgpuFullscreenPass(state, wgpuPipeline, inputs, setUniforms)
29
29
  const uniformBindGroup = setUniforms(state, wgpuPipeline.uniformBindGroupLayout);
30
30
  pass.setBindGroup(0, uniformBindGroup);
31
31
  }
32
+ else {
33
+ pass.setBindGroup(0, wgpuPipeline.emptyUniformBindGroup);
34
+ }
32
35
  for (let i = 0; i < inputs.length; i++) {
33
36
  const input = inputs[i];
34
37
  const layout = wgpuPipeline.textureBindGroupLayouts[i];
@@ -57,7 +60,7 @@ export function initializeWgpuFullscreenPipeline(out, state, fragmentWgsl, textu
57
60
  entries: [
58
61
  {
59
62
  binding: 0,
60
- visibility: GPUShaderStage.FRAGMENT,
63
+ visibility: WgpuShaderStage.FRAGMENT,
61
64
  buffer: { type: 'uniform' },
62
65
  },
63
66
  ],
@@ -66,8 +69,8 @@ export function initializeWgpuFullscreenPipeline(out, state, fragmentWgsl, textu
66
69
  for (let i = 0; i < textureInputCount; i++) {
67
70
  textureBindGroupLayouts.push(device.createBindGroupLayout({
68
71
  entries: [
69
- { binding: 0, visibility: GPUShaderStage.FRAGMENT, texture: { sampleType: 'float' } },
70
- { binding: 1, visibility: GPUShaderStage.FRAGMENT, sampler: { type: 'filtering' } },
72
+ { binding: 0, visibility: WgpuShaderStage.FRAGMENT, texture: { sampleType: 'float' } },
73
+ { binding: 1, visibility: WgpuShaderStage.FRAGMENT, sampler: { type: 'filtering' } },
71
74
  ],
72
75
  }));
73
76
  }
@@ -85,11 +88,22 @@ export function initializeWgpuFullscreenPipeline(out, state, fragmentWgsl, textu
85
88
  targets: [{ format }],
86
89
  },
87
90
  primitive: { topology: 'triangle-list' },
91
+ depthStencil: {
92
+ format: 'depth24plus-stencil8',
93
+ depthWriteEnabled: false,
94
+ depthCompare: 'always',
95
+ stencilWriteMask: 0,
96
+ },
97
+ });
98
+ const emptyUniformBindGroup = device.createBindGroup({
99
+ layout: uniformBindGroupLayout,
100
+ entries: [{ binding: 0, resource: { buffer: device.createBuffer({ size: 16, usage: WgpuBufferUsage.UNIFORM }) } }],
88
101
  });
89
102
  out.pipeline = pipeline;
90
103
  out.pipelineLayout = pipelineLayout;
91
104
  out.uniformBindGroupLayout = uniformBindGroupLayout;
92
105
  out.textureBindGroupLayouts = textureBindGroupLayouts;
106
+ out.emptyUniformBindGroup = emptyUniformBindGroup;
93
107
  }
94
108
  // The substrate-level WebGPU fullscreen-pass primitive. Filter and effect leaf packages draw
95
109
  // through this; it is not filter-specific.
@@ -1 +1 @@
1
- {"version":3,"file":"wgpuFullscreenPass.js","sourceRoot":"","sources":["../src/wgpuFullscreenPass.ts"],"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9D,EAAE;AACF,yFAAyF;AACzF,iGAAiG;AACjG,oEAAoE;AACpE,MAAM,sBAAsB,GAAG,UAAU,CAAC;;;;;;;;CAQzC,CAAC"}
@@ -1,8 +1,5 @@
1
- import type { EntityConstruction, WgpuHostBackend } from '@flighthq/types/contract';
2
- export declare function createWebWgpuHostBackend(): WgpuHostBackend;
3
- export declare function getWgpuHostBackend(): WgpuHostBackend;
4
- export declare function initializeWebWgpuHostBackend(out: EntityConstruction<WgpuHostBackend>): void;
5
- export declare function installWgpuHostBackend(backend: WgpuHostBackend): void;
6
- export declare function resetWgpuHostBackendForTest(): void;
7
- export declare function setWgpuHostBackend(backend: WgpuHostBackend | null): void;
1
+ import type { Surface } from '@flighthq/surface/contract';
2
+ import type { HostWgpuCapability } from './contract.render-wgpu-types.ts';
3
+ export declare function createTestWgpuSurface(canvas: HTMLCanvasElement): Surface;
4
+ export declare const testWgpuHost: HostWgpuCapability;
8
5
  //# sourceMappingURL=wgpuHost.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"wgpuHost.d.ts","sourceRoot":"","sources":["../src/wgpuHost.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAuB,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAIzG,wBAAgB,wBAAwB,IAAI,eAAe,CAI1D;AAED,wBAAgB,kBAAkB,IAAI,eAAe,CAEpD;AAED,wBAAgB,4BAA4B,CAAC,GAAG,EAAE,kBAAkB,CAAC,eAAe,CAAC,GAAG,IAAI,CA+C3F;AAGD,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,eAAe,GAAG,IAAI,CAErE;AAED,wBAAgB,2BAA2B,IAAI,IAAI,CAGlD;AAID,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,eAAe,GAAG,IAAI,GAAG,IAAI,CAExE"}
1
+ {"version":3,"file":"wgpuHost.d.ts","sourceRoot":"","sources":["../src/wgpuHost.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAuB,OAAO,EAAkB,MAAM,4BAA4B,CAAC;AAE/F,OAAO,KAAK,EACV,kBAAkB,EAOnB,MAAM,iCAAiC,CAAC;AAKzC,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,iBAAiB,GAAG,OAAO,CAMxE;AAED,eAAO,MAAM,YAAY,EAAE,kBAA6C,CAAC"}
package/dist/wgpuHost.js CHANGED
@@ -1,75 +1,89 @@
1
- import { allocateEntity, finishEntity } from '@flighthq/entity/contract';
2
- // The explicit browser adapter. All WebGPU discovery and host-handle acquisition stays in this
3
- // function's call graph so render-state creation can also consume native caller-provided handles.
4
- export function createWebWgpuHostBackend() {
5
- const out = allocateEntity();
6
- initializeWebWgpuHostBackend(out);
7
- return finishEntity(out);
1
+ import { allocateEntity, createEntityRuntime } from '@flighthq/entity/contract';
2
+ import { EntityRuntimeKey } from '@flighthq/entity/contract';
3
+ import { WgpuTextureUsage } from './contract.render-wgpu-types.js';
4
+ // Builds a Surface around an existing canvas, the way a host's create lane would. Reads the runtime slot
5
+ // directly rather than through @flighthq/surface so this test double adds no package dependency.
6
+ export function createTestWgpuSurface(canvas) {
7
+ const surface = allocateEntity();
8
+ const runtime = createEntityRuntime();
9
+ runtime.handle = canvas;
10
+ surface[EntityRuntimeKey] = runtime;
11
+ return surface;
8
12
  }
9
- export function getWgpuHostBackend() {
10
- return _custom ?? _host ?? _web;
11
- }
12
- export function initializeWebWgpuHostBackend(out) {
13
- out.acquire = async (canvas, options) => {
14
- const gpu = getWebWgpu();
15
- if (gpu === null)
16
- throw new Error('WebGPU is not supported in this browser.');
17
- const adapter = await gpu.requestAdapter(options.powerPreference !== undefined ? { powerPreference: options.powerPreference } : undefined);
18
- if (adapter === null)
19
- throw new Error('Failed to get WebGPU adapter.');
20
- // The forward-lit 3D pipeline binds 5 groups (Frame, Draw, Material, Shadow, Ibl); request 5
21
- // only when the adapter advertises it so baseline-4 adapters retain the portable paths.
22
- const requiredLimits = {};
23
- if (adapter.limits.maxBindGroups >= 5)
24
- requiredLimits.maxBindGroups = 5;
25
- // Compression features have to be enabled when the device is created. Unsupported families
26
- // retain their CPU decode fallback.
27
- const requiredFeatures = ['texture-compression-bc', 'texture-compression-etc2', 'texture-compression-astc'].filter((feature) => adapter.features.has(feature));
28
- const descriptor = {};
29
- if (Object.keys(requiredLimits).length > 0)
30
- descriptor.requiredLimits = requiredLimits;
31
- if (requiredFeatures.length > 0)
32
- descriptor.requiredFeatures = requiredFeatures;
33
- const device = await adapter.requestDevice(descriptor);
34
- try {
35
- const format = options.format ?? gpu.getPreferredCanvasFormat();
13
+ export const testWgpuHost = initializeTestWgpuHost();
14
+ function initializeTestWgpuHost() {
15
+ return {
16
+ create: (_window, width, height) => {
17
+ const canvas = document.createElement('canvas');
18
+ canvas.width = width;
19
+ canvas.height = height;
20
+ return canvas;
21
+ },
22
+ acquire: async (surface, options) => {
23
+ const canvas = testCanvas(surface);
24
+ if (canvas === null)
25
+ throw new Error('Test surface is not backed by a canvas.');
26
+ const gpu = getWebWgpu();
27
+ if (gpu === null)
28
+ throw new Error('WebGPU is not supported in this browser.');
29
+ const adapter = await gpu.requestAdapter(options.powerPreference !== undefined ? { powerPreference: options.powerPreference } : undefined);
30
+ if (adapter === null)
31
+ throw new Error('Failed to get WebGPU adapter.');
32
+ const requiredLimits = {};
33
+ if (adapter.limits.maxBindGroups >= 5)
34
+ requiredLimits.maxBindGroups = 5;
35
+ const requiredFeatures = ['texture-compression-bc', 'texture-compression-etc2', 'texture-compression-astc'].filter((feature) => adapter.features.has(feature));
36
+ const descriptor = {};
37
+ if (Object.keys(requiredLimits).length > 0)
38
+ descriptor.requiredLimits = requiredLimits;
39
+ if (requiredFeatures.length > 0)
40
+ descriptor.requiredFeatures = requiredFeatures;
41
+ const device = await adapter.requestDevice(descriptor);
42
+ try {
43
+ const format = options.format ?? gpu.getPreferredCanvasFormat();
44
+ const context = canvas.getContext('webgpu');
45
+ if (context === null)
46
+ throw new Error('Failed to get WebGPU canvas context.');
47
+ const acquisition = allocateEntity();
48
+ acquisition.context = context;
49
+ acquisition.device = device;
50
+ acquisition.format = format;
51
+ acquisition.ownership = 'flight';
52
+ acquisition.surface = canvas;
53
+ return acquisition;
54
+ }
55
+ catch (error) {
56
+ device.destroy();
57
+ throw error;
58
+ }
59
+ },
60
+ attachSurface: (surface, attachment) => {
61
+ const canvas = testCanvas(surface);
62
+ if (canvas === null)
63
+ return null;
36
64
  const context = canvas.getContext('webgpu');
37
65
  if (context === null)
38
- throw new Error('Failed to get WebGPU canvas context.');
39
- const acquisition = allocateEntity();
40
- acquisition.context = context;
41
- acquisition.device = device;
42
- acquisition.format = format;
43
- acquisition.ownership = 'flight';
44
- acquisition.surface = canvas;
45
- return finishEntity(acquisition);
46
- }
47
- catch (error) {
48
- device.destroy();
49
- throw error;
50
- }
51
- };
52
- out.isSupported = () => {
53
- return getWebWgpu() !== null;
54
- };
55
- out.release = (acquisition) => {
56
- acquisition.context.unconfigure();
57
- acquisition.device.destroy();
66
+ return null;
67
+ context.configure({
68
+ device: attachment.device,
69
+ format: attachment.format,
70
+ alphaMode: attachment.alphaMode,
71
+ usage: WgpuTextureUsage.RENDER_ATTACHMENT | WgpuTextureUsage.COPY_SRC,
72
+ });
73
+ return { context, surface: canvas };
74
+ },
75
+ isSupported: () => {
76
+ return getWebWgpu() !== null;
77
+ },
78
+ release: (acquisition) => {
79
+ acquisition.context.unconfigure();
80
+ acquisition.device.destroy();
81
+ },
58
82
  };
59
83
  }
60
- // First host wins and a custom backend installed through setWgpuHostBackend always takes precedence.
61
- export function installWgpuHostBackend(backend) {
62
- if (_host === null)
63
- _host = backend;
64
- }
65
- export function resetWgpuHostBackendForTest() {
66
- _custom = null;
67
- _host = null;
68
- }
69
- // Installs a process-wide custom backend. Clearing it reveals the first installed host, or the
70
- // built-in explicit web adapter when no host has been installed.
71
- export function setWgpuHostBackend(backend) {
72
- _custom = backend;
84
+ function testCanvas(surface) {
85
+ const handle = surface[EntityRuntimeKey].handle;
86
+ return handle instanceof HTMLCanvasElement ? handle : null;
73
87
  }
74
88
  function getWebWgpu() {
75
89
  if (typeof navigator === 'undefined')
@@ -81,7 +95,4 @@ function getWebWgpu() {
81
95
  return null;
82
96
  }
83
97
  }
84
- const _web = createWebWgpuHostBackend();
85
- let _custom = null;
86
- let _host = null;
87
98
  //# sourceMappingURL=wgpuHost.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"wgpuHost.js","sourceRoot":"","sources":["../src/wgpuHost.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAGzE,+FAA+F;AAC/F,kGAAkG;AAClG,MAAM,UAAU,wBAAwB;IACtC,MAAM,GAAG,GAAG,cAAc,EAAmB,CAAC;IAC9C,4BAA4B,CAAC,GAAG,CAAC,CAAC;IAClC,OAAO,YAAY,CAAC,GAAG,CAAC,CAAC;AAC3B,CAAC;AAED,MAAM,UAAU,kBAAkB;IAChC,OAAO,OAAO,IAAI,KAAK,IAAI,IAAI,CAAC;AAClC,CAAC;AAED,MAAM,UAAU,4BAA4B,CAAC,GAAwC;IACnF,GAAG,CAAC,OAAO,GAAG,KAAK,EAAE,MAAM,EAAE,OAAO,EAAgC,EAAE;QACpE,MAAM,GAAG,GAAG,UAAU,EAAE,CAAC;QACzB,IAAI,GAAG,KAAK,IAAI;YAAE,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAC;QAE9E,MAAM,OAAO,GAAG,MAAM,GAAG,CAAC,cAAc,CACtC,OAAO,CAAC,eAAe,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,eAAe,EAAE,OAAO,CAAC,eAAe,EAAE,CAAC,CAAC,CAAC,SAAS,CACjG,CAAC;QACF,IAAI,OAAO,KAAK,IAAI;YAAE,MAAM,IAAI,KAAK,CAAC,+BAA+B,CAAC,CAAC;QAEvE,6FAA6F;QAC7F,wFAAwF;QACxF,MAAM,cAAc,GAA2B,EAAE,CAAC;QAClD,IAAI,OAAO,CAAC,MAAM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C;QACH,OAAO,SAAS,CAAC,GAAG,IAAI,IAAI,CAAC;IAC/B,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC"}
@@ -1,5 +1,5 @@
1
- import type { WgpuRenderState } from '@flighthq/types/contract';
2
- export declare function generateWgpuMipmaps(state: WgpuRenderState, texture: GPUTexture, width: number, height: number, format: GPUTextureFormat): void;
1
+ import type { WgpuRenderState, WgpuTexture, WgpuTextureFormat } from './contract.render-wgpu-types.ts';
2
+ export declare function generateWgpuMipmaps(state: WgpuRenderState, texture: WgpuTexture, width: number, height: number, format: WgpuTextureFormat): void;
3
3
  export declare function getWgpuMipLevelCount(width: number, height: number): number;
4
4
  export declare function registerWgpuMipmapGeneration(state: WgpuRenderState): void;
5
5
  //# sourceMappingURL=wgpuMipmap.d.ts.map