@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.
- package/README.md +2 -2
- package/dist/.tsbuildinfo.compressed-texture-decoder-contract +1 -0
- package/dist/.tsbuildinfo.contract +1 -0
- package/dist/.tsbuildinfo.runtime +1 -0
- package/dist/compressed-texture-decoder-contract/WgpuCompressedTextureDecoder.d.ts +3 -0
- package/dist/compressed-texture-decoder-contract/WgpuCompressedTextureDecoder.d.ts.map +1 -0
- package/dist/compressed-texture-decoder-contract/WgpuCompressedTextureDecoder.js +2 -0
- package/dist/compressed-texture-decoder-contract/WgpuCompressedTextureDecoder.js.map +1 -0
- package/dist/compressed-texture-decoder-contract/compressedTextureDecoderContract.d.ts +2 -0
- package/dist/compressed-texture-decoder-contract/compressedTextureDecoderContract.d.ts.map +1 -0
- package/dist/compressed-texture-decoder-contract/compressedTextureDecoderContract.js +2 -0
- package/dist/compressed-texture-decoder-contract/compressedTextureDecoderContract.js.map +1 -0
- package/dist/contract.d.ts +32 -34
- package/dist/contract.d.ts.map +1 -1
- package/dist/contract.js +32 -34
- package/dist/contract.js.map +1 -1
- package/dist/contract.render-wgpu-types.d.ts +55 -0
- package/dist/contract.render-wgpu-types.d.ts.map +1 -0
- package/dist/contract.render-wgpu-types.js +5 -0
- package/dist/contract.render-wgpu-types.js.map +1 -0
- package/dist/enableWgpuTextureResolverGuards.d.ts +3 -2
- package/dist/enableWgpuTextureResolverGuards.d.ts.map +1 -1
- package/dist/enableWgpuTextureResolverGuards.js +12 -9
- package/dist/enableWgpuTextureResolverGuards.js.map +1 -1
- package/dist/explainWgpuTextureResolution.d.ts +2 -1
- package/dist/explainWgpuTextureResolution.d.ts.map +1 -1
- package/dist/explainWgpuTextureResolution.js +2 -5
- package/dist/explainWgpuTextureResolution.js.map +1 -1
- package/dist/explainWgpuUniformEndianness.d.ts +3 -0
- package/dist/explainWgpuUniformEndianness.d.ts.map +1 -0
- package/dist/explainWgpuUniformEndianness.js +25 -0
- package/dist/explainWgpuUniformEndianness.js.map +1 -0
- package/dist/index.d.ts +20 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +20 -1
- package/dist/index.js.map +1 -1
- package/dist/types/Host.d.ts +5 -0
- package/dist/types/Host.d.ts.map +1 -0
- package/dist/types/Host.js +2 -0
- package/dist/types/Host.js.map +1 -0
- package/dist/types/WgpuAdapter.d.ts +14 -0
- package/dist/types/WgpuAdapter.d.ts.map +1 -0
- package/dist/types/WgpuAdapter.js +2 -0
- package/dist/types/WgpuAdapter.js.map +1 -0
- package/dist/types/WgpuAdapterCapabilities.d.ts +7 -0
- package/dist/types/WgpuAdapterCapabilities.d.ts.map +1 -0
- package/dist/types/WgpuAdapterCapabilities.js +2 -0
- package/dist/types/WgpuAdapterCapabilities.js.map +1 -0
- package/dist/types/WgpuBindGroup.d.ts +23 -0
- package/dist/types/WgpuBindGroup.d.ts.map +1 -0
- package/dist/types/WgpuBindGroup.js +2 -0
- package/dist/types/WgpuBindGroup.js.map +1 -0
- package/dist/types/WgpuBindGroupLayout.d.ts +45 -0
- package/dist/types/WgpuBindGroupLayout.d.ts.map +1 -0
- package/dist/types/WgpuBindGroupLayout.js +7 -0
- package/dist/types/WgpuBindGroupLayout.js.map +1 -0
- package/dist/types/WgpuBuffer.d.ts +34 -0
- package/dist/types/WgpuBuffer.d.ts.map +1 -0
- package/dist/types/WgpuBuffer.js +19 -0
- package/dist/types/WgpuBuffer.js.map +1 -0
- package/dist/types/WgpuCanvasContext.d.ts +17 -0
- package/dist/types/WgpuCanvasContext.d.ts.map +1 -0
- package/dist/types/WgpuCanvasContext.js +2 -0
- package/dist/types/WgpuCanvasContext.js.map +1 -0
- package/dist/types/WgpuColorAdjustmentMaterialFeature.d.ts +14 -0
- package/dist/types/WgpuColorAdjustmentMaterialFeature.d.ts.map +1 -0
- package/dist/types/WgpuColorAdjustmentMaterialFeature.js +2 -0
- package/dist/types/WgpuColorAdjustmentMaterialFeature.js.map +1 -0
- package/dist/types/WgpuCommandBuffer.d.ts +5 -0
- package/dist/types/WgpuCommandBuffer.d.ts.map +1 -0
- package/dist/types/WgpuCommandBuffer.js +2 -0
- package/dist/types/WgpuCommandBuffer.js.map +1 -0
- package/dist/types/WgpuCommandEncoder.d.ts +12 -0
- package/dist/types/WgpuCommandEncoder.d.ts.map +1 -0
- package/dist/types/WgpuCommandEncoder.js +2 -0
- package/dist/types/WgpuCommandEncoder.js.map +1 -0
- package/dist/types/WgpuCompressedTextureSupport.d.ts +6 -0
- package/dist/types/WgpuCompressedTextureSupport.d.ts.map +1 -0
- package/dist/types/WgpuCompressedTextureSupport.js +2 -0
- package/dist/types/WgpuCompressedTextureSupport.js.map +1 -0
- package/dist/types/WgpuCompressedTextureUploader.d.ts +6 -0
- package/dist/types/WgpuCompressedTextureUploader.d.ts.map +1 -0
- package/dist/types/WgpuCompressedTextureUploader.js +2 -0
- package/dist/types/WgpuCompressedTextureUploader.js.map +1 -0
- package/dist/types/WgpuCustomMaterialShaderSource.d.ts +2 -0
- package/dist/types/WgpuCustomMaterialShaderSource.d.ts.map +1 -0
- package/dist/types/WgpuCustomMaterialShaderSource.js +2 -0
- package/dist/types/WgpuCustomMaterialShaderSource.js.map +1 -0
- package/dist/types/WgpuDevice.d.ts +76 -0
- package/dist/types/WgpuDevice.d.ts.map +1 -0
- package/dist/types/WgpuDevice.js +2 -0
- package/dist/types/WgpuDevice.js.map +1 -0
- package/dist/types/WgpuDeviceRuntime.d.ts +53 -0
- package/dist/types/WgpuDeviceRuntime.d.ts.map +1 -0
- package/dist/types/WgpuDeviceRuntime.js +2 -0
- package/dist/types/WgpuDeviceRuntime.js.map +1 -0
- package/dist/types/WgpuDeviceSignals.d.ts +6 -0
- package/dist/types/WgpuDeviceSignals.d.ts.map +1 -0
- package/dist/types/WgpuDeviceSignals.js +2 -0
- package/dist/types/WgpuDeviceSignals.js.map +1 -0
- package/dist/types/WgpuDeviceState.d.ts +7 -0
- package/dist/types/WgpuDeviceState.d.ts.map +1 -0
- package/dist/types/WgpuDeviceState.js +2 -0
- package/dist/types/WgpuDeviceState.js.map +1 -0
- package/dist/types/WgpuEffectState.d.ts +19 -0
- package/dist/types/WgpuEffectState.d.ts.map +1 -0
- package/dist/types/WgpuEffectState.js +2 -0
- package/dist/types/WgpuEffectState.js.map +1 -0
- package/dist/types/WgpuExternalImageSource.d.ts +18 -0
- package/dist/types/WgpuExternalImageSource.d.ts.map +1 -0
- package/dist/types/WgpuExternalImageSource.js +2 -0
- package/dist/types/WgpuExternalImageSource.js.map +1 -0
- package/dist/types/WgpuFullscreenPipeline.d.ts +14 -0
- package/dist/types/WgpuFullscreenPipeline.d.ts.map +1 -0
- package/dist/types/WgpuFullscreenPipeline.js +2 -0
- package/dist/types/WgpuFullscreenPipeline.js.map +1 -0
- package/dist/types/WgpuGpu.d.ts +7 -0
- package/dist/types/WgpuGpu.d.ts.map +1 -0
- package/dist/types/WgpuGpu.js +2 -0
- package/dist/types/WgpuGpu.js.map +1 -0
- package/dist/types/WgpuHost.d.ts +44 -0
- package/dist/types/WgpuHost.d.ts.map +1 -0
- package/dist/types/WgpuHost.js +2 -0
- package/dist/types/WgpuHost.js.map +1 -0
- package/dist/types/WgpuMeshMaterialRenderer.d.ts +11 -0
- package/dist/types/WgpuMeshMaterialRenderer.d.ts.map +1 -0
- package/dist/types/WgpuMeshMaterialRenderer.js +2 -0
- package/dist/types/WgpuMeshMaterialRenderer.js.map +1 -0
- package/dist/types/WgpuModifierSnippet.d.ts +16 -0
- package/dist/types/WgpuModifierSnippet.d.ts.map +1 -0
- package/dist/types/WgpuModifierSnippet.js +2 -0
- package/dist/types/WgpuModifierSnippet.js.map +1 -0
- package/dist/types/WgpuParticleResources.d.ts +12 -0
- package/dist/types/WgpuParticleResources.d.ts.map +1 -0
- package/dist/types/WgpuParticleResources.js +2 -0
- package/dist/types/WgpuParticleResources.js.map +1 -0
- package/dist/types/WgpuPipelineLayout.d.ts +8 -0
- package/dist/types/WgpuPipelineLayout.d.ts.map +1 -0
- package/dist/types/WgpuPipelineLayout.js +2 -0
- package/dist/types/WgpuPipelineLayout.js.map +1 -0
- package/dist/types/WgpuQuadBatchResources.d.ts +12 -0
- package/dist/types/WgpuQuadBatchResources.d.ts.map +1 -0
- package/dist/types/WgpuQuadBatchResources.js +2 -0
- package/dist/types/WgpuQuadBatchResources.js.map +1 -0
- package/dist/types/WgpuQuadMaterialRenderer.d.ts +9 -0
- package/dist/types/WgpuQuadMaterialRenderer.d.ts.map +1 -0
- package/dist/types/WgpuQuadMaterialRenderer.js +2 -0
- package/dist/types/WgpuQuadMaterialRenderer.js.map +1 -0
- package/dist/types/WgpuQueue.d.ts +12 -0
- package/dist/types/WgpuQueue.d.ts.map +1 -0
- package/dist/types/WgpuQueue.js +2 -0
- package/dist/types/WgpuQueue.js.map +1 -0
- package/dist/types/WgpuRenderOptions.d.ts +14 -0
- package/dist/types/WgpuRenderOptions.d.ts.map +1 -0
- package/dist/types/WgpuRenderOptions.js +2 -0
- package/dist/types/WgpuRenderOptions.js.map +1 -0
- package/dist/types/WgpuRenderPass.d.ts +31 -0
- package/dist/types/WgpuRenderPass.d.ts.map +1 -0
- package/dist/types/WgpuRenderPass.js +2 -0
- package/dist/types/WgpuRenderPass.js.map +1 -0
- package/dist/types/WgpuRenderPassEncoder.d.ts +52 -0
- package/dist/types/WgpuRenderPassEncoder.d.ts.map +1 -0
- package/dist/types/WgpuRenderPassEncoder.js +2 -0
- package/dist/types/WgpuRenderPassEncoder.js.map +1 -0
- package/dist/types/WgpuRenderPipeline.d.ts +96 -0
- package/dist/types/WgpuRenderPipeline.d.ts.map +1 -0
- package/dist/types/WgpuRenderPipeline.js +9 -0
- package/dist/types/WgpuRenderPipeline.js.map +1 -0
- package/dist/types/WgpuRenderState.d.ts +249 -0
- package/dist/types/WgpuRenderState.d.ts.map +1 -0
- package/dist/types/WgpuRenderState.js +2 -0
- package/dist/types/WgpuRenderState.js.map +1 -0
- package/dist/types/WgpuRenderStateOptions.d.ts +31 -0
- package/dist/types/WgpuRenderStateOptions.d.ts.map +1 -0
- package/dist/types/WgpuRenderStateOptions.js +2 -0
- package/dist/types/WgpuRenderStateOptions.js.map +1 -0
- package/dist/types/WgpuRenderTarget.d.ts +62 -0
- package/dist/types/WgpuRenderTarget.d.ts.map +1 -0
- package/dist/types/WgpuRenderTarget.js +2 -0
- package/dist/types/WgpuRenderTarget.js.map +1 -0
- package/dist/types/WgpuRenderTexture.d.ts +25 -0
- package/dist/types/WgpuRenderTexture.d.ts.map +1 -0
- package/dist/types/WgpuRenderTexture.js +2 -0
- package/dist/types/WgpuRenderTexture.js.map +1 -0
- package/dist/types/WgpuSampler.d.ts +19 -0
- package/dist/types/WgpuSampler.d.ts.map +1 -0
- package/dist/types/WgpuSampler.js +2 -0
- package/dist/types/WgpuSampler.js.map +1 -0
- package/dist/types/WgpuScene3DRuntime.d.ts +6 -0
- package/dist/types/WgpuScene3DRuntime.d.ts.map +1 -0
- package/dist/types/WgpuScene3DRuntime.js +2 -0
- package/dist/types/WgpuScene3DRuntime.js.map +1 -0
- package/dist/types/WgpuShaderModule.d.ts +6 -0
- package/dist/types/WgpuShaderModule.d.ts.map +1 -0
- package/dist/types/WgpuShaderModule.js +2 -0
- package/dist/types/WgpuShaderModule.js.map +1 -0
- package/dist/types/WgpuShapeMesh.d.ts +7 -0
- package/dist/types/WgpuShapeMesh.d.ts.map +1 -0
- package/dist/types/WgpuShapeMesh.js +2 -0
- package/dist/types/WgpuShapeMesh.js.map +1 -0
- package/dist/types/WgpuSkinningAdapter.d.ts +18 -0
- package/dist/types/WgpuSkinningAdapter.d.ts.map +1 -0
- package/dist/types/WgpuSkinningAdapter.js +2 -0
- package/dist/types/WgpuSkinningAdapter.js.map +1 -0
- package/dist/types/WgpuSurface.d.ts +5 -0
- package/dist/types/WgpuSurface.d.ts.map +1 -0
- package/dist/types/WgpuSurface.js +2 -0
- package/dist/types/WgpuSurface.js.map +1 -0
- package/dist/types/WgpuTexture.d.ts +58 -0
- package/dist/types/WgpuTexture.d.ts.map +1 -0
- package/dist/types/WgpuTexture.js +9 -0
- package/dist/types/WgpuTexture.js.map +1 -0
- package/dist/types/WgpuTextureFormat.d.ts +2 -0
- package/dist/types/WgpuTextureFormat.d.ts.map +1 -0
- package/dist/types/WgpuTextureFormat.js +2 -0
- package/dist/types/WgpuTextureFormat.js.map +1 -0
- package/dist/types/WgpuTextureResolver.d.ts +4 -0
- package/dist/types/WgpuTextureResolver.d.ts.map +1 -0
- package/dist/types/WgpuTextureResolver.js +2 -0
- package/dist/types/WgpuTextureResolver.js.map +1 -0
- package/dist/types/WgpuTextureView.d.ts +16 -0
- package/dist/types/WgpuTextureView.d.ts.map +1 -0
- package/dist/types/WgpuTextureView.js +2 -0
- package/dist/types/WgpuTextureView.js.map +1 -0
- package/dist/types/WgpuUniformEndianness.d.ts +7 -0
- package/dist/types/WgpuUniformEndianness.d.ts.map +1 -0
- package/dist/types/WgpuUniformEndianness.js +2 -0
- package/dist/types/WgpuUniformEndianness.js.map +1 -0
- package/dist/types/WgpuVelocityWriter.d.ts +11 -0
- package/dist/types/WgpuVelocityWriter.d.ts.map +1 -0
- package/dist/types/WgpuVelocityWriter.js +2 -0
- package/dist/types/WgpuVelocityWriter.js.map +1 -0
- package/dist/wgpuAdapterCapabilities.d.ts +2 -2
- package/dist/wgpuAdapterCapabilities.d.ts.map +1 -1
- package/dist/wgpuAdapterCapabilities.js.map +1 -1
- package/dist/wgpuCompressedTexture.d.ts +7 -5
- package/dist/wgpuCompressedTexture.d.ts.map +1 -1
- package/dist/wgpuCompressedTexture.js +10 -18
- package/dist/wgpuCompressedTexture.js.map +1 -1
- package/dist/wgpuDeviceLoss.d.ts +2 -2
- package/dist/wgpuDeviceLoss.d.ts.map +1 -1
- package/dist/wgpuDeviceLoss.js +1 -1
- package/dist/wgpuDeviceLoss.js.map +1 -1
- package/dist/wgpuDraw.d.ts +11 -5
- package/dist/wgpuDraw.d.ts.map +1 -1
- package/dist/wgpuDraw.js +21 -20
- package/dist/wgpuDraw.js.map +1 -1
- package/dist/wgpuExternalImageSource.d.ts +3 -2
- package/dist/wgpuExternalImageSource.d.ts.map +1 -1
- package/dist/wgpuExternalImageSource.js.map +1 -1
- package/dist/wgpuExternalTexture.d.ts +7 -3
- package/dist/wgpuExternalTexture.d.ts.map +1 -1
- package/dist/wgpuExternalTexture.js +5 -5
- package/dist/wgpuExternalTexture.js.map +1 -1
- package/dist/wgpuFrame.d.ts +23 -0
- package/dist/wgpuFrame.d.ts.map +1 -0
- package/dist/{wgpuBackground.js → wgpuFrame.js} +67 -122
- package/dist/wgpuFrame.js.map +1 -0
- package/dist/wgpuFullscreenPass.d.ts +5 -4
- package/dist/wgpuFullscreenPass.d.ts.map +1 -1
- package/dist/wgpuFullscreenPass.js +22 -8
- package/dist/wgpuFullscreenPass.js.map +1 -1
- package/dist/wgpuHost.d.ts +4 -7
- package/dist/wgpuHost.d.ts.map +1 -1
- package/dist/wgpuHost.js +81 -70
- package/dist/wgpuHost.js.map +1 -1
- package/dist/wgpuMipmap.d.ts +2 -2
- package/dist/wgpuMipmap.d.ts.map +1 -1
- package/dist/wgpuMipmap.js +4 -3
- package/dist/wgpuMipmap.js.map +1 -1
- package/dist/wgpuQuadMaterialRegistry.d.ts +7 -0
- package/dist/wgpuQuadMaterialRegistry.d.ts.map +1 -0
- package/dist/wgpuQuadMaterialRegistry.js +33 -0
- package/dist/wgpuQuadMaterialRegistry.js.map +1 -0
- package/dist/wgpuRenderPass.d.ts +9 -0
- package/dist/wgpuRenderPass.d.ts.map +1 -0
- package/dist/wgpuRenderPass.js +210 -0
- package/dist/wgpuRenderPass.js.map +1 -0
- package/dist/wgpuRenderState.d.ts +16 -12
- package/dist/wgpuRenderState.d.ts.map +1 -1
- package/dist/wgpuRenderState.js +104 -149
- package/dist/wgpuRenderState.js.map +1 -1
- package/dist/wgpuRenderTarget.d.ts +13 -29
- package/dist/wgpuRenderTarget.d.ts.map +1 -1
- package/dist/wgpuRenderTarget.js +20 -253
- package/dist/wgpuRenderTarget.js.map +1 -1
- package/dist/wgpuRenderTargetPool.d.ts +8 -6
- package/dist/wgpuRenderTargetPool.d.ts.map +1 -1
- package/dist/wgpuRenderTargetPool.js +9 -9
- package/dist/wgpuRenderTargetPool.js.map +1 -1
- package/dist/wgpuRenderTexture.d.ts +7 -4
- package/dist/wgpuRenderTexture.d.ts.map +1 -1
- package/dist/wgpuRenderTexture.js +15 -17
- package/dist/wgpuRenderTexture.js.map +1 -1
- package/dist/wgpuRenderTexturePool.d.ts +3 -1
- package/dist/wgpuRenderTexturePool.d.ts.map +1 -1
- package/dist/wgpuRenderTexturePool.js +5 -7
- package/dist/wgpuRenderTexturePool.js.map +1 -1
- package/dist/wgpuScissor.d.ts +3 -3
- package/dist/wgpuScissor.d.ts.map +1 -1
- package/dist/wgpuScissor.js +8 -5
- package/dist/wgpuScissor.js.map +1 -1
- package/dist/wgpuScreenAntialias.d.ts +3 -0
- package/dist/wgpuScreenAntialias.d.ts.map +1 -0
- package/dist/wgpuScreenAntialias.js +120 -0
- package/dist/wgpuScreenAntialias.js.map +1 -0
- package/dist/wgpuScreenCapture.d.ts +6 -0
- package/dist/wgpuScreenCapture.d.ts.map +1 -0
- package/dist/wgpuScreenCapture.js +138 -0
- package/dist/wgpuScreenCapture.js.map +1 -0
- package/dist/wgpuScreenRenderTarget.d.ts +11 -0
- package/dist/wgpuScreenRenderTarget.d.ts.map +1 -0
- package/dist/wgpuScreenRenderTarget.js +121 -0
- package/dist/wgpuScreenRenderTarget.js.map +1 -0
- package/dist/wgpuShader.d.ts +11 -8
- package/dist/wgpuShader.d.ts.map +1 -1
- package/dist/wgpuShader.js +11 -10
- package/dist/wgpuShader.js.map +1 -1
- package/dist/wgpuShaderBinding.d.ts +3 -1
- package/dist/wgpuShaderBinding.d.ts.map +1 -1
- package/dist/wgpuShaderBinding.js +1 -1
- package/dist/wgpuShaderBinding.js.map +1 -1
- package/dist/wgpuShaderRegistry.d.ts +1 -1
- package/dist/wgpuShaderRegistry.d.ts.map +1 -1
- package/dist/wgpuShaderRegistry.js +1 -1
- package/dist/wgpuShaderRegistry.js.map +1 -1
- package/dist/wgpuTestHelper.d.ts +11 -2
- package/dist/wgpuTestHelper.d.ts.map +1 -1
- package/dist/wgpuTestHelper.js +50 -38
- package/dist/wgpuTestHelper.js.map +1 -1
- package/dist/wgpuTextureRenderTarget.d.ts +22 -0
- package/dist/wgpuTextureRenderTarget.d.ts.map +1 -0
- package/dist/wgpuTextureRenderTarget.js +123 -0
- package/dist/wgpuTextureRenderTarget.js.map +1 -0
- package/dist/wgpuTextureResolver.d.ts +5 -1
- package/dist/wgpuTextureResolver.d.ts.map +1 -1
- package/dist/wgpuTextureResolver.js +13 -12
- package/dist/wgpuTextureResolver.js.map +1 -1
- package/dist/wgpuTextureUpload.d.ts +5 -4
- package/dist/wgpuTextureUpload.d.ts.map +1 -1
- package/dist/wgpuTextureUpload.js +1 -1
- package/dist/wgpuTextureUpload.js.map +1 -1
- package/package.json +33 -13
- package/src/enableWgpuTextureResolverGuards.test.ts +40 -19
- package/src/explainWgpuTextureResolution.test.ts +6 -6
- package/src/explainWgpuUniformEndianness.test.ts +11 -0
- package/src/types/WgpuBindGroupLayout.test.ts +9 -0
- package/src/types/WgpuBuffer.test.ts +26 -0
- package/src/types/WgpuGpu.test.ts +56 -0
- package/src/types/WgpuRenderPipeline.test.ts +12 -0
- package/src/types/WgpuTexture.test.ts +15 -0
- package/src/wgpuAdapterCapabilities.test.ts +5 -4
- package/src/wgpuCompressedTexture.test.ts +31 -37
- package/src/wgpuDeviceLoss.test.ts +31 -24
- package/src/wgpuDraw.test.ts +21 -24
- package/src/wgpuExternalImageSource.test.ts +12 -11
- package/src/wgpuExternalTexture.test.ts +7 -6
- package/src/{wgpuBackground.test.ts → wgpuFrame.test.ts} +47 -29
- package/src/wgpuFullscreenPass.test.ts +8 -8
- package/src/wgpuHost.test.ts +57 -186
- package/src/wgpuMipmap.test.ts +15 -9
- package/src/wgpuQuadMaterialRegistry.test.ts +132 -0
- package/src/wgpuRenderPass.test.ts +239 -0
- package/src/wgpuRenderState.test.ts +215 -550
- package/src/wgpuRenderTarget.test.ts +44 -220
- package/src/wgpuRenderTargetPool.test.ts +23 -23
- package/src/wgpuRenderTexture.test.ts +21 -18
- package/src/wgpuRenderTexturePool.test.ts +3 -3
- package/src/wgpuScissor.test.ts +50 -19
- package/src/wgpuScreenAntialias.test.ts +65 -0
- package/src/wgpuScreenCapture.test.ts +165 -0
- package/src/wgpuScreenRenderTarget.test.ts +172 -0
- package/src/wgpuShader.test.ts +12 -11
- package/src/wgpuShaderBinding.test.ts +4 -4
- package/src/wgpuShaderRegistry.test.ts +4 -5
- package/src/wgpuTestHelper.test.ts +8 -7
- package/src/wgpuTextureRenderTarget.test.ts +129 -0
- package/src/wgpuTextureResolver.test.ts +25 -14
- package/src/wgpuTextureUpload.test.ts +15 -10
- package/dist/wgpuAntialias.d.ts +0 -14
- package/dist/wgpuAntialias.d.ts.map +0 -1
- package/dist/wgpuAntialias.js +0 -155
- package/dist/wgpuAntialias.js.map +0 -1
- package/dist/wgpuBackground.d.ts +0 -20
- package/dist/wgpuBackground.d.ts.map +0 -1
- package/dist/wgpuBackground.js.map +0 -1
- package/dist/wgpuElement.d.ts +0 -7
- package/dist/wgpuElement.d.ts.map +0 -1
- package/dist/wgpuElement.js +0 -20
- package/dist/wgpuElement.js.map +0 -1
- package/dist/wgpuMaterialRegistry.d.ts +0 -5
- package/dist/wgpuMaterialRegistry.d.ts.map +0 -1
- package/dist/wgpuMaterialRegistry.js +0 -32
- package/dist/wgpuMaterialRegistry.js.map +0 -1
- package/dist/wgpuPipeline.d.ts +0 -6
- package/dist/wgpuPipeline.d.ts.map +0 -1
- package/dist/wgpuPipeline.js +0 -33
- package/dist/wgpuPipeline.js.map +0 -1
- package/dist/wgpuSurface.d.ts +0 -6
- package/dist/wgpuSurface.d.ts.map +0 -1
- package/dist/wgpuSurface.js +0 -155
- package/dist/wgpuSurface.js.map +0 -1
- package/src/wgpuAntialias.test.ts +0 -239
- package/src/wgpuElement.test.ts +0 -145
- package/src/wgpuMaterialRegistry.test.ts +0 -100
- package/src/wgpuPipeline.test.ts +0 -62
- 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:
|
|
23
|
-
let resolveLost!: (reason:
|
|
24
|
-
const lost = new Promise<
|
|
25
|
-
resolveLost = (reason) => resolve({ message: `lost: ${reason}`, reason } as
|
|
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
|
|
33
|
+
return { device: { destroy: () => {}, lost } as unknown as WgpuDevice, resolveLost };
|
|
28
34
|
}
|
|
29
35
|
|
|
30
|
-
function makeStateOn(device:
|
|
31
|
-
const
|
|
32
|
-
state
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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<
|
|
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
|
|
236
|
+
resolveLost('unknown' as WgpuDeviceLostReason);
|
|
230
237
|
await settle();
|
|
231
238
|
await settle();
|
|
232
239
|
expect(emissions).toBe(1);
|
package/src/wgpuDraw.test.ts
CHANGED
|
@@ -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/
|
|
12
|
+
} from '@flighthq/texture/contract';
|
|
17
13
|
|
|
18
|
-
import {
|
|
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 {
|
|
40
|
-
import {
|
|
41
|
-
import {
|
|
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
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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 {
|
|
2
|
-
import {
|
|
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
|
|
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
|
|
41
|
-
const texture = {} as
|
|
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
|
|
55
|
-
expect(tryCopyWgpuExternalImageToTexture(queue, { source: canvas }, { texture: {} as
|
|
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
|
|
70
|
-
expect(tryCopyWgpuExternalImageToTexture(queue, { source: canvas }, { texture: {} as
|
|
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
|
|
85
|
+
} as unknown as WgpuQueue;
|
|
85
86
|
expect(() =>
|
|
86
|
-
tryCopyWgpuExternalImageToTexture(queue, { source: canvas }, { texture: {} as
|
|
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/
|
|
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
|
|
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
|
|
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
|
-
|
|
6
|
+
submitWgpuFrame,
|
|
7
7
|
withWgpuFrameBorrow,
|
|
8
|
-
} from './
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
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
|
|
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
|
|
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('
|
|
42
|
+
describe('submitWgpuFrame', () => {
|
|
53
43
|
it('submits and closes the active frame', async () => {
|
|
54
44
|
const state = await createWgpuRenderStateForTest();
|
|
55
45
|
beginWgpuFrame(state);
|
|
56
|
-
|
|
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.
|
|
66
|
-
|
|
67
|
-
|
|
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.
|
|
80
|
-
|
|
81
|
-
|
|
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 {
|
|
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 {
|
|
9
|
-
import {
|
|
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,17 +49,17 @@ 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
|
-
|
|
52
|
+
beginWgpuScreenRenderPassForTest(state);
|
|
53
53
|
const pipeline = createWgpuFullscreenPipeline(state, SIMPLE_FRAGMENT_WGSL, 1);
|
|
54
|
-
const target =
|
|
54
|
+
const target = createWgpuTextureRenderTarget(state, 64, 64);
|
|
55
55
|
expect(() => drawWgpuFullscreenPass(state, pipeline, [target], null)).not.toThrow();
|
|
56
|
-
|
|
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 =
|
|
62
|
+
const target = createWgpuTextureRenderTarget(state, 64, 64);
|
|
63
63
|
expect(() => drawWgpuFullscreenPass(state, pipeline, [target], null)).not.toThrow();
|
|
64
64
|
});
|
|
65
65
|
});
|