react-native-wgpu 0.1.0 → 0.1.3
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 +221 -13
- package/android/CMakeLists.txt +15 -1
- package/android/build.gradle +0 -18
- package/android/cpp/AndroidPlatformContext.h +132 -0
- package/android/cpp/cpp-adapter.cpp +70 -4
- package/android/src/main/java/com/webgpu/WebGPUModule.java +69 -21
- package/android/src/main/java/com/webgpu/WebGPUView.java +63 -8
- package/android/src/main/java/com/webgpu/WebGPUViewManager.java +5 -6
- package/android/src/newarch/{WgpuViewManagerSpec.java → com/webgpu/WebGPUViewManagerSpec.java} +5 -5
- package/android/src/oldarch/com/webgpu/NativeWebGPUModuleSpec.java +23 -0
- package/android/src/oldarch/{WebGPUViewManagerSpec.java → com/webgpu/WebGPUViewManagerSpec.java} +1 -1
- package/cpp/{Logger.h → WGPULogger.h} +13 -6
- package/cpp/dawn/webgpu.h +9 -0
- package/cpp/dawn/webgpu_cpp.h +95 -43
- package/cpp/dawn/webgpu_cpp_print.h +6 -0
- package/cpp/dawn/wire/client/webgpu_cpp.h +80 -43
- package/cpp/jsi/RNFHybridObject.cpp +1 -1
- package/cpp/jsi/RNFHybridObject.h +4 -4
- package/cpp/jsi/RNFJSIConverter.h +204 -17
- package/cpp/rnwgpu/ArrayBuffer.h +72 -0
- package/cpp/rnwgpu/PlatformContext.h +29 -0
- package/cpp/rnwgpu/RNWebGPUManager.cpp +13 -11
- package/cpp/rnwgpu/RNWebGPUManager.h +9 -1
- package/cpp/rnwgpu/SurfaceRegistry.h +36 -0
- package/cpp/rnwgpu/api/AsyncRunner.h +30 -0
- package/cpp/rnwgpu/api/Canvas.h +55 -0
- package/cpp/rnwgpu/api/Convertors.h +765 -0
- package/cpp/rnwgpu/api/External.h +12 -0
- package/cpp/rnwgpu/api/GPU.cpp +81 -23
- package/cpp/rnwgpu/api/GPU.h +24 -6
- package/cpp/rnwgpu/api/GPUAdapter.cpp +138 -24
- package/cpp/rnwgpu/api/GPUAdapter.h +24 -5
- package/cpp/rnwgpu/api/GPUAdapterInfo.h +19 -7
- package/cpp/rnwgpu/api/GPUBindGroup.cpp +3 -0
- package/cpp/rnwgpu/api/GPUBindGroup.h +11 -4
- package/cpp/rnwgpu/api/GPUBindGroupLayout.h +11 -4
- package/cpp/rnwgpu/api/GPUBuffer.cpp +82 -7
- package/cpp/rnwgpu/api/GPUBuffer.h +44 -8
- package/cpp/rnwgpu/api/GPUCanvasContext.cpp +63 -0
- package/cpp/rnwgpu/api/GPUCanvasContext.h +51 -8
- package/cpp/rnwgpu/api/GPUCommandBuffer.h +11 -4
- package/cpp/rnwgpu/api/GPUCommandEncoder.cpp +177 -0
- package/cpp/rnwgpu/api/GPUCommandEncoder.h +75 -3
- package/cpp/rnwgpu/api/GPUCompilationInfo.h +65 -8
- package/cpp/rnwgpu/api/GPUCompilationMessage.h +6 -4
- package/cpp/rnwgpu/api/GPUComputePassEncoder.cpp +58 -0
- package/cpp/rnwgpu/api/GPUComputePassEncoder.h +49 -3
- package/cpp/rnwgpu/api/GPUComputePipeline.cpp +11 -0
- package/cpp/rnwgpu/api/GPUComputePipeline.h +18 -3
- package/cpp/rnwgpu/api/GPUDevice.cpp +330 -3
- package/cpp/rnwgpu/api/GPUDevice.h +119 -5
- package/cpp/rnwgpu/api/GPUDeviceLostInfo.cpp +6 -0
- package/cpp/rnwgpu/api/GPUDeviceLostInfo.h +14 -7
- package/cpp/rnwgpu/api/GPUError.h +42 -0
- package/cpp/rnwgpu/api/GPUExtent3D.h +69 -0
- package/cpp/rnwgpu/api/GPUExternalTexture.h +11 -4
- package/cpp/rnwgpu/api/GPUFeatures.h +221 -0
- package/cpp/rnwgpu/api/GPUOrigin2D.h +59 -0
- package/cpp/rnwgpu/api/GPUOrigin3D.h +66 -0
- package/cpp/rnwgpu/api/GPUPipelineLayout.h +11 -4
- package/cpp/rnwgpu/api/GPUQuerySet.cpp +11 -0
- package/cpp/rnwgpu/api/GPUQuerySet.h +19 -5
- package/cpp/rnwgpu/api/GPUQueue.cpp +153 -0
- package/cpp/rnwgpu/api/GPUQueue.h +45 -4
- package/cpp/rnwgpu/api/GPURenderBundle.h +11 -4
- package/cpp/rnwgpu/api/GPURenderBundleEncoder.cpp +128 -0
- package/cpp/rnwgpu/api/GPURenderBundleEncoder.h +72 -3
- package/cpp/rnwgpu/api/GPURenderPassEncoder.cpp +161 -0
- package/cpp/rnwgpu/api/GPURenderPassEncoder.h +93 -3
- package/cpp/rnwgpu/api/GPURenderPipeline.cpp +13 -0
- package/cpp/rnwgpu/api/GPURenderPipeline.h +18 -3
- package/cpp/rnwgpu/api/GPUSampler.h +11 -4
- package/cpp/rnwgpu/api/GPUShaderModule.cpp +39 -0
- package/cpp/rnwgpu/api/GPUShaderModule.h +23 -4
- package/cpp/rnwgpu/api/GPUSupportedLimits.cpp +133 -0
- package/cpp/rnwgpu/api/GPUSupportedLimits.h +128 -4
- package/cpp/rnwgpu/api/GPUTexture.cpp +47 -0
- package/cpp/rnwgpu/api/GPUTexture.h +38 -4
- package/cpp/rnwgpu/api/GPUTextureView.h +11 -4
- package/cpp/rnwgpu/api/ImageBitmap.h +34 -0
- package/cpp/rnwgpu/api/RNWebGPU.h +100 -0
- package/cpp/rnwgpu/api/WebGPUCanvasContextFactory.h +59 -0
- package/cpp/rnwgpu/api/descriptors/GPUBindGroupDescriptor.h +31 -43
- package/cpp/rnwgpu/api/descriptors/GPUBindGroupEntry.h +40 -31
- package/cpp/rnwgpu/api/descriptors/GPUBindGroupLayoutDescriptor.h +24 -32
- package/cpp/rnwgpu/api/descriptors/GPUBindGroupLayoutEntry.h +56 -49
- package/cpp/rnwgpu/api/descriptors/GPUBlendComponent.h +27 -20
- package/cpp/rnwgpu/api/descriptors/GPUBlendState.h +23 -31
- package/cpp/rnwgpu/api/descriptors/GPUBufferBinding.h +25 -36
- package/cpp/rnwgpu/api/descriptors/GPUBufferBindingLayout.h +25 -25
- package/cpp/rnwgpu/api/descriptors/GPUBufferDescriptor.h +26 -46
- package/cpp/rnwgpu/api/descriptors/GPUCanvasConfiguration.h +31 -53
- package/cpp/rnwgpu/api/descriptors/GPUColor.h +72 -0
- package/cpp/rnwgpu/api/descriptors/GPUColorTargetState.h +27 -33
- package/cpp/rnwgpu/api/descriptors/GPUCommandBufferDescriptor.h +51 -0
- package/cpp/rnwgpu/api/descriptors/GPUCommandEncoderDescriptor.h +51 -0
- package/cpp/rnwgpu/api/descriptors/GPUComputePassDescriptor.h +24 -25
- package/cpp/rnwgpu/api/descriptors/GPUComputePassTimestampWrites.h +25 -42
- package/cpp/rnwgpu/api/descriptors/GPUComputePipelineDescriptor.h +32 -42
- package/cpp/rnwgpu/api/descriptors/GPUDepthStencilState.h +58 -76
- package/cpp/rnwgpu/api/descriptors/GPUDeviceDescriptor.h +38 -30
- package/cpp/rnwgpu/api/descriptors/GPUExternalTextureBindingLayout.h +11 -11
- package/cpp/rnwgpu/api/descriptors/GPUExternalTextureDescriptor.h +43 -34
- package/cpp/rnwgpu/api/descriptors/GPUFragmentState.h +39 -46
- package/cpp/rnwgpu/api/descriptors/GPUImageCopyBuffer.h +29 -45
- package/cpp/rnwgpu/api/descriptors/GPUImageCopyExternalImage.h +32 -31
- package/cpp/rnwgpu/api/descriptors/GPUImageCopyTexture.h +32 -36
- package/cpp/rnwgpu/api/descriptors/GPUImageCopyTextureTagged.h +42 -44
- package/cpp/rnwgpu/api/descriptors/GPUImageDataLayout.h +24 -34
- package/cpp/rnwgpu/api/descriptors/GPUMultisampleState.h +24 -32
- package/cpp/rnwgpu/api/descriptors/GPUPipelineLayoutDescriptor.h +25 -35
- package/cpp/rnwgpu/api/descriptors/GPUPrimitiveState.h +35 -26
- package/cpp/rnwgpu/api/descriptors/GPUProgrammableStage.h +29 -35
- package/cpp/rnwgpu/api/descriptors/GPUQuerySetDescriptor.h +23 -43
- package/cpp/rnwgpu/api/descriptors/GPUQueueDescriptor.h +49 -0
- package/cpp/rnwgpu/api/descriptors/GPURenderBundleDescriptor.h +51 -0
- package/cpp/rnwgpu/api/descriptors/GPURenderBundleEncoderDescriptor.h +41 -57
- package/cpp/rnwgpu/api/descriptors/GPURenderPassColorAttachment.h +42 -61
- package/cpp/rnwgpu/api/descriptors/GPURenderPassDepthStencilAttachment.h +54 -66
- package/cpp/rnwgpu/api/descriptors/GPURenderPassDescriptor.h +52 -55
- package/cpp/rnwgpu/api/descriptors/GPURenderPassTimestampWrites.h +25 -42
- package/cpp/rnwgpu/api/descriptors/GPURenderPipelineDescriptor.h +60 -56
- package/cpp/rnwgpu/api/descriptors/GPURequestAdapterOptions.h +21 -20
- package/cpp/rnwgpu/api/descriptors/GPUSamplerBindingLayout.h +17 -14
- package/cpp/rnwgpu/api/descriptors/GPUSamplerDescriptor.h +63 -63
- package/cpp/rnwgpu/api/descriptors/GPUShaderModuleCompilationHint.h +28 -27
- package/cpp/rnwgpu/api/descriptors/GPUShaderModuleDescriptor.h +28 -49
- package/cpp/rnwgpu/api/descriptors/GPUStencilFaceState.h +32 -23
- package/cpp/rnwgpu/api/descriptors/GPUStorageTextureBindingLayout.h +27 -29
- package/cpp/rnwgpu/api/descriptors/GPUTextureBindingLayout.h +27 -20
- package/cpp/rnwgpu/api/descriptors/GPUTextureDescriptor.h +49 -76
- package/cpp/rnwgpu/api/descriptors/GPUTextureViewDescriptor.h +48 -64
- package/cpp/rnwgpu/api/descriptors/GPUUncapturedErrorEventInit.h +29 -31
- package/cpp/rnwgpu/api/descriptors/GPUVertexAttribute.h +23 -44
- package/cpp/rnwgpu/api/descriptors/GPUVertexBufferLayout.h +30 -36
- package/cpp/rnwgpu/api/descriptors/GPUVertexState.h +39 -38
- package/cpp/rnwgpu/api/descriptors/Unions.h +57 -2
- package/ios/IOSPlatformContext.h +19 -0
- package/ios/IOSPlatformContext.mm +68 -0
- package/ios/MetalView.h +10 -0
- package/ios/MetalView.mm +27 -0
- package/ios/SurfaceUtils.h +13 -0
- package/ios/SurfaceUtils.mm +24 -0
- package/ios/WebGPUModule.h +8 -7
- package/ios/WebGPUModule.mm +47 -14
- package/ios/WebGPUView.h +6 -3
- package/ios/WebGPUView.mm +36 -24
- package/ios/WebGPUViewComponentDescriptor.h +61 -0
- package/ios/WebGPUViewManager.mm +6 -4
- package/lib/commonjs/Canvas.js +47 -0
- package/lib/commonjs/Canvas.js.map +1 -0
- package/lib/commonjs/{WebGPUNativeModule.js → NativeWebGPUModule.js} +1 -1
- package/lib/commonjs/{WebGPUNativeModule.js.map → NativeWebGPUModule.js.map} +1 -1
- package/lib/commonjs/WebGPUView.js +2 -0
- package/lib/commonjs/WebGPUView.js.map +1 -0
- package/lib/commonjs/WebGPUViewNativeComponent.js.map +1 -1
- package/lib/commonjs/index.js +183 -19
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/utils.js +39 -0
- package/lib/commonjs/utils.js.map +1 -0
- package/lib/module/Canvas.js +40 -0
- package/lib/module/Canvas.js.map +1 -0
- package/lib/module/{WebGPUNativeModule.js → NativeWebGPUModule.js} +1 -1
- package/lib/module/NativeWebGPUModule.js.map +1 -0
- package/lib/module/WebGPUView.js +2 -0
- package/lib/module/WebGPUView.js.map +1 -0
- package/lib/module/WebGPUViewNativeComponent.js.map +1 -1
- package/lib/module/index.js +158 -6
- package/lib/module/index.js.map +1 -1
- package/lib/module/utils.js +31 -0
- package/lib/module/utils.js.map +1 -0
- package/lib/typescript/example/src/Triangle/triangle.d.ts +3 -0
- package/lib/typescript/example/src/Triangle/triangle.d.ts.map +1 -0
- package/lib/typescript/example/src/Wireframe/Shaders.d.ts +3 -0
- package/lib/typescript/example/src/Wireframe/Shaders.d.ts.map +1 -0
- package/lib/typescript/example/src/Wireframe/models.d.ts +29 -0
- package/lib/typescript/example/src/Wireframe/models.d.ts.map +1 -0
- package/lib/typescript/example/src/components/DrawingContext.d.ts +13 -0
- package/lib/typescript/example/src/components/DrawingContext.d.ts.map +1 -0
- package/lib/typescript/example/src/components/cube.d.ts +7 -0
- package/lib/typescript/example/src/components/cube.d.ts.map +1 -0
- package/lib/typescript/example/src/components/meshes/sphere.d.ts +12 -0
- package/lib/typescript/example/src/components/meshes/sphere.d.ts.map +1 -0
- package/lib/typescript/example/src/components/meshes/teapot.d.ts +6 -0
- package/lib/typescript/example/src/components/meshes/teapot.d.ts.map +1 -0
- package/lib/typescript/example/src/components/meshes/utils.d.ts +10 -0
- package/lib/typescript/example/src/components/meshes/utils.d.ts.map +1 -0
- package/lib/typescript/jest.config.d.ts +4 -0
- package/lib/typescript/lib/commonjs/Canvas.d.ts +4 -0
- package/lib/typescript/lib/commonjs/Canvas.d.ts.map +1 -0
- package/lib/typescript/lib/commonjs/{WebGPUNativeModule.d.ts → NativeWebGPUModule.d.ts} +1 -1
- package/lib/typescript/lib/commonjs/NativeWebGPUModule.d.ts.map +1 -0
- package/lib/typescript/lib/commonjs/WebGPUView.d.ts +1 -0
- package/lib/typescript/lib/commonjs/WebGPUView.d.ts.map +1 -0
- package/lib/typescript/lib/commonjs/index.d.ts +0 -2
- package/lib/typescript/lib/commonjs/utils.d.ts +5 -0
- package/lib/typescript/lib/commonjs/utils.d.ts.map +1 -0
- package/lib/typescript/lib/module/Canvas.d.ts +2 -0
- package/lib/typescript/lib/module/Canvas.d.ts.map +1 -0
- package/lib/typescript/lib/module/{WebGPUNativeModule.d.ts → NativeWebGPUModule.d.ts} +1 -1
- package/lib/typescript/lib/module/NativeWebGPUModule.d.ts.map +1 -0
- package/lib/typescript/lib/module/WebGPUView.d.ts +1 -0
- package/lib/typescript/lib/module/WebGPUView.d.ts.map +1 -0
- package/lib/typescript/lib/module/index.d.ts +3 -3
- package/lib/typescript/lib/module/utils.d.ts +3 -0
- package/lib/typescript/lib/module/utils.d.ts.map +1 -0
- package/lib/typescript/src/Canvas.d.ts +29 -0
- package/lib/typescript/src/Canvas.d.ts.map +1 -0
- package/lib/typescript/src/{WebGPUNativeModule.d.ts → NativeWebGPUModule.d.ts} +2 -1
- package/lib/typescript/src/NativeWebGPUModule.d.ts.map +1 -0
- package/lib/typescript/src/WebGPUView.d.ts +1 -0
- package/lib/typescript/src/WebGPUView.d.ts.map +1 -0
- package/lib/typescript/src/WebGPUViewNativeComponent.d.ts +2 -1
- package/lib/typescript/src/WebGPUViewNativeComponent.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +3 -7
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/utils.d.ts +7 -0
- package/lib/typescript/src/utils.d.ts.map +1 -0
- package/libs/android/arm64-v8a/libwebgpu_dawn.so +0 -0
- package/libs/android/armeabi-v7a/libwebgpu_dawn.so +0 -0
- package/libs/android/x86/libwebgpu_dawn.so +0 -0
- package/libs/android/x86_64/libwebgpu_dawn.so +0 -0
- package/libs/dawn.json +4597 -0
- package/libs/ios/arm64_iphoneos/libwebgpu_dawn.a +0 -0
- package/libs/ios/arm64_iphonesimulator/libwebgpu_dawn.a +0 -0
- package/libs/ios/libwebgpu_dawn.a +0 -0
- package/libs/ios/libwebgpu_dawn.xcframework/Info.plist +44 -0
- package/libs/ios/libwebgpu_dawn.xcframework/ios-arm64/libwebgpu_dawn.a +0 -0
- package/libs/ios/libwebgpu_dawn.xcframework/ios-arm64_x86_64-simulator/libwebgpu_dawn.a +0 -0
- package/libs/ios/x86_64_iphonesimulator/libwebgpu_dawn.a +0 -0
- package/package.json +25 -8
- package/{react-native-webgpu.podspec → react-native-wgpu.podspec} +6 -9
- package/src/Canvas.tsx +73 -0
- package/src/{WebGPUNativeModule.ts → NativeWebGPUModule.ts} +1 -0
- package/src/WebGPUView.tsx +0 -0
- package/src/WebGPUViewNativeComponent.ts +2 -1
- package/src/index.tsx +191 -8
- package/src/utils.ts +40 -0
- package/android/src/main/AndroidManifestNew.xml +0 -2
- package/cpp/rnwgpu/MutableBuffer.h +0 -48
- package/cpp/rnwgpu/api/GPUUncapturedErrorEvent.h +0 -33
- package/cpp/rnwgpu/api/descriptors/GPUColorDict.h +0 -81
- package/cpp/rnwgpu/api/descriptors/GPUExtent3DDict.h +0 -76
- package/cpp/rnwgpu/api/descriptors/GPUExtent3DDictStrict.h +0 -91
- package/cpp/rnwgpu/api/descriptors/GPUOrigin2DDict.h +0 -61
- package/cpp/rnwgpu/api/descriptors/GPUOrigin2DDictStrict.h +0 -75
- package/cpp/rnwgpu/api/descriptors/GPUOrigin3DDict.h +0 -71
- package/cpp/rnwgpu/api/descriptors/GPUPipelineErrorInit.h +0 -54
- package/cpp/rnwgpu/api/descriptors/GPURenderPassLayout.h +0 -83
- package/ios/RNFAppleLogger.mm +0 -22
- package/ios/Utils.h +0 -5
- package/ios/Utils.m +0 -26
- package/lib/module/WebGPUNativeModule.js.map +0 -1
- package/lib/typescript/lib/commonjs/WebGPUNativeModule.d.ts.map +0 -1
- package/lib/typescript/lib/module/WebGPUNativeModule.d.ts.map +0 -1
- package/lib/typescript/scripts/build/copy-artifacts.d.ts +0 -2
- package/lib/typescript/scripts/build/copy-artifacts.d.ts.map +0 -1
- package/lib/typescript/scripts/build/dawn.d.ts +0 -2
- package/lib/typescript/scripts/build/dawn.d.ts.map +0 -1
- package/lib/typescript/scripts/build/util.d.ts +0 -13
- package/lib/typescript/scripts/build/util.d.ts.map +0 -1
- package/lib/typescript/scripts/codegen/codegen.d.ts +0 -2
- package/lib/typescript/scripts/codegen/codegen.d.ts.map +0 -1
- package/lib/typescript/scripts/codegen/model/dawn.d.ts +0 -2
- package/lib/typescript/scripts/codegen/model/dawn.d.ts.map +0 -1
- package/lib/typescript/scripts/codegen/model/model.d.ts +0 -8
- package/lib/typescript/scripts/codegen/model/model.d.ts.map +0 -1
- package/lib/typescript/scripts/codegen/templates/Descriptor.d.ts +0 -4
- package/lib/typescript/scripts/codegen/templates/Descriptor.d.ts.map +0 -1
- package/lib/typescript/scripts/codegen/templates/Enum.d.ts +0 -3
- package/lib/typescript/scripts/codegen/templates/Enum.d.ts.map +0 -1
- package/lib/typescript/scripts/codegen/templates/HybridObject.d.ts +0 -3
- package/lib/typescript/scripts/codegen/templates/HybridObject.d.ts.map +0 -1
- package/lib/typescript/scripts/codegen/templates/Unions.d.ts +0 -6
- package/lib/typescript/scripts/codegen/templates/Unions.d.ts.map +0 -1
- package/lib/typescript/scripts/codegen/templates/common.d.ts +0 -9
- package/lib/typescript/scripts/codegen/templates/common.d.ts.map +0 -1
- package/lib/typescript/scripts/codegen/util.d.ts +0 -2
- package/lib/typescript/scripts/codegen/util.d.ts.map +0 -1
- package/lib/typescript/src/WebGPUNativeModule.d.ts.map +0 -1
package/lib/module/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["WebGPUNativeModule","default","
|
|
1
|
+
{"version":3,"names":["WebGPUNativeModule","default","WebGPUModule","GPU","Symbol","hasInstance","instance","__brand","GPUAdapter","GPUAdapterInfo","GPUBindGroup","GPUBindGroupLayout","GPUBuffer","GPUCanvasContext","GPUCommandBuffer","GPUCommandEncoder","GPUCompilationInfo","GPUCompilationMessage","GPUComputePassEncoder","GPUComputePipeline","GPUDevice","GPUDeviceLostInfo","GPUError","GPUExternalTexture","GPUPipelineLayout","GPUQuerySet","GPUQueue","GPURenderBundle","GPURenderBundleEncoder","GPURenderPassEncoder","GPURenderPipeline","GPUSampler","GPUShaderModule","GPUTexture","GPUTextureView","global","install","navigator","gpu","RNWebGPU","userAgent","createImageBitmap","params","Promise","resolve"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":"AAAA;AACA,OAAOA,kBAAkB,MAAM,sBAAsB;AAErD,cAAc,UAAU;AACxB,cAAc,6BAA6B;AAC3C,cAAc,SAAS;AACvB,SAASC,OAAO,IAAIC,YAAY,QAAQ,sBAAsB;AAE9D,MAAMC,GAAQ,GAAG,CAAC,CAAC;AACnBA,GAAG,CAACC,MAAM,CAACC,WAAW,CAAC,GAAG,UAAUC,QAAgB,EAAE;EACpD,OAAO,SAAS,IAAIA,QAAQ,IAAIA,QAAQ,CAACC,OAAO,KAAK,KAAK;AAC5D,CAAC;AAED,MAAMC,UAAe,GAAG,CAAC,CAAC;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R,eAAe,GAAGA,eAAe;AACxCQ,MAAM,CAACP,sBAAsB,GAAGA,sBAAsB;AACtDO,MAAM,CAACN,oBAAoB,GAAGA,oBAAoB;AAClDM,MAAM,CAACL,iBAAiB,GAAGA,iBAAiB;AAC5CK,MAAM,CAACJ,UAAU,GAAGA,UAAU;AAC9BI,MAAM,CAACH,eAAe,GAAGA,eAAe;AACxCG,MAAM,CAACF,UAAU,GAAGA,UAAU;AAC9BE,MAAM,CAACD,cAAc,GAAGA,cAAc;AAEtClC,kBAAkB,CAACoC,OAAO,CAAC,CAAC;AAE5B,IAAI,CAACC,SAAS,EAAE;EACd;EACA;EACAA,SAAS,GAAG,CAAC,CAAC;AAChB;AACA;AACA;AACAA,SAAS,CAACC,GAAG,GAAGC,QAAQ,CAACD,GAAG;;AAE5B;AACA;AACAD,SAAS,CAACG,SAAS,GAAG,cAAc;AAEpCL,MAAM,CAACM,iBAAiB,GACtBN,MAAM,CAACM,iBAAiB,KACvB,CAAC,GAAGC,MAA4C,KAC/C,IAAIC,OAAO,CAAEC,OAAO,IAAKA,OAAO,CAACL,QAAQ,CAACE,iBAAiB,CAAC,GAAGC,MAAM,CAAC,CAAC,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { useEffect, useRef } from "react";
|
|
2
|
+
export const warnIfNotHardwareAccelerated = adapter => {
|
|
3
|
+
if (adapter.info.architecture === "swiftshader") {
|
|
4
|
+
console.warn("GPUAdapter is not hardware accelerated. This is common on Android emulators. Rendering will be slow.");
|
|
5
|
+
}
|
|
6
|
+
};
|
|
7
|
+
export const useCanvasEffect = effect => {
|
|
8
|
+
const ref = useRef(null);
|
|
9
|
+
const unsubscribe = useRef();
|
|
10
|
+
useEffect(() => {
|
|
11
|
+
requestAnimationFrame(async () => {
|
|
12
|
+
// const adapter = await navigator.gpu.requestAdapter();
|
|
13
|
+
// if (!adapter) {
|
|
14
|
+
// return;
|
|
15
|
+
// }
|
|
16
|
+
// const device = await adapter.requestDevice();
|
|
17
|
+
const unsub = await effect();
|
|
18
|
+
if (unsub) {
|
|
19
|
+
unsubscribe.current = unsub;
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
return () => {
|
|
23
|
+
if (unsubscribe.current) {
|
|
24
|
+
unsubscribe.current();
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
28
|
+
}, []);
|
|
29
|
+
return ref;
|
|
30
|
+
};
|
|
31
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useEffect","useRef","warnIfNotHardwareAccelerated","adapter","info","architecture","console","warn","useCanvasEffect","effect","ref","unsubscribe","requestAnimationFrame","unsub","current"],"sourceRoot":"../../src","sources":["utils.ts"],"mappings":"AAAA,SAASA,SAAS,EAAEC,MAAM,QAAQ,OAAO;AAMzC,OAAO,MAAMC,4BAA4B,GAAIC,OAAmB,IAAK;EACnE,IAAIA,OAAO,CAACC,IAAI,CAACC,YAAY,KAAK,aAAa,EAAE;IAC/CC,OAAO,CAACC,IAAI,CACV,sGACF,CAAC;EACH;AACF,CAAC;AAED,OAAO,MAAMC,eAAe,GAC1BC,MAA8D,IAC3D;EACH,MAAMC,GAAG,GAAGT,MAAM,CAAY,IAAI,CAAC;EACnC,MAAMU,WAAW,GAAGV,MAAM,CAAc,CAAC;EACzCD,SAAS,CAAC,MAAM;IACdY,qBAAqB,CAAC,YAAY;MAChC;MACA;MACA;MACA;MACA;MACA,MAAMC,KAAK,GAAG,MAAMJ,MAAM,CAAC,CAAC;MAC5B,IAAII,KAAK,EAAE;QACTF,WAAW,CAACG,OAAO,GAAGD,KAAK;MAC7B;IACF,CAAC,CAAC;IACF,OAAO,MAAM;MACX,IAAIF,WAAW,CAACG,OAAO,EAAE;QACvBH,WAAW,CAACG,OAAO,CAAC,CAAC;MACvB;IACF,CAAC;IACD;EACF,CAAC,EAAE,EAAE,CAAC;EACN,OAAOJ,GAAG;AACZ,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export declare const triangleVertWGSL = "@vertex\nfn main(\n @builtin(vertex_index) VertexIndex : u32\n) -> @builtin(position) vec4f {\n var pos = array<vec2f, 3>(\n vec2(0.0, 0.5),\n vec2(-0.5, -0.5),\n vec2(0.5, -0.5)\n );\n\n return vec4f(pos[VertexIndex], 0.0, 1.0);\n}";
|
|
2
|
+
export declare const redFragWGSL = "@fragment\nfn main() -> @location(0) vec4f {\n return vec4(1.0, 0.0, 0.0, 1.0);\n}";
|
|
3
|
+
//# sourceMappingURL=triangle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"triangle.d.ts","sourceRoot":"","sources":["../../../../../example/src/Triangle/triangle.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,gBAAgB,0PAW3B,CAAC;AAEH,eAAO,MAAM,WAAW,wFAGtB,CAAC"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export declare const solidColorLitWGSL = "struct Uniforms {\n worldViewProjectionMatrix: mat4x4f,\n worldMatrix: mat4x4f,\n color: vec4f,\n};\n\nstruct Vertex {\n @location(0) position: vec4f,\n @location(1) normal: vec3f,\n};\n\nstruct VSOut {\n @builtin(position) position: vec4f,\n @location(0) normal: vec3f,\n};\n\n@group(0) @binding(0) var<uniform> uni: Uniforms;\n\n@vertex fn vs(vin: Vertex) -> VSOut {\n var vOut: VSOut;\n vOut.position = uni.worldViewProjectionMatrix * vin.position;\n vOut.normal = (uni.worldMatrix * vec4f(vin.normal, 0)).xyz;\n return vOut;\n}\n\n@fragment fn fs(vin: VSOut) -> @location(0) vec4f {\n let lightDirection = normalize(vec3f(4, 10, 6));\n let light = dot(normalize(vin.normal), lightDirection) * 0.5 + 0.5;\n return vec4f(uni.color.rgb * light, uni.color.a);\n}";
|
|
2
|
+
export declare const wireframeWGSL = "struct Uniforms {\n worldViewProjectionMatrix: mat4x4f,\n worldMatrix: mat4x4f,\n color: vec4f,\n};\n\nstruct LineUniforms {\n stride: u32,\n thickness: f32,\n alphaThreshold: f32,\n};\n\nstruct VSOut {\n @builtin(position) position: vec4f,\n};\n\n@group(0) @binding(0) var<uniform> uni: Uniforms;\n@group(0) @binding(1) var<storage, read> positions: array<f32>;\n@group(0) @binding(2) var<storage, read> indices: array<u32>;\n@group(0) @binding(3) var<uniform> line: LineUniforms;\n\n@vertex fn vsIndexedU32(@builtin(vertex_index) vNdx: u32) -> VSOut {\n // indices make a triangle so for every 3 indices we need to output\n // 6 values\n let triNdx = vNdx / 6;\n // 0 1 0 1 0 1 0 1 0 1 0 1 vNdx % 2\n // 0 0 1 1 2 2 3 3 4 4 5 5 vNdx / 2\n // 0 1 1 2 2 3 3 4 4 5 5 6 vNdx % 2 + vNdx / 2\n // 0 1 1 2 2 0 0 1 1 2 2 0 (vNdx % 2 + vNdx / 2) % 3\n let vertNdx = (vNdx % 2 + vNdx / 2) % 3;\n let index = indices[triNdx * 3 + vertNdx];\n\n // note:\n //\n // * if your indices are U16 you could use this\n //\n // let indexNdx = triNdx * 3 + vertNdx;\n // let twoIndices = indices[indexNdx / 2]; // indices is u32 but we want u16\n // let index = (twoIndices >> ((indexNdx & 1) * 16)) & 0xFFFF;\n //\n // * if you're not using indices you could use this\n //\n // let index = triNdx * 3 + vertNdx;\n\n let pNdx = index * line.stride;\n let position = vec4f(positions[pNdx], positions[pNdx + 1], positions[pNdx + 2], 1);\n\n var vOut: VSOut;\n vOut.position = uni.worldViewProjectionMatrix * position;\n return vOut;\n}\n\n@fragment fn fs() -> @location(0) vec4f {\n return uni.color + vec4f(0.5);\n}\n\nstruct BarycentricCoordinateBasedVSOutput {\n @builtin(position) position: vec4f,\n @location(0) barycenticCoord: vec3f,\n};\n\n@vertex fn vsIndexedU32BarycentricCoordinateBasedLines(\n @builtin(vertex_index) vNdx: u32\n) -> BarycentricCoordinateBasedVSOutput {\n let vertNdx = vNdx % 3;\n let index = indices[vNdx];\n\n // note:\n //\n // * if your indices are U16 you could use this\n //\n // let twoIndices = indices[vNdx / 2]; // indices is u32 but we want u16\n // let index = (twoIndices >> ((vNdx & 1) * 16)) & 0xFFFF;\n //\n // * if you're not using indices you could use this\n //\n // let index = vNdx;\n\n let pNdx = index * line.stride;\n let position = vec4f(positions[pNdx], positions[pNdx + 1], positions[pNdx + 2], 1);\n\n var vsOut: BarycentricCoordinateBasedVSOutput;\n vsOut.position = uni.worldViewProjectionMatrix * position;\n\n // emit a barycentric coordinate\n vsOut.barycenticCoord = vec3f(0);\n vsOut.barycenticCoord[vertNdx] = 1.0;\n return vsOut;\n}\n\nfn edgeFactor(bary: vec3f) -> f32 {\n let d = fwidth(bary);\n let a3 = smoothstep(vec3f(0.0), d * line.thickness, bary);\n return min(min(a3.x, a3.y), a3.z);\n}\n\n@fragment fn fsBarycentricCoordinateBasedLines(\n v: BarycentricCoordinateBasedVSOutput\n) -> @location(0) vec4f {\n let a = 1.0 - edgeFactor(v.barycenticCoord);\n if (a < line.alphaThreshold) {\n discard;\n }\n\n return vec4((uni.color.rgb + 0.5) * a, a);\n}\n";
|
|
3
|
+
//# sourceMappingURL=Shaders.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Shaders.d.ts","sourceRoot":"","sources":["../../../../../example/src/Wireframe/Shaders.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,iBAAiB,6wBA6B5B,CAAC;AAEH,eAAO,MAAM,aAAa,oiGA0GzB,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
type Mesh = {
|
|
2
|
+
positions: [number, number, number][];
|
|
3
|
+
triangles: [number, number, number][];
|
|
4
|
+
normals: [number, number, number][];
|
|
5
|
+
};
|
|
6
|
+
export declare function convertMeshToTypedArrays(mesh: Mesh, scale: number, offset?: number[]): {
|
|
7
|
+
vertices: Float32Array;
|
|
8
|
+
indices: Uint32Array;
|
|
9
|
+
};
|
|
10
|
+
export declare const modelData: {
|
|
11
|
+
teapot: {
|
|
12
|
+
vertices: Float32Array;
|
|
13
|
+
indices: Uint32Array;
|
|
14
|
+
};
|
|
15
|
+
sphere: {
|
|
16
|
+
vertices: Float32Array;
|
|
17
|
+
indices: Uint32Array;
|
|
18
|
+
};
|
|
19
|
+
jewel: {
|
|
20
|
+
vertices: Float32Array;
|
|
21
|
+
indices: Uint32Array;
|
|
22
|
+
};
|
|
23
|
+
rock: {
|
|
24
|
+
vertices: Float32Array;
|
|
25
|
+
indices: Uint32Array;
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
export {};
|
|
29
|
+
//# sourceMappingURL=models.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"models.d.ts","sourceRoot":"","sources":["../../../../../example/src/Wireframe/models.ts"],"names":[],"mappings":"AAUA,KAAK,IAAI,GAAG;IACV,SAAS,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,CAAC;IACtC,SAAS,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,CAAC;IACtC,OAAO,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,CAAC;CACrC,CAAC;AAEF,wBAAgB,wBAAwB,CACtC,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,MAAM,EACb,MAAM,WAAY;;;EAoBnB;AAoED,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;CAKrB,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/// <reference types="@webgpu/types" />
|
|
2
|
+
export interface DrawingContext {
|
|
3
|
+
width: number;
|
|
4
|
+
height: number;
|
|
5
|
+
getCurrentTexture(): GPUTexture;
|
|
6
|
+
getImageData(): Promise<{
|
|
7
|
+
data: number[];
|
|
8
|
+
width: number;
|
|
9
|
+
height: number;
|
|
10
|
+
format: string;
|
|
11
|
+
}>;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=DrawingContext.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DrawingContext.d.ts","sourceRoot":"","sources":["../../../../../example/src/components/DrawingContext.ts"],"names":[],"mappings":";AAAA,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,iBAAiB,IAAI,UAAU,CAAC;IAChC,YAAY,IAAI,OAAO,CAAC;QACtB,IAAI,EAAE,MAAM,EAAE,CAAC;QACf,KAAK,EAAE,MAAM,CAAC;QACd,MAAM,EAAE,MAAM,CAAC;QACf,MAAM,EAAE,MAAM,CAAC;KAChB,CAAC,CAAC;CACJ"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const cubeVertexSize: number;
|
|
2
|
+
export declare const cubePositionOffset = 0;
|
|
3
|
+
export declare const cubeColorOffset: number;
|
|
4
|
+
export declare const cubeUVOffset: number;
|
|
5
|
+
export declare const cubeVertexCount = 36;
|
|
6
|
+
export declare const cubeVertexArray: Float32Array;
|
|
7
|
+
//# sourceMappingURL=cube.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cube.d.ts","sourceRoot":"","sources":["../../../../../example/src/components/cube.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,cAAc,QAAS,CAAC;AACrC,eAAO,MAAM,kBAAkB,IAAI,CAAC;AACpC,eAAO,MAAM,eAAe,QAAQ,CAAC;AACrC,eAAO,MAAM,YAAY,QAAQ,CAAC;AAClC,eAAO,MAAM,eAAe,KAAK,CAAC;AAGlC,eAAO,MAAM,eAAe,cA2C1B,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export interface SphereMesh {
|
|
2
|
+
vertices: Float32Array;
|
|
3
|
+
indices: Uint16Array;
|
|
4
|
+
}
|
|
5
|
+
export declare const SphereLayout: {
|
|
6
|
+
vertexStride: number;
|
|
7
|
+
positionsOffset: number;
|
|
8
|
+
normalOffset: number;
|
|
9
|
+
uvOffset: number;
|
|
10
|
+
};
|
|
11
|
+
export declare function createSphereMesh(radius: number, widthSegments?: number, heightSegments?: number, randomness?: number): SphereMesh;
|
|
12
|
+
//# sourceMappingURL=sphere.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sphere.d.ts","sourceRoot":"","sources":["../../../../../../example/src/components/meshes/sphere.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,UAAU;IACzB,QAAQ,EAAE,YAAY,CAAC;IACvB,OAAO,EAAE,WAAW,CAAC;CACtB;AAED,eAAO,MAAM,YAAY;;;;;CAKxB,CAAC;AAGF,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,MAAM,EACd,aAAa,SAAK,EAClB,cAAc,SAAK,EACnB,UAAU,SAAI,GACb,UAAU,CAkFZ"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"teapot.d.ts","sourceRoot":"","sources":["../../../../../../example/src/components/meshes/teapot.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,IAAI;;;;CAIhB,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare function computeSurfaceNormals(positions: [number, number, number][], triangles: [number, number, number][]): [number, number, number][];
|
|
2
|
+
export declare function generateNormals(maxAngle: number, positions: [number, number, number][], triangles: [number, number, number][]): {
|
|
3
|
+
positions: [number, number, number][];
|
|
4
|
+
normals: [number, number, number][];
|
|
5
|
+
triangles: [number, number, number][];
|
|
6
|
+
};
|
|
7
|
+
type ProjectedPlane = "xy" | "xz" | "yz";
|
|
8
|
+
export declare function computeProjectedPlaneUVs(positions: [number, number, number][], projectedPlane?: ProjectedPlane): [number, number][];
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../../../example/src/components/meshes/utils.ts"],"names":[],"mappings":"AAGA,wBAAgB,qBAAqB,CACnC,SAAS,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,EACrC,SAAS,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,GACpC,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,CA4B5B;AAsBD,wBAAgB,eAAe,CAC7B,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,EACrC,SAAS,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE;;;;EA2ItC;AAED,KAAK,cAAc,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAQzC,wBAAgB,wBAAwB,CACtC,SAAS,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,EACrC,cAAc,GAAE,cAAqB,GACpC,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,CAuBpB"}
|
|
@@ -2,4 +2,8 @@ export let preset: string;
|
|
|
2
2
|
export let modulePathIgnorePatterns: string[];
|
|
3
3
|
export let globalSetup: string;
|
|
4
4
|
export let globalTeardown: string;
|
|
5
|
+
export let transform: {
|
|
6
|
+
'^.+\\.(js|jsx|ts|tsx)$': string;
|
|
7
|
+
};
|
|
8
|
+
export let transformIgnorePatterns: string[];
|
|
5
9
|
//# sourceMappingURL=jest.config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Canvas.d.ts","sourceRoot":"","sources":["../../../commonjs/Canvas.js"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NativeWebGPUModule.d.ts","sourceRoot":"","sources":["../../../commonjs/NativeWebGPUModule.js"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=WebGPUView.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WebGPUView.d.ts","sourceRoot":"","sources":["../../../commonjs/WebGPUView.js"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../commonjs/utils.js"],"names":[],"mappings":";AAOA,iEAIC;AAED,4EAuBC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Canvas.d.ts","sourceRoot":"","sources":["../../../module/Canvas.js"],"names":[],"mappings":"AAUA,mGA4BG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NativeWebGPUModule.d.ts","sourceRoot":"","sources":["../../../module/NativeWebGPUModule.js"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=WebGPUView.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WebGPUView.d.ts","sourceRoot":"","sources":["../../../module/WebGPUView.js"],"names":[],"mappings":""}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export
|
|
1
|
+
export * from "./Canvas";
|
|
2
2
|
export * from "./WebGPUViewNativeComponent";
|
|
3
|
-
export
|
|
4
|
-
export
|
|
3
|
+
export * from "./utils";
|
|
4
|
+
export { default as WebGPUModule } from "./NativeWebGPUModule";
|
|
5
5
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../module/utils.js"],"names":[],"mappings":"AACO,iEAIN;AACM,qFAuBN"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/// <reference types="@webgpu/types" />
|
|
2
|
+
/// <reference types="node" />
|
|
3
|
+
import type { ViewProps } from "react-native";
|
|
4
|
+
declare global {
|
|
5
|
+
var __WebGPUContextRegistry: Record<number, NativeCanvas>;
|
|
6
|
+
var RNWebGPU: {
|
|
7
|
+
gpu: GPU;
|
|
8
|
+
MakeWebGPUCanvasContext: (nativeCanvas: NativeCanvas) => CanvasContext;
|
|
9
|
+
DecodeToUTF8: (buffer: NodeJS.ArrayBufferView | ArrayBuffer) => string;
|
|
10
|
+
createImageBitmap: typeof createImageBitmap;
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
export interface NativeCanvas {
|
|
14
|
+
surface: bigint;
|
|
15
|
+
width: number;
|
|
16
|
+
height: number;
|
|
17
|
+
clientWidth: number;
|
|
18
|
+
clientHeight: number;
|
|
19
|
+
}
|
|
20
|
+
type CanvasContext = GPUCanvasContext & {
|
|
21
|
+
present: () => void;
|
|
22
|
+
getNativeSurface: () => NativeCanvas;
|
|
23
|
+
};
|
|
24
|
+
export interface CanvasRef {
|
|
25
|
+
getContext(contextName: "webgpu"): CanvasContext | null;
|
|
26
|
+
}
|
|
27
|
+
export declare const Canvas: import("react").ForwardRefExoticComponent<ViewProps & import("react").RefAttributes<CanvasRef>>;
|
|
28
|
+
export {};
|
|
29
|
+
//# sourceMappingURL=Canvas.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Canvas.d.ts","sourceRoot":"","sources":["../../../src/Canvas.tsx"],"names":[],"mappings":";;AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAW9C,OAAO,CAAC,MAAM,CAAC;IAEb,IAAI,uBAAuB,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;IAE1D,IAAI,QAAQ,EAAE;QACZ,GAAG,EAAE,GAAG,CAAC;QACT,uBAAuB,EAAE,CAAC,YAAY,EAAE,YAAY,KAAK,aAAa,CAAC;QACvE,YAAY,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,eAAe,GAAG,WAAW,KAAK,MAAM,CAAC;QACvE,iBAAiB,EAAE,OAAO,iBAAiB,CAAC;KAC7C,CAAC;CACH;AAED,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;CACtB;AAKD,KAAK,aAAa,GAAG,gBAAgB,GAAG;IACtC,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,gBAAgB,EAAE,MAAM,YAAY,CAAC;CACtC,CAAC;AAEF,MAAM,WAAW,SAAS;IACxB,UAAU,CAAC,WAAW,EAAE,QAAQ,GAAG,aAAa,GAAG,IAAI,CAAC;CACzD;AAED,eAAO,MAAM,MAAM,iGA6BjB,CAAC"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { TurboModule } from "react-native/Libraries/TurboModule/RCTExport";
|
|
2
2
|
export interface Spec extends TurboModule {
|
|
3
3
|
install: () => boolean;
|
|
4
|
+
createSurfaceContext: (contextId: number) => boolean;
|
|
4
5
|
}
|
|
5
6
|
declare const _default: Spec;
|
|
6
7
|
export default _default;
|
|
7
|
-
//# sourceMappingURL=
|
|
8
|
+
//# sourceMappingURL=NativeWebGPUModule.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NativeWebGPUModule.d.ts","sourceRoot":"","sources":["../../../src/NativeWebGPUModule.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,8CAA8C,CAAC;AAGhF,MAAM,WAAW,IAAK,SAAQ,WAAW;IACvC,OAAO,EAAE,MAAM,OAAO,CAAC;IACvB,oBAAoB,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,OAAO,CAAC;CACtD;;AAGD,wBAAsE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=WebGPUView.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WebGPUView.d.ts","sourceRoot":"","sources":["../../../src/WebGPUView.tsx"],"names":[],"mappings":""}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/// <reference types="react-native/types/modules/Codegen" />
|
|
2
2
|
import type { ViewProps } from "react-native";
|
|
3
|
+
import type { Int32 } from "react-native/Libraries/Types/CodegenTypes";
|
|
3
4
|
interface NativeProps extends ViewProps {
|
|
4
|
-
|
|
5
|
+
contextId?: Int32;
|
|
5
6
|
}
|
|
6
7
|
declare const _default: import("react-native/Libraries/Utilities/codegenNativeComponent").NativeComponentType<NativeProps>;
|
|
7
8
|
export default _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WebGPUViewNativeComponent.d.ts","sourceRoot":"","sources":["../../../src/WebGPUViewNativeComponent.ts"],"names":[],"mappings":";AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"WebGPUViewNativeComponent.d.ts","sourceRoot":"","sources":["../../../src/WebGPUViewNativeComponent.ts"],"names":[],"mappings":";AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,2CAA2C,CAAC;AAEvE,UAAU,WAAY,SAAQ,SAAS;IACrC,SAAS,CAAC,EAAE,KAAK,CAAC;CACnB;;AAGD,wBAAiE"}
|
|
@@ -1,9 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
export { default as WebGPUView } from "./WebGPUViewNativeComponent";
|
|
1
|
+
export * from "./Canvas";
|
|
3
2
|
export * from "./WebGPUViewNativeComponent";
|
|
4
|
-
export
|
|
5
|
-
|
|
6
|
-
var gpu: GPU;
|
|
7
|
-
}
|
|
8
|
-
export declare const gpu: GPU;
|
|
3
|
+
export * from "./utils";
|
|
4
|
+
export { default as WebGPUModule } from "./NativeWebGPUModule";
|
|
9
5
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAGA,cAAc,UAAU,CAAC;AACzB,cAAc,6BAA6B,CAAC;AAC5C,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,sBAAsB,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/// <reference types="@webgpu/types" />
|
|
2
|
+
import type { CanvasRef } from "./Canvas";
|
|
3
|
+
type Unsubscribe = () => void;
|
|
4
|
+
export declare const warnIfNotHardwareAccelerated: (adapter: GPUAdapter) => void;
|
|
5
|
+
export declare const useCanvasEffect: (effect: () => void | Unsubscribe | Promise<void | Unsubscribe>) => import("react").RefObject<CanvasRef>;
|
|
6
|
+
export {};
|
|
7
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/utils.ts"],"names":[],"mappings":";AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAE1C,KAAK,WAAW,GAAG,MAAM,IAAI,CAAC;AAE9B,eAAO,MAAM,4BAA4B,YAAa,UAAU,SAM/D,CAAC;AAEF,eAAO,MAAM,eAAe,WAClB,MAAM,IAAI,GAAG,WAAW,GAAG,QAAQ,IAAI,GAAG,WAAW,CAAC,yCAwB/D,CAAC"}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|