react-native-wgpu 0.5.13 → 0.5.14
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 +13 -386
- package/lib/commonjs/index.js +7 -4
- package/lib/commonjs/index.js.map +1 -1
- package/lib/module/index.js +4 -4
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/webgpu/src/Canvas.d.ts.map +1 -0
- package/lib/typescript/webgpu/src/NativeWebGPUModule.d.ts.map +1 -0
- package/lib/typescript/webgpu/src/Offscreen.d.ts.map +1 -0
- package/lib/typescript/webgpu/src/WebGPUViewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/webgpu/src/external/ModuleProxy.d.ts.map +1 -0
- package/lib/typescript/webgpu/src/external/index.d.ts.map +1 -0
- package/lib/typescript/webgpu/src/external/reanimated/ReanimatedProxy.d.ts.map +1 -0
- package/lib/typescript/webgpu/src/external/reanimated/index.d.ts.map +1 -0
- package/lib/typescript/webgpu/src/external/reanimated/registerWebGPUForReanimated.d.ts.map +1 -0
- package/lib/typescript/webgpu/src/hooks.d.ts.map +1 -0
- package/lib/typescript/webgpu/src/index.d.ts.map +1 -0
- package/lib/typescript/webgpu/src/main/index.d.ts.map +1 -0
- package/lib/typescript/webgpu/src/types.d.ts.map +1 -0
- package/lib/typescript/{eslint.config.d.mts.map → webgpu-shim/eslint.config.d.mts.map} +1 -1
- package/lib/typescript/{lib → webgpu-shim/lib}/commonjs/index.d.ts.map +1 -1
- package/lib/typescript/webgpu-shim/lib/module/index.d.ts +2 -0
- package/lib/typescript/{lib → webgpu-shim/lib}/module/index.d.ts.map +1 -1
- package/lib/typescript/webgpu-shim/src/index.d.ts +2 -0
- package/lib/typescript/webgpu-shim/src/index.d.ts.map +1 -0
- package/package.json +12 -81
- package/src/index.ts +9 -0
- package/LICENSE +0 -20
- package/android/CMakeLists.txt +0 -110
- package/android/build.gradle +0 -138
- package/android/cpp/AndroidPlatformContext.h +0 -328
- package/android/cpp/cpp-adapter.cpp +0 -71
- package/android/src/main/AndroidManifest.xml +0 -3
- package/android/src/main/java/com/webgpu/WebGPUAHBView.java +0 -298
- package/android/src/main/java/com/webgpu/WebGPUAPI.java +0 -20
- package/android/src/main/java/com/webgpu/WebGPUBaseView.java +0 -61
- package/android/src/main/java/com/webgpu/WebGPUModule.java +0 -50
- package/android/src/main/java/com/webgpu/WebGPUSurfaceView.java +0 -41
- package/android/src/main/java/com/webgpu/WebGPUSurfaceViewWithSC.java +0 -79
- package/android/src/main/java/com/webgpu/WebGPUTextureView.java +0 -46
- package/android/src/main/java/com/webgpu/WebGPUView.java +0 -108
- package/android/src/main/java/com/webgpu/WebGPUViewManager.java +0 -38
- package/android/src/main/java/com/webgpu/WebGPUViewPackage.java +0 -50
- package/android/src/newarch/com/webgpu/WebGPUViewManagerSpec.java +0 -24
- package/apple/ApplePlatformContext.h +0 -44
- package/apple/ApplePlatformContext.mm +0 -302
- package/apple/AppleVideoPlayer.h +0 -31
- package/apple/AppleVideoPlayer.mm +0 -314
- package/apple/MetalView.h +0 -13
- package/apple/MetalView.mm +0 -50
- package/apple/RNWGUIKit.h +0 -16
- package/apple/WebGPUModule.h +0 -13
- package/apple/WebGPUModule.mm +0 -89
- package/apple/WebGPUView.h +0 -12
- package/apple/WebGPUView.mm +0 -66
- package/cpp/WGPULogger.h +0 -100
- package/cpp/dawn_logging.cpp +0 -119
- package/cpp/jsi/EnumMapper.h +0 -45
- package/cpp/jsi/JSIConverter.h +0 -473
- package/cpp/jsi/NativeObject.h +0 -607
- package/cpp/jsi/Promise.cpp +0 -44
- package/cpp/jsi/Promise.h +0 -35
- package/cpp/jsi/RuntimeAwareCache.cpp +0 -7
- package/cpp/jsi/RuntimeAwareCache.h +0 -100
- package/cpp/jsi/RuntimeLifecycleMonitor.cpp +0 -72
- package/cpp/jsi/RuntimeLifecycleMonitor.h +0 -32
- package/cpp/rnwgpu/ArrayBuffer.h +0 -117
- package/cpp/rnwgpu/PlatformContext.h +0 -127
- package/cpp/rnwgpu/RNWebGPUManager.cpp +0 -237
- package/cpp/rnwgpu/RNWebGPUManager.h +0 -46
- package/cpp/rnwgpu/SurfaceRegistry.h +0 -230
- package/cpp/rnwgpu/api/Canvas.h +0 -57
- package/cpp/rnwgpu/api/Convertors.h +0 -783
- package/cpp/rnwgpu/api/External.h +0 -12
- package/cpp/rnwgpu/api/GPU.cpp +0 -154
- package/cpp/rnwgpu/api/GPU.h +0 -58
- package/cpp/rnwgpu/api/GPUAdapter.cpp +0 -267
- package/cpp/rnwgpu/api/GPUAdapter.h +0 -59
- package/cpp/rnwgpu/api/GPUAdapterInfo.h +0 -57
- package/cpp/rnwgpu/api/GPUBindGroup.cpp +0 -3
- package/cpp/rnwgpu/api/GPUBindGroup.h +0 -51
- package/cpp/rnwgpu/api/GPUBindGroupLayout.h +0 -52
- package/cpp/rnwgpu/api/GPUBuffer.cpp +0 -97
- package/cpp/rnwgpu/api/GPUBuffer.h +0 -87
- package/cpp/rnwgpu/api/GPUCanvasContext.cpp +0 -67
- package/cpp/rnwgpu/api/GPUCanvasContext.h +0 -66
- package/cpp/rnwgpu/api/GPUCommandBuffer.h +0 -45
- package/cpp/rnwgpu/api/GPUCommandEncoder.cpp +0 -179
- package/cpp/rnwgpu/api/GPUCommandEncoder.h +0 -111
- package/cpp/rnwgpu/api/GPUCompilationInfo.h +0 -79
- package/cpp/rnwgpu/api/GPUCompilationMessage.h +0 -36
- package/cpp/rnwgpu/api/GPUComputePassEncoder.cpp +0 -60
- package/cpp/rnwgpu/api/GPUComputePassEncoder.h +0 -85
- package/cpp/rnwgpu/api/GPUComputePipeline.cpp +0 -12
- package/cpp/rnwgpu/api/GPUComputePipeline.h +0 -60
- package/cpp/rnwgpu/api/GPUDevice.cpp +0 -545
- package/cpp/rnwgpu/api/GPUDevice.h +0 -265
- package/cpp/rnwgpu/api/GPUDeviceLostInfo.cpp +0 -7
- package/cpp/rnwgpu/api/GPUDeviceLostInfo.h +0 -40
- package/cpp/rnwgpu/api/GPUError.h +0 -35
- package/cpp/rnwgpu/api/GPUExtent3D.h +0 -66
- package/cpp/rnwgpu/api/GPUExternalTexture.cpp +0 -335
- package/cpp/rnwgpu/api/GPUExternalTexture.h +0 -90
- package/cpp/rnwgpu/api/GPUFeatures.h +0 -206
- package/cpp/rnwgpu/api/GPUInternalError.h +0 -31
- package/cpp/rnwgpu/api/GPUOrigin2D.h +0 -55
- package/cpp/rnwgpu/api/GPUOrigin3D.h +0 -62
- package/cpp/rnwgpu/api/GPUOutOfMemoryError.h +0 -33
- package/cpp/rnwgpu/api/GPUPipelineLayout.h +0 -45
- package/cpp/rnwgpu/api/GPUQuerySet.cpp +0 -11
- package/cpp/rnwgpu/api/GPUQuerySet.h +0 -73
- package/cpp/rnwgpu/api/GPUQueue.cpp +0 -169
- package/cpp/rnwgpu/api/GPUQueue.h +0 -81
- package/cpp/rnwgpu/api/GPURenderBundle.h +0 -44
- package/cpp/rnwgpu/api/GPURenderBundleEncoder.cpp +0 -131
- package/cpp/rnwgpu/api/GPURenderBundleEncoder.h +0 -110
- package/cpp/rnwgpu/api/GPURenderPassEncoder.cpp +0 -165
- package/cpp/rnwgpu/api/GPURenderPassEncoder.h +0 -130
- package/cpp/rnwgpu/api/GPURenderPipeline.cpp +0 -13
- package/cpp/rnwgpu/api/GPURenderPipeline.h +0 -61
- package/cpp/rnwgpu/api/GPUSampler.h +0 -44
- package/cpp/rnwgpu/api/GPUShaderModule.cpp +0 -50
- package/cpp/rnwgpu/api/GPUShaderModule.h +0 -66
- package/cpp/rnwgpu/api/GPUSharedTextureMemory.cpp +0 -80
- package/cpp/rnwgpu/api/GPUSharedTextureMemory.h +0 -71
- package/cpp/rnwgpu/api/GPUSupportedLimits.cpp +0 -129
- package/cpp/rnwgpu/api/GPUSupportedLimits.h +0 -131
- package/cpp/rnwgpu/api/GPUTexture.cpp +0 -47
- package/cpp/rnwgpu/api/GPUTexture.h +0 -162
- package/cpp/rnwgpu/api/GPUTextureView.h +0 -44
- package/cpp/rnwgpu/api/GPUUncapturedErrorEvent.h +0 -71
- package/cpp/rnwgpu/api/GPUValidationError.h +0 -32
- package/cpp/rnwgpu/api/ImageBitmap.h +0 -48
- package/cpp/rnwgpu/api/RNWebGPU.h +0 -241
- package/cpp/rnwgpu/api/RnFeatures.h +0 -53
- package/cpp/rnwgpu/api/VideoFrame.h +0 -76
- package/cpp/rnwgpu/api/VideoPlayer.h +0 -69
- package/cpp/rnwgpu/api/descriptors/GPUBindGroupDescriptor.h +0 -65
- package/cpp/rnwgpu/api/descriptors/GPUBindGroupEntry.h +0 -81
- package/cpp/rnwgpu/api/descriptors/GPUBindGroupLayoutDescriptor.h +0 -57
- package/cpp/rnwgpu/api/descriptors/GPUBindGroupLayoutEntry.h +0 -98
- package/cpp/rnwgpu/api/descriptors/GPUBlendComponent.h +0 -58
- package/cpp/rnwgpu/api/descriptors/GPUBlendState.h +0 -53
- package/cpp/rnwgpu/api/descriptors/GPUBufferBinding.h +0 -57
- package/cpp/rnwgpu/api/descriptors/GPUBufferBindingLayout.h +0 -57
- package/cpp/rnwgpu/api/descriptors/GPUBufferDescriptor.h +0 -60
- package/cpp/rnwgpu/api/descriptors/GPUBufferUsage.h +0 -39
- package/cpp/rnwgpu/api/descriptors/GPUCanvasConfiguration.h +0 -76
- package/cpp/rnwgpu/api/descriptors/GPUColor.h +0 -67
- package/cpp/rnwgpu/api/descriptors/GPUColorTargetState.h +0 -59
- package/cpp/rnwgpu/api/descriptors/GPUColorWrite.h +0 -29
- package/cpp/rnwgpu/api/descriptors/GPUCommandBufferDescriptor.h +0 -46
- package/cpp/rnwgpu/api/descriptors/GPUCommandEncoderDescriptor.h +0 -46
- package/cpp/rnwgpu/api/descriptors/GPUComputePassDescriptor.h +0 -57
- package/cpp/rnwgpu/api/descriptors/GPUComputePassTimestampWrites.h +0 -59
- package/cpp/rnwgpu/api/descriptors/GPUComputePipelineDescriptor.h +0 -68
- package/cpp/rnwgpu/api/descriptors/GPUDawnTogglesDescriptor.h +0 -57
- package/cpp/rnwgpu/api/descriptors/GPUDepthStencilState.h +0 -104
- package/cpp/rnwgpu/api/descriptors/GPUDeviceDescriptor.h +0 -115
- package/cpp/rnwgpu/api/descriptors/GPUExternalTextureBindingLayout.h +0 -39
- package/cpp/rnwgpu/api/descriptors/GPUExternalTextureDescriptor.h +0 -82
- package/cpp/rnwgpu/api/descriptors/GPUFragmentState.h +0 -74
- package/cpp/rnwgpu/api/descriptors/GPUImageCopyBuffer.h +0 -63
- package/cpp/rnwgpu/api/descriptors/GPUImageCopyExternalImage.h +0 -63
- package/cpp/rnwgpu/api/descriptors/GPUImageCopyTexture.h +0 -66
- package/cpp/rnwgpu/api/descriptors/GPUImageCopyTextureTagged.h +0 -82
- package/cpp/rnwgpu/api/descriptors/GPUImageDataLayout.h +0 -55
- package/cpp/rnwgpu/api/descriptors/GPUMapMode.h +0 -22
- package/cpp/rnwgpu/api/descriptors/GPUMultisampleState.h +0 -55
- package/cpp/rnwgpu/api/descriptors/GPUPipelineLayoutDescriptor.h +0 -58
- package/cpp/rnwgpu/api/descriptors/GPUPrimitiveState.h +0 -70
- package/cpp/rnwgpu/api/descriptors/GPUProgrammableStage.h +0 -62
- package/cpp/rnwgpu/api/descriptors/GPUQuerySetDescriptor.h +0 -56
- package/cpp/rnwgpu/api/descriptors/GPUQueueDescriptor.h +0 -44
- package/cpp/rnwgpu/api/descriptors/GPURenderBundleDescriptor.h +0 -46
- package/cpp/rnwgpu/api/descriptors/GPURenderBundleEncoderDescriptor.h +0 -81
- package/cpp/rnwgpu/api/descriptors/GPURenderPassColorAttachment.h +0 -82
- package/cpp/rnwgpu/api/descriptors/GPURenderPassDepthStencilAttachment.h +0 -102
- package/cpp/rnwgpu/api/descriptors/GPURenderPassDescriptor.h +0 -93
- package/cpp/rnwgpu/api/descriptors/GPURenderPassTimestampWrites.h +0 -59
- package/cpp/rnwgpu/api/descriptors/GPURenderPipelineDescriptor.h +0 -104
- package/cpp/rnwgpu/api/descriptors/GPURequestAdapterOptions.h +0 -52
- package/cpp/rnwgpu/api/descriptors/GPUSamplerBindingLayout.h +0 -46
- package/cpp/rnwgpu/api/descriptors/GPUSamplerDescriptor.h +0 -111
- package/cpp/rnwgpu/api/descriptors/GPUShaderModuleCompilationHint.h +0 -61
- package/cpp/rnwgpu/api/descriptors/GPUShaderModuleDescriptor.h +0 -63
- package/cpp/rnwgpu/api/descriptors/GPUShaderStage.h +0 -25
- package/cpp/rnwgpu/api/descriptors/GPUSharedTextureMemoryDescriptor.h +0 -62
- package/cpp/rnwgpu/api/descriptors/GPUStencilFaceState.h +0 -65
- package/cpp/rnwgpu/api/descriptors/GPUStorageTextureBindingLayout.h +0 -60
- package/cpp/rnwgpu/api/descriptors/GPUTextureBindingLayout.h +0 -60
- package/cpp/rnwgpu/api/descriptors/GPUTextureDescriptor.h +0 -92
- package/cpp/rnwgpu/api/descriptors/GPUTextureUsage.h +0 -29
- package/cpp/rnwgpu/api/descriptors/GPUTextureViewDescriptor.h +0 -92
- package/cpp/rnwgpu/api/descriptors/GPUUncapturedErrorEventInit.h +0 -65
- package/cpp/rnwgpu/api/descriptors/GPUVertexAttribute.h +0 -54
- package/cpp/rnwgpu/api/descriptors/GPUVertexBufferLayout.h +0 -63
- package/cpp/rnwgpu/api/descriptors/GPUVertexState.h +0 -74
- package/cpp/rnwgpu/api/descriptors/Unions.h +0 -1979
- package/cpp/rnwgpu/async/AsyncDispatcher.h +0 -28
- package/cpp/rnwgpu/async/AsyncRunner.cpp +0 -215
- package/cpp/rnwgpu/async/AsyncRunner.h +0 -53
- package/cpp/rnwgpu/async/AsyncTaskHandle.cpp +0 -181
- package/cpp/rnwgpu/async/AsyncTaskHandle.h +0 -55
- package/cpp/rnwgpu/async/JSIMicrotaskDispatcher.cpp +0 -23
- package/cpp/rnwgpu/async/JSIMicrotaskDispatcher.h +0 -22
- package/cpp/webgpu/webgpu.h +0 -4979
- package/cpp/webgpu/webgpu_cpp.h +0 -10059
- package/cpp/webgpu/webgpu_cpp_chained_struct.h +0 -57
- package/cpp/webgpu/webgpu_cpp_print.h +0 -2844
- package/cpp/webgpu/webgpu_enum_class_bitmasks.h +0 -161
- package/lib/commonjs/Canvas.js +0 -55
- package/lib/commonjs/Canvas.js.map +0 -1
- package/lib/commonjs/NativeWebGPUModule.js +0 -10
- package/lib/commonjs/NativeWebGPUModule.js.map +0 -1
- package/lib/commonjs/Offscreen.js +0 -103
- package/lib/commonjs/Offscreen.js.map +0 -1
- package/lib/commonjs/WebGPUViewNativeComponent.js +0 -10
- package/lib/commonjs/WebGPUViewNativeComponent.js.map +0 -1
- package/lib/commonjs/WebGPUViewNativeComponent.web.js +0 -103
- package/lib/commonjs/WebGPUViewNativeComponent.web.js.map +0 -1
- package/lib/commonjs/WebPolyfillGPUModule.js +0 -40
- package/lib/commonjs/WebPolyfillGPUModule.js.map +0 -1
- package/lib/commonjs/external/ModuleProxy.js +0 -36
- package/lib/commonjs/external/ModuleProxy.js.map +0 -1
- package/lib/commonjs/external/index.js +0 -17
- package/lib/commonjs/external/index.js.map +0 -1
- package/lib/commonjs/external/reanimated/ReanimatedProxy.js +0 -18
- package/lib/commonjs/external/reanimated/ReanimatedProxy.js.map +0 -1
- package/lib/commonjs/external/reanimated/index.js +0 -21
- package/lib/commonjs/external/reanimated/index.js.map +0 -1
- package/lib/commonjs/external/reanimated/registerWebGPUForReanimated.js +0 -49
- package/lib/commonjs/external/reanimated/registerWebGPUForReanimated.js.map +0 -1
- package/lib/commonjs/hooks.js +0 -83
- package/lib/commonjs/hooks.js.map +0 -1
- package/lib/commonjs/main/index.js +0 -91
- package/lib/commonjs/main/index.js.map +0 -1
- package/lib/commonjs/main/index.web.js +0 -51
- package/lib/commonjs/main/index.web.js.map +0 -1
- package/lib/commonjs/types.js +0 -2
- package/lib/commonjs/types.js.map +0 -1
- package/lib/commonjs/utils.js +0 -11
- package/lib/commonjs/utils.js.map +0 -1
- package/lib/module/Canvas.js +0 -46
- package/lib/module/Canvas.js.map +0 -1
- package/lib/module/NativeWebGPUModule.js +0 -4
- package/lib/module/NativeWebGPUModule.js.map +0 -1
- package/lib/module/Offscreen.js +0 -96
- package/lib/module/Offscreen.js.map +0 -1
- package/lib/module/WebGPUViewNativeComponent.js +0 -4
- package/lib/module/WebGPUViewNativeComponent.js.map +0 -1
- package/lib/module/WebGPUViewNativeComponent.web.js +0 -96
- package/lib/module/WebGPUViewNativeComponent.web.js.map +0 -1
- package/lib/module/WebPolyfillGPUModule.js +0 -38
- package/lib/module/WebPolyfillGPUModule.js.map +0 -1
- package/lib/module/external/ModuleProxy.js +0 -28
- package/lib/module/external/ModuleProxy.js.map +0 -1
- package/lib/module/external/index.js +0 -2
- package/lib/module/external/index.js.map +0 -1
- package/lib/module/external/reanimated/ReanimatedProxy.js +0 -12
- package/lib/module/external/reanimated/ReanimatedProxy.js.map +0 -1
- package/lib/module/external/reanimated/index.js +0 -3
- package/lib/module/external/reanimated/index.js.map +0 -1
- package/lib/module/external/reanimated/registerWebGPUForReanimated.js +0 -42
- package/lib/module/external/reanimated/registerWebGPUForReanimated.js.map +0 -1
- package/lib/module/hooks.js +0 -70
- package/lib/module/hooks.js.map +0 -1
- package/lib/module/main/index.js +0 -33
- package/lib/module/main/index.js.map +0 -1
- package/lib/module/main/index.web.js +0 -8
- package/lib/module/main/index.web.js.map +0 -1
- package/lib/module/types.js +0 -2
- package/lib/module/types.js.map +0 -1
- package/lib/module/utils.js +0 -5
- package/lib/module/utils.js.map +0 -1
- package/lib/typescript/babel.config.d.ts +0 -3
- package/lib/typescript/babel.config.d.ts.map +0 -1
- package/lib/typescript/jest.config.d.ts +0 -9
- package/lib/typescript/jest.config.d.ts.map +0 -1
- package/lib/typescript/lib/commonjs/Canvas.d.ts +0 -7
- package/lib/typescript/lib/commonjs/Canvas.d.ts.map +0 -1
- package/lib/typescript/lib/commonjs/NativeWebGPUModule.d.ts +0 -5
- package/lib/typescript/lib/commonjs/NativeWebGPUModule.d.ts.map +0 -1
- package/lib/typescript/lib/commonjs/Offscreen.d.ts +0 -26
- package/lib/typescript/lib/commonjs/Offscreen.d.ts.map +0 -1
- package/lib/typescript/lib/commonjs/WebGPUViewNativeComponent.d.ts +0 -5
- package/lib/typescript/lib/commonjs/WebGPUViewNativeComponent.d.ts.map +0 -1
- package/lib/typescript/lib/commonjs/WebGPUViewNativeComponent.web.d.ts +0 -4
- package/lib/typescript/lib/commonjs/WebGPUViewNativeComponent.web.d.ts.map +0 -1
- package/lib/typescript/lib/commonjs/WebPolyfillGPUModule.d.ts +0 -2
- package/lib/typescript/lib/commonjs/WebPolyfillGPUModule.d.ts.map +0 -1
- package/lib/typescript/lib/commonjs/external/ModuleProxy.d.ts +0 -12
- package/lib/typescript/lib/commonjs/external/ModuleProxy.d.ts.map +0 -1
- package/lib/typescript/lib/commonjs/external/index.d.ts.map +0 -1
- package/lib/typescript/lib/commonjs/external/reanimated/ReanimatedProxy.d.ts +0 -6
- package/lib/typescript/lib/commonjs/external/reanimated/ReanimatedProxy.d.ts.map +0 -1
- package/lib/typescript/lib/commonjs/external/reanimated/index.d.ts +0 -4
- package/lib/typescript/lib/commonjs/external/reanimated/index.d.ts.map +0 -1
- package/lib/typescript/lib/commonjs/external/reanimated/registerWebGPUForReanimated.d.ts +0 -9
- package/lib/typescript/lib/commonjs/external/reanimated/registerWebGPUForReanimated.d.ts.map +0 -1
- package/lib/typescript/lib/commonjs/hooks.d.ts +0 -18
- package/lib/typescript/lib/commonjs/hooks.d.ts.map +0 -1
- package/lib/typescript/lib/commonjs/index.d.ts +0 -2
- package/lib/typescript/lib/commonjs/main/index.d.ts +0 -3
- package/lib/typescript/lib/commonjs/main/index.d.ts.map +0 -1
- package/lib/typescript/lib/commonjs/main/index.web.d.ts +0 -2
- package/lib/typescript/lib/commonjs/main/index.web.d.ts.map +0 -1
- package/lib/typescript/lib/commonjs/types.d.ts +0 -1
- package/lib/typescript/lib/commonjs/types.d.ts.map +0 -1
- package/lib/typescript/lib/commonjs/utils.d.ts +0 -3
- package/lib/typescript/lib/commonjs/utils.d.ts.map +0 -1
- package/lib/typescript/lib/module/Canvas.d.ts +0 -8
- package/lib/typescript/lib/module/Canvas.d.ts.map +0 -1
- package/lib/typescript/lib/module/NativeWebGPUModule.d.ts +0 -3
- package/lib/typescript/lib/module/NativeWebGPUModule.d.ts.map +0 -1
- package/lib/typescript/lib/module/Offscreen.d.ts +0 -25
- package/lib/typescript/lib/module/Offscreen.d.ts.map +0 -1
- package/lib/typescript/lib/module/WebGPUViewNativeComponent.d.ts +0 -3
- package/lib/typescript/lib/module/WebGPUViewNativeComponent.d.ts.map +0 -1
- package/lib/typescript/lib/module/WebGPUViewNativeComponent.web.d.ts +0 -3
- package/lib/typescript/lib/module/WebGPUViewNativeComponent.web.d.ts.map +0 -1
- package/lib/typescript/lib/module/WebPolyfillGPUModule.d.ts +0 -2
- package/lib/typescript/lib/module/WebPolyfillGPUModule.d.ts.map +0 -1
- package/lib/typescript/lib/module/external/ModuleProxy.d.ts +0 -7
- package/lib/typescript/lib/module/external/ModuleProxy.d.ts.map +0 -1
- package/lib/typescript/lib/module/external/index.d.ts.map +0 -1
- package/lib/typescript/lib/module/external/reanimated/ReanimatedProxy.d.ts +0 -5
- package/lib/typescript/lib/module/external/reanimated/ReanimatedProxy.d.ts.map +0 -1
- package/lib/typescript/lib/module/external/reanimated/index.d.ts.map +0 -1
- package/lib/typescript/lib/module/external/reanimated/registerWebGPUForReanimated.d.ts +0 -2
- package/lib/typescript/lib/module/external/reanimated/registerWebGPUForReanimated.d.ts.map +0 -1
- package/lib/typescript/lib/module/hooks.d.ts +0 -18
- package/lib/typescript/lib/module/hooks.d.ts.map +0 -1
- package/lib/typescript/lib/module/index.d.ts +0 -2
- package/lib/typescript/lib/module/main/index.d.ts.map +0 -1
- package/lib/typescript/lib/module/main/index.web.d.ts +0 -5
- package/lib/typescript/lib/module/main/index.web.d.ts.map +0 -1
- package/lib/typescript/lib/module/types.d.ts +0 -1
- package/lib/typescript/lib/module/types.d.ts.map +0 -1
- package/lib/typescript/lib/module/utils.d.ts +0 -2
- package/lib/typescript/lib/module/utils.d.ts.map +0 -1
- package/lib/typescript/src/Canvas.d.ts.map +0 -1
- package/lib/typescript/src/NativeWebGPUModule.d.ts.map +0 -1
- package/lib/typescript/src/Offscreen.d.ts.map +0 -1
- package/lib/typescript/src/WebGPUViewNativeComponent.d.ts.map +0 -1
- package/lib/typescript/src/WebGPUViewNativeComponent.web.d.ts +0 -9
- package/lib/typescript/src/WebGPUViewNativeComponent.web.d.ts.map +0 -1
- package/lib/typescript/src/WebPolyfillGPUModule.d.ts +0 -2
- package/lib/typescript/src/WebPolyfillGPUModule.d.ts.map +0 -1
- package/lib/typescript/src/external/ModuleProxy.d.ts.map +0 -1
- package/lib/typescript/src/external/index.d.ts +0 -2
- package/lib/typescript/src/external/index.d.ts.map +0 -1
- package/lib/typescript/src/external/reanimated/ReanimatedProxy.d.ts.map +0 -1
- package/lib/typescript/src/external/reanimated/index.d.ts +0 -3
- package/lib/typescript/src/external/reanimated/index.d.ts.map +0 -1
- package/lib/typescript/src/external/reanimated/registerWebGPUForReanimated.d.ts.map +0 -1
- package/lib/typescript/src/hooks.d.ts.map +0 -1
- package/lib/typescript/src/index.d.ts.map +0 -1
- package/lib/typescript/src/main/index.d.ts +0 -6
- package/lib/typescript/src/main/index.d.ts.map +0 -1
- package/lib/typescript/src/main/index.web.d.ts +0 -6
- package/lib/typescript/src/main/index.web.d.ts.map +0 -1
- package/lib/typescript/src/types.d.ts.map +0 -1
- package/lib/typescript/src/utils.d.ts +0 -2
- package/lib/typescript/src/utils.d.ts.map +0 -1
- 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/apple/libwebgpu_dawn.xcframework/Info.plist +0 -59
- package/libs/apple/libwebgpu_dawn.xcframework/ios-arm64/libwebgpu_dawn.a +0 -0
- package/libs/apple/libwebgpu_dawn.xcframework/ios-arm64_x86_64-simulator/libwebgpu_dawn.a +0 -0
- package/libs/apple/libwebgpu_dawn.xcframework/macos-arm64_x86_64/libwebgpu_dawn.a +0 -0
- package/react-native-wgpu.podspec +0 -47
- package/src/Canvas.tsx +0 -76
- package/src/NativeWebGPUModule.ts +0 -9
- package/src/Offscreen.ts +0 -113
- package/src/WebGPUViewNativeComponent.ts +0 -11
- package/src/WebGPUViewNativeComponent.web.ts +0 -113
- package/src/WebPolyfillGPUModule.ts +0 -53
- package/src/external/ModuleProxy.ts +0 -30
- package/src/external/index.ts +0 -1
- package/src/external/reanimated/ReanimatedProxy.ts +0 -19
- package/src/external/reanimated/index.ts +0 -2
- package/src/external/reanimated/registerWebGPUForReanimated.ts +0 -43
- package/src/hooks.tsx +0 -93
- package/src/index.tsx +0 -91
- package/src/main/index.tsx +0 -40
- package/src/main/index.web.tsx +0 -8
- package/src/types.ts +0 -102
- package/src/utils.ts +0 -4
- /package/lib/typescript/{src → webgpu/src}/Canvas.d.ts +0 -0
- /package/lib/typescript/{src → webgpu/src}/NativeWebGPUModule.d.ts +0 -0
- /package/lib/typescript/{src → webgpu/src}/Offscreen.d.ts +0 -0
- /package/lib/typescript/{src → webgpu/src}/WebGPUViewNativeComponent.d.ts +0 -0
- /package/lib/typescript/{src → webgpu/src}/external/ModuleProxy.d.ts +0 -0
- /package/lib/typescript/{lib/module → webgpu/src}/external/index.d.ts +0 -0
- /package/lib/typescript/{src → webgpu/src}/external/reanimated/ReanimatedProxy.d.ts +0 -0
- /package/lib/typescript/{lib/module → webgpu/src}/external/reanimated/index.d.ts +0 -0
- /package/lib/typescript/{src → webgpu/src}/external/reanimated/registerWebGPUForReanimated.d.ts +0 -0
- /package/lib/typescript/{src → webgpu/src}/hooks.d.ts +0 -0
- /package/lib/typescript/{src → webgpu/src}/index.d.ts +0 -0
- /package/lib/typescript/{lib/module → webgpu/src}/main/index.d.ts +0 -0
- /package/lib/typescript/{src → webgpu/src}/types.d.ts +0 -0
- /package/lib/typescript/{eslint.config.d.mts → webgpu-shim/eslint.config.d.mts} +0 -0
- /package/lib/typescript/{lib/commonjs/external → webgpu-shim/lib/commonjs}/index.d.ts +0 -0
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
#pragma once
|
|
2
|
-
|
|
3
|
-
#include <jsi/jsi.h>
|
|
4
|
-
|
|
5
|
-
#include <cassert>
|
|
6
|
-
#include <memory>
|
|
7
|
-
#include <unordered_map>
|
|
8
|
-
#include <utility>
|
|
9
|
-
|
|
10
|
-
#include "RuntimeLifecycleMonitor.h"
|
|
11
|
-
|
|
12
|
-
namespace rnwgpu {
|
|
13
|
-
|
|
14
|
-
namespace jsi = facebook::jsi;
|
|
15
|
-
|
|
16
|
-
class BaseRuntimeAwareCache {
|
|
17
|
-
public:
|
|
18
|
-
static void setMainJsRuntime(jsi::Runtime *rt) { _mainRuntime = rt; }
|
|
19
|
-
static jsi::Runtime *getMainJsRuntime() {
|
|
20
|
-
assert(_mainRuntime != nullptr &&
|
|
21
|
-
"Expected main Javascript runtime to be set in the "
|
|
22
|
-
"BaseRuntimeAwareCache class.");
|
|
23
|
-
|
|
24
|
-
return _mainRuntime;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
private:
|
|
28
|
-
static jsi::Runtime *_mainRuntime;
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* Provides a way to keep data specific to a jsi::Runtime instance that gets
|
|
33
|
-
* cleaned up when that runtime is destroyed. This is necessary because JSI does
|
|
34
|
-
* not allow for its associated objects to be retained past the runtime
|
|
35
|
-
* lifetime. If an object (e.g. jsi::Values or jsi::Function instances) is kept
|
|
36
|
-
* after the runtime is torn down, its destructor (once it is destroyed
|
|
37
|
-
* eventually) will result in a crash (JSI objects keep a pointer to memory
|
|
38
|
-
* managed by the runtime, accessing that portion of the memory after runtime is
|
|
39
|
-
* deleted is the root cause of that crash).
|
|
40
|
-
*
|
|
41
|
-
* In order to provide an efficient implementation that does not add an overhead
|
|
42
|
-
* for the cases when only a single runtime is used, which is the primary
|
|
43
|
-
* usecase, the following assumption has been made: Only for secondary runtimes
|
|
44
|
-
* we track destruction and clean up the store associated with that runtime. For
|
|
45
|
-
* the first runtime we assume that the object holding the store is destroyed
|
|
46
|
-
* prior to the destruction of that runtime.
|
|
47
|
-
*
|
|
48
|
-
* The above assumption makes it work without any overhead when only single
|
|
49
|
-
* runtime is in use. Specifically, we don't perform any additional operations
|
|
50
|
-
* related to tracking runtime lifecycle when only a single runtime is used.
|
|
51
|
-
*/
|
|
52
|
-
template <typename T>
|
|
53
|
-
class RuntimeAwareCache : public BaseRuntimeAwareCache,
|
|
54
|
-
public RuntimeLifecycleListener {
|
|
55
|
-
|
|
56
|
-
public:
|
|
57
|
-
void onRuntimeDestroyed(jsi::Runtime *rt) override {
|
|
58
|
-
if (getMainJsRuntime() != rt) {
|
|
59
|
-
// We are removing a secondary runtime
|
|
60
|
-
_secondaryRuntimeCaches.erase(rt);
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
~RuntimeAwareCache() {
|
|
65
|
-
for (auto &cache : _secondaryRuntimeCaches) {
|
|
66
|
-
RuntimeLifecycleMonitor::removeListener(
|
|
67
|
-
*static_cast<jsi::Runtime *>(cache.first), this);
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
T &get(jsi::Runtime &rt) {
|
|
72
|
-
// We check if we're accessing the main runtime - this is the happy path
|
|
73
|
-
// to avoid us having to lookup by runtime for caches that only has a single
|
|
74
|
-
// runtime
|
|
75
|
-
if (getMainJsRuntime() == &rt) {
|
|
76
|
-
return _primaryCache;
|
|
77
|
-
} else {
|
|
78
|
-
if (_secondaryRuntimeCaches.count(&rt) == 0) {
|
|
79
|
-
// we only add listener when the secondary runtime is used, this assumes
|
|
80
|
-
// that the secondary runtime is terminated first. This lets us avoid
|
|
81
|
-
// additional complexity for the majority of cases when objects are not
|
|
82
|
-
// shared between runtimes. Otherwise we'd have to register all objecrts
|
|
83
|
-
// with the RuntimeMonitor as opposed to only registering ones that are
|
|
84
|
-
// used in secondary runtime. Note that we can't register listener here
|
|
85
|
-
// with the primary runtime as it may run on a separate thread.
|
|
86
|
-
RuntimeLifecycleMonitor::addListener(rt, this);
|
|
87
|
-
|
|
88
|
-
T cache;
|
|
89
|
-
_secondaryRuntimeCaches.emplace(&rt, std::move(cache));
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
return _secondaryRuntimeCaches.at(&rt);
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
private:
|
|
96
|
-
std::unordered_map<void *, T> _secondaryRuntimeCaches;
|
|
97
|
-
T _primaryCache;
|
|
98
|
-
};
|
|
99
|
-
|
|
100
|
-
} // namespace rnwgpu
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
#include "RuntimeLifecycleMonitor.h"
|
|
2
|
-
|
|
3
|
-
#include <mutex>
|
|
4
|
-
#include <unordered_map>
|
|
5
|
-
#include <unordered_set>
|
|
6
|
-
#include <utility>
|
|
7
|
-
|
|
8
|
-
namespace rnwgpu {
|
|
9
|
-
|
|
10
|
-
static std::unordered_map<jsi::Runtime *,
|
|
11
|
-
std::unordered_set<RuntimeLifecycleListener *>>
|
|
12
|
-
listeners;
|
|
13
|
-
static std::mutex listenersMutex;
|
|
14
|
-
|
|
15
|
-
struct RuntimeLifecycleMonitorObject : public jsi::HostObject {
|
|
16
|
-
jsi::Runtime *_rt;
|
|
17
|
-
explicit RuntimeLifecycleMonitorObject(jsi::Runtime *rt) : _rt(rt) {}
|
|
18
|
-
~RuntimeLifecycleMonitorObject() {
|
|
19
|
-
std::unordered_set<RuntimeLifecycleListener *> listenersCopy;
|
|
20
|
-
{
|
|
21
|
-
std::lock_guard<std::mutex> lock(listenersMutex);
|
|
22
|
-
auto listenersSet = listeners.find(_rt);
|
|
23
|
-
if (listenersSet != listeners.end()) {
|
|
24
|
-
listenersCopy = listenersSet->second;
|
|
25
|
-
listeners.erase(listenersSet);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
for (auto listener : listenersCopy) {
|
|
29
|
-
listener->onRuntimeDestroyed(_rt);
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
void RuntimeLifecycleMonitor::addListener(jsi::Runtime &rt,
|
|
35
|
-
RuntimeLifecycleListener *listener) {
|
|
36
|
-
bool shouldInstallMonitor = false;
|
|
37
|
-
{
|
|
38
|
-
std::lock_guard<std::mutex> lock(listenersMutex);
|
|
39
|
-
auto listenersSet = listeners.find(&rt);
|
|
40
|
-
if (listenersSet == listeners.end()) {
|
|
41
|
-
std::unordered_set<RuntimeLifecycleListener *> newSet;
|
|
42
|
-
newSet.insert(listener);
|
|
43
|
-
listeners.emplace(&rt, std::move(newSet));
|
|
44
|
-
shouldInstallMonitor = true;
|
|
45
|
-
} else {
|
|
46
|
-
listenersSet->second.insert(listener);
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
if (shouldInstallMonitor) {
|
|
50
|
-
// We install a global host object in the provided runtime, this way we can
|
|
51
|
-
// use that host object destructor to get notified when the runtime is being
|
|
52
|
-
// terminated. We use a unique name for the object as it gets saved with the
|
|
53
|
-
// runtime's global object.
|
|
54
|
-
rt.global().setProperty(
|
|
55
|
-
rt, "__rnwgpu_rt_lifecycle_monitor",
|
|
56
|
-
jsi::Object::createFromHostObject(
|
|
57
|
-
rt, std::make_shared<RuntimeLifecycleMonitorObject>(&rt)));
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
void RuntimeLifecycleMonitor::removeListener(
|
|
62
|
-
jsi::Runtime &rt, RuntimeLifecycleListener *listener) {
|
|
63
|
-
std::lock_guard<std::mutex> lock(listenersMutex);
|
|
64
|
-
auto listenersSet = listeners.find(&rt);
|
|
65
|
-
if (listenersSet == listeners.end()) {
|
|
66
|
-
// nothing to do here
|
|
67
|
-
} else {
|
|
68
|
-
listenersSet->second.erase(listener);
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
} // namespace rnwgpu
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
#pragma once
|
|
2
|
-
|
|
3
|
-
#include <jsi/jsi.h>
|
|
4
|
-
|
|
5
|
-
#include <memory>
|
|
6
|
-
|
|
7
|
-
namespace rnwgpu {
|
|
8
|
-
|
|
9
|
-
namespace jsi = facebook::jsi;
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Listener interface that allows for getting notified when a jsi::Runtime
|
|
13
|
-
* instance is destroyed.
|
|
14
|
-
*/
|
|
15
|
-
struct RuntimeLifecycleListener {
|
|
16
|
-
virtual ~RuntimeLifecycleListener() {}
|
|
17
|
-
virtual void onRuntimeDestroyed(jsi::Runtime *) = 0;
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* This class provides an API via static methods for registering and
|
|
22
|
-
* unregistering runtime lifecycle listeners. The listeners can be used to
|
|
23
|
-
* cleanup any data that references a given jsi::Runtime instance before it gets
|
|
24
|
-
* destroyed.
|
|
25
|
-
*/
|
|
26
|
-
struct RuntimeLifecycleMonitor {
|
|
27
|
-
static void addListener(jsi::Runtime &rt, RuntimeLifecycleListener *listener);
|
|
28
|
-
static void removeListener(jsi::Runtime &rt,
|
|
29
|
-
RuntimeLifecycleListener *listener);
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
} // namespace rnwgpu
|
package/cpp/rnwgpu/ArrayBuffer.h
DELETED
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
#pragma once
|
|
2
|
-
#include <jsi/jsi.h>
|
|
3
|
-
|
|
4
|
-
#include <cmath>
|
|
5
|
-
#include <cstdint>
|
|
6
|
-
#include <memory>
|
|
7
|
-
|
|
8
|
-
#include "JSIConverter.h"
|
|
9
|
-
|
|
10
|
-
namespace rnwgpu {
|
|
11
|
-
|
|
12
|
-
namespace jsi = facebook::jsi;
|
|
13
|
-
|
|
14
|
-
struct ArrayBuffer : jsi::MutableBuffer {
|
|
15
|
-
ArrayBuffer(void *data, size_t size, size_t bytesPerElement)
|
|
16
|
-
: _data(data), _size(size), _bytesPerElement(bytesPerElement) {}
|
|
17
|
-
|
|
18
|
-
~ArrayBuffer() override {}
|
|
19
|
-
|
|
20
|
-
size_t size() const override { return _size; }
|
|
21
|
-
|
|
22
|
-
uint8_t *data() override { return static_cast<uint8_t *>(_data); }
|
|
23
|
-
|
|
24
|
-
void *_data;
|
|
25
|
-
size_t _size;
|
|
26
|
-
size_t _bytesPerElement;
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
static std::shared_ptr<ArrayBuffer>
|
|
30
|
-
createArrayBufferFromJSI(jsi::Runtime &runtime,
|
|
31
|
-
const jsi::ArrayBuffer &arrayBuffer,
|
|
32
|
-
size_t bytesPerElement) {
|
|
33
|
-
auto size = arrayBuffer.size(runtime);
|
|
34
|
-
return std::make_shared<ArrayBuffer>(arrayBuffer.data(runtime), size,
|
|
35
|
-
bytesPerElement);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
template <> struct JSIConverter<std::shared_ptr<ArrayBuffer>> {
|
|
39
|
-
static std::shared_ptr<ArrayBuffer>
|
|
40
|
-
fromJSI(jsi::Runtime &runtime, const jsi::Value &arg, bool outOfBound) {
|
|
41
|
-
if (arg.isObject()) {
|
|
42
|
-
auto obj = arg.getObject(runtime);
|
|
43
|
-
if (obj.isArrayBuffer(runtime)) {
|
|
44
|
-
return createArrayBufferFromJSI(runtime, obj.getArrayBuffer(runtime),
|
|
45
|
-
1);
|
|
46
|
-
}
|
|
47
|
-
if (obj.hasProperty(runtime, "buffer")) {
|
|
48
|
-
auto bufferProp = obj.getProperty(runtime, "buffer");
|
|
49
|
-
if (bufferProp.isObject() &&
|
|
50
|
-
bufferProp.getObject(runtime).isArrayBuffer(runtime)) {
|
|
51
|
-
auto buff = bufferProp.getObject(runtime);
|
|
52
|
-
auto arrayBuffer = buff.getArrayBuffer(runtime);
|
|
53
|
-
const size_t bufferSize = arrayBuffer.size(runtime);
|
|
54
|
-
|
|
55
|
-
// byteOffset / byteLength are user-readable JS properties, not values
|
|
56
|
-
// the engine guarantees (unlike Dawn's node binding, which reads them
|
|
57
|
-
// off the engine's typed-array view). Read them as doubles so we can
|
|
58
|
-
// reject negative, non-integral, NaN/Inf, or oversized values before
|
|
59
|
-
// they wrap around when cast to size_t.
|
|
60
|
-
const double byteOffsetValue =
|
|
61
|
-
obj.getProperty(runtime, "byteOffset").asNumber();
|
|
62
|
-
const double byteLengthValue =
|
|
63
|
-
obj.getProperty(runtime, "byteLength").asNumber();
|
|
64
|
-
|
|
65
|
-
auto isValidByteIndex = [](double value) {
|
|
66
|
-
return std::isfinite(value) && value >= 0.0 &&
|
|
67
|
-
value <= static_cast<double>(SIZE_MAX) &&
|
|
68
|
-
std::floor(value) == value;
|
|
69
|
-
};
|
|
70
|
-
if (!isValidByteIndex(byteOffsetValue) ||
|
|
71
|
-
!isValidByteIndex(byteLengthValue)) {
|
|
72
|
-
throw std::runtime_error(
|
|
73
|
-
"ArrayBuffer::fromJSI: invalid byteOffset/byteLength");
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
const size_t byteOffset = static_cast<size_t>(byteOffsetValue);
|
|
77
|
-
const size_t byteLength = static_cast<size_t>(byteLengthValue);
|
|
78
|
-
|
|
79
|
-
// Overflow-safe bounds check: byteOffset + byteLength <= bufferSize.
|
|
80
|
-
if (byteOffset > bufferSize ||
|
|
81
|
-
byteLength > bufferSize - byteOffset) {
|
|
82
|
-
throw std::runtime_error(
|
|
83
|
-
"ArrayBuffer::fromJSI: view bounds [byteOffset, byteOffset + "
|
|
84
|
-
"byteLength) exceed the backing ArrayBuffer size");
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
// BYTES_PER_ELEMENT is absent on a DataView; default to 1. A spoofed
|
|
88
|
-
// object could report 0 (or a negative/NaN value), so clamp to a
|
|
89
|
-
// minimum of 1 to avoid a later division by zero in writeBuffer.
|
|
90
|
-
size_t bytesPerElements = 1;
|
|
91
|
-
if (obj.hasProperty(runtime, "BYTES_PER_ELEMENT")) {
|
|
92
|
-
auto bpe = obj.getProperty(runtime, "BYTES_PER_ELEMENT");
|
|
93
|
-
if (bpe.isNumber()) {
|
|
94
|
-
const double value = bpe.asNumber();
|
|
95
|
-
if (std::isfinite(value) && value >= 1.0) {
|
|
96
|
-
bytesPerElements = static_cast<size_t>(value);
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
return std::make_shared<ArrayBuffer>(
|
|
102
|
-
arrayBuffer.data(runtime) + byteOffset, byteLength,
|
|
103
|
-
bytesPerElements);
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
throw std::runtime_error("ArrayBuffer::fromJSI: argument is not an object "
|
|
108
|
-
"with an ArrayBuffer 'buffer' property");
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
static jsi::Value toJSI(jsi::Runtime &runtime,
|
|
112
|
-
std::shared_ptr<ArrayBuffer> arg) {
|
|
113
|
-
return jsi::ArrayBuffer(runtime, arg);
|
|
114
|
-
}
|
|
115
|
-
};
|
|
116
|
-
|
|
117
|
-
} // namespace rnwgpu
|
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
#pragma once
|
|
2
|
-
|
|
3
|
-
#include <functional>
|
|
4
|
-
#include <memory>
|
|
5
|
-
#include <span>
|
|
6
|
-
#include <string>
|
|
7
|
-
#include <utility>
|
|
8
|
-
#include <vector>
|
|
9
|
-
|
|
10
|
-
#include "webgpu/webgpu_cpp.h"
|
|
11
|
-
|
|
12
|
-
namespace rnwgpu {
|
|
13
|
-
|
|
14
|
-
struct ImageData {
|
|
15
|
-
std::vector<uint8_t> data;
|
|
16
|
-
size_t width;
|
|
17
|
-
size_t height;
|
|
18
|
-
wgpu::TextureFormat format;
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
// Pixel layout of a VideoFrame. Determines whether the underlying surface is
|
|
22
|
-
// a single RGBA plane or a biplanar Y / CbCr pair.
|
|
23
|
-
enum class VideoPixelFormat {
|
|
24
|
-
// Single-plane 8-bit BGRA (default; what RGBA-style sampling expects).
|
|
25
|
-
BGRA8,
|
|
26
|
-
// Biplanar 4:2:0 8-bit Y + interleaved CbCr (NV12). Used for the
|
|
27
|
-
// importExternalTexture path; needs the YUV→RGB conversion matrix below.
|
|
28
|
-
NV12,
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
// A native handle to a video frame that can be imported into a
|
|
32
|
-
// GPUSharedTextureMemory.
|
|
33
|
-
//
|
|
34
|
-
// - handle is an IOSurfaceRef on Apple platforms
|
|
35
|
-
// - handle is an AHardwareBuffer* on Android
|
|
36
|
-
//
|
|
37
|
-
// The deleter is responsible for releasing the underlying backing object
|
|
38
|
-
// (CVPixelBuffer / AHardwareBuffer) and must be called exactly once. The
|
|
39
|
-
// VideoFrame JS wrapper handles this on destruction.
|
|
40
|
-
struct VideoFrameHandle {
|
|
41
|
-
void *handle = nullptr;
|
|
42
|
-
uint32_t width = 0;
|
|
43
|
-
uint32_t height = 0;
|
|
44
|
-
VideoPixelFormat pixelFormat = VideoPixelFormat::BGRA8;
|
|
45
|
-
// 3x4 row-major matrix mapping [Y, U, V, 1] → linear [R, G, B]. Pre-computed
|
|
46
|
-
// at decode time from CVPixelBuffer attachments (kCVImageBufferYCbCrMatrixKey
|
|
47
|
-
// + range), with a BT.709 limited-range default. Only meaningful when
|
|
48
|
-
// pixelFormat == NV12.
|
|
49
|
-
float yuvToRgbMatrix[12] = {};
|
|
50
|
-
std::function<void()> deleter;
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
// Platform-implemented video source that hands out fresh IOSurface /
|
|
54
|
-
// AHardwareBuffer-backed frames as a video plays.
|
|
55
|
-
class IVideoPlayer {
|
|
56
|
-
public:
|
|
57
|
-
virtual ~IVideoPlayer() = default;
|
|
58
|
-
|
|
59
|
-
// Returns the latest decoded frame, or an empty handle (handle == nullptr)
|
|
60
|
-
// when no new frame is ready yet. Each non-empty return retains its backing
|
|
61
|
-
// surface; the VideoFrame wrapper releases it on destruction.
|
|
62
|
-
virtual VideoFrameHandle copyLatestFrame() = 0;
|
|
63
|
-
|
|
64
|
-
virtual void play() = 0;
|
|
65
|
-
virtual void pause() = 0;
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
class PlatformContext {
|
|
69
|
-
public:
|
|
70
|
-
PlatformContext() = default;
|
|
71
|
-
virtual ~PlatformContext() = default;
|
|
72
|
-
|
|
73
|
-
virtual wgpu::Surface makeSurface(wgpu::Instance instance, void *surface,
|
|
74
|
-
int width, int height) = 0;
|
|
75
|
-
virtual ImageData createImageBitmap(std::string blobId, double offset,
|
|
76
|
-
double size) = 0;
|
|
77
|
-
|
|
78
|
-
// Async version that performs image decoding on a background thread
|
|
79
|
-
virtual void
|
|
80
|
-
createImageBitmapAsync(std::string blobId, double offset, double size,
|
|
81
|
-
std::function<void(ImageData)> onSuccess,
|
|
82
|
-
std::function<void(std::string)> onError) = 0;
|
|
83
|
-
|
|
84
|
-
// Create ImageBitmap from raw encoded image bytes (PNG/JPEG/etc.)
|
|
85
|
-
virtual ImageData
|
|
86
|
-
createImageBitmapFromData(std::span<const uint8_t> data) = 0;
|
|
87
|
-
|
|
88
|
-
virtual void
|
|
89
|
-
createImageBitmapFromDataAsync(std::span<const uint8_t> data,
|
|
90
|
-
std::function<void(ImageData)> onSuccess,
|
|
91
|
-
std::function<void(std::string)> onError) = 0;
|
|
92
|
-
|
|
93
|
-
// Decode the first video frame of `path` (a local file path) into a
|
|
94
|
-
// native, GPU-shareable surface. Used by the SharedTextureMemory example;
|
|
95
|
-
// not intended as a long-term media-loading API.
|
|
96
|
-
virtual VideoFrameHandle loadVideoFrame(const std::string &path) = 0;
|
|
97
|
-
|
|
98
|
-
// Create a synthetic, GPU-shareable IOSurface/AHardwareBuffer filled with a
|
|
99
|
-
// generated test pattern. Avoids the need to bundle a video asset for the
|
|
100
|
-
// SharedTextureMemory example.
|
|
101
|
-
virtual VideoFrameHandle createTestVideoFrame(uint32_t width,
|
|
102
|
-
uint32_t height) = 0;
|
|
103
|
-
|
|
104
|
-
// Open a video file at `path` for playback. The returned player yields
|
|
105
|
-
// IOSurface / AHardwareBuffer-backed frames via copyLatestFrame().
|
|
106
|
-
//
|
|
107
|
-
// `format` selects the requested pixel layout. BGRA8 is the easiest target
|
|
108
|
-
// for a regular sampled GPUTexture; NV12 is the right shape for the
|
|
109
|
-
// importExternalTexture path (zero-copy biplanar YUV).
|
|
110
|
-
virtual std::unique_ptr<IVideoPlayer>
|
|
111
|
-
createVideoPlayer(const std::string &path, VideoPixelFormat format) = 0;
|
|
112
|
-
|
|
113
|
-
// Wrap a CVPixelBufferRef (Apple) or AHardwareBuffer* (Android) pointer
|
|
114
|
-
// obtained from another library (typically VisionCamera's
|
|
115
|
-
// Frame.getNativeBuffer().pointer) as one of our VideoFrame handles.
|
|
116
|
-
//
|
|
117
|
-
// We CFRetain / AHardwareBuffer_acquire on the way in, so callers can
|
|
118
|
-
// safely release their own reference immediately after.
|
|
119
|
-
virtual VideoFrameHandle wrapNativeBuffer(void *pointer) = 0;
|
|
120
|
-
|
|
121
|
-
// Write a small procedurally-generated test video to a temporary location
|
|
122
|
-
// and return its absolute path. Lets the SharedTextureMemory example play
|
|
123
|
-
// a real decoded video without bundling an asset.
|
|
124
|
-
virtual std::string writeTestVideoFile() = 0;
|
|
125
|
-
};
|
|
126
|
-
|
|
127
|
-
} // namespace rnwgpu
|
|
@@ -1,237 +0,0 @@
|
|
|
1
|
-
#include "RNWebGPUManager.h"
|
|
2
|
-
|
|
3
|
-
#include "GPU.h"
|
|
4
|
-
#include "NativeObject.h"
|
|
5
|
-
#include "RNWebGPU.h"
|
|
6
|
-
|
|
7
|
-
// GPU API classes (for instanceof support)
|
|
8
|
-
#include "GPUAdapter.h"
|
|
9
|
-
#include "GPUAdapterInfo.h"
|
|
10
|
-
#include "GPUBindGroup.h"
|
|
11
|
-
#include "GPUBindGroupLayout.h"
|
|
12
|
-
#include "GPUBuffer.h"
|
|
13
|
-
#include "GPUCanvasContext.h"
|
|
14
|
-
#include "GPUCommandBuffer.h"
|
|
15
|
-
#include "GPUCommandEncoder.h"
|
|
16
|
-
#include "GPUCompilationInfo.h"
|
|
17
|
-
#include "GPUCompilationMessage.h"
|
|
18
|
-
#include "GPUComputePassEncoder.h"
|
|
19
|
-
#include "GPUComputePipeline.h"
|
|
20
|
-
#include "GPUDevice.h"
|
|
21
|
-
#include "GPUDeviceLostInfo.h"
|
|
22
|
-
#include "GPUError.h"
|
|
23
|
-
#include "GPUExternalTexture.h"
|
|
24
|
-
#include "GPUInternalError.h"
|
|
25
|
-
#include "GPUOutOfMemoryError.h"
|
|
26
|
-
#include "GPUPipelineLayout.h"
|
|
27
|
-
#include "GPUQuerySet.h"
|
|
28
|
-
#include "GPUQueue.h"
|
|
29
|
-
#include "GPURenderBundle.h"
|
|
30
|
-
#include "GPURenderBundleEncoder.h"
|
|
31
|
-
#include "GPURenderPassEncoder.h"
|
|
32
|
-
#include "GPURenderPipeline.h"
|
|
33
|
-
#include "GPUSampler.h"
|
|
34
|
-
#include "GPUSharedTextureMemory.h"
|
|
35
|
-
#include "GPUShaderModule.h"
|
|
36
|
-
#include "GPUSupportedLimits.h"
|
|
37
|
-
#include "GPUTexture.h"
|
|
38
|
-
#include "GPUTextureView.h"
|
|
39
|
-
#include "GPUUncapturedErrorEvent.h"
|
|
40
|
-
#include "GPUValidationError.h"
|
|
41
|
-
#include "VideoFrame.h"
|
|
42
|
-
#include "VideoPlayer.h"
|
|
43
|
-
|
|
44
|
-
// Enums
|
|
45
|
-
#include "GPUBufferUsage.h"
|
|
46
|
-
#include "GPUColorWrite.h"
|
|
47
|
-
#include "GPUMapMode.h"
|
|
48
|
-
#include "GPUShaderStage.h"
|
|
49
|
-
#include "GPUTextureUsage.h"
|
|
50
|
-
|
|
51
|
-
#include <memory>
|
|
52
|
-
#include <utility>
|
|
53
|
-
|
|
54
|
-
namespace rnwgpu {
|
|
55
|
-
|
|
56
|
-
RNWebGPUManager::RNWebGPUManager(
|
|
57
|
-
jsi::Runtime *jsRuntime,
|
|
58
|
-
std::shared_ptr<facebook::react::CallInvoker> jsCallInvoker,
|
|
59
|
-
std::shared_ptr<PlatformContext> platformContext)
|
|
60
|
-
: _jsRuntime(jsRuntime), _jsCallInvoker(jsCallInvoker),
|
|
61
|
-
_platformContext(platformContext) {
|
|
62
|
-
|
|
63
|
-
// Register main runtime for RuntimeAwareCache
|
|
64
|
-
BaseRuntimeAwareCache::setMainJsRuntime(_jsRuntime);
|
|
65
|
-
|
|
66
|
-
auto gpu = std::make_shared<GPU>(*_jsRuntime);
|
|
67
|
-
auto rnWebGPU =
|
|
68
|
-
std::make_shared<RNWebGPU>(gpu, _platformContext, _jsCallInvoker);
|
|
69
|
-
_gpu = gpu->get();
|
|
70
|
-
|
|
71
|
-
// RNWebGPU needs its brand registered in NativeObjectRegistry so the boxing
|
|
72
|
-
// path can install the prototype on worklet runtimes. installConstructor
|
|
73
|
-
// does that registration but also sets globalThis.RNWebGPU = ctor, so we
|
|
74
|
-
// call it FIRST and then overwrite the global with the actual instance.
|
|
75
|
-
RNWebGPU::installConstructor(*_jsRuntime);
|
|
76
|
-
_jsRuntime->global().setProperty(*_jsRuntime, "RNWebGPU",
|
|
77
|
-
RNWebGPU::create(*_jsRuntime, rnWebGPU));
|
|
78
|
-
|
|
79
|
-
// Install constructors for instanceof support
|
|
80
|
-
GPU::installConstructor(*_jsRuntime);
|
|
81
|
-
GPUAdapter::installConstructor(*_jsRuntime);
|
|
82
|
-
GPUAdapterInfo::installConstructor(*_jsRuntime);
|
|
83
|
-
GPUBindGroup::installConstructor(*_jsRuntime);
|
|
84
|
-
GPUBindGroupLayout::installConstructor(*_jsRuntime);
|
|
85
|
-
GPUBuffer::installConstructor(*_jsRuntime);
|
|
86
|
-
GPUCanvasContext::installConstructor(*_jsRuntime);
|
|
87
|
-
GPUCommandBuffer::installConstructor(*_jsRuntime);
|
|
88
|
-
GPUCommandEncoder::installConstructor(*_jsRuntime);
|
|
89
|
-
GPUCompilationInfo::installConstructor(*_jsRuntime);
|
|
90
|
-
GPUCompilationMessage::installConstructor(*_jsRuntime);
|
|
91
|
-
GPUComputePassEncoder::installConstructor(*_jsRuntime);
|
|
92
|
-
GPUComputePipeline::installConstructor(*_jsRuntime);
|
|
93
|
-
GPUDevice::installConstructor(*_jsRuntime);
|
|
94
|
-
GPUDeviceLostInfo::installConstructor(*_jsRuntime);
|
|
95
|
-
GPUError::installConstructor(*_jsRuntime);
|
|
96
|
-
GPUExternalTexture::installConstructor(*_jsRuntime);
|
|
97
|
-
GPUInternalError::installConstructor(*_jsRuntime);
|
|
98
|
-
GPUOutOfMemoryError::installConstructor(*_jsRuntime);
|
|
99
|
-
GPUValidationError::installConstructor(*_jsRuntime);
|
|
100
|
-
GPUUncapturedErrorEvent::installConstructor(*_jsRuntime);
|
|
101
|
-
GPUPipelineLayout::installConstructor(*_jsRuntime);
|
|
102
|
-
GPUQuerySet::installConstructor(*_jsRuntime);
|
|
103
|
-
GPUQueue::installConstructor(*_jsRuntime);
|
|
104
|
-
GPURenderBundle::installConstructor(*_jsRuntime);
|
|
105
|
-
GPURenderBundleEncoder::installConstructor(*_jsRuntime);
|
|
106
|
-
GPURenderPassEncoder::installConstructor(*_jsRuntime);
|
|
107
|
-
GPURenderPipeline::installConstructor(*_jsRuntime);
|
|
108
|
-
GPUSampler::installConstructor(*_jsRuntime);
|
|
109
|
-
GPUSharedTextureMemory::installConstructor(*_jsRuntime);
|
|
110
|
-
GPUShaderModule::installConstructor(*_jsRuntime);
|
|
111
|
-
GPUSupportedLimits::installConstructor(*_jsRuntime);
|
|
112
|
-
GPUTexture::installConstructor(*_jsRuntime);
|
|
113
|
-
GPUTextureView::installConstructor(*_jsRuntime);
|
|
114
|
-
VideoFrame::installConstructor(*_jsRuntime);
|
|
115
|
-
VideoPlayer::installConstructor(*_jsRuntime);
|
|
116
|
-
|
|
117
|
-
// Install constant objects as plain JS objects with own properties
|
|
118
|
-
_jsRuntime->global().setProperty(*_jsRuntime, "GPUBufferUsage",
|
|
119
|
-
GPUBufferUsage::create(*_jsRuntime));
|
|
120
|
-
_jsRuntime->global().setProperty(*_jsRuntime, "GPUColorWrite",
|
|
121
|
-
GPUColorWrite::create(*_jsRuntime));
|
|
122
|
-
_jsRuntime->global().setProperty(*_jsRuntime, "GPUMapMode",
|
|
123
|
-
GPUMapMode::create(*_jsRuntime));
|
|
124
|
-
_jsRuntime->global().setProperty(*_jsRuntime, "GPUShaderStage",
|
|
125
|
-
GPUShaderStage::create(*_jsRuntime));
|
|
126
|
-
_jsRuntime->global().setProperty(*_jsRuntime, "GPUTextureUsage",
|
|
127
|
-
GPUTextureUsage::create(*_jsRuntime));
|
|
128
|
-
|
|
129
|
-
// Install global helper functions for Worklets serialization
|
|
130
|
-
// These are standalone functions that don't require RNWebGPU instance
|
|
131
|
-
installWebGPUWorkletHelpers(*_jsRuntime);
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
void RNWebGPUManager::installWebGPUWorkletHelpers(jsi::Runtime &runtime) {
|
|
135
|
-
// __webgpuIsWebGPUObject - checks if a value is a WebGPU NativeObject
|
|
136
|
-
auto isWebGPUObjectFunc = jsi::Function::createFromHostFunction(
|
|
137
|
-
runtime, jsi::PropNameID::forUtf8(runtime, "__webgpuIsWebGPUObject"), 1,
|
|
138
|
-
[](jsi::Runtime &rt, const jsi::Value & /*thisVal*/,
|
|
139
|
-
const jsi::Value *args, size_t count) -> jsi::Value {
|
|
140
|
-
if (count < 1 || !args[0].isObject()) {
|
|
141
|
-
return jsi::Value(false);
|
|
142
|
-
}
|
|
143
|
-
auto obj = args[0].getObject(rt);
|
|
144
|
-
|
|
145
|
-
// Check if it has native state
|
|
146
|
-
if (!obj.hasNativeState(rt)) {
|
|
147
|
-
return jsi::Value(false);
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
// Check if it has Symbol.toStringTag on its prototype (WebGPU objects
|
|
151
|
-
// do)
|
|
152
|
-
auto objectCtor = rt.global().getPropertyAsObject(rt, "Object");
|
|
153
|
-
auto getPrototypeOf =
|
|
154
|
-
objectCtor.getPropertyAsFunction(rt, "getPrototypeOf");
|
|
155
|
-
auto proto = getPrototypeOf.call(rt, obj);
|
|
156
|
-
|
|
157
|
-
if (!proto.isObject()) {
|
|
158
|
-
return jsi::Value(false);
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
auto protoObj = proto.getObject(rt);
|
|
162
|
-
auto symbolCtor = rt.global().getPropertyAsObject(rt, "Symbol");
|
|
163
|
-
auto toStringTag = symbolCtor.getProperty(rt, "toStringTag");
|
|
164
|
-
if (toStringTag.isUndefined()) {
|
|
165
|
-
return jsi::Value(false);
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
auto getOwnPropertyDescriptor =
|
|
169
|
-
objectCtor.getPropertyAsFunction(rt, "getOwnPropertyDescriptor");
|
|
170
|
-
auto desc = getOwnPropertyDescriptor.call(rt, protoObj, toStringTag);
|
|
171
|
-
return jsi::Value(desc.isObject());
|
|
172
|
-
});
|
|
173
|
-
runtime.global().setProperty(runtime, "__webgpuIsWebGPUObject",
|
|
174
|
-
std::move(isWebGPUObjectFunc));
|
|
175
|
-
|
|
176
|
-
// __webgpuBox - boxes a WebGPU object for Worklets serialization
|
|
177
|
-
auto boxFunc = jsi::Function::createFromHostFunction(
|
|
178
|
-
runtime, jsi::PropNameID::forUtf8(runtime, "__webgpuBox"), 1,
|
|
179
|
-
[](jsi::Runtime &rt, const jsi::Value & /*thisVal*/,
|
|
180
|
-
const jsi::Value *args, size_t count) -> jsi::Value {
|
|
181
|
-
if (count < 1 || !args[0].isObject()) {
|
|
182
|
-
throw jsi::JSError(rt,
|
|
183
|
-
"__webgpuBox() requires a WebGPU object argument");
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
auto obj = args[0].getObject(rt);
|
|
187
|
-
|
|
188
|
-
// Check if it has native state
|
|
189
|
-
if (!obj.hasNativeState(rt)) {
|
|
190
|
-
throw jsi::JSError(
|
|
191
|
-
rt, "Object has no native state - not a WebGPU object");
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
// Get the brand name from Symbol.toStringTag on the prototype
|
|
195
|
-
auto objectCtor = rt.global().getPropertyAsObject(rt, "Object");
|
|
196
|
-
auto getPrototypeOf =
|
|
197
|
-
objectCtor.getPropertyAsFunction(rt, "getPrototypeOf");
|
|
198
|
-
auto proto = getPrototypeOf.call(rt, obj);
|
|
199
|
-
|
|
200
|
-
std::string brand;
|
|
201
|
-
if (proto.isObject()) {
|
|
202
|
-
auto protoObj = proto.getObject(rt);
|
|
203
|
-
auto symbolCtor = rt.global().getPropertyAsObject(rt, "Symbol");
|
|
204
|
-
auto toStringTag = symbolCtor.getProperty(rt, "toStringTag");
|
|
205
|
-
if (!toStringTag.isUndefined()) {
|
|
206
|
-
auto getOwnPropertyDescriptor = objectCtor.getPropertyAsFunction(
|
|
207
|
-
rt, "getOwnPropertyDescriptor");
|
|
208
|
-
auto desc =
|
|
209
|
-
getOwnPropertyDescriptor.call(rt, protoObj, toStringTag);
|
|
210
|
-
if (desc.isObject()) {
|
|
211
|
-
auto descObj = desc.getObject(rt);
|
|
212
|
-
auto value = descObj.getProperty(rt, "value");
|
|
213
|
-
if (value.isString()) {
|
|
214
|
-
brand = value.getString(rt).utf8(rt);
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
if (brand.empty()) {
|
|
221
|
-
throw jsi::JSError(rt, "Cannot determine WebGPU object type - no "
|
|
222
|
-
"Symbol.toStringTag found");
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
auto nativeState = obj.getNativeState(rt);
|
|
226
|
-
auto boxed = std::make_shared<BoxedWebGPUObject>(nativeState, brand);
|
|
227
|
-
return jsi::Object::createFromHostObject(rt, boxed);
|
|
228
|
-
});
|
|
229
|
-
runtime.global().setProperty(runtime, "__webgpuBox", std::move(boxFunc));
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
RNWebGPUManager::~RNWebGPUManager() {
|
|
233
|
-
_jsRuntime = nullptr;
|
|
234
|
-
_jsCallInvoker = nullptr;
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
} // namespace rnwgpu
|