react-native-wgpu 0.5.2 → 0.5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/android/cpp/AndroidPlatformContext.h +108 -0
- package/apple/ApplePlatformContext.h +5 -0
- package/apple/ApplePlatformContext.mm +69 -0
- package/cpp/jsi/JSIConverter.h +12 -4
- package/cpp/rnwgpu/PlatformContext.h +7 -0
- package/cpp/rnwgpu/RNWebGPUManager.cpp +1 -1
- package/cpp/rnwgpu/api/GPU.h +1 -0
- package/cpp/rnwgpu/api/RNWebGPU.h +71 -37
- package/lib/commonjs/main/index.js +1 -1
- package/lib/commonjs/main/index.js.map +1 -1
- package/lib/module/main/index.js +1 -1
- package/lib/module/main/index.js.map +1 -1
- package/package.json +1 -1
- package/src/main/index.tsx +1 -3
|
@@ -3,8 +3,10 @@
|
|
|
3
3
|
#include <android/bitmap.h>
|
|
4
4
|
#include <jni.h>
|
|
5
5
|
|
|
6
|
+
#include <functional>
|
|
6
7
|
#include <memory>
|
|
7
8
|
#include <string>
|
|
9
|
+
#include <thread>
|
|
8
10
|
#include <vector>
|
|
9
11
|
|
|
10
12
|
#include "webgpu/webgpu_cpp.h"
|
|
@@ -128,6 +130,112 @@ public:
|
|
|
128
130
|
result.data = imageData;
|
|
129
131
|
return result;
|
|
130
132
|
}
|
|
133
|
+
|
|
134
|
+
void createImageBitmapAsync(
|
|
135
|
+
std::string blobId, double offset, double size,
|
|
136
|
+
std::function<void(ImageData)> onSuccess,
|
|
137
|
+
std::function<void(std::string)> onError) override {
|
|
138
|
+
// Capture blobModule for the background thread
|
|
139
|
+
jobject blobModule = _blobModule;
|
|
140
|
+
|
|
141
|
+
// Dispatch to a background thread
|
|
142
|
+
std::thread([blobModule, blobId = std::move(blobId), offset, size,
|
|
143
|
+
onSuccess = std::move(onSuccess),
|
|
144
|
+
onError = std::move(onError)]() {
|
|
145
|
+
jni::Environment::ensureCurrentThreadIsAttached();
|
|
146
|
+
|
|
147
|
+
JNIEnv *env = facebook::jni::Environment::current();
|
|
148
|
+
if (!env) {
|
|
149
|
+
onError("Couldn't get JNI environment");
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
if (!blobModule) {
|
|
154
|
+
onError("BlobModule instance is null");
|
|
155
|
+
return;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
// Get the resolve method ID
|
|
159
|
+
jclass blobModuleClass = env->GetObjectClass(blobModule);
|
|
160
|
+
if (!blobModuleClass) {
|
|
161
|
+
onError("Couldn't find BlobModule class");
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
jmethodID resolveMethod = env->GetMethodID(blobModuleClass, "resolve",
|
|
166
|
+
"(Ljava/lang/String;II)[B");
|
|
167
|
+
if (!resolveMethod) {
|
|
168
|
+
onError("Couldn't find resolve method in BlobModule");
|
|
169
|
+
return;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
// Resolve the blob data
|
|
173
|
+
jstring jBlobId = env->NewStringUTF(blobId.c_str());
|
|
174
|
+
jbyteArray blobData = (jbyteArray)env->CallObjectMethod(
|
|
175
|
+
blobModule, resolveMethod, jBlobId, static_cast<jint>(offset),
|
|
176
|
+
static_cast<jint>(size));
|
|
177
|
+
env->DeleteLocalRef(jBlobId);
|
|
178
|
+
|
|
179
|
+
if (!blobData) {
|
|
180
|
+
onError("Couldn't retrieve blob data");
|
|
181
|
+
return;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
// Create a Bitmap from the blob data
|
|
185
|
+
jclass bitmapFactoryClass =
|
|
186
|
+
env->FindClass("android/graphics/BitmapFactory");
|
|
187
|
+
jmethodID decodeByteArrayMethod =
|
|
188
|
+
env->GetStaticMethodID(bitmapFactoryClass, "decodeByteArray",
|
|
189
|
+
"([BII)Landroid/graphics/Bitmap;");
|
|
190
|
+
jint blobLength = env->GetArrayLength(blobData);
|
|
191
|
+
jobject bitmap = env->CallStaticObjectMethod(
|
|
192
|
+
bitmapFactoryClass, decodeByteArrayMethod, blobData, 0, blobLength);
|
|
193
|
+
|
|
194
|
+
if (!bitmap) {
|
|
195
|
+
env->DeleteLocalRef(blobData);
|
|
196
|
+
onError("Couldn't decode image");
|
|
197
|
+
return;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
// Get bitmap info
|
|
201
|
+
AndroidBitmapInfo bitmapInfo;
|
|
202
|
+
if (AndroidBitmap_getInfo(env, bitmap, &bitmapInfo) !=
|
|
203
|
+
ANDROID_BITMAP_RESULT_SUCCESS) {
|
|
204
|
+
env->DeleteLocalRef(blobData);
|
|
205
|
+
env->DeleteLocalRef(bitmap);
|
|
206
|
+
onError("Couldn't get bitmap info");
|
|
207
|
+
return;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
// Lock the bitmap pixels
|
|
211
|
+
void *bitmapPixels;
|
|
212
|
+
if (AndroidBitmap_lockPixels(env, bitmap, &bitmapPixels) !=
|
|
213
|
+
ANDROID_BITMAP_RESULT_SUCCESS) {
|
|
214
|
+
env->DeleteLocalRef(blobData);
|
|
215
|
+
env->DeleteLocalRef(bitmap);
|
|
216
|
+
onError("Couldn't lock bitmap pixels");
|
|
217
|
+
return;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
// Copy the bitmap data
|
|
221
|
+
std::vector<uint8_t> imageData(bitmapInfo.height * bitmapInfo.stride);
|
|
222
|
+
memcpy(imageData.data(), bitmapPixels, imageData.size());
|
|
223
|
+
|
|
224
|
+
// Unlock the bitmap pixels
|
|
225
|
+
AndroidBitmap_unlockPixels(env, bitmap);
|
|
226
|
+
|
|
227
|
+
// Clean up JNI references
|
|
228
|
+
env->DeleteLocalRef(blobData);
|
|
229
|
+
env->DeleteLocalRef(bitmap);
|
|
230
|
+
|
|
231
|
+
ImageData result;
|
|
232
|
+
result.width = static_cast<int>(bitmapInfo.width);
|
|
233
|
+
result.height = static_cast<int>(bitmapInfo.height);
|
|
234
|
+
result.data = std::move(imageData);
|
|
235
|
+
|
|
236
|
+
onSuccess(std::move(result));
|
|
237
|
+
}).detach();
|
|
238
|
+
}
|
|
131
239
|
};
|
|
132
240
|
|
|
133
241
|
} // namespace rnwgpu
|
|
@@ -15,6 +15,11 @@ public:
|
|
|
15
15
|
|
|
16
16
|
ImageData createImageBitmap(std::string blobId, double offset,
|
|
17
17
|
double size) override;
|
|
18
|
+
|
|
19
|
+
void createImageBitmapAsync(
|
|
20
|
+
std::string blobId, double offset, double size,
|
|
21
|
+
std::function<void(ImageData)> onSuccess,
|
|
22
|
+
std::function<void(std::string)> onError) override;
|
|
18
23
|
};
|
|
19
24
|
|
|
20
25
|
} // namespace rnwgpu
|
|
@@ -95,4 +95,73 @@ ImageData ApplePlatformContext::createImageBitmap(std::string blobId,
|
|
|
95
95
|
return result;
|
|
96
96
|
}
|
|
97
97
|
|
|
98
|
+
void ApplePlatformContext::createImageBitmapAsync(
|
|
99
|
+
std::string blobId, double offset, double size,
|
|
100
|
+
std::function<void(ImageData)> onSuccess,
|
|
101
|
+
std::function<void(std::string)> onError) {
|
|
102
|
+
// Capture blob data on the current thread (requires RCTBridge access)
|
|
103
|
+
RCTBlobManager *blobManager =
|
|
104
|
+
[[RCTBridge currentBridge] moduleForClass:RCTBlobManager.class];
|
|
105
|
+
NSData *blobData =
|
|
106
|
+
[blobManager resolve:[NSString stringWithUTF8String:blobId.c_str()]
|
|
107
|
+
offset:(long)offset
|
|
108
|
+
size:(long)size];
|
|
109
|
+
|
|
110
|
+
if (!blobData) {
|
|
111
|
+
onError("Couldn't retrieve blob data");
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
// Retain the data for the background block
|
|
116
|
+
NSData *retainedData = [blobData copy];
|
|
117
|
+
|
|
118
|
+
// Dispatch heavy image decoding work to a background queue
|
|
119
|
+
dispatch_async(
|
|
120
|
+
dispatch_get_global_queue(QOS_CLASS_USER_INITIATED, 0), ^{
|
|
121
|
+
@autoreleasepool {
|
|
122
|
+
#if !TARGET_OS_OSX
|
|
123
|
+
UIImage *image = [UIImage imageWithData:retainedData];
|
|
124
|
+
#else
|
|
125
|
+
NSImage *image = [[NSImage alloc] initWithData:retainedData];
|
|
126
|
+
#endif
|
|
127
|
+
if (!image) {
|
|
128
|
+
onError("Couldn't decode image");
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
#if !TARGET_OS_OSX
|
|
133
|
+
CGImageRef cgImage = image.CGImage;
|
|
134
|
+
#else
|
|
135
|
+
CGImageRef cgImage = [image CGImageForProposedRect:NULL
|
|
136
|
+
context:NULL
|
|
137
|
+
hints:NULL];
|
|
138
|
+
#endif
|
|
139
|
+
size_t width = CGImageGetWidth(cgImage);
|
|
140
|
+
size_t height = CGImageGetHeight(cgImage);
|
|
141
|
+
size_t bitsPerComponent = 8;
|
|
142
|
+
size_t bytesPerRow = width * 4;
|
|
143
|
+
std::vector<uint8_t> imageData(height * bytesPerRow);
|
|
144
|
+
|
|
145
|
+
CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
|
|
146
|
+
CGContextRef context = CGBitmapContextCreate(
|
|
147
|
+
imageData.data(), width, height, bitsPerComponent, bytesPerRow,
|
|
148
|
+
colorSpace,
|
|
149
|
+
kCGImageAlphaPremultipliedLast | kCGBitmapByteOrder32Big);
|
|
150
|
+
|
|
151
|
+
CGContextDrawImage(context, CGRectMake(0, 0, width, height), cgImage);
|
|
152
|
+
|
|
153
|
+
CGContextRelease(context);
|
|
154
|
+
CGColorSpaceRelease(colorSpace);
|
|
155
|
+
|
|
156
|
+
ImageData result;
|
|
157
|
+
result.width = static_cast<int>(width);
|
|
158
|
+
result.height = static_cast<int>(height);
|
|
159
|
+
result.data = std::move(imageData);
|
|
160
|
+
result.format = wgpu::TextureFormat::RGBA8Unorm;
|
|
161
|
+
|
|
162
|
+
onSuccess(std::move(result));
|
|
163
|
+
}
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
|
|
98
167
|
} // namespace rnwgpu
|
package/cpp/jsi/JSIConverter.h
CHANGED
|
@@ -9,9 +9,10 @@
|
|
|
9
9
|
#include <variant>
|
|
10
10
|
#include <map>
|
|
11
11
|
#include <unordered_set>
|
|
12
|
-
|
|
13
12
|
#include <jsi/jsi.h>
|
|
14
13
|
|
|
14
|
+
#include "WGPULogger.h"
|
|
15
|
+
|
|
15
16
|
#include "EnumMapper.h"
|
|
16
17
|
#include "Promise.h"
|
|
17
18
|
|
|
@@ -308,10 +309,17 @@ template <typename T> struct JSIConverter<T, std::enable_if_t<is_shared_ptr_to_n
|
|
|
308
309
|
#endif
|
|
309
310
|
jsi::Object object = arg.getObject(runtime);
|
|
310
311
|
#if DEBUG
|
|
311
|
-
if (!object.hasNativeState<TPointee>(runtime)) {
|
|
312
|
-
|
|
312
|
+
if (!object.hasNativeState<TPointee>(runtime)) [[unlikely]] {
|
|
313
|
+
// Log instead of throwing: hasNativeState<T>() uses dynamic_cast (RTTI)
|
|
314
|
+
// which can return false across shared-library / JSI-runtime boundaries
|
|
315
|
+
// on iOS (duplicate typeinfo symbols in separate .dylib modules).
|
|
316
|
+
// getNativeState<T>() below uses static_pointer_cast and works correctly
|
|
317
|
+
// even when dynamic_cast fails, so this is not a fatal error.
|
|
313
318
|
std::string stringRepresentation = arg.toString(runtime).utf8(runtime);
|
|
314
|
-
|
|
319
|
+
Logger::logToConsole("NativeState<T> RTTI mismatch for \"%s\" (expected %s) "
|
|
320
|
+
"-- this is likely a false positive from dynamic_cast across JSI "
|
|
321
|
+
"runtime boundaries; continuing with static_pointer_cast.",
|
|
322
|
+
stringRepresentation.c_str(), getFriendlyTypename().c_str());
|
|
315
323
|
}
|
|
316
324
|
#endif
|
|
317
325
|
return object.getNativeState<TPointee>(runtime);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
#pragma once
|
|
2
2
|
|
|
3
|
+
#include <functional>
|
|
3
4
|
#include <memory>
|
|
4
5
|
#include <string>
|
|
5
6
|
#include <vector>
|
|
@@ -24,6 +25,12 @@ public:
|
|
|
24
25
|
int width, int height) = 0;
|
|
25
26
|
virtual ImageData createImageBitmap(std::string blobId, double offset,
|
|
26
27
|
double size) = 0;
|
|
28
|
+
|
|
29
|
+
// Async version that performs image decoding on a background thread
|
|
30
|
+
virtual void createImageBitmapAsync(
|
|
31
|
+
std::string blobId, double offset, double size,
|
|
32
|
+
std::function<void(ImageData)> onSuccess,
|
|
33
|
+
std::function<void(std::string)> onError) = 0;
|
|
27
34
|
};
|
|
28
35
|
|
|
29
36
|
} // namespace rnwgpu
|
|
@@ -60,7 +60,7 @@ RNWebGPUManager::RNWebGPUManager(
|
|
|
60
60
|
BaseRuntimeAwareCache::setMainJsRuntime(_jsRuntime);
|
|
61
61
|
|
|
62
62
|
auto gpu = std::make_shared<GPU>(*_jsRuntime);
|
|
63
|
-
auto rnWebGPU = std::make_shared<RNWebGPU>(gpu, _platformContext);
|
|
63
|
+
auto rnWebGPU = std::make_shared<RNWebGPU>(gpu, _platformContext, _jsCallInvoker);
|
|
64
64
|
_gpu = gpu->get();
|
|
65
65
|
_jsRuntime->global().setProperty(*_jsRuntime, "RNWebGPU",
|
|
66
66
|
RNWebGPU::create(*_jsRuntime, rnWebGPU));
|
package/cpp/rnwgpu/api/GPU.h
CHANGED
|
@@ -11,6 +11,11 @@
|
|
|
11
11
|
#include "ImageBitmap.h"
|
|
12
12
|
#include "PlatformContext.h"
|
|
13
13
|
|
|
14
|
+
#include <ReactCommon/CallInvoker.h>
|
|
15
|
+
|
|
16
|
+
#include "JSIConverter.h"
|
|
17
|
+
#include "Promise.h"
|
|
18
|
+
|
|
14
19
|
namespace rnwgpu {
|
|
15
20
|
|
|
16
21
|
namespace jsi = facebook::jsi;
|
|
@@ -23,14 +28,41 @@ struct Blob {
|
|
|
23
28
|
std::string name;
|
|
24
29
|
};
|
|
25
30
|
|
|
31
|
+
// JSIConverter specialization must be declared before use
|
|
32
|
+
template <> struct JSIConverter<std::shared_ptr<Blob>> {
|
|
33
|
+
static std::shared_ptr<Blob>
|
|
34
|
+
fromJSI(jsi::Runtime &runtime, const jsi::Value &arg, bool outOfBounds) {
|
|
35
|
+
if (!outOfBounds && arg.isObject()) {
|
|
36
|
+
auto result = std::make_unique<Blob>();
|
|
37
|
+
auto val = arg.asObject(runtime);
|
|
38
|
+
if (val.hasProperty(runtime, "_data")) {
|
|
39
|
+
auto value = val.getPropertyAsObject(runtime, "_data");
|
|
40
|
+
result->blobId = JSIConverter<std::string>::fromJSI(
|
|
41
|
+
runtime, value.getProperty(runtime, "blobId"), false);
|
|
42
|
+
result->size = JSIConverter<double>::fromJSI(
|
|
43
|
+
runtime, value.getProperty(runtime, "size"), false);
|
|
44
|
+
result->offset = JSIConverter<double>::fromJSI(
|
|
45
|
+
runtime, value.getProperty(runtime, "offset"), false);
|
|
46
|
+
}
|
|
47
|
+
return result;
|
|
48
|
+
} else {
|
|
49
|
+
throw std::runtime_error("Invalid Blob::fromJSI()");
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
static jsi::Value toJSI(jsi::Runtime &runtime, std::shared_ptr<Blob> arg) {
|
|
53
|
+
throw std::runtime_error("Invalid Blob::toJSI()");
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
|
|
26
57
|
class RNWebGPU : public NativeObject<RNWebGPU> {
|
|
27
58
|
public:
|
|
28
59
|
static constexpr const char *CLASS_NAME = "RNWebGPU";
|
|
29
60
|
|
|
30
61
|
explicit RNWebGPU(std::shared_ptr<GPU> gpu,
|
|
31
|
-
std::shared_ptr<PlatformContext> platformContext
|
|
32
|
-
|
|
33
|
-
|
|
62
|
+
std::shared_ptr<PlatformContext> platformContext,
|
|
63
|
+
std::shared_ptr<facebook::react::CallInvoker> callInvoker)
|
|
64
|
+
: NativeObject(CLASS_NAME), _gpu(gpu), _platformContext(platformContext),
|
|
65
|
+
_callInvoker(callInvoker) {}
|
|
34
66
|
|
|
35
67
|
std::shared_ptr<GPU> getGPU() { return _gpu; }
|
|
36
68
|
|
|
@@ -43,11 +75,41 @@ public:
|
|
|
43
75
|
return ctx;
|
|
44
76
|
}
|
|
45
77
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
78
|
+
jsi::Value createImageBitmap(jsi::Runtime &runtime,
|
|
79
|
+
const jsi::Value & /*thisVal*/,
|
|
80
|
+
const jsi::Value *args, size_t count) {
|
|
81
|
+
if (count < 1) {
|
|
82
|
+
throw jsi::JSError(runtime, "createImageBitmap requires a Blob argument");
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
auto blob =
|
|
86
|
+
JSIConverter<std::shared_ptr<Blob>>::fromJSI(runtime, args[0], false);
|
|
87
|
+
auto platformContext = _platformContext;
|
|
88
|
+
auto callInvoker = _callInvoker;
|
|
89
|
+
std::string blobId = blob->blobId;
|
|
90
|
+
double offset = blob->offset;
|
|
91
|
+
double size = blob->size;
|
|
92
|
+
|
|
93
|
+
return Promise::createPromise(
|
|
94
|
+
runtime,
|
|
95
|
+
[platformContext, callInvoker, blobId, offset,
|
|
96
|
+
size](jsi::Runtime & /*runtime*/, std::shared_ptr<Promise> promise) {
|
|
97
|
+
platformContext->createImageBitmapAsync(
|
|
98
|
+
blobId, offset, size,
|
|
99
|
+
[callInvoker, promise](ImageData imageData) {
|
|
100
|
+
auto imageBitmap = std::make_shared<ImageBitmap>(imageData);
|
|
101
|
+
callInvoker->invokeAsync(
|
|
102
|
+
[promise, imageBitmap]() {
|
|
103
|
+
promise->resolve(
|
|
104
|
+
JSIConverter<std::shared_ptr<ImageBitmap>>::toJSI(
|
|
105
|
+
promise->runtime, imageBitmap));
|
|
106
|
+
});
|
|
107
|
+
},
|
|
108
|
+
[callInvoker, promise](std::string error) {
|
|
109
|
+
callInvoker->invokeAsync(
|
|
110
|
+
[promise, error]() { promise->reject(error); });
|
|
111
|
+
});
|
|
112
|
+
});
|
|
51
113
|
}
|
|
52
114
|
|
|
53
115
|
std::shared_ptr<Canvas> getNativeSurface(int contextId) {
|
|
@@ -75,35 +137,7 @@ public:
|
|
|
75
137
|
private:
|
|
76
138
|
std::shared_ptr<GPU> _gpu;
|
|
77
139
|
std::shared_ptr<PlatformContext> _platformContext;
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
template <> struct JSIConverter<std::shared_ptr<Blob>> {
|
|
81
|
-
static std::shared_ptr<Blob>
|
|
82
|
-
fromJSI(jsi::Runtime &runtime, const jsi::Value &arg, bool outOfBounds) {
|
|
83
|
-
if (!outOfBounds && arg.isObject()) {
|
|
84
|
-
auto result = std::make_unique<Blob>();
|
|
85
|
-
auto val = arg.asObject(runtime);
|
|
86
|
-
if (val.hasProperty(runtime, "_data")) {
|
|
87
|
-
auto value = val.getPropertyAsObject(runtime, "_data");
|
|
88
|
-
result->blobId = JSIConverter<std::string>::fromJSI(
|
|
89
|
-
runtime, value.getProperty(runtime, "blobId"), false);
|
|
90
|
-
// result->type = JSIConverter<std::string>::fromJSI(
|
|
91
|
-
// runtime, value.getProperty(runtime, "type"), false);
|
|
92
|
-
// result->name = JSIConverter<std::string>::fromJSI(
|
|
93
|
-
// runtime, value.getProperty(runtime, "name"), false);
|
|
94
|
-
result->size = JSIConverter<double>::fromJSI(
|
|
95
|
-
runtime, value.getProperty(runtime, "size"), false);
|
|
96
|
-
result->offset = JSIConverter<double>::fromJSI(
|
|
97
|
-
runtime, value.getProperty(runtime, "offset"), false);
|
|
98
|
-
}
|
|
99
|
-
return result;
|
|
100
|
-
} else {
|
|
101
|
-
throw std::runtime_error("Invalid Blob::fromJSI()");
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
static jsi::Value toJSI(jsi::Runtime &runtime, std::shared_ptr<Blob> arg) {
|
|
105
|
-
throw std::runtime_error("Invalid Blob::toJSI()");
|
|
106
|
-
}
|
|
140
|
+
std::shared_ptr<facebook::react::CallInvoker> _callInvoker;
|
|
107
141
|
};
|
|
108
142
|
|
|
109
143
|
} // namespace rnwgpu
|
|
@@ -83,5 +83,5 @@ if (!navigator) {
|
|
|
83
83
|
}
|
|
84
84
|
}
|
|
85
85
|
}
|
|
86
|
-
global.createImageBitmap = global.createImageBitmap ??
|
|
86
|
+
global.createImageBitmap = global.createImageBitmap ?? RNWebGPU.createImageBitmap.bind(RNWebGPU);
|
|
87
87
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_external","require","_NativeWebGPUModule","_interopRequireDefault","_Canvas","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_Offscreen","_WebGPUViewNativeComponent","_hooks","e","__esModule","default","WebGPUModule","install","registerWebGPUForReanimated","navigator","gpu","RNWebGPU","userAgent","global","createImageBitmap","
|
|
1
|
+
{"version":3,"names":["_external","require","_NativeWebGPUModule","_interopRequireDefault","_Canvas","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_Offscreen","_WebGPUViewNativeComponent","_hooks","e","__esModule","default","WebGPUModule","install","registerWebGPUForReanimated","navigator","gpu","RNWebGPU","userAgent","global","createImageBitmap","bind"],"sourceRoot":"../../../src","sources":["main/index.tsx"],"mappings":"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","ignoreList":[]}
|
package/lib/module/main/index.js
CHANGED
|
@@ -25,5 +25,5 @@ if (!navigator) {
|
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
|
-
global.createImageBitmap = global.createImageBitmap ??
|
|
28
|
+
global.createImageBitmap = global.createImageBitmap ?? RNWebGPU.createImageBitmap.bind(RNWebGPU);
|
|
29
29
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["registerWebGPUForReanimated","WebGPUModule","default","install","navigator","gpu","RNWebGPU","userAgent","global","createImageBitmap","
|
|
1
|
+
{"version":3,"names":["registerWebGPUForReanimated","WebGPUModule","default","install","navigator","gpu","RNWebGPU","userAgent","global","createImageBitmap","bind"],"sourceRoot":"../../../src","sources":["main/index.tsx"],"mappings":"AAAA,SAASA,2BAA2B,QAAQ,aAAa;AACzD,OAAOC,YAAY,MAAM,uBAAuB;AAEhD,cAAc,WAAW;AACzB,cAAc,cAAc;AAC5B,cAAc,8BAA8B;AAC5C,cAAc,UAAU;AAExB,SAASC,OAAO,IAAID,YAAY,QAAQ,uBAAuB;AAE/DA,YAAY,CAACE,OAAO,CAAC,CAAC;AAEtBH,2BAA2B,CAAC,CAAC;AAE7B,IAAI,CAACI,SAAS,EAAE;EACd;EACAA,SAAS,GAAG;IACVC,GAAG,EAAEC,QAAQ,CAACD,GAAG;IACjBE,SAAS,EAAE;EACb,CAAC;AACH,CAAC,MAAM;EACLH,SAAS,CAACC,GAAG,GAAGC,QAAQ,CAACD,GAAG;EAC5B,IAAI,OAAOD,SAAS,CAACG,SAAS,KAAK,QAAQ,EAAE;IAC3C,IAAI;MACF;MACA;MACAH,SAAS,CAACG,SAAS,GAAG,cAAc;IACtC,CAAC,CAAC,MAAM;MACN;IAAA;EAEJ;AACF;AAEAC,MAAM,CAACC,iBAAiB,GACtBD,MAAM,CAACC,iBAAiB,IAAIH,QAAQ,CAACG,iBAAiB,CAACC,IAAI,CAACJ,QAAQ,CAAC","ignoreList":[]}
|
package/package.json
CHANGED
package/src/main/index.tsx
CHANGED
|
@@ -32,6 +32,4 @@ if (!navigator) {
|
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
global.createImageBitmap =
|
|
35
|
-
global.createImageBitmap ??
|
|
36
|
-
((...params: Parameters<typeof createImageBitmap>) =>
|
|
37
|
-
new Promise((resolve) => resolve(RNWebGPU.createImageBitmap(...params))));
|
|
35
|
+
global.createImageBitmap ?? RNWebGPU.createImageBitmap.bind(RNWebGPU);
|