@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,170 +1,40 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
import { resolveWgpuSmoothingBindGroup } from './wgpuDraw';
|
|
6
|
-
import { getWgpuRenderStateDeviceResources, getWgpuRenderStateRuntime } from './wgpuRenderState';
|
|
1
|
+
import type { WgpuRenderTarget, WgpuScreenRenderTarget } from './contract.render-wgpu-types.ts';
|
|
2
|
+
import { beginWgpuRenderPass, endWgpuRenderPass } from './wgpuRenderPass.ts';
|
|
3
|
+
import { getWgpuRenderStateRuntime } from './wgpuRenderState.ts';
|
|
4
|
+
import { declareWgpuRenderTargetColorSpace, getWgpuRenderTargetSupersampleScale } from './wgpuRenderTarget.ts';
|
|
7
5
|
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
getWgpuRenderTargetSupersampleScale,
|
|
15
|
-
initializeWgpuRenderTarget,
|
|
16
|
-
resizeWgpuRenderTarget,
|
|
17
|
-
setWgpuRenderTransform2D,
|
|
18
|
-
} from './wgpuRenderTarget';
|
|
19
|
-
import { createWgpuRenderStateForTest, installWgpuMock } from './wgpuTestHelper';
|
|
6
|
+
beginWgpuScreenRenderPassForTest,
|
|
7
|
+
createWgpuRenderStateForTest,
|
|
8
|
+
createWgpuScreenRenderTargetForTest,
|
|
9
|
+
installWgpuMock,
|
|
10
|
+
} from './wgpuTestHelper.ts';
|
|
11
|
+
import { createWgpuTextureRenderTarget } from './wgpuTextureRenderTarget.ts';
|
|
20
12
|
|
|
21
13
|
beforeAll(() => {
|
|
22
14
|
installWgpuMock();
|
|
23
15
|
});
|
|
24
16
|
|
|
25
|
-
describe('beginWgpuRenderPass', () => {
|
|
26
|
-
it('sets the render target viewport', async () => {
|
|
27
|
-
const state = await createWgpuRenderStateForTest();
|
|
28
|
-
renderWgpuBackground(state);
|
|
29
|
-
const target = createWgpuRenderTarget(state, 64, 64);
|
|
30
|
-
beginWgpuRenderPass(state, target);
|
|
31
|
-
expect(getWgpuRenderStateRuntime(state).renderTargetViewport?.width).toBe(64);
|
|
32
|
-
endWgpuRenderPass(state);
|
|
33
|
-
submitWgpuRenderPass(state);
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
it('switches the render target and restores it on end', async () => {
|
|
37
|
-
const state = await createWgpuRenderStateForTest();
|
|
38
|
-
renderWgpuBackground(state);
|
|
39
|
-
|
|
40
|
-
const target = createWgpuRenderTarget(state, 128, 128);
|
|
41
|
-
beginWgpuRenderPass(state, target);
|
|
42
|
-
|
|
43
|
-
const runtime = getWgpuRenderStateRuntime(state);
|
|
44
|
-
expect(runtime.renderTargetViewport?.width).toBe(128);
|
|
45
|
-
|
|
46
|
-
endWgpuRenderPass(state);
|
|
47
|
-
expect(runtime.renderTargetViewport).toBeNull();
|
|
48
|
-
|
|
49
|
-
submitWgpuRenderPass(state);
|
|
50
|
-
});
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
describe('createWgpuRenderTarget', () => {
|
|
54
|
-
it('returns a target with texture, view, binding cache, and depth-stencil', async () => {
|
|
55
|
-
const state = await createWgpuRenderStateForTest();
|
|
56
|
-
const target = createWgpuRenderTarget(state, 256, 256);
|
|
57
|
-
expect(target.texture).toBeDefined();
|
|
58
|
-
expect(target.view).toBeDefined();
|
|
59
|
-
expect(target.bindings).toBeDefined();
|
|
60
|
-
expect(target.depthStencilTexture).toBeDefined();
|
|
61
|
-
expect(target.width).toBe(256);
|
|
62
|
-
expect(target.height).toBe(256);
|
|
63
|
-
});
|
|
64
|
-
|
|
65
|
-
it('clamps to minimum 1×1', async () => {
|
|
66
|
-
const state = await createWgpuRenderStateForTest();
|
|
67
|
-
const target = createWgpuRenderTarget(state, 0, 0);
|
|
68
|
-
expect(target.width).toBe(1);
|
|
69
|
-
expect(target.height).toBe(1);
|
|
70
|
-
});
|
|
71
|
-
|
|
72
|
-
it('defaults to sRGB and accepts a linear content declaration', async () => {
|
|
73
|
-
const state = await createWgpuRenderStateForTest();
|
|
74
|
-
expect(createWgpuRenderTarget(state, 16, 16).colorSpace).toBe('srgb');
|
|
75
|
-
expect(createWgpuRenderTarget(state, 16, 16, state.format, 'linear').colorSpace).toBe('linear');
|
|
76
|
-
});
|
|
77
|
-
|
|
78
|
-
it('realizes four coverage samples as a 2x extent in each axis', async () => {
|
|
79
|
-
const state = await createWgpuRenderStateForTest();
|
|
80
|
-
const target = createWgpuRenderTarget(state, 64, 48, state.format, 'srgb', 4);
|
|
81
|
-
expect(target.width).toBe(128);
|
|
82
|
-
expect(target.height).toBe(96);
|
|
83
|
-
expect(target.sampleCount).toBe(4);
|
|
84
|
-
expect(target.texture.width).toBe(128);
|
|
85
|
-
expect(target.texture.height).toBe(96);
|
|
86
|
-
});
|
|
87
|
-
});
|
|
88
|
-
|
|
89
17
|
describe('declareWgpuRenderTargetColorSpace', () => {
|
|
90
|
-
it('
|
|
18
|
+
it('stamps the innermost open target and reports false outside a pass', async () => {
|
|
91
19
|
const state = await createWgpuRenderStateForTest();
|
|
92
|
-
|
|
93
|
-
const
|
|
94
|
-
const beginRenderPass = vi.spyOn(runtime.commandEncoder!, 'beginRenderPass');
|
|
95
|
-
const target = createWgpuRenderTarget(state, 32, 32, state.format, 'linear');
|
|
96
|
-
target.clearColors = [0x0a0c10ff];
|
|
97
|
-
|
|
98
|
-
beginWgpuRenderPass(state, target);
|
|
99
|
-
const attachment = Array.from(beginRenderPass.mock.calls.at(-1)![0].colorAttachments)[0]!;
|
|
100
|
-
const linearClear = attachment.clearValue as GPUColorDict;
|
|
101
|
-
expect(beginRenderPass).toHaveBeenCalledTimes(1);
|
|
102
|
-
expect(linearClear.r).toBeCloseTo(0.00303527);
|
|
103
|
-
expect(linearClear.g).toBeCloseTo(0.00367651);
|
|
104
|
-
expect(linearClear.b).toBeCloseTo(0.00518152);
|
|
105
|
-
expect(linearClear.a).toBe(1);
|
|
106
|
-
|
|
107
|
-
endWgpuRenderPass(state);
|
|
108
|
-
submitWgpuRenderPass(state);
|
|
109
|
-
});
|
|
110
|
-
|
|
111
|
-
it('stamps the current target and restores the enclosing target on end', async () => {
|
|
112
|
-
const state = await createWgpuRenderStateForTest();
|
|
113
|
-
renderWgpuBackground(state);
|
|
114
|
-
const outer = createWgpuRenderTarget(state, 32, 32);
|
|
115
|
-
const inner = createWgpuRenderTarget(state, 16, 16);
|
|
20
|
+
const outer = createWgpuTextureRenderTarget(state, 32, 32);
|
|
21
|
+
const inner = createWgpuTextureRenderTarget(state, 16, 16);
|
|
116
22
|
|
|
117
23
|
expect(declareWgpuRenderTargetColorSpace(state, 'linear')).toBe(false);
|
|
118
|
-
|
|
24
|
+
|
|
25
|
+
const screenPass = beginWgpuScreenRenderPassForTest(state);
|
|
26
|
+
const outerPass = beginWgpuRenderPass(state, outer);
|
|
119
27
|
expect(declareWgpuRenderTargetColorSpace(state, 'linear')).toBe(true);
|
|
120
|
-
beginWgpuRenderPass(state, inner);
|
|
28
|
+
const innerPass = beginWgpuRenderPass(state, inner);
|
|
121
29
|
expect(declareWgpuRenderTargetColorSpace(state, 'linear')).toBe(true);
|
|
122
|
-
|
|
30
|
+
|
|
31
|
+
endWgpuRenderPass(innerPass);
|
|
123
32
|
expect(getWgpuRenderStateRuntime(state).currentRenderTarget).toBe(outer);
|
|
124
|
-
endWgpuRenderPass(
|
|
125
|
-
|
|
33
|
+
endWgpuRenderPass(outerPass);
|
|
34
|
+
endWgpuRenderPass(screenPass);
|
|
35
|
+
|
|
126
36
|
expect(outer.colorSpace).toBe('linear');
|
|
127
37
|
expect(inner.colorSpace).toBe('linear');
|
|
128
|
-
submitWgpuRenderPass(state);
|
|
129
|
-
});
|
|
130
|
-
});
|
|
131
|
-
|
|
132
|
-
describe('destroyWgpuRenderTarget', () => {
|
|
133
|
-
it('calls destroy on texture and depth-stencil', async () => {
|
|
134
|
-
const state = await createWgpuRenderStateForTest();
|
|
135
|
-
const target = createWgpuRenderTarget(state, 64, 64);
|
|
136
|
-
const destroyTexture = vi.spyOn(target.texture, 'destroy');
|
|
137
|
-
const destroyDepth = vi.spyOn(target.depthStencilTexture, 'destroy');
|
|
138
|
-
destroyWgpuRenderTarget(state, target);
|
|
139
|
-
expect(destroyTexture).toHaveBeenCalled();
|
|
140
|
-
expect(destroyDepth).toHaveBeenCalled();
|
|
141
|
-
});
|
|
142
|
-
});
|
|
143
|
-
|
|
144
|
-
describe('drawWgpuRenderTargetResult', () => {
|
|
145
|
-
it('does not throw with an open render pass', async () => {
|
|
146
|
-
const state = await createWgpuRenderStateForTest();
|
|
147
|
-
renderWgpuBackground(state);
|
|
148
|
-
const target = createWgpuRenderTarget(state, 64, 64);
|
|
149
|
-
const fakeNode = {
|
|
150
|
-
alpha: 1,
|
|
151
|
-
material: null,
|
|
152
|
-
transform2D: { a: 1, b: 0, c: 0, d: 1, tx: 0, ty: 0 },
|
|
153
|
-
};
|
|
154
|
-
expect(() => drawWgpuRenderTargetResult(state, fakeNode, target, createMatrix())).not.toThrow();
|
|
155
|
-
submitWgpuRenderPass(state);
|
|
156
|
-
});
|
|
157
|
-
});
|
|
158
|
-
|
|
159
|
-
describe('endWgpuRenderPass', () => {
|
|
160
|
-
it('restores null renderTargetViewport', async () => {
|
|
161
|
-
const state = await createWgpuRenderStateForTest();
|
|
162
|
-
renderWgpuBackground(state);
|
|
163
|
-
const target = createWgpuRenderTarget(state, 32, 32);
|
|
164
|
-
beginWgpuRenderPass(state, target);
|
|
165
|
-
endWgpuRenderPass(state);
|
|
166
|
-
expect(getWgpuRenderStateRuntime(state).renderTargetViewport).toBeNull();
|
|
167
|
-
submitWgpuRenderPass(state);
|
|
168
38
|
});
|
|
169
39
|
});
|
|
170
40
|
|
|
@@ -173,9 +43,22 @@ describe('getWgpuRenderTargetSupersampleScale', () => {
|
|
|
173
43
|
// if the 2D projection divides by that physical width it maps logical x = 800 to NDC 0, and the scene
|
|
174
44
|
// fills a quarter of its own target. Measured on effect-sepia before the repair: the WebGPU frame
|
|
175
45
|
// equalled the WebGL frame sampled at (2x, 2y) on 12 of 12 grid points; after, 48 of 48 matched 1:1.
|
|
176
|
-
it('reports 2 for a supersampled target and 1 for a single-sample one', () => {
|
|
177
|
-
expect(getWgpuRenderTargetSupersampleScale({ sampleCount: 4 } as WgpuRenderTarget)).toBe(2);
|
|
178
|
-
expect(getWgpuRenderTargetSupersampleScale({ sampleCount: 1 } as WgpuRenderTarget)).toBe(1);
|
|
46
|
+
it('reports 2 for a supersampled texture target and 1 for a single-sample one', () => {
|
|
47
|
+
expect(getWgpuRenderTargetSupersampleScale({ context: null, sampleCount: 4 } as WgpuRenderTarget)).toBe(2);
|
|
48
|
+
expect(getWgpuRenderTargetSupersampleScale({ context: null, sampleCount: 1 } as WgpuRenderTarget)).toBe(1);
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
// A screen target reaches supersampling by a different route — an antialias option rather than a sample
|
|
52
|
+
// count — and the two must resolve to one number, or the scissor and the projection disagree about which
|
|
53
|
+
// coordinate space the frame is in.
|
|
54
|
+
it('reads a screen target from its antialias option, not its sample count', async () => {
|
|
55
|
+
const state = await createWgpuRenderStateForTest();
|
|
56
|
+
const plain = createWgpuScreenRenderTargetForTest(state);
|
|
57
|
+
const antialiased = createWgpuScreenRenderTargetForTest(state, { antialias: true });
|
|
58
|
+
|
|
59
|
+
expect(getWgpuRenderTargetSupersampleScale(plain)).toBe(1);
|
|
60
|
+
expect(getWgpuRenderTargetSupersampleScale(antialiased)).toBe(2);
|
|
61
|
+
expect(antialiased.sampleCount).toBe(1);
|
|
179
62
|
});
|
|
180
63
|
|
|
181
64
|
// Dividing the physical extent by the scale has to land back on the logical extent exactly, or the
|
|
@@ -189,77 +72,18 @@ describe('getWgpuRenderTargetSupersampleScale', () => {
|
|
|
189
72
|
[1, 4],
|
|
190
73
|
] as const) {
|
|
191
74
|
const physical = Math.max(1, Math.ceil(logical)) * (sampleCount === 4 ? 2 : 1);
|
|
192
|
-
const scale = getWgpuRenderTargetSupersampleScale({ sampleCount } as WgpuRenderTarget);
|
|
75
|
+
const scale = getWgpuRenderTargetSupersampleScale({ context: null, sampleCount } as WgpuRenderTarget);
|
|
193
76
|
|
|
194
77
|
expect(physical / scale).toBe(logical);
|
|
195
78
|
}
|
|
196
79
|
});
|
|
197
|
-
});
|
|
198
80
|
|
|
199
|
-
|
|
200
|
-
it('is the construction initializer of createWgpuRenderTarget', () => {
|
|
201
|
-
expect(typeof initializeWgpuRenderTarget).toBe('function');
|
|
202
|
-
});
|
|
203
|
-
});
|
|
204
|
-
|
|
205
|
-
describe('resizeWgpuRenderTarget', () => {
|
|
206
|
-
it('preserves the allocation when dimensions are unchanged', async () => {
|
|
207
|
-
const state = await createWgpuRenderStateForTest();
|
|
208
|
-
const target = createWgpuRenderTarget(state, 64, 64);
|
|
209
|
-
const texture = target.texture;
|
|
210
|
-
const depthStencilTexture = target.depthStencilTexture;
|
|
211
|
-
const sampler = getWgpuRenderStateDeviceResources(state).linearSampler;
|
|
212
|
-
const bindGroup = resolveWgpuSmoothingBindGroup(state, target, true);
|
|
213
|
-
|
|
214
|
-
resizeWgpuRenderTarget(state, target, 64, 64);
|
|
215
|
-
|
|
216
|
-
expect(target.texture).toBe(texture);
|
|
217
|
-
expect(target.depthStencilTexture).toBe(depthStencilTexture);
|
|
218
|
-
// The view survived, so its cached bindings must survive with it.
|
|
219
|
-
expect(target.bindings.get(sampler)).toBe(bindGroup);
|
|
220
|
-
});
|
|
221
|
-
|
|
222
|
-
it('updates width, height, and drops bindings that referenced the old view', async () => {
|
|
223
|
-
const state = await createWgpuRenderStateForTest();
|
|
224
|
-
const target = createWgpuRenderTarget(state, 64, 64);
|
|
225
|
-
const previousBindGroup = resolveWgpuSmoothingBindGroup(state, target, true);
|
|
226
|
-
resizeWgpuRenderTarget(state, target, 200, 150);
|
|
227
|
-
expect(target.width).toBe(200);
|
|
228
|
-
expect(target.height).toBe(150);
|
|
229
|
-
// Reallocation replaces the view, so every binding over the old one is dropped and rebuilt.
|
|
230
|
-
expect(target.bindings.size).toBe(0);
|
|
231
|
-
expect(resolveWgpuSmoothingBindGroup(state, target, true)).not.toBe(previousBindGroup);
|
|
232
|
-
});
|
|
233
|
-
|
|
234
|
-
it('reallocates when the effective sample count changes', async () => {
|
|
235
|
-
const state = await createWgpuRenderStateForTest();
|
|
236
|
-
const target = createWgpuRenderTarget(state, 64, 48);
|
|
237
|
-
const previousTexture = target.texture;
|
|
238
|
-
|
|
239
|
-
resizeWgpuRenderTarget(state, target, 64, 48, 4);
|
|
240
|
-
|
|
241
|
-
expect(target.width).toBe(128);
|
|
242
|
-
expect(target.height).toBe(96);
|
|
243
|
-
expect(target.sampleCount).toBe(4);
|
|
244
|
-
expect(target.texture).not.toBe(previousTexture);
|
|
245
|
-
});
|
|
246
|
-
});
|
|
247
|
-
describe('setWgpuRenderTransform2D', () => {
|
|
248
|
-
it('installs a copy of the transform, restored by the enclosing pass', async () => {
|
|
81
|
+
it('inverts the screen allocator exactly for a supersampled surface', async () => {
|
|
249
82
|
const state = await createWgpuRenderStateForTest();
|
|
250
|
-
|
|
251
|
-
const original = state.renderTransform2D;
|
|
252
|
-
const target = createWgpuRenderTarget(state, 32, 32);
|
|
253
|
-
const bake = createMatrix();
|
|
254
|
-
bake.tx = 42;
|
|
255
|
-
|
|
256
|
-
beginWgpuRenderPass(state, target);
|
|
257
|
-
setWgpuRenderTransform2D(state, bake);
|
|
258
|
-
expect(state.renderTransform2D?.tx).toBe(42);
|
|
259
|
-
expect(state.renderTransform2D).not.toBe(bake);
|
|
260
|
-
endWgpuRenderPass(state);
|
|
83
|
+
const screen: WgpuScreenRenderTarget = createWgpuScreenRenderTargetForTest(state, { antialias: true }, 801, 599);
|
|
261
84
|
|
|
262
|
-
expect(
|
|
263
|
-
|
|
85
|
+
expect(screen.width).toBe(1602);
|
|
86
|
+
expect(screen.width / getWgpuRenderTargetSupersampleScale(screen)).toBe(801);
|
|
87
|
+
expect(screen.height / getWgpuRenderTargetSupersampleScale(screen)).toBe(599);
|
|
264
88
|
});
|
|
265
89
|
});
|
|
@@ -1,32 +1,32 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
2
|
+
acquireWgpuTextureRenderTarget,
|
|
3
3
|
createWgpuRenderTargetPool,
|
|
4
4
|
destroyWgpuRenderTargetPool,
|
|
5
5
|
initializeWgpuRenderTargetPool,
|
|
6
|
-
|
|
7
|
-
} from './wgpuRenderTargetPool';
|
|
8
|
-
import { createWgpuRenderStateForTest, installWgpuMock } from './wgpuTestHelper';
|
|
6
|
+
releaseWgpuTextureRenderTarget,
|
|
7
|
+
} from './wgpuRenderTargetPool.ts';
|
|
8
|
+
import { createWgpuRenderStateForTest, installWgpuMock } from './wgpuTestHelper.ts';
|
|
9
9
|
|
|
10
10
|
beforeAll(() => {
|
|
11
11
|
installWgpuMock();
|
|
12
12
|
});
|
|
13
13
|
|
|
14
|
-
describe('
|
|
14
|
+
describe('acquireWgpuTextureRenderTarget', () => {
|
|
15
15
|
it('reuses a released target matching width, height, and format', async () => {
|
|
16
16
|
const state = await createWgpuRenderStateForTest();
|
|
17
17
|
const pool = createWgpuRenderTargetPool();
|
|
18
|
-
const first =
|
|
19
|
-
|
|
20
|
-
const second =
|
|
18
|
+
const first = acquireWgpuTextureRenderTarget(state, pool, { width: 64, height: 64 });
|
|
19
|
+
releaseWgpuTextureRenderTarget(pool, first);
|
|
20
|
+
const second = acquireWgpuTextureRenderTarget(state, pool, { width: 64, height: 64 });
|
|
21
21
|
expect(second).toBe(first);
|
|
22
22
|
});
|
|
23
23
|
|
|
24
24
|
it('allocates a distinct target when no free target matches the format', async () => {
|
|
25
25
|
const state = await createWgpuRenderStateForTest();
|
|
26
26
|
const pool = createWgpuRenderTargetPool();
|
|
27
|
-
const eight =
|
|
28
|
-
|
|
29
|
-
const hdr =
|
|
27
|
+
const eight = acquireWgpuTextureRenderTarget(state, pool, { width: 64, height: 64 });
|
|
28
|
+
releaseWgpuTextureRenderTarget(pool, eight);
|
|
29
|
+
const hdr = acquireWgpuTextureRenderTarget(state, pool, { width: 64, height: 64, format: 'rgba16float' });
|
|
30
30
|
expect(hdr).not.toBe(eight);
|
|
31
31
|
expect(hdr.format).toBe('rgba16float');
|
|
32
32
|
});
|
|
@@ -34,26 +34,26 @@ describe('acquireWgpuRenderTarget', () => {
|
|
|
34
34
|
it('realizes and pools a four-sample request at twice the extent in each axis', async () => {
|
|
35
35
|
const state = await createWgpuRenderStateForTest();
|
|
36
36
|
const pool = createWgpuRenderTargetPool();
|
|
37
|
-
const supersampled =
|
|
37
|
+
const supersampled = acquireWgpuTextureRenderTarget(state, pool, { width: 64, height: 48, sampleCount: 4 });
|
|
38
38
|
expect(supersampled.width).toBe(128);
|
|
39
39
|
expect(supersampled.height).toBe(96);
|
|
40
40
|
expect(supersampled.sampleCount).toBe(4);
|
|
41
41
|
|
|
42
|
-
|
|
43
|
-
const singleSampled =
|
|
42
|
+
releaseWgpuTextureRenderTarget(pool, supersampled);
|
|
43
|
+
const singleSampled = acquireWgpuTextureRenderTarget(state, pool, { width: 128, height: 96 });
|
|
44
44
|
expect(singleSampled).not.toBe(supersampled);
|
|
45
45
|
|
|
46
|
-
const reused =
|
|
46
|
+
const reused = acquireWgpuTextureRenderTarget(state, pool, { width: 64, height: 48, sampleCount: 4 });
|
|
47
47
|
expect(reused).toBe(supersampled);
|
|
48
48
|
});
|
|
49
49
|
|
|
50
50
|
it('re-stamps the logical color space when reusing storage', async () => {
|
|
51
51
|
const state = await createWgpuRenderStateForTest();
|
|
52
52
|
const pool = createWgpuRenderTargetPool();
|
|
53
|
-
const first =
|
|
53
|
+
const first = acquireWgpuTextureRenderTarget(state, pool, { width: 64, height: 64, colorSpace: 'linear' });
|
|
54
54
|
expect(first.colorSpace).toBe('linear');
|
|
55
|
-
|
|
56
|
-
const reused =
|
|
55
|
+
releaseWgpuTextureRenderTarget(pool, first);
|
|
56
|
+
const reused = acquireWgpuTextureRenderTarget(state, pool, { width: 64, height: 64 });
|
|
57
57
|
expect(reused).toBe(first);
|
|
58
58
|
expect(reused.colorSpace).toBe('srgb');
|
|
59
59
|
});
|
|
@@ -69,8 +69,8 @@ describe('destroyWgpuRenderTargetPool', () => {
|
|
|
69
69
|
it('clears the free list', async () => {
|
|
70
70
|
const state = await createWgpuRenderStateForTest();
|
|
71
71
|
const pool = createWgpuRenderTargetPool();
|
|
72
|
-
|
|
73
|
-
destroyWgpuRenderTargetPool(
|
|
72
|
+
releaseWgpuTextureRenderTarget(pool, acquireWgpuTextureRenderTarget(state, pool, { width: 32, height: 32 }));
|
|
73
|
+
destroyWgpuRenderTargetPool(pool);
|
|
74
74
|
expect(pool.free.length).toBe(0);
|
|
75
75
|
});
|
|
76
76
|
});
|
|
@@ -80,12 +80,12 @@ describe('initializeWgpuRenderTargetPool', () => {
|
|
|
80
80
|
expect(typeof initializeWgpuRenderTargetPool).toBe('function');
|
|
81
81
|
});
|
|
82
82
|
});
|
|
83
|
-
describe('
|
|
83
|
+
describe('releaseWgpuTextureRenderTarget', () => {
|
|
84
84
|
it('returns the target to the free list', async () => {
|
|
85
85
|
const state = await createWgpuRenderStateForTest();
|
|
86
86
|
const pool = createWgpuRenderTargetPool();
|
|
87
|
-
const target =
|
|
88
|
-
|
|
87
|
+
const target = acquireWgpuTextureRenderTarget(state, pool, { width: 16, height: 16 });
|
|
88
|
+
releaseWgpuTextureRenderTarget(pool, target);
|
|
89
89
|
expect(pool.free).toContain(target);
|
|
90
90
|
});
|
|
91
91
|
});
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import type { RenderTexture } from '@flighthq/
|
|
2
|
-
import {
|
|
1
|
+
import type { RenderTexture } from '@flighthq/render/contract';
|
|
2
|
+
import type { RenderTargetClear } from '@flighthq/render/contract';
|
|
3
|
+
import { RenderTargetTextureSourceKind } from '@flighthq/texture/contract';
|
|
3
4
|
|
|
4
|
-
import {
|
|
5
|
-
import { getWgpuRenderStateRuntime } from './wgpuRenderState';
|
|
5
|
+
import { submitWgpuFrame } from './wgpuFrame.ts';
|
|
6
|
+
import { getWgpuRenderStateRuntime } from './wgpuRenderState.ts';
|
|
6
7
|
import {
|
|
7
8
|
bindWgpuRenderTexture,
|
|
8
9
|
destroyWgpuRenderTexture,
|
|
@@ -13,8 +14,8 @@ import {
|
|
|
13
14
|
renderIntoWgpuRenderTexture,
|
|
14
15
|
setWgpuRenderTextureGuard,
|
|
15
16
|
writeWgpuRenderTextureTarget,
|
|
16
|
-
} from './wgpuRenderTexture';
|
|
17
|
-
import { createWgpuRenderStateForTest, installWgpuMock } from './wgpuTestHelper';
|
|
17
|
+
} from './wgpuRenderTexture.ts';
|
|
18
|
+
import { beginWgpuScreenRenderPassForTest, createWgpuRenderStateForTest, installWgpuMock } from './wgpuTestHelper.ts';
|
|
18
19
|
|
|
19
20
|
beforeAll(() => {
|
|
20
21
|
installWgpuMock();
|
|
@@ -48,10 +49,10 @@ describe('bindWgpuRenderTexture', () => {
|
|
|
48
49
|
const renderTexture = texture();
|
|
49
50
|
expect(bindWgpuRenderTexture(state, renderTexture)).toBeNull();
|
|
50
51
|
|
|
51
|
-
|
|
52
|
-
renderIntoWgpuRenderTexture(state, renderTexture, () => {});
|
|
52
|
+
beginWgpuScreenRenderPassForTest(state);
|
|
53
|
+
renderIntoWgpuRenderTexture(state, renderTexture, () => {}, TRANSPARENT_CLEAR);
|
|
53
54
|
expect(bindWgpuRenderTexture(state, renderTexture)).not.toBeNull();
|
|
54
|
-
|
|
55
|
+
submitWgpuFrame(state);
|
|
55
56
|
});
|
|
56
57
|
});
|
|
57
58
|
|
|
@@ -59,15 +60,15 @@ describe('destroyWgpuRenderTexture', () => {
|
|
|
59
60
|
it('destroys and removes the hidden target', async () => {
|
|
60
61
|
const state = await createWgpuRenderStateForTest();
|
|
61
62
|
const renderTexture = texture();
|
|
62
|
-
|
|
63
|
-
renderIntoWgpuRenderTexture(state, renderTexture, () => {});
|
|
63
|
+
beginWgpuScreenRenderPassForTest(state);
|
|
64
|
+
renderIntoWgpuRenderTexture(state, renderTexture, () => {}, TRANSPARENT_CLEAR);
|
|
64
65
|
const entry = getWgpuRenderStateRuntime(state).context.wgpuRenderTextureCache!.get(renderTexture)!;
|
|
65
66
|
const destroy = vi.spyOn(entry.target.texture, 'destroy');
|
|
66
67
|
|
|
67
68
|
destroyWgpuRenderTexture(state, renderTexture);
|
|
68
69
|
expect(destroy).toHaveBeenCalled();
|
|
69
70
|
expect(bindWgpuRenderTexture(state, renderTexture)).toBeNull();
|
|
70
|
-
|
|
71
|
+
submitWgpuFrame(state);
|
|
71
72
|
});
|
|
72
73
|
});
|
|
73
74
|
|
|
@@ -109,10 +110,10 @@ describe('isWgpuRenderTextureReady', () => {
|
|
|
109
110
|
const state = await createWgpuRenderStateForTest();
|
|
110
111
|
const renderTexture = texture();
|
|
111
112
|
expect(isWgpuRenderTextureReady(state, renderTexture)).toBe(false);
|
|
112
|
-
|
|
113
|
-
renderIntoWgpuRenderTexture(state, renderTexture, () => {});
|
|
113
|
+
beginWgpuScreenRenderPassForTest(state);
|
|
114
|
+
renderIntoWgpuRenderTexture(state, renderTexture, () => {}, TRANSPARENT_CLEAR);
|
|
114
115
|
expect(isWgpuRenderTextureReady(state, renderTexture)).toBe(true);
|
|
115
|
-
|
|
116
|
+
submitWgpuFrame(state);
|
|
116
117
|
});
|
|
117
118
|
});
|
|
118
119
|
|
|
@@ -120,16 +121,16 @@ describe('renderIntoWgpuRenderTexture', () => {
|
|
|
120
121
|
it('restores the enclosing pass and bumps version after success', async () => {
|
|
121
122
|
const state = await createWgpuRenderStateForTest();
|
|
122
123
|
const renderTexture = texture();
|
|
123
|
-
|
|
124
|
+
beginWgpuScreenRenderPassForTest(state);
|
|
124
125
|
const enclosingPass = getWgpuRenderStateRuntime(state).renderPass;
|
|
125
126
|
|
|
126
|
-
renderIntoWgpuRenderTexture(state, renderTexture, () => {});
|
|
127
|
+
renderIntoWgpuRenderTexture(state, renderTexture, () => {}, TRANSPARENT_CLEAR);
|
|
127
128
|
|
|
128
129
|
expect(renderTexture.version).toBe(1);
|
|
129
130
|
expect(renderTexture.colorSpace).toBe('linear');
|
|
130
131
|
expect(getWgpuRenderStateRuntime(state).renderPass).not.toBeNull();
|
|
131
132
|
expect(getWgpuRenderStateRuntime(state).renderPass).not.toBe(enclosingPass);
|
|
132
|
-
|
|
133
|
+
submitWgpuFrame(state);
|
|
133
134
|
});
|
|
134
135
|
});
|
|
135
136
|
|
|
@@ -176,3 +177,5 @@ describe('writeWgpuRenderTextureTarget', () => {
|
|
|
176
177
|
expect(target.sampleCount).toBe(4);
|
|
177
178
|
});
|
|
178
179
|
});
|
|
180
|
+
|
|
181
|
+
const TRANSPARENT_CLEAR: Readonly<RenderTargetClear> = { color: [0, 0, 0, 0], depth: 1.0, stencil: 0 };
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
getWgpuRenderTextureTarget,
|
|
4
4
|
isWgpuRenderTextureReady,
|
|
5
5
|
writeWgpuRenderTextureTarget,
|
|
6
|
-
} from './wgpuRenderTexture';
|
|
6
|
+
} from './wgpuRenderTexture.ts';
|
|
7
7
|
import {
|
|
8
8
|
acquireWgpuRenderTexture,
|
|
9
9
|
createWgpuRenderTexturePool,
|
|
@@ -11,8 +11,8 @@ import {
|
|
|
11
11
|
initializeWgpuRenderTexturePool,
|
|
12
12
|
releaseWgpuRenderTexture,
|
|
13
13
|
withWgpuRenderTextures,
|
|
14
|
-
} from './wgpuRenderTexturePool';
|
|
15
|
-
import { createWgpuRenderStateForTest, installWgpuMock } from './wgpuTestHelper';
|
|
14
|
+
} from './wgpuRenderTexturePool.ts';
|
|
15
|
+
import { createWgpuRenderStateForTest, installWgpuMock } from './wgpuTestHelper.ts';
|
|
16
16
|
|
|
17
17
|
beforeAll(() => installWgpuMock());
|
|
18
18
|
|