@flighthq/render-wgpu 0.5.1-next.920.da8f530 → 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 +29 -16
  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 +10 -10
  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,35 +1,42 @@
1
+ import { EntityRuntimeKey } from '@flighthq/entity/contract';
1
2
  import { connectSignal, createSignal } from '@flighthq/signals/contract';
2
- import type { WgpuDeviceRuntime, WgpuRenderState } from '@flighthq/types/contract';
3
- import { EntityRuntimeKey } from '@flighthq/types/contract';
4
3
 
4
+ import type {
5
+ WgpuDevice,
6
+ WgpuDeviceLostInfo,
7
+ WgpuDeviceLostReason,
8
+ WgpuDeviceRuntime,
9
+ WgpuRenderState,
10
+ } from './contract.render-wgpu-types.ts';
5
11
  import {
6
12
  disposeWgpuDeviceSignals,
7
13
  enableWgpuDeviceSignals,
8
14
  getWgpuDeviceLoss,
9
15
  isWgpuDeviceLost,
10
16
  observeWgpuDeviceLoss,
11
- } from './wgpuDeviceLoss';
17
+ } from './wgpuDeviceLoss.ts';
12
18
  import {
13
19
  createWgpuDeviceState,
14
20
  createWgpuOffscreenRenderState,
15
21
  createWgpuRenderStateRuntime,
16
22
  getWgpuRenderStateRuntime,
17
- } from './wgpuRenderState';
23
+ } from './wgpuRenderState.ts';
18
24
 
19
25
  // A device whose loss the test drives by hand. `lost` is the only member the observer reads, so the
20
26
  // rest of GPUDevice stays absent on purpose: a probe that needed a full device would be testing the
21
27
  // mock. `resolveLost` stands in for the driver resolving the real terminal promise.
