@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.
- 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 +29 -16
- 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 +10 -10
- 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,4 +1,4 @@
|
|
|
1
|
-
import { tryCopyWgpuExternalImageToTexture } from './wgpuExternalImageSource';
|
|
1
|
+
import { tryCopyWgpuExternalImageToTexture } from './wgpuExternalImageSource.js';
|
|
2
2
|
// Texel-upload primitives for one texture region. Each writes into `texture` at `origin` (the [x, y, z]
|
|
3
3
|
// where z selects a cube-array layer / cube face). The wgpu mirror of render-gl's glTextureUpload; the
|
|
4
4
|
// caller owns texture creation and format.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wgpuTextureUpload.js","sourceRoot":"","sources":["../src/wgpuTextureUpload.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"wgpuTextureUpload.js","sourceRoot":"","sources":["../src/wgpuTextureUpload.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,iCAAiC,EAAE,MAAM,8BAA8B,CAAC;AAEjF,wGAAwG;AACxG,uGAAuG;AACvG,2CAA2C;AAE3C,0GAA0G;AAC1G,2GAA2G;AAC3G,wCAAwC;AACxC,MAAM,UAAU,qBAAqB,CACnC,MAAkB,EAClB,OAAoB,EACpB,MAAoB,EACpB,KAAa,EACb,MAAc,EACd,IAAuC;IAEvC,MAAM,CAAC,KAAK,CAAC,YAAY,CACvB,EAAE,OAAO,EAAE,MAAM,EAAE,EACnB,IAA+B,EAC/B,EAAE,WAAW,EAAE,KAAK,GAAG,CAAC,EAAE,YAAY,EAAE,MAAM,EAAE,EAChD,CAAC,KAAK,EAAE,MAAM,EAAE,CAAC,CAAC,CACnB,CAAC;AACJ,CAAC;AAED,uGAAuG;AACvG,kDAAkD;AAClD,MAAM,UAAU,wBAAwB,CACtC,MAAkB,EAClB,OAAoB,EACpB,MAAoB,EACpB,KAAa,EACb,MAAc,EACd,MAA+B;IAE/B,iCAAiC,CAAC,MAAM,CAAC,KAAK,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;AAClG,CAAC;AAED,6EAA6E;AAC7E,MAAM,UAAU,8BAA8B,CAC5C,MAAkB,EAClB,OAAoB,EACpB,MAAoB,EACpB,KAA8B;IAE9B,wBAAwB,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,MAAiC,CAAC,CAAC;AACxH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flighthq/render-wgpu",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"author": "Joshua Granick and other contributors",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -19,6 +19,10 @@
|
|
|
19
19
|
"./contract": {
|
|
20
20
|
"types": "./dist/contract.d.ts",
|
|
21
21
|
"default": "./dist/contract.js"
|
|
22
|
+
},
|
|
23
|
+
"./compressed-texture-decoder-contract": {
|
|
24
|
+
"types": "./dist/compressed-texture-decoder-contract/compressedTextureDecoderContract.d.ts",
|
|
25
|
+
"default": "./dist/compressed-texture-decoder-contract/compressedTextureDecoderContract.js"
|
|
22
26
|
}
|
|
23
27
|
},
|
|
24
28
|
"files": [
|
|
@@ -32,30 +36,46 @@
|
|
|
32
36
|
"scripts": {
|
|
33
37
|
"build": "tsc -b",
|
|
34
38
|
"clean": "tsc -b --clean",
|
|
39
|
+
"generate": "tsx ../../scripts/generate-rust-package.ts --crate flight-render-wgpu --package render-wgpu",
|
|
40
|
+
"generate:check": "tsx ../../scripts/generate-rust-package.ts --crate flight-render-wgpu --package render-wgpu --check",
|
|
35
41
|
"test": "vitest run --config vitest.config.ts",
|
|
36
42
|
"test:watch": "vitest --watch --config vitest.config.ts",
|
|
37
43
|
"prepack": "npm run clean && npm run clean:dist && npm run build",
|
|
38
44
|
"clean:dist": "tsx ../../scripts/clean-package-dist.ts"
|
|
39
45
|
},
|
|
40
46
|
"dependencies": {
|
|
41
|
-
"@flighthq/
|
|
42
|
-
"@flighthq/
|
|
43
|
-
"@flighthq/
|
|
44
|
-
"@flighthq/
|
|
45
|
-
"@flighthq/
|
|
46
|
-
"@flighthq/
|
|
47
|
-
"@flighthq/
|
|
48
|
-
"@flighthq/
|
|
49
|
-
"@flighthq/
|
|
50
|
-
"@flighthq/
|
|
47
|
+
"@flighthq/adjustments": "0.6.0",
|
|
48
|
+
"@flighthq/app": "0.6.0",
|
|
49
|
+
"@flighthq/bitmap": "0.6.0",
|
|
50
|
+
"@flighthq/camera": "0.6.0",
|
|
51
|
+
"@flighthq/color": "0.6.0",
|
|
52
|
+
"@flighthq/effects": "0.6.0",
|
|
53
|
+
"@flighthq/entity": "0.6.0",
|
|
54
|
+
"@flighthq/geometry": "0.6.0",
|
|
55
|
+
"@flighthq/image": "0.6.0",
|
|
56
|
+
"@flighthq/lighting": "0.6.0",
|
|
57
|
+
"@flighthq/log": "0.6.0",
|
|
58
|
+
"@flighthq/materials": "0.6.0",
|
|
59
|
+
"@flighthq/meshgeometry": "0.6.0",
|
|
60
|
+
"@flighthq/node": "0.6.0",
|
|
61
|
+
"@flighthq/platform": "0.6.0",
|
|
62
|
+
"@flighthq/registry": "0.6.0",
|
|
63
|
+
"@flighthq/render": "0.6.0",
|
|
64
|
+
"@flighthq/scene2d": "0.6.0",
|
|
65
|
+
"@flighthq/scene3d": "0.6.0",
|
|
66
|
+
"@flighthq/shading": "0.6.0",
|
|
67
|
+
"@flighthq/signals": "0.6.0",
|
|
68
|
+
"@flighthq/surface": "0.6.0",
|
|
69
|
+
"@flighthq/texture": "0.6.0",
|
|
70
|
+
"@flighthq/texture-formats": "0.6.0",
|
|
71
|
+
"@flighthq/velocity": "0.6.0"
|
|
51
72
|
},
|
|
52
73
|
"peerDependencies": {
|
|
53
74
|
"@webgpu/types": "^0.1.70"
|
|
54
75
|
},
|
|
55
76
|
"devDependencies": {
|
|
56
|
-
"@flighthq/scene2d": "*",
|
|
57
77
|
"@webgpu/types": "*",
|
|
58
|
-
"typescript": "^
|
|
78
|
+
"typescript": "^7.0.2"
|
|
59
79
|
},
|
|
60
80
|
"description": "WebGPU renderer core: render state, targets, shaders, draw, surface, and background",
|
|
61
81
|
"sideEffects": false
|
|
@@ -1,15 +1,30 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { ImageResource } from '@flighthq/image/contract';
|
|
2
|
+
import {
|
|
3
|
+
addLogSink,
|
|
4
|
+
createLogState,
|
|
5
|
+
createMemoryLogSink,
|
|
6
|
+
getMemoryLogSinkEntries,
|
|
7
|
+
removeLogSink,
|
|
8
|
+
} from '@flighthq/log/contract';
|
|
9
|
+
import type { LogState } from '@flighthq/log/contract';
|
|
10
|
+
import type { LogEntry, MemoryLogSink } from '@flighthq/log/contract';
|
|
2
11
|
import { createTexture } from '@flighthq/texture/contract';
|
|
3
|
-
import type { ImageResource } from '@flighthq/types/contract';
|
|
4
12
|
|
|
5
13
|
import {
|
|
6
14
|
areWgpuTextureResolverGuardsEnabled,
|
|
7
15
|
enableWgpuTextureResolverGuards,
|
|
8
|
-
} from './enableWgpuTextureResolverGuards';
|
|
9
|
-
import { bindWgpuTexture } from './wgpuDraw';
|
|
10
|
-
import { getWgpuRenderStateRuntime } from './wgpuRenderState';
|
|
11
|
-
import { createWgpuRenderStateForTest, installWgpuMock } from './wgpuTestHelper';
|
|
12
|
-
import { registerWgpuTextureResolver, resolveWgpuTexture } from './wgpuTextureResolver';
|
|
16
|
+
} from './enableWgpuTextureResolverGuards.ts';
|
|
17
|
+
import { bindWgpuTexture } from './wgpuDraw.ts';
|
|
18
|
+
import { getWgpuRenderStateRuntime } from './wgpuRenderState.ts';
|
|
19
|
+
import { createWgpuRenderStateForTest, installWgpuMock } from './wgpuTestHelper.ts';
|
|
20
|
+
import { registerWgpuTextureResolver, resolveWgpuTexture } from './wgpuTextureResolver.ts';
|
|
21
|
+
|
|
22
|
+
// Each test logs into a fresh caller-owned state, so logOnce keys never leak between tests.
|
|
23
|
+
let logState: LogState;
|
|
24
|
+
|
|
25
|
+
beforeEach(() => {
|
|
26
|
+
logState = createLogState();
|
|
27
|
+
});
|
|
13
28
|
|
|
14
29
|
beforeAll(() => {
|
|
15
30
|
installWgpuMock();
|
|
@@ -20,7 +35,7 @@ describe('areWgpuTextureResolverGuardsEnabled', () => {
|
|
|
20
35
|
const state = await createWgpuRenderStateForTest();
|
|
21
36
|
expect(areWgpuTextureResolverGuardsEnabled(state)).toBe(false);
|
|
22
37
|
|
|
23
|
-
enableWgpuTextureResolverGuards(state);
|
|
38
|
+
enableWgpuTextureResolverGuards(state, logState);
|
|
24
39
|
expect(areWgpuTextureResolverGuardsEnabled(state)).toBe(true);
|
|
25
40
|
});
|
|
26
41
|
});
|
|
@@ -28,8 +43,8 @@ describe('areWgpuTextureResolverGuardsEnabled', () => {
|
|
|
28
43
|
describe('enableWgpuTextureResolverGuards', () => {
|
|
29
44
|
it('is idempotent', async () => {
|
|
30
45
|
const state = await createWgpuRenderStateForTest();
|
|
31
|
-
enableWgpuTextureResolverGuards(state);
|
|
32
|
-
enableWgpuTextureResolverGuards(state);
|
|
46
|
+
enableWgpuTextureResolverGuards(state, logState);
|
|
47
|
+
enableWgpuTextureResolverGuards(state, logState);
|
|
33
48
|
expect(areWgpuTextureResolverGuardsEnabled(state)).toBe(true);
|
|
34
49
|
});
|
|
35
50
|
|
|
@@ -38,15 +53,15 @@ describe('enableWgpuTextureResolverGuards', () => {
|
|
|
38
53
|
const missing = textureWithKind('acme.missing.wgpu');
|
|
39
54
|
const registered = textureWithKind('acme.registered.wgpu');
|
|
40
55
|
const sink = createMemoryLogSink(4);
|
|
41
|
-
addLogSink(sink.sink);
|
|
42
|
-
enableWgpuTextureResolverGuards(state);
|
|
56
|
+
addLogSink(logState, sink.sink);
|
|
57
|
+
enableWgpuTextureResolverGuards(state, logState);
|
|
43
58
|
registerWgpuTextureResolver(state, 'acme.registered.wgpu', () => null);
|
|
44
59
|
try {
|
|
45
60
|
expect(resolveWgpuTexture(state, missing)).toBeNull();
|
|
46
61
|
expect(resolveWgpuTexture(state, missing)).toBeNull();
|
|
47
62
|
expect(resolveWgpuTexture(state, registered)).toBeNull();
|
|
48
63
|
|
|
49
|
-
const entries =
|
|
64
|
+
const entries = readMemoryLogEntries(sink);
|
|
50
65
|
expect(entries).toHaveLength(1);
|
|
51
66
|
expect(entries[0]?.data).toMatchObject({
|
|
52
67
|
kind: 'acme.missing.wgpu',
|
|
@@ -54,35 +69,35 @@ describe('enableWgpuTextureResolverGuards', () => {
|
|
|
54
69
|
'resolveWgpuTexture: texture source kind has no registered resolver — call registerWgpuTextureResolver(state, sourceKind, resolver)',
|
|
55
70
|
});
|
|
56
71
|
} finally {
|
|
57
|
-
removeLogSink(sink.sink);
|
|
72
|
+
removeLogSink(logState, sink.sink);
|
|
58
73
|
}
|
|
59
74
|
});
|
|
60
75
|
|
|
61
76
|
it('installs the mipmap-degraded guard on the runtime', async () => {
|
|
62
77
|
const state = await createWgpuRenderStateForTest();
|
|
63
78
|
expect(getWgpuRenderStateRuntime(state).mipmapDegradedGuard).toBeNull();
|
|
64
|
-
enableWgpuTextureResolverGuards(state);
|
|
79
|
+
enableWgpuTextureResolverGuards(state, logState);
|
|
65
80
|
expect(getWgpuRenderStateRuntime(state).mipmapDegradedGuard).not.toBeNull();
|
|
66
81
|
});
|
|
67
82
|
|
|
68
83
|
it('logs a warning when mipmaps are requested without a registered generator', async () => {
|
|
69
84
|
const state = await createWgpuRenderStateForTest();
|
|
70
85
|
const sink = createMemoryLogSink(4);
|
|
71
|
-
addLogSink(sink.sink);
|
|
72
|
-
enableWgpuTextureResolverGuards(state);
|
|
86
|
+
addLogSink(logState, sink.sink);
|
|
87
|
+
enableWgpuTextureResolverGuards(state, logState);
|
|
73
88
|
try {
|
|
74
89
|
const canvas = document.createElement('canvas');
|
|
75
90
|
canvas.width = 8;
|
|
76
91
|
canvas.height = 8;
|
|
77
92
|
bindWgpuTexture(state, canvas, true);
|
|
78
93
|
|
|
79
|
-
const entries =
|
|
94
|
+
const entries = readMemoryLogEntries(sink);
|
|
80
95
|
expect(entries).toHaveLength(1);
|
|
81
96
|
expect(entries[0]?.data).toMatchObject({
|
|
82
97
|
message: expect.stringContaining('no WGPU mipmap generator registered'),
|
|
83
98
|
});
|
|
84
99
|
} finally {
|
|
85
|
-
removeLogSink(sink.sink);
|
|
100
|
+
removeLogSink(logState, sink.sink);
|
|
86
101
|
}
|
|
87
102
|
});
|
|
88
103
|
});
|
|
@@ -93,3 +108,9 @@ function textureWithKind(kind: string) {
|
|
|
93
108
|
source: { kind } as ImageResource,
|
|
94
109
|
});
|
|
95
110
|
}
|
|
111
|
+
|
|
112
|
+
function readMemoryLogEntries(handle: Readonly<MemoryLogSink>): LogEntry[] {
|
|
113
|
+
const entries: LogEntry[] = [];
|
|
114
|
+
getMemoryLogSinkEntries(entries, handle);
|
|
115
|
+
return entries;
|
|
116
|
+
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { allocateEntity
|
|
1
|
+
import { allocateEntity } from '@flighthq/entity/contract';
|
|
2
2
|
import { createTexture } from '@flighthq/texture/contract';
|
|
3
|
-
import type { TextureSource } from '@flighthq/
|
|
3
|
+
import type { TextureSource } from '@flighthq/texture/contract';
|
|
4
4
|
|
|
5
|
-
import { explainWgpuTextureResolution } from './explainWgpuTextureResolution';
|
|
6
|
-
import { createWgpuRenderStateForTest, installWgpuMock } from './wgpuTestHelper';
|
|
7
|
-
import { registerWgpuTextureResolver } from './wgpuTextureResolver';
|
|
5
|
+
import { explainWgpuTextureResolution } from './explainWgpuTextureResolution.ts';
|
|
6
|
+
import { createWgpuRenderStateForTest, installWgpuMock } from './wgpuTestHelper.ts';
|
|
7
|
+
import { registerWgpuTextureResolver } from './wgpuTextureResolver.ts';
|
|
8
8
|
|
|
9
9
|
beforeAll(() => {
|
|
10
10
|
installWgpuMock();
|
|
@@ -21,7 +21,7 @@ describe('explainWgpuTextureResolution', () => {
|
|
|
21
21
|
out.kind = 'acme.test';
|
|
22
22
|
out.version = 0;
|
|
23
23
|
out.width = 1;
|
|
24
|
-
return
|
|
24
|
+
return out as TextureSource;
|
|
25
25
|
})(),
|
|
26
26
|
});
|
|
27
27
|
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest';
|
|
2
|
+
|
|
3
|
+
import { explainWgpuUniformEndianness } from './explainWgpuUniformEndianness.ts';
|
|
4
|
+
|
|
5
|
+
describe('explainWgpuUniformEndianness', () => {
|
|
6
|
+
it('reports the host endianness and validation status', () => {
|
|
7
|
+
const result = explainWgpuUniformEndianness();
|
|
8
|
+
expect(result.endianness).toBe('little');
|
|
9
|
+
expect(result.status).toBe('validated');
|
|
10
|
+
});
|
|
11
|
+
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest';
|
|
2
|
+
|
|
3
|
+
import { WgpuShaderStage } from './WgpuBindGroupLayout.ts';
|
|
4
|
+
|
|
5
|
+
describe('WgpuShaderStage', () => {
|
|
6
|
+
it('carries the WGPU shader stage bits', () => {
|
|
7
|
+
expect(WgpuShaderStage).toEqual({ COMPUTE: 4, FRAGMENT: 2, VERTEX: 1 });
|
|
8
|
+
});
|
|
9
|
+
});
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest';
|
|
2
|
+
|
|
3
|
+
import { WgpuBufferUsage, WgpuMapMode } from './WgpuBuffer.ts';
|
|
4
|
+
|
|
5
|
+
describe('WgpuBufferUsage', () => {
|
|
6
|
+
it('carries the WGPU buffer usage bits', () => {
|
|
7
|
+
expect(WgpuBufferUsage).toEqual({
|
|
8
|
+
COPY_DST: 8,
|
|
9
|
+
COPY_SRC: 4,
|
|
10
|
+
INDEX: 16,
|
|
11
|
+
INDIRECT: 256,
|
|
12
|
+
MAP_READ: 1,
|
|
13
|
+
MAP_WRITE: 2,
|
|
14
|
+
QUERY_RESOLVE: 512,
|
|
15
|
+
STORAGE: 128,
|
|
16
|
+
UNIFORM: 64,
|
|
17
|
+
VERTEX: 32,
|
|
18
|
+
});
|
|
19
|
+
});
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
describe('WgpuMapMode', () => {
|
|
23
|
+
it('carries the WGPU map mode bits', () => {
|
|
24
|
+
expect(WgpuMapMode).toEqual({ READ: 1, WRITE: 2 });
|
|
25
|
+
});
|
|
26
|
+
});
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest';
|
|
2
|
+
|
|
3
|
+
import type { WgpuAdapter } from './WgpuAdapter.ts';
|
|
4
|
+
import type { WgpuBuffer } from './WgpuBuffer.ts';
|
|
5
|
+
import type { WgpuCanvasContext } from './WgpuCanvasContext.ts';
|
|
6
|
+
import type { WgpuCommandEncoder } from './WgpuCommandEncoder.ts';
|
|
7
|
+
import type { WgpuDevice } from './WgpuDevice.ts';
|
|
8
|
+
import type { WgpuGpu } from './WgpuGpu.ts';
|
|
9
|
+
import type { WgpuQueue } from './WgpuQueue.ts';
|
|
10
|
+
import type { WgpuRenderPassEncoder } from './WgpuRenderPassEncoder.ts';
|
|
11
|
+
import type { WgpuTexture } from './WgpuTexture.ts';
|
|
12
|
+
import type { WgpuTextureFormat } from './WgpuTextureFormat.ts';
|
|
13
|
+
|
|
14
|
+
// The Flight types are the contract; the browser's objects are one provider of it. Each assignment below
|
|
15
|
+
// fails to compile when the browser's typings stop satisfying a Flight type, which is the drift that would
|
|
16
|
+
// otherwise force a cast at the web host boundary.
|
|
17
|
+
describe('WgpuGpu', () => {
|
|
18
|
+
it('is satisfied by the browser WebGPU objects without a cast', () => {
|
|
19
|
+
const conform = (
|
|
20
|
+
gpu: GPU,
|
|
21
|
+
adapter: GPUAdapter,
|
|
22
|
+
device: GPUDevice,
|
|
23
|
+
queue: GPUQueue,
|
|
24
|
+
encoder: GPUCommandEncoder,
|
|
25
|
+
pass: GPURenderPassEncoder,
|
|
26
|
+
buffer: GPUBuffer,
|
|
27
|
+
texture: GPUTexture,
|
|
28
|
+
context: GPUCanvasContext,
|
|
29
|
+
format: GPUTextureFormat,
|
|
30
|
+
): readonly unknown[] => {
|
|
31
|
+
const flightGpu: WgpuGpu = gpu;
|
|
32
|
+
const flightAdapter: WgpuAdapter = adapter;
|
|
33
|
+
const flightDevice: WgpuDevice = device;
|
|
34
|
+
const flightQueue: WgpuQueue = queue;
|
|
35
|
+
const flightEncoder: WgpuCommandEncoder = encoder;
|
|
36
|
+
const flightPass: WgpuRenderPassEncoder = pass;
|
|
37
|
+
const flightBuffer: WgpuBuffer = buffer;
|
|
38
|
+
const flightTexture: WgpuTexture = texture;
|
|
39
|
+
const flightContext: WgpuCanvasContext = context;
|
|
40
|
+
const flightFormat: WgpuTextureFormat = format;
|
|
41
|
+
return [
|
|
42
|
+
flightGpu,
|
|
43
|
+
flightAdapter,
|
|
44
|
+
flightDevice,
|
|
45
|
+
flightQueue,
|
|
46
|
+
flightEncoder,
|
|
47
|
+
flightPass,
|
|
48
|
+
flightBuffer,
|
|
49
|
+
flightTexture,
|
|
50
|
+
flightContext,
|
|
51
|
+
flightFormat,
|
|
52
|
+
];
|
|
53
|
+
};
|
|
54
|
+
expect(typeof conform).toBe('function');
|
|
55
|
+
});
|
|
56
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest';
|
|
2
|
+
|
|
3
|
+
import { WgpuColorWrite } from './WgpuRenderPipeline.ts';
|
|
4
|
+
|
|
5
|
+
describe('WgpuColorWrite', () => {
|
|
6
|
+
it('carries the WGPU color write bits, with ALL as their union', () => {
|
|
7
|
+
expect(WgpuColorWrite).toEqual({ ALL: 15, ALPHA: 8, BLUE: 4, GREEN: 2, RED: 1 });
|
|
8
|
+
expect(WgpuColorWrite.RED | WgpuColorWrite.GREEN | WgpuColorWrite.BLUE | WgpuColorWrite.ALPHA).toBe(
|
|
9
|
+
WgpuColorWrite.ALL,
|
|
10
|
+
);
|
|
11
|
+
});
|
|
12
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest';
|
|
2
|
+
|
|
3
|
+
import { WgpuTextureUsage } from './WgpuTexture.ts';
|
|
4
|
+
|
|
5
|
+
describe('WgpuTextureUsage', () => {
|
|
6
|
+
it('carries the WGPU texture usage bits', () => {
|
|
7
|
+
expect(WgpuTextureUsage).toEqual({
|
|
8
|
+
COPY_DST: 2,
|
|
9
|
+
COPY_SRC: 1,
|
|
10
|
+
RENDER_ATTACHMENT: 16,
|
|
11
|
+
STORAGE_BINDING: 8,
|
|
12
|
+
TEXTURE_BINDING: 4,
|
|
13
|
+
});
|
|
14
|
+
});
|
|
15
|
+
});
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { WgpuAdapter } from './contract.render-wgpu-types.ts';
|
|
2
|
+
import { getWgpuAdapterCapabilities } from './wgpuAdapterCapabilities.ts';
|
|
2
3
|
|
|
3
|
-
function makeAdapter(features: ReadonlyArray<string> = [], limits: Record<string, number> = {}):
|
|
4
|
+
function makeAdapter(features: ReadonlyArray<string> = [], limits: Record<string, number> = {}): WgpuAdapter {
|
|
4
5
|
return {
|
|
5
6
|
features: new Set(features),
|
|
6
7
|
limits: { maxTextureDimension2D: 8192, ...limits },
|
|
7
|
-
} as unknown as
|
|
8
|
+
} as unknown as WgpuAdapter;
|
|
8
9
|
}
|
|
9
10
|
|
|
10
11
|
describe('getWgpuAdapterCapabilities', () => {
|
|
@@ -37,7 +38,7 @@ describe('getWgpuAdapterCapabilities', () => {
|
|
|
37
38
|
const adapter = {
|
|
38
39
|
features: new Set(),
|
|
39
40
|
limits: {},
|
|
40
|
-
} as unknown as
|
|
41
|
+
} as unknown as WgpuAdapter;
|
|
41
42
|
const caps = getWgpuAdapterCapabilities(adapter);
|
|
42
43
|
expect(caps.maxTextureDimension2D).toBe(8192);
|
|
43
44
|
});
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import type { CompressedImageResource
|
|
2
|
-
import {
|
|
1
|
+
import type { CompressedImageResource } from '@flighthq/image/contract';
|
|
2
|
+
import type { TextureContainer, TextureContainerFormat } from '@flighthq/texture-formats/contract';
|
|
3
|
+
import { CompressedImageTextureSourceKind } from '@flighthq/texture/contract';
|
|
3
4
|
|
|
5
|
+
import type { WgpuCompressedTextureSupport, WgpuFeatureName } from './contract.render-wgpu-types.ts';
|
|
4
6
|
import {
|
|
5
7
|
detectWgpuCompressedTextureSupport,
|
|
6
8
|
getWgpuCompressedTextureFormat,
|
|
@@ -8,10 +10,10 @@ import {
|
|
|
8
10
|
registerWgpuCompressedTextureDecoder,
|
|
9
11
|
registerWgpuCompressedTextureUpload,
|
|
10
12
|
uploadWgpuCompressedTextureContainer,
|
|
11
|
-
} from './wgpuCompressedTexture';
|
|
12
|
-
import { bindWgpuCompressedImageTexture } from './wgpuDraw';
|
|
13
|
-
import { getWgpuRenderStateRuntime } from './wgpuRenderState';
|
|
14
|
-
import { createWgpuRenderStateForTest, installWgpuMock } from './wgpuTestHelper';
|
|
13
|
+
} from './wgpuCompressedTexture.ts';
|
|
14
|
+
import { bindWgpuCompressedImageTexture } from './wgpuDraw.ts';
|
|
15
|
+
import { getWgpuRenderStateRuntime } from './wgpuRenderState.ts';
|
|
16
|
+
import { createWgpuRenderStateForTest, installWgpuMock } from './wgpuTestHelper.ts';
|
|
15
17
|
|
|
16
18
|
beforeAll(() => installWgpuMock());
|
|
17
19
|
|
|
@@ -43,7 +45,7 @@ function compressedImage(): CompressedImageResource {
|
|
|
43
45
|
describe('detectWgpuCompressedTextureSupport', () => {
|
|
44
46
|
it('reads the three WebGPU compression features', async () => {
|
|
45
47
|
const state = await createWgpuRenderStateForTest();
|
|
46
|
-
(state.device.features as Set<
|
|
48
|
+
(state.device.features as Set<WgpuFeatureName>).add('texture-compression-bc');
|
|
47
49
|
expect(detectWgpuCompressedTextureSupport(state.device)).toEqual({ astc: false, bc: true, etc2: false });
|
|
48
50
|
});
|
|
49
51
|
});
|
|
@@ -52,7 +54,7 @@ describe('getWgpuCompressedTextureFormat', () => {
|
|
|
52
54
|
it('maps a format only when its family is enabled', async () => {
|
|
53
55
|
const state = await createWgpuRenderStateForTest();
|
|
54
56
|
expect(getWgpuCompressedTextureFormat(state.device, 'bc1')).toBeNull();
|
|
55
|
-
(state.device.features as Set<
|
|
57
|
+
(state.device.features as Set<WgpuFeatureName>).add('texture-compression-bc');
|
|
56
58
|
expect(getWgpuCompressedTextureFormat(state.device, 'bc1')).toBe('bc1-rgba-unorm');
|
|
57
59
|
expect(getWgpuCompressedTextureFormat(state.device, 'rgba8unorm')).toBeNull();
|
|
58
60
|
});
|
|
@@ -73,15 +75,12 @@ describe('registerWgpuCompressedTextureDecoder', () => {
|
|
|
73
75
|
const state = await createWgpuRenderStateForTest();
|
|
74
76
|
const runtime = getWgpuRenderStateRuntime(state);
|
|
75
77
|
const before = runtime.registries.compressedTextureDecoder;
|
|
76
|
-
const decoder = vi.fn(() => new
|
|
78
|
+
const decoder = vi.fn(() => new Uint8Array(64));
|
|
77
79
|
registerWgpuCompressedTextureDecoder(state, decoder);
|
|
78
80
|
expect(runtime.registries.compressedTextureDecoder).not.toBe(before);
|
|
79
|
-
expect(runtime.registries.compressedTextureDecoder
|
|
80
|
-
state: RegistryEntryState.Bound,
|
|
81
|
-
value: decoder,
|
|
82
|
-
});
|
|
81
|
+
expect(runtime.registries.compressedTextureDecoder).toEqual(decoder);
|
|
83
82
|
registerWgpuCompressedTextureDecoder(state, null);
|
|
84
|
-
expect(runtime.registries.compressedTextureDecoder
|
|
83
|
+
expect(runtime.registries.compressedTextureDecoder).toBeNull();
|
|
85
84
|
});
|
|
86
85
|
});
|
|
87
86
|
|
|
@@ -90,21 +89,18 @@ describe('registerWgpuCompressedTextureUpload', () => {
|
|
|
90
89
|
const state = await createWgpuRenderStateForTest();
|
|
91
90
|
const runtime = getWgpuRenderStateRuntime(state);
|
|
92
91
|
const before = runtime.registries.compressedTextureUpload;
|
|
93
|
-
registerWgpuCompressedTextureUpload(state);
|
|
92
|
+
registerWgpuCompressedTextureUpload(state, true);
|
|
94
93
|
expect(runtime.registries.compressedTextureUpload).not.toBe(before);
|
|
95
|
-
expect(runtime.registries.compressedTextureUpload
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
});
|
|
99
|
-
registerWgpuCompressedTextureUpload(state, null);
|
|
100
|
-
expect(runtime.registries.compressedTextureUpload.entry).toBeNull();
|
|
94
|
+
expect(runtime.registries.compressedTextureUpload).toMatchObject(expect.any(Function));
|
|
95
|
+
registerWgpuCompressedTextureUpload(state, false);
|
|
96
|
+
expect(runtime.registries.compressedTextureUpload).toBeNull();
|
|
101
97
|
});
|
|
102
98
|
|
|
103
99
|
it('lets the compressed-image binder consume its source', async () => {
|
|
104
100
|
const state = await createWgpuRenderStateForTest();
|
|
105
|
-
registerWgpuCompressedTextureUpload(state);
|
|
106
|
-
registerWgpuCompressedTextureDecoder(state, (_format, width, height) => {
|
|
107
|
-
return new
|
|
101
|
+
registerWgpuCompressedTextureUpload(state, true);
|
|
102
|
+
registerWgpuCompressedTextureDecoder(state, (_format: TextureContainerFormat, width: number, height: number) => {
|
|
103
|
+
return new Uint8Array(width * height * 4);
|
|
108
104
|
});
|
|
109
105
|
const writeTexture = vi.spyOn(state.device.queue, 'writeTexture');
|
|
110
106
|
expect(bindWgpuCompressedImageTexture(state, compressedImage())?.view).toBeDefined();
|
|
@@ -113,9 +109,9 @@ describe('registerWgpuCompressedTextureUpload', () => {
|
|
|
113
109
|
|
|
114
110
|
it('premultiplies straight-alpha decoder output before the RGBA upload', async () => {
|
|
115
111
|
const state = await createWgpuRenderStateForTest();
|
|
116
|
-
registerWgpuCompressedTextureUpload(state);
|
|
117
|
-
registerWgpuCompressedTextureDecoder(state, (_format, width, height) => {
|
|
118
|
-
const rgba = new
|
|
112
|
+
registerWgpuCompressedTextureUpload(state, true);
|
|
113
|
+
registerWgpuCompressedTextureDecoder(state, (_format: TextureContainerFormat, width: number, height: number) => {
|
|
114
|
+
const rgba = new Uint8Array(width * height * 4);
|
|
119
115
|
for (let i = 0; i < rgba.length; i += 4) {
|
|
120
116
|
rgba[i] = 255;
|
|
121
117
|
rgba[i + 1] = 64;
|
|
@@ -128,13 +124,13 @@ describe('registerWgpuCompressedTextureUpload', () => {
|
|
|
128
124
|
const entry = bindWgpuCompressedImageTexture(state, compressedImage())!;
|
|
129
125
|
|
|
130
126
|
expect(entry.straightAlpha).toBe(false);
|
|
131
|
-
expect(Array.from(writeTexture.mock.calls[0][1] as
|
|
127
|
+
expect(Array.from(writeTexture.mock.calls[0][1] as Uint8Array).slice(0, 4)).toEqual([128, 32, 0, 128]);
|
|
132
128
|
});
|
|
133
129
|
|
|
134
130
|
it('marks native straight-alpha blocks for display-shader premultiplication', async () => {
|
|
135
131
|
const state = await createWgpuRenderStateForTest();
|
|
136
|
-
(state.device.features as Set<
|
|
137
|
-
registerWgpuCompressedTextureUpload(state);
|
|
132
|
+
(state.device.features as Set<WgpuFeatureName>).add('texture-compression-bc');
|
|
133
|
+
registerWgpuCompressedTextureUpload(state, true);
|
|
138
134
|
expect(bindWgpuCompressedImageTexture(state, compressedImage())?.straightAlpha).toBe(true);
|
|
139
135
|
});
|
|
140
136
|
});
|
|
@@ -142,7 +138,7 @@ describe('registerWgpuCompressedTextureUpload', () => {
|
|
|
142
138
|
describe('uploadWgpuCompressedTextureContainer', () => {
|
|
143
139
|
it('uploads native blocks with their block-row layout', async () => {
|
|
144
140
|
const state = await createWgpuRenderStateForTest();
|
|
145
|
-
(state.device.features as Set<
|
|
141
|
+
(state.device.features as Set<WgpuFeatureName>).add('texture-compression-bc');
|
|
146
142
|
const createTexture = vi.spyOn(state.device, 'createTexture');
|
|
147
143
|
const writeTexture = vi.spyOn(state.device.queue, 'writeTexture');
|
|
148
144
|
expect(uploadWgpuCompressedTextureContainer(state, container(), new Uint8Array(8))).not.toBeNull();
|
|
@@ -157,7 +153,7 @@ describe('uploadWgpuCompressedTextureContainer', () => {
|
|
|
157
153
|
|
|
158
154
|
it('decodes plain 2D levels to RGBA when native support is absent', async () => {
|
|
159
155
|
const state = await createWgpuRenderStateForTest();
|
|
160
|
-
const decoder = vi.fn(() => new
|
|
156
|
+
const decoder = vi.fn(() => new Uint8Array(64));
|
|
161
157
|
const createTexture = vi.spyOn(state.device, 'createTexture');
|
|
162
158
|
expect(uploadWgpuCompressedTextureContainer(state, container(), new Uint8Array(8), decoder)).not.toBeNull();
|
|
163
159
|
expect(decoder).toHaveBeenCalledWith('bc1', 4, 4, expect.any(Uint8Array));
|
|
@@ -171,10 +167,8 @@ describe('uploadWgpuCompressedTextureContainer', () => {
|
|
|
171
167
|
{ byteLength: 8, byteOffset: face * 40 + 32, height: 4, width: 4 },
|
|
172
168
|
]).flat();
|
|
173
169
|
const cube = container({ faces: 6, height: 8, levels, mipLevels: 2, width: 8 });
|
|
174
|
-
expect(
|
|
175
|
-
|
|
176
|
-
).toBeNull();
|
|
177
|
-
(state.device.features as Set<GPUFeatureName>).add('texture-compression-bc');
|
|
170
|
+
expect(uploadWgpuCompressedTextureContainer(state, cube, new Uint8Array(240), () => new Uint8Array(64))).toBeNull();
|
|
171
|
+
(state.device.features as Set<WgpuFeatureName>).add('texture-compression-bc');
|
|
178
172
|
const writeTexture = vi.spyOn(state.device.queue, 'writeTexture');
|
|
179
173
|
expect(uploadWgpuCompressedTextureContainer(state, cube, new Uint8Array(240))).not.toBeNull();
|
|
180
174
|
expect(writeTexture).toHaveBeenCalledTimes(12);
|
|
@@ -184,7 +178,7 @@ describe('uploadWgpuCompressedTextureContainer', () => {
|
|
|
184
178
|
|
|
185
179
|
it('maps canonical multi-mip array entries to the right mip and layer slice', async () => {
|
|
186
180
|
const state = await createWgpuRenderStateForTest();
|
|
187
|
-
(state.device.features as Set<
|
|
181
|
+
(state.device.features as Set<WgpuFeatureName>).add('texture-compression-bc');
|
|
188
182
|
const array = container({
|
|
189
183
|
height: 8,
|
|
190
184
|
layers: 2,
|