react-native-wgpu 0.4.2 → 0.5.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 +31 -0
- package/android/CMakeLists.txt +3 -3
- package/cpp/jsi/{RNFEnumMapper.h → EnumMapper.h} +2 -6
- package/cpp/jsi/{RNFJSIConverter.h → JSIConverter.h} +27 -110
- package/cpp/jsi/NativeObject.h +607 -0
- package/cpp/jsi/{RNFPromise.cpp → Promise.cpp} +3 -6
- package/cpp/jsi/{RNFPromise.h → Promise.h} +2 -5
- package/cpp/jsi/RuntimeAwareCache.cpp +7 -0
- package/cpp/jsi/RuntimeAwareCache.h +100 -0
- package/cpp/jsi/RuntimeLifecycleMonitor.cpp +72 -0
- package/cpp/jsi/RuntimeLifecycleMonitor.h +32 -0
- package/cpp/rnwgpu/ArrayBuffer.h +8 -12
- package/cpp/rnwgpu/RNWebGPUManager.cpp +187 -28
- package/cpp/rnwgpu/RNWebGPUManager.h +7 -0
- package/cpp/rnwgpu/api/Canvas.h +14 -12
- package/cpp/rnwgpu/api/GPU.cpp +4 -6
- package/cpp/rnwgpu/api/GPU.h +13 -11
- package/cpp/rnwgpu/api/GPUAdapter.cpp +9 -9
- package/cpp/rnwgpu/api/GPUAdapter.h +14 -11
- package/cpp/rnwgpu/api/GPUAdapterInfo.h +17 -15
- package/cpp/rnwgpu/api/GPUBindGroup.h +11 -10
- package/cpp/rnwgpu/api/GPUBindGroupLayout.h +12 -11
- package/cpp/rnwgpu/api/GPUBuffer.h +19 -16
- package/cpp/rnwgpu/api/GPUCanvasContext.h +17 -13
- package/cpp/rnwgpu/api/GPUCommandBuffer.h +12 -10
- package/cpp/rnwgpu/api/GPUCommandEncoder.h +35 -32
- package/cpp/rnwgpu/api/GPUCompilationInfo.h +19 -19
- package/cpp/rnwgpu/api/GPUCompilationMessage.h +10 -7
- package/cpp/rnwgpu/api/GPUComputePassEncoder.h +28 -27
- package/cpp/rnwgpu/api/GPUComputePipeline.h +14 -13
- package/cpp/rnwgpu/api/GPUDevice.cpp +111 -95
- package/cpp/rnwgpu/api/GPUDevice.h +51 -43
- package/cpp/rnwgpu/api/GPUDeviceLostInfo.h +12 -10
- package/cpp/rnwgpu/api/GPUError.h +19 -29
- package/cpp/rnwgpu/api/GPUExtent3D.h +7 -10
- package/cpp/rnwgpu/api/GPUExternalTexture.h +12 -11
- package/cpp/rnwgpu/api/GPUInternalError.h +31 -0
- package/cpp/rnwgpu/api/GPUOrigin2D.h +6 -10
- package/cpp/rnwgpu/api/GPUOrigin3D.h +6 -10
- package/cpp/rnwgpu/api/GPUOutOfMemoryError.h +33 -0
- package/cpp/rnwgpu/api/GPUPipelineLayout.h +12 -10
- package/cpp/rnwgpu/api/GPUQuerySet.h +14 -12
- package/cpp/rnwgpu/api/GPUQueue.h +18 -17
- package/cpp/rnwgpu/api/GPURenderBundle.h +11 -10
- package/cpp/rnwgpu/api/GPURenderBundleEncoder.h +36 -33
- package/cpp/rnwgpu/api/GPURenderPassEncoder.h +49 -47
- package/cpp/rnwgpu/api/GPURenderPipeline.h +14 -12
- package/cpp/rnwgpu/api/GPUSampler.h +11 -10
- package/cpp/rnwgpu/api/GPUShaderModule.cpp +7 -8
- package/cpp/rnwgpu/api/GPUShaderModule.h +13 -12
- package/cpp/rnwgpu/api/GPUSupportedLimits.h +73 -93
- package/cpp/rnwgpu/api/GPUTexture.h +24 -20
- package/cpp/rnwgpu/api/GPUTextureView.h +11 -10
- package/cpp/rnwgpu/api/GPUValidationError.h +32 -0
- package/cpp/rnwgpu/api/ImageBitmap.h +10 -6
- package/cpp/rnwgpu/api/RNWebGPU.h +21 -21
- package/cpp/rnwgpu/api/descriptors/GPUBindGroupDescriptor.h +3 -7
- package/cpp/rnwgpu/api/descriptors/GPUBindGroupEntry.h +7 -11
- package/cpp/rnwgpu/api/descriptors/GPUBindGroupLayoutDescriptor.h +3 -7
- package/cpp/rnwgpu/api/descriptors/GPUBindGroupLayoutEntry.h +3 -7
- package/cpp/rnwgpu/api/descriptors/GPUBlendComponent.h +3 -8
- package/cpp/rnwgpu/api/descriptors/GPUBlendState.h +3 -7
- package/cpp/rnwgpu/api/descriptors/GPUBufferBinding.h +3 -7
- package/cpp/rnwgpu/api/descriptors/GPUBufferBindingLayout.h +3 -8
- package/cpp/rnwgpu/api/descriptors/GPUBufferDescriptor.h +3 -8
- package/cpp/rnwgpu/api/descriptors/GPUBufferUsage.h +28 -32
- package/cpp/rnwgpu/api/descriptors/GPUCanvasConfiguration.h +3 -7
- package/cpp/rnwgpu/api/descriptors/GPUColor.h +3 -8
- package/cpp/rnwgpu/api/descriptors/GPUColorTargetState.h +3 -7
- package/cpp/rnwgpu/api/descriptors/GPUColorWrite.h +18 -20
- package/cpp/rnwgpu/api/descriptors/GPUCommandBufferDescriptor.h +3 -8
- package/cpp/rnwgpu/api/descriptors/GPUCommandEncoderDescriptor.h +3 -8
- package/cpp/rnwgpu/api/descriptors/GPUComputePassDescriptor.h +3 -7
- package/cpp/rnwgpu/api/descriptors/GPUComputePassTimestampWrites.h +3 -7
- package/cpp/rnwgpu/api/descriptors/GPUComputePipelineDescriptor.h +3 -7
- package/cpp/rnwgpu/api/descriptors/GPUDepthStencilState.h +3 -7
- package/cpp/rnwgpu/api/descriptors/GPUDeviceDescriptor.h +3 -7
- package/cpp/rnwgpu/api/descriptors/GPUExternalTextureBindingLayout.h +3 -8
- package/cpp/rnwgpu/api/descriptors/GPUExternalTextureDescriptor.h +3 -7
- package/cpp/rnwgpu/api/descriptors/GPUFragmentState.h +3 -7
- package/cpp/rnwgpu/api/descriptors/GPUImageCopyBuffer.h +3 -7
- package/cpp/rnwgpu/api/descriptors/GPUImageCopyExternalImage.h +3 -7
- package/cpp/rnwgpu/api/descriptors/GPUImageCopyTexture.h +3 -7
- package/cpp/rnwgpu/api/descriptors/GPUImageCopyTextureTagged.h +3 -7
- package/cpp/rnwgpu/api/descriptors/GPUImageDataLayout.h +3 -8
- package/cpp/rnwgpu/api/descriptors/GPUMapMode.h +11 -14
- package/cpp/rnwgpu/api/descriptors/GPUMultisampleState.h +3 -8
- package/cpp/rnwgpu/api/descriptors/GPUPipelineLayoutDescriptor.h +3 -7
- package/cpp/rnwgpu/api/descriptors/GPUPrimitiveState.h +3 -8
- package/cpp/rnwgpu/api/descriptors/GPUProgrammableStage.h +3 -7
- package/cpp/rnwgpu/api/descriptors/GPUQuerySetDescriptor.h +3 -8
- package/cpp/rnwgpu/api/descriptors/GPUQueueDescriptor.h +3 -8
- package/cpp/rnwgpu/api/descriptors/GPURenderBundleDescriptor.h +3 -8
- package/cpp/rnwgpu/api/descriptors/GPURenderBundleEncoderDescriptor.h +3 -8
- package/cpp/rnwgpu/api/descriptors/GPURenderPassColorAttachment.h +3 -7
- package/cpp/rnwgpu/api/descriptors/GPURenderPassDepthStencilAttachment.h +3 -7
- package/cpp/rnwgpu/api/descriptors/GPURenderPassDescriptor.h +3 -7
- package/cpp/rnwgpu/api/descriptors/GPURenderPassTimestampWrites.h +3 -7
- package/cpp/rnwgpu/api/descriptors/GPURenderPipelineDescriptor.h +3 -7
- package/cpp/rnwgpu/api/descriptors/GPURequestAdapterOptions.h +3 -8
- package/cpp/rnwgpu/api/descriptors/GPUSamplerBindingLayout.h +3 -8
- package/cpp/rnwgpu/api/descriptors/GPUSamplerDescriptor.h +3 -8
- package/cpp/rnwgpu/api/descriptors/GPUShaderModuleCompilationHint.h +3 -7
- package/cpp/rnwgpu/api/descriptors/GPUShaderModuleDescriptor.h +3 -7
- package/cpp/rnwgpu/api/descriptors/GPUShaderStage.h +14 -16
- package/cpp/rnwgpu/api/descriptors/GPUStencilFaceState.h +3 -8
- package/cpp/rnwgpu/api/descriptors/GPUStorageTextureBindingLayout.h +3 -8
- package/cpp/rnwgpu/api/descriptors/GPUTextureBindingLayout.h +3 -8
- package/cpp/rnwgpu/api/descriptors/GPUTextureDescriptor.h +3 -7
- package/cpp/rnwgpu/api/descriptors/GPUTextureUsage.h +18 -29
- package/cpp/rnwgpu/api/descriptors/GPUTextureViewDescriptor.h +3 -8
- package/cpp/rnwgpu/api/descriptors/GPUUncapturedErrorEventInit.h +3 -7
- package/cpp/rnwgpu/api/descriptors/GPUVertexAttribute.h +3 -8
- package/cpp/rnwgpu/api/descriptors/GPUVertexBufferLayout.h +3 -7
- package/cpp/rnwgpu/api/descriptors/GPUVertexState.h +3 -7
- package/cpp/rnwgpu/api/descriptors/Unions.h +3 -3
- package/cpp/rnwgpu/async/AsyncTaskHandle.cpp +10 -10
- package/cpp/rnwgpu/async/AsyncTaskHandle.h +2 -2
- package/lib/commonjs/external/ModuleProxy.js +36 -0
- package/lib/commonjs/external/ModuleProxy.js.map +1 -0
- package/lib/commonjs/external/index.js +17 -0
- package/lib/commonjs/external/index.js.map +1 -0
- package/lib/commonjs/external/reanimated/ReanimatedProxy.js +18 -0
- package/lib/commonjs/external/reanimated/ReanimatedProxy.js.map +1 -0
- package/lib/commonjs/external/reanimated/index.js +21 -0
- package/lib/commonjs/external/reanimated/index.js.map +1 -0
- package/lib/commonjs/external/reanimated/registerWebGPUForReanimated.js +50 -0
- package/lib/commonjs/external/reanimated/registerWebGPUForReanimated.js.map +1 -0
- package/lib/commonjs/main/index.js +2 -142
- package/lib/commonjs/main/index.js.map +1 -1
- package/lib/module/external/ModuleProxy.js +28 -0
- package/lib/module/external/ModuleProxy.js.map +1 -0
- package/lib/module/external/index.js +2 -0
- package/lib/module/external/index.js.map +1 -0
- package/lib/module/external/reanimated/ReanimatedProxy.js +12 -0
- package/lib/module/external/reanimated/ReanimatedProxy.js.map +1 -0
- package/lib/module/external/reanimated/index.js +3 -0
- package/lib/module/external/reanimated/index.js.map +1 -0
- package/lib/module/external/reanimated/registerWebGPUForReanimated.js +43 -0
- package/lib/module/external/reanimated/registerWebGPUForReanimated.js.map +1 -0
- package/lib/module/main/index.js +2 -141
- package/lib/module/main/index.js.map +1 -1
- package/lib/typescript/babel.config.d.ts +1 -0
- package/lib/typescript/lib/commonjs/external/ModuleProxy.d.ts +12 -0
- package/lib/typescript/lib/commonjs/external/ModuleProxy.d.ts.map +1 -0
- package/lib/typescript/lib/commonjs/external/index.d.ts +2 -0
- package/lib/typescript/lib/commonjs/external/index.d.ts.map +1 -0
- package/lib/typescript/lib/commonjs/external/reanimated/ReanimatedProxy.d.ts +6 -0
- package/lib/typescript/lib/commonjs/external/reanimated/ReanimatedProxy.d.ts.map +1 -0
- package/lib/typescript/lib/commonjs/external/reanimated/index.d.ts +4 -0
- package/lib/typescript/lib/commonjs/external/reanimated/index.d.ts.map +1 -0
- package/lib/typescript/lib/commonjs/external/reanimated/registerWebGPUForReanimated.d.ts +9 -0
- package/lib/typescript/lib/commonjs/external/reanimated/registerWebGPUForReanimated.d.ts.map +1 -0
- package/lib/typescript/lib/module/external/ModuleProxy.d.ts +7 -0
- package/lib/typescript/lib/module/external/ModuleProxy.d.ts.map +1 -0
- package/lib/typescript/lib/module/external/index.d.ts +2 -0
- package/lib/typescript/lib/module/external/index.d.ts.map +1 -0
- package/lib/typescript/lib/module/external/reanimated/ReanimatedProxy.d.ts +5 -0
- package/lib/typescript/lib/module/external/reanimated/ReanimatedProxy.d.ts.map +1 -0
- package/lib/typescript/lib/module/external/reanimated/index.d.ts +3 -0
- package/lib/typescript/lib/module/external/reanimated/index.d.ts.map +1 -0
- package/lib/typescript/lib/module/external/reanimated/registerWebGPUForReanimated.d.ts +2 -0
- package/lib/typescript/lib/module/external/reanimated/registerWebGPUForReanimated.d.ts.map +1 -0
- package/lib/typescript/src/external/ModuleProxy.d.ts +11 -0
- package/lib/typescript/src/external/ModuleProxy.d.ts.map +1 -0
- package/lib/typescript/src/external/index.d.ts +2 -0
- package/lib/typescript/src/external/index.d.ts.map +1 -0
- package/lib/typescript/src/external/reanimated/ReanimatedProxy.d.ts +4 -0
- package/lib/typescript/src/external/reanimated/ReanimatedProxy.d.ts.map +1 -0
- package/lib/typescript/src/external/reanimated/index.d.ts +3 -0
- package/lib/typescript/src/external/reanimated/index.d.ts.map +1 -0
- package/lib/typescript/src/external/reanimated/registerWebGPUForReanimated.d.ts +8 -0
- package/lib/typescript/src/external/reanimated/registerWebGPUForReanimated.d.ts.map +1 -0
- package/package.json +16 -3
- package/src/external/ModuleProxy.ts +30 -0
- package/src/external/index.ts +1 -0
- package/src/external/reanimated/ReanimatedProxy.ts +19 -0
- package/src/external/reanimated/index.ts +2 -0
- package/src/external/reanimated/registerWebGPUForReanimated.ts +43 -0
- package/src/main/index.tsx +3 -170
- package/cpp/jsi/RNFHybridObject.cpp +0 -150
- package/cpp/jsi/RNFHybridObject.h +0 -181
- package/cpp/jsi/RNFJSIHelper.h +0 -51
- package/cpp/jsi/RNFPointerHolder.h +0 -95
- package/cpp/jsi/RNFRuntimeState.cpp +0 -18
- package/cpp/jsi/RNFRuntimeState.h +0 -106
|
@@ -1,40 +1,29 @@
|
|
|
1
1
|
#pragma once
|
|
2
|
-
#include <string>
|
|
3
2
|
|
|
4
|
-
#include <
|
|
3
|
+
#include <jsi/jsi.h>
|
|
5
4
|
|
|
6
5
|
#include "webgpu/webgpu_cpp.h"
|
|
7
6
|
|
|
8
7
|
namespace rnwgpu {
|
|
9
8
|
|
|
10
|
-
namespace
|
|
9
|
+
namespace jsi = facebook::jsi;
|
|
11
10
|
|
|
12
|
-
class GPUTextureUsage
|
|
11
|
+
class GPUTextureUsage {
|
|
13
12
|
public:
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
return
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
void loadHybridMethods() override {
|
|
30
|
-
registerHybridGetter("COPY_SRC", &GPUTextureUsage::CopySrc, this);
|
|
31
|
-
registerHybridGetter("COPY_DST", &GPUTextureUsage::CopyDst, this);
|
|
32
|
-
registerHybridGetter("TEXTURE_BINDING", &GPUTextureUsage::TextureBinding,
|
|
33
|
-
this);
|
|
34
|
-
registerHybridGetter("STORAGE_BINDING", &GPUTextureUsage::StorageBinding,
|
|
35
|
-
this);
|
|
36
|
-
registerHybridGetter("RENDER_ATTACHMENT",
|
|
37
|
-
&GPUTextureUsage::RenderAttachment, this);
|
|
13
|
+
static jsi::Object create(jsi::Runtime &runtime) {
|
|
14
|
+
jsi::Object obj(runtime);
|
|
15
|
+
obj.setProperty(runtime, "COPY_SRC",
|
|
16
|
+
static_cast<double>(wgpu::TextureUsage::CopySrc));
|
|
17
|
+
obj.setProperty(runtime, "COPY_DST",
|
|
18
|
+
static_cast<double>(wgpu::TextureUsage::CopyDst));
|
|
19
|
+
obj.setProperty(runtime, "TEXTURE_BINDING",
|
|
20
|
+
static_cast<double>(wgpu::TextureUsage::TextureBinding));
|
|
21
|
+
obj.setProperty(runtime, "STORAGE_BINDING",
|
|
22
|
+
static_cast<double>(wgpu::TextureUsage::StorageBinding));
|
|
23
|
+
obj.setProperty(runtime, "RENDER_ATTACHMENT",
|
|
24
|
+
static_cast<double>(wgpu::TextureUsage::RenderAttachment));
|
|
25
|
+
return obj;
|
|
38
26
|
}
|
|
39
27
|
};
|
|
40
|
-
|
|
28
|
+
|
|
29
|
+
} // namespace rnwgpu
|
|
@@ -5,13 +5,10 @@
|
|
|
5
5
|
|
|
6
6
|
#include "webgpu/webgpu_cpp.h"
|
|
7
7
|
|
|
8
|
-
#include "
|
|
8
|
+
#include "JSIConverter.h"
|
|
9
9
|
#include "WGPULogger.h"
|
|
10
10
|
|
|
11
|
-
#include "RNFHybridObject.h"
|
|
12
|
-
|
|
13
11
|
namespace jsi = facebook::jsi;
|
|
14
|
-
namespace m = margelo;
|
|
15
12
|
|
|
16
13
|
namespace rnwgpu {
|
|
17
14
|
|
|
@@ -29,9 +26,7 @@ struct GPUTextureViewDescriptor {
|
|
|
29
26
|
|
|
30
27
|
} // namespace rnwgpu
|
|
31
28
|
|
|
32
|
-
namespace
|
|
33
|
-
|
|
34
|
-
using namespace rnwgpu; // NOLINT(build/namespaces)
|
|
29
|
+
namespace rnwgpu {
|
|
35
30
|
|
|
36
31
|
template <>
|
|
37
32
|
struct JSIConverter<std::shared_ptr<rnwgpu::GPUTextureViewDescriptor>> {
|
|
@@ -94,4 +89,4 @@ struct JSIConverter<std::shared_ptr<rnwgpu::GPUTextureViewDescriptor>> {
|
|
|
94
89
|
}
|
|
95
90
|
};
|
|
96
91
|
|
|
97
|
-
} // namespace
|
|
92
|
+
} // namespace rnwgpu
|
|
@@ -4,14 +4,12 @@
|
|
|
4
4
|
|
|
5
5
|
#include "webgpu/webgpu_cpp.h"
|
|
6
6
|
|
|
7
|
-
#include "
|
|
7
|
+
#include "JSIConverter.h"
|
|
8
8
|
#include "WGPULogger.h"
|
|
9
9
|
|
|
10
10
|
#include "GPUError.h"
|
|
11
|
-
#include "RNFHybridObject.h"
|
|
12
11
|
|
|
13
12
|
namespace jsi = facebook::jsi;
|
|
14
|
-
namespace m = margelo;
|
|
15
13
|
|
|
16
14
|
namespace rnwgpu {
|
|
17
15
|
|
|
@@ -24,9 +22,7 @@ struct GPUUncapturedErrorEventInit {
|
|
|
24
22
|
|
|
25
23
|
} // namespace rnwgpu
|
|
26
24
|
|
|
27
|
-
namespace
|
|
28
|
-
|
|
29
|
-
using namespace rnwgpu; // NOLINT(build/namespaces)
|
|
25
|
+
namespace rnwgpu {
|
|
30
26
|
|
|
31
27
|
template <>
|
|
32
28
|
struct JSIConverter<std::shared_ptr<rnwgpu::GPUUncapturedErrorEventInit>> {
|
|
@@ -66,4 +62,4 @@ struct JSIConverter<std::shared_ptr<rnwgpu::GPUUncapturedErrorEventInit>> {
|
|
|
66
62
|
}
|
|
67
63
|
};
|
|
68
64
|
|
|
69
|
-
} // namespace
|
|
65
|
+
} // namespace rnwgpu
|
|
@@ -4,13 +4,10 @@
|
|
|
4
4
|
|
|
5
5
|
#include "webgpu/webgpu_cpp.h"
|
|
6
6
|
|
|
7
|
-
#include "
|
|
7
|
+
#include "JSIConverter.h"
|
|
8
8
|
#include "WGPULogger.h"
|
|
9
9
|
|
|
10
|
-
#include "RNFHybridObject.h"
|
|
11
|
-
|
|
12
10
|
namespace jsi = facebook::jsi;
|
|
13
|
-
namespace m = margelo;
|
|
14
11
|
|
|
15
12
|
namespace rnwgpu {
|
|
16
13
|
|
|
@@ -22,9 +19,7 @@ struct GPUVertexAttribute {
|
|
|
22
19
|
|
|
23
20
|
} // namespace rnwgpu
|
|
24
21
|
|
|
25
|
-
namespace
|
|
26
|
-
|
|
27
|
-
using namespace rnwgpu; // NOLINT(build/namespaces)
|
|
22
|
+
namespace rnwgpu {
|
|
28
23
|
|
|
29
24
|
template <> struct JSIConverter<std::shared_ptr<rnwgpu::GPUVertexAttribute>> {
|
|
30
25
|
static std::shared_ptr<rnwgpu::GPUVertexAttribute>
|
|
@@ -56,4 +51,4 @@ template <> struct JSIConverter<std::shared_ptr<rnwgpu::GPUVertexAttribute>> {
|
|
|
56
51
|
}
|
|
57
52
|
};
|
|
58
53
|
|
|
59
|
-
} // namespace
|
|
54
|
+
} // namespace rnwgpu
|
|
@@ -5,14 +5,12 @@
|
|
|
5
5
|
|
|
6
6
|
#include "webgpu/webgpu_cpp.h"
|
|
7
7
|
|
|
8
|
-
#include "
|
|
8
|
+
#include "JSIConverter.h"
|
|
9
9
|
#include "WGPULogger.h"
|
|
10
10
|
|
|
11
11
|
#include "GPUVertexAttribute.h"
|
|
12
|
-
#include "RNFHybridObject.h"
|
|
13
12
|
|
|
14
13
|
namespace jsi = facebook::jsi;
|
|
15
|
-
namespace m = margelo;
|
|
16
14
|
|
|
17
15
|
namespace rnwgpu {
|
|
18
16
|
|
|
@@ -25,9 +23,7 @@ struct GPUVertexBufferLayout {
|
|
|
25
23
|
|
|
26
24
|
} // namespace rnwgpu
|
|
27
25
|
|
|
28
|
-
namespace
|
|
29
|
-
|
|
30
|
-
using namespace rnwgpu; // NOLINT(build/namespaces)
|
|
26
|
+
namespace rnwgpu {
|
|
31
27
|
|
|
32
28
|
template <>
|
|
33
29
|
struct JSIConverter<std::shared_ptr<rnwgpu::GPUVertexBufferLayout>> {
|
|
@@ -64,4 +60,4 @@ struct JSIConverter<std::shared_ptr<rnwgpu::GPUVertexBufferLayout>> {
|
|
|
64
60
|
}
|
|
65
61
|
};
|
|
66
62
|
|
|
67
|
-
} // namespace
|
|
63
|
+
} // namespace rnwgpu
|
|
@@ -8,15 +8,13 @@
|
|
|
8
8
|
|
|
9
9
|
#include "webgpu/webgpu_cpp.h"
|
|
10
10
|
|
|
11
|
-
#include "
|
|
11
|
+
#include "JSIConverter.h"
|
|
12
12
|
#include "WGPULogger.h"
|
|
13
13
|
|
|
14
14
|
#include "GPUShaderModule.h"
|
|
15
15
|
#include "GPUVertexBufferLayout.h"
|
|
16
|
-
#include "RNFHybridObject.h"
|
|
17
16
|
|
|
18
17
|
namespace jsi = facebook::jsi;
|
|
19
|
-
namespace m = margelo;
|
|
20
18
|
|
|
21
19
|
namespace rnwgpu {
|
|
22
20
|
|
|
@@ -32,9 +30,7 @@ struct GPUVertexState {
|
|
|
32
30
|
|
|
33
31
|
} // namespace rnwgpu
|
|
34
32
|
|
|
35
|
-
namespace
|
|
36
|
-
|
|
37
|
-
using namespace rnwgpu; // NOLINT(build/namespaces)
|
|
33
|
+
namespace rnwgpu {
|
|
38
34
|
|
|
39
35
|
template <> struct JSIConverter<std::shared_ptr<rnwgpu::GPUVertexState>> {
|
|
40
36
|
static std::shared_ptr<rnwgpu::GPUVertexState>
|
|
@@ -75,4 +71,4 @@ template <> struct JSIConverter<std::shared_ptr<rnwgpu::GPUVertexState>> {
|
|
|
75
71
|
}
|
|
76
72
|
};
|
|
77
73
|
|
|
78
|
-
} // namespace
|
|
74
|
+
} // namespace rnwgpu
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
#include <string>
|
|
4
4
|
|
|
5
|
+
#include "EnumMapper.h"
|
|
5
6
|
#include "External.h"
|
|
6
|
-
#include "RNFEnumMapper.h"
|
|
7
7
|
#include "webgpu/webgpu_cpp.h"
|
|
8
8
|
|
|
9
|
-
namespace
|
|
9
|
+
namespace rnwgpu {
|
|
10
10
|
namespace EnumMapper {
|
|
11
11
|
|
|
12
12
|
inline void convertJSUnionToEnum(const std::string &inUnion,
|
|
@@ -1981,4 +1981,4 @@ inline void convertEnumToJSUnion(rnwgpu::PremultiplyAlpha inEnum,
|
|
|
1981
1981
|
}
|
|
1982
1982
|
|
|
1983
1983
|
} // namespace EnumMapper
|
|
1984
|
-
} // namespace
|
|
1984
|
+
} // namespace rnwgpu
|
|
@@ -3,13 +3,13 @@
|
|
|
3
3
|
#include <string>
|
|
4
4
|
#include <utility>
|
|
5
5
|
|
|
6
|
-
#include "
|
|
6
|
+
#include "Promise.h"
|
|
7
7
|
|
|
8
8
|
#include "AsyncRunner.h"
|
|
9
9
|
|
|
10
10
|
namespace rnwgpu::async {
|
|
11
11
|
|
|
12
|
-
using Action = std::function<void(jsi::Runtime &,
|
|
12
|
+
using Action = std::function<void(jsi::Runtime &, rnwgpu::Promise &)>;
|
|
13
13
|
|
|
14
14
|
struct AsyncTaskHandle::State
|
|
15
15
|
: public std::enable_shared_from_this<AsyncTaskHandle::State> {
|
|
@@ -17,17 +17,17 @@ struct AsyncTaskHandle::State
|
|
|
17
17
|
: runner(std::move(runner)), keepPumping(keepPumping) {}
|
|
18
18
|
|
|
19
19
|
void settle(Action action);
|
|
20
|
-
void attachPromise(const std::shared_ptr<
|
|
20
|
+
void attachPromise(const std::shared_ptr<rnwgpu::Promise> &promise);
|
|
21
21
|
void schedule(Action action);
|
|
22
22
|
|
|
23
23
|
ResolveFunction createResolveFunction();
|
|
24
24
|
RejectFunction createRejectFunction();
|
|
25
25
|
|
|
26
|
-
std::shared_ptr<
|
|
26
|
+
std::shared_ptr<rnwgpu::Promise> currentPromise();
|
|
27
27
|
|
|
28
28
|
std::mutex mutex;
|
|
29
29
|
std::weak_ptr<AsyncRunner> runner;
|
|
30
|
-
std::shared_ptr<
|
|
30
|
+
std::shared_ptr<rnwgpu::Promise> promise;
|
|
31
31
|
std::optional<Action> pendingAction;
|
|
32
32
|
bool settled = false;
|
|
33
33
|
std::shared_ptr<State> keepAlive;
|
|
@@ -59,7 +59,7 @@ void AsyncTaskHandle::State::settle(Action action) {
|
|
|
59
59
|
}
|
|
60
60
|
|
|
61
61
|
void AsyncTaskHandle::State::attachPromise(
|
|
62
|
-
const std::shared_ptr<
|
|
62
|
+
const std::shared_ptr<rnwgpu::Promise> &newPromise) {
|
|
63
63
|
std::optional<Action> actionToSchedule;
|
|
64
64
|
{
|
|
65
65
|
std::lock_guard<std::mutex> lock(mutex);
|
|
@@ -114,7 +114,7 @@ AsyncTaskHandle::State::createResolveFunction() {
|
|
|
114
114
|
};
|
|
115
115
|
self->settle(
|
|
116
116
|
[factory = std::move(resolvedFactory)](
|
|
117
|
-
jsi::Runtime &runtime,
|
|
117
|
+
jsi::Runtime &runtime, rnwgpu::Promise &promise) mutable {
|
|
118
118
|
auto value = factory(runtime);
|
|
119
119
|
promise.resolve(std::move(value));
|
|
120
120
|
});
|
|
@@ -127,14 +127,14 @@ AsyncTaskHandle::RejectFunction AsyncTaskHandle::State::createRejectFunction() {
|
|
|
127
127
|
return [weakSelf](std::string reason) {
|
|
128
128
|
if (auto self = weakSelf.lock()) {
|
|
129
129
|
self->settle([reason = std::move(reason)](jsi::Runtime & /*runtime*/,
|
|
130
|
-
|
|
130
|
+
rnwgpu::Promise &promise) {
|
|
131
131
|
promise.reject(reason);
|
|
132
132
|
});
|
|
133
133
|
}
|
|
134
134
|
};
|
|
135
135
|
}
|
|
136
136
|
|
|
137
|
-
std::shared_ptr<
|
|
137
|
+
std::shared_ptr<rnwgpu::Promise> AsyncTaskHandle::State::currentPromise() {
|
|
138
138
|
std::lock_guard<std::mutex> lock(mutex);
|
|
139
139
|
return promise;
|
|
140
140
|
}
|
|
@@ -172,7 +172,7 @@ AsyncTaskHandle::RejectFunction AsyncTaskHandle::createRejectFunction() const {
|
|
|
172
172
|
}
|
|
173
173
|
|
|
174
174
|
void AsyncTaskHandle::attachPromise(
|
|
175
|
-
const std::shared_ptr<
|
|
175
|
+
const std::shared_ptr<rnwgpu::Promise> &promise) const {
|
|
176
176
|
if (_state) {
|
|
177
177
|
_state->attachPromise(promise);
|
|
178
178
|
}
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
|
|
11
11
|
#include "AsyncDispatcher.h"
|
|
12
12
|
|
|
13
|
-
namespace
|
|
13
|
+
namespace rnwgpu {
|
|
14
14
|
class Promise;
|
|
15
15
|
}
|
|
16
16
|
|
|
@@ -43,7 +43,7 @@ public:
|
|
|
43
43
|
ResolveFunction createResolveFunction() const;
|
|
44
44
|
RejectFunction createRejectFunction() const;
|
|
45
45
|
|
|
46
|
-
void attachPromise(const std::shared_ptr<
|
|
46
|
+
void attachPromise(const std::shared_ptr<rnwgpu::Promise> &promise) const;
|
|
47
47
|
|
|
48
48
|
static AsyncTaskHandle create(const std::shared_ptr<AsyncRunner> &runner,
|
|
49
49
|
bool keepPumping);
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.createModuleProxy = exports.OptionalDependencyNotInstalledError = void 0;
|
|
7
|
+
// https://github.com/mrousavy/react-native-vision-camera/blob/main/package/src/dependencies/ModuleProxy.ts
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Create a lazily-imported module proxy.
|
|
11
|
+
* This is useful for lazily requiring optional dependencies.
|
|
12
|
+
*/
|
|
13
|
+
const createModuleProxy = getModule => {
|
|
14
|
+
const holder = {
|
|
15
|
+
module: undefined
|
|
16
|
+
};
|
|
17
|
+
const proxy = new Proxy(holder, {
|
|
18
|
+
get: (target, property) => {
|
|
19
|
+
if (target.module == null) {
|
|
20
|
+
// lazy initialize module via require()
|
|
21
|
+
// caller needs to make sure the require() call is wrapped in a try/catch
|
|
22
|
+
target.module = getModule();
|
|
23
|
+
}
|
|
24
|
+
return target.module[property];
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
return proxy;
|
|
28
|
+
};
|
|
29
|
+
exports.createModuleProxy = createModuleProxy;
|
|
30
|
+
class OptionalDependencyNotInstalledError extends Error {
|
|
31
|
+
constructor(name) {
|
|
32
|
+
super(`${name} is not installed!`);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
exports.OptionalDependencyNotInstalledError = OptionalDependencyNotInstalledError;
|
|
36
|
+
//# sourceMappingURL=ModuleProxy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["createModuleProxy","getModule","holder","module","undefined","proxy","Proxy","get","target","property","exports","OptionalDependencyNotInstalledError","Error","constructor","name"],"sourceRoot":"../../../src","sources":["external/ModuleProxy.ts"],"mappings":";;;;;;AAAA;;AAGA;AACA;AACA;AACA;AACO,MAAMA,iBAAiB,GAC5BC,SAA2B,IACf;EACZ,MAAMC,MAAuC,GAAG;IAAEC,MAAM,EAAEC;EAAU,CAAC;EAErE,MAAMC,KAAK,GAAG,IAAIC,KAAK,CAACJ,MAAM,EAAE;IAC9BK,GAAG,EAAEA,CAACC,MAAM,EAAEC,QAAQ,KAAK;MACzB,IAAID,MAAM,CAACL,MAAM,IAAI,IAAI,EAAE;QACzB;QACA;QACAK,MAAM,CAACL,MAAM,GAAGF,SAAS,CAAC,CAAY;MACxC;MACA,OAAOO,MAAM,CAACL,MAAM,CAACM,QAAQ,CAA+B;IAC9D;EACF,CAAC,CAAC;EACF,OAAOJ,KAAK;AACd,CAAC;AAACK,OAAA,CAAAV,iBAAA,GAAAA,iBAAA;AAEK,MAAMW,mCAAmC,SAASC,KAAK,CAAC;EAC7DC,WAAWA,CAACC,IAAY,EAAE;IACxB,KAAK,CAAC,GAAGA,IAAI,oBAAoB,CAAC;EACpC;AACF;AAACJ,OAAA,CAAAC,mCAAA,GAAAA,mCAAA","ignoreList":[]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _reanimated = require("./reanimated");
|
|
7
|
+
Object.keys(_reanimated).forEach(function (key) {
|
|
8
|
+
if (key === "default" || key === "__esModule") return;
|
|
9
|
+
if (key in exports && exports[key] === _reanimated[key]) return;
|
|
10
|
+
Object.defineProperty(exports, key, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () {
|
|
13
|
+
return _reanimated[key];
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_reanimated","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get"],"sourceRoot":"../../../src","sources":["external/index.ts"],"mappings":";;;;;AAAA,IAAAA,WAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,WAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,WAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,WAAA,CAAAK,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _ModuleProxy = require("../ModuleProxy");
|
|
8
|
+
const Reanimated = (0, _ModuleProxy.createModuleProxy)(() => {
|
|
9
|
+
try {
|
|
10
|
+
return require("react-native-reanimated");
|
|
11
|
+
} catch (e) {
|
|
12
|
+
throw new _ModuleProxy.OptionalDependencyNotInstalledError("react-native-reanimated");
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
// eslint-disable-next-line import/no-default-export
|
|
17
|
+
var _default = exports.default = Reanimated;
|
|
18
|
+
//# sourceMappingURL=ReanimatedProxy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_ModuleProxy","require","Reanimated","createModuleProxy","e","OptionalDependencyNotInstalledError","_default","exports","default"],"sourceRoot":"../../../../src","sources":["external/reanimated/ReanimatedProxy.ts"],"mappings":";;;;;;AAEA,IAAAA,YAAA,GAAAC,OAAA;AAOA,MAAMC,UAAU,GAAG,IAAAC,8BAAiB,EAAc,MAAM;EACtD,IAAI;IACF,OAAOF,OAAO,CAAC,yBAAyB,CAAC;EAC3C,CAAC,CAAC,OAAOG,CAAC,EAAE;IACV,MAAM,IAAIC,gDAAmC,CAAC,yBAAyB,CAAC;EAC1E;AACF,CAAC,CAAC;;AAEF;AAAA,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GACeN,UAAU","ignoreList":[]}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "Reanimated", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _ReanimatedProxy.default;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "registerWebGPUForReanimated", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () {
|
|
15
|
+
return _registerWebGPUForReanimated.registerWebGPUForReanimated;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
var _registerWebGPUForReanimated = require("./registerWebGPUForReanimated");
|
|
19
|
+
var _ReanimatedProxy = _interopRequireDefault(require("./ReanimatedProxy"));
|
|
20
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
21
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_registerWebGPUForReanimated","require","_ReanimatedProxy","_interopRequireDefault","e","__esModule","default"],"sourceRoot":"../../../../src","sources":["external/reanimated/index.ts"],"mappings":";;;;;;;;;;;;;;;;;AAAA,IAAAA,4BAAA,GAAAC,OAAA;AACA,IAAAC,gBAAA,GAAAC,sBAAA,CAAAF,OAAA;AAA0D,SAAAE,uBAAAC,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA","ignoreList":[]}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.registerWebGPUForReanimated = void 0;
|
|
7
|
+
// Declare global WebGPU worklet helper functions (installed by native module)
|
|
8
|
+
|
|
9
|
+
let isRegistered = false;
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Register WebGPU objects for Worklets serialization.
|
|
13
|
+
* This allows GPUDevice, GPUCanvasContext, etc. to be passed to worklets.
|
|
14
|
+
*
|
|
15
|
+
* This is called automatically when the module loads if react-native-worklets is installed.
|
|
16
|
+
*/
|
|
17
|
+
const registerWebGPUForReanimated = () => {
|
|
18
|
+
if (isRegistered) {
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
isRegistered = true;
|
|
22
|
+
try {
|
|
23
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
24
|
+
const {
|
|
25
|
+
registerCustomSerializable
|
|
26
|
+
} = require("react-native-worklets");
|
|
27
|
+
registerCustomSerializable({
|
|
28
|
+
name: "WebGPU",
|
|
29
|
+
determine: value => {
|
|
30
|
+
"worklet";
|
|
31
|
+
|
|
32
|
+
return __webgpuIsWebGPUObject(value);
|
|
33
|
+
},
|
|
34
|
+
pack: value => {
|
|
35
|
+
"worklet";
|
|
36
|
+
|
|
37
|
+
return __webgpuBox(value);
|
|
38
|
+
},
|
|
39
|
+
unpack: boxed => {
|
|
40
|
+
"worklet";
|
|
41
|
+
|
|
42
|
+
return boxed.unbox();
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
} catch {
|
|
46
|
+
// react-native-worklets not installed, skip registration
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
exports.registerWebGPUForReanimated = registerWebGPUForReanimated;
|
|
50
|
+
//# sourceMappingURL=registerWebGPUForReanimated.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["isRegistered","registerWebGPUForReanimated","registerCustomSerializable","require","name","determine","value","__webgpuIsWebGPUObject","pack","__webgpuBox","unpack","boxed","unbox","exports"],"sourceRoot":"../../../../src","sources":["external/reanimated/registerWebGPUForReanimated.ts"],"mappings":";;;;;;AAAA;;AAMA,IAAIA,YAAY,GAAG,KAAK;;AAExB;AACA;AACA;AACA;AACA;AACA;AACO,MAAMC,2BAA2B,GAAGA,CAAA,KAAM;EAC/C,IAAID,YAAY,EAAE;IAChB;EACF;EACAA,YAAY,GAAG,IAAI;EAEnB,IAAI;IACF;IACA,MAAM;MAAEE;IAA2B,CAAC,GAAGC,OAAO,CAAC,uBAAuB,CAAC;IAEvED,0BAA0B,CAAC;MACzBE,IAAI,EAAE,QAAQ;MACdC,SAAS,EAAGC,KAAa,IAAsB;QAC7C,SAAS;;QACT,OAAOC,sBAAsB,CAACD,KAAK,CAAC;MACtC,CAAC;MACDE,IAAI,EAAGF,KAAa,IAAK;QACvB,SAAS;;QACT,OAAOG,WAAW,CAACH,KAAK,CAAC;MAC3B,CAAC;MACDI,MAAM,EAAGC,KAA8B,IAAK;QAC1C,SAAS;;QACT,OAAOA,KAAK,CAACC,KAAK,CAAC,CAAC;MACtB;IACF,CAAC,CAAC;EACJ,CAAC,CAAC,MAAM;IACN;EAAA;AAEJ,CAAC;AAACC,OAAA,CAAAZ,2BAAA,GAAAA,2BAAA","ignoreList":[]}
|
|
@@ -12,6 +12,7 @@ Object.defineProperty(exports, "WebGPUModule", {
|
|
|
12
12
|
return _NativeWebGPUModule.default;
|
|
13
13
|
}
|
|
14
14
|
});
|
|
15
|
+
var _external = require("../external");
|
|
15
16
|
var _NativeWebGPUModule = _interopRequireDefault(require("../NativeWebGPUModule"));
|
|
16
17
|
var _Canvas = require("../Canvas");
|
|
17
18
|
Object.keys(_Canvas).forEach(function (key) {
|
|
@@ -62,149 +63,8 @@ Object.keys(_hooks).forEach(function (key) {
|
|
|
62
63
|
});
|
|
63
64
|
});
|
|
64
65
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
65
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
66
|
-
|
|
67
|
-
const GPU = {};
|
|
68
|
-
GPU[Symbol.hasInstance] = function (instance) {
|
|
69
|
-
return "__brand" in instance && instance.__brand === "GPU";
|
|
70
|
-
};
|
|
71
|
-
const GPUAdapter = {};
|
|
72
|
-
GPUAdapter[Symbol.hasInstance] = function (instance) {
|
|
73
|
-
return "__brand" in instance && instance.__brand === "GPUAdapter";
|
|
74
|
-
};
|
|
75
|
-
const GPUAdapterInfo = {};
|
|
76
|
-
GPUAdapterInfo[Symbol.hasInstance] = function (instance) {
|
|
77
|
-
return "__brand" in instance && instance.__brand === "GPUAdapterInfo";
|
|
78
|
-
};
|
|
79
|
-
const GPUBindGroup = {};
|
|
80
|
-
GPUBindGroup[Symbol.hasInstance] = function (instance) {
|
|
81
|
-
return "__brand" in instance && instance.__brand === "GPUBindGroup";
|
|
82
|
-
};
|
|
83
|
-
const GPUBindGroupLayout = {};
|
|
84
|
-
GPUBindGroupLayout[Symbol.hasInstance] = function (instance) {
|
|
85
|
-
return "__brand" in instance && instance.__brand === "GPUBindGroupLayout";
|
|
86
|
-
};
|
|
87
|
-
const GPUBuffer = {};
|
|
88
|
-
GPUBuffer[Symbol.hasInstance] = function (instance) {
|
|
89
|
-
return "__brand" in instance && instance.__brand === "GPUBuffer";
|
|
90
|
-
};
|
|
91
|
-
const GPUCanvasContext = {};
|
|
92
|
-
GPUCanvasContext[Symbol.hasInstance] = function (instance) {
|
|
93
|
-
return "__brand" in instance && instance.__brand === "GPUCanvasContext";
|
|
94
|
-
};
|
|
95
|
-
const GPUCommandBuffer = {};
|
|
96
|
-
GPUCommandBuffer[Symbol.hasInstance] = function (instance) {
|
|
97
|
-
return "__brand" in instance && instance.__brand === "GPUCommandBuffer";
|
|
98
|
-
};
|
|
99
|
-
const GPUCommandEncoder = {};
|
|
100
|
-
GPUCommandEncoder[Symbol.hasInstance] = function (instance) {
|
|
101
|
-
return "__brand" in instance && instance.__brand === "GPUCommandEncoder";
|
|
102
|
-
};
|
|
103
|
-
const GPUCompilationInfo = {};
|
|
104
|
-
GPUCompilationInfo[Symbol.hasInstance] = function (instance) {
|
|
105
|
-
return "__brand" in instance && instance.__brand === "GPUCompilationInfo";
|
|
106
|
-
};
|
|
107
|
-
const GPUCompilationMessage = {};
|
|
108
|
-
GPUCompilationMessage[Symbol.hasInstance] = function (instance) {
|
|
109
|
-
return "__brand" in instance && instance.__brand === "GPUCompilationMessage";
|
|
110
|
-
};
|
|
111
|
-
const GPUComputePassEncoder = {};
|
|
112
|
-
GPUComputePassEncoder[Symbol.hasInstance] = function (instance) {
|
|
113
|
-
return "__brand" in instance && instance.__brand === "GPUComputePassEncoder";
|
|
114
|
-
};
|
|
115
|
-
const GPUComputePipeline = {};
|
|
116
|
-
GPUComputePipeline[Symbol.hasInstance] = function (instance) {
|
|
117
|
-
return "__brand" in instance && instance.__brand === "GPUComputePipeline";
|
|
118
|
-
};
|
|
119
|
-
const GPUDevice = {};
|
|
120
|
-
GPUDevice[Symbol.hasInstance] = function (instance) {
|
|
121
|
-
return "__brand" in instance && instance.__brand === "GPUDevice";
|
|
122
|
-
};
|
|
123
|
-
const GPUDeviceLostInfo = {};
|
|
124
|
-
GPUDeviceLostInfo[Symbol.hasInstance] = function (instance) {
|
|
125
|
-
return "__brand" in instance && instance.__brand === "GPUDeviceLostInfo";
|
|
126
|
-
};
|
|
127
|
-
const GPUError = {};
|
|
128
|
-
GPUError[Symbol.hasInstance] = function (instance) {
|
|
129
|
-
return "__brand" in instance && instance.__brand === "GPUError";
|
|
130
|
-
};
|
|
131
|
-
const GPUExternalTexture = {};
|
|
132
|
-
GPUExternalTexture[Symbol.hasInstance] = function (instance) {
|
|
133
|
-
return "__brand" in instance && instance.__brand === "GPUExternalTexture";
|
|
134
|
-
};
|
|
135
|
-
const GPUPipelineLayout = {};
|
|
136
|
-
GPUPipelineLayout[Symbol.hasInstance] = function (instance) {
|
|
137
|
-
return "__brand" in instance && instance.__brand === "GPUPipelineLayout";
|
|
138
|
-
};
|
|
139
|
-
const GPUQuerySet = {};
|
|
140
|
-
GPUQuerySet[Symbol.hasInstance] = function (instance) {
|
|
141
|
-
return "__brand" in instance && instance.__brand === "GPUQuerySet";
|
|
142
|
-
};
|
|
143
|
-
const GPUQueue = {};
|
|
144
|
-
GPUQueue[Symbol.hasInstance] = function (instance) {
|
|
145
|
-
return "__brand" in instance && instance.__brand === "GPUQueue";
|
|
146
|
-
};
|
|
147
|
-
const GPURenderBundle = {};
|
|
148
|
-
GPURenderBundle[Symbol.hasInstance] = function (instance) {
|
|
149
|
-
return "__brand" in instance && instance.__brand === "GPURenderBundle";
|
|
150
|
-
};
|
|
151
|
-
const GPURenderBundleEncoder = {};
|
|
152
|
-
GPURenderBundleEncoder[Symbol.hasInstance] = function (instance) {
|
|
153
|
-
return "__brand" in instance && instance.__brand === "GPURenderBundleEncoder";
|
|
154
|
-
};
|
|
155
|
-
const GPURenderPassEncoder = {};
|
|
156
|
-
GPURenderPassEncoder[Symbol.hasInstance] = function (instance) {
|
|
157
|
-
return "__brand" in instance && instance.__brand === "GPURenderPassEncoder";
|
|
158
|
-
};
|
|
159
|
-
const GPURenderPipeline = {};
|
|
160
|
-
GPURenderPipeline[Symbol.hasInstance] = function (instance) {
|
|
161
|
-
return "__brand" in instance && instance.__brand === "GPURenderPipeline";
|
|
162
|
-
};
|
|
163
|
-
const GPUSampler = {};
|
|
164
|
-
GPUSampler[Symbol.hasInstance] = function (instance) {
|
|
165
|
-
return "__brand" in instance && instance.__brand === "GPUSampler";
|
|
166
|
-
};
|
|
167
|
-
const GPUShaderModule = {};
|
|
168
|
-
GPUShaderModule[Symbol.hasInstance] = function (instance) {
|
|
169
|
-
return "__brand" in instance && instance.__brand === "GPUShaderModule";
|
|
170
|
-
};
|
|
171
|
-
const GPUTexture = {};
|
|
172
|
-
GPUTexture[Symbol.hasInstance] = function (instance) {
|
|
173
|
-
return "__brand" in instance && instance.__brand === "GPUTexture";
|
|
174
|
-
};
|
|
175
|
-
const GPUTextureView = {};
|
|
176
|
-
GPUTextureView[Symbol.hasInstance] = function (instance) {
|
|
177
|
-
return "__brand" in instance && instance.__brand === "GPUTextureView";
|
|
178
|
-
};
|
|
179
|
-
global.GPU = GPU;
|
|
180
|
-
global.GPUAdapter = GPUAdapter;
|
|
181
|
-
global.GPUAdapterInfo = GPUAdapterInfo;
|
|
182
|
-
global.GPUBindGroup = GPUBindGroup;
|
|
183
|
-
global.GPUBindGroupLayout = GPUBindGroupLayout;
|
|
184
|
-
global.GPUBuffer = GPUBuffer;
|
|
185
|
-
global.GPUCanvasContext = GPUCanvasContext;
|
|
186
|
-
global.GPUCommandBuffer = GPUCommandBuffer;
|
|
187
|
-
global.GPUCommandEncoder = GPUCommandEncoder;
|
|
188
|
-
global.GPUCompilationInfo = GPUCompilationInfo;
|
|
189
|
-
global.GPUCompilationMessage = GPUCompilationMessage;
|
|
190
|
-
global.GPUComputePassEncoder = GPUComputePassEncoder;
|
|
191
|
-
global.GPUComputePipeline = GPUComputePipeline;
|
|
192
|
-
global.GPUDevice = GPUDevice;
|
|
193
|
-
global.GPUDeviceLostInfo = GPUDeviceLostInfo;
|
|
194
|
-
global.GPUError = GPUError;
|
|
195
|
-
global.GPUExternalTexture = GPUExternalTexture;
|
|
196
|
-
global.GPUPipelineLayout = GPUPipelineLayout;
|
|
197
|
-
global.GPUQuerySet = GPUQuerySet;
|
|
198
|
-
global.GPUQueue = GPUQueue;
|
|
199
|
-
global.GPURenderBundle = GPURenderBundle;
|
|
200
|
-
global.GPURenderBundleEncoder = GPURenderBundleEncoder;
|
|
201
|
-
global.GPURenderPassEncoder = GPURenderPassEncoder;
|
|
202
|
-
global.GPURenderPipeline = GPURenderPipeline;
|
|
203
|
-
global.GPUSampler = GPUSampler;
|
|
204
|
-
global.GPUShaderModule = GPUShaderModule;
|
|
205
|
-
global.GPUTexture = GPUTexture;
|
|
206
|
-
global.GPUTextureView = GPUTextureView;
|
|
207
66
|
_NativeWebGPUModule.default.install();
|
|
67
|
+
(0, _external.registerWebGPUForReanimated)();
|
|
208
68
|
if (!navigator) {
|
|
209
69
|
// @ts-expect-error Navigation object is more complex than this, setting it to an empty object to add gpu property
|
|
210
70
|
navigator = {
|