22
- function makeLosableDevice(): { device: GPUDevice; resolveLost: (reason: GPUDeviceLostReason) => void } {
23
- let resolveLost!: (reason: GPUDeviceLostReason) => void;
24
- const lost = new Promise<GPUDeviceLostInfo>((resolve) => {
25
- resolveLost = (reason) => resolve({ message: `lost: ${reason}`, reason } as GPUDeviceLostInfo);
28
+ function makeLosableDevice(): { device: WgpuDevice; resolveLost: (reason: WgpuDeviceLostReason) => void } {
29
+ let resolveLost!: (reason: WgpuDeviceLostReason) => void;
30
+ const lost = new Promise<WgpuDeviceLostInfo>((resolve) => {
31
+ resolveLost = (reason) => resolve({ message: `lost: ${reason}`, reason } as WgpuDeviceLostInfo);
26
32
  });
27
- return { device: { destroy: () => {}, lost } as unknown as GPUDevice, resolveLost };
33
+ return { device: { destroy: () => {}, lost } as unknown as WgpuDevice, resolveLost };
28
34
  }
29
35
 
30
- function makeStateOn(device: GPUDevice): WgpuRenderState {
31
- const state = { applyBlendMode: null } as unknown as WgpuRenderState;
32
- state[EntityRuntimeKey] = createWgpuRenderStateRuntime(createWgpuDeviceState(device));
36
+ function makeStateOn(device: WgpuDevice): WgpuRenderState {
37
+ const deviceState = createWgpuDeviceState(device);
38
+ const state = { applyBlendMode: null, deviceState } as unknown as WgpuRenderState;
39
+ state[EntityRuntimeKey] = createWgpuRenderStateRuntime(deviceState);
33
40
  return state;
34
41
  }
35
42
 
@@ -51,7 +58,7 @@ describe('createWgpuOffscreenRenderState', () => {
51
58
  it('reports a method-tight device-lost outcome instead of deriving on a dead device', async () => {
52
59
  const { device, resolveLost } = makeLosableDevice();
53
60
  const screen = makeStateOn(device);
54
- resolveLost('unknown' as GPUDeviceLostReason);
61
+ resolveLost('unknown' as WgpuDeviceLostReason);
55
62
  await settle();
56
63
  const result = createWgpuOffscreenRenderState(screen);
57
64
  expect(result.reason).toBe('device-lost');
@@ -95,7 +102,7 @@ describe('getWgpuDeviceLoss', () => {
95
102
  connectSignal(enableWgpuDeviceSignals(state).onDeviceLost, () => {
96
103
  emissions += 1;
97
104
  });
98
- resolveLost('unknown' as GPUDeviceLostReason);
105
+ resolveLost('unknown' as WgpuDeviceLostReason);
99
106
  await settle();
100
107
  expect(emissions).toBe(1);
101
108
  expect(getWgpuDeviceLoss(state)?.reason).toBe('unknown');
@@ -111,7 +118,7 @@ describe('getWgpuDeviceLoss', () => {
111
118
  connectSignal(enableWgpuDeviceSignals(state).onDeviceLost, () => {
112
119
  emissions += 1;
113
120
  });
114
- resolveLost('destroyed' as GPUDeviceLostReason);
121
+ resolveLost('destroyed' as WgpuDeviceLostReason);
115
122
  await settle();
116
123
  expect(emissions).toBe(0);
117
124
  expect(getWgpuDeviceLoss(state)?.reason).toBe('destroyed');
@@ -127,7 +134,7 @@ describe('getWgpuDeviceLoss', () => {
127
134
  connectSignal(enableWgpuDeviceSignals(screen).onDeviceLost, () => {
128
135
  emissions += 1;
129
136
  });
130
- resolveLost('unknown' as GPUDeviceLostReason);
137
+ resolveLost('unknown' as WgpuDeviceLostReason);
131
138
  await settle();
132
139
  expect(emissions).toBe(1);
133
140
  expect(isWgpuDeviceLost(screen)).toBe(true);
@@ -139,7 +146,7 @@ describe('getWgpuDeviceLoss', () => {
139
146
  it('reports the terminal fact to a state created after the loss', async () => {
140
147
  const { device, resolveLost } = makeLosableDevice();
141
148
  const screen = makeStateOn(device);
142
- resolveLost('unknown' as GPUDeviceLostReason);
149
+ resolveLost('unknown' as WgpuDeviceLostReason);
143
150
  await settle();
144
151
  const late = makeAliasOf(screen);
145
152
  expect(isWgpuDeviceLost(late)).toBe(true);
@@ -151,7 +158,7 @@ describe('getWgpuDeviceLoss', () => {
151
158
  // that, so it is asserted rather than assumed.
152
159
  it('records a loss that resolved before the device tier was ever constructed', async () => {
153
160
  const { device, resolveLost } = makeLosableDevice();
154
- resolveLost('unknown' as GPUDeviceLostReason);
161
+ resolveLost('unknown' as WgpuDeviceLostReason);
155
162
  await settle();
156
163
  const state = makeStateOn(device);
157
164
  let emissions = 0;
@@ -171,7 +178,7 @@ describe('getWgpuDeviceLoss', () => {
171
178
  // A device with no `lost` member is reachable today — `createWgpuDeviceState({} as GPUDevice)` is
172
179
  // used by existing tests, and the host seam accepts caller-supplied handles from native hosts.
173
180
  it('treats a device with no lost promise as live rather than throwing', () => {
174
- const state = makeStateOn({ destroy: () => {} } as unknown as GPUDevice);
181
+ const state = makeStateOn({ destroy: () => {} } as unknown as WgpuDevice);
175
182
  expect(isWgpuDeviceLost(state)).toBe(false);
176
183
  });
177
184
  });
@@ -183,7 +190,7 @@ describe('isWgpuDeviceLost', () => {
183
190
  const { device, resolveLost } = makeLosableDevice();
184
191
  const state = makeStateOn(device);
185
192
  enableWgpuDeviceSignals(state);
186
- resolveLost('unknown' as GPUDeviceLostReason);
193
+ resolveLost('unknown' as WgpuDeviceLostReason);
187
194
  const deviceRuntime = getWgpuRenderStateRuntime(state).context;
188
195
  const holdsState = Object.values(deviceRuntime as unknown as Record<string, unknown>).some(
189
196
  (value) => value === state || (Array.isArray(value) && value.includes(state)),
@@ -195,7 +202,7 @@ describe('isWgpuDeviceLost', () => {
195
202
  const { device, resolveLost } = makeLosableDevice();
196
203
  const state = makeStateOn(device);
197
204
  expect(isWgpuDeviceLost(state)).toBe(false);
198
- resolveLost('unknown' as GPUDeviceLostReason);
205
+ resolveLost('unknown' as WgpuDeviceLostReason);
199
206
  await settle();
200
207
  expect(isWgpuDeviceLost(state)).toBe(true);
201
208
  });
@@ -206,7 +213,7 @@ describe('observeWgpuDeviceLoss', () => {
206
213
  const { device, resolveLost } = makeLosableDevice();
207
214
  const deviceRuntime = { device, lost: null, signals: null } as unknown as WgpuDeviceRuntime;
208
215
  observeWgpuDeviceLoss(deviceRuntime);
209
- resolveLost('unknown' as GPUDeviceLostReason);
216
+ resolveLost('unknown' as WgpuDeviceLostReason);
210
217
  await settle();
211
218
  expect(deviceRuntime.lost?.reason).toBe('unknown');
212
219
  });
@@ -218,7 +225,7 @@ describe('observeWgpuDeviceLoss', () => {
218
225
  const deviceRuntime = {
219
226
  device,
220
227
  lost: null,
221
- signals: { onDeviceLost: createSignal<(info: GPUDeviceLostInfo) => void>() },
228
+ signals: { onDeviceLost: createSignal<WgpuDeviceLostInfo>() },
222
229
  } as unknown as WgpuDeviceRuntime;
223
230
  let emissions = 0;
224
231
  connectSignal(deviceRuntime.signals!.onDeviceLost, () => {
@@ -226,7 +233,7 @@ describe('observeWgpuDeviceLoss', () => {
226
233
  });
227
234
  observeWgpuDeviceLoss(deviceRuntime);
228
235
  observeWgpuDeviceLoss(deviceRuntime);
229
- resolveLost('unknown' as GPUDeviceLostReason);
236
+ resolveLost('unknown' as WgpuDeviceLostReason);
230
237
  await settle();
231
238
  await settle();
232
239
  expect(emissions).toBe(1);
@@ -1,22 +1,18 @@
1
+ import type { Bitmap } from '@flighthq/bitmap/contract';
2
+ import type { CompressedImageResource, ImageResource } from '@flighthq/image/contract';
3
+ import { BlendMode } from '@flighthq/materials/contract';
1
4
  import { getOrCreateRenderProxy2D, prepareScene2DRender } from '@flighthq/render/contract';
2
5
  import { createSprite } from '@flighthq/scene2d/contract';
3
6
  import { getTextureSource } from '@flighthq/texture/contract';
4
- import type {
5
- Bitmap,
6
- CompressedImageResource,
7
- ImageResource,
8
- Texture,
9
- WgpuTextureEntry,
10
- } from '@flighthq/types/contract';
7
+ import type { Texture } from '@flighthq/texture/contract';
11
8
  import {
12
9
  BitmapTextureSourceKind,
13
- BlendMode,
14
10
  CompressedImageTextureSourceKind,
15
11
  ImageTextureSourceKind,
16
- } from '@flighthq/types/contract';
12
+ } from '@flighthq/texture/contract';
17
13
 
18
- import { renderWgpuBackground, submitWgpuRenderPass } from './wgpuBackground';
19
- import { registerWgpuCompressedTextureDecoder, registerWgpuCompressedTextureUpload } from './wgpuCompressedTexture';
14
+ import type { WgpuTextureEntry } from './contract.render-wgpu-types.ts';
15
+ import { registerWgpuCompressedTextureDecoder, registerWgpuCompressedTextureUpload } from './wgpuCompressedTexture.ts';
20
16
  import {
21
17
  applyWgpuBlendMode,
22
18
  bindWgpuBitmapTexture,
@@ -35,10 +31,11 @@ import {
35
31
  submitWgpuQuadDraw,
36
32
  updateWgpuTextureEntry,
37
33
  warmWgpuPipelines,
38
- } from './wgpuDraw';
39
- import { registerWgpuMipmapGeneration } from './wgpuMipmap';
40
- import { getWgpuRenderStateDeviceResources, getWgpuRenderStateRuntime } from './wgpuRenderState';
41
- import { createWgpuRenderStateForTest, installWgpuMock } from './wgpuTestHelper';
34
+ } from './wgpuDraw.ts';
35
+ import { submitWgpuFrame } from './wgpuFrame.ts';
36
+ import { registerWgpuMipmapGeneration } from './wgpuMipmap.ts';
37
+ import { getWgpuRenderStateDeviceResources, getWgpuRenderStateRuntime } from './wgpuRenderState.ts';
38
+ import { beginWgpuScreenRenderPassForTest, createWgpuRenderStateForTest, installWgpuMock } from './wgpuTestHelper.ts';
42
39
 
43
40
  beforeAll(() => {
44
41
  installWgpuMock();
@@ -53,7 +50,7 @@ function bitmap(size: number, version: number): Bitmap {
53
50
  return {
54
51
  alphaType: 'straight',
55
52
  colorSpace: 'srgb',
56
- data: new Uint8ClampedArray(size * size * 4),
53
+ data: new Uint8Array(size * size * 4),
57
54
  format: 'rgba8unorm',
58
55
  height: size,
59
56
  kind: BitmapTextureSourceKind,
@@ -185,8 +182,8 @@ describe('bindWgpuBitmapTexture mip allocation identity', () => {
185
182
  describe('bindWgpuCompressedImageTexture', () => {
186
183
  it('routes through the registered compressed upload seam', async () => {
187
184
  const state = await createWgpuRenderStateForTest();
188
- const decode = vi.fn(() => new Uint8ClampedArray(4 * 4 * 4));
189
- registerWgpuCompressedTextureUpload(state);
185
+ const decode = vi.fn(() => new Uint8Array(4 * 4 * 4));
186
+ registerWgpuCompressedTextureUpload(state, true);
190
187
  registerWgpuCompressedTextureDecoder(state, decode);
191
188
  const entry = bindWgpuCompressedImageTexture(state, compressedBc3Image());
192
189
  expect(entry?.texture).toBeDefined();
@@ -426,7 +423,7 @@ describe('destroyWgpuVideoTexture', () => {
426
423
  describe('drawWgpuQuad', () => {
427
424
  it('does not throw when render pass is open', async () => {
428
425
  const state = await createWgpuRenderStateForTest();
429
- renderWgpuBackground(state);
426
+ beginWgpuScreenRenderPassForTest(state);
430
427
  const bitmap = createSprite();
431
428
  prepareScene2DRender(state, bitmap);
432
429
  const renderProxy = getOrCreateRenderProxy2D(state, bitmap);
@@ -435,14 +432,14 @@ describe('drawWgpuQuad', () => {
435
432
  canvas.height = 4;
436
433
  const entry = requireTextureEntry(bindWgpuTexture(state, canvas));
437
434
  expect(() => drawWgpuQuad(state, renderProxy, entry, 0, 0, 4, 4, 0, 0, 1, 1)).not.toThrow();
438
- submitWgpuRenderPass(state);
435
+ submitWgpuFrame(state);
439
436
  });
440
437
  });
441
438
 
442
439
  describe('drawWgpuQuadWithTransform', () => {
443
440
  it('does not throw when render pass is open', async () => {
444
441
  const state = await createWgpuRenderStateForTest();
445
- renderWgpuBackground(state);
442
+ beginWgpuScreenRenderPassForTest(state);
446
443
  const bitmap = createSprite();
447
444
  prepareScene2DRender(state, bitmap);
448
445
  const renderProxy = getOrCreateRenderProxy2D(state, bitmap);
@@ -452,7 +449,7 @@ describe('drawWgpuQuadWithTransform', () => {
452
449
  const entry = requireTextureEntry(bindWgpuTexture(state, canvas));
453
450
  const t = { a: 1, b: 0, c: 0, d: 1, tx: 0, ty: 0 };
454
451
  expect(() => drawWgpuQuadWithTransform(state, renderProxy, t, entry, 0, 0, 4, 4, 0, 0, 1, 1)).not.toThrow();
455
- submitWgpuRenderPass(state);
452
+ submitWgpuFrame(state);
456
453
  });
457
454
  });
458
455
 
@@ -568,13 +565,13 @@ describe('resolveWgpuSmoothingBindGroup', () => {
568
565
  describe('submitWgpuQuadDraw', () => {
569
566
  it('does not throw when render pass is open', async () => {
570
567
  const state = await createWgpuRenderStateForTest();
571
- renderWgpuBackground(state);
568
+ beginWgpuScreenRenderPassForTest(state);
572
569
  const canvas = document.createElement('canvas');
573
570
  canvas.width = 4;
574
571
  canvas.height = 4;
575
572
  const entry = requireTextureEntry(bindWgpuTexture(state, canvas));
576
573
  expect(() => submitWgpuQuadDraw(state, 0, resolveWgpuSmoothingBindGroup(state, entry, null))).not.toThrow();
577
- submitWgpuRenderPass(state);
574
+ submitWgpuFrame(state);
578
575
  });
579
576
 
580
577
  it('is a no-op when render pass is null', async () => {
@@ -1,5 +1,6 @@
1
- import { isWgpuExternalImageSourceReady, tryCopyWgpuExternalImageToTexture } from './wgpuExternalImageSource';
2
- import { createReadyImageElementForTest } from './wgpuTestHelper';
1
+ import type { WgpuExternalImageSource, WgpuQueue, WgpuTexture } from './contract.render-wgpu-types.ts';
2
+ import { isWgpuExternalImageSourceReady, tryCopyWgpuExternalImageToTexture } from './wgpuExternalImageSource.ts';
3
+ import { createReadyImageElementForTest } from './wgpuTestHelper.ts';
3
4
 
4
5
  describe('isWgpuExternalImageSourceReady', () => {
5
6
  it('accepts a dimension-valid canvas without probing or binding its context', () => {
@@ -30,15 +31,15 @@ describe('isWgpuExternalImageSourceReady', () => {
30
31
  });
31
32
 
32
33
  it('rejects an unrecognized source instead of failing open', () => {
33
- expect(isWgpuExternalImageSourceReady({} as GPUCopyExternalImageSource, 1, 1)).toBe(false);
34
+ expect(isWgpuExternalImageSourceReady({} as WgpuExternalImageSource, 1, 1)).toBe(false);
34
35
  });
35
36
  });
36
37
 
37
38
  describe('tryCopyWgpuExternalImageToTexture', () => {
38
39
  it('copies a ready source', () => {
39
40
  const copyExternalImageToTexture = vi.fn();
40
- const queue = { copyExternalImageToTexture } as unknown as GPUQueue;
41
- const texture = {} as GPUTexture;
41
+ const queue = { copyExternalImageToTexture } as unknown as WgpuQueue;
42
+ const texture = {} as WgpuTexture;
42
43
  const source = createReadyImageElementForTest(4, 4);
43
44
  expect(tryCopyWgpuExternalImageToTexture(queue, { source }, { texture }, 4, 4)).toBe(true);
44
45
  expect(copyExternalImageToTexture).toHaveBeenCalledWith({ source }, { texture }, [4, 4, 1]);
@@ -51,8 +52,8 @@ describe('tryCopyWgpuExternalImageToTexture', () => {
51
52
  const copyExternalImageToTexture = vi.fn(() => {
52
53
  throw new DOMException('canvas has no rendering context', 'OperationError');
53
54
  });
54
- const queue = { copyExternalImageToTexture } as unknown as GPUQueue;
55
- expect(tryCopyWgpuExternalImageToTexture(queue, { source: canvas }, { texture: {} as GPUTexture }, 4, 4)).toBe(
55
+ const queue = { copyExternalImageToTexture } as unknown as WgpuQueue;
56
+ expect(tryCopyWgpuExternalImageToTexture(queue, { source: canvas }, { texture: {} as WgpuTexture }, 4, 4)).toBe(
56
57
  false,
57
58
  );
58
59
  });
@@ -66,8 +67,8 @@ describe('tryCopyWgpuExternalImageToTexture', () => {
66
67
  "Failed to execute 'copyExternalImageToTexture' on 'GPUQueue': Failed to copy content from external image.",
67
68
  );
68
69
  });
69
- const queue = { copyExternalImageToTexture } as unknown as GPUQueue;
70
- expect(tryCopyWgpuExternalImageToTexture(queue, { source: canvas }, { texture: {} as GPUTexture }, 4, 4)).toBe(
70
+ const queue = { copyExternalImageToTexture } as unknown as WgpuQueue;
71
+ expect(tryCopyWgpuExternalImageToTexture(queue, { source: canvas }, { texture: {} as WgpuTexture }, 4, 4)).toBe(
71
72
  false,
72
73
  );
73
74
  });
@@ -81,9 +82,9 @@ describe('tryCopyWgpuExternalImageToTexture', () => {
81
82
  copyExternalImageToTexture: vi.fn(() => {
82
83
  throw error;
83
84
  }),
84
- } as unknown as GPUQueue;
85
+ } as unknown as WgpuQueue;
85
86
  expect(() =>
86
- tryCopyWgpuExternalImageToTexture(queue, { source: canvas }, { texture: {} as GPUTexture }, 4, 4),
87
+ tryCopyWgpuExternalImageToTexture(queue, { source: canvas }, { texture: {} as WgpuTexture }, 4, 4),
87
88
  ).toThrow(error);
88
89
  });
89
90
  });
@@ -1,14 +1,15 @@
1
1
  import { getTextureSourceKind } from '@flighthq/texture/contract';
2
- import { ExternalTextureSourceKind } from '@flighthq/types/contract';
2
+ import { ExternalTextureSourceKind } from '@flighthq/texture/contract';
3
3
 
4
+ import type { WgpuTexture } from './contract.render-wgpu-types.ts';
4
5
  import {
5
6
  createExternalWgpuTexture,
6
7
  disposeExternalWgpuTexture,
7
8
  initializeExternalWgpuTextureEntry,
8
9
  initializeExternalWgpuTextureSource,
9
- } from './wgpuExternalTexture';
10
- import { createWgpuRenderStateForTest, installWgpuMock } from './wgpuTestHelper';
11
- import { resolveWgpuTexture } from './wgpuTextureResolver';
10
+ } from './wgpuExternalTexture.ts';
11
+ import { createWgpuRenderStateForTest, installWgpuMock } from './wgpuTestHelper.ts';
12
+ import { resolveWgpuTexture } from './wgpuTextureResolver.ts';
12
13
 
13
14
  beforeAll(() => {
14
15
  installWgpuMock();
@@ -18,7 +19,7 @@ describe('createExternalWgpuTexture', () => {
18
19
  it('resolves a borrowed handle and forgets it without destroying the allocation', async () => {
19
20
  const state = await createWgpuRenderStateForTest();
20
21
  const destroy = vi.fn();
21
- const handle = { createView: vi.fn(() => ({})), destroy } as unknown as GPUTexture;
22
+ const handle = { createView: vi.fn(() => ({})), destroy } as unknown as WgpuTexture;
22
23
  const texture = createExternalWgpuTexture(state, handle, { height: 16, width: 32 });
23
24
 
24
25
  expect(getTextureSourceKind(texture)).toBe(ExternalTextureSourceKind);
@@ -32,7 +33,7 @@ describe('createExternalWgpuTexture', () => {
32
33
  describe('disposeExternalWgpuTexture', () => {
33
34
  it('returns false after the borrowed handle has already been forgotten', async () => {
34
35
  const state = await createWgpuRenderStateForTest();
35
- const handle = { createView: () => ({}) } as unknown as GPUTexture;
36
+ const handle = { createView: () => ({}) } as unknown as WgpuTexture;
36
37
  const texture = createExternalWgpuTexture(state, handle, { height: 1, width: 1 });
37
38
  expect(disposeExternalWgpuTexture(state, texture)).toBe(true);
38
39
  expect(disposeExternalWgpuTexture(state, texture)).toBe(false);
@@ -1,14 +1,13 @@
1
+ import type { WgpuBuffer, WgpuTexture } from './contract.render-wgpu-types.ts';
1
2
  import {
2
3
  beginWgpuFrame,
3
- renderWgpuBackground,
4
4
  retireWgpuBuffer,
5
5
  retireWgpuTexture,
6
- submitWgpuRenderPass,
6
+ submitWgpuFrame,
7
7
  withWgpuFrameBorrow,
8
- } from './wgpuBackground';
9
- import { createWgpuPipeline } from './wgpuPipeline';
10
- import { createWgpuOffscreenRenderState, getWgpuRenderStateRuntime } from './wgpuRenderState';
11
- import { createWgpuRenderStateForTest, installWgpuMock } from './wgpuTestHelper';
8
+ } from './wgpuFrame.ts';
9
+ import { createWgpuOffscreenRenderState, getWgpuRenderStateRuntime } from './wgpuRenderState.ts';
10
+ import { beginWgpuScreenRenderPassForTest, createWgpuRenderStateForTest, installWgpuMock } from './wgpuTestHelper.ts';
12
11
 
13
12
  beforeAll(() => installWgpuMock());
14
13
 
@@ -22,19 +21,10 @@ describe('beginWgpuFrame', () => {
22
21
  });
23
22
  });
24
23
 
25
- describe('renderWgpuBackground', () => {
26
- it('opens the presentation pass on the current surface', async () => {
27
- const state = await createWgpuRenderStateForTest();
28
- renderWgpuBackground(state);
29
- expect(getWgpuRenderStateRuntime(state).renderPass).not.toBeNull();
30
- submitWgpuRenderPass(state);
31
- });
32
- });
33
-
34
24
  describe('retireWgpuBuffer', () => {
35
25
  it('adds the buffer to the post-submit destruction ledger', async () => {
36
26
  const state = await createWgpuRenderStateForTest();
37
- const buffer = { destroy: vi.fn() } as unknown as GPUBuffer;
27
+ const buffer = { destroy: vi.fn() } as unknown as WgpuBuffer;
38
28
  retireWgpuBuffer(state, buffer);
39
29
  expect(getWgpuRenderStateRuntime(state).retiredBuffers).toEqual([buffer]);
40
30
  });
@@ -43,29 +33,58 @@ describe('retireWgpuBuffer', () => {
43
33
  describe('retireWgpuTexture', () => {
44
34
  it('adds the texture to the post-submit destruction ledger', async () => {
45
35
  const state = await createWgpuRenderStateForTest();
46
- const texture = { destroy: vi.fn() } as unknown as GPUTexture;
36
+ const texture = { destroy: vi.fn() } as unknown as WgpuTexture;
47
37
  retireWgpuTexture(state, texture);
48
38
  expect(getWgpuRenderStateRuntime(state).retiredTextures).toEqual([texture]);
49
39
  });
50
40
  });
51
41
 
52
- describe('submitWgpuRenderPass', () => {
42
+ describe('submitWgpuFrame', () => {
53
43
  it('submits and closes the active frame', async () => {
54
44
  const state = await createWgpuRenderStateForTest();
55
45
  beginWgpuFrame(state);
56
- submitWgpuRenderPass(state);
46
+ submitWgpuFrame(state);
57
47
  expect(getWgpuRenderStateRuntime(state).commandEncoder).toBeNull();
58
48
  });
49
+
50
+ it('closes a pass the caller left open rather than carrying its encoder into the next frame', async () => {
51
+ const state = await createWgpuRenderStateForTest();
52
+ beginWgpuFrame(state);
53
+ beginWgpuScreenRenderPassForTest(state);
54
+ expect(getWgpuRenderStateRuntime(state).renderPass).not.toBeNull();
55
+
56
+ submitWgpuFrame(state);
57
+
58
+ const runtime = getWgpuRenderStateRuntime(state);
59
+ expect(runtime.renderPass).toBeNull();
60
+ expect(runtime.passStack).toEqual([]);
61
+ expect(runtime.currentRenderTarget).toBeNull();
62
+ expect(runtime.renderTargetViewport).toBeNull();
63
+ });
64
+ // A frame that only drew into texture targets has no screen to resolve or capture. Skipping that work
65
+ // is not an optimization: the capture texture still holds the LAST VISIBLE frame, so encoding a copy
66
+ // here would overwrite the readback buffer with a stale picture that a caller would read as current.
67
+ it('resolves and captures nothing when the frame never touched a screen target', async () => {
68
+ const state = await createWgpuRenderStateForTest();
69
+ const runtime = getWgpuRenderStateRuntime(state);
70
+ beginWgpuFrame(state);
71
+ const encoder = runtime.commandEncoder!;
72
+ const copyToBuffer = vi.spyOn(encoder, 'copyTextureToBuffer');
73
+
74
+ expect(runtime.frameScreenTarget).toBeNull();
75
+ submitWgpuFrame(state);
76
+
77
+ expect(copyToBuffer).not.toHaveBeenCalled();
78
+ });
59
79
  });
60
80
 
61
81
  describe('withWgpuFrameBorrow', () => {
62
82
  it('returns callback values and closes a standalone frame', async () => {
63
83
  const screen = await createWgpuRenderStateForTest();
64
- const offscreen = createWgpuOffscreenRenderState(
65
- screen.deviceState,
66
- createWgpuPipeline(getWgpuRenderStateRuntime(screen).registries),
67
- { format: screen.format },
68
- );
84
+ const offscreen = createWgpuOffscreenRenderState(screen.deviceState, {
85
+ ...getWgpuRenderStateRuntime(screen).registries,
86
+ format: screen.format,
87
+ });
69
88
 
70
89
  expect(withWgpuFrameBorrow(screen, offscreen, () => 42)).toBe(42);
71
90
  expect(getWgpuRenderStateRuntime(screen).commandEncoder).toBeNull();
@@ -75,11 +94,10 @@ describe('withWgpuFrameBorrow', () => {
75
94
  it('rejects a borrower owned by a different GPU device', async () => {
76
95
  const owner = await createWgpuRenderStateForTest();
77
96
  const other = await createWgpuRenderStateForTest();
78
- const borrower = createWgpuOffscreenRenderState(
79
- other.deviceState,
80
- createWgpuPipeline(getWgpuRenderStateRuntime(other).registries),
81
- { format: other.format },
82
- );
97
+ const borrower = createWgpuOffscreenRenderState(other.deviceState, {
98
+ ...getWgpuRenderStateRuntime(other).registries,
99
+ format: other.format,
100
+ });
83
101
 
84
102
  expect(() => withWgpuFrameBorrow(owner, borrower, () => {})).toThrow(/same GPU device/);
85
103
  expect(getWgpuRenderStateRuntime(owner).commandEncoder).toBeNull();
@@ -1,12 +1,12 @@
1
- import { renderWgpuBackground, submitWgpuRenderPass } from './wgpuBackground';
1
+ import { submitWgpuFrame } from './wgpuFrame.ts';
2
2
  import {
3
3
  createWgpuFullscreenPipeline,
4
4
  destroyWgpuFullscreenPipeline,
5
5
  drawWgpuFullscreenPass,
6
6
  initializeWgpuFullscreenPipeline,
7
- } from './wgpuFullscreenPass';
8
- import { createWgpuRenderTarget } from './wgpuRenderTarget';
9
- import { createWgpuRenderStateForTest, installWgpuMock } from './wgpuTestHelper';
7
+ } from './wgpuFullscreenPass.ts';
8
+ import { beginWgpuScreenRenderPassForTest, createWgpuRenderStateForTest, installWgpuMock } from './wgpuTestHelper.ts';
9
+ import { createWgpuTextureRenderTarget } from './wgpuTextureRenderTarget.ts';
10
10
 
11
11
  beforeAll(() => {
12
12
  installWgpuMock();
@@ -49,18 +49,18 @@ describe('destroyWgpuFullscreenPipeline', () => {
49
49
  describe('drawWgpuFullscreenPass', () => {
50
50
  it('does not throw when render pass is open and no uniforms', async () => {
51
51
  const state = await createWgpuRenderStateForTest();
52
- renderWgpuBackground(state);
52
+ beginWgpuScreenRenderPassForTest(state);
53
53
  const pipeline = createWgpuFullscreenPipeline(state, SIMPLE_FRAGMENT_WGSL, 1);
54
- const target = createWgpuRenderTarget(state, 64, 64);
55
- expect(() => drawWgpuFullscreenPass(state, pipeline, [target], null, null)).not.toThrow();
56
- submitWgpuRenderPass(state);
54
+ const target = createWgpuTextureRenderTarget(state, 64, 64);
55
+ expect(() => drawWgpuFullscreenPass(state, pipeline, [target], null)).not.toThrow();
56
+ submitWgpuFrame(state);
57
57
  });
58
58
 
59
59
  it('is a no-op when render pass is not open', async () => {
60
60
  const state = await createWgpuRenderStateForTest();
61
61
  const pipeline = createWgpuFullscreenPipeline(state, SIMPLE_FRAGMENT_WGSL, 1);
62
- const target = createWgpuRenderTarget(state, 64, 64);
63
- expect(() => drawWgpuFullscreenPass(state, pipeline, [target], null, null)).not.toThrow();
62
+ const target = createWgpuTextureRenderTarget(state, 64, 64);
63
+ expect(() => drawWgpuFullscreenPass(state, pipeline, [target], null)).not.toThrow();
64
64
  });
65
65
  });
66
66
  describe('initializeWgpuFullscreenPipeline', () => {