react-native-webgpu 0.22.0 → 0.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +15 -2
- package/android/CMakeLists.txt +2 -1
- package/android/cpp/AndroidAnimationFrameSource.h +136 -0
- package/android/cpp/AndroidPlatformContext.h +55 -0
- package/android/cpp/cpp-adapter.cpp +148 -2
- package/android/src/main/java/com/webgpu/WebGPUModule.java +21 -4
- package/android/src/main/java/com/webgpu/WebGPUNativeBufferView.java +370 -0
- package/android/src/main/java/com/webgpu/WebGPUNativeBufferViewManager.java +56 -0
- package/android/src/main/java/com/webgpu/WebGPUTextureView.java +21 -0
- package/android/src/main/java/com/webgpu/WebGPUVideoPlayer.java +1 -1
- package/android/src/main/java/com/webgpu/WebGPUView.java +19 -3
- package/android/src/main/java/com/webgpu/WebGPUViewPackage.java +2 -2
- package/android/src/newarch/com/webgpu/WebGPUNativeBufferViewManagerSpec.java +24 -0
- package/apple/AppleAnimationFrameSource.mm +208 -0
- package/apple/ApplePlatformContext.h +6 -0
- package/apple/ApplePlatformContext.mm +73 -0
- package/apple/NativeBufferFenceWait.mm +88 -0
- package/apple/WebGPUNativeBufferView.h +15 -0
- package/apple/WebGPUNativeBufferView.mm +200 -0
- package/cpp/rnwgpu/AnimationFrames.cpp +576 -0
- package/cpp/rnwgpu/AnimationFrames.h +233 -0
- package/cpp/rnwgpu/NativeBufferViewRegistry.cpp +396 -0
- package/cpp/rnwgpu/NativeBufferViewRegistry.h +163 -0
- package/cpp/rnwgpu/PlatformContext.h +20 -0
- package/cpp/rnwgpu/RNWebGPUManager.cpp +17 -4
- package/cpp/rnwgpu/api/GPUAdapter.cpp +1 -1
- package/cpp/rnwgpu/api/GPUDevice.cpp +16 -131
- package/cpp/rnwgpu/api/GPUDevice.h +0 -18
- package/cpp/rnwgpu/api/GPUExternalTexture.cpp +35 -3
- package/cpp/rnwgpu/api/GPUExternalTexture.h +4 -4
- package/cpp/rnwgpu/api/GPUQueue.cpp +1 -1
- package/cpp/rnwgpu/api/GPUQueue.h +1 -1
- package/cpp/rnwgpu/api/GPUSharedFence.h +1 -0
- package/cpp/rnwgpu/api/GPUSharedTextureMemory.cpp +11 -5
- package/cpp/rnwgpu/api/GPUSharedTextureMemory.h +21 -2
- package/cpp/rnwgpu/api/GPUTexture.h +18 -0
- package/cpp/rnwgpu/api/NativeFrameFeatures.h +1 -1
- package/cpp/rnwgpu/api/NativeFrameImport.cpp +20 -17
- package/cpp/rnwgpu/api/NativeFrameImport.h +31 -20
- package/cpp/rnwgpu/api/RNWebGPU.h +201 -3
- package/cpp/rnwgpu/api/VideoFrame.h +5 -4
- package/cpp/rnwgpu/api/VideoFrameBlit.h +2 -2
- package/cpp/rnwgpu/api/descriptors/GPUExternalTextureDescriptor.h +21 -14
- package/cpp/rnwgpu/api/descriptors/GPUImageCopyExternalImage.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPUSharedTextureMemoryDescriptor.h +17 -9
- package/cpp/rnwgpu/async/RuntimeContext.cpp +21 -4
- package/cpp/rnwgpu/async/RuntimeContext.h +8 -0
- package/lib/commonjs/NativeBufferView.js +131 -0
- package/lib/commonjs/NativeBufferView.js.map +1 -0
- package/lib/commonjs/NativeBufferViewNativeComponent.js +10 -0
- package/lib/commonjs/NativeBufferViewNativeComponent.js.map +1 -0
- package/lib/commonjs/animationFrame.js +91 -0
- package/lib/commonjs/animationFrame.js.map +1 -0
- package/lib/commonjs/index.js +16 -1
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/main/index.js +12 -0
- package/lib/commonjs/main/index.js.map +1 -1
- package/lib/commonjs/mock.js +30 -1
- package/lib/commonjs/mock.js.map +1 -1
- package/lib/commonjs/video.js +14 -4
- package/lib/commonjs/video.js.map +1 -1
- package/lib/module/NativeBufferView.js +122 -0
- package/lib/module/NativeBufferView.js.map +1 -0
- package/lib/module/NativeBufferViewNativeComponent.js +4 -0
- package/lib/module/NativeBufferViewNativeComponent.js.map +1 -0
- package/lib/module/animationFrame.js +83 -0
- package/lib/module/animationFrame.js.map +1 -0
- package/lib/module/index.js +1 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/main/index.js +1 -0
- package/lib/module/main/index.js.map +1 -1
- package/lib/module/mock.js +21 -0
- package/lib/module/mock.js.map +1 -1
- package/lib/module/video.js +11 -2
- package/lib/module/video.js.map +1 -1
- package/lib/typescript/lib/commonjs/NativeBufferView.d.ts +48 -0
- package/lib/typescript/lib/commonjs/NativeBufferView.d.ts.map +1 -0
- package/lib/typescript/lib/commonjs/NativeBufferViewNativeComponent.d.ts +5 -0
- package/lib/typescript/lib/commonjs/NativeBufferViewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/lib/commonjs/animationFrame.d.ts +54 -0
- package/lib/typescript/lib/commonjs/animationFrame.d.ts.map +1 -0
- package/lib/typescript/lib/commonjs/index.d.ts +2 -0
- package/lib/typescript/lib/commonjs/mock.d.ts +12 -0
- package/lib/typescript/lib/commonjs/mock.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/video.d.ts +3 -2
- package/lib/typescript/lib/commonjs/video.d.ts.map +1 -1
- package/lib/typescript/lib/module/NativeBufferView.d.ts +14 -0
- package/lib/typescript/lib/module/NativeBufferView.d.ts.map +1 -0
- package/lib/typescript/lib/module/NativeBufferViewNativeComponent.d.ts +3 -0
- package/lib/typescript/lib/module/NativeBufferViewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/lib/module/animationFrame.d.ts +3 -0
- package/lib/typescript/lib/module/animationFrame.d.ts.map +1 -0
- package/lib/typescript/lib/module/index.d.ts +1 -0
- package/lib/typescript/lib/module/main/index.d.ts +1 -0
- package/lib/typescript/lib/module/mock.d.ts +14 -0
- package/lib/typescript/lib/module/mock.d.ts.map +1 -1
- package/lib/typescript/lib/module/video.d.ts +3 -2
- package/lib/typescript/lib/module/video.d.ts.map +1 -1
- package/lib/typescript/src/NativeBufferView.d.ts +99 -0
- package/lib/typescript/src/NativeBufferView.d.ts.map +1 -0
- package/lib/typescript/src/NativeBufferViewNativeComponent.d.ts +13 -0
- package/lib/typescript/src/NativeBufferViewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/src/animationFrame.d.ts +59 -0
- package/lib/typescript/src/animationFrame.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +18 -8
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/main/index.d.ts +1 -0
- package/lib/typescript/src/main/index.d.ts.map +1 -1
- package/lib/typescript/src/mock.d.ts +11 -0
- package/lib/typescript/src/mock.d.ts.map +1 -1
- package/lib/typescript/src/types.d.ts +32 -31
- package/lib/typescript/src/types.d.ts.map +1 -1
- package/lib/typescript/src/video.d.ts +12 -4
- package/lib/typescript/src/video.d.ts.map +1 -1
- package/package.json +7 -2
- package/react-native-webgpu.podspec +1 -1
- package/src/NativeBufferView.tsx +199 -0
- package/src/NativeBufferViewNativeComponent.ts +20 -0
- package/src/animationFrame.ts +82 -0
- package/src/index.tsx +45 -39
- package/src/main/index.tsx +1 -0
- package/src/mock.ts +35 -0
- package/src/types.ts +61 -87
- package/src/video.ts +20 -7
- package/cpp/rnwgpu/api/GPUNativeBufferExternalTexture.h +0 -60
- package/cpp/rnwgpu/api/GPUNativeBufferTexture.h +0 -52
- package/cpp/rnwgpu/api/GPUNativeBufferWrapper.cpp +0 -144
- package/cpp/rnwgpu/api/GPUNativeBufferWrapper.h +0 -143
- package/cpp/rnwgpu/api/descriptors/GPUNativeBufferTextureDescriptor.h +0 -55
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
#pragma once
|
|
2
|
-
|
|
3
|
-
#include <memory>
|
|
4
|
-
#include <optional>
|
|
5
|
-
#include <stdexcept>
|
|
6
|
-
#include <string>
|
|
7
|
-
|
|
8
|
-
#include "webgpu/webgpu_cpp.h"
|
|
9
|
-
|
|
10
|
-
#include "JSIConverter.h"
|
|
11
|
-
|
|
12
|
-
namespace jsi = facebook::jsi;
|
|
13
|
-
|
|
14
|
-
namespace rnwgpu {
|
|
15
|
-
|
|
16
|
-
// The options of GPUDevice.createNativeBufferTexture(): the usage of the
|
|
17
|
-
// texture (the usages the buffer allows by default, as
|
|
18
|
-
// GPUSharedTextureMemory.createTexture() without a descriptor) and a label.
|
|
19
|
-
struct GPUNativeBufferTextureDescriptor {
|
|
20
|
-
std::optional<double> usage;
|
|
21
|
-
std::optional<std::string> label;
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
template <>
|
|
25
|
-
struct JSIConverter<std::shared_ptr<rnwgpu::GPUNativeBufferTextureDescriptor>> {
|
|
26
|
-
static std::shared_ptr<rnwgpu::GPUNativeBufferTextureDescriptor>
|
|
27
|
-
fromJSI(jsi::Runtime &runtime, const jsi::Value &arg, bool outOfBounds) {
|
|
28
|
-
auto result = std::make_shared<rnwgpu::GPUNativeBufferTextureDescriptor>();
|
|
29
|
-
if (!outOfBounds && arg.isObject()) {
|
|
30
|
-
auto value = arg.getObject(runtime);
|
|
31
|
-
if (value.hasProperty(runtime, "usage")) {
|
|
32
|
-
auto prop = value.getProperty(runtime, "usage");
|
|
33
|
-
if (prop.isNumber()) {
|
|
34
|
-
result->usage = prop.asNumber();
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
if (value.hasProperty(runtime, "label")) {
|
|
38
|
-
auto prop = value.getProperty(runtime, "label");
|
|
39
|
-
if (!prop.isUndefined()) {
|
|
40
|
-
result->label = JSIConverter<std::optional<std::string>>::fromJSI(
|
|
41
|
-
runtime, prop, false);
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
return result;
|
|
46
|
-
}
|
|
47
|
-
static jsi::Value
|
|
48
|
-
toJSI(jsi::Runtime & /*runtime*/,
|
|
49
|
-
std::shared_ptr<rnwgpu::GPUNativeBufferTextureDescriptor> /*arg*/) {
|
|
50
|
-
throw std::runtime_error(
|
|
51
|
-
"Invalid GPUNativeBufferTextureDescriptor::toJSI()");
|
|
52
|
-
}
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
} // namespace rnwgpu
|