From 8a9067a9dc20149d7f85a3f4da568e7a3a80c87d Mon Sep 17 00:00:00 2001 From: William Candillon Date: Mon, 12 Jan 2026 11:57:01 +0100 Subject: [PATCH 01/23] :wrench: --- apps/example/ios/Podfile.lock | 4 +- apps/example/src/Triangle/HelloTriangle.tsx | 7 + externals/dawn | 2 +- packages/webgpu/cpp/jsi/RNFJSIConverter.h | 25 +- packages/webgpu/cpp/jsi/RNFNativeObject.h | 385 ++++++++++++++++++ .../webgpu/cpp/rnwgpu/api/GPUAdapterInfo.h | 29 +- 6 files changed, 432 insertions(+), 20 deletions(-) create mode 100644 packages/webgpu/cpp/jsi/RNFNativeObject.h diff --git a/apps/example/ios/Podfile.lock b/apps/example/ios/Podfile.lock index a8ae26a8c..72c5024eb 100644 --- a/apps/example/ios/Podfile.lock +++ b/apps/example/ios/Podfile.lock @@ -1865,7 +1865,7 @@ PODS: - ReactCommon/turbomodule/core - SocketRocket - Yoga - - react-native-wgpu (0.4.1): + - react-native-wgpu (0.4.2): - boost - DoubleConversion - fast_float @@ -2903,7 +2903,7 @@ SPEC CHECKSUMS: React-microtasksnativemodule: 75b6604b667d297292345302cc5bfb6b6aeccc1b react-native-safe-area-context: c6e2edd1c1da07bdce287fa9d9e60c5f7b514616 react-native-skia: 5bf2b2107cd7f2d806fd364f5e16b1c7554ed3cd - react-native-wgpu: 9b91079473265b91dc2c60c692845b70a4f0182b + react-native-wgpu: 8b91bdc8de384f0fce7dd622698e46645895b085 React-NativeModulesApple: 879fbdc5dcff7136abceb7880fe8a2022a1bd7c3 React-oscompat: 93b5535ea7f7dff46aaee4f78309a70979bdde9d React-perflogger: 5536d2df3d18fe0920263466f7b46a56351c0510 diff --git a/apps/example/src/Triangle/HelloTriangle.tsx b/apps/example/src/Triangle/HelloTriangle.tsx index 8d10ca58a..6d1485f96 100644 --- a/apps/example/src/Triangle/HelloTriangle.tsx +++ b/apps/example/src/Triangle/HelloTriangle.tsx @@ -13,6 +13,13 @@ export function HelloTriangle() { if (!adapter) { throw new Error("No adapter"); } + console.log(adapter.info.constructor); + console.log(adapter.info.__proto__); + console.log(adapter.info.vendor); + console.log(adapter.info.architecture); + console.log(adapter.info.description); + console.log(adapter.info.device); + const device = await adapter.requestDevice(); const presentationFormat = navigator.gpu.getPreferredCanvasFormat(); diff --git a/externals/dawn b/externals/dawn index c84d448f3..ffb6058ec 160000 --- a/externals/dawn +++ b/externals/dawn @@ -1 +1 @@ -Subproject commit c84d448f3c3ebe2cfa1b1a4dfe51d7de47c96ede +Subproject commit ffb6058ec90b7012360b9c287ea6f3f329993d38 diff --git a/packages/webgpu/cpp/jsi/RNFJSIConverter.h b/packages/webgpu/cpp/jsi/RNFJSIConverter.h index 46e5fc049..e6af7376d 100644 --- a/packages/webgpu/cpp/jsi/RNFJSIConverter.h +++ b/packages/webgpu/cpp/jsi/RNFJSIConverter.h @@ -416,16 +416,33 @@ template struct JSIConverter(runtime); } +private: + // SFINAE helper to detect if T has a IsNativeObject marker type + template + static std::true_type hasNativeObjectMarker(int); + template + static std::false_type hasNativeObjectMarker(...); + + // Type trait for detection + static constexpr bool is_native_object = decltype(hasNativeObjectMarker(0))::value; + +public: static jsi::Value toJSI(jsi::Runtime& runtime, const T& arg) { #if DEBUG if (arg == nullptr) { [[unlikely]]; - throw jsi::JSError(runtime, "Cannot convert nullptr to HostObject<" + getFriendlyTypename() + ">!"); + throw jsi::JSError(runtime, "Cannot convert nullptr to NativeState<" + getFriendlyTypename() + ">!"); } #endif - jsi::Object object(runtime); - object.setNativeState(runtime, arg); - return object; + // Check if the type is a NativeObject (has IsNativeObject marker) + // Use TPointee::create() if it's a NativeObject, otherwise fall back to plain setNativeState + if constexpr (is_native_object) { + return TPointee::create(runtime, arg); + } else { + jsi::Object object(runtime); + object.setNativeState(runtime, arg); + return object; + } } }; diff --git a/packages/webgpu/cpp/jsi/RNFNativeObject.h b/packages/webgpu/cpp/jsi/RNFNativeObject.h new file mode 100644 index 000000000..b14c2d0ea --- /dev/null +++ b/packages/webgpu/cpp/jsi/RNFNativeObject.h @@ -0,0 +1,385 @@ +// +// NativeObject base class for JSI NativeState pattern +// + +#pragma once + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "RNFJSIHelper.h" +#include "RNFRuntimeState.h" +#include "WGPULogger.h" + +// Forward declare to avoid circular dependency +namespace margelo { +template struct JSIConverter; +} // namespace margelo + +// Include the converter - must come after forward declaration +#include "RNFJSIConverter.h" + +namespace margelo { + +namespace jsi = facebook::jsi; + +/** + * Per-runtime cache for prototype objects. + * Uses a simple static map keyed by runtime pointer. + * Each NativeObject type has its own static cache. + */ +template class PrototypeCache { +public: + static std::shared_ptr get(jsi::Runtime &runtime) { + std::lock_guard lock(mutex_); + auto it = cache_.find(&runtime); + if (it != cache_.end()) { + return it->second; + } + return nullptr; + } + + static void set(jsi::Runtime &runtime, + std::shared_ptr prototype) { + std::lock_guard lock(mutex_); + cache_[&runtime] = std::move(prototype); + } + +private: + static inline std::mutex mutex_; + static inline std::unordered_map> cache_; +}; + +/** + * Base class for native objects using the NativeState pattern. + * + * Instead of using HostObject (which intercepts all property access), + * this pattern: + * 1. Stores native data via jsi::Object::setNativeState() + * 2. Installs methods on a shared prototype object (once per runtime) + * 3. Creates plain JS objects that use the prototype chain + * + * Usage: + * ```cpp + * class MyClass : public NativeObject { + * public: + * static constexpr const char* CLASS_NAME = "MyClass"; + * + * MyClass(...) : NativeObject(CLASS_NAME), ... {} + * + * std::string getValue() { return _value; } + * + * static void definePrototype(jsi::Runtime& rt, jsi::Object& proto) { + * installGetter(rt, proto, "value", &MyClass::getValue); + * } + * + * private: + * std::string _value; + * }; + * ``` + */ +template +class NativeObject : public jsi::NativeState, + public std::enable_shared_from_this { +public: + // Marker type for SFINAE detection in JSIConverter + using IsNativeObject = std::true_type; + + /** + * Ensure the prototype is installed for this runtime. + * Called automatically by create(), but can be called manually. + */ + static void installPrototype(jsi::Runtime &runtime) { + auto existing = PrototypeCache::get(runtime); + if (existing) { + return; // Already installed + } + + // Create prototype object + jsi::Object prototype(runtime); + + // Let derived class define its methods/properties + Derived::definePrototype(runtime, prototype); + + // Cache the prototype + auto sharedProto = std::make_shared(std::move(prototype)); + PrototypeCache::set(runtime, sharedProto); + } + + /** + * Create a JS object with native state attached. + */ + static jsi::Value create(jsi::Runtime &runtime, + std::shared_ptr instance) { + installPrototype(runtime); + + // Create a new object + jsi::Object obj(runtime); + + // Attach native state + obj.setNativeState(runtime, instance); + + // Set prototype + auto proto = PrototypeCache::get(runtime); + if (proto) { + // Use Object.setPrototypeOf to set the prototype + auto objectCtor = + runtime.global().getPropertyAsObject(runtime, "Object"); + auto setPrototypeOf = + objectCtor.getPropertyAsFunction(runtime, "setPrototypeOf"); + setPrototypeOf.call(runtime, obj, *proto); + } + + // Set memory pressure hint for GC + auto pressure = instance->getMemoryPressure(); + if (pressure > 0) { + obj.setExternalMemoryPressure(runtime, pressure); + } + + // Store runtime reference in instance + instance->_creationRuntime = &runtime; + instance->_runtimeState = rnwgpu::RNFRuntimeState::get(runtime); + + return std::move(obj); + } + + /** + * Get the native state from a JS value. + * Throws if the value doesn't have the expected native state. + */ + static std::shared_ptr fromValue(jsi::Runtime &runtime, + const jsi::Value &value) { + if (!value.isObject()) { + throw jsi::JSError(runtime, std::string("Expected ") + + Derived::CLASS_NAME + + " but got non-object"); + } + jsi::Object obj = value.getObject(runtime); + if (!obj.hasNativeState(runtime)) { + throw jsi::JSError(runtime, std::string("Expected ") + + Derived::CLASS_NAME + + " but got different type"); + } + return obj.getNativeState(runtime); + } + + /** + * Memory pressure for GC hints. Override in derived classes. + */ + virtual size_t getMemoryPressure() { return 1024; } + +protected: + explicit NativeObject(const char *name) : _name(name) { +#if DEBUG && RNF_ENABLE_LOGS + Logger::logToConsole("NativeObject", "(MEMORY) Creating %s... ✅", _name); +#endif + } + + virtual ~NativeObject() { +#if DEBUG && RNF_ENABLE_LOGS + Logger::log("NativeObject", "(MEMORY) Deleting %s... ❌", _name); +#endif + } + + const char *_name; + jsi::Runtime *_creationRuntime = nullptr; + std::weak_ptr _runtimeState; + + jsi::Runtime *getCreationRuntime() const { + if (_runtimeState.expired()) { + return nullptr; + } + return _creationRuntime; + } + + bool isRuntimeAlive() const { return !_runtimeState.expired(); } + + // ============================================================ + // Helper methods for definePrototype() implementations + // ============================================================ + + /** + * Install a method on the prototype. + */ + template + static void installMethod(jsi::Runtime &runtime, jsi::Object &prototype, + const char *name, + ReturnType (Derived::*method)(Args...)) { + auto func = jsi::Function::createFromHostFunction( + runtime, jsi::PropNameID::forUtf8(runtime, name), sizeof...(Args), + [method](jsi::Runtime &rt, const jsi::Value &thisVal, + const jsi::Value *args, size_t count) -> jsi::Value { + auto native = Derived::fromValue(rt, thisVal); + return callMethod(native.get(), method, rt, args, + std::index_sequence_for{}, count); + }); + prototype.setProperty(runtime, name, func); + } + + /** + * Install a getter on the prototype. + */ + template + static void installGetter(jsi::Runtime &runtime, jsi::Object &prototype, + const char *name, ReturnType (Derived::*getter)()) { + // Create a getter function + auto getterFunc = jsi::Function::createFromHostFunction( + runtime, jsi::PropNameID::forUtf8(runtime, std::string("get_") + name), + 0, + [getter](jsi::Runtime &rt, const jsi::Value &thisVal, + const jsi::Value *args, size_t count) -> jsi::Value { + auto native = Derived::fromValue(rt, thisVal); + if constexpr (std::is_same_v) { + (native.get()->*getter)(); + return jsi::Value::undefined(); + } else { + ReturnType result = (native.get()->*getter)(); + return JSIConverter>::toJSI( + rt, std::move(result)); + } + }); + + // Use Object.defineProperty to create a proper getter + auto objectCtor = runtime.global().getPropertyAsObject(runtime, "Object"); + auto defineProperty = + objectCtor.getPropertyAsFunction(runtime, "defineProperty"); + + jsi::Object descriptor(runtime); + descriptor.setProperty(runtime, "get", getterFunc); + descriptor.setProperty(runtime, "enumerable", true); + descriptor.setProperty(runtime, "configurable", true); + + defineProperty.call(runtime, prototype, + jsi::String::createFromUtf8(runtime, name), descriptor); + } + + /** + * Install a setter on the prototype. + */ + template + static void installSetter(jsi::Runtime &runtime, jsi::Object &prototype, + const char *name, + void (Derived::*setter)(ValueType)) { + auto setterFunc = jsi::Function::createFromHostFunction( + runtime, jsi::PropNameID::forUtf8(runtime, std::string("set_") + name), + 1, + [setter](jsi::Runtime &rt, const jsi::Value &thisVal, + const jsi::Value *args, size_t count) -> jsi::Value { + auto native = Derived::fromValue(rt, thisVal); + auto value = + JSIConverter>::fromJSI(rt, args[0], false); + (native.get()->*setter)(std::move(value)); + return jsi::Value::undefined(); + }); + + // Use Object.defineProperty to create a proper setter + auto objectCtor = runtime.global().getPropertyAsObject(runtime, "Object"); + auto defineProperty = + objectCtor.getPropertyAsFunction(runtime, "defineProperty"); + + // Check if property already has a getter + auto getOwnPropertyDescriptor = + objectCtor.getPropertyAsFunction(runtime, "getOwnPropertyDescriptor"); + auto existingDesc = getOwnPropertyDescriptor.call( + runtime, prototype, jsi::String::createFromUtf8(runtime, name)); + + jsi::Object descriptor(runtime); + if (existingDesc.isObject()) { + auto existingDescObj = existingDesc.getObject(runtime); + if (existingDescObj.hasProperty(runtime, "get")) { + descriptor.setProperty( + runtime, "get", existingDescObj.getProperty(runtime, "get")); + } + } + descriptor.setProperty(runtime, "set", setterFunc); + descriptor.setProperty(runtime, "enumerable", true); + descriptor.setProperty(runtime, "configurable", true); + + defineProperty.call(runtime, prototype, + jsi::String::createFromUtf8(runtime, name), descriptor); + } + + /** + * Install both getter and setter for a property. + */ + template + static void installGetterSetter(jsi::Runtime &runtime, jsi::Object &prototype, + const char *name, + ReturnType (Derived::*getter)(), + void (Derived::*setter)(ValueType)) { + auto getterFunc = jsi::Function::createFromHostFunction( + runtime, jsi::PropNameID::forUtf8(runtime, std::string("get_") + name), + 0, + [getter](jsi::Runtime &rt, const jsi::Value &thisVal, + const jsi::Value *args, size_t count) -> jsi::Value { + auto native = Derived::fromValue(rt, thisVal); + ReturnType result = (native.get()->*getter)(); + return JSIConverter>::toJSI(rt, + std::move(result)); + }); + + auto setterFunc = jsi::Function::createFromHostFunction( + runtime, jsi::PropNameID::forUtf8(runtime, std::string("set_") + name), + 1, + [setter](jsi::Runtime &rt, const jsi::Value &thisVal, + const jsi::Value *args, size_t count) -> jsi::Value { + auto native = Derived::fromValue(rt, thisVal); + auto value = + JSIConverter>::fromJSI(rt, args[0], false); + (native.get()->*setter)(std::move(value)); + return jsi::Value::undefined(); + }); + + auto objectCtor = runtime.global().getPropertyAsObject(runtime, "Object"); + auto defineProperty = + objectCtor.getPropertyAsFunction(runtime, "defineProperty"); + + jsi::Object descriptor(runtime); + descriptor.setProperty(runtime, "get", getterFunc); + descriptor.setProperty(runtime, "set", setterFunc); + descriptor.setProperty(runtime, "enumerable", true); + descriptor.setProperty(runtime, "configurable", true); + + defineProperty.call(runtime, prototype, + jsi::String::createFromUtf8(runtime, name), descriptor); + } + +private: + // Helper to call a method with JSI argument conversion + template + static jsi::Value callMethod(Derived *obj, + ReturnType (Derived::*method)(Args...), + jsi::Runtime &runtime, const jsi::Value *args, + std::index_sequence, size_t count) { + if constexpr (std::is_same_v) { + (obj->*method)(JSIConverter>::fromJSI( + runtime, args[Is], Is >= count)...); + return jsi::Value::undefined(); + } else if constexpr (std::is_same_v) { + // Special case: if return type is jsi::Value, method has full control + // This requires the method signature to match HostFunction + return (obj->*method)(runtime, jsi::Value::undefined(), args, count); + } else { + ReturnType result = (obj->*method)(JSIConverter>::fromJSI( + runtime, args[Is], Is >= count)...); + return JSIConverter>::toJSI(runtime, + std::move(result)); + } + } +}; + +// Type trait to detect NativeObject-derived classes +template struct is_native_object : std::false_type {}; + +template +struct is_native_object> + : std::bool_constant, T>> {}; + +} // namespace margelo diff --git a/packages/webgpu/cpp/rnwgpu/api/GPUAdapterInfo.h b/packages/webgpu/cpp/rnwgpu/api/GPUAdapterInfo.h index 8ae0d35d3..c5df4507d 100644 --- a/packages/webgpu/cpp/rnwgpu/api/GPUAdapterInfo.h +++ b/packages/webgpu/cpp/rnwgpu/api/GPUAdapterInfo.h @@ -5,7 +5,7 @@ #include "Unions.h" -#include "RNFHybridObject.h" +#include "RNFNativeObject.h" #include "Convertors.h" @@ -14,11 +14,14 @@ namespace rnwgpu { namespace m = margelo; +namespace jsi = facebook::jsi; -class GPUAdapterInfo : public m::HybridObject { +class GPUAdapterInfo : public m::NativeObject { public: + static constexpr const char *CLASS_NAME = "GPUAdapterInfo"; + explicit GPUAdapterInfo(wgpu::AdapterInfo &info) - : HybridObject("GPUAdapterInfo"), _vendor(info.vendor), + : NativeObject(CLASS_NAME), _vendor(info.vendor), _architecture(info.architecture), _device(info.device), _description(info.description), _isFallbackAdapter(info.adapterType == wgpu::AdapterType::CPU) {} @@ -32,16 +35,16 @@ class GPUAdapterInfo : public m::HybridObject { std::string getDescription() { return _description; } bool getIsFallbackAdapter() { return _isFallbackAdapter; } - void loadHybridMethods() override { - registerHybridGetter("__brand", &GPUAdapterInfo::getBrand, this); - - registerHybridGetter("vendor", &GPUAdapterInfo::getVendor, this); - registerHybridGetter("architecture", &GPUAdapterInfo::getArchitecture, - this); - registerHybridGetter("device", &GPUAdapterInfo::getDevice, this); - registerHybridGetter("description", &GPUAdapterInfo::getDescription, this); - registerHybridGetter("isFallbackAdapter", - &GPUAdapterInfo::getIsFallbackAdapter, this); + static void definePrototype(jsi::Runtime &runtime, jsi::Object &prototype) { + installGetter(runtime, prototype, "__brand", &GPUAdapterInfo::getBrand); + installGetter(runtime, prototype, "vendor", &GPUAdapterInfo::getVendor); + installGetter(runtime, prototype, "architecture", + &GPUAdapterInfo::getArchitecture); + installGetter(runtime, prototype, "device", &GPUAdapterInfo::getDevice); + installGetter(runtime, prototype, "description", + &GPUAdapterInfo::getDescription); + installGetter(runtime, prototype, "isFallbackAdapter", + &GPUAdapterInfo::getIsFallbackAdapter); } private: From 97a6b75aae574c5c913c6d6461356b9f9b8a9104 Mon Sep 17 00:00:00 2001 From: William Candillon Date: Mon, 12 Jan 2026 12:03:59 +0100 Subject: [PATCH 02/23] :wrench: --- packages/webgpu/cpp/jsi/RNFNativeObject.h | 76 +++++++++---------- packages/webgpu/cpp/jsi/RNFRuntimeState.h | 24 ++++++ .../webgpu/cpp/rnwgpu/api/GPUAdapterInfo.h | 2 +- 3 files changed, 62 insertions(+), 40 deletions(-) diff --git a/packages/webgpu/cpp/jsi/RNFNativeObject.h b/packages/webgpu/cpp/jsi/RNFNativeObject.h index b14c2d0ea..a8307f356 100644 --- a/packages/webgpu/cpp/jsi/RNFNativeObject.h +++ b/packages/webgpu/cpp/jsi/RNFNativeObject.h @@ -8,13 +8,13 @@ #include #include #include +#include #include #include #include #include #include "RNFJSIHelper.h" -#include "RNFRuntimeState.h" #include "WGPULogger.h" // Forward declare to avoid circular dependency @@ -30,31 +30,36 @@ namespace margelo { namespace jsi = facebook::jsi; /** - * Per-runtime cache for prototype objects. - * Uses a simple static map keyed by runtime pointer. - * Each NativeObject type has its own static cache. + * Per-runtime cache entry for a prototype object. + * Uses std::optional so the prototype is stored directly + * without extra indirection. */ -template class PrototypeCache { +struct PrototypeCacheEntry { + std::optional prototype; +}; + +/** + * Simple runtime-aware cache that stores data per-runtime. + * When a runtime is destroyed, its cached data is automatically invalidated + * on next access (by checking if the runtime pointer is still valid). + */ +template class RuntimeAwareCache { public: - static std::shared_ptr get(jsi::Runtime &runtime) { + T &get(jsi::Runtime &rt) { std::lock_guard lock(mutex_); - auto it = cache_.find(&runtime); + // Use runtime address as key + auto it = cache_.find(&rt); if (it != cache_.end()) { return it->second; } - return nullptr; - } - - static void set(jsi::Runtime &runtime, - std::shared_ptr prototype) { - std::lock_guard lock(mutex_); - cache_[&runtime] = std::move(prototype); + // Create new entry for this runtime + auto result = cache_.emplace(&rt, T{}); + return result.first->second; } private: - static inline std::mutex mutex_; - static inline std::unordered_map> cache_; + std::mutex mutex_; + std::unordered_map cache_; }; /** @@ -92,13 +97,22 @@ class NativeObject : public jsi::NativeState, // Marker type for SFINAE detection in JSIConverter using IsNativeObject = std::true_type; + /** + * Get the prototype cache for this type. + * Each NativeObject type has its own static cache. + */ + static RuntimeAwareCache &getPrototypeCache() { + static RuntimeAwareCache cache; + return cache; + } + /** * Ensure the prototype is installed for this runtime. * Called automatically by create(), but can be called manually. */ static void installPrototype(jsi::Runtime &runtime) { - auto existing = PrototypeCache::get(runtime); - if (existing) { + auto &entry = getPrototypeCache().get(runtime); + if (entry.prototype.has_value()) { return; // Already installed } @@ -109,8 +123,7 @@ class NativeObject : public jsi::NativeState, Derived::definePrototype(runtime, prototype); // Cache the prototype - auto sharedProto = std::make_shared(std::move(prototype)); - PrototypeCache::set(runtime, sharedProto); + entry.prototype = std::move(prototype); } /** @@ -127,14 +140,14 @@ class NativeObject : public jsi::NativeState, obj.setNativeState(runtime, instance); // Set prototype - auto proto = PrototypeCache::get(runtime); - if (proto) { + auto &entry = getPrototypeCache().get(runtime); + if (entry.prototype.has_value()) { // Use Object.setPrototypeOf to set the prototype auto objectCtor = runtime.global().getPropertyAsObject(runtime, "Object"); auto setPrototypeOf = objectCtor.getPropertyAsFunction(runtime, "setPrototypeOf"); - setPrototypeOf.call(runtime, obj, *proto); + setPrototypeOf.call(runtime, obj, *entry.prototype); } // Set memory pressure hint for GC @@ -143,10 +156,6 @@ class NativeObject : public jsi::NativeState, obj.setExternalMemoryPressure(runtime, pressure); } - // Store runtime reference in instance - instance->_creationRuntime = &runtime; - instance->_runtimeState = rnwgpu::RNFRuntimeState::get(runtime); - return std::move(obj); } @@ -189,17 +198,6 @@ class NativeObject : public jsi::NativeState, } const char *_name; - jsi::Runtime *_creationRuntime = nullptr; - std::weak_ptr _runtimeState; - - jsi::Runtime *getCreationRuntime() const { - if (_runtimeState.expired()) { - return nullptr; - } - return _creationRuntime; - } - - bool isRuntimeAlive() const { return !_runtimeState.expired(); } // ============================================================ // Helper methods for definePrototype() implementations diff --git a/packages/webgpu/cpp/jsi/RNFRuntimeState.h b/packages/webgpu/cpp/jsi/RNFRuntimeState.h index fc037f71d..26cdb733a 100644 --- a/packages/webgpu/cpp/jsi/RNFRuntimeState.h +++ b/packages/webgpu/cpp/jsi/RNFRuntimeState.h @@ -78,12 +78,36 @@ class RNFRuntimeState { return cache; } + /** + * Store a prototype object for a given type key. + * Used by NativeObject to cache prototypes per runtime. + */ + void setPrototype(void* typeKey, std::shared_ptr prototype) { + std::lock_guard lock(mutex_); + prototypes_[typeKey] = std::move(prototype); + } + + /** + * Get a cached prototype for a given type key. + * Returns nullptr if not found. + */ + std::shared_ptr getPrototype(void* typeKey) { + std::lock_guard lock(mutex_); + auto it = prototypes_.find(typeKey); + if (it != prototypes_.end()) { + return it->second; + } + return nullptr; + } + private: RNFRuntimeState() = default; std::mutex mutex_; // Map from type_info to cache instance std::unordered_map> typeCaches_; + // Map from type key to prototype object (for NativeObject pattern) + std::unordered_map> prototypes_; }; /** diff --git a/packages/webgpu/cpp/rnwgpu/api/GPUAdapterInfo.h b/packages/webgpu/cpp/rnwgpu/api/GPUAdapterInfo.h index c5df4507d..2b654e2f8 100644 --- a/packages/webgpu/cpp/rnwgpu/api/GPUAdapterInfo.h +++ b/packages/webgpu/cpp/rnwgpu/api/GPUAdapterInfo.h @@ -27,7 +27,7 @@ class GPUAdapterInfo : public m::NativeObject { _isFallbackAdapter(info.adapterType == wgpu::AdapterType::CPU) {} public: - std::string getBrand() { return _name; } + std::string getBrand() { return CLASS_NAME; } std::string getVendor() { return _vendor; } std::string getArchitecture() { return _architecture; } From 3569bef7182bc0224e7b641757fc12a5ea2969cb Mon Sep 17 00:00:00 2001 From: William Candillon Date: Mon, 12 Jan 2026 14:19:35 +0100 Subject: [PATCH 03/23] :wrench: --- apps/example/src/Triangle/HelloTriangle.tsx | 8 +- packages/webgpu/cpp/jsi/RNFJSIConverter.h | 6 +- packages/webgpu/cpp/jsi/RNFNativeObject.h | 15 ++ .../webgpu/cpp/rnwgpu/RNWebGPUManager.cpp | 18 +- packages/webgpu/cpp/rnwgpu/api/Canvas.h | 25 +-- packages/webgpu/cpp/rnwgpu/api/GPU.cpp | 2 +- packages/webgpu/cpp/rnwgpu/api/GPU.h | 23 +-- packages/webgpu/cpp/rnwgpu/api/GPUAdapter.cpp | 14 +- packages/webgpu/cpp/rnwgpu/api/GPUAdapter.h | 24 +-- packages/webgpu/cpp/rnwgpu/api/GPUBindGroup.h | 20 ++- .../cpp/rnwgpu/api/GPUBindGroupLayout.h | 22 +-- packages/webgpu/cpp/rnwgpu/api/GPUBuffer.h | 34 ++-- .../webgpu/cpp/rnwgpu/api/GPUCanvasContext.h | 29 +-- .../webgpu/cpp/rnwgpu/api/GPUCommandBuffer.h | 21 ++- .../webgpu/cpp/rnwgpu/api/GPUCommandEncoder.h | 66 +++---- .../cpp/rnwgpu/api/GPUCompilationInfo.h | 33 ++-- .../cpp/rnwgpu/api/GPUCompilationMessage.h | 16 +- .../cpp/rnwgpu/api/GPUComputePassEncoder.h | 54 +++--- .../cpp/rnwgpu/api/GPUComputePipeline.h | 26 +-- packages/webgpu/cpp/rnwgpu/api/GPUDevice.h | 93 +++++----- .../webgpu/cpp/rnwgpu/api/GPUDeviceLostInfo.h | 21 ++- .../cpp/rnwgpu/api/GPUExternalTexture.h | 22 +-- .../webgpu/cpp/rnwgpu/api/GPUPipelineLayout.h | 21 ++- packages/webgpu/cpp/rnwgpu/api/GPUQuerySet.h | 25 +-- packages/webgpu/cpp/rnwgpu/api/GPUQueue.h | 34 ++-- .../webgpu/cpp/rnwgpu/api/GPURenderBundle.h | 20 ++- .../cpp/rnwgpu/api/GPURenderBundleEncoder.h | 68 ++++---- .../cpp/rnwgpu/api/GPURenderPassEncoder.h | 95 +++++----- .../webgpu/cpp/rnwgpu/api/GPURenderPipeline.h | 25 +-- packages/webgpu/cpp/rnwgpu/api/GPUSampler.h | 20 ++- .../webgpu/cpp/rnwgpu/api/GPUShaderModule.cpp | 2 +- .../webgpu/cpp/rnwgpu/api/GPUShaderModule.h | 24 +-- .../cpp/rnwgpu/api/GPUSupportedLimits.h | 165 ++++++++---------- packages/webgpu/cpp/rnwgpu/api/GPUTexture.h | 43 +++-- .../webgpu/cpp/rnwgpu/api/GPUTextureView.h | 20 ++- packages/webgpu/cpp/rnwgpu/api/ImageBitmap.h | 17 +- packages/webgpu/cpp/rnwgpu/api/RNWebGPU.h | 26 +-- .../api/descriptors/GPUBindGroupEntry.h | 9 +- .../rnwgpu/api/descriptors/GPUBufferUsage.h | 34 ++-- .../rnwgpu/api/descriptors/GPUColorWrite.h | 23 +-- .../cpp/rnwgpu/api/descriptors/GPUMapMode.h | 17 +- .../rnwgpu/api/descriptors/GPUShaderStage.h | 19 +- .../rnwgpu/api/descriptors/GPUTextureUsage.h | 29 +-- 43 files changed, 718 insertions(+), 610 deletions(-) diff --git a/apps/example/src/Triangle/HelloTriangle.tsx b/apps/example/src/Triangle/HelloTriangle.tsx index 6d1485f96..19824c526 100644 --- a/apps/example/src/Triangle/HelloTriangle.tsx +++ b/apps/example/src/Triangle/HelloTriangle.tsx @@ -13,12 +13,8 @@ export function HelloTriangle() { if (!adapter) { throw new Error("No adapter"); } - console.log(adapter.info.constructor); - console.log(adapter.info.__proto__); - console.log(adapter.info.vendor); - console.log(adapter.info.architecture); - console.log(adapter.info.description); - console.log(adapter.info.device); + console.log(adapter); + console.log(adapter instanceof GPUAdapter); const device = await adapter.requestDevice(); const presentationFormat = navigator.gpu.getPreferredCanvasFormat(); diff --git a/packages/webgpu/cpp/jsi/RNFJSIConverter.h b/packages/webgpu/cpp/jsi/RNFJSIConverter.h index e6af7376d..50c954729 100644 --- a/packages/webgpu/cpp/jsi/RNFJSIConverter.h +++ b/packages/webgpu/cpp/jsi/RNFJSIConverter.h @@ -305,7 +305,11 @@ template struct JSIConverter {} template struct is_shared_ptr_to_host_object : std::false_type {}; -template struct is_shared_ptr_to_host_object> : std::is_base_of {}; +// Only match HostObject types that are NOT NativeState types +template +struct is_shared_ptr_to_host_object> + : std::bool_constant && + !std::is_base_of_v> {}; template struct JSIConverter::value>> { using TPointee = typename T::element_type; diff --git a/packages/webgpu/cpp/jsi/RNFNativeObject.h b/packages/webgpu/cpp/jsi/RNFNativeObject.h index a8307f356..6a5592a53 100644 --- a/packages/webgpu/cpp/jsi/RNFNativeObject.h +++ b/packages/webgpu/cpp/jsi/RNFNativeObject.h @@ -133,6 +133,9 @@ class NativeObject : public jsi::NativeState, std::shared_ptr instance) { installPrototype(runtime); + // Store creation runtime for logging etc. + instance->setCreationRuntime(&runtime); + // Create a new object jsi::Object obj(runtime); @@ -184,6 +187,17 @@ class NativeObject : public jsi::NativeState, */ virtual size_t getMemoryPressure() { return 1024; } + /** + * Set the creation runtime. Called during create(). + */ + void setCreationRuntime(jsi::Runtime *runtime) { _creationRuntime = runtime; } + + /** + * Get the creation runtime. + * WARNING: This pointer may become invalid if the runtime is destroyed. + */ + jsi::Runtime *getCreationRuntime() const { return _creationRuntime; } + protected: explicit NativeObject(const char *name) : _name(name) { #if DEBUG && RNF_ENABLE_LOGS @@ -198,6 +212,7 @@ class NativeObject : public jsi::NativeState, } const char *_name; + jsi::Runtime *_creationRuntime = nullptr; // ============================================================ // Helper methods for definePrototype() implementations diff --git a/packages/webgpu/cpp/rnwgpu/RNWebGPUManager.cpp b/packages/webgpu/cpp/rnwgpu/RNWebGPUManager.cpp index a59e5b657..7eab32315 100644 --- a/packages/webgpu/cpp/rnwgpu/RNWebGPUManager.cpp +++ b/packages/webgpu/cpp/rnwgpu/RNWebGPUManager.cpp @@ -25,34 +25,32 @@ RNWebGPUManager::RNWebGPUManager( auto gpu = std::make_shared(*_jsRuntime); auto rnWebGPU = std::make_shared(gpu, _platformContext); _gpu = gpu->get(); - _jsRuntime->global().setProperty( - *_jsRuntime, "RNWebGPU", - jsi::Object::createFromHostObject(*_jsRuntime, rnWebGPU)); + _jsRuntime->global().setProperty(*_jsRuntime, "RNWebGPU", + RNWebGPU::create(*_jsRuntime, rnWebGPU)); auto bufferUsage = std::make_shared(); _jsRuntime->global().setProperty( *_jsRuntime, "GPUBufferUsage", - jsi::Object::createFromHostObject(*_jsRuntime, std::move(bufferUsage))); + GPUBufferUsage::create(*_jsRuntime, std::move(bufferUsage))); auto colorWrite = std::make_shared(); _jsRuntime->global().setProperty( *_jsRuntime, "GPUColorWrite", - jsi::Object::createFromHostObject(*_jsRuntime, std::move(colorWrite))); + GPUColorWrite::create(*_jsRuntime, std::move(colorWrite))); auto mapMode = std::make_shared(); - _jsRuntime->global().setProperty( - *_jsRuntime, "GPUMapMode", - jsi::Object::createFromHostObject(*_jsRuntime, std::move(mapMode))); + _jsRuntime->global().setProperty(*_jsRuntime, "GPUMapMode", + GPUMapMode::create(*_jsRuntime, mapMode)); auto shaderStage = std::make_shared(); _jsRuntime->global().setProperty( *_jsRuntime, "GPUShaderStage", - jsi::Object::createFromHostObject(*_jsRuntime, std::move(shaderStage))); + GPUShaderStage::create(*_jsRuntime, std::move(shaderStage))); auto textureUsage = std::make_shared(); _jsRuntime->global().setProperty( *_jsRuntime, "GPUTextureUsage", - jsi::Object::createFromHostObject(*_jsRuntime, std::move(textureUsage))); + GPUTextureUsage::create(*_jsRuntime, std::move(textureUsage))); } RNWebGPUManager::~RNWebGPUManager() { diff --git a/packages/webgpu/cpp/rnwgpu/api/Canvas.h b/packages/webgpu/cpp/rnwgpu/api/Canvas.h index 25a3a9c1a..ce664c427 100644 --- a/packages/webgpu/cpp/rnwgpu/api/Canvas.h +++ b/packages/webgpu/cpp/rnwgpu/api/Canvas.h @@ -7,16 +7,19 @@ #include "webgpu/webgpu_cpp.h" -#include "RNFHybridObject.h" +#include "RNFNativeObject.h" namespace rnwgpu { namespace m = margelo; +namespace jsi = facebook::jsi; -class Canvas : public m::HybridObject { +class Canvas : public m::NativeObject { public: + static constexpr const char *CLASS_NAME = "Canvas"; + explicit Canvas(void *surface, const int width, const int height) - : HybridObject("Canvas"), _surface(surface), _width(width), + : NativeObject(CLASS_NAME), _surface(surface), _width(width), _height(height), _clientWidth(width), _clientHeight(height) {} int getWidth() { return _width; } @@ -34,14 +37,14 @@ class Canvas : public m::HybridObject { void *getSurface() { return _surface; } - void loadHybridMethods() override { - registerHybridGetter("surface", &Canvas::getSurface, this); - registerHybridGetter("width", &Canvas::getWidth, this); - registerHybridGetter("height", &Canvas::getHeight, this); - registerHybridGetter("clientWidth", &Canvas::getClientWidth, this); - registerHybridGetter("clientHeight", &Canvas::getClientHeight, this); - registerHybridSetter("width", &Canvas::setWidth, this); - registerHybridSetter("height", &Canvas::setHeight, this); + static void definePrototype(jsi::Runtime &runtime, jsi::Object &prototype) { + installGetter(runtime, prototype, "surface", &Canvas::getSurface); + installGetterSetter(runtime, prototype, "width", &Canvas::getWidth, + &Canvas::setWidth); + installGetterSetter(runtime, prototype, "height", &Canvas::getHeight, + &Canvas::setHeight); + installGetter(runtime, prototype, "clientWidth", &Canvas::getClientWidth); + installGetter(runtime, prototype, "clientHeight", &Canvas::getClientHeight); } private: diff --git a/packages/webgpu/cpp/rnwgpu/api/GPU.cpp b/packages/webgpu/cpp/rnwgpu/api/GPU.cpp index 277d4d884..d904d0745 100644 --- a/packages/webgpu/cpp/rnwgpu/api/GPU.cpp +++ b/packages/webgpu/cpp/rnwgpu/api/GPU.cpp @@ -13,7 +13,7 @@ namespace rnwgpu { -GPU::GPU(jsi::Runtime &runtime) : HybridObject("GPU") { +GPU::GPU(jsi::Runtime &runtime) : NativeObject(CLASS_NAME) { static const auto kTimedWaitAny = wgpu::InstanceFeatureName::TimedWaitAny; wgpu::InstanceDescriptor instanceDesc{.requiredFeatureCount = 1, .requiredFeatures = &kTimedWaitAny}; diff --git a/packages/webgpu/cpp/rnwgpu/api/GPU.h b/packages/webgpu/cpp/rnwgpu/api/GPU.h index 08f50c750..91007d815 100644 --- a/packages/webgpu/cpp/rnwgpu/api/GPU.h +++ b/packages/webgpu/cpp/rnwgpu/api/GPU.h @@ -7,7 +7,7 @@ #include "Unions.h" -#include "RNFHybridObject.h" +#include "RNFNativeObject.h" #include "rnwgpu/async/AsyncRunner.h" #include "rnwgpu/async/AsyncTaskHandle.h" @@ -22,13 +22,16 @@ namespace rnwgpu { namespace m = margelo; +namespace jsi = facebook::jsi; -class GPU : public m::HybridObject { +class GPU : public m::NativeObject { public: + static constexpr const char *CLASS_NAME = "GPU"; + explicit GPU(jsi::Runtime &runtime); public: - std::string getBrand() { return _name; } + std::string getBrand() { return CLASS_NAME; } async::AsyncTaskHandle requestAdapter( std::optional> options); @@ -36,13 +39,13 @@ class GPU : public m::HybridObject { std::unordered_set getWgslLanguageFeatures(); - void loadHybridMethods() override { - registerHybridGetter("__brand", &GPU::getBrand, this); - registerHybridMethod("requestAdapter", &GPU::requestAdapter, this); - registerHybridMethod("getPreferredCanvasFormat", - &GPU::getPreferredCanvasFormat, this); - registerHybridGetter("wgslLanguageFeatures", &GPU::getWgslLanguageFeatures, - this); + static void definePrototype(jsi::Runtime &runtime, jsi::Object &prototype) { + installGetter(runtime, prototype, "__brand", &GPU::getBrand); + installMethod(runtime, prototype, "requestAdapter", &GPU::requestAdapter); + installMethod(runtime, prototype, "getPreferredCanvasFormat", + &GPU::getPreferredCanvasFormat); + installGetter(runtime, prototype, "wgslLanguageFeatures", + &GPU::getWgslLanguageFeatures); } inline const wgpu::Instance get() { return _instance; } diff --git a/packages/webgpu/cpp/rnwgpu/api/GPUAdapter.cpp b/packages/webgpu/cpp/rnwgpu/api/GPUAdapter.cpp index e4bb7ca9a..81bad6390 100644 --- a/packages/webgpu/cpp/rnwgpu/api/GPUAdapter.cpp +++ b/packages/webgpu/cpp/rnwgpu/api/GPUAdapter.cpp @@ -82,16 +82,16 @@ async::AsyncTaskHandle GPUAdapter::requestDevice( auto creationRuntime = getCreationRuntime(); return _async->postTask( [this, aDescriptor, descriptor, label = std::move(label), - deviceLostBinding, creationRuntime]( - const async::AsyncTaskHandle::ResolveFunction &resolve, - const async::AsyncTaskHandle::RejectFunction &reject) { + deviceLostBinding, + creationRuntime](const async::AsyncTaskHandle::ResolveFunction &resolve, + const async::AsyncTaskHandle::RejectFunction &reject) { (void)descriptor; _instance.RequestDevice( &aDescriptor, wgpu::CallbackMode::AllowProcessEvents, - [asyncRunner = _async, resolve, reject, label, - creationRuntime, deviceLostBinding]( - wgpu::RequestDeviceStatus status, wgpu::Device device, - wgpu::StringView message) mutable { + [asyncRunner = _async, resolve, reject, label, creationRuntime, + deviceLostBinding](wgpu::RequestDeviceStatus status, + wgpu::Device device, + wgpu::StringView message) mutable { if (message.length) { fprintf(stderr, "%s", message.data); } diff --git a/packages/webgpu/cpp/rnwgpu/api/GPUAdapter.h b/packages/webgpu/cpp/rnwgpu/api/GPUAdapter.h index ff2a3819f..276f1e75d 100644 --- a/packages/webgpu/cpp/rnwgpu/api/GPUAdapter.h +++ b/packages/webgpu/cpp/rnwgpu/api/GPUAdapter.h @@ -6,7 +6,7 @@ #include "Unions.h" -#include "RNFHybridObject.h" +#include "RNFNativeObject.h" #include "rnwgpu/async/AsyncRunner.h" #include "rnwgpu/async/AsyncTaskHandle.h" @@ -21,15 +21,18 @@ namespace rnwgpu { namespace m = margelo; +namespace jsi = facebook::jsi; -class GPUAdapter : public m::HybridObject { +class GPUAdapter : public m::NativeObject { public: + static constexpr const char *CLASS_NAME = "GPUAdapter"; + explicit GPUAdapter(wgpu::Adapter instance, std::shared_ptr async) - : HybridObject("GPUAdapter"), _instance(instance), _async(async) {} + : NativeObject(CLASS_NAME), _instance(instance), _async(async) {} public: - std::string getBrand() { return _name; } + std::string getBrand() { return CLASS_NAME; } async::AsyncTaskHandle requestDevice(std::optional> descriptor); @@ -38,12 +41,13 @@ class GPUAdapter : public m::HybridObject { std::shared_ptr getLimits(); std::shared_ptr getInfo(); - void loadHybridMethods() override { - registerHybridGetter("__brand", &GPUAdapter::getBrand, this); - registerHybridMethod("requestDevice", &GPUAdapter::requestDevice, this); - registerHybridGetter("features", &GPUAdapter::getFeatures, this); - registerHybridGetter("limits", &GPUAdapter::getLimits, this); - registerHybridGetter("info", &GPUAdapter::getInfo, this); + static void definePrototype(jsi::Runtime &runtime, jsi::Object &prototype) { + installGetter(runtime, prototype, "__brand", &GPUAdapter::getBrand); + installMethod(runtime, prototype, "requestDevice", + &GPUAdapter::requestDevice); + installGetter(runtime, prototype, "features", &GPUAdapter::getFeatures); + installGetter(runtime, prototype, "limits", &GPUAdapter::getLimits); + installGetter(runtime, prototype, "info", &GPUAdapter::getInfo); } inline const wgpu::Adapter get() { return _instance; } diff --git a/packages/webgpu/cpp/rnwgpu/api/GPUBindGroup.h b/packages/webgpu/cpp/rnwgpu/api/GPUBindGroup.h index f3a5cc538..60db08a2e 100644 --- a/packages/webgpu/cpp/rnwgpu/api/GPUBindGroup.h +++ b/packages/webgpu/cpp/rnwgpu/api/GPUBindGroup.h @@ -4,21 +4,24 @@ #include "Unions.h" -#include "RNFHybridObject.h" +#include "RNFNativeObject.h" #include "webgpu/webgpu_cpp.h" namespace rnwgpu { namespace m = margelo; +namespace jsi = facebook::jsi; -class GPUBindGroup : public m::HybridObject { +class GPUBindGroup : public m::NativeObject { public: + static constexpr const char *CLASS_NAME = "GPUBindGroup"; + explicit GPUBindGroup(wgpu::BindGroup instance, std::string label) - : HybridObject("GPUBindGroup"), _instance(instance), _label(label) {} + : NativeObject(CLASS_NAME), _instance(instance), _label(label) {} public: - std::string getBrand() { return _name; } + std::string getBrand() { return CLASS_NAME; } std::string getLabel() { return _label; } void setLabel(const std::string &label) { @@ -26,11 +29,10 @@ class GPUBindGroup : public m::HybridObject { _instance.SetLabel(_label.c_str()); } - void loadHybridMethods() override { - registerHybridGetter("__brand", &GPUBindGroup::getBrand, this); - - registerHybridGetter("label", &GPUBindGroup::getLabel, this); - registerHybridSetter("label", &GPUBindGroup::setLabel, this); + static void definePrototype(jsi::Runtime &runtime, jsi::Object &prototype) { + installGetter(runtime, prototype, "__brand", &GPUBindGroup::getBrand); + installGetterSetter(runtime, prototype, "label", &GPUBindGroup::getLabel, + &GPUBindGroup::setLabel); } inline const wgpu::BindGroup get() { return _instance; } diff --git a/packages/webgpu/cpp/rnwgpu/api/GPUBindGroupLayout.h b/packages/webgpu/cpp/rnwgpu/api/GPUBindGroupLayout.h index a50050557..0de28cc6b 100644 --- a/packages/webgpu/cpp/rnwgpu/api/GPUBindGroupLayout.h +++ b/packages/webgpu/cpp/rnwgpu/api/GPUBindGroupLayout.h @@ -4,22 +4,24 @@ #include "Unions.h" -#include "RNFHybridObject.h" +#include "RNFNativeObject.h" #include "webgpu/webgpu_cpp.h" namespace rnwgpu { namespace m = margelo; +namespace jsi = facebook::jsi; -class GPUBindGroupLayout : public m::HybridObject { +class GPUBindGroupLayout : public m::NativeObject { public: + static constexpr const char *CLASS_NAME = "GPUBindGroupLayout"; + explicit GPUBindGroupLayout(wgpu::BindGroupLayout instance, std::string label) - : HybridObject("GPUBindGroupLayout"), _instance(instance), _label(label) { - } + : NativeObject(CLASS_NAME), _instance(instance), _label(label) {} public: - std::string getBrand() { return _name; } + std::string getBrand() { return CLASS_NAME; } std::string getLabel() { return _label; } void setLabel(const std::string &label) { @@ -27,11 +29,11 @@ class GPUBindGroupLayout : public m::HybridObject { _instance.SetLabel(_label.c_str()); } - void loadHybridMethods() override { - registerHybridGetter("__brand", &GPUBindGroupLayout::getBrand, this); - - registerHybridGetter("label", &GPUBindGroupLayout::getLabel, this); - registerHybridSetter("label", &GPUBindGroupLayout::setLabel, this); + static void definePrototype(jsi::Runtime &runtime, jsi::Object &prototype) { + installGetter(runtime, prototype, "__brand", &GPUBindGroupLayout::getBrand); + installGetterSetter(runtime, prototype, "label", + &GPUBindGroupLayout::getLabel, + &GPUBindGroupLayout::setLabel); } inline const wgpu::BindGroupLayout get() { return _instance; } diff --git a/packages/webgpu/cpp/rnwgpu/api/GPUBuffer.h b/packages/webgpu/cpp/rnwgpu/api/GPUBuffer.h index 52ad77374..53c458e67 100644 --- a/packages/webgpu/cpp/rnwgpu/api/GPUBuffer.h +++ b/packages/webgpu/cpp/rnwgpu/api/GPUBuffer.h @@ -7,7 +7,7 @@ #include "Unions.h" -#include "RNFHybridObject.h" +#include "RNFNativeObject.h" #include "rnwgpu/async/AsyncRunner.h" #include "rnwgpu/async/AsyncTaskHandle.h" @@ -19,17 +19,20 @@ namespace rnwgpu { namespace m = margelo; +namespace jsi = facebook::jsi; -class GPUBuffer : public m::HybridObject { +class GPUBuffer : public m::NativeObject { public: + static constexpr const char *CLASS_NAME = "GPUBuffer"; + explicit GPUBuffer(wgpu::Buffer instance, std::shared_ptr async, std::string label) - : HybridObject("GPUBuffer"), _instance(instance), _async(async), + : NativeObject(CLASS_NAME), _instance(instance), _async(async), _label(label) {} public: - std::string getBrand() { return _name; } + std::string getBrand() { return CLASS_NAME; } async::AsyncTaskHandle mapAsync(uint64_t modeIn, std::optional offset, @@ -49,17 +52,18 @@ class GPUBuffer : public m::HybridObject { _instance.SetLabel(_label.c_str()); } - void loadHybridMethods() override { - registerHybridGetter("__brand", &GPUBuffer::getBrand, this); - registerHybridMethod("mapAsync", &GPUBuffer::mapAsync, this); - registerHybridMethod("getMappedRange", &GPUBuffer::getMappedRange, this); - registerHybridMethod("unmap", &GPUBuffer::unmap, this); - registerHybridMethod("destroy", &GPUBuffer::destroy, this); - registerHybridGetter("size", &GPUBuffer::getSize, this); - registerHybridGetter("usage", &GPUBuffer::getUsage, this); - registerHybridGetter("mapState", &GPUBuffer::getMapState, this); - registerHybridGetter("label", &GPUBuffer::getLabel, this); - registerHybridSetter("label", &GPUBuffer::setLabel, this); + static void definePrototype(jsi::Runtime &runtime, jsi::Object &prototype) { + installGetter(runtime, prototype, "__brand", &GPUBuffer::getBrand); + installMethod(runtime, prototype, "mapAsync", &GPUBuffer::mapAsync); + installMethod(runtime, prototype, "getMappedRange", + &GPUBuffer::getMappedRange); + installMethod(runtime, prototype, "unmap", &GPUBuffer::unmap); + installMethod(runtime, prototype, "destroy", &GPUBuffer::destroy); + installGetter(runtime, prototype, "size", &GPUBuffer::getSize); + installGetter(runtime, prototype, "usage", &GPUBuffer::getUsage); + installGetter(runtime, prototype, "mapState", &GPUBuffer::getMapState); + installGetterSetter(runtime, prototype, "label", &GPUBuffer::getLabel, + &GPUBuffer::setLabel); } inline const wgpu::Buffer get() { return _instance; } diff --git a/packages/webgpu/cpp/rnwgpu/api/GPUCanvasContext.h b/packages/webgpu/cpp/rnwgpu/api/GPUCanvasContext.h index e425a0729..38b0bb383 100644 --- a/packages/webgpu/cpp/rnwgpu/api/GPUCanvasContext.h +++ b/packages/webgpu/cpp/rnwgpu/api/GPUCanvasContext.h @@ -8,7 +8,7 @@ #include "webgpu/webgpu_cpp.h" -#include "RNFHybridObject.h" +#include "RNFNativeObject.h" #include "Canvas.h" #include "GPU.h" @@ -19,12 +19,15 @@ namespace rnwgpu { namespace m = margelo; +namespace jsi = facebook::jsi; -class GPUCanvasContext : public m::HybridObject { +class GPUCanvasContext : public m::NativeObject { public: + static constexpr const char *CLASS_NAME = "GPUCanvasContext"; + GPUCanvasContext(std::shared_ptr gpu, int contextId, int width, int height) - : HybridObject("GPUCanvasContext"), _gpu(std::move(gpu)) { + : NativeObject(CLASS_NAME), _gpu(std::move(gpu)) { _canvas = std::make_shared(nullptr, width, height); auto ®istry = rnwgpu::SurfaceRegistry::getInstance(); _surfaceInfo = @@ -32,18 +35,20 @@ class GPUCanvasContext : public m::HybridObject { } public: - std::string getBrand() { return _name; } + std::string getBrand() { return CLASS_NAME; } std::shared_ptr getCanvas() { return _canvas; } - void loadHybridMethods() override { - registerHybridGetter("__brand", &GPUCanvasContext::getBrand, this); - registerHybridGetter("canvas", &GPUCanvasContext::getCanvas, this); - registerHybridMethod("configure", &GPUCanvasContext::configure, this); - registerHybridMethod("unconfigure", &GPUCanvasContext::unconfigure, this); - registerHybridMethod("getCurrentTexture", - &GPUCanvasContext::getCurrentTexture, this); - registerHybridMethod("present", &GPUCanvasContext::present, this); + static void definePrototype(jsi::Runtime &runtime, jsi::Object &prototype) { + installGetter(runtime, prototype, "__brand", &GPUCanvasContext::getBrand); + installGetter(runtime, prototype, "canvas", &GPUCanvasContext::getCanvas); + installMethod(runtime, prototype, "configure", + &GPUCanvasContext::configure); + installMethod(runtime, prototype, "unconfigure", + &GPUCanvasContext::unconfigure); + installMethod(runtime, prototype, "getCurrentTexture", + &GPUCanvasContext::getCurrentTexture); + installMethod(runtime, prototype, "present", &GPUCanvasContext::present); } // TODO: is this ok? diff --git a/packages/webgpu/cpp/rnwgpu/api/GPUCommandBuffer.h b/packages/webgpu/cpp/rnwgpu/api/GPUCommandBuffer.h index 9ef9a95fc..728194b64 100644 --- a/packages/webgpu/cpp/rnwgpu/api/GPUCommandBuffer.h +++ b/packages/webgpu/cpp/rnwgpu/api/GPUCommandBuffer.h @@ -4,21 +4,24 @@ #include "Unions.h" -#include "RNFHybridObject.h" +#include "RNFNativeObject.h" #include "webgpu/webgpu_cpp.h" namespace rnwgpu { namespace m = margelo; +namespace jsi = facebook::jsi; -class GPUCommandBuffer : public m::HybridObject { +class GPUCommandBuffer : public m::NativeObject { public: + static constexpr const char *CLASS_NAME = "GPUCommandBuffer"; + explicit GPUCommandBuffer(wgpu::CommandBuffer instance, std::string label) - : HybridObject("GPUCommandBuffer"), _instance(instance), _label(label) {} + : NativeObject(CLASS_NAME), _instance(instance), _label(label) {} public: - std::string getBrand() { return _name; } + std::string getBrand() { return CLASS_NAME; } std::string getLabel() { return _label; } void setLabel(const std::string &label) { @@ -26,11 +29,11 @@ class GPUCommandBuffer : public m::HybridObject { _instance.SetLabel(_label.c_str()); } - void loadHybridMethods() override { - registerHybridGetter("__brand", &GPUCommandBuffer::getBrand, this); - - registerHybridGetter("label", &GPUCommandBuffer::getLabel, this); - registerHybridSetter("label", &GPUCommandBuffer::setLabel, this); + static void definePrototype(jsi::Runtime &runtime, jsi::Object &prototype) { + installGetter(runtime, prototype, "__brand", &GPUCommandBuffer::getBrand); + installGetterSetter(runtime, prototype, "label", + &GPUCommandBuffer::getLabel, + &GPUCommandBuffer::setLabel); } inline const wgpu::CommandBuffer get() { return _instance; } diff --git a/packages/webgpu/cpp/rnwgpu/api/GPUCommandEncoder.h b/packages/webgpu/cpp/rnwgpu/api/GPUCommandEncoder.h index 61616017a..8fd42b328 100644 --- a/packages/webgpu/cpp/rnwgpu/api/GPUCommandEncoder.h +++ b/packages/webgpu/cpp/rnwgpu/api/GPUCommandEncoder.h @@ -5,7 +5,7 @@ #include "Unions.h" -#include "RNFHybridObject.h" +#include "RNFNativeObject.h" #include "webgpu/webgpu_cpp.h" @@ -24,14 +24,17 @@ namespace rnwgpu { namespace m = margelo; +namespace jsi = facebook::jsi; -class GPUCommandEncoder : public m::HybridObject { +class GPUCommandEncoder : public m::NativeObject { public: + static constexpr const char *CLASS_NAME = "GPUCommandEncoder"; + explicit GPUCommandEncoder(wgpu::CommandEncoder instance, std::string label) - : HybridObject("GPUCommandEncoder"), _instance(instance), _label(label) {} + : NativeObject(CLASS_NAME), _instance(instance), _label(label) {} public: - std::string getBrand() { return _name; } + std::string getBrand() { return CLASS_NAME; } std::shared_ptr beginRenderPass(std::shared_ptr descriptor); @@ -69,33 +72,34 @@ class GPUCommandEncoder : public m::HybridObject { _instance.SetLabel(_label.c_str()); } - void loadHybridMethods() override { - registerHybridGetter("__brand", &GPUCommandEncoder::getBrand, this); - registerHybridMethod("beginRenderPass", &GPUCommandEncoder::beginRenderPass, - this); - registerHybridMethod("beginComputePass", - &GPUCommandEncoder::beginComputePass, this); - registerHybridMethod("copyBufferToBuffer", - &GPUCommandEncoder::copyBufferToBuffer, this); - registerHybridMethod("copyBufferToTexture", - &GPUCommandEncoder::copyBufferToTexture, this); - registerHybridMethod("copyTextureToBuffer", - &GPUCommandEncoder::copyTextureToBuffer, this); - registerHybridMethod("copyTextureToTexture", - &GPUCommandEncoder::copyTextureToTexture, this); - registerHybridMethod("clearBuffer", &GPUCommandEncoder::clearBuffer, this); - registerHybridMethod("resolveQuerySet", &GPUCommandEncoder::resolveQuerySet, - this); - registerHybridMethod("finish", &GPUCommandEncoder::finish, this); - registerHybridMethod("pushDebugGroup", &GPUCommandEncoder::pushDebugGroup, - this); - registerHybridMethod("popDebugGroup", &GPUCommandEncoder::popDebugGroup, - this); - registerHybridMethod("insertDebugMarker", - &GPUCommandEncoder::insertDebugMarker, this); - - registerHybridGetter("label", &GPUCommandEncoder::getLabel, this); - registerHybridSetter("label", &GPUCommandEncoder::setLabel, this); + static void definePrototype(jsi::Runtime &runtime, jsi::Object &prototype) { + installGetter(runtime, prototype, "__brand", &GPUCommandEncoder::getBrand); + installMethod(runtime, prototype, "beginRenderPass", + &GPUCommandEncoder::beginRenderPass); + installMethod(runtime, prototype, "beginComputePass", + &GPUCommandEncoder::beginComputePass); + installMethod(runtime, prototype, "copyBufferToBuffer", + &GPUCommandEncoder::copyBufferToBuffer); + installMethod(runtime, prototype, "copyBufferToTexture", + &GPUCommandEncoder::copyBufferToTexture); + installMethod(runtime, prototype, "copyTextureToBuffer", + &GPUCommandEncoder::copyTextureToBuffer); + installMethod(runtime, prototype, "copyTextureToTexture", + &GPUCommandEncoder::copyTextureToTexture); + installMethod(runtime, prototype, "clearBuffer", + &GPUCommandEncoder::clearBuffer); + installMethod(runtime, prototype, "resolveQuerySet", + &GPUCommandEncoder::resolveQuerySet); + installMethod(runtime, prototype, "finish", &GPUCommandEncoder::finish); + installMethod(runtime, prototype, "pushDebugGroup", + &GPUCommandEncoder::pushDebugGroup); + installMethod(runtime, prototype, "popDebugGroup", + &GPUCommandEncoder::popDebugGroup); + installMethod(runtime, prototype, "insertDebugMarker", + &GPUCommandEncoder::insertDebugMarker); + installGetterSetter(runtime, prototype, "label", + &GPUCommandEncoder::getLabel, + &GPUCommandEncoder::setLabel); } inline const wgpu::CommandEncoder get() { return _instance; } diff --git a/packages/webgpu/cpp/rnwgpu/api/GPUCompilationInfo.h b/packages/webgpu/cpp/rnwgpu/api/GPUCompilationInfo.h index e3dc3f4a0..344266093 100644 --- a/packages/webgpu/cpp/rnwgpu/api/GPUCompilationInfo.h +++ b/packages/webgpu/cpp/rnwgpu/api/GPUCompilationInfo.h @@ -5,15 +5,16 @@ #include "Unions.h" -#include "RNFHybridObject.h" +#include "RNFNativeObject.h" #include "webgpu/webgpu_cpp.h" namespace rnwgpu { namespace m = margelo; +namespace jsi = facebook::jsi; -struct GPUCompilationMessage { +struct GPUCompilationMessageData { std::string message; wgpu::CompilationMessageType type; uint64_t lineNum; @@ -22,35 +23,39 @@ struct GPUCompilationMessage { uint64_t length; }; -class GPUCompilationInfo : public m::HybridObject { +class GPUCompilationInfo : public m::NativeObject { public: - GPUCompilationInfo() : HybridObject("GPUCompilationInfo") {} + static constexpr const char *CLASS_NAME = "GPUCompilationInfo"; + + GPUCompilationInfo() : NativeObject(CLASS_NAME) {} public: - std::string getBrand() { return _name; } + std::string getBrand() { return CLASS_NAME; } - std::vector getMessages() { return _messages; } + std::vector getMessages() { return _messages; } - void loadHybridMethods() override { - registerHybridGetter("__brand", &GPUCompilationInfo::getBrand, this); - registerHybridGetter("messages", &GPUCompilationInfo::getMessages, this); + static void definePrototype(jsi::Runtime &runtime, jsi::Object &prototype) { + installGetter(runtime, prototype, "__brand", &GPUCompilationInfo::getBrand); + installGetter(runtime, prototype, "messages", + &GPUCompilationInfo::getMessages); } private: - std::vector _messages; + std::vector _messages; friend class GPUShaderModule; }; } // namespace rnwgpu namespace margelo { -template <> struct JSIConverter> { - static std::vector +template <> +struct JSIConverter> { + static std::vector fromJSI(jsi::Runtime &runtime, const jsi::Value &arg, bool outOfBounds) { - throw std::runtime_error("Invalid GPUCompilationMessage::fromJSI()"); + throw std::runtime_error("Invalid GPUCompilationMessageData::fromJSI()"); } static jsi::Value toJSI(jsi::Runtime &runtime, - std::vector arg) { + std::vector arg) { jsi::Array result = jsi::Array(runtime, arg.size()); for (size_t i = 0; i < arg.size(); i++) { const auto &message = arg[i]; diff --git a/packages/webgpu/cpp/rnwgpu/api/GPUCompilationMessage.h b/packages/webgpu/cpp/rnwgpu/api/GPUCompilationMessage.h index b94295af2..2a3c99d8a 100644 --- a/packages/webgpu/cpp/rnwgpu/api/GPUCompilationMessage.h +++ b/packages/webgpu/cpp/rnwgpu/api/GPUCompilationMessage.h @@ -4,24 +4,28 @@ #include "Unions.h" -#include "RNFHybridObject.h" +#include "RNFNativeObject.h" #include "webgpu/webgpu_cpp.h" namespace rnwgpu { namespace m = margelo; +namespace jsi = facebook::jsi; -class GPUCompilationMessage : public m::HybridObject { +class GPUCompilationMessage : public m::NativeObject { public: + static constexpr const char *CLASS_NAME = "GPUCompilationMessage"; + explicit GPUCompilationMessage(wgpu::CompilationMessage instance) - : HybridObject("GPUCompilationMessage"), _instance(instance) {} + : NativeObject(CLASS_NAME), _instance(instance) {} public: - std::string getBrand() { return _name; } + std::string getBrand() { return CLASS_NAME; } - void loadHybridMethods() override { - registerHybridGetter("__brand", &GPUCompilationMessage::getBrand, this); + static void definePrototype(jsi::Runtime &runtime, jsi::Object &prototype) { + installGetter(runtime, prototype, "__brand", + &GPUCompilationMessage::getBrand); } inline const wgpu::CompilationMessage get() { return _instance; } diff --git a/packages/webgpu/cpp/rnwgpu/api/GPUComputePassEncoder.h b/packages/webgpu/cpp/rnwgpu/api/GPUComputePassEncoder.h index 9734d3516..a6a0b332a 100644 --- a/packages/webgpu/cpp/rnwgpu/api/GPUComputePassEncoder.h +++ b/packages/webgpu/cpp/rnwgpu/api/GPUComputePassEncoder.h @@ -8,7 +8,7 @@ #include "Unions.h" -#include "RNFHybridObject.h" +#include "RNFNativeObject.h" #include "webgpu/webgpu_cpp.h" @@ -19,16 +19,18 @@ namespace rnwgpu { namespace m = margelo; +namespace jsi = facebook::jsi; -class GPUComputePassEncoder : public m::HybridObject { +class GPUComputePassEncoder : public m::NativeObject { public: + static constexpr const char *CLASS_NAME = "GPUComputePassEncoder"; + explicit GPUComputePassEncoder(wgpu::ComputePassEncoder instance, std::string label) - : HybridObject("GPUComputePassEncoder"), _instance(instance), - _label(label) {} + : NativeObject(CLASS_NAME), _instance(instance), _label(label) {} public: - std::string getBrand() { return _name; } + std::string getBrand() { return CLASS_NAME; } void setPipeline(std::shared_ptr pipeline); void dispatchWorkgroups(uint32_t workgroupCountX, @@ -51,27 +53,27 @@ class GPUComputePassEncoder : public m::HybridObject { _instance.SetLabel(_label.c_str()); } - void loadHybridMethods() override { - registerHybridGetter("__brand", &GPUComputePassEncoder::getBrand, this); - registerHybridMethod("setPipeline", &GPUComputePassEncoder::setPipeline, - this); - registerHybridMethod("dispatchWorkgroups", - &GPUComputePassEncoder::dispatchWorkgroups, this); - registerHybridMethod("dispatchWorkgroupsIndirect", - &GPUComputePassEncoder::dispatchWorkgroupsIndirect, - this); - registerHybridMethod("end", &GPUComputePassEncoder::end, this); - registerHybridMethod("pushDebugGroup", - &GPUComputePassEncoder::pushDebugGroup, this); - registerHybridMethod("popDebugGroup", &GPUComputePassEncoder::popDebugGroup, - this); - registerHybridMethod("insertDebugMarker", - &GPUComputePassEncoder::insertDebugMarker, this); - registerHybridMethod("setBindGroup", &GPUComputePassEncoder::setBindGroup, - this); - - registerHybridGetter("label", &GPUComputePassEncoder::getLabel, this); - registerHybridSetter("label", &GPUComputePassEncoder::setLabel, this); + static void definePrototype(jsi::Runtime &runtime, jsi::Object &prototype) { + installGetter(runtime, prototype, "__brand", + &GPUComputePassEncoder::getBrand); + installMethod(runtime, prototype, "setPipeline", + &GPUComputePassEncoder::setPipeline); + installMethod(runtime, prototype, "dispatchWorkgroups", + &GPUComputePassEncoder::dispatchWorkgroups); + installMethod(runtime, prototype, "dispatchWorkgroupsIndirect", + &GPUComputePassEncoder::dispatchWorkgroupsIndirect); + installMethod(runtime, prototype, "end", &GPUComputePassEncoder::end); + installMethod(runtime, prototype, "pushDebugGroup", + &GPUComputePassEncoder::pushDebugGroup); + installMethod(runtime, prototype, "popDebugGroup", + &GPUComputePassEncoder::popDebugGroup); + installMethod(runtime, prototype, "insertDebugMarker", + &GPUComputePassEncoder::insertDebugMarker); + installMethod(runtime, prototype, "setBindGroup", + &GPUComputePassEncoder::setBindGroup); + installGetterSetter(runtime, prototype, "label", + &GPUComputePassEncoder::getLabel, + &GPUComputePassEncoder::setLabel); } inline const wgpu::ComputePassEncoder get() { return _instance; } diff --git a/packages/webgpu/cpp/rnwgpu/api/GPUComputePipeline.h b/packages/webgpu/cpp/rnwgpu/api/GPUComputePipeline.h index e8bd6d56d..027a231c4 100644 --- a/packages/webgpu/cpp/rnwgpu/api/GPUComputePipeline.h +++ b/packages/webgpu/cpp/rnwgpu/api/GPUComputePipeline.h @@ -5,7 +5,7 @@ #include "Unions.h" -#include "RNFHybridObject.h" +#include "RNFNativeObject.h" #include "webgpu/webgpu_cpp.h" @@ -14,15 +14,17 @@ namespace rnwgpu { namespace m = margelo; +namespace jsi = facebook::jsi; -class GPUComputePipeline : public m::HybridObject { +class GPUComputePipeline : public m::NativeObject { public: + static constexpr const char *CLASS_NAME = "GPUComputePipeline"; + explicit GPUComputePipeline(wgpu::ComputePipeline instance, std::string label) - : HybridObject("GPUComputePipeline"), _instance(instance), _label(label) { - } + : NativeObject(CLASS_NAME), _instance(instance), _label(label) {} public: - std::string getBrand() { return _name; } + std::string getBrand() { return CLASS_NAME; } std::shared_ptr getBindGroupLayout(uint32_t index); @@ -32,13 +34,13 @@ class GPUComputePipeline : public m::HybridObject { _instance.SetLabel(_label.c_str()); } - void loadHybridMethods() override { - registerHybridGetter("__brand", &GPUComputePipeline::getBrand, this); - registerHybridMethod("getBindGroupLayout", - &GPUComputePipeline::getBindGroupLayout, this); - - registerHybridGetter("label", &GPUComputePipeline::getLabel, this); - registerHybridSetter("label", &GPUComputePipeline::setLabel, this); + static void definePrototype(jsi::Runtime &runtime, jsi::Object &prototype) { + installGetter(runtime, prototype, "__brand", &GPUComputePipeline::getBrand); + installMethod(runtime, prototype, "getBindGroupLayout", + &GPUComputePipeline::getBindGroupLayout); + installGetterSetter(runtime, prototype, "label", + &GPUComputePipeline::getLabel, + &GPUComputePipeline::setLabel); } inline const wgpu::ComputePipeline get() { return _instance; } diff --git a/packages/webgpu/cpp/rnwgpu/api/GPUDevice.h b/packages/webgpu/cpp/rnwgpu/api/GPUDevice.h index ef8ed87e0..8462cbcaa 100644 --- a/packages/webgpu/cpp/rnwgpu/api/GPUDevice.h +++ b/packages/webgpu/cpp/rnwgpu/api/GPUDevice.h @@ -9,7 +9,7 @@ #include "Unions.h" -#include "RNFHybridObject.h" +#include "RNFNativeObject.h" #include "rnwgpu/async/AsyncRunner.h" #include "rnwgpu/async/AsyncTaskHandle.h" @@ -50,17 +50,20 @@ namespace rnwgpu { namespace m = margelo; +namespace jsi = facebook::jsi; -class GPUDevice : public m::HybridObject { +class GPUDevice : public m::NativeObject { public: + static constexpr const char *CLASS_NAME = "GPUDevice"; + explicit GPUDevice(wgpu::Device instance, std::shared_ptr async, std::string label) - : HybridObject("GPUDevice"), _instance(instance), _async(async), + : NativeObject(CLASS_NAME), _instance(instance), _async(async), _label(label) {} public: - std::string getBrand() { return _name; } + std::string getBrand() { return CLASS_NAME; } void destroy(); std::shared_ptr @@ -109,44 +112,50 @@ class GPUDevice : public m::HybridObject { _instance.SetLabel(_label.c_str()); } - void loadHybridMethods() override { - registerHybridGetter("__brand", &GPUDevice::getBrand, this); - registerHybridMethod("destroy", &GPUDevice::destroy, this); - registerHybridMethod("createBuffer", &GPUDevice::createBuffer, this); - registerHybridMethod("createTexture", &GPUDevice::createTexture, this); - registerHybridMethod("createSampler", &GPUDevice::createSampler, this); - registerHybridMethod("importExternalTexture", - &GPUDevice::importExternalTexture, this); - registerHybridMethod("createBindGroupLayout", - &GPUDevice::createBindGroupLayout, this); - registerHybridMethod("createPipelineLayout", - &GPUDevice::createPipelineLayout, this); - registerHybridMethod("createBindGroup", &GPUDevice::createBindGroup, this); - registerHybridMethod("createShaderModule", &GPUDevice::createShaderModule, - this); - registerHybridMethod("createComputePipeline", - &GPUDevice::createComputePipeline, this); - registerHybridMethod("createRenderPipeline", - &GPUDevice::createRenderPipeline, this); - registerHybridMethod("createComputePipelineAsync", - &GPUDevice::createComputePipelineAsync, this); - registerHybridMethod("createRenderPipelineAsync", - &GPUDevice::createRenderPipelineAsync, this); - registerHybridMethod("createCommandEncoder", - &GPUDevice::createCommandEncoder, this); - registerHybridMethod("createRenderBundleEncoder", - &GPUDevice::createRenderBundleEncoder, this); - registerHybridMethod("createQuerySet", &GPUDevice::createQuerySet, this); - registerHybridMethod("pushErrorScope", &GPUDevice::pushErrorScope, this); - registerHybridMethod("popErrorScope", &GPUDevice::popErrorScope, this); - registerHybridGetter("features", &GPUDevice::getFeatures, this); - registerHybridGetter("limits", &GPUDevice::getLimits, this); - registerHybridGetter("queue", &GPUDevice::getQueue, this); - registerHybridGetter("lost", &GPUDevice::getLost, this); - registerHybridGetter("label", &GPUDevice::getLabel, this); - registerHybridSetter("label", &GPUDevice::setLabel, this); - registerHybridMethod("forceLossForTesting", &GPUDevice::forceLossForTesting, - this); + static void definePrototype(jsi::Runtime &runtime, jsi::Object &prototype) { + installGetter(runtime, prototype, "__brand", &GPUDevice::getBrand); + installMethod(runtime, prototype, "destroy", &GPUDevice::destroy); + installMethod(runtime, prototype, "createBuffer", &GPUDevice::createBuffer); + installMethod(runtime, prototype, "createTexture", + &GPUDevice::createTexture); + installMethod(runtime, prototype, "createSampler", + &GPUDevice::createSampler); + installMethod(runtime, prototype, "importExternalTexture", + &GPUDevice::importExternalTexture); + installMethod(runtime, prototype, "createBindGroupLayout", + &GPUDevice::createBindGroupLayout); + installMethod(runtime, prototype, "createPipelineLayout", + &GPUDevice::createPipelineLayout); + installMethod(runtime, prototype, "createBindGroup", + &GPUDevice::createBindGroup); + installMethod(runtime, prototype, "createShaderModule", + &GPUDevice::createShaderModule); + installMethod(runtime, prototype, "createComputePipeline", + &GPUDevice::createComputePipeline); + installMethod(runtime, prototype, "createRenderPipeline", + &GPUDevice::createRenderPipeline); + installMethod(runtime, prototype, "createComputePipelineAsync", + &GPUDevice::createComputePipelineAsync); + installMethod(runtime, prototype, "createRenderPipelineAsync", + &GPUDevice::createRenderPipelineAsync); + installMethod(runtime, prototype, "createCommandEncoder", + &GPUDevice::createCommandEncoder); + installMethod(runtime, prototype, "createRenderBundleEncoder", + &GPUDevice::createRenderBundleEncoder); + installMethod(runtime, prototype, "createQuerySet", + &GPUDevice::createQuerySet); + installMethod(runtime, prototype, "pushErrorScope", + &GPUDevice::pushErrorScope); + installMethod(runtime, prototype, "popErrorScope", + &GPUDevice::popErrorScope); + installGetter(runtime, prototype, "features", &GPUDevice::getFeatures); + installGetter(runtime, prototype, "limits", &GPUDevice::getLimits); + installGetter(runtime, prototype, "queue", &GPUDevice::getQueue); + installGetter(runtime, prototype, "lost", &GPUDevice::getLost); + installGetterSetter(runtime, prototype, "label", &GPUDevice::getLabel, + &GPUDevice::setLabel); + installMethod(runtime, prototype, "forceLossForTesting", + &GPUDevice::forceLossForTesting); } inline const wgpu::Device get() { return _instance; } diff --git a/packages/webgpu/cpp/rnwgpu/api/GPUDeviceLostInfo.h b/packages/webgpu/cpp/rnwgpu/api/GPUDeviceLostInfo.h index 35feffcb0..35b295c5a 100644 --- a/packages/webgpu/cpp/rnwgpu/api/GPUDeviceLostInfo.h +++ b/packages/webgpu/cpp/rnwgpu/api/GPUDeviceLostInfo.h @@ -4,30 +4,33 @@ #include "Unions.h" -#include "RNFHybridObject.h" +#include "RNFNativeObject.h" #include "webgpu/webgpu_cpp.h" namespace rnwgpu { namespace m = margelo; +namespace jsi = facebook::jsi; -class GPUDeviceLostInfo : public m::HybridObject { +class GPUDeviceLostInfo : public m::NativeObject { public: + static constexpr const char *CLASS_NAME = "GPUDeviceLostInfo"; + explicit GPUDeviceLostInfo(wgpu::DeviceLostReason reason, std::string message) - : HybridObject("GPUDeviceLostInfo"), _reason(reason), _message(message) {} + : NativeObject(CLASS_NAME), _reason(reason), _message(message) {} public: - std::string getBrand() { return _name; } + std::string getBrand() { return CLASS_NAME; } wgpu::DeviceLostReason getReason() { return _reason; } std::string getMessage() { return _message; } - void loadHybridMethods() override { - registerHybridGetter("__brand", &GPUDeviceLostInfo::getBrand, this); - - registerHybridGetter("reason", &GPUDeviceLostInfo::getReason, this); - registerHybridGetter("message", &GPUDeviceLostInfo::getMessage, this); + static void definePrototype(jsi::Runtime &runtime, jsi::Object &prototype) { + installGetter(runtime, prototype, "__brand", &GPUDeviceLostInfo::getBrand); + installGetter(runtime, prototype, "reason", &GPUDeviceLostInfo::getReason); + installGetter(runtime, prototype, "message", + &GPUDeviceLostInfo::getMessage); } private: diff --git a/packages/webgpu/cpp/rnwgpu/api/GPUExternalTexture.h b/packages/webgpu/cpp/rnwgpu/api/GPUExternalTexture.h index ffca6cce0..3b38ca338 100644 --- a/packages/webgpu/cpp/rnwgpu/api/GPUExternalTexture.h +++ b/packages/webgpu/cpp/rnwgpu/api/GPUExternalTexture.h @@ -4,22 +4,24 @@ #include "Unions.h" -#include "RNFHybridObject.h" +#include "RNFNativeObject.h" #include "webgpu/webgpu_cpp.h" namespace rnwgpu { namespace m = margelo; +namespace jsi = facebook::jsi; -class GPUExternalTexture : public m::HybridObject { +class GPUExternalTexture : public m::NativeObject { public: + static constexpr const char *CLASS_NAME = "GPUExternalTexture"; + explicit GPUExternalTexture(wgpu::ExternalTexture instance, std::string label) - : HybridObject("GPUExternalTexture"), _instance(instance), _label(label) { - } + : NativeObject(CLASS_NAME), _instance(instance), _label(label) {} public: - std::string getBrand() { return _name; } + std::string getBrand() { return CLASS_NAME; } std::string getLabel() { return _label; } void setLabel(const std::string &label) { @@ -27,11 +29,11 @@ class GPUExternalTexture : public m::HybridObject { _instance.SetLabel(_label.c_str()); } - void loadHybridMethods() override { - registerHybridGetter("__brand", &GPUExternalTexture::getBrand, this); - - registerHybridGetter("label", &GPUExternalTexture::getLabel, this); - registerHybridSetter("label", &GPUExternalTexture::setLabel, this); + static void definePrototype(jsi::Runtime &runtime, jsi::Object &prototype) { + installGetter(runtime, prototype, "__brand", &GPUExternalTexture::getBrand); + installGetterSetter(runtime, prototype, "label", + &GPUExternalTexture::getLabel, + &GPUExternalTexture::setLabel); } inline const wgpu::ExternalTexture get() { return _instance; } diff --git a/packages/webgpu/cpp/rnwgpu/api/GPUPipelineLayout.h b/packages/webgpu/cpp/rnwgpu/api/GPUPipelineLayout.h index c42e93915..2c5bf2ff6 100644 --- a/packages/webgpu/cpp/rnwgpu/api/GPUPipelineLayout.h +++ b/packages/webgpu/cpp/rnwgpu/api/GPUPipelineLayout.h @@ -4,21 +4,24 @@ #include "Unions.h" -#include "RNFHybridObject.h" +#include "RNFNativeObject.h" #include "webgpu/webgpu_cpp.h" namespace rnwgpu { namespace m = margelo; +namespace jsi = facebook::jsi; -class GPUPipelineLayout : public m::HybridObject { +class GPUPipelineLayout : public m::NativeObject { public: + static constexpr const char *CLASS_NAME = "GPUPipelineLayout"; + explicit GPUPipelineLayout(wgpu::PipelineLayout instance, std::string label) - : HybridObject("GPUPipelineLayout"), _instance(instance), _label(label) {} + : NativeObject(CLASS_NAME), _instance(instance), _label(label) {} public: - std::string getBrand() { return _name; } + std::string getBrand() { return CLASS_NAME; } std::string getLabel() { return _label; } void setLabel(const std::string &label) { @@ -26,11 +29,11 @@ class GPUPipelineLayout : public m::HybridObject { _instance.SetLabel(_label.c_str()); } - void loadHybridMethods() override { - registerHybridGetter("__brand", &GPUPipelineLayout::getBrand, this); - - registerHybridGetter("label", &GPUPipelineLayout::getLabel, this); - registerHybridSetter("label", &GPUPipelineLayout::setLabel, this); + static void definePrototype(jsi::Runtime &runtime, jsi::Object &prototype) { + installGetter(runtime, prototype, "__brand", &GPUPipelineLayout::getBrand); + installGetterSetter(runtime, prototype, "label", + &GPUPipelineLayout::getLabel, + &GPUPipelineLayout::setLabel); } inline const wgpu::PipelineLayout get() { return _instance; } diff --git a/packages/webgpu/cpp/rnwgpu/api/GPUQuerySet.h b/packages/webgpu/cpp/rnwgpu/api/GPUQuerySet.h index 6d14195dc..73f01b7c7 100644 --- a/packages/webgpu/cpp/rnwgpu/api/GPUQuerySet.h +++ b/packages/webgpu/cpp/rnwgpu/api/GPUQuerySet.h @@ -4,21 +4,24 @@ #include "Unions.h" -#include "RNFHybridObject.h" +#include "RNFNativeObject.h" #include "webgpu/webgpu_cpp.h" namespace rnwgpu { namespace m = margelo; +namespace jsi = facebook::jsi; -class GPUQuerySet : public m::HybridObject { +class GPUQuerySet : public m::NativeObject { public: + static constexpr const char *CLASS_NAME = "GPUQuerySet"; + explicit GPUQuerySet(wgpu::QuerySet instance, std::string label) - : HybridObject("GPUQuerySet"), _instance(instance), _label(label) {} + : NativeObject(CLASS_NAME), _instance(instance), _label(label) {} public: - std::string getBrand() { return _name; } + std::string getBrand() { return CLASS_NAME; } void destroy(); @@ -31,13 +34,13 @@ class GPUQuerySet : public m::HybridObject { _instance.SetLabel(_label.c_str()); } - void loadHybridMethods() override { - registerHybridGetter("__brand", &GPUQuerySet::getBrand, this); - registerHybridMethod("destroy", &GPUQuerySet::destroy, this); - registerHybridGetter("type", &GPUQuerySet::getType, this); - registerHybridGetter("count", &GPUQuerySet::getCount, this); - registerHybridGetter("label", &GPUQuerySet::getLabel, this); - registerHybridSetter("label", &GPUQuerySet::setLabel, this); + static void definePrototype(jsi::Runtime &runtime, jsi::Object &prototype) { + installGetter(runtime, prototype, "__brand", &GPUQuerySet::getBrand); + installMethod(runtime, prototype, "destroy", &GPUQuerySet::destroy); + installGetter(runtime, prototype, "type", &GPUQuerySet::getType); + installGetter(runtime, prototype, "count", &GPUQuerySet::getCount); + installGetterSetter(runtime, prototype, "label", &GPUQuerySet::getLabel, + &GPUQuerySet::setLabel); } inline const wgpu::QuerySet get() { return _instance; } diff --git a/packages/webgpu/cpp/rnwgpu/api/GPUQueue.h b/packages/webgpu/cpp/rnwgpu/api/GPUQueue.h index c01237b72..23f92e070 100644 --- a/packages/webgpu/cpp/rnwgpu/api/GPUQueue.h +++ b/packages/webgpu/cpp/rnwgpu/api/GPUQueue.h @@ -6,7 +6,7 @@ #include "Unions.h" -#include "RNFHybridObject.h" +#include "RNFNativeObject.h" #include "rnwgpu/async/AsyncRunner.h" #include "rnwgpu/async/AsyncTaskHandle.h" @@ -22,17 +22,20 @@ namespace rnwgpu { namespace m = margelo; +namespace jsi = facebook::jsi; -class GPUQueue : public m::HybridObject { +class GPUQueue : public m::NativeObject { public: + static constexpr const char *CLASS_NAME = "GPUQueue"; + explicit GPUQueue(wgpu::Queue instance, std::shared_ptr async, std::string label) - : HybridObject("GPUQueue"), _instance(instance), _async(async), + : NativeObject(CLASS_NAME), _instance(instance), _async(async), _label(label) {} public: - std::string getBrand() { return _name; } + std::string getBrand() { return CLASS_NAME; } void submit(std::vector> commandBuffers); async::AsyncTaskHandle onSubmittedWorkDone(); @@ -55,18 +58,17 @@ class GPUQueue : public m::HybridObject { _instance.SetLabel(_label.c_str()); } - void loadHybridMethods() override { - registerHybridGetter("__brand", &GPUQueue::getBrand, this); - registerHybridMethod("submit", &GPUQueue::submit, this); - registerHybridMethod("onSubmittedWorkDone", &GPUQueue::onSubmittedWorkDone, - this); - registerHybridMethod("writeBuffer", &GPUQueue::writeBuffer, this); - registerHybridMethod("writeTexture", &GPUQueue::writeTexture, this); - registerHybridMethod("copyExternalImageToTexture", - &GPUQueue::copyExternalImageToTexture, this); - - registerHybridGetter("label", &GPUQueue::getLabel, this); - registerHybridSetter("label", &GPUQueue::setLabel, this); + static void definePrototype(jsi::Runtime &runtime, jsi::Object &prototype) { + installGetter(runtime, prototype, "__brand", &GPUQueue::getBrand); + installMethod(runtime, prototype, "submit", &GPUQueue::submit); + installMethod(runtime, prototype, "onSubmittedWorkDone", + &GPUQueue::onSubmittedWorkDone); + installMethod(runtime, prototype, "writeBuffer", &GPUQueue::writeBuffer); + installMethod(runtime, prototype, "writeTexture", &GPUQueue::writeTexture); + installMethod(runtime, prototype, "copyExternalImageToTexture", + &GPUQueue::copyExternalImageToTexture); + installGetterSetter(runtime, prototype, "label", &GPUQueue::getLabel, + &GPUQueue::setLabel); } inline const wgpu::Queue get() { return _instance; } diff --git a/packages/webgpu/cpp/rnwgpu/api/GPURenderBundle.h b/packages/webgpu/cpp/rnwgpu/api/GPURenderBundle.h index d59c8e422..3944bed9b 100644 --- a/packages/webgpu/cpp/rnwgpu/api/GPURenderBundle.h +++ b/packages/webgpu/cpp/rnwgpu/api/GPURenderBundle.h @@ -4,21 +4,24 @@ #include "Unions.h" -#include "RNFHybridObject.h" +#include "RNFNativeObject.h" #include "webgpu/webgpu_cpp.h" namespace rnwgpu { namespace m = margelo; +namespace jsi = facebook::jsi; -class GPURenderBundle : public m::HybridObject { +class GPURenderBundle : public m::NativeObject { public: + static constexpr const char *CLASS_NAME = "GPURenderBundle"; + explicit GPURenderBundle(wgpu::RenderBundle instance, std::string label) - : HybridObject("GPURenderBundle"), _instance(instance), _label(label) {} + : NativeObject(CLASS_NAME), _instance(instance), _label(label) {} public: - std::string getBrand() { return _name; } + std::string getBrand() { return CLASS_NAME; } std::string getLabel() { return _label; } void setLabel(const std::string &label) { @@ -26,11 +29,10 @@ class GPURenderBundle : public m::HybridObject { _instance.SetLabel(_label.c_str()); } - void loadHybridMethods() override { - registerHybridGetter("__brand", &GPURenderBundle::getBrand, this); - - registerHybridGetter("label", &GPURenderBundle::getLabel, this); - registerHybridSetter("label", &GPURenderBundle::setLabel, this); + static void definePrototype(jsi::Runtime &runtime, jsi::Object &prototype) { + installGetter(runtime, prototype, "__brand", &GPURenderBundle::getBrand); + installGetterSetter(runtime, prototype, "label", &GPURenderBundle::getLabel, + &GPURenderBundle::setLabel); } inline const wgpu::RenderBundle get() { return _instance; } diff --git a/packages/webgpu/cpp/rnwgpu/api/GPURenderBundleEncoder.h b/packages/webgpu/cpp/rnwgpu/api/GPURenderBundleEncoder.h index e0abe1075..2c6ba714d 100644 --- a/packages/webgpu/cpp/rnwgpu/api/GPURenderBundleEncoder.h +++ b/packages/webgpu/cpp/rnwgpu/api/GPURenderBundleEncoder.h @@ -8,7 +8,7 @@ #include "Unions.h" -#include "RNFHybridObject.h" +#include "RNFNativeObject.h" #include "webgpu/webgpu_cpp.h" @@ -21,16 +21,18 @@ namespace rnwgpu { namespace m = margelo; +namespace jsi = facebook::jsi; -class GPURenderBundleEncoder : public m::HybridObject { +class GPURenderBundleEncoder : public m::NativeObject { public: + static constexpr const char *CLASS_NAME = "GPURenderBundleEncoder"; + explicit GPURenderBundleEncoder(wgpu::RenderBundleEncoder instance, std::string label) - : HybridObject("GPURenderBundleEncoder"), _instance(instance), - _label(label) {} + : NativeObject(CLASS_NAME), _instance(instance), _label(label) {} public: - std::string getBrand() { return _name; } + std::string getBrand() { return CLASS_NAME; } std::shared_ptr finish(std::optional> descriptor); @@ -68,33 +70,35 @@ class GPURenderBundleEncoder : public m::HybridObject { _instance.SetLabel(_label.c_str()); } - void loadHybridMethods() override { - registerHybridGetter("__brand", &GPURenderBundleEncoder::getBrand, this); - registerHybridMethod("finish", &GPURenderBundleEncoder::finish, this); - registerHybridMethod("pushDebugGroup", - &GPURenderBundleEncoder::pushDebugGroup, this); - registerHybridMethod("popDebugGroup", - &GPURenderBundleEncoder::popDebugGroup, this); - registerHybridMethod("insertDebugMarker", - &GPURenderBundleEncoder::insertDebugMarker, this); - registerHybridMethod("setBindGroup", &GPURenderBundleEncoder::setBindGroup, - this); - registerHybridMethod("setPipeline", &GPURenderBundleEncoder::setPipeline, - this); - registerHybridMethod("setIndexBuffer", - &GPURenderBundleEncoder::setIndexBuffer, this); - registerHybridMethod("setVertexBuffer", - &GPURenderBundleEncoder::setVertexBuffer, this); - registerHybridMethod("draw", &GPURenderBundleEncoder::draw, this); - registerHybridMethod("drawIndexed", &GPURenderBundleEncoder::drawIndexed, - this); - registerHybridMethod("drawIndirect", &GPURenderBundleEncoder::drawIndirect, - this); - registerHybridMethod("drawIndexedIndirect", - &GPURenderBundleEncoder::drawIndexedIndirect, this); - - registerHybridGetter("label", &GPURenderBundleEncoder::getLabel, this); - registerHybridSetter("label", &GPURenderBundleEncoder::setLabel, this); + static void definePrototype(jsi::Runtime &runtime, jsi::Object &prototype) { + installGetter(runtime, prototype, "__brand", + &GPURenderBundleEncoder::getBrand); + installMethod(runtime, prototype, "finish", + &GPURenderBundleEncoder::finish); + installMethod(runtime, prototype, "pushDebugGroup", + &GPURenderBundleEncoder::pushDebugGroup); + installMethod(runtime, prototype, "popDebugGroup", + &GPURenderBundleEncoder::popDebugGroup); + installMethod(runtime, prototype, "insertDebugMarker", + &GPURenderBundleEncoder::insertDebugMarker); + installMethod(runtime, prototype, "setBindGroup", + &GPURenderBundleEncoder::setBindGroup); + installMethod(runtime, prototype, "setPipeline", + &GPURenderBundleEncoder::setPipeline); + installMethod(runtime, prototype, "setIndexBuffer", + &GPURenderBundleEncoder::setIndexBuffer); + installMethod(runtime, prototype, "setVertexBuffer", + &GPURenderBundleEncoder::setVertexBuffer); + installMethod(runtime, prototype, "draw", &GPURenderBundleEncoder::draw); + installMethod(runtime, prototype, "drawIndexed", + &GPURenderBundleEncoder::drawIndexed); + installMethod(runtime, prototype, "drawIndirect", + &GPURenderBundleEncoder::drawIndirect); + installMethod(runtime, prototype, "drawIndexedIndirect", + &GPURenderBundleEncoder::drawIndexedIndirect); + installGetterSetter(runtime, prototype, "label", + &GPURenderBundleEncoder::getLabel, + &GPURenderBundleEncoder::setLabel); } inline const wgpu::RenderBundleEncoder get() { return _instance; } diff --git a/packages/webgpu/cpp/rnwgpu/api/GPURenderPassEncoder.h b/packages/webgpu/cpp/rnwgpu/api/GPURenderPassEncoder.h index 126bc675f..52933372c 100644 --- a/packages/webgpu/cpp/rnwgpu/api/GPURenderPassEncoder.h +++ b/packages/webgpu/cpp/rnwgpu/api/GPURenderPassEncoder.h @@ -8,7 +8,7 @@ #include "Unions.h" -#include "RNFHybridObject.h" +#include "RNFNativeObject.h" #include "webgpu/webgpu_cpp.h" @@ -21,16 +21,18 @@ namespace rnwgpu { namespace m = margelo; +namespace jsi = facebook::jsi; -class GPURenderPassEncoder : public m::HybridObject { +class GPURenderPassEncoder : public m::NativeObject { public: + static constexpr const char *CLASS_NAME = "GPURenderPassEncoder"; + explicit GPURenderPassEncoder(wgpu::RenderPassEncoder instance, std::string label) - : HybridObject("GPURenderPassEncoder"), _instance(instance), - _label(label) {} + : NativeObject(CLASS_NAME), _instance(instance), _label(label) {} public: - std::string getBrand() { return _name; } + std::string getBrand() { return CLASS_NAME; } void setViewport(double x, double y, double width, double height, double minDepth, double maxDepth); @@ -75,47 +77,48 @@ class GPURenderPassEncoder : public m::HybridObject { _instance.SetLabel(_label.c_str()); } - void loadHybridMethods() override { - registerHybridGetter("__brand", &GPURenderPassEncoder::getBrand, this); - registerHybridMethod("setViewport", &GPURenderPassEncoder::setViewport, - this); - registerHybridMethod("setScissorRect", - &GPURenderPassEncoder::setScissorRect, this); - registerHybridMethod("setBlendConstant", - &GPURenderPassEncoder::setBlendConstant, this); - registerHybridMethod("setStencilReference", - &GPURenderPassEncoder::setStencilReference, this); - registerHybridMethod("beginOcclusionQuery", - &GPURenderPassEncoder::beginOcclusionQuery, this); - registerHybridMethod("endOcclusionQuery", - &GPURenderPassEncoder::endOcclusionQuery, this); - registerHybridMethod("executeBundles", - &GPURenderPassEncoder::executeBundles, this); - registerHybridMethod("end", &GPURenderPassEncoder::end, this); - registerHybridMethod("pushDebugGroup", - &GPURenderPassEncoder::pushDebugGroup, this); - registerHybridMethod("popDebugGroup", &GPURenderPassEncoder::popDebugGroup, - this); - registerHybridMethod("insertDebugMarker", - &GPURenderPassEncoder::insertDebugMarker, this); - registerHybridMethod("setBindGroup", &GPURenderPassEncoder::setBindGroup, - this); - registerHybridMethod("setPipeline", &GPURenderPassEncoder::setPipeline, - this); - registerHybridMethod("setIndexBuffer", - &GPURenderPassEncoder::setIndexBuffer, this); - registerHybridMethod("setVertexBuffer", - &GPURenderPassEncoder::setVertexBuffer, this); - registerHybridMethod("draw", &GPURenderPassEncoder::draw, this); - registerHybridMethod("drawIndexed", &GPURenderPassEncoder::drawIndexed, - this); - registerHybridMethod("drawIndirect", &GPURenderPassEncoder::drawIndirect, - this); - registerHybridMethod("drawIndexedIndirect", - &GPURenderPassEncoder::drawIndexedIndirect, this); - - registerHybridGetter("label", &GPURenderPassEncoder::getLabel, this); - registerHybridSetter("label", &GPURenderPassEncoder::setLabel, this); + static void definePrototype(jsi::Runtime &runtime, jsi::Object &prototype) { + installGetter(runtime, prototype, "__brand", + &GPURenderPassEncoder::getBrand); + installMethod(runtime, prototype, "setViewport", + &GPURenderPassEncoder::setViewport); + installMethod(runtime, prototype, "setScissorRect", + &GPURenderPassEncoder::setScissorRect); + installMethod(runtime, prototype, "setBlendConstant", + &GPURenderPassEncoder::setBlendConstant); + installMethod(runtime, prototype, "setStencilReference", + &GPURenderPassEncoder::setStencilReference); + installMethod(runtime, prototype, "beginOcclusionQuery", + &GPURenderPassEncoder::beginOcclusionQuery); + installMethod(runtime, prototype, "endOcclusionQuery", + &GPURenderPassEncoder::endOcclusionQuery); + installMethod(runtime, prototype, "executeBundles", + &GPURenderPassEncoder::executeBundles); + installMethod(runtime, prototype, "end", &GPURenderPassEncoder::end); + installMethod(runtime, prototype, "pushDebugGroup", + &GPURenderPassEncoder::pushDebugGroup); + installMethod(runtime, prototype, "popDebugGroup", + &GPURenderPassEncoder::popDebugGroup); + installMethod(runtime, prototype, "insertDebugMarker", + &GPURenderPassEncoder::insertDebugMarker); + installMethod(runtime, prototype, "setBindGroup", + &GPURenderPassEncoder::setBindGroup); + installMethod(runtime, prototype, "setPipeline", + &GPURenderPassEncoder::setPipeline); + installMethod(runtime, prototype, "setIndexBuffer", + &GPURenderPassEncoder::setIndexBuffer); + installMethod(runtime, prototype, "setVertexBuffer", + &GPURenderPassEncoder::setVertexBuffer); + installMethod(runtime, prototype, "draw", &GPURenderPassEncoder::draw); + installMethod(runtime, prototype, "drawIndexed", + &GPURenderPassEncoder::drawIndexed); + installMethod(runtime, prototype, "drawIndirect", + &GPURenderPassEncoder::drawIndirect); + installMethod(runtime, prototype, "drawIndexedIndirect", + &GPURenderPassEncoder::drawIndexedIndirect); + installGetterSetter(runtime, prototype, "label", + &GPURenderPassEncoder::getLabel, + &GPURenderPassEncoder::setLabel); } inline const wgpu::RenderPassEncoder get() { return _instance; } diff --git a/packages/webgpu/cpp/rnwgpu/api/GPURenderPipeline.h b/packages/webgpu/cpp/rnwgpu/api/GPURenderPipeline.h index a52a91f43..e893324da 100644 --- a/packages/webgpu/cpp/rnwgpu/api/GPURenderPipeline.h +++ b/packages/webgpu/cpp/rnwgpu/api/GPURenderPipeline.h @@ -5,7 +5,7 @@ #include "Unions.h" -#include "RNFHybridObject.h" +#include "RNFNativeObject.h" #include "webgpu/webgpu_cpp.h" @@ -14,14 +14,17 @@ namespace rnwgpu { namespace m = margelo; +namespace jsi = facebook::jsi; -class GPURenderPipeline : public m::HybridObject { +class GPURenderPipeline : public m::NativeObject { public: + static constexpr const char *CLASS_NAME = "GPURenderPipeline"; + explicit GPURenderPipeline(wgpu::RenderPipeline instance, std::string label) - : HybridObject("GPURenderPipeline"), _instance(instance), _label(label) {} + : NativeObject(CLASS_NAME), _instance(instance), _label(label) {} public: - std::string getBrand() { return _name; } + std::string getBrand() { return CLASS_NAME; } std::shared_ptr getBindGroupLayout(uint32_t index); @@ -31,13 +34,13 @@ class GPURenderPipeline : public m::HybridObject { _instance.SetLabel(_label.c_str()); } - void loadHybridMethods() override { - registerHybridGetter("__brand", &GPURenderPipeline::getBrand, this); - registerHybridMethod("getBindGroupLayout", - &GPURenderPipeline::getBindGroupLayout, this); - - registerHybridGetter("label", &GPURenderPipeline::getLabel, this); - registerHybridSetter("label", &GPURenderPipeline::setLabel, this); + static void definePrototype(jsi::Runtime &runtime, jsi::Object &prototype) { + installGetter(runtime, prototype, "__brand", &GPURenderPipeline::getBrand); + installMethod(runtime, prototype, "getBindGroupLayout", + &GPURenderPipeline::getBindGroupLayout); + installGetterSetter(runtime, prototype, "label", + &GPURenderPipeline::getLabel, + &GPURenderPipeline::setLabel); } inline const wgpu::RenderPipeline get() { return _instance; } diff --git a/packages/webgpu/cpp/rnwgpu/api/GPUSampler.h b/packages/webgpu/cpp/rnwgpu/api/GPUSampler.h index dd88ae866..a076317ac 100644 --- a/packages/webgpu/cpp/rnwgpu/api/GPUSampler.h +++ b/packages/webgpu/cpp/rnwgpu/api/GPUSampler.h @@ -4,21 +4,24 @@ #include "Unions.h" -#include "RNFHybridObject.h" +#include "RNFNativeObject.h" #include "webgpu/webgpu_cpp.h" namespace rnwgpu { namespace m = margelo; +namespace jsi = facebook::jsi; -class GPUSampler : public m::HybridObject { +class GPUSampler : public m::NativeObject { public: + static constexpr const char *CLASS_NAME = "GPUSampler"; + explicit GPUSampler(wgpu::Sampler instance, std::string label) - : HybridObject("GPUSampler"), _instance(instance), _label(label) {} + : NativeObject(CLASS_NAME), _instance(instance), _label(label) {} public: - std::string getBrand() { return _name; } + std::string getBrand() { return CLASS_NAME; } std::string getLabel() { return _label; } void setLabel(const std::string &label) { @@ -26,11 +29,10 @@ class GPUSampler : public m::HybridObject { _instance.SetLabel(_label.c_str()); } - void loadHybridMethods() override { - registerHybridGetter("__brand", &GPUSampler::getBrand, this); - - registerHybridGetter("label", &GPUSampler::getLabel, this); - registerHybridSetter("label", &GPUSampler::setLabel, this); + static void definePrototype(jsi::Runtime &runtime, jsi::Object &prototype) { + installGetter(runtime, prototype, "__brand", &GPUSampler::getBrand); + installGetterSetter(runtime, prototype, "label", &GPUSampler::getLabel, + &GPUSampler::setLabel); } inline const wgpu::Sampler get() { return _instance; } diff --git a/packages/webgpu/cpp/rnwgpu/api/GPUShaderModule.cpp b/packages/webgpu/cpp/rnwgpu/api/GPUShaderModule.cpp index 81aac5c5e..a49450dc5 100644 --- a/packages/webgpu/cpp/rnwgpu/api/GPUShaderModule.cpp +++ b/packages/webgpu/cpp/rnwgpu/api/GPUShaderModule.cpp @@ -28,7 +28,7 @@ async::AsyncTaskHandle GPUShaderModule::getCompilationInfo() { result->_messages.reserve(compilationInfo->messageCount); for (size_t i = 0; i < compilationInfo->messageCount; ++i) { const auto &wgpuMessage = compilationInfo->messages[i]; - GPUCompilationMessage message; + GPUCompilationMessageData message; message.message = wgpuMessage.message.length ? wgpuMessage.message.data : ""; message.type = wgpuMessage.type; diff --git a/packages/webgpu/cpp/rnwgpu/api/GPUShaderModule.h b/packages/webgpu/cpp/rnwgpu/api/GPUShaderModule.h index bc5be9e22..256e69faf 100644 --- a/packages/webgpu/cpp/rnwgpu/api/GPUShaderModule.h +++ b/packages/webgpu/cpp/rnwgpu/api/GPUShaderModule.h @@ -5,7 +5,7 @@ #include "Unions.h" -#include "RNFHybridObject.h" +#include "RNFNativeObject.h" #include "rnwgpu/async/AsyncRunner.h" #include "rnwgpu/async/AsyncTaskHandle.h" @@ -17,17 +17,20 @@ namespace rnwgpu { namespace m = margelo; +namespace jsi = facebook::jsi; -class GPUShaderModule : public m::HybridObject { +class GPUShaderModule : public m::NativeObject { public: + static constexpr const char *CLASS_NAME = "GPUShaderModule"; + explicit GPUShaderModule(wgpu::ShaderModule instance, std::shared_ptr async, std::string label) - : HybridObject("GPUShaderModule"), _instance(instance), _async(async), + : NativeObject(CLASS_NAME), _instance(instance), _async(async), _label(label) {} public: - std::string getBrand() { return _name; } + std::string getBrand() { return CLASS_NAME; } async::AsyncTaskHandle getCompilationInfo(); @@ -37,13 +40,12 @@ class GPUShaderModule : public m::HybridObject { _instance.SetLabel(_label.c_str()); } - void loadHybridMethods() override { - registerHybridGetter("__brand", &GPUShaderModule::getBrand, this); - registerHybridMethod("getCompilationInfo", - &GPUShaderModule::getCompilationInfo, this); - - registerHybridGetter("label", &GPUShaderModule::getLabel, this); - registerHybridSetter("label", &GPUShaderModule::setLabel, this); + static void definePrototype(jsi::Runtime &runtime, jsi::Object &prototype) { + installGetter(runtime, prototype, "__brand", &GPUShaderModule::getBrand); + installMethod(runtime, prototype, "getCompilationInfo", + &GPUShaderModule::getCompilationInfo); + installGetterSetter(runtime, prototype, "label", &GPUShaderModule::getLabel, + &GPUShaderModule::setLabel); } inline const wgpu::ShaderModule get() { return _instance; } diff --git a/packages/webgpu/cpp/rnwgpu/api/GPUSupportedLimits.h b/packages/webgpu/cpp/rnwgpu/api/GPUSupportedLimits.h index e0ecff61c..53161b21b 100644 --- a/packages/webgpu/cpp/rnwgpu/api/GPUSupportedLimits.h +++ b/packages/webgpu/cpp/rnwgpu/api/GPUSupportedLimits.h @@ -4,21 +4,24 @@ #include "Unions.h" -#include "RNFHybridObject.h" +#include "RNFNativeObject.h" #include "webgpu/webgpu_cpp.h" namespace rnwgpu { namespace m = margelo; +namespace jsi = facebook::jsi; -class GPUSupportedLimits : public m::HybridObject { +class GPUSupportedLimits : public m::NativeObject { public: + static constexpr const char *CLASS_NAME = "GPUSupportedLimits"; + explicit GPUSupportedLimits(wgpu::Limits instance) - : HybridObject("GPUSupportedLimits"), _instance(instance) {} + : NativeObject(CLASS_NAME), _instance(instance) {} public: - std::string getBrand() { return _name; } + std::string getBrand() { return CLASS_NAME; } double getMaxTextureDimension1D(); double getMaxTextureDimension2D(); @@ -52,94 +55,72 @@ class GPUSupportedLimits : public m::HybridObject { double getMaxComputeWorkgroupSizeZ(); double getMaxComputeWorkgroupsPerDimension(); - void loadHybridMethods() override { - registerHybridGetter("__brand", &GPUSupportedLimits::getBrand, this); - - registerHybridGetter("maxTextureDimension1D", - &GPUSupportedLimits::getMaxTextureDimension1D, this); - registerHybridGetter("maxTextureDimension2D", - &GPUSupportedLimits::getMaxTextureDimension2D, this); - registerHybridGetter("maxTextureDimension3D", - &GPUSupportedLimits::getMaxTextureDimension3D, this); - registerHybridGetter("maxTextureArrayLayers", - &GPUSupportedLimits::getMaxTextureArrayLayers, this); - registerHybridGetter("maxBindGroups", &GPUSupportedLimits::getMaxBindGroups, - this); - registerHybridGetter("maxBindGroupsPlusVertexBuffers", - &GPUSupportedLimits::getMaxBindGroupsPlusVertexBuffers, - this); - registerHybridGetter("maxBindingsPerBindGroup", - &GPUSupportedLimits::getMaxBindingsPerBindGroup, this); - registerHybridGetter( - "maxDynamicUniformBuffersPerPipelineLayout", - &GPUSupportedLimits::getMaxDynamicUniformBuffersPerPipelineLayout, - this); - registerHybridGetter( - "maxDynamicStorageBuffersPerPipelineLayout", - &GPUSupportedLimits::getMaxDynamicStorageBuffersPerPipelineLayout, - this); - registerHybridGetter( - "maxSampledTexturesPerShaderStage", - &GPUSupportedLimits::getMaxSampledTexturesPerShaderStage, this); - registerHybridGetter("maxSamplersPerShaderStage", - &GPUSupportedLimits::getMaxSamplersPerShaderStage, - this); - registerHybridGetter( - "maxStorageBuffersPerShaderStage", - &GPUSupportedLimits::getMaxStorageBuffersPerShaderStage, this); - registerHybridGetter( - "maxStorageTexturesPerShaderStage", - &GPUSupportedLimits::getMaxStorageTexturesPerShaderStage, this); - registerHybridGetter( - "maxUniformBuffersPerShaderStage", - &GPUSupportedLimits::getMaxUniformBuffersPerShaderStage, this); - registerHybridGetter("maxUniformBufferBindingSize", - &GPUSupportedLimits::getMaxUniformBufferBindingSize, - this); - registerHybridGetter("maxStorageBufferBindingSize", - &GPUSupportedLimits::getMaxStorageBufferBindingSize, - this); - registerHybridGetter( - "minUniformBufferOffsetAlignment", - &GPUSupportedLimits::getMinUniformBufferOffsetAlignment, this); - registerHybridGetter( - "minStorageBufferOffsetAlignment", - &GPUSupportedLimits::getMinStorageBufferOffsetAlignment, this); - registerHybridGetter("maxVertexBuffers", - &GPUSupportedLimits::getMaxVertexBuffers, this); - registerHybridGetter("maxBufferSize", &GPUSupportedLimits::getMaxBufferSize, - this); - registerHybridGetter("maxVertexAttributes", - &GPUSupportedLimits::getMaxVertexAttributes, this); - registerHybridGetter("maxVertexBufferArrayStride", - &GPUSupportedLimits::getMaxVertexBufferArrayStride, - this); - registerHybridGetter("maxInterStageShaderVariables", - &GPUSupportedLimits::getMaxInterStageShaderVariables, - this); - registerHybridGetter("maxColorAttachments", - &GPUSupportedLimits::getMaxColorAttachments, this); - registerHybridGetter( - "maxColorAttachmentBytesPerSample", - &GPUSupportedLimits::getMaxColorAttachmentBytesPerSample, this); - registerHybridGetter("maxComputeWorkgroupStorageSize", - &GPUSupportedLimits::getMaxComputeWorkgroupStorageSize, - this); - registerHybridGetter( - "maxComputeInvocationsPerWorkgroup", - &GPUSupportedLimits::getMaxComputeInvocationsPerWorkgroup, this); - registerHybridGetter("maxComputeWorkgroupSizeX", - &GPUSupportedLimits::getMaxComputeWorkgroupSizeX, - this); - registerHybridGetter("maxComputeWorkgroupSizeY", - &GPUSupportedLimits::getMaxComputeWorkgroupSizeY, - this); - registerHybridGetter("maxComputeWorkgroupSizeZ", - &GPUSupportedLimits::getMaxComputeWorkgroupSizeZ, - this); - registerHybridGetter( - "maxComputeWorkgroupsPerDimension", - &GPUSupportedLimits::getMaxComputeWorkgroupsPerDimension, this); + static void definePrototype(jsi::Runtime &runtime, jsi::Object &prototype) { + installGetter(runtime, prototype, "__brand", &GPUSupportedLimits::getBrand); + installGetter(runtime, prototype, "maxTextureDimension1D", + &GPUSupportedLimits::getMaxTextureDimension1D); + installGetter(runtime, prototype, "maxTextureDimension2D", + &GPUSupportedLimits::getMaxTextureDimension2D); + installGetter(runtime, prototype, "maxTextureDimension3D", + &GPUSupportedLimits::getMaxTextureDimension3D); + installGetter(runtime, prototype, "maxTextureArrayLayers", + &GPUSupportedLimits::getMaxTextureArrayLayers); + installGetter(runtime, prototype, "maxBindGroups", + &GPUSupportedLimits::getMaxBindGroups); + installGetter(runtime, prototype, "maxBindGroupsPlusVertexBuffers", + &GPUSupportedLimits::getMaxBindGroupsPlusVertexBuffers); + installGetter(runtime, prototype, "maxBindingsPerBindGroup", + &GPUSupportedLimits::getMaxBindingsPerBindGroup); + installGetter( + runtime, prototype, "maxDynamicUniformBuffersPerPipelineLayout", + &GPUSupportedLimits::getMaxDynamicUniformBuffersPerPipelineLayout); + installGetter( + runtime, prototype, "maxDynamicStorageBuffersPerPipelineLayout", + &GPUSupportedLimits::getMaxDynamicStorageBuffersPerPipelineLayout); + installGetter(runtime, prototype, "maxSampledTexturesPerShaderStage", + &GPUSupportedLimits::getMaxSampledTexturesPerShaderStage); + installGetter(runtime, prototype, "maxSamplersPerShaderStage", + &GPUSupportedLimits::getMaxSamplersPerShaderStage); + installGetter(runtime, prototype, "maxStorageBuffersPerShaderStage", + &GPUSupportedLimits::getMaxStorageBuffersPerShaderStage); + installGetter(runtime, prototype, "maxStorageTexturesPerShaderStage", + &GPUSupportedLimits::getMaxStorageTexturesPerShaderStage); + installGetter(runtime, prototype, "maxUniformBuffersPerShaderStage", + &GPUSupportedLimits::getMaxUniformBuffersPerShaderStage); + installGetter(runtime, prototype, "maxUniformBufferBindingSize", + &GPUSupportedLimits::getMaxUniformBufferBindingSize); + installGetter(runtime, prototype, "maxStorageBufferBindingSize", + &GPUSupportedLimits::getMaxStorageBufferBindingSize); + installGetter(runtime, prototype, "minUniformBufferOffsetAlignment", + &GPUSupportedLimits::getMinUniformBufferOffsetAlignment); + installGetter(runtime, prototype, "minStorageBufferOffsetAlignment", + &GPUSupportedLimits::getMinStorageBufferOffsetAlignment); + installGetter(runtime, prototype, "maxVertexBuffers", + &GPUSupportedLimits::getMaxVertexBuffers); + installGetter(runtime, prototype, "maxBufferSize", + &GPUSupportedLimits::getMaxBufferSize); + installGetter(runtime, prototype, "maxVertexAttributes", + &GPUSupportedLimits::getMaxVertexAttributes); + installGetter(runtime, prototype, "maxVertexBufferArrayStride", + &GPUSupportedLimits::getMaxVertexBufferArrayStride); + installGetter(runtime, prototype, "maxInterStageShaderVariables", + &GPUSupportedLimits::getMaxInterStageShaderVariables); + installGetter(runtime, prototype, "maxColorAttachments", + &GPUSupportedLimits::getMaxColorAttachments); + installGetter(runtime, prototype, "maxColorAttachmentBytesPerSample", + &GPUSupportedLimits::getMaxColorAttachmentBytesPerSample); + installGetter(runtime, prototype, "maxComputeWorkgroupStorageSize", + &GPUSupportedLimits::getMaxComputeWorkgroupStorageSize); + installGetter(runtime, prototype, "maxComputeInvocationsPerWorkgroup", + &GPUSupportedLimits::getMaxComputeInvocationsPerWorkgroup); + installGetter(runtime, prototype, "maxComputeWorkgroupSizeX", + &GPUSupportedLimits::getMaxComputeWorkgroupSizeX); + installGetter(runtime, prototype, "maxComputeWorkgroupSizeY", + &GPUSupportedLimits::getMaxComputeWorkgroupSizeY); + installGetter(runtime, prototype, "maxComputeWorkgroupSizeZ", + &GPUSupportedLimits::getMaxComputeWorkgroupSizeZ); + installGetter(runtime, prototype, "maxComputeWorkgroupsPerDimension", + &GPUSupportedLimits::getMaxComputeWorkgroupsPerDimension); } inline const wgpu::Limits get() { return _instance; } diff --git a/packages/webgpu/cpp/rnwgpu/api/GPUTexture.h b/packages/webgpu/cpp/rnwgpu/api/GPUTexture.h index 2d45b9633..7c0f1675f 100644 --- a/packages/webgpu/cpp/rnwgpu/api/GPUTexture.h +++ b/packages/webgpu/cpp/rnwgpu/api/GPUTexture.h @@ -6,7 +6,7 @@ #include "Unions.h" -#include "RNFHybridObject.h" +#include "RNFNativeObject.h" #include "webgpu/webgpu_cpp.h" @@ -16,14 +16,17 @@ namespace rnwgpu { namespace m = margelo; +namespace jsi = facebook::jsi; -class GPUTexture : public m::HybridObject { +class GPUTexture : public m::NativeObject { public: + static constexpr const char *CLASS_NAME = "GPUTexture"; + explicit GPUTexture(wgpu::Texture instance, std::string label) - : HybridObject("GPUTexture"), _instance(instance), _label(label) {} + : NativeObject(CLASS_NAME), _instance(instance), _label(label) {} public: - std::string getBrand() { return _name; } + std::string getBrand() { return CLASS_NAME; } std::shared_ptr createView( std::optional> descriptor); @@ -44,21 +47,23 @@ class GPUTexture : public m::HybridObject { _instance.SetLabel(_label.c_str()); } - void loadHybridMethods() override { - registerHybridGetter("__brand", &GPUTexture::getBrand, this); - registerHybridMethod("createView", &GPUTexture::createView, this); - registerHybridMethod("destroy", &GPUTexture::destroy, this); - registerHybridGetter("width", &GPUTexture::getWidth, this); - registerHybridGetter("height", &GPUTexture::getHeight, this); - registerHybridGetter("depthOrArrayLayers", - &GPUTexture::getDepthOrArrayLayers, this); - registerHybridGetter("mipLevelCount", &GPUTexture::getMipLevelCount, this); - registerHybridGetter("sampleCount", &GPUTexture::getSampleCount, this); - registerHybridGetter("dimension", &GPUTexture::getDimension, this); - registerHybridGetter("format", &GPUTexture::getFormat, this); - registerHybridGetter("usage", &GPUTexture::getUsage, this); - registerHybridGetter("label", &GPUTexture::getLabel, this); - registerHybridSetter("label", &GPUTexture::setLabel, this); + static void definePrototype(jsi::Runtime &runtime, jsi::Object &prototype) { + installGetter(runtime, prototype, "__brand", &GPUTexture::getBrand); + installMethod(runtime, prototype, "createView", &GPUTexture::createView); + installMethod(runtime, prototype, "destroy", &GPUTexture::destroy); + installGetter(runtime, prototype, "width", &GPUTexture::getWidth); + installGetter(runtime, prototype, "height", &GPUTexture::getHeight); + installGetter(runtime, prototype, "depthOrArrayLayers", + &GPUTexture::getDepthOrArrayLayers); + installGetter(runtime, prototype, "mipLevelCount", + &GPUTexture::getMipLevelCount); + installGetter(runtime, prototype, "sampleCount", + &GPUTexture::getSampleCount); + installGetter(runtime, prototype, "dimension", &GPUTexture::getDimension); + installGetter(runtime, prototype, "format", &GPUTexture::getFormat); + installGetter(runtime, prototype, "usage", &GPUTexture::getUsage); + installGetterSetter(runtime, prototype, "label", &GPUTexture::getLabel, + &GPUTexture::setLabel); } inline const wgpu::Texture get() { return _instance; } diff --git a/packages/webgpu/cpp/rnwgpu/api/GPUTextureView.h b/packages/webgpu/cpp/rnwgpu/api/GPUTextureView.h index 482c53c60..08134aa55 100644 --- a/packages/webgpu/cpp/rnwgpu/api/GPUTextureView.h +++ b/packages/webgpu/cpp/rnwgpu/api/GPUTextureView.h @@ -4,21 +4,24 @@ #include "Unions.h" -#include "RNFHybridObject.h" +#include "RNFNativeObject.h" #include "webgpu/webgpu_cpp.h" namespace rnwgpu { namespace m = margelo; +namespace jsi = facebook::jsi; -class GPUTextureView : public m::HybridObject { +class GPUTextureView : public m::NativeObject { public: + static constexpr const char *CLASS_NAME = "GPUTextureView"; + explicit GPUTextureView(wgpu::TextureView instance, std::string label) - : HybridObject("GPUTextureView"), _instance(instance), _label(label) {} + : NativeObject(CLASS_NAME), _instance(instance), _label(label) {} public: - std::string getBrand() { return _name; } + std::string getBrand() { return CLASS_NAME; } std::string getLabel() { return _label; } void setLabel(const std::string &label) { @@ -26,11 +29,10 @@ class GPUTextureView : public m::HybridObject { _instance.SetLabel(_label.c_str()); } - void loadHybridMethods() override { - registerHybridGetter("__brand", &GPUTextureView::getBrand, this); - - registerHybridGetter("label", &GPUTextureView::getLabel, this); - registerHybridSetter("label", &GPUTextureView::setLabel, this); + static void definePrototype(jsi::Runtime &runtime, jsi::Object &prototype) { + installGetter(runtime, prototype, "__brand", &GPUTextureView::getBrand); + installGetterSetter(runtime, prototype, "label", &GPUTextureView::getLabel, + &GPUTextureView::setLabel); } inline const wgpu::TextureView get() { return _instance; } diff --git a/packages/webgpu/cpp/rnwgpu/api/ImageBitmap.h b/packages/webgpu/cpp/rnwgpu/api/ImageBitmap.h index 6276c25ca..2f59c5109 100644 --- a/packages/webgpu/cpp/rnwgpu/api/ImageBitmap.h +++ b/packages/webgpu/cpp/rnwgpu/api/ImageBitmap.h @@ -5,14 +5,19 @@ #include "webgpu/webgpu_cpp.h" #include "PlatformContext.h" -#include "RNFHybridObject.h" +#include "RNFNativeObject.h" namespace rnwgpu { -class ImageBitmap : public margelo::HybridObject { +namespace m = margelo; +namespace jsi = facebook::jsi; + +class ImageBitmap : public m::NativeObject { public: + static constexpr const char *CLASS_NAME = "ImageBitmap"; + explicit ImageBitmap(ImageData &imageData) - : HybridObject("ImageBitmap"), _imageData(imageData) {} + : NativeObject(CLASS_NAME), _imageData(imageData) {} size_t getWidth() { return _imageData.width; } @@ -22,9 +27,9 @@ class ImageBitmap : public margelo::HybridObject { size_t getSize() { return _imageData.data.size(); } - void loadHybridMethods() override { - registerHybridGetter("width", &ImageBitmap::getWidth, this); - registerHybridGetter("height", &ImageBitmap::getHeight, this); + static void definePrototype(jsi::Runtime &runtime, jsi::Object &prototype) { + installGetter(runtime, prototype, "width", &ImageBitmap::getWidth); + installGetter(runtime, prototype, "height", &ImageBitmap::getHeight); } size_t getMemoryPressure() override { return getSize(); } diff --git a/packages/webgpu/cpp/rnwgpu/api/RNWebGPU.h b/packages/webgpu/cpp/rnwgpu/api/RNWebGPU.h index 9f6ea1f81..0df996ee2 100644 --- a/packages/webgpu/cpp/rnwgpu/api/RNWebGPU.h +++ b/packages/webgpu/cpp/rnwgpu/api/RNWebGPU.h @@ -3,6 +3,8 @@ #include #include +#include "RNFNativeObject.h" + #include "Canvas.h" #include "GPU.h" #include "GPUCanvasContext.h" @@ -12,6 +14,7 @@ namespace rnwgpu { namespace m = margelo; +namespace jsi = facebook::jsi; struct Blob { std::string blobId; @@ -21,11 +24,13 @@ struct Blob { std::string name; }; -class RNWebGPU : public m::HybridObject { +class RNWebGPU : public m::NativeObject { public: + static constexpr const char *CLASS_NAME = "RNWebGPU"; + explicit RNWebGPU(std::shared_ptr gpu, std::shared_ptr platformContext) - : HybridObject("RNWebGPU"), _gpu(gpu), _platformContext(platformContext) { + : NativeObject(CLASS_NAME), _gpu(gpu), _platformContext(platformContext) { } std::shared_ptr getGPU() { return _gpu; } @@ -57,14 +62,15 @@ class RNWebGPU : public m::HybridObject { nativeInfo.height); } - void loadHybridMethods() override { - registerHybridGetter("fabric", &RNWebGPU::getFabric, this); - registerHybridGetter("gpu", &RNWebGPU::getGPU, this); - registerHybridMethod("createImageBitmap", &RNWebGPU::createImageBitmap, - this); - registerHybridMethod("getNativeSurface", &RNWebGPU::getNativeSurface, this); - registerHybridMethod("MakeWebGPUCanvasContext", - &RNWebGPU::MakeWebGPUCanvasContext, this); + static void definePrototype(jsi::Runtime &runtime, jsi::Object &prototype) { + installGetter(runtime, prototype, "fabric", &RNWebGPU::getFabric); + installGetter(runtime, prototype, "gpu", &RNWebGPU::getGPU); + installMethod(runtime, prototype, "createImageBitmap", + &RNWebGPU::createImageBitmap); + installMethod(runtime, prototype, "getNativeSurface", + &RNWebGPU::getNativeSurface); + installMethod(runtime, prototype, "MakeWebGPUCanvasContext", + &RNWebGPU::MakeWebGPUCanvasContext); } private: diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBindGroupEntry.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBindGroupEntry.h index 8931de0bd..665def3a7 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBindGroupEntry.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBindGroupEntry.h @@ -9,7 +9,6 @@ #include "GPUExternalTexture.h" #include "GPUSampler.h" #include "GPUTextureView.h" -#include "RNFHybridObject.h" #include "RNFJSIConverter.h" #include "WGPULogger.h" @@ -45,11 +44,11 @@ template <> struct JSIConverter> { auto prop = value.getProperty(runtime, "resource"); if (prop.isObject()) { auto obj = prop.getObject(runtime); - if (obj.isHostObject(runtime)) { - result->sampler = obj.getHostObject(runtime); - } else if (obj.isHostObject(runtime)) { + if (obj.hasNativeState(runtime)) { + result->sampler = obj.getNativeState(runtime); + } else if (obj.hasNativeState(runtime)) { result->textureView = - obj.getHostObject(runtime); + obj.getNativeState(runtime); } else { result->buffer = JSIConverter< std::shared_ptr>::fromJSI(runtime, diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBufferUsage.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBufferUsage.h index f833c1258..686cdc24c 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBufferUsage.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBufferUsage.h @@ -1,17 +1,20 @@ #pragma once #include -#include +#include #include "webgpu/webgpu_cpp.h" namespace rnwgpu { namespace m = margelo; +namespace jsi = facebook::jsi; -class GPUBufferUsage : public m::HybridObject { +class GPUBufferUsage : public m::NativeObject { public: - GPUBufferUsage() : HybridObject("GPUBufferUsage") {} + static constexpr const char *CLASS_NAME = "GPUBufferUsage"; + + GPUBufferUsage() : NativeObject(CLASS_NAME) {} public: double MapRead() { return static_cast(wgpu::BufferUsage::MapRead); } @@ -27,17 +30,18 @@ class GPUBufferUsage : public m::HybridObject { return static_cast(wgpu::BufferUsage::QueryResolve); } - void loadHybridMethods() override { - registerHybridGetter("MAP_READ", &GPUBufferUsage::MapRead, this); - registerHybridGetter("MAP_WRITE", &GPUBufferUsage::MapWrite, this); - registerHybridGetter("COPY_SRC", &GPUBufferUsage::CopySrc, this); - registerHybridGetter("COPY_DST", &GPUBufferUsage::CopyDst, this); - registerHybridGetter("INDEX", &GPUBufferUsage::Index, this); - registerHybridGetter("VERTEX", &GPUBufferUsage::Vertex, this); - registerHybridGetter("UNIFORM", &GPUBufferUsage::Uniform, this); - registerHybridGetter("STORAGE", &GPUBufferUsage::Storage, this); - registerHybridGetter("INDIRECT", &GPUBufferUsage::Indirect, this); - registerHybridGetter("QUERY_RESOLVE", &GPUBufferUsage::QueryResolve, this); + static void definePrototype(jsi::Runtime &runtime, jsi::Object &prototype) { + installGetter(runtime, prototype, "MAP_READ", &GPUBufferUsage::MapRead); + installGetter(runtime, prototype, "MAP_WRITE", &GPUBufferUsage::MapWrite); + installGetter(runtime, prototype, "COPY_SRC", &GPUBufferUsage::CopySrc); + installGetter(runtime, prototype, "COPY_DST", &GPUBufferUsage::CopyDst); + installGetter(runtime, prototype, "INDEX", &GPUBufferUsage::Index); + installGetter(runtime, prototype, "VERTEX", &GPUBufferUsage::Vertex); + installGetter(runtime, prototype, "UNIFORM", &GPUBufferUsage::Uniform); + installGetter(runtime, prototype, "STORAGE", &GPUBufferUsage::Storage); + installGetter(runtime, prototype, "INDIRECT", &GPUBufferUsage::Indirect); + installGetter(runtime, prototype, "QUERY_RESOLVE", + &GPUBufferUsage::QueryResolve); } }; -} // namespace rnwgpu \ No newline at end of file +} // namespace rnwgpu diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUColorWrite.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUColorWrite.h index 569b417c9..db163477b 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUColorWrite.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUColorWrite.h @@ -1,17 +1,20 @@ #pragma once #include -#include +#include #include "webgpu/webgpu_cpp.h" namespace rnwgpu { namespace m = margelo; +namespace jsi = facebook::jsi; -class GPUColorWrite : public m::HybridObject { +class GPUColorWrite : public m::NativeObject { public: - GPUColorWrite() : HybridObject("GPUColorWrite") {} + static constexpr const char *CLASS_NAME = "GPUColorWrite"; + + GPUColorWrite() : NativeObject(CLASS_NAME) {} public: double Red() { return static_cast(wgpu::ColorWriteMask::Red); } @@ -20,12 +23,12 @@ class GPUColorWrite : public m::HybridObject { double Alpha() { return static_cast(wgpu::ColorWriteMask::Alpha); } double All() { return static_cast(wgpu::ColorWriteMask::All); } - void loadHybridMethods() override { - registerHybridGetter("RED", &GPUColorWrite::Red, this); - registerHybridGetter("GREEN", &GPUColorWrite::Green, this); - registerHybridGetter("BLUE", &GPUColorWrite::Blue, this); - registerHybridGetter("ALPHA", &GPUColorWrite::Alpha, this); - registerHybridGetter("ALL", &GPUColorWrite::All, this); + static void definePrototype(jsi::Runtime &runtime, jsi::Object &prototype) { + installGetter(runtime, prototype, "RED", &GPUColorWrite::Red); + installGetter(runtime, prototype, "GREEN", &GPUColorWrite::Green); + installGetter(runtime, prototype, "BLUE", &GPUColorWrite::Blue); + installGetter(runtime, prototype, "ALPHA", &GPUColorWrite::Alpha); + installGetter(runtime, prototype, "ALL", &GPUColorWrite::All); } }; -} // namespace rnwgpu \ No newline at end of file +} // namespace rnwgpu diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUMapMode.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUMapMode.h index dce03b5d0..9e81cf6a4 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUMapMode.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUMapMode.h @@ -1,25 +1,28 @@ #pragma once #include -#include +#include #include "webgpu/webgpu_cpp.h" namespace rnwgpu { namespace m = margelo; +namespace jsi = facebook::jsi; -class GPUMapMode : public m::HybridObject { +class GPUMapMode : public m::NativeObject { public: - GPUMapMode() : HybridObject("GPUMapMode") {} + static constexpr const char *CLASS_NAME = "GPUMapMode"; + + GPUMapMode() : NativeObject(CLASS_NAME) {} public: double Read() { return static_cast(wgpu::MapMode::Read); } double Write() { return static_cast(wgpu::MapMode::Write); } - void loadHybridMethods() override { - registerHybridGetter("READ", &GPUMapMode::Read, this); - registerHybridGetter("WRITE", &GPUMapMode::Write, this); + static void definePrototype(jsi::Runtime &runtime, jsi::Object &prototype) { + installGetter(runtime, prototype, "READ", &GPUMapMode::Read); + installGetter(runtime, prototype, "WRITE", &GPUMapMode::Write); } }; -} // namespace rnwgpu \ No newline at end of file +} // namespace rnwgpu diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUShaderStage.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUShaderStage.h index 4bf78bad7..33d4e2ae1 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUShaderStage.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUShaderStage.h @@ -1,27 +1,30 @@ #pragma once #include -#include +#include #include "webgpu/webgpu_cpp.h" namespace rnwgpu { namespace m = margelo; +namespace jsi = facebook::jsi; -class GPUShaderStage : public m::HybridObject { +class GPUShaderStage : public m::NativeObject { public: - GPUShaderStage() : HybridObject("GPUShaderStage") {} + static constexpr const char *CLASS_NAME = "GPUShaderStage"; + + GPUShaderStage() : NativeObject(CLASS_NAME) {} public: double Vertex() { return static_cast(wgpu::ShaderStage::Vertex); } double Fragment() { return static_cast(wgpu::ShaderStage::Fragment); } double Compute() { return static_cast(wgpu::ShaderStage::Compute); } - void loadHybridMethods() override { - registerHybridGetter("VERTEX", &GPUShaderStage::Vertex, this); - registerHybridGetter("FRAGMENT", &GPUShaderStage::Fragment, this); - registerHybridGetter("COMPUTE", &GPUShaderStage::Compute, this); + static void definePrototype(jsi::Runtime &runtime, jsi::Object &prototype) { + installGetter(runtime, prototype, "VERTEX", &GPUShaderStage::Vertex); + installGetter(runtime, prototype, "FRAGMENT", &GPUShaderStage::Fragment); + installGetter(runtime, prototype, "COMPUTE", &GPUShaderStage::Compute); } }; -} // namespace rnwgpu \ No newline at end of file +} // namespace rnwgpu diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUTextureUsage.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUTextureUsage.h index 563b6200f..dd2491af2 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUTextureUsage.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUTextureUsage.h @@ -1,17 +1,20 @@ #pragma once #include -#include +#include #include "webgpu/webgpu_cpp.h" namespace rnwgpu { namespace m = margelo; +namespace jsi = facebook::jsi; -class GPUTextureUsage : public m::HybridObject { +class GPUTextureUsage : public m::NativeObject { public: - GPUTextureUsage() : HybridObject("GPUTextureUsage") {} + static constexpr const char *CLASS_NAME = "GPUTextureUsage"; + + GPUTextureUsage() : NativeObject(CLASS_NAME) {} public: double CopySrc() { return static_cast(wgpu::TextureUsage::CopySrc); } @@ -26,15 +29,15 @@ class GPUTextureUsage : public m::HybridObject { return static_cast(wgpu::TextureUsage::RenderAttachment); } - void loadHybridMethods() override { - registerHybridGetter("COPY_SRC", &GPUTextureUsage::CopySrc, this); - registerHybridGetter("COPY_DST", &GPUTextureUsage::CopyDst, this); - registerHybridGetter("TEXTURE_BINDING", &GPUTextureUsage::TextureBinding, - this); - registerHybridGetter("STORAGE_BINDING", &GPUTextureUsage::StorageBinding, - this); - registerHybridGetter("RENDER_ATTACHMENT", - &GPUTextureUsage::RenderAttachment, this); + static void definePrototype(jsi::Runtime &runtime, jsi::Object &prototype) { + installGetter(runtime, prototype, "COPY_SRC", &GPUTextureUsage::CopySrc); + installGetter(runtime, prototype, "COPY_DST", &GPUTextureUsage::CopyDst); + installGetter(runtime, prototype, "TEXTURE_BINDING", + &GPUTextureUsage::TextureBinding); + installGetter(runtime, prototype, "STORAGE_BINDING", + &GPUTextureUsage::StorageBinding); + installGetter(runtime, prototype, "RENDER_ATTACHMENT", + &GPUTextureUsage::RenderAttachment); } }; -} // namespace rnwgpu \ No newline at end of file +} // namespace rnwgpu From 2f9060ff1e077b7c8b50500577af42fbc79740fc Mon Sep 17 00:00:00 2001 From: William Candillon Date: Mon, 12 Jan 2026 16:12:16 +0100 Subject: [PATCH 04/23] :wrench: --- packages/webgpu/cpp/jsi/RNFNativeObject.h | 47 +++++++++++++------ packages/webgpu/cpp/rnwgpu/api/Canvas.h | 3 +- packages/webgpu/cpp/rnwgpu/api/GPU.h | 3 +- packages/webgpu/cpp/rnwgpu/api/GPUAdapter.h | 3 +- .../webgpu/cpp/rnwgpu/api/GPUAdapterInfo.h | 3 +- packages/webgpu/cpp/rnwgpu/api/GPUBindGroup.h | 3 +- .../cpp/rnwgpu/api/GPUBindGroupLayout.h | 3 +- packages/webgpu/cpp/rnwgpu/api/GPUBuffer.h | 3 +- .../webgpu/cpp/rnwgpu/api/GPUCanvasContext.h | 3 +- .../webgpu/cpp/rnwgpu/api/GPUCommandBuffer.h | 3 +- .../webgpu/cpp/rnwgpu/api/GPUCommandEncoder.h | 3 +- .../cpp/rnwgpu/api/GPUCompilationInfo.h | 3 +- .../cpp/rnwgpu/api/GPUCompilationMessage.h | 3 +- .../cpp/rnwgpu/api/GPUComputePassEncoder.h | 3 +- .../cpp/rnwgpu/api/GPUComputePipeline.h | 3 +- packages/webgpu/cpp/rnwgpu/api/GPUDevice.h | 3 +- .../webgpu/cpp/rnwgpu/api/GPUDeviceLostInfo.h | 3 +- .../cpp/rnwgpu/api/GPUExternalTexture.h | 3 +- .../webgpu/cpp/rnwgpu/api/GPUPipelineLayout.h | 3 +- packages/webgpu/cpp/rnwgpu/api/GPUQuerySet.h | 3 +- packages/webgpu/cpp/rnwgpu/api/GPUQueue.h | 3 +- .../webgpu/cpp/rnwgpu/api/GPURenderBundle.h | 3 +- .../cpp/rnwgpu/api/GPURenderBundleEncoder.h | 3 +- .../cpp/rnwgpu/api/GPURenderPassEncoder.h | 3 +- .../webgpu/cpp/rnwgpu/api/GPURenderPipeline.h | 3 +- packages/webgpu/cpp/rnwgpu/api/GPUSampler.h | 3 +- .../webgpu/cpp/rnwgpu/api/GPUShaderModule.h | 3 +- .../cpp/rnwgpu/api/GPUSupportedLimits.h | 3 +- packages/webgpu/cpp/rnwgpu/api/GPUTexture.h | 3 +- .../webgpu/cpp/rnwgpu/api/GPUTextureView.h | 3 +- packages/webgpu/cpp/rnwgpu/api/ImageBitmap.h | 3 +- packages/webgpu/cpp/rnwgpu/api/RNWebGPU.h | 3 +- .../api/descriptors/GPUBindGroupDescriptor.h | 1 - .../api/descriptors/GPUBindGroupEntry.h | 1 - .../GPUBindGroupLayoutDescriptor.h | 1 - .../api/descriptors/GPUBindGroupLayoutEntry.h | 1 - .../api/descriptors/GPUBlendComponent.h | 1 - .../rnwgpu/api/descriptors/GPUBlendState.h | 1 - .../rnwgpu/api/descriptors/GPUBufferBinding.h | 1 - .../api/descriptors/GPUBufferBindingLayout.h | 1 - .../api/descriptors/GPUBufferDescriptor.h | 1 - .../rnwgpu/api/descriptors/GPUBufferUsage.h | 3 +- .../api/descriptors/GPUCanvasConfiguration.h | 1 - .../cpp/rnwgpu/api/descriptors/GPUColor.h | 1 - .../api/descriptors/GPUColorTargetState.h | 1 - .../rnwgpu/api/descriptors/GPUColorWrite.h | 3 +- .../descriptors/GPUCommandBufferDescriptor.h | 1 - .../descriptors/GPUCommandEncoderDescriptor.h | 1 - .../descriptors/GPUComputePassDescriptor.h | 1 - .../GPUComputePassTimestampWrites.h | 1 - .../GPUComputePipelineDescriptor.h | 1 - .../api/descriptors/GPUDepthStencilState.h | 1 - .../api/descriptors/GPUDeviceDescriptor.h | 1 - .../GPUExternalTextureBindingLayout.h | 1 - .../GPUExternalTextureDescriptor.h | 1 - .../rnwgpu/api/descriptors/GPUFragmentState.h | 1 - .../api/descriptors/GPUImageCopyBuffer.h | 1 - .../descriptors/GPUImageCopyExternalImage.h | 1 - .../api/descriptors/GPUImageCopyTexture.h | 1 - .../descriptors/GPUImageCopyTextureTagged.h | 1 - .../api/descriptors/GPUImageDataLayout.h | 1 - .../cpp/rnwgpu/api/descriptors/GPUMapMode.h | 3 +- .../api/descriptors/GPUMultisampleState.h | 1 - .../descriptors/GPUPipelineLayoutDescriptor.h | 1 - .../api/descriptors/GPUPrimitiveState.h | 1 - .../api/descriptors/GPUProgrammableStage.h | 1 - .../api/descriptors/GPUQuerySetDescriptor.h | 1 - .../api/descriptors/GPUQueueDescriptor.h | 1 - .../descriptors/GPURenderBundleDescriptor.h | 1 - .../GPURenderBundleEncoderDescriptor.h | 1 - .../GPURenderPassColorAttachment.h | 1 - .../GPURenderPassDepthStencilAttachment.h | 1 - .../api/descriptors/GPURenderPassDescriptor.h | 1 - .../GPURenderPassTimestampWrites.h | 1 - .../descriptors/GPURenderPipelineDescriptor.h | 1 - .../descriptors/GPURequestAdapterOptions.h | 1 - .../api/descriptors/GPUSamplerBindingLayout.h | 1 - .../api/descriptors/GPUSamplerDescriptor.h | 1 - .../GPUShaderModuleCompilationHint.h | 1 - .../descriptors/GPUShaderModuleDescriptor.h | 1 - .../rnwgpu/api/descriptors/GPUShaderStage.h | 3 +- .../api/descriptors/GPUStencilFaceState.h | 1 - .../GPUStorageTextureBindingLayout.h | 1 - .../api/descriptors/GPUTextureBindingLayout.h | 1 - .../api/descriptors/GPUTextureDescriptor.h | 1 - .../rnwgpu/api/descriptors/GPUTextureUsage.h | 3 +- .../descriptors/GPUTextureViewDescriptor.h | 1 - .../descriptors/GPUUncapturedErrorEventInit.h | 1 - .../api/descriptors/GPUVertexAttribute.h | 1 - .../api/descriptors/GPUVertexBufferLayout.h | 1 - .../rnwgpu/api/descriptors/GPUVertexState.h | 1 - 91 files changed, 69 insertions(+), 140 deletions(-) diff --git a/packages/webgpu/cpp/jsi/RNFNativeObject.h b/packages/webgpu/cpp/jsi/RNFNativeObject.h index 6a5592a53..9e09d4cd1 100644 --- a/packages/webgpu/cpp/jsi/RNFNativeObject.h +++ b/packages/webgpu/cpp/jsi/RNFNativeObject.h @@ -25,7 +25,7 @@ template struct JSIConverter; // Include the converter - must come after forward declaration #include "RNFJSIConverter.h" -namespace margelo { +namespace rnwgpu { namespace jsi = facebook::jsi; @@ -40,10 +40,9 @@ struct PrototypeCacheEntry { /** * Simple runtime-aware cache that stores data per-runtime. - * When a runtime is destroyed, its cached data is automatically invalidated - * on next access (by checking if the runtime pointer is still valid). + * Used by NativeObject to cache prototypes per runtime. */ -template class RuntimeAwareCache { +template class PrototypeCache { public: T &get(jsi::Runtime &rt) { std::lock_guard lock(mutex_); @@ -101,8 +100,8 @@ class NativeObject : public jsi::NativeState, * Get the prototype cache for this type. * Each NativeObject type has its own static cache. */ - static RuntimeAwareCache &getPrototypeCache() { - static RuntimeAwareCache cache; + static PrototypeCache &getPrototypeCache() { + static PrototypeCache cache; return cache; } @@ -122,6 +121,26 @@ class NativeObject : public jsi::NativeState, // Let derived class define its methods/properties Derived::definePrototype(runtime, prototype); + // Add Symbol.toStringTag for proper object identification in console.log + auto symbolCtor = runtime.global().getPropertyAsObject(runtime, "Symbol"); + auto toStringTag = symbolCtor.getProperty(runtime, "toStringTag"); + if (!toStringTag.isUndefined()) { + // Use Object.defineProperty to set symbol property since setProperty + // doesn't support symbols directly + auto objectCtor = + runtime.global().getPropertyAsObject(runtime, "Object"); + auto defineProperty = + objectCtor.getPropertyAsFunction(runtime, "defineProperty"); + jsi::Object descriptor(runtime); + descriptor.setProperty( + runtime, "value", + jsi::String::createFromUtf8(runtime, Derived::CLASS_NAME)); + descriptor.setProperty(runtime, "writable", false); + descriptor.setProperty(runtime, "enumerable", false); + descriptor.setProperty(runtime, "configurable", true); + defineProperty.call(runtime, prototype, toStringTag, descriptor); + } + // Cache the prototype entry.prototype = std::move(prototype); } @@ -254,7 +273,7 @@ class NativeObject : public jsi::NativeState, return jsi::Value::undefined(); } else { ReturnType result = (native.get()->*getter)(); - return JSIConverter>::toJSI( + return margelo::JSIConverter>::toJSI( rt, std::move(result)); } }); @@ -287,7 +306,7 @@ class NativeObject : public jsi::NativeState, const jsi::Value *args, size_t count) -> jsi::Value { auto native = Derived::fromValue(rt, thisVal); auto value = - JSIConverter>::fromJSI(rt, args[0], false); + margelo::JSIConverter>::fromJSI(rt, args[0], false); (native.get()->*setter)(std::move(value)); return jsi::Value::undefined(); }); @@ -334,7 +353,7 @@ class NativeObject : public jsi::NativeState, const jsi::Value *args, size_t count) -> jsi::Value { auto native = Derived::fromValue(rt, thisVal); ReturnType result = (native.get()->*getter)(); - return JSIConverter>::toJSI(rt, + return margelo::JSIConverter>::toJSI(rt, std::move(result)); }); @@ -345,7 +364,7 @@ class NativeObject : public jsi::NativeState, const jsi::Value *args, size_t count) -> jsi::Value { auto native = Derived::fromValue(rt, thisVal); auto value = - JSIConverter>::fromJSI(rt, args[0], false); + margelo::JSIConverter>::fromJSI(rt, args[0], false); (native.get()->*setter)(std::move(value)); return jsi::Value::undefined(); }); @@ -372,7 +391,7 @@ class NativeObject : public jsi::NativeState, jsi::Runtime &runtime, const jsi::Value *args, std::index_sequence, size_t count) { if constexpr (std::is_same_v) { - (obj->*method)(JSIConverter>::fromJSI( + (obj->*method)(margelo::JSIConverter>::fromJSI( runtime, args[Is], Is >= count)...); return jsi::Value::undefined(); } else if constexpr (std::is_same_v) { @@ -380,9 +399,9 @@ class NativeObject : public jsi::NativeState, // This requires the method signature to match HostFunction return (obj->*method)(runtime, jsi::Value::undefined(), args, count); } else { - ReturnType result = (obj->*method)(JSIConverter>::fromJSI( + ReturnType result = (obj->*method)(margelo::JSIConverter>::fromJSI( runtime, args[Is], Is >= count)...); - return JSIConverter>::toJSI(runtime, + return margelo::JSIConverter>::toJSI(runtime, std::move(result)); } } @@ -395,4 +414,4 @@ template struct is_native_object> : std::bool_constant, T>> {}; -} // namespace margelo +} // namespace rnwgpu diff --git a/packages/webgpu/cpp/rnwgpu/api/Canvas.h b/packages/webgpu/cpp/rnwgpu/api/Canvas.h index ce664c427..1f6326d77 100644 --- a/packages/webgpu/cpp/rnwgpu/api/Canvas.h +++ b/packages/webgpu/cpp/rnwgpu/api/Canvas.h @@ -11,10 +11,9 @@ namespace rnwgpu { -namespace m = margelo; namespace jsi = facebook::jsi; -class Canvas : public m::NativeObject { +class Canvas : public NativeObject { public: static constexpr const char *CLASS_NAME = "Canvas"; diff --git a/packages/webgpu/cpp/rnwgpu/api/GPU.h b/packages/webgpu/cpp/rnwgpu/api/GPU.h index 91007d815..3326b27fd 100644 --- a/packages/webgpu/cpp/rnwgpu/api/GPU.h +++ b/packages/webgpu/cpp/rnwgpu/api/GPU.h @@ -21,10 +21,9 @@ namespace rnwgpu { -namespace m = margelo; namespace jsi = facebook::jsi; -class GPU : public m::NativeObject { +class GPU : public NativeObject { public: static constexpr const char *CLASS_NAME = "GPU"; diff --git a/packages/webgpu/cpp/rnwgpu/api/GPUAdapter.h b/packages/webgpu/cpp/rnwgpu/api/GPUAdapter.h index 276f1e75d..8d0499715 100644 --- a/packages/webgpu/cpp/rnwgpu/api/GPUAdapter.h +++ b/packages/webgpu/cpp/rnwgpu/api/GPUAdapter.h @@ -20,10 +20,9 @@ namespace rnwgpu { -namespace m = margelo; namespace jsi = facebook::jsi; -class GPUAdapter : public m::NativeObject { +class GPUAdapter : public NativeObject { public: static constexpr const char *CLASS_NAME = "GPUAdapter"; diff --git a/packages/webgpu/cpp/rnwgpu/api/GPUAdapterInfo.h b/packages/webgpu/cpp/rnwgpu/api/GPUAdapterInfo.h index 2b654e2f8..6b5ca9e94 100644 --- a/packages/webgpu/cpp/rnwgpu/api/GPUAdapterInfo.h +++ b/packages/webgpu/cpp/rnwgpu/api/GPUAdapterInfo.h @@ -13,10 +13,9 @@ namespace rnwgpu { -namespace m = margelo; namespace jsi = facebook::jsi; -class GPUAdapterInfo : public m::NativeObject { +class GPUAdapterInfo : public NativeObject { public: static constexpr const char *CLASS_NAME = "GPUAdapterInfo"; diff --git a/packages/webgpu/cpp/rnwgpu/api/GPUBindGroup.h b/packages/webgpu/cpp/rnwgpu/api/GPUBindGroup.h index 60db08a2e..d071e449c 100644 --- a/packages/webgpu/cpp/rnwgpu/api/GPUBindGroup.h +++ b/packages/webgpu/cpp/rnwgpu/api/GPUBindGroup.h @@ -10,10 +10,9 @@ namespace rnwgpu { -namespace m = margelo; namespace jsi = facebook::jsi; -class GPUBindGroup : public m::NativeObject { +class GPUBindGroup : public NativeObject { public: static constexpr const char *CLASS_NAME = "GPUBindGroup"; diff --git a/packages/webgpu/cpp/rnwgpu/api/GPUBindGroupLayout.h b/packages/webgpu/cpp/rnwgpu/api/GPUBindGroupLayout.h index 0de28cc6b..fc7437d78 100644 --- a/packages/webgpu/cpp/rnwgpu/api/GPUBindGroupLayout.h +++ b/packages/webgpu/cpp/rnwgpu/api/GPUBindGroupLayout.h @@ -10,10 +10,9 @@ namespace rnwgpu { -namespace m = margelo; namespace jsi = facebook::jsi; -class GPUBindGroupLayout : public m::NativeObject { +class GPUBindGroupLayout : public NativeObject { public: static constexpr const char *CLASS_NAME = "GPUBindGroupLayout"; diff --git a/packages/webgpu/cpp/rnwgpu/api/GPUBuffer.h b/packages/webgpu/cpp/rnwgpu/api/GPUBuffer.h index 53c458e67..3b4769361 100644 --- a/packages/webgpu/cpp/rnwgpu/api/GPUBuffer.h +++ b/packages/webgpu/cpp/rnwgpu/api/GPUBuffer.h @@ -18,10 +18,9 @@ namespace rnwgpu { -namespace m = margelo; namespace jsi = facebook::jsi; -class GPUBuffer : public m::NativeObject { +class GPUBuffer : public NativeObject { public: static constexpr const char *CLASS_NAME = "GPUBuffer"; diff --git a/packages/webgpu/cpp/rnwgpu/api/GPUCanvasContext.h b/packages/webgpu/cpp/rnwgpu/api/GPUCanvasContext.h index 38b0bb383..1423b5784 100644 --- a/packages/webgpu/cpp/rnwgpu/api/GPUCanvasContext.h +++ b/packages/webgpu/cpp/rnwgpu/api/GPUCanvasContext.h @@ -18,10 +18,9 @@ namespace rnwgpu { -namespace m = margelo; namespace jsi = facebook::jsi; -class GPUCanvasContext : public m::NativeObject { +class GPUCanvasContext : public NativeObject { public: static constexpr const char *CLASS_NAME = "GPUCanvasContext"; diff --git a/packages/webgpu/cpp/rnwgpu/api/GPUCommandBuffer.h b/packages/webgpu/cpp/rnwgpu/api/GPUCommandBuffer.h index 728194b64..73b11e20a 100644 --- a/packages/webgpu/cpp/rnwgpu/api/GPUCommandBuffer.h +++ b/packages/webgpu/cpp/rnwgpu/api/GPUCommandBuffer.h @@ -10,10 +10,9 @@ namespace rnwgpu { -namespace m = margelo; namespace jsi = facebook::jsi; -class GPUCommandBuffer : public m::NativeObject { +class GPUCommandBuffer : public NativeObject { public: static constexpr const char *CLASS_NAME = "GPUCommandBuffer"; diff --git a/packages/webgpu/cpp/rnwgpu/api/GPUCommandEncoder.h b/packages/webgpu/cpp/rnwgpu/api/GPUCommandEncoder.h index 8fd42b328..cdedad8e7 100644 --- a/packages/webgpu/cpp/rnwgpu/api/GPUCommandEncoder.h +++ b/packages/webgpu/cpp/rnwgpu/api/GPUCommandEncoder.h @@ -23,10 +23,9 @@ namespace rnwgpu { -namespace m = margelo; namespace jsi = facebook::jsi; -class GPUCommandEncoder : public m::NativeObject { +class GPUCommandEncoder : public NativeObject { public: static constexpr const char *CLASS_NAME = "GPUCommandEncoder"; diff --git a/packages/webgpu/cpp/rnwgpu/api/GPUCompilationInfo.h b/packages/webgpu/cpp/rnwgpu/api/GPUCompilationInfo.h index 344266093..c9f8278f5 100644 --- a/packages/webgpu/cpp/rnwgpu/api/GPUCompilationInfo.h +++ b/packages/webgpu/cpp/rnwgpu/api/GPUCompilationInfo.h @@ -11,7 +11,6 @@ namespace rnwgpu { -namespace m = margelo; namespace jsi = facebook::jsi; struct GPUCompilationMessageData { @@ -23,7 +22,7 @@ struct GPUCompilationMessageData { uint64_t length; }; -class GPUCompilationInfo : public m::NativeObject { +class GPUCompilationInfo : public NativeObject { public: static constexpr const char *CLASS_NAME = "GPUCompilationInfo"; diff --git a/packages/webgpu/cpp/rnwgpu/api/GPUCompilationMessage.h b/packages/webgpu/cpp/rnwgpu/api/GPUCompilationMessage.h index 2a3c99d8a..8e5154bb7 100644 --- a/packages/webgpu/cpp/rnwgpu/api/GPUCompilationMessage.h +++ b/packages/webgpu/cpp/rnwgpu/api/GPUCompilationMessage.h @@ -10,10 +10,9 @@ namespace rnwgpu { -namespace m = margelo; namespace jsi = facebook::jsi; -class GPUCompilationMessage : public m::NativeObject { +class GPUCompilationMessage : public NativeObject { public: static constexpr const char *CLASS_NAME = "GPUCompilationMessage"; diff --git a/packages/webgpu/cpp/rnwgpu/api/GPUComputePassEncoder.h b/packages/webgpu/cpp/rnwgpu/api/GPUComputePassEncoder.h index a6a0b332a..39e7e5e42 100644 --- a/packages/webgpu/cpp/rnwgpu/api/GPUComputePassEncoder.h +++ b/packages/webgpu/cpp/rnwgpu/api/GPUComputePassEncoder.h @@ -18,10 +18,9 @@ namespace rnwgpu { -namespace m = margelo; namespace jsi = facebook::jsi; -class GPUComputePassEncoder : public m::NativeObject { +class GPUComputePassEncoder : public NativeObject { public: static constexpr const char *CLASS_NAME = "GPUComputePassEncoder"; diff --git a/packages/webgpu/cpp/rnwgpu/api/GPUComputePipeline.h b/packages/webgpu/cpp/rnwgpu/api/GPUComputePipeline.h index 027a231c4..2704843cc 100644 --- a/packages/webgpu/cpp/rnwgpu/api/GPUComputePipeline.h +++ b/packages/webgpu/cpp/rnwgpu/api/GPUComputePipeline.h @@ -13,10 +13,9 @@ namespace rnwgpu { -namespace m = margelo; namespace jsi = facebook::jsi; -class GPUComputePipeline : public m::NativeObject { +class GPUComputePipeline : public NativeObject { public: static constexpr const char *CLASS_NAME = "GPUComputePipeline"; diff --git a/packages/webgpu/cpp/rnwgpu/api/GPUDevice.h b/packages/webgpu/cpp/rnwgpu/api/GPUDevice.h index 8462cbcaa..69af87f62 100644 --- a/packages/webgpu/cpp/rnwgpu/api/GPUDevice.h +++ b/packages/webgpu/cpp/rnwgpu/api/GPUDevice.h @@ -49,10 +49,9 @@ namespace rnwgpu { -namespace m = margelo; namespace jsi = facebook::jsi; -class GPUDevice : public m::NativeObject { +class GPUDevice : public NativeObject { public: static constexpr const char *CLASS_NAME = "GPUDevice"; diff --git a/packages/webgpu/cpp/rnwgpu/api/GPUDeviceLostInfo.h b/packages/webgpu/cpp/rnwgpu/api/GPUDeviceLostInfo.h index 35b295c5a..81782411d 100644 --- a/packages/webgpu/cpp/rnwgpu/api/GPUDeviceLostInfo.h +++ b/packages/webgpu/cpp/rnwgpu/api/GPUDeviceLostInfo.h @@ -10,10 +10,9 @@ namespace rnwgpu { -namespace m = margelo; namespace jsi = facebook::jsi; -class GPUDeviceLostInfo : public m::NativeObject { +class GPUDeviceLostInfo : public NativeObject { public: static constexpr const char *CLASS_NAME = "GPUDeviceLostInfo"; diff --git a/packages/webgpu/cpp/rnwgpu/api/GPUExternalTexture.h b/packages/webgpu/cpp/rnwgpu/api/GPUExternalTexture.h index 3b38ca338..26e671d8e 100644 --- a/packages/webgpu/cpp/rnwgpu/api/GPUExternalTexture.h +++ b/packages/webgpu/cpp/rnwgpu/api/GPUExternalTexture.h @@ -10,10 +10,9 @@ namespace rnwgpu { -namespace m = margelo; namespace jsi = facebook::jsi; -class GPUExternalTexture : public m::NativeObject { +class GPUExternalTexture : public NativeObject { public: static constexpr const char *CLASS_NAME = "GPUExternalTexture"; diff --git a/packages/webgpu/cpp/rnwgpu/api/GPUPipelineLayout.h b/packages/webgpu/cpp/rnwgpu/api/GPUPipelineLayout.h index 2c5bf2ff6..ad3ff193c 100644 --- a/packages/webgpu/cpp/rnwgpu/api/GPUPipelineLayout.h +++ b/packages/webgpu/cpp/rnwgpu/api/GPUPipelineLayout.h @@ -10,10 +10,9 @@ namespace rnwgpu { -namespace m = margelo; namespace jsi = facebook::jsi; -class GPUPipelineLayout : public m::NativeObject { +class GPUPipelineLayout : public NativeObject { public: static constexpr const char *CLASS_NAME = "GPUPipelineLayout"; diff --git a/packages/webgpu/cpp/rnwgpu/api/GPUQuerySet.h b/packages/webgpu/cpp/rnwgpu/api/GPUQuerySet.h index 73f01b7c7..2cd74dccb 100644 --- a/packages/webgpu/cpp/rnwgpu/api/GPUQuerySet.h +++ b/packages/webgpu/cpp/rnwgpu/api/GPUQuerySet.h @@ -10,10 +10,9 @@ namespace rnwgpu { -namespace m = margelo; namespace jsi = facebook::jsi; -class GPUQuerySet : public m::NativeObject { +class GPUQuerySet : public NativeObject { public: static constexpr const char *CLASS_NAME = "GPUQuerySet"; diff --git a/packages/webgpu/cpp/rnwgpu/api/GPUQueue.h b/packages/webgpu/cpp/rnwgpu/api/GPUQueue.h index 23f92e070..3b64350e6 100644 --- a/packages/webgpu/cpp/rnwgpu/api/GPUQueue.h +++ b/packages/webgpu/cpp/rnwgpu/api/GPUQueue.h @@ -21,10 +21,9 @@ namespace rnwgpu { -namespace m = margelo; namespace jsi = facebook::jsi; -class GPUQueue : public m::NativeObject { +class GPUQueue : public NativeObject { public: static constexpr const char *CLASS_NAME = "GPUQueue"; diff --git a/packages/webgpu/cpp/rnwgpu/api/GPURenderBundle.h b/packages/webgpu/cpp/rnwgpu/api/GPURenderBundle.h index 3944bed9b..4b5bdc499 100644 --- a/packages/webgpu/cpp/rnwgpu/api/GPURenderBundle.h +++ b/packages/webgpu/cpp/rnwgpu/api/GPURenderBundle.h @@ -10,10 +10,9 @@ namespace rnwgpu { -namespace m = margelo; namespace jsi = facebook::jsi; -class GPURenderBundle : public m::NativeObject { +class GPURenderBundle : public NativeObject { public: static constexpr const char *CLASS_NAME = "GPURenderBundle"; diff --git a/packages/webgpu/cpp/rnwgpu/api/GPURenderBundleEncoder.h b/packages/webgpu/cpp/rnwgpu/api/GPURenderBundleEncoder.h index 2c6ba714d..563ef27a9 100644 --- a/packages/webgpu/cpp/rnwgpu/api/GPURenderBundleEncoder.h +++ b/packages/webgpu/cpp/rnwgpu/api/GPURenderBundleEncoder.h @@ -20,10 +20,9 @@ namespace rnwgpu { -namespace m = margelo; namespace jsi = facebook::jsi; -class GPURenderBundleEncoder : public m::NativeObject { +class GPURenderBundleEncoder : public NativeObject { public: static constexpr const char *CLASS_NAME = "GPURenderBundleEncoder"; diff --git a/packages/webgpu/cpp/rnwgpu/api/GPURenderPassEncoder.h b/packages/webgpu/cpp/rnwgpu/api/GPURenderPassEncoder.h index 52933372c..13993fbcd 100644 --- a/packages/webgpu/cpp/rnwgpu/api/GPURenderPassEncoder.h +++ b/packages/webgpu/cpp/rnwgpu/api/GPURenderPassEncoder.h @@ -20,10 +20,9 @@ namespace rnwgpu { -namespace m = margelo; namespace jsi = facebook::jsi; -class GPURenderPassEncoder : public m::NativeObject { +class GPURenderPassEncoder : public NativeObject { public: static constexpr const char *CLASS_NAME = "GPURenderPassEncoder"; diff --git a/packages/webgpu/cpp/rnwgpu/api/GPURenderPipeline.h b/packages/webgpu/cpp/rnwgpu/api/GPURenderPipeline.h index e893324da..0fa617315 100644 --- a/packages/webgpu/cpp/rnwgpu/api/GPURenderPipeline.h +++ b/packages/webgpu/cpp/rnwgpu/api/GPURenderPipeline.h @@ -13,10 +13,9 @@ namespace rnwgpu { -namespace m = margelo; namespace jsi = facebook::jsi; -class GPURenderPipeline : public m::NativeObject { +class GPURenderPipeline : public NativeObject { public: static constexpr const char *CLASS_NAME = "GPURenderPipeline"; diff --git a/packages/webgpu/cpp/rnwgpu/api/GPUSampler.h b/packages/webgpu/cpp/rnwgpu/api/GPUSampler.h index a076317ac..2a20aec39 100644 --- a/packages/webgpu/cpp/rnwgpu/api/GPUSampler.h +++ b/packages/webgpu/cpp/rnwgpu/api/GPUSampler.h @@ -10,10 +10,9 @@ namespace rnwgpu { -namespace m = margelo; namespace jsi = facebook::jsi; -class GPUSampler : public m::NativeObject { +class GPUSampler : public NativeObject { public: static constexpr const char *CLASS_NAME = "GPUSampler"; diff --git a/packages/webgpu/cpp/rnwgpu/api/GPUShaderModule.h b/packages/webgpu/cpp/rnwgpu/api/GPUShaderModule.h index 256e69faf..18da306e8 100644 --- a/packages/webgpu/cpp/rnwgpu/api/GPUShaderModule.h +++ b/packages/webgpu/cpp/rnwgpu/api/GPUShaderModule.h @@ -16,10 +16,9 @@ namespace rnwgpu { -namespace m = margelo; namespace jsi = facebook::jsi; -class GPUShaderModule : public m::NativeObject { +class GPUShaderModule : public NativeObject { public: static constexpr const char *CLASS_NAME = "GPUShaderModule"; diff --git a/packages/webgpu/cpp/rnwgpu/api/GPUSupportedLimits.h b/packages/webgpu/cpp/rnwgpu/api/GPUSupportedLimits.h index 53161b21b..b05c4673b 100644 --- a/packages/webgpu/cpp/rnwgpu/api/GPUSupportedLimits.h +++ b/packages/webgpu/cpp/rnwgpu/api/GPUSupportedLimits.h @@ -10,10 +10,9 @@ namespace rnwgpu { -namespace m = margelo; namespace jsi = facebook::jsi; -class GPUSupportedLimits : public m::NativeObject { +class GPUSupportedLimits : public NativeObject { public: static constexpr const char *CLASS_NAME = "GPUSupportedLimits"; diff --git a/packages/webgpu/cpp/rnwgpu/api/GPUTexture.h b/packages/webgpu/cpp/rnwgpu/api/GPUTexture.h index 7c0f1675f..dcb0dfa6d 100644 --- a/packages/webgpu/cpp/rnwgpu/api/GPUTexture.h +++ b/packages/webgpu/cpp/rnwgpu/api/GPUTexture.h @@ -15,10 +15,9 @@ namespace rnwgpu { -namespace m = margelo; namespace jsi = facebook::jsi; -class GPUTexture : public m::NativeObject { +class GPUTexture : public NativeObject { public: static constexpr const char *CLASS_NAME = "GPUTexture"; diff --git a/packages/webgpu/cpp/rnwgpu/api/GPUTextureView.h b/packages/webgpu/cpp/rnwgpu/api/GPUTextureView.h index 08134aa55..4c4ec7d7a 100644 --- a/packages/webgpu/cpp/rnwgpu/api/GPUTextureView.h +++ b/packages/webgpu/cpp/rnwgpu/api/GPUTextureView.h @@ -10,10 +10,9 @@ namespace rnwgpu { -namespace m = margelo; namespace jsi = facebook::jsi; -class GPUTextureView : public m::NativeObject { +class GPUTextureView : public NativeObject { public: static constexpr const char *CLASS_NAME = "GPUTextureView"; diff --git a/packages/webgpu/cpp/rnwgpu/api/ImageBitmap.h b/packages/webgpu/cpp/rnwgpu/api/ImageBitmap.h index 2f59c5109..743c68aed 100644 --- a/packages/webgpu/cpp/rnwgpu/api/ImageBitmap.h +++ b/packages/webgpu/cpp/rnwgpu/api/ImageBitmap.h @@ -9,10 +9,9 @@ namespace rnwgpu { -namespace m = margelo; namespace jsi = facebook::jsi; -class ImageBitmap : public m::NativeObject { +class ImageBitmap : public NativeObject { public: static constexpr const char *CLASS_NAME = "ImageBitmap"; diff --git a/packages/webgpu/cpp/rnwgpu/api/RNWebGPU.h b/packages/webgpu/cpp/rnwgpu/api/RNWebGPU.h index 0df996ee2..d34e1a283 100644 --- a/packages/webgpu/cpp/rnwgpu/api/RNWebGPU.h +++ b/packages/webgpu/cpp/rnwgpu/api/RNWebGPU.h @@ -13,7 +13,6 @@ namespace rnwgpu { -namespace m = margelo; namespace jsi = facebook::jsi; struct Blob { @@ -24,7 +23,7 @@ struct Blob { std::string name; }; -class RNWebGPU : public m::NativeObject { +class RNWebGPU : public NativeObject { public: static constexpr const char *CLASS_NAME = "RNWebGPU"; diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBindGroupDescriptor.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBindGroupDescriptor.h index 89758a326..26cc8b6e9 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBindGroupDescriptor.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBindGroupDescriptor.h @@ -14,7 +14,6 @@ #include "RNFHybridObject.h" namespace jsi = facebook::jsi; -namespace m = margelo; namespace rnwgpu { diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBindGroupEntry.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBindGroupEntry.h index 665def3a7..cb6549ebb 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBindGroupEntry.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBindGroupEntry.h @@ -13,7 +13,6 @@ #include "WGPULogger.h" namespace jsi = facebook::jsi; -namespace m = margelo; namespace rnwgpu { diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBindGroupLayoutDescriptor.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBindGroupLayoutDescriptor.h index 6427d8405..e57df5d97 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBindGroupLayoutDescriptor.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBindGroupLayoutDescriptor.h @@ -13,7 +13,6 @@ #include "RNFHybridObject.h" namespace jsi = facebook::jsi; -namespace m = margelo; namespace rnwgpu { diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBindGroupLayoutEntry.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBindGroupLayoutEntry.h index ec600f087..12056e718 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBindGroupLayoutEntry.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBindGroupLayoutEntry.h @@ -15,7 +15,6 @@ #include "RNFHybridObject.h" namespace jsi = facebook::jsi; -namespace m = margelo; namespace rnwgpu { diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBlendComponent.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBlendComponent.h index ce77ad44f..a95c4f0b8 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBlendComponent.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBlendComponent.h @@ -10,7 +10,6 @@ #include "RNFHybridObject.h" namespace jsi = facebook::jsi; -namespace m = margelo; namespace rnwgpu { diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBlendState.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBlendState.h index d39cd9f8c..e81120cfe 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBlendState.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBlendState.h @@ -11,7 +11,6 @@ #include "RNFHybridObject.h" namespace jsi = facebook::jsi; -namespace m = margelo; namespace rnwgpu { diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBufferBinding.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBufferBinding.h index dc815794f..63ce9bb1f 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBufferBinding.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBufferBinding.h @@ -11,7 +11,6 @@ #include "RNFHybridObject.h" namespace jsi = facebook::jsi; -namespace m = margelo; namespace rnwgpu { diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBufferBindingLayout.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBufferBindingLayout.h index 39b66f1bd..41ca93a42 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBufferBindingLayout.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBufferBindingLayout.h @@ -10,7 +10,6 @@ #include "RNFHybridObject.h" namespace jsi = facebook::jsi; -namespace m = margelo; namespace rnwgpu { diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBufferDescriptor.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBufferDescriptor.h index e3b45e6c6..aa64ff01d 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBufferDescriptor.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBufferDescriptor.h @@ -11,7 +11,6 @@ #include "RNFHybridObject.h" namespace jsi = facebook::jsi; -namespace m = margelo; namespace rnwgpu { diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBufferUsage.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBufferUsage.h index 686cdc24c..e171f88db 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBufferUsage.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBufferUsage.h @@ -7,10 +7,9 @@ namespace rnwgpu { -namespace m = margelo; namespace jsi = facebook::jsi; -class GPUBufferUsage : public m::NativeObject { +class GPUBufferUsage : public NativeObject { public: static constexpr const char *CLASS_NAME = "GPUBufferUsage"; diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUCanvasConfiguration.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUCanvasConfiguration.h index eb89e5e34..c604bae05 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUCanvasConfiguration.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUCanvasConfiguration.h @@ -11,7 +11,6 @@ #include "RNFHybridObject.h" namespace jsi = facebook::jsi; -namespace m = margelo; namespace rnwgpu { diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUColor.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUColor.h index c8d55a8a5..a28e63b91 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUColor.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUColor.h @@ -10,7 +10,6 @@ #include "RNFHybridObject.h" namespace jsi = facebook::jsi; -namespace m = margelo; namespace rnwgpu { diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUColorTargetState.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUColorTargetState.h index 16c04d55e..9b353a9cb 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUColorTargetState.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUColorTargetState.h @@ -11,7 +11,6 @@ #include "RNFHybridObject.h" namespace jsi = facebook::jsi; -namespace m = margelo; namespace rnwgpu { diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUColorWrite.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUColorWrite.h index db163477b..c692ca1a2 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUColorWrite.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUColorWrite.h @@ -7,10 +7,9 @@ namespace rnwgpu { -namespace m = margelo; namespace jsi = facebook::jsi; -class GPUColorWrite : public m::NativeObject { +class GPUColorWrite : public NativeObject { public: static constexpr const char *CLASS_NAME = "GPUColorWrite"; diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUCommandBufferDescriptor.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUCommandBufferDescriptor.h index 78fc2f209..f6d81c008 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUCommandBufferDescriptor.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUCommandBufferDescriptor.h @@ -11,7 +11,6 @@ #include "RNFHybridObject.h" namespace jsi = facebook::jsi; -namespace m = margelo; namespace rnwgpu { diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUCommandEncoderDescriptor.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUCommandEncoderDescriptor.h index c5a52fa0e..1c94c3d1b 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUCommandEncoderDescriptor.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUCommandEncoderDescriptor.h @@ -11,7 +11,6 @@ #include "RNFHybridObject.h" namespace jsi = facebook::jsi; -namespace m = margelo; namespace rnwgpu { diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUComputePassDescriptor.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUComputePassDescriptor.h index 6287f8899..9b444a4c2 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUComputePassDescriptor.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUComputePassDescriptor.h @@ -12,7 +12,6 @@ #include "RNFHybridObject.h" namespace jsi = facebook::jsi; -namespace m = margelo; namespace rnwgpu { diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUComputePassTimestampWrites.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUComputePassTimestampWrites.h index a5488e761..2cf87dd3c 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUComputePassTimestampWrites.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUComputePassTimestampWrites.h @@ -11,7 +11,6 @@ #include "RNFHybridObject.h" namespace jsi = facebook::jsi; -namespace m = margelo; namespace rnwgpu { diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUComputePipelineDescriptor.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUComputePipelineDescriptor.h index 783ff102e..ad3dfaf1f 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUComputePipelineDescriptor.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUComputePipelineDescriptor.h @@ -13,7 +13,6 @@ #include "RNFHybridObject.h" namespace jsi = facebook::jsi; -namespace m = margelo; namespace rnwgpu { diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUDepthStencilState.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUDepthStencilState.h index 4f731815c..2cbaf6ae7 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUDepthStencilState.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUDepthStencilState.h @@ -11,7 +11,6 @@ #include "RNFHybridObject.h" namespace jsi = facebook::jsi; -namespace m = margelo; namespace rnwgpu { diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUDeviceDescriptor.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUDeviceDescriptor.h index b2ee4cc40..7f6893cc5 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUDeviceDescriptor.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUDeviceDescriptor.h @@ -14,7 +14,6 @@ #include "RNFHybridObject.h" namespace jsi = facebook::jsi; -namespace m = margelo; namespace rnwgpu { diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUExternalTextureBindingLayout.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUExternalTextureBindingLayout.h index 95b95f011..b60d8d58c 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUExternalTextureBindingLayout.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUExternalTextureBindingLayout.h @@ -10,7 +10,6 @@ #include "RNFHybridObject.h" namespace jsi = facebook::jsi; -namespace m = margelo; namespace rnwgpu { diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUExternalTextureDescriptor.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUExternalTextureDescriptor.h index ec4726566..7f057a5f8 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUExternalTextureDescriptor.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUExternalTextureDescriptor.h @@ -14,7 +14,6 @@ #include "WGPULogger.h" namespace jsi = facebook::jsi; -namespace m = margelo; namespace rnwgpu { diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUFragmentState.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUFragmentState.h index fd30d1a59..8c82495f6 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUFragmentState.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUFragmentState.h @@ -16,7 +16,6 @@ #include "RNFHybridObject.h" namespace jsi = facebook::jsi; -namespace m = margelo; namespace rnwgpu { diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUImageCopyBuffer.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUImageCopyBuffer.h index 51b5904ee..12f84c4e1 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUImageCopyBuffer.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUImageCopyBuffer.h @@ -11,7 +11,6 @@ #include "RNFHybridObject.h" namespace jsi = facebook::jsi; -namespace m = margelo; namespace rnwgpu { diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUImageCopyExternalImage.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUImageCopyExternalImage.h index d087a7576..eb9b102e0 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUImageCopyExternalImage.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUImageCopyExternalImage.h @@ -15,7 +15,6 @@ #include "ImageBitmap.h" namespace jsi = facebook::jsi; -namespace m = margelo; namespace rnwgpu { diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUImageCopyTexture.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUImageCopyTexture.h index fda91a968..d66b013f9 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUImageCopyTexture.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUImageCopyTexture.h @@ -12,7 +12,6 @@ #include "RNFHybridObject.h" namespace jsi = facebook::jsi; -namespace m = margelo; namespace rnwgpu { diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUImageCopyTextureTagged.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUImageCopyTextureTagged.h index f8c4acde0..b8542b0a8 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUImageCopyTextureTagged.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUImageCopyTextureTagged.h @@ -13,7 +13,6 @@ #include "RNFHybridObject.h" namespace jsi = facebook::jsi; -namespace m = margelo; namespace rnwgpu { diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUImageDataLayout.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUImageDataLayout.h index 21aceb256..42a622a31 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUImageDataLayout.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUImageDataLayout.h @@ -10,7 +10,6 @@ #include "RNFHybridObject.h" namespace jsi = facebook::jsi; -namespace m = margelo; namespace rnwgpu { diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUMapMode.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUMapMode.h index 9e81cf6a4..827e89eef 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUMapMode.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUMapMode.h @@ -7,10 +7,9 @@ namespace rnwgpu { -namespace m = margelo; namespace jsi = facebook::jsi; -class GPUMapMode : public m::NativeObject { +class GPUMapMode : public NativeObject { public: static constexpr const char *CLASS_NAME = "GPUMapMode"; diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUMultisampleState.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUMultisampleState.h index ac2850667..c12f21fd8 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUMultisampleState.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUMultisampleState.h @@ -10,7 +10,6 @@ #include "RNFHybridObject.h" namespace jsi = facebook::jsi; -namespace m = margelo; namespace rnwgpu { diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUPipelineLayoutDescriptor.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUPipelineLayoutDescriptor.h index e0dc6fa5c..6030cf0e9 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUPipelineLayoutDescriptor.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUPipelineLayoutDescriptor.h @@ -13,7 +13,6 @@ #include "RNFHybridObject.h" namespace jsi = facebook::jsi; -namespace m = margelo; namespace rnwgpu { diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUPrimitiveState.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUPrimitiveState.h index d787d0aaa..fae935a64 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUPrimitiveState.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUPrimitiveState.h @@ -10,7 +10,6 @@ #include "RNFHybridObject.h" namespace jsi = facebook::jsi; -namespace m = margelo; namespace rnwgpu { diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUProgrammableStage.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUProgrammableStage.h index 46a424fbd..b39e39a6e 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUProgrammableStage.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUProgrammableStage.h @@ -13,7 +13,6 @@ #include "RNFHybridObject.h" namespace jsi = facebook::jsi; -namespace m = margelo; namespace rnwgpu { diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUQuerySetDescriptor.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUQuerySetDescriptor.h index 4bbff0c3f..b44b2ca47 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUQuerySetDescriptor.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUQuerySetDescriptor.h @@ -11,7 +11,6 @@ #include "RNFHybridObject.h" namespace jsi = facebook::jsi; -namespace m = margelo; namespace rnwgpu { diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUQueueDescriptor.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUQueueDescriptor.h index b79b14359..5eb58ecb3 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUQueueDescriptor.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUQueueDescriptor.h @@ -11,7 +11,6 @@ #include "RNFHybridObject.h" namespace jsi = facebook::jsi; -namespace m = margelo; namespace rnwgpu { diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPURenderBundleDescriptor.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPURenderBundleDescriptor.h index 54d104973..6b46ee3a7 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPURenderBundleDescriptor.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPURenderBundleDescriptor.h @@ -11,7 +11,6 @@ #include "RNFHybridObject.h" namespace jsi = facebook::jsi; -namespace m = margelo; namespace rnwgpu { diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPURenderBundleEncoderDescriptor.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPURenderBundleEncoderDescriptor.h index caa623455..6bf516f67 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPURenderBundleEncoderDescriptor.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPURenderBundleEncoderDescriptor.h @@ -12,7 +12,6 @@ #include "RNFHybridObject.h" namespace jsi = facebook::jsi; -namespace m = margelo; namespace rnwgpu { diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPURenderPassColorAttachment.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPURenderPassColorAttachment.h index 9744101a9..5a89cc081 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPURenderPassColorAttachment.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPURenderPassColorAttachment.h @@ -12,7 +12,6 @@ #include "RNFHybridObject.h" namespace jsi = facebook::jsi; -namespace m = margelo; namespace rnwgpu { diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPURenderPassDepthStencilAttachment.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPURenderPassDepthStencilAttachment.h index 43c96ead4..ba5e57471 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPURenderPassDepthStencilAttachment.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPURenderPassDepthStencilAttachment.h @@ -11,7 +11,6 @@ #include "RNFHybridObject.h" namespace jsi = facebook::jsi; -namespace m = margelo; namespace rnwgpu { diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPURenderPassDescriptor.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPURenderPassDescriptor.h index e2cf98704..0aef9a84a 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPURenderPassDescriptor.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPURenderPassDescriptor.h @@ -17,7 +17,6 @@ #include "RNFHybridObject.h" namespace jsi = facebook::jsi; -namespace m = margelo; namespace rnwgpu { diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPURenderPassTimestampWrites.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPURenderPassTimestampWrites.h index 3c4eaecfc..30c4a222d 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPURenderPassTimestampWrites.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPURenderPassTimestampWrites.h @@ -11,7 +11,6 @@ #include "RNFHybridObject.h" namespace jsi = facebook::jsi; -namespace m = margelo; namespace rnwgpu { diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPURenderPipelineDescriptor.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPURenderPipelineDescriptor.h index 85e371984..8fdcb9736 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPURenderPipelineDescriptor.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPURenderPipelineDescriptor.h @@ -17,7 +17,6 @@ #include "RNFHybridObject.h" namespace jsi = facebook::jsi; -namespace m = margelo; namespace rnwgpu { diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPURequestAdapterOptions.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPURequestAdapterOptions.h index 69ebae6d6..1d34f6223 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPURequestAdapterOptions.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPURequestAdapterOptions.h @@ -10,7 +10,6 @@ #include "RNFHybridObject.h" namespace jsi = facebook::jsi; -namespace m = margelo; namespace rnwgpu { diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUSamplerBindingLayout.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUSamplerBindingLayout.h index dba6ed9cf..42dbfaef1 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUSamplerBindingLayout.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUSamplerBindingLayout.h @@ -10,7 +10,6 @@ #include "RNFHybridObject.h" namespace jsi = facebook::jsi; -namespace m = margelo; namespace rnwgpu { diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUSamplerDescriptor.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUSamplerDescriptor.h index 571c7c44b..965b8e29e 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUSamplerDescriptor.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUSamplerDescriptor.h @@ -11,7 +11,6 @@ #include "RNFHybridObject.h" namespace jsi = facebook::jsi; -namespace m = margelo; namespace rnwgpu { diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUShaderModuleCompilationHint.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUShaderModuleCompilationHint.h index 8c6f906eb..86071c8f1 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUShaderModuleCompilationHint.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUShaderModuleCompilationHint.h @@ -12,7 +12,6 @@ #include "RNFHybridObject.h" namespace jsi = facebook::jsi; -namespace m = margelo; namespace rnwgpu { diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUShaderModuleDescriptor.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUShaderModuleDescriptor.h index 0b3179ef6..c9fc41f6f 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUShaderModuleDescriptor.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUShaderModuleDescriptor.h @@ -13,7 +13,6 @@ #include "RNFHybridObject.h" namespace jsi = facebook::jsi; -namespace m = margelo; namespace rnwgpu { diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUShaderStage.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUShaderStage.h index 33d4e2ae1..b361122f1 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUShaderStage.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUShaderStage.h @@ -7,10 +7,9 @@ namespace rnwgpu { -namespace m = margelo; namespace jsi = facebook::jsi; -class GPUShaderStage : public m::NativeObject { +class GPUShaderStage : public NativeObject { public: static constexpr const char *CLASS_NAME = "GPUShaderStage"; diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUStencilFaceState.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUStencilFaceState.h index 43afc72a5..a687c1ba8 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUStencilFaceState.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUStencilFaceState.h @@ -10,7 +10,6 @@ #include "RNFHybridObject.h" namespace jsi = facebook::jsi; -namespace m = margelo; namespace rnwgpu { diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUStorageTextureBindingLayout.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUStorageTextureBindingLayout.h index b0f49c6d2..5df1caf39 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUStorageTextureBindingLayout.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUStorageTextureBindingLayout.h @@ -10,7 +10,6 @@ #include "RNFHybridObject.h" namespace jsi = facebook::jsi; -namespace m = margelo; namespace rnwgpu { diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUTextureBindingLayout.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUTextureBindingLayout.h index 084e03cab..470769221 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUTextureBindingLayout.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUTextureBindingLayout.h @@ -10,7 +10,6 @@ #include "RNFHybridObject.h" namespace jsi = facebook::jsi; -namespace m = margelo; namespace rnwgpu { diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUTextureDescriptor.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUTextureDescriptor.h index 6901a55d2..3953ffacd 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUTextureDescriptor.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUTextureDescriptor.h @@ -13,7 +13,6 @@ #include "RNFHybridObject.h" namespace jsi = facebook::jsi; -namespace m = margelo; namespace rnwgpu { diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUTextureUsage.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUTextureUsage.h index dd2491af2..d4f278d4d 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUTextureUsage.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUTextureUsage.h @@ -7,10 +7,9 @@ namespace rnwgpu { -namespace m = margelo; namespace jsi = facebook::jsi; -class GPUTextureUsage : public m::NativeObject { +class GPUTextureUsage : public NativeObject { public: static constexpr const char *CLASS_NAME = "GPUTextureUsage"; diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUTextureViewDescriptor.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUTextureViewDescriptor.h index 42d1d50ae..070fac500 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUTextureViewDescriptor.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUTextureViewDescriptor.h @@ -11,7 +11,6 @@ #include "RNFHybridObject.h" namespace jsi = facebook::jsi; -namespace m = margelo; namespace rnwgpu { diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUUncapturedErrorEventInit.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUUncapturedErrorEventInit.h index 323bbf725..a688e7e4c 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUUncapturedErrorEventInit.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUUncapturedErrorEventInit.h @@ -11,7 +11,6 @@ #include "RNFHybridObject.h" namespace jsi = facebook::jsi; -namespace m = margelo; namespace rnwgpu { diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUVertexAttribute.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUVertexAttribute.h index b1f69dde7..1721b6da1 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUVertexAttribute.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUVertexAttribute.h @@ -10,7 +10,6 @@ #include "RNFHybridObject.h" namespace jsi = facebook::jsi; -namespace m = margelo; namespace rnwgpu { diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUVertexBufferLayout.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUVertexBufferLayout.h index 0dd0a6d1a..7b2fed6c0 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUVertexBufferLayout.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUVertexBufferLayout.h @@ -12,7 +12,6 @@ #include "RNFHybridObject.h" namespace jsi = facebook::jsi; -namespace m = margelo; namespace rnwgpu { diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUVertexState.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUVertexState.h index 07e2124ea..cfb96d062 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUVertexState.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUVertexState.h @@ -16,7 +16,6 @@ #include "RNFHybridObject.h" namespace jsi = facebook::jsi; -namespace m = margelo; namespace rnwgpu { From 5f8a45760a1a64e8a53b87d2a9408b3674d6c18b Mon Sep 17 00:00:00 2001 From: William Candillon Date: Mon, 12 Jan 2026 16:24:05 +0100 Subject: [PATCH 05/23] :wrench: --- apps/example/ios/Podfile.lock | 4 +- packages/webgpu/android/CMakeLists.txt | 1 - packages/webgpu/cpp/jsi/RNFHybridObject.cpp | 150 --------------- packages/webgpu/cpp/jsi/RNFHybridObject.h | 181 ------------------ packages/webgpu/cpp/jsi/RNFJSIConverter.h | 2 +- packages/webgpu/cpp/jsi/RNFPointerHolder.h | 95 --------- .../api/descriptors/GPUBindGroupDescriptor.h | 1 - .../GPUBindGroupLayoutDescriptor.h | 1 - .../api/descriptors/GPUBindGroupLayoutEntry.h | 1 - .../api/descriptors/GPUBlendComponent.h | 1 - .../rnwgpu/api/descriptors/GPUBlendState.h | 1 - .../rnwgpu/api/descriptors/GPUBufferBinding.h | 1 - .../api/descriptors/GPUBufferBindingLayout.h | 1 - .../api/descriptors/GPUBufferDescriptor.h | 1 - .../api/descriptors/GPUCanvasConfiguration.h | 1 - .../cpp/rnwgpu/api/descriptors/GPUColor.h | 1 - .../api/descriptors/GPUColorTargetState.h | 1 - .../descriptors/GPUCommandBufferDescriptor.h | 1 - .../descriptors/GPUCommandEncoderDescriptor.h | 1 - .../descriptors/GPUComputePassDescriptor.h | 1 - .../GPUComputePassTimestampWrites.h | 1 - .../GPUComputePipelineDescriptor.h | 1 - .../api/descriptors/GPUDepthStencilState.h | 1 - .../api/descriptors/GPUDeviceDescriptor.h | 1 - .../GPUExternalTextureBindingLayout.h | 1 - .../GPUExternalTextureDescriptor.h | 1 - .../rnwgpu/api/descriptors/GPUFragmentState.h | 1 - .../api/descriptors/GPUImageCopyBuffer.h | 1 - .../descriptors/GPUImageCopyExternalImage.h | 1 - .../api/descriptors/GPUImageCopyTexture.h | 1 - .../descriptors/GPUImageCopyTextureTagged.h | 1 - .../api/descriptors/GPUImageDataLayout.h | 1 - .../api/descriptors/GPUMultisampleState.h | 1 - .../descriptors/GPUPipelineLayoutDescriptor.h | 1 - .../api/descriptors/GPUPrimitiveState.h | 1 - .../api/descriptors/GPUProgrammableStage.h | 1 - .../api/descriptors/GPUQuerySetDescriptor.h | 1 - .../api/descriptors/GPUQueueDescriptor.h | 1 - .../descriptors/GPURenderBundleDescriptor.h | 1 - .../GPURenderBundleEncoderDescriptor.h | 1 - .../GPURenderPassColorAttachment.h | 1 - .../GPURenderPassDepthStencilAttachment.h | 1 - .../api/descriptors/GPURenderPassDescriptor.h | 1 - .../GPURenderPassTimestampWrites.h | 1 - .../descriptors/GPURenderPipelineDescriptor.h | 1 - .../descriptors/GPURequestAdapterOptions.h | 1 - .../api/descriptors/GPUSamplerBindingLayout.h | 1 - .../api/descriptors/GPUSamplerDescriptor.h | 1 - .../GPUShaderModuleCompilationHint.h | 1 - .../descriptors/GPUShaderModuleDescriptor.h | 1 - .../api/descriptors/GPUStencilFaceState.h | 1 - .../GPUStorageTextureBindingLayout.h | 1 - .../api/descriptors/GPUTextureBindingLayout.h | 1 - .../api/descriptors/GPUTextureDescriptor.h | 1 - .../descriptors/GPUTextureViewDescriptor.h | 1 - .../descriptors/GPUUncapturedErrorEventInit.h | 1 - .../api/descriptors/GPUVertexAttribute.h | 1 - .../api/descriptors/GPUVertexBufferLayout.h | 1 - .../rnwgpu/api/descriptors/GPUVertexState.h | 1 - packages/webgpu/package.json | 2 +- .../webgpu/scripts/codegen/Descriptors.ts | 2 - packages/webgpu/scripts/codegen/model/dawn.ts | 6 +- .../webgpu/scripts/codegen/templates/Enum.ts | 14 +- .../scripts/codegen/templates/HybridObject.ts | 38 ++-- 64 files changed, 35 insertions(+), 513 deletions(-) delete mode 100644 packages/webgpu/cpp/jsi/RNFHybridObject.cpp delete mode 100644 packages/webgpu/cpp/jsi/RNFHybridObject.h delete mode 100644 packages/webgpu/cpp/jsi/RNFPointerHolder.h diff --git a/apps/example/ios/Podfile.lock b/apps/example/ios/Podfile.lock index 72c5024eb..f75a99dd0 100644 --- a/apps/example/ios/Podfile.lock +++ b/apps/example/ios/Podfile.lock @@ -1865,7 +1865,7 @@ PODS: - ReactCommon/turbomodule/core - SocketRocket - Yoga - - react-native-wgpu (0.4.2): + - react-native-wgpu (0.5.0): - boost - DoubleConversion - fast_float @@ -2903,7 +2903,7 @@ SPEC CHECKSUMS: React-microtasksnativemodule: 75b6604b667d297292345302cc5bfb6b6aeccc1b react-native-safe-area-context: c6e2edd1c1da07bdce287fa9d9e60c5f7b514616 react-native-skia: 5bf2b2107cd7f2d806fd364f5e16b1c7554ed3cd - react-native-wgpu: 8b91bdc8de384f0fce7dd622698e46645895b085 + react-native-wgpu: e54fcee5946cc2cee4814f63f425be358f097b14 React-NativeModulesApple: 879fbdc5dcff7136abceb7880fe8a2022a1bd7c3 React-oscompat: 93b5535ea7f7dff46aaee4f78309a70979bdde9d React-perflogger: 5536d2df3d18fe0920263466f7b46a56351c0510 diff --git a/packages/webgpu/android/CMakeLists.txt b/packages/webgpu/android/CMakeLists.txt index 660190c0c..b1f818e1b 100644 --- a/packages/webgpu/android/CMakeLists.txt +++ b/packages/webgpu/android/CMakeLists.txt @@ -45,7 +45,6 @@ add_library(${PACKAGE_NAME} SHARED ../cpp/rnwgpu/api/GPUCanvasContext.cpp ../cpp/rnwgpu/RNWebGPUManager.cpp ../cpp/jsi/RNFPromise.cpp - ../cpp/jsi/RNFHybridObject.cpp ../cpp/jsi/RNFRuntimeState.cpp ../cpp/rnwgpu/async/AsyncRunner.cpp ../cpp/rnwgpu/async/AsyncTaskHandle.cpp diff --git a/packages/webgpu/cpp/jsi/RNFHybridObject.cpp b/packages/webgpu/cpp/jsi/RNFHybridObject.cpp deleted file mode 100644 index 6c77177ff..000000000 --- a/packages/webgpu/cpp/jsi/RNFHybridObject.cpp +++ /dev/null @@ -1,150 +0,0 @@ -// -// Created by Marc Rousavy on 21.02.24. -// -#include "RNFHybridObject.h" -#include "RNFJSIConverter.h" -#include "WGPULogger.h" - -#include -#include -#include -#include - -namespace margelo { - -#if DEBUG && RNF_ENABLE_LOGS -static std::unordered_map _instanceIds; -static std::mutex _mutex; - -static int getId(const char* name) { - std::unique_lock lock(_mutex); - if (_instanceIds.find(name) == _instanceIds.end()) { - _instanceIds.insert({name, 1}); - } - auto iterator = _instanceIds.find(name); - return iterator->second++; -} -#endif - -HybridObject::HybridObject(const char* name) : _name(name) { -#if DEBUG && RNF_ENABLE_LOGS - _instanceId = getId(name); - Logger::logToConsole(TAG, "(MEMORY) Creating %s (#%i)... ✅", _name, _instanceId); -#endif -} - -HybridObject::~HybridObject() { -#if DEBUG && RNF_ENABLE_LOGS - Logger::log(TAG, "(MEMORY) Deleting %s (#%i)... ❌", _name, _instanceId); -#endif - _functionCache.clear(); -} - -std::string HybridObject::toString(jsi::Runtime& runtime) { - std::string result = std::string(_name) + " { "; - std::vector props = getPropertyNames(runtime); - for (size_t i = 0; i < props.size(); i++) { - auto suffix = i < props.size() - 1 ? ", " : " "; - result += "\"" + props[i].utf8(runtime) + "\"" + suffix; - } - return result + "}"; -} - -std::vector HybridObject::getPropertyNames(facebook::jsi::Runtime& runtime) { - std::unique_lock lock(_mutex); - ensureInitialized(runtime); - - std::vector result; - size_t totalSize = _methods.size() + _getters.size() + _setters.size(); - result.reserve(totalSize); - - for (const auto& item : _methods) { - result.push_back(jsi::PropNameID::forUtf8(runtime, item.first)); - } - for (const auto& item : _getters) { - result.push_back(jsi::PropNameID::forUtf8(runtime, item.first)); - } - for (const auto& item : _setters) { - result.push_back(jsi::PropNameID::forUtf8(runtime, item.first)); - } - return result; -} - -jsi::Value HybridObject::get(facebook::jsi::Runtime& runtime, const facebook::jsi::PropNameID& propName) { - std::unique_lock lock(_mutex); - ensureInitialized(runtime); - - std::string name = propName.utf8(runtime); - auto& functionCache = _functionCache[&runtime]; - - if (_getters.count(name) > 0) { - // it's a property getter - return _getters[name](runtime, jsi::Value::undefined(), nullptr, 0); - } - - if (functionCache.count(name) > 0) { - [[likely]]; - // cache hit - return jsi::Value(runtime, *functionCache[name]); - } - - if (_methods.count(name) > 0) { - // cache miss - create jsi::Function and cache it. - HybridFunction& hybridFunction = _methods.at(name); - jsi::Function function = jsi::Function::createFromHostFunction(runtime, jsi::PropNameID::forUtf8(runtime, name), - hybridFunction.parameterCount, hybridFunction.function); - - functionCache[name] = JSIHelper::createSharedJsiFunction(runtime, std::move(function)); - return jsi::Value(runtime, *functionCache[name]); - } - - if (name == "toString") { - return jsi::Function::createFromHostFunction( - runtime, jsi::PropNameID::forUtf8(runtime, "toString"), 0, - [=](jsi::Runtime& runtime, const jsi::Value& thisValue, const jsi::Value* args, size_t count) -> jsi::Value { - std::string stringRepresentation = this->toString(runtime); - return jsi::String::createFromUtf8(runtime, stringRepresentation); - }); - } - - return jsi::HostObject::get(runtime, propName); -} - -void HybridObject::set(facebook::jsi::Runtime& runtime, const facebook::jsi::PropNameID& propName, const facebook::jsi::Value& value) { - std::unique_lock lock(_mutex); - ensureInitialized(runtime); - - std::string name = propName.utf8(runtime); - - if (_setters.count(name) > 0) { - // Call setter - _setters[name](runtime, jsi::Value::undefined(), &value, 1); - return; - } - - HostObject::set(runtime, propName, value); -} - -void HybridObject::ensureInitialized(facebook::jsi::Runtime& runtime) { - if (!_didLoadMethods) { - [[unlikely]]; - _creationRuntime = &runtime; - _runtimeState = rnwgpu::RNFRuntimeState::get(runtime); - // lazy-load all exposed methods - loadHybridMethods(); - _didLoadMethods = true; - } -} - -bool HybridObject::isRuntimeAlive() { - return !_runtimeState.expired(); -} - -facebook::jsi::Runtime* HybridObject::getCreationRuntime() const { - if (_runtimeState.expired()) { - return nullptr; - } - return _creationRuntime; -} - -} // namespace margelo diff --git a/packages/webgpu/cpp/jsi/RNFHybridObject.h b/packages/webgpu/cpp/jsi/RNFHybridObject.h deleted file mode 100644 index 2e345606d..000000000 --- a/packages/webgpu/cpp/jsi/RNFHybridObject.h +++ /dev/null @@ -1,181 +0,0 @@ -// -// Created by Marc Rousavy on 21.02.24. -// - -#pragma once - -#include "WGPULogger.h" -#include "RNFRuntimeState.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// Forward declare to avoid circular dependency -namespace margelo { -template -struct JSIConverter; -} - -// Include the converter - this must come after forward declaration -#include "RNFJSIConverter.h" - -namespace margelo { - -namespace jsi = facebook::jsi; - -class HybridObject : public jsi::HostObject, public std::enable_shared_from_this { -public: - struct HybridFunction { - jsi::HostFunctionType function; - size_t parameterCount; - }; - -public: - explicit HybridObject(const char* name); - ~HybridObject(); - - void set(jsi::Runtime&, const jsi::PropNameID& name, const jsi::Value& value) override; - jsi::Value get(jsi::Runtime& runtime, const jsi::PropNameID& propName) override; - std::vector getPropertyNames(jsi::Runtime& runtime) override; - - /** - * Get the `std::shared_ptr` instance of this HybridObject. - * The HybridObject must be managed inside a `shared_ptr` already, otherwise this will fail. - */ - template std::shared_ptr shared() { - return std::static_pointer_cast(shared_from_this()); - } - - /** - * Loads all native methods of this `HybridObject` to be exposed to JavaScript. - * Example: - * - * ```cpp - * int User::getAge() { - * return 23; - * } - * - * void User::loadHybridMethods() { - * registerHybridMethod("getAge", &User::getAge, this); - * } - * ``` - */ - virtual void loadHybridMethods() = 0; - - /** - * Get a string representation of this HostObject, useful for logging or debugging. - */ - virtual std::string toString(jsi::Runtime& runtime); - - /** - * Get the memory pressure of this HostObject in bytes. - * This is used to inform the JavaScript runtime about memory usage for garbage collection. - */ - virtual size_t getMemoryPressure() { return 1024; } - -private: - static constexpr auto TAG = "HybridObject"; - int _instanceId = 1; - bool _didLoadMethods = false; - std::mutex _mutex; - std::unordered_map _methods; - std::unordered_map _getters; - std::unordered_map _setters; - std::unordered_map>> _functionCache; - -protected: - const char* _name = TAG; - // Store a pointer to the runtime for convenience; ensure it is only used while the runtime state is alive. - jsi::Runtime* _creationRuntime = nullptr; - std::weak_ptr _runtimeState; - -private: - inline void ensureInitialized(facebook::jsi::Runtime& runtime); - -private: - template - static inline jsi::Value callMethod(Derived* obj, ReturnType (Derived::*method)(Args...), jsi::Runtime& runtime, const jsi::Value* args, - std::index_sequence, size_t count) { - if constexpr (std::is_same_v) { - // It's a void method. - (obj->*method)(JSIConverter>::fromJSI(runtime, args[Is], Is >= count)...); - return jsi::Value::undefined(); - } else { - // It's returning some C++ type, we need to convert that to a JSI value now. - ReturnType result = (obj->*method)(JSIConverter>::fromJSI(runtime, args[Is], Is >= count)...); - return JSIConverter>::toJSI(runtime, std::move(result)); - } - } - - template - static jsi::HostFunctionType createHybridMethod(ReturnType (Derived::*method)(Args...), Derived* derivedInstance) { - - return [derivedInstance, method](jsi::Runtime& runtime, const jsi::Value& thisVal, const jsi::Value* args, size_t count) -> jsi::Value { - if constexpr (std::is_same_v) { - // If the return type is a jsi::Value, we assume the user wants full JSI code control. - // The signature must be identical to jsi::HostFunction (jsi::Runtime&, jsi::Value& this, ...) - return (derivedInstance->*method)(runtime, thisVal, args, count); - } else { - // Call the actual method with JSI values as arguments and return a JSI value again. - // Internally, this method converts the JSI values to C++ values. - return callMethod(derivedInstance, method, runtime, args, std::index_sequence_for{}, count); - } - }; - } - -protected: - facebook::jsi::Runtime* getCreationRuntime() const; - std::weak_ptr getRuntimeStateWeak() const { return _runtimeState; } - -protected: - template - void registerHybridMethod(std::string name, ReturnType (Derived::*method)(Args...), Derived* derivedInstance, bool override = false) { - if (!override && (_getters.count(name) > 0 || _setters.count(name) > 0)) { - [[unlikely]]; - throw std::runtime_error("Cannot add Hybrid Method \"" + name + "\" - a property with that name already exists!"); - } - if (!override && (_methods.count(name) > 0)) { - throw std::runtime_error("Cannot add Hybrid Method \"" + name + "\" - a method with that name already exists!"); - } - - _methods[name] = HybridFunction{.function = createHybridMethod(method, derivedInstance), .parameterCount = sizeof...(Args)}; - } - - template - void registerHybridGetter(std::string name, ReturnType (Derived::*method)(), Derived* derivedInstance) { - if (_getters.count(name) > 0) { - [[unlikely]]; - throw std::runtime_error("Cannot add Hybrid Property Getter \"" + name + "\" - a getter with that name already exists!"); - } - if (_methods.count(name) > 0) { - [[unlikely]]; - throw std::runtime_error("Cannot add Hybrid Property Getter \"" + name + "\" - a method with that name already exists!"); - } - - _getters[name] = createHybridMethod(method, derivedInstance); - } - - template - void registerHybridSetter(std::string name, void (Derived::*method)(ValueType), Derived* derivedInstance) { - if (_setters.count(name) > 0) { - [[unlikely]]; - throw std::runtime_error("Cannot add Hybrid Property Setter \"" + name + "\" - a setter with that name already exists!"); - } - if (_methods.count(name) > 0) { - [[unlikely]]; - throw std::runtime_error("Cannot add Hybrid Property Setter \"" + name + "\" - a method with that name already exists!"); - } - - _setters[name] = createHybridMethod(method, derivedInstance); - } - - bool isRuntimeAlive(); -}; - -} // namespace margelo diff --git a/packages/webgpu/cpp/jsi/RNFJSIConverter.h b/packages/webgpu/cpp/jsi/RNFJSIConverter.h index 50c954729..81d744e72 100644 --- a/packages/webgpu/cpp/jsi/RNFJSIConverter.h +++ b/packages/webgpu/cpp/jsi/RNFJSIConverter.h @@ -302,7 +302,7 @@ template struct JSIConverter {} +// HostObject (non-NativeState) <> {} template struct is_shared_ptr_to_host_object : std::false_type {}; // Only match HostObject types that are NOT NativeState types diff --git a/packages/webgpu/cpp/jsi/RNFPointerHolder.h b/packages/webgpu/cpp/jsi/RNFPointerHolder.h deleted file mode 100644 index f84345970..000000000 --- a/packages/webgpu/cpp/jsi/RNFPointerHolder.h +++ /dev/null @@ -1,95 +0,0 @@ -// -// Created by Marc Rousavy on 16.04.24. -// - -#pragma once - -#include "RNFHybridObject.h" -#include "RNFLogger.h" -#include -#include -#include -#include - -namespace margelo { - -namespace jsi = facebook::jsi; - -template class PointerHolder : public HybridObject { -protected: - // no default constructor - PointerHolder() = delete; - - /** - * Create a new instance of a pointer holder which holds the given shared_ptr. - * @param name The name of the implementing class, for example "ViewWrapper". - * @param pointer The pointer this class will hold. It might be released from JS at any point via `release()`. - */ - PointerHolder(const char* name, std::shared_ptr pointer) : HybridObject(name), _name(name), _pointer(pointer) { - // eagerly initialize the release() method instead of putting it in `loadHybridMethods` - registerHybridMethod("release", &PointerHolder::release, this); - registerHybridGetter("isValid", &PointerHolder::getIsValid, this); - } - - /** - * Create a new instance of a pointer holder which holds a shared_ptr of the given value. - * The shared_ptr will be move-constructed. - * @param name The name of the implementing class, for example "ViewWrapper". - * @param value The value this class will hold as a shared_ptr. It might be destroyed from JS at any point via `release()`. - */ - PointerHolder(const char* name, T&& value) : PointerHolder(name, std::make_shared(std::move(value))) {} - - /** - * Called when the PointerHolder gets automatically destroyed (e.g. via GC) and the shared_ptr will be destroyed. - */ - ~PointerHolder() { - if (_pointer != nullptr) { - Logger::log(TAG, "Automatically releasing %s... (~PointerHolder())", _name.c_str()); - } - } - -protected: - /** - * Manually release this reference to the pointer. - * If there are any other references to this pointer, no memory will be force-deleted. - */ - virtual void release() { - std::unique_lock lock(_mutex); - - if (_pointer == nullptr) { - throw std::runtime_error("Pointer " + _name + " has already been manually released!"); - } - Logger::log(TAG, "Manually releasing %s... (PointerHolder::release())", _name.c_str()); - _pointer = nullptr; - } - - /** - * Get the shared_ptr this class is holding. - * If it has already been manually released from JS, this method will throw a runtime_error. - */ - std::shared_ptr pointee() { - std::unique_lock lock(_mutex); - - if (_pointer == nullptr) { - throw std::runtime_error("Pointer " + _name + " has already been manually released!"); - } - return _pointer; - } - - /** - * Get if the pointer is still valid and strong. - */ - bool getIsValid() { - std::unique_lock lock(_mutex); - - return _pointer != nullptr; - } - -private: - std::string _name; - std::shared_ptr _pointer; - std::mutex _mutex; - static constexpr auto TAG = "PointerHolder"; -}; - -} // namespace margelo diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBindGroupDescriptor.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBindGroupDescriptor.h index 26cc8b6e9..1404b46b2 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBindGroupDescriptor.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBindGroupDescriptor.h @@ -11,7 +11,6 @@ #include "GPUBindGroupEntry.h" #include "GPUBindGroupLayout.h" -#include "RNFHybridObject.h" namespace jsi = facebook::jsi; diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBindGroupLayoutDescriptor.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBindGroupLayoutDescriptor.h index e57df5d97..94602cc0a 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBindGroupLayoutDescriptor.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBindGroupLayoutDescriptor.h @@ -10,7 +10,6 @@ #include "WGPULogger.h" #include "GPUBindGroupLayoutEntry.h" -#include "RNFHybridObject.h" namespace jsi = facebook::jsi; diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBindGroupLayoutEntry.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBindGroupLayoutEntry.h index 12056e718..5d509a16c 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBindGroupLayoutEntry.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBindGroupLayoutEntry.h @@ -12,7 +12,6 @@ #include "GPUSamplerBindingLayout.h" #include "GPUStorageTextureBindingLayout.h" #include "GPUTextureBindingLayout.h" -#include "RNFHybridObject.h" namespace jsi = facebook::jsi; diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBlendComponent.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBlendComponent.h index a95c4f0b8..3e25697f9 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBlendComponent.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBlendComponent.h @@ -7,7 +7,6 @@ #include "RNFJSIConverter.h" #include "WGPULogger.h" -#include "RNFHybridObject.h" namespace jsi = facebook::jsi; diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBlendState.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBlendState.h index e81120cfe..443e6b0a2 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBlendState.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBlendState.h @@ -8,7 +8,6 @@ #include "WGPULogger.h" #include "GPUBlendComponent.h" -#include "RNFHybridObject.h" namespace jsi = facebook::jsi; diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBufferBinding.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBufferBinding.h index 63ce9bb1f..b1133a482 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBufferBinding.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBufferBinding.h @@ -8,7 +8,6 @@ #include "WGPULogger.h" #include "GPUBuffer.h" -#include "RNFHybridObject.h" namespace jsi = facebook::jsi; diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBufferBindingLayout.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBufferBindingLayout.h index 41ca93a42..a9d7bba98 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBufferBindingLayout.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBufferBindingLayout.h @@ -7,7 +7,6 @@ #include "RNFJSIConverter.h" #include "WGPULogger.h" -#include "RNFHybridObject.h" namespace jsi = facebook::jsi; diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBufferDescriptor.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBufferDescriptor.h index aa64ff01d..743015e51 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBufferDescriptor.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBufferDescriptor.h @@ -8,7 +8,6 @@ #include "RNFJSIConverter.h" #include "WGPULogger.h" -#include "RNFHybridObject.h" namespace jsi = facebook::jsi; diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUCanvasConfiguration.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUCanvasConfiguration.h index c604bae05..8f1a22213 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUCanvasConfiguration.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUCanvasConfiguration.h @@ -8,7 +8,6 @@ #include "RNFJSIConverter.h" #include "GPUDevice.h" -#include "RNFHybridObject.h" namespace jsi = facebook::jsi; diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUColor.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUColor.h index a28e63b91..2a64631a6 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUColor.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUColor.h @@ -7,7 +7,6 @@ #include "RNFJSIConverter.h" #include "WGPULogger.h" -#include "RNFHybridObject.h" namespace jsi = facebook::jsi; diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUColorTargetState.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUColorTargetState.h index 9b353a9cb..55bf06b95 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUColorTargetState.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUColorTargetState.h @@ -8,7 +8,6 @@ #include "WGPULogger.h" #include "GPUBlendState.h" -#include "RNFHybridObject.h" namespace jsi = facebook::jsi; diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUCommandBufferDescriptor.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUCommandBufferDescriptor.h index f6d81c008..65d744590 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUCommandBufferDescriptor.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUCommandBufferDescriptor.h @@ -8,7 +8,6 @@ #include "RNFJSIConverter.h" #include "WGPULogger.h" -#include "RNFHybridObject.h" namespace jsi = facebook::jsi; diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUCommandEncoderDescriptor.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUCommandEncoderDescriptor.h index 1c94c3d1b..c08a1691e 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUCommandEncoderDescriptor.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUCommandEncoderDescriptor.h @@ -8,7 +8,6 @@ #include "RNFJSIConverter.h" #include "WGPULogger.h" -#include "RNFHybridObject.h" namespace jsi = facebook::jsi; diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUComputePassDescriptor.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUComputePassDescriptor.h index 9b444a4c2..38178133f 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUComputePassDescriptor.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUComputePassDescriptor.h @@ -9,7 +9,6 @@ #include "WGPULogger.h" #include "GPUComputePassTimestampWrites.h" -#include "RNFHybridObject.h" namespace jsi = facebook::jsi; diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUComputePassTimestampWrites.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUComputePassTimestampWrites.h index 2cf87dd3c..bdc052b61 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUComputePassTimestampWrites.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUComputePassTimestampWrites.h @@ -8,7 +8,6 @@ #include "WGPULogger.h" #include "GPUQuerySet.h" -#include "RNFHybridObject.h" namespace jsi = facebook::jsi; diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUComputePipelineDescriptor.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUComputePipelineDescriptor.h index ad3dfaf1f..2308ca221 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUComputePipelineDescriptor.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUComputePipelineDescriptor.h @@ -10,7 +10,6 @@ #include "GPUPipelineLayout.h" #include "GPUProgrammableStage.h" -#include "RNFHybridObject.h" namespace jsi = facebook::jsi; diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUDepthStencilState.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUDepthStencilState.h index 2cbaf6ae7..c739d9a5f 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUDepthStencilState.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUDepthStencilState.h @@ -8,7 +8,6 @@ #include "WGPULogger.h" #include "GPUStencilFaceState.h" -#include "RNFHybridObject.h" namespace jsi = facebook::jsi; diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUDeviceDescriptor.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUDeviceDescriptor.h index 7f6893cc5..eba0e1811 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUDeviceDescriptor.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUDeviceDescriptor.h @@ -11,7 +11,6 @@ #include "WGPULogger.h" #include "GPUQueueDescriptor.h" -#include "RNFHybridObject.h" namespace jsi = facebook::jsi; diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUExternalTextureBindingLayout.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUExternalTextureBindingLayout.h index b60d8d58c..14e8d20e2 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUExternalTextureBindingLayout.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUExternalTextureBindingLayout.h @@ -7,7 +7,6 @@ #include "RNFJSIConverter.h" #include "WGPULogger.h" -#include "RNFHybridObject.h" namespace jsi = facebook::jsi; diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUExternalTextureDescriptor.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUExternalTextureDescriptor.h index 7f057a5f8..e2bda5c92 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUExternalTextureDescriptor.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUExternalTextureDescriptor.h @@ -9,7 +9,6 @@ #include "Convertors.h" -#include "RNFHybridObject.h" #include "RNFJSIConverter.h" #include "WGPULogger.h" diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUFragmentState.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUFragmentState.h index 8c82495f6..f5e1ae4f0 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUFragmentState.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUFragmentState.h @@ -13,7 +13,6 @@ #include "GPUColorTargetState.h" #include "GPUShaderModule.h" -#include "RNFHybridObject.h" namespace jsi = facebook::jsi; diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUImageCopyBuffer.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUImageCopyBuffer.h index 12f84c4e1..93d9da35a 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUImageCopyBuffer.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUImageCopyBuffer.h @@ -8,7 +8,6 @@ #include "WGPULogger.h" #include "GPUBuffer.h" -#include "RNFHybridObject.h" namespace jsi = facebook::jsi; diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUImageCopyExternalImage.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUImageCopyExternalImage.h index eb9b102e0..0b4b1df0e 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUImageCopyExternalImage.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUImageCopyExternalImage.h @@ -8,7 +8,6 @@ #include "webgpu/webgpu_cpp.h" #include "Convertors.h" -#include "RNFHybridObject.h" #include "RNFJSIConverter.h" #include "GPUOrigin2D.h" diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUImageCopyTexture.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUImageCopyTexture.h index d66b013f9..2e554cd6d 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUImageCopyTexture.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUImageCopyTexture.h @@ -9,7 +9,6 @@ #include "GPUOrigin3D.h" #include "GPUTexture.h" -#include "RNFHybridObject.h" namespace jsi = facebook::jsi; diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUImageCopyTextureTagged.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUImageCopyTextureTagged.h index b8542b0a8..c400ecf8b 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUImageCopyTextureTagged.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUImageCopyTextureTagged.h @@ -10,7 +10,6 @@ #include "External.h" #include "GPUOrigin3D.h" #include "GPUTexture.h" -#include "RNFHybridObject.h" namespace jsi = facebook::jsi; diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUImageDataLayout.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUImageDataLayout.h index 42a622a31..b355088b1 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUImageDataLayout.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUImageDataLayout.h @@ -7,7 +7,6 @@ #include "RNFJSIConverter.h" #include "WGPULogger.h" -#include "RNFHybridObject.h" namespace jsi = facebook::jsi; diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUMultisampleState.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUMultisampleState.h index c12f21fd8..eb6f31747 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUMultisampleState.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUMultisampleState.h @@ -7,7 +7,6 @@ #include "RNFJSIConverter.h" #include "WGPULogger.h" -#include "RNFHybridObject.h" namespace jsi = facebook::jsi; diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUPipelineLayoutDescriptor.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUPipelineLayoutDescriptor.h index 6030cf0e9..22ae4ecfd 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUPipelineLayoutDescriptor.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUPipelineLayoutDescriptor.h @@ -10,7 +10,6 @@ #include "WGPULogger.h" #include "GPUBindGroupLayout.h" -#include "RNFHybridObject.h" namespace jsi = facebook::jsi; diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUPrimitiveState.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUPrimitiveState.h index fae935a64..308544531 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUPrimitiveState.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUPrimitiveState.h @@ -7,7 +7,6 @@ #include "RNFJSIConverter.h" #include "WGPULogger.h" -#include "RNFHybridObject.h" namespace jsi = facebook::jsi; diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUProgrammableStage.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUProgrammableStage.h index b39e39a6e..5c252709e 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUProgrammableStage.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUProgrammableStage.h @@ -10,7 +10,6 @@ #include "WGPULogger.h" #include "GPUShaderModule.h" -#include "RNFHybridObject.h" namespace jsi = facebook::jsi; diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUQuerySetDescriptor.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUQuerySetDescriptor.h index b44b2ca47..cb4888001 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUQuerySetDescriptor.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUQuerySetDescriptor.h @@ -8,7 +8,6 @@ #include "RNFJSIConverter.h" #include "WGPULogger.h" -#include "RNFHybridObject.h" namespace jsi = facebook::jsi; diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUQueueDescriptor.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUQueueDescriptor.h index 5eb58ecb3..dc89e307d 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUQueueDescriptor.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUQueueDescriptor.h @@ -8,7 +8,6 @@ #include "RNFJSIConverter.h" #include "WGPULogger.h" -#include "RNFHybridObject.h" namespace jsi = facebook::jsi; diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPURenderBundleDescriptor.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPURenderBundleDescriptor.h index 6b46ee3a7..4f0191c11 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPURenderBundleDescriptor.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPURenderBundleDescriptor.h @@ -8,7 +8,6 @@ #include "RNFJSIConverter.h" #include "WGPULogger.h" -#include "RNFHybridObject.h" namespace jsi = facebook::jsi; diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPURenderBundleEncoderDescriptor.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPURenderBundleEncoderDescriptor.h index 6bf516f67..282d2cfc6 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPURenderBundleEncoderDescriptor.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPURenderBundleEncoderDescriptor.h @@ -9,7 +9,6 @@ #include "RNFJSIConverter.h" #include "WGPULogger.h" -#include "RNFHybridObject.h" namespace jsi = facebook::jsi; diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPURenderPassColorAttachment.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPURenderPassColorAttachment.h index 5a89cc081..bfde2e7b5 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPURenderPassColorAttachment.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPURenderPassColorAttachment.h @@ -9,7 +9,6 @@ #include "GPUColor.h" #include "GPUTextureView.h" -#include "RNFHybridObject.h" namespace jsi = facebook::jsi; diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPURenderPassDepthStencilAttachment.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPURenderPassDepthStencilAttachment.h index ba5e57471..05f76490c 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPURenderPassDepthStencilAttachment.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPURenderPassDepthStencilAttachment.h @@ -8,7 +8,6 @@ #include "WGPULogger.h" #include "GPUTextureView.h" -#include "RNFHybridObject.h" namespace jsi = facebook::jsi; diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPURenderPassDescriptor.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPURenderPassDescriptor.h index 0aef9a84a..75c4d6959 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPURenderPassDescriptor.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPURenderPassDescriptor.h @@ -14,7 +14,6 @@ #include "GPURenderPassColorAttachment.h" #include "GPURenderPassDepthStencilAttachment.h" #include "GPURenderPassTimestampWrites.h" -#include "RNFHybridObject.h" namespace jsi = facebook::jsi; diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPURenderPassTimestampWrites.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPURenderPassTimestampWrites.h index 30c4a222d..569519606 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPURenderPassTimestampWrites.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPURenderPassTimestampWrites.h @@ -8,7 +8,6 @@ #include "WGPULogger.h" #include "GPUQuerySet.h" -#include "RNFHybridObject.h" namespace jsi = facebook::jsi; diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPURenderPipelineDescriptor.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPURenderPipelineDescriptor.h index 8fdcb9736..8b6ad814c 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPURenderPipelineDescriptor.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPURenderPipelineDescriptor.h @@ -14,7 +14,6 @@ #include "GPUPipelineLayout.h" #include "GPUPrimitiveState.h" #include "GPUVertexState.h" -#include "RNFHybridObject.h" namespace jsi = facebook::jsi; diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPURequestAdapterOptions.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPURequestAdapterOptions.h index 1d34f6223..ee72c81e4 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPURequestAdapterOptions.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPURequestAdapterOptions.h @@ -7,7 +7,6 @@ #include "RNFJSIConverter.h" #include "WGPULogger.h" -#include "RNFHybridObject.h" namespace jsi = facebook::jsi; diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUSamplerBindingLayout.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUSamplerBindingLayout.h index 42dbfaef1..61d78e0f5 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUSamplerBindingLayout.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUSamplerBindingLayout.h @@ -7,7 +7,6 @@ #include "RNFJSIConverter.h" #include "WGPULogger.h" -#include "RNFHybridObject.h" namespace jsi = facebook::jsi; diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUSamplerDescriptor.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUSamplerDescriptor.h index 965b8e29e..34fed143f 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUSamplerDescriptor.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUSamplerDescriptor.h @@ -8,7 +8,6 @@ #include "RNFJSIConverter.h" #include "WGPULogger.h" -#include "RNFHybridObject.h" namespace jsi = facebook::jsi; diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUShaderModuleCompilationHint.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUShaderModuleCompilationHint.h index 86071c8f1..d0887b12f 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUShaderModuleCompilationHint.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUShaderModuleCompilationHint.h @@ -9,7 +9,6 @@ #include "WGPULogger.h" #include "GPUPipelineLayout.h" -#include "RNFHybridObject.h" namespace jsi = facebook::jsi; diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUShaderModuleDescriptor.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUShaderModuleDescriptor.h index c9fc41f6f..3bc9dc9f4 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUShaderModuleDescriptor.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUShaderModuleDescriptor.h @@ -10,7 +10,6 @@ #include "WGPULogger.h" #include "GPUShaderModuleCompilationHint.h" -#include "RNFHybridObject.h" namespace jsi = facebook::jsi; diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUStencilFaceState.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUStencilFaceState.h index a687c1ba8..c8b96a796 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUStencilFaceState.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUStencilFaceState.h @@ -7,7 +7,6 @@ #include "RNFJSIConverter.h" #include "WGPULogger.h" -#include "RNFHybridObject.h" namespace jsi = facebook::jsi; diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUStorageTextureBindingLayout.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUStorageTextureBindingLayout.h index 5df1caf39..d16277e53 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUStorageTextureBindingLayout.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUStorageTextureBindingLayout.h @@ -7,7 +7,6 @@ #include "RNFJSIConverter.h" #include "WGPULogger.h" -#include "RNFHybridObject.h" namespace jsi = facebook::jsi; diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUTextureBindingLayout.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUTextureBindingLayout.h index 470769221..694fbe41b 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUTextureBindingLayout.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUTextureBindingLayout.h @@ -7,7 +7,6 @@ #include "RNFJSIConverter.h" #include "WGPULogger.h" -#include "RNFHybridObject.h" namespace jsi = facebook::jsi; diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUTextureDescriptor.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUTextureDescriptor.h index 3953ffacd..3f6a5439f 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUTextureDescriptor.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUTextureDescriptor.h @@ -10,7 +10,6 @@ #include "WGPULogger.h" #include "GPUExtent3D.h" -#include "RNFHybridObject.h" namespace jsi = facebook::jsi; diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUTextureViewDescriptor.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUTextureViewDescriptor.h index 070fac500..915df37fc 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUTextureViewDescriptor.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUTextureViewDescriptor.h @@ -8,7 +8,6 @@ #include "RNFJSIConverter.h" #include "WGPULogger.h" -#include "RNFHybridObject.h" namespace jsi = facebook::jsi; diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUUncapturedErrorEventInit.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUUncapturedErrorEventInit.h index a688e7e4c..53d720bd8 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUUncapturedErrorEventInit.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUUncapturedErrorEventInit.h @@ -8,7 +8,6 @@ #include "WGPULogger.h" #include "GPUError.h" -#include "RNFHybridObject.h" namespace jsi = facebook::jsi; diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUVertexAttribute.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUVertexAttribute.h index 1721b6da1..5eeda927d 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUVertexAttribute.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUVertexAttribute.h @@ -7,7 +7,6 @@ #include "RNFJSIConverter.h" #include "WGPULogger.h" -#include "RNFHybridObject.h" namespace jsi = facebook::jsi; diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUVertexBufferLayout.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUVertexBufferLayout.h index 7b2fed6c0..f77eca199 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUVertexBufferLayout.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUVertexBufferLayout.h @@ -9,7 +9,6 @@ #include "WGPULogger.h" #include "GPUVertexAttribute.h" -#include "RNFHybridObject.h" namespace jsi = facebook::jsi; diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUVertexState.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUVertexState.h index cfb96d062..9a05ab0c4 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUVertexState.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUVertexState.h @@ -13,7 +13,6 @@ #include "GPUShaderModule.h" #include "GPUVertexBufferLayout.h" -#include "RNFHybridObject.h" namespace jsi = facebook::jsi; diff --git a/packages/webgpu/package.json b/packages/webgpu/package.json index 7ae56a557..43c7b4b85 100644 --- a/packages/webgpu/package.json +++ b/packages/webgpu/package.json @@ -1,6 +1,6 @@ { "name": "react-native-wgpu", - "version": "0.4.2", + "version": "0.5.0", "description": "React Native WebGPU", "main": "lib/commonjs/index", "module": "lib/module/index", diff --git a/packages/webgpu/scripts/codegen/Descriptors.ts b/packages/webgpu/scripts/codegen/Descriptors.ts index 8cbfb9bcd..1eb3850b4 100644 --- a/packages/webgpu/scripts/codegen/Descriptors.ts +++ b/packages/webgpu/scripts/codegen/Descriptors.ts @@ -271,14 +271,12 @@ ${Array.from(dependencies) #include "WGPULogger.h" #include "RNFJSIConverter.h" -#include "RNFHybridObject.h" ${Array.from(dependencies) .filter((dep) => dep[0] !== dep[0].toLowerCase()) .map((dep) => `#include "${dep}.h"`) .join("\n")} namespace jsi = facebook::jsi; -namespace m = margelo; namespace rnwgpu { diff --git a/packages/webgpu/scripts/codegen/model/dawn.ts b/packages/webgpu/scripts/codegen/model/dawn.ts index ccde1ddf7..60bb94ca9 100644 --- a/packages/webgpu/scripts/codegen/model/dawn.ts +++ b/packages/webgpu/scripts/codegen/model/dawn.ts @@ -47,7 +47,7 @@ export const resolved: Record< > = { GPU: { ctor: `GPU() - : HybridObject("GPU") { + : NativeObject(CLASS_NAME) { wgpu::InstanceDescriptor instanceDesc; instanceDesc.features.timedWaitAnyEnable = true; instanceDesc.features.timedWaitAnyMaxCount = 64; @@ -57,9 +57,9 @@ export const resolved: Record< }`, }, GPUDevice: { - ctor: ` explicit GPUDevice(wgpu::Device instance, std::shared_ptr async, + ctor: `explicit GPUDevice(wgpu::Device instance, std::shared_ptr async, std::string label) - : HybridObject("GPUDevice"), _instance(instance), _async(async), + : NativeObject(CLASS_NAME), _instance(instance), _async(async), _label(label) { m_lostPromise = std::make_shared>>(); }`, diff --git a/packages/webgpu/scripts/codegen/templates/Enum.ts b/packages/webgpu/scripts/codegen/templates/Enum.ts index 54b0ed329..7a8e10e11 100644 --- a/packages/webgpu/scripts/codegen/templates/Enum.ts +++ b/packages/webgpu/scripts/codegen/templates/Enum.ts @@ -18,17 +18,19 @@ export const getEnum = (decl: VariableDeclaration) => { return `#pragma once #include -#include +#include #include "webgpu/webgpu_cpp.h" namespace rnwgpu { -namespace m = margelo; +namespace jsi = facebook::jsi; -class ${name} : public m::HybridObject { +class ${name} : public NativeObject<${name}> { public: - ${name}() : HybridObject("${name}") {} + static constexpr const char *CLASS_NAME = "${name}"; + + ${name}() : NativeObject(CLASS_NAME) {} public: ${properties @@ -40,11 +42,11 @@ public: }) .join("\n ")} - void loadHybridMethods() override { + static void definePrototype(jsi::Runtime &runtime, jsi::Object &prototype) { ${properties .map((property) => { const prop = getPropName(property); - return `registerHybridGetter("${property.getName()}", &${name}::${prop}, this);`; + return `installGetter(runtime, prototype, "${property.getName()}", &${name}::${prop});`; }) .join("\n ")} } diff --git a/packages/webgpu/scripts/codegen/templates/HybridObject.ts b/packages/webgpu/scripts/codegen/templates/HybridObject.ts index 3a12fdacd..46257fa61 100644 --- a/packages/webgpu/scripts/codegen/templates/HybridObject.ts +++ b/packages/webgpu/scripts/codegen/templates/HybridObject.ts @@ -127,9 +127,9 @@ ${Array.from(dependencies) #include "Unions.h" -#include "RNFHybridObject.h" +#include "RNFNativeObject.h" -#include "AsyncRunner.h" +#include "rnwgpu/async/AsyncRunner.h" #include "webgpu/webgpu_cpp.h" @@ -140,18 +140,20 @@ ${Array.from(dependencies) namespace rnwgpu { -namespace m = margelo; +namespace jsi = facebook::jsi; -class ${className} : public m::HybridObject { +class ${className} : public NativeObject<${className}> { public: + static constexpr const char *CLASS_NAME = "${className}"; + ${ ctor ? ctor - : ` explicit ${className}(${ctorParams.map((param) => `${param.type} ${param.name}`).join(", ")}) : HybridObject("${className}"), ${ctorParams.map((param) => `_${param.name}(${param.name})`).join(", ")} {}` + : `explicit ${className}(${ctorParams.map((param) => `${param.type} ${param.name}`).join(", ")}) : NativeObject(CLASS_NAME), ${ctorParams.map((param) => `_${param.name}(${param.name})`).join(", ")} {}` } public: - std::string getBrand() { return _name; } + std::string getBrand() { return CLASS_NAME; } ${methods .map((method) => { @@ -167,35 +169,35 @@ public: ${ hasLabel ? `std::string getLabel() { return _label; } - void setLabel(const std::string& label) { _label = label; - _instance.SetLabel(_label.c_str()); - }` + void setLabel(const std::string& label) { + _label = label; + _instance.SetLabel(_label.c_str()); + }` : "" } - void loadHybridMethods() override { - registerHybridGetter("__brand", &${className}::getBrand, this); + static void definePrototype(jsi::Runtime &runtime, jsi::Object &prototype) { + installGetter(runtime, prototype, "__brand", &${className}::getBrand); ${methods .map( (method) => - `registerHybridMethod("${method.name}", &${className}::${method.name}, this);`, + `installMethod(runtime, prototype, "${method.name}", &${className}::${method.name});`, ) - .join("\n")} - ${properties.map((prop) => `registerHybridGetter("${prop.name}", &${className}::get${_.upperFirst(prop.name)}, this);`).join("\n")} + .join("\n ")} + ${properties.map((prop) => `installGetter(runtime, prototype, "${prop.name}", &${className}::get${_.upperFirst(prop.name)});`).join("\n ")} ${ hasLabel - ? `registerHybridGetter("label", &${className}::getLabel, this); - registerHybridSetter("label", &${className}::setLabel, this);` + ? `installGetterSetter(runtime, prototype, "label", &${className}::getLabel, &${className}::setLabel);` : "" } } - + inline const ${instanceName} get() { return _instance; } private: - ${ctorParams.map((param) => `${param.type} _${param.name};`).join("\n")} + ${ctorParams.map((param) => `${param.type} _${param.name};`).join("\n ")} ${resolveExtra(className)} }; From 2b67e2ce424203da2a4c32ae69f0914168139568 Mon Sep 17 00:00:00 2001 From: William Candillon Date: Mon, 12 Jan 2026 16:37:34 +0100 Subject: [PATCH 06/23] :wrench: --- packages/webgpu/cpp/jsi/{RNFNativeObject.h => NativeObject.h} | 0 packages/webgpu/cpp/rnwgpu/api/Canvas.h | 2 +- packages/webgpu/cpp/rnwgpu/api/GPU.h | 2 +- packages/webgpu/cpp/rnwgpu/api/GPUAdapter.h | 2 +- packages/webgpu/cpp/rnwgpu/api/GPUAdapterInfo.h | 2 +- packages/webgpu/cpp/rnwgpu/api/GPUBindGroup.h | 2 +- packages/webgpu/cpp/rnwgpu/api/GPUBindGroupLayout.h | 2 +- packages/webgpu/cpp/rnwgpu/api/GPUBuffer.h | 2 +- packages/webgpu/cpp/rnwgpu/api/GPUCanvasContext.h | 2 +- packages/webgpu/cpp/rnwgpu/api/GPUCommandBuffer.h | 2 +- packages/webgpu/cpp/rnwgpu/api/GPUCommandEncoder.h | 2 +- packages/webgpu/cpp/rnwgpu/api/GPUCompilationInfo.h | 2 +- packages/webgpu/cpp/rnwgpu/api/GPUCompilationMessage.h | 2 +- packages/webgpu/cpp/rnwgpu/api/GPUComputePassEncoder.h | 2 +- packages/webgpu/cpp/rnwgpu/api/GPUComputePipeline.h | 2 +- packages/webgpu/cpp/rnwgpu/api/GPUDevice.h | 2 +- packages/webgpu/cpp/rnwgpu/api/GPUDeviceLostInfo.h | 2 +- packages/webgpu/cpp/rnwgpu/api/GPUExternalTexture.h | 2 +- packages/webgpu/cpp/rnwgpu/api/GPUPipelineLayout.h | 2 +- packages/webgpu/cpp/rnwgpu/api/GPUQuerySet.h | 2 +- packages/webgpu/cpp/rnwgpu/api/GPUQueue.h | 2 +- packages/webgpu/cpp/rnwgpu/api/GPURenderBundle.h | 2 +- packages/webgpu/cpp/rnwgpu/api/GPURenderBundleEncoder.h | 2 +- packages/webgpu/cpp/rnwgpu/api/GPURenderPassEncoder.h | 2 +- packages/webgpu/cpp/rnwgpu/api/GPURenderPipeline.h | 2 +- packages/webgpu/cpp/rnwgpu/api/GPUSampler.h | 2 +- packages/webgpu/cpp/rnwgpu/api/GPUShaderModule.h | 2 +- packages/webgpu/cpp/rnwgpu/api/GPUSupportedLimits.h | 2 +- packages/webgpu/cpp/rnwgpu/api/GPUTexture.h | 2 +- packages/webgpu/cpp/rnwgpu/api/GPUTextureView.h | 2 +- packages/webgpu/cpp/rnwgpu/api/ImageBitmap.h | 2 +- packages/webgpu/cpp/rnwgpu/api/RNWebGPU.h | 2 +- packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBlendComponent.h | 1 - .../webgpu/cpp/rnwgpu/api/descriptors/GPUBufferBindingLayout.h | 1 - .../webgpu/cpp/rnwgpu/api/descriptors/GPUBufferDescriptor.h | 1 - packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBufferUsage.h | 2 +- packages/webgpu/cpp/rnwgpu/api/descriptors/GPUColor.h | 1 - packages/webgpu/cpp/rnwgpu/api/descriptors/GPUColorWrite.h | 2 +- .../cpp/rnwgpu/api/descriptors/GPUCommandBufferDescriptor.h | 1 - .../cpp/rnwgpu/api/descriptors/GPUCommandEncoderDescriptor.h | 1 - .../rnwgpu/api/descriptors/GPUExternalTextureBindingLayout.h | 1 - packages/webgpu/cpp/rnwgpu/api/descriptors/GPUImageDataLayout.h | 1 - packages/webgpu/cpp/rnwgpu/api/descriptors/GPUMapMode.h | 2 +- .../webgpu/cpp/rnwgpu/api/descriptors/GPUMultisampleState.h | 1 - packages/webgpu/cpp/rnwgpu/api/descriptors/GPUPrimitiveState.h | 1 - .../webgpu/cpp/rnwgpu/api/descriptors/GPUQuerySetDescriptor.h | 1 - packages/webgpu/cpp/rnwgpu/api/descriptors/GPUQueueDescriptor.h | 1 - .../cpp/rnwgpu/api/descriptors/GPURenderBundleDescriptor.h | 1 - .../rnwgpu/api/descriptors/GPURenderBundleEncoderDescriptor.h | 1 - .../cpp/rnwgpu/api/descriptors/GPURequestAdapterOptions.h | 1 - .../webgpu/cpp/rnwgpu/api/descriptors/GPUSamplerBindingLayout.h | 1 - .../webgpu/cpp/rnwgpu/api/descriptors/GPUSamplerDescriptor.h | 1 - packages/webgpu/cpp/rnwgpu/api/descriptors/GPUShaderStage.h | 2 +- .../webgpu/cpp/rnwgpu/api/descriptors/GPUStencilFaceState.h | 1 - .../cpp/rnwgpu/api/descriptors/GPUStorageTextureBindingLayout.h | 1 - .../webgpu/cpp/rnwgpu/api/descriptors/GPUTextureBindingLayout.h | 1 - packages/webgpu/cpp/rnwgpu/api/descriptors/GPUTextureUsage.h | 2 +- .../cpp/rnwgpu/api/descriptors/GPUTextureViewDescriptor.h | 1 - packages/webgpu/cpp/rnwgpu/api/descriptors/GPUVertexAttribute.h | 1 - packages/webgpu/scripts/codegen/templates/Enum.ts | 2 +- packages/webgpu/scripts/codegen/templates/HybridObject.ts | 2 +- 61 files changed, 38 insertions(+), 60 deletions(-) rename packages/webgpu/cpp/jsi/{RNFNativeObject.h => NativeObject.h} (100%) diff --git a/packages/webgpu/cpp/jsi/RNFNativeObject.h b/packages/webgpu/cpp/jsi/NativeObject.h similarity index 100% rename from packages/webgpu/cpp/jsi/RNFNativeObject.h rename to packages/webgpu/cpp/jsi/NativeObject.h diff --git a/packages/webgpu/cpp/rnwgpu/api/Canvas.h b/packages/webgpu/cpp/rnwgpu/api/Canvas.h index 1f6326d77..b84ec6929 100644 --- a/packages/webgpu/cpp/rnwgpu/api/Canvas.h +++ b/packages/webgpu/cpp/rnwgpu/api/Canvas.h @@ -7,7 +7,7 @@ #include "webgpu/webgpu_cpp.h" -#include "RNFNativeObject.h" +#include "NativeObject.h" namespace rnwgpu { diff --git a/packages/webgpu/cpp/rnwgpu/api/GPU.h b/packages/webgpu/cpp/rnwgpu/api/GPU.h index 3326b27fd..27db1f903 100644 --- a/packages/webgpu/cpp/rnwgpu/api/GPU.h +++ b/packages/webgpu/cpp/rnwgpu/api/GPU.h @@ -7,7 +7,7 @@ #include "Unions.h" -#include "RNFNativeObject.h" +#include "NativeObject.h" #include "rnwgpu/async/AsyncRunner.h" #include "rnwgpu/async/AsyncTaskHandle.h" diff --git a/packages/webgpu/cpp/rnwgpu/api/GPUAdapter.h b/packages/webgpu/cpp/rnwgpu/api/GPUAdapter.h index 8d0499715..66acdc2f7 100644 --- a/packages/webgpu/cpp/rnwgpu/api/GPUAdapter.h +++ b/packages/webgpu/cpp/rnwgpu/api/GPUAdapter.h @@ -6,7 +6,7 @@ #include "Unions.h" -#include "RNFNativeObject.h" +#include "NativeObject.h" #include "rnwgpu/async/AsyncRunner.h" #include "rnwgpu/async/AsyncTaskHandle.h" diff --git a/packages/webgpu/cpp/rnwgpu/api/GPUAdapterInfo.h b/packages/webgpu/cpp/rnwgpu/api/GPUAdapterInfo.h index 6b5ca9e94..414713176 100644 --- a/packages/webgpu/cpp/rnwgpu/api/GPUAdapterInfo.h +++ b/packages/webgpu/cpp/rnwgpu/api/GPUAdapterInfo.h @@ -5,7 +5,7 @@ #include "Unions.h" -#include "RNFNativeObject.h" +#include "NativeObject.h" #include "Convertors.h" diff --git a/packages/webgpu/cpp/rnwgpu/api/GPUBindGroup.h b/packages/webgpu/cpp/rnwgpu/api/GPUBindGroup.h index d071e449c..fd3c8c9d4 100644 --- a/packages/webgpu/cpp/rnwgpu/api/GPUBindGroup.h +++ b/packages/webgpu/cpp/rnwgpu/api/GPUBindGroup.h @@ -4,7 +4,7 @@ #include "Unions.h" -#include "RNFNativeObject.h" +#include "NativeObject.h" #include "webgpu/webgpu_cpp.h" diff --git a/packages/webgpu/cpp/rnwgpu/api/GPUBindGroupLayout.h b/packages/webgpu/cpp/rnwgpu/api/GPUBindGroupLayout.h index fc7437d78..ae4abae79 100644 --- a/packages/webgpu/cpp/rnwgpu/api/GPUBindGroupLayout.h +++ b/packages/webgpu/cpp/rnwgpu/api/GPUBindGroupLayout.h @@ -4,7 +4,7 @@ #include "Unions.h" -#include "RNFNativeObject.h" +#include "NativeObject.h" #include "webgpu/webgpu_cpp.h" diff --git a/packages/webgpu/cpp/rnwgpu/api/GPUBuffer.h b/packages/webgpu/cpp/rnwgpu/api/GPUBuffer.h index 3b4769361..edfc8e41b 100644 --- a/packages/webgpu/cpp/rnwgpu/api/GPUBuffer.h +++ b/packages/webgpu/cpp/rnwgpu/api/GPUBuffer.h @@ -7,7 +7,7 @@ #include "Unions.h" -#include "RNFNativeObject.h" +#include "NativeObject.h" #include "rnwgpu/async/AsyncRunner.h" #include "rnwgpu/async/AsyncTaskHandle.h" diff --git a/packages/webgpu/cpp/rnwgpu/api/GPUCanvasContext.h b/packages/webgpu/cpp/rnwgpu/api/GPUCanvasContext.h index 1423b5784..4b97a7887 100644 --- a/packages/webgpu/cpp/rnwgpu/api/GPUCanvasContext.h +++ b/packages/webgpu/cpp/rnwgpu/api/GPUCanvasContext.h @@ -8,7 +8,7 @@ #include "webgpu/webgpu_cpp.h" -#include "RNFNativeObject.h" +#include "NativeObject.h" #include "Canvas.h" #include "GPU.h" diff --git a/packages/webgpu/cpp/rnwgpu/api/GPUCommandBuffer.h b/packages/webgpu/cpp/rnwgpu/api/GPUCommandBuffer.h index 73b11e20a..4f537d084 100644 --- a/packages/webgpu/cpp/rnwgpu/api/GPUCommandBuffer.h +++ b/packages/webgpu/cpp/rnwgpu/api/GPUCommandBuffer.h @@ -4,7 +4,7 @@ #include "Unions.h" -#include "RNFNativeObject.h" +#include "NativeObject.h" #include "webgpu/webgpu_cpp.h" diff --git a/packages/webgpu/cpp/rnwgpu/api/GPUCommandEncoder.h b/packages/webgpu/cpp/rnwgpu/api/GPUCommandEncoder.h index cdedad8e7..153426785 100644 --- a/packages/webgpu/cpp/rnwgpu/api/GPUCommandEncoder.h +++ b/packages/webgpu/cpp/rnwgpu/api/GPUCommandEncoder.h @@ -5,7 +5,7 @@ #include "Unions.h" -#include "RNFNativeObject.h" +#include "NativeObject.h" #include "webgpu/webgpu_cpp.h" diff --git a/packages/webgpu/cpp/rnwgpu/api/GPUCompilationInfo.h b/packages/webgpu/cpp/rnwgpu/api/GPUCompilationInfo.h index c9f8278f5..58f3dd880 100644 --- a/packages/webgpu/cpp/rnwgpu/api/GPUCompilationInfo.h +++ b/packages/webgpu/cpp/rnwgpu/api/GPUCompilationInfo.h @@ -5,7 +5,7 @@ #include "Unions.h" -#include "RNFNativeObject.h" +#include "NativeObject.h" #include "webgpu/webgpu_cpp.h" diff --git a/packages/webgpu/cpp/rnwgpu/api/GPUCompilationMessage.h b/packages/webgpu/cpp/rnwgpu/api/GPUCompilationMessage.h index 8e5154bb7..9f2be8895 100644 --- a/packages/webgpu/cpp/rnwgpu/api/GPUCompilationMessage.h +++ b/packages/webgpu/cpp/rnwgpu/api/GPUCompilationMessage.h @@ -4,7 +4,7 @@ #include "Unions.h" -#include "RNFNativeObject.h" +#include "NativeObject.h" #include "webgpu/webgpu_cpp.h" diff --git a/packages/webgpu/cpp/rnwgpu/api/GPUComputePassEncoder.h b/packages/webgpu/cpp/rnwgpu/api/GPUComputePassEncoder.h index 39e7e5e42..1dd8d725d 100644 --- a/packages/webgpu/cpp/rnwgpu/api/GPUComputePassEncoder.h +++ b/packages/webgpu/cpp/rnwgpu/api/GPUComputePassEncoder.h @@ -8,7 +8,7 @@ #include "Unions.h" -#include "RNFNativeObject.h" +#include "NativeObject.h" #include "webgpu/webgpu_cpp.h" diff --git a/packages/webgpu/cpp/rnwgpu/api/GPUComputePipeline.h b/packages/webgpu/cpp/rnwgpu/api/GPUComputePipeline.h index 2704843cc..66102d759 100644 --- a/packages/webgpu/cpp/rnwgpu/api/GPUComputePipeline.h +++ b/packages/webgpu/cpp/rnwgpu/api/GPUComputePipeline.h @@ -5,7 +5,7 @@ #include "Unions.h" -#include "RNFNativeObject.h" +#include "NativeObject.h" #include "webgpu/webgpu_cpp.h" diff --git a/packages/webgpu/cpp/rnwgpu/api/GPUDevice.h b/packages/webgpu/cpp/rnwgpu/api/GPUDevice.h index 69af87f62..8ab921e16 100644 --- a/packages/webgpu/cpp/rnwgpu/api/GPUDevice.h +++ b/packages/webgpu/cpp/rnwgpu/api/GPUDevice.h @@ -9,7 +9,7 @@ #include "Unions.h" -#include "RNFNativeObject.h" +#include "NativeObject.h" #include "rnwgpu/async/AsyncRunner.h" #include "rnwgpu/async/AsyncTaskHandle.h" diff --git a/packages/webgpu/cpp/rnwgpu/api/GPUDeviceLostInfo.h b/packages/webgpu/cpp/rnwgpu/api/GPUDeviceLostInfo.h index 81782411d..5ab597ffb 100644 --- a/packages/webgpu/cpp/rnwgpu/api/GPUDeviceLostInfo.h +++ b/packages/webgpu/cpp/rnwgpu/api/GPUDeviceLostInfo.h @@ -4,7 +4,7 @@ #include "Unions.h" -#include "RNFNativeObject.h" +#include "NativeObject.h" #include "webgpu/webgpu_cpp.h" diff --git a/packages/webgpu/cpp/rnwgpu/api/GPUExternalTexture.h b/packages/webgpu/cpp/rnwgpu/api/GPUExternalTexture.h index 26e671d8e..9be5efe6f 100644 --- a/packages/webgpu/cpp/rnwgpu/api/GPUExternalTexture.h +++ b/packages/webgpu/cpp/rnwgpu/api/GPUExternalTexture.h @@ -4,7 +4,7 @@ #include "Unions.h" -#include "RNFNativeObject.h" +#include "NativeObject.h" #include "webgpu/webgpu_cpp.h" diff --git a/packages/webgpu/cpp/rnwgpu/api/GPUPipelineLayout.h b/packages/webgpu/cpp/rnwgpu/api/GPUPipelineLayout.h index ad3ff193c..74ddd17e9 100644 --- a/packages/webgpu/cpp/rnwgpu/api/GPUPipelineLayout.h +++ b/packages/webgpu/cpp/rnwgpu/api/GPUPipelineLayout.h @@ -4,7 +4,7 @@ #include "Unions.h" -#include "RNFNativeObject.h" +#include "NativeObject.h" #include "webgpu/webgpu_cpp.h" diff --git a/packages/webgpu/cpp/rnwgpu/api/GPUQuerySet.h b/packages/webgpu/cpp/rnwgpu/api/GPUQuerySet.h index 2cd74dccb..16f9b2f78 100644 --- a/packages/webgpu/cpp/rnwgpu/api/GPUQuerySet.h +++ b/packages/webgpu/cpp/rnwgpu/api/GPUQuerySet.h @@ -4,7 +4,7 @@ #include "Unions.h" -#include "RNFNativeObject.h" +#include "NativeObject.h" #include "webgpu/webgpu_cpp.h" diff --git a/packages/webgpu/cpp/rnwgpu/api/GPUQueue.h b/packages/webgpu/cpp/rnwgpu/api/GPUQueue.h index 3b64350e6..be824e781 100644 --- a/packages/webgpu/cpp/rnwgpu/api/GPUQueue.h +++ b/packages/webgpu/cpp/rnwgpu/api/GPUQueue.h @@ -6,7 +6,7 @@ #include "Unions.h" -#include "RNFNativeObject.h" +#include "NativeObject.h" #include "rnwgpu/async/AsyncRunner.h" #include "rnwgpu/async/AsyncTaskHandle.h" diff --git a/packages/webgpu/cpp/rnwgpu/api/GPURenderBundle.h b/packages/webgpu/cpp/rnwgpu/api/GPURenderBundle.h index 4b5bdc499..df7ca5821 100644 --- a/packages/webgpu/cpp/rnwgpu/api/GPURenderBundle.h +++ b/packages/webgpu/cpp/rnwgpu/api/GPURenderBundle.h @@ -4,7 +4,7 @@ #include "Unions.h" -#include "RNFNativeObject.h" +#include "NativeObject.h" #include "webgpu/webgpu_cpp.h" diff --git a/packages/webgpu/cpp/rnwgpu/api/GPURenderBundleEncoder.h b/packages/webgpu/cpp/rnwgpu/api/GPURenderBundleEncoder.h index 563ef27a9..68e0cfcd1 100644 --- a/packages/webgpu/cpp/rnwgpu/api/GPURenderBundleEncoder.h +++ b/packages/webgpu/cpp/rnwgpu/api/GPURenderBundleEncoder.h @@ -8,7 +8,7 @@ #include "Unions.h" -#include "RNFNativeObject.h" +#include "NativeObject.h" #include "webgpu/webgpu_cpp.h" diff --git a/packages/webgpu/cpp/rnwgpu/api/GPURenderPassEncoder.h b/packages/webgpu/cpp/rnwgpu/api/GPURenderPassEncoder.h index 13993fbcd..5d1410af0 100644 --- a/packages/webgpu/cpp/rnwgpu/api/GPURenderPassEncoder.h +++ b/packages/webgpu/cpp/rnwgpu/api/GPURenderPassEncoder.h @@ -8,7 +8,7 @@ #include "Unions.h" -#include "RNFNativeObject.h" +#include "NativeObject.h" #include "webgpu/webgpu_cpp.h" diff --git a/packages/webgpu/cpp/rnwgpu/api/GPURenderPipeline.h b/packages/webgpu/cpp/rnwgpu/api/GPURenderPipeline.h index 0fa617315..96245adcf 100644 --- a/packages/webgpu/cpp/rnwgpu/api/GPURenderPipeline.h +++ b/packages/webgpu/cpp/rnwgpu/api/GPURenderPipeline.h @@ -5,7 +5,7 @@ #include "Unions.h" -#include "RNFNativeObject.h" +#include "NativeObject.h" #include "webgpu/webgpu_cpp.h" diff --git a/packages/webgpu/cpp/rnwgpu/api/GPUSampler.h b/packages/webgpu/cpp/rnwgpu/api/GPUSampler.h index 2a20aec39..35cfc53f9 100644 --- a/packages/webgpu/cpp/rnwgpu/api/GPUSampler.h +++ b/packages/webgpu/cpp/rnwgpu/api/GPUSampler.h @@ -4,7 +4,7 @@ #include "Unions.h" -#include "RNFNativeObject.h" +#include "NativeObject.h" #include "webgpu/webgpu_cpp.h" diff --git a/packages/webgpu/cpp/rnwgpu/api/GPUShaderModule.h b/packages/webgpu/cpp/rnwgpu/api/GPUShaderModule.h index 18da306e8..ab8561090 100644 --- a/packages/webgpu/cpp/rnwgpu/api/GPUShaderModule.h +++ b/packages/webgpu/cpp/rnwgpu/api/GPUShaderModule.h @@ -5,7 +5,7 @@ #include "Unions.h" -#include "RNFNativeObject.h" +#include "NativeObject.h" #include "rnwgpu/async/AsyncRunner.h" #include "rnwgpu/async/AsyncTaskHandle.h" diff --git a/packages/webgpu/cpp/rnwgpu/api/GPUSupportedLimits.h b/packages/webgpu/cpp/rnwgpu/api/GPUSupportedLimits.h index b05c4673b..e3e65f525 100644 --- a/packages/webgpu/cpp/rnwgpu/api/GPUSupportedLimits.h +++ b/packages/webgpu/cpp/rnwgpu/api/GPUSupportedLimits.h @@ -4,7 +4,7 @@ #include "Unions.h" -#include "RNFNativeObject.h" +#include "NativeObject.h" #include "webgpu/webgpu_cpp.h" diff --git a/packages/webgpu/cpp/rnwgpu/api/GPUTexture.h b/packages/webgpu/cpp/rnwgpu/api/GPUTexture.h index dcb0dfa6d..a026d2476 100644 --- a/packages/webgpu/cpp/rnwgpu/api/GPUTexture.h +++ b/packages/webgpu/cpp/rnwgpu/api/GPUTexture.h @@ -6,7 +6,7 @@ #include "Unions.h" -#include "RNFNativeObject.h" +#include "NativeObject.h" #include "webgpu/webgpu_cpp.h" diff --git a/packages/webgpu/cpp/rnwgpu/api/GPUTextureView.h b/packages/webgpu/cpp/rnwgpu/api/GPUTextureView.h index 4c4ec7d7a..c37058517 100644 --- a/packages/webgpu/cpp/rnwgpu/api/GPUTextureView.h +++ b/packages/webgpu/cpp/rnwgpu/api/GPUTextureView.h @@ -4,7 +4,7 @@ #include "Unions.h" -#include "RNFNativeObject.h" +#include "NativeObject.h" #include "webgpu/webgpu_cpp.h" diff --git a/packages/webgpu/cpp/rnwgpu/api/ImageBitmap.h b/packages/webgpu/cpp/rnwgpu/api/ImageBitmap.h index 743c68aed..9df66fc5c 100644 --- a/packages/webgpu/cpp/rnwgpu/api/ImageBitmap.h +++ b/packages/webgpu/cpp/rnwgpu/api/ImageBitmap.h @@ -5,7 +5,7 @@ #include "webgpu/webgpu_cpp.h" #include "PlatformContext.h" -#include "RNFNativeObject.h" +#include "NativeObject.h" namespace rnwgpu { diff --git a/packages/webgpu/cpp/rnwgpu/api/RNWebGPU.h b/packages/webgpu/cpp/rnwgpu/api/RNWebGPU.h index d34e1a283..3bf797aa3 100644 --- a/packages/webgpu/cpp/rnwgpu/api/RNWebGPU.h +++ b/packages/webgpu/cpp/rnwgpu/api/RNWebGPU.h @@ -3,7 +3,7 @@ #include #include -#include "RNFNativeObject.h" +#include "NativeObject.h" #include "Canvas.h" #include "GPU.h" diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBlendComponent.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBlendComponent.h index 3e25697f9..65610578e 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBlendComponent.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBlendComponent.h @@ -7,7 +7,6 @@ #include "RNFJSIConverter.h" #include "WGPULogger.h" - namespace jsi = facebook::jsi; namespace rnwgpu { diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBufferBindingLayout.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBufferBindingLayout.h index a9d7bba98..734f1a11a 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBufferBindingLayout.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBufferBindingLayout.h @@ -7,7 +7,6 @@ #include "RNFJSIConverter.h" #include "WGPULogger.h" - namespace jsi = facebook::jsi; namespace rnwgpu { diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBufferDescriptor.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBufferDescriptor.h index 743015e51..8ba549498 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBufferDescriptor.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBufferDescriptor.h @@ -8,7 +8,6 @@ #include "RNFJSIConverter.h" #include "WGPULogger.h" - namespace jsi = facebook::jsi; namespace rnwgpu { diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBufferUsage.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBufferUsage.h index e171f88db..2c9f0286b 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBufferUsage.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBufferUsage.h @@ -1,7 +1,7 @@ #pragma once #include -#include +#include #include "webgpu/webgpu_cpp.h" diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUColor.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUColor.h index 2a64631a6..aecab9e48 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUColor.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUColor.h @@ -7,7 +7,6 @@ #include "RNFJSIConverter.h" #include "WGPULogger.h" - namespace jsi = facebook::jsi; namespace rnwgpu { diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUColorWrite.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUColorWrite.h index c692ca1a2..31deb5145 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUColorWrite.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUColorWrite.h @@ -1,7 +1,7 @@ #pragma once #include -#include +#include #include "webgpu/webgpu_cpp.h" diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUCommandBufferDescriptor.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUCommandBufferDescriptor.h index 65d744590..3fc988563 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUCommandBufferDescriptor.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUCommandBufferDescriptor.h @@ -8,7 +8,6 @@ #include "RNFJSIConverter.h" #include "WGPULogger.h" - namespace jsi = facebook::jsi; namespace rnwgpu { diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUCommandEncoderDescriptor.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUCommandEncoderDescriptor.h index c08a1691e..47b093a88 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUCommandEncoderDescriptor.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUCommandEncoderDescriptor.h @@ -8,7 +8,6 @@ #include "RNFJSIConverter.h" #include "WGPULogger.h" - namespace jsi = facebook::jsi; namespace rnwgpu { diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUExternalTextureBindingLayout.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUExternalTextureBindingLayout.h index 14e8d20e2..5363079de 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUExternalTextureBindingLayout.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUExternalTextureBindingLayout.h @@ -7,7 +7,6 @@ #include "RNFJSIConverter.h" #include "WGPULogger.h" - namespace jsi = facebook::jsi; namespace rnwgpu { diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUImageDataLayout.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUImageDataLayout.h index b355088b1..b6413d340 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUImageDataLayout.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUImageDataLayout.h @@ -7,7 +7,6 @@ #include "RNFJSIConverter.h" #include "WGPULogger.h" - namespace jsi = facebook::jsi; namespace rnwgpu { diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUMapMode.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUMapMode.h index 827e89eef..9a0b3f131 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUMapMode.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUMapMode.h @@ -1,7 +1,7 @@ #pragma once #include -#include +#include #include "webgpu/webgpu_cpp.h" diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUMultisampleState.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUMultisampleState.h index eb6f31747..bc0149a7e 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUMultisampleState.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUMultisampleState.h @@ -7,7 +7,6 @@ #include "RNFJSIConverter.h" #include "WGPULogger.h" - namespace jsi = facebook::jsi; namespace rnwgpu { diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUPrimitiveState.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUPrimitiveState.h index 308544531..3c56e71f3 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUPrimitiveState.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUPrimitiveState.h @@ -7,7 +7,6 @@ #include "RNFJSIConverter.h" #include "WGPULogger.h" - namespace jsi = facebook::jsi; namespace rnwgpu { diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUQuerySetDescriptor.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUQuerySetDescriptor.h index cb4888001..ce5ccf357 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUQuerySetDescriptor.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUQuerySetDescriptor.h @@ -8,7 +8,6 @@ #include "RNFJSIConverter.h" #include "WGPULogger.h" - namespace jsi = facebook::jsi; namespace rnwgpu { diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUQueueDescriptor.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUQueueDescriptor.h index dc89e307d..7b335fc5d 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUQueueDescriptor.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUQueueDescriptor.h @@ -8,7 +8,6 @@ #include "RNFJSIConverter.h" #include "WGPULogger.h" - namespace jsi = facebook::jsi; namespace rnwgpu { diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPURenderBundleDescriptor.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPURenderBundleDescriptor.h index 4f0191c11..96d289838 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPURenderBundleDescriptor.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPURenderBundleDescriptor.h @@ -8,7 +8,6 @@ #include "RNFJSIConverter.h" #include "WGPULogger.h" - namespace jsi = facebook::jsi; namespace rnwgpu { diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPURenderBundleEncoderDescriptor.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPURenderBundleEncoderDescriptor.h index 282d2cfc6..fe87247ba 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPURenderBundleEncoderDescriptor.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPURenderBundleEncoderDescriptor.h @@ -9,7 +9,6 @@ #include "RNFJSIConverter.h" #include "WGPULogger.h" - namespace jsi = facebook::jsi; namespace rnwgpu { diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPURequestAdapterOptions.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPURequestAdapterOptions.h index ee72c81e4..7ce18a64f 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPURequestAdapterOptions.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPURequestAdapterOptions.h @@ -7,7 +7,6 @@ #include "RNFJSIConverter.h" #include "WGPULogger.h" - namespace jsi = facebook::jsi; namespace rnwgpu { diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUSamplerBindingLayout.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUSamplerBindingLayout.h index 61d78e0f5..7d4c15ce1 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUSamplerBindingLayout.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUSamplerBindingLayout.h @@ -7,7 +7,6 @@ #include "RNFJSIConverter.h" #include "WGPULogger.h" - namespace jsi = facebook::jsi; namespace rnwgpu { diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUSamplerDescriptor.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUSamplerDescriptor.h index 34fed143f..fdf87671e 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUSamplerDescriptor.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUSamplerDescriptor.h @@ -8,7 +8,6 @@ #include "RNFJSIConverter.h" #include "WGPULogger.h" - namespace jsi = facebook::jsi; namespace rnwgpu { diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUShaderStage.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUShaderStage.h index b361122f1..9f6b13df2 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUShaderStage.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUShaderStage.h @@ -1,7 +1,7 @@ #pragma once #include -#include +#include #include "webgpu/webgpu_cpp.h" diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUStencilFaceState.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUStencilFaceState.h index c8b96a796..2c4ab16c9 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUStencilFaceState.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUStencilFaceState.h @@ -7,7 +7,6 @@ #include "RNFJSIConverter.h" #include "WGPULogger.h" - namespace jsi = facebook::jsi; namespace rnwgpu { diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUStorageTextureBindingLayout.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUStorageTextureBindingLayout.h index d16277e53..cd4566646 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUStorageTextureBindingLayout.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUStorageTextureBindingLayout.h @@ -7,7 +7,6 @@ #include "RNFJSIConverter.h" #include "WGPULogger.h" - namespace jsi = facebook::jsi; namespace rnwgpu { diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUTextureBindingLayout.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUTextureBindingLayout.h index 694fbe41b..59fbbe679 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUTextureBindingLayout.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUTextureBindingLayout.h @@ -7,7 +7,6 @@ #include "RNFJSIConverter.h" #include "WGPULogger.h" - namespace jsi = facebook::jsi; namespace rnwgpu { diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUTextureUsage.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUTextureUsage.h index d4f278d4d..0e32de154 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUTextureUsage.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUTextureUsage.h @@ -1,7 +1,7 @@ #pragma once #include -#include +#include #include "webgpu/webgpu_cpp.h" diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUTextureViewDescriptor.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUTextureViewDescriptor.h index 915df37fc..29178b702 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUTextureViewDescriptor.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUTextureViewDescriptor.h @@ -8,7 +8,6 @@ #include "RNFJSIConverter.h" #include "WGPULogger.h" - namespace jsi = facebook::jsi; namespace rnwgpu { diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUVertexAttribute.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUVertexAttribute.h index 5eeda927d..3c651c1c1 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUVertexAttribute.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUVertexAttribute.h @@ -7,7 +7,6 @@ #include "RNFJSIConverter.h" #include "WGPULogger.h" - namespace jsi = facebook::jsi; namespace rnwgpu { diff --git a/packages/webgpu/scripts/codegen/templates/Enum.ts b/packages/webgpu/scripts/codegen/templates/Enum.ts index 7a8e10e11..acb73bb16 100644 --- a/packages/webgpu/scripts/codegen/templates/Enum.ts +++ b/packages/webgpu/scripts/codegen/templates/Enum.ts @@ -18,7 +18,7 @@ export const getEnum = (decl: VariableDeclaration) => { return `#pragma once #include -#include +#include #include "webgpu/webgpu_cpp.h" diff --git a/packages/webgpu/scripts/codegen/templates/HybridObject.ts b/packages/webgpu/scripts/codegen/templates/HybridObject.ts index 46257fa61..838c87c4b 100644 --- a/packages/webgpu/scripts/codegen/templates/HybridObject.ts +++ b/packages/webgpu/scripts/codegen/templates/HybridObject.ts @@ -127,7 +127,7 @@ ${Array.from(dependencies) #include "Unions.h" -#include "RNFNativeObject.h" +#include "NativeObject.h" #include "rnwgpu/async/AsyncRunner.h" From a4d6e425cad346f455c6b07244fe6e180732f870 Mon Sep 17 00:00:00 2001 From: William Candillon Date: Mon, 12 Jan 2026 16:43:17 +0100 Subject: [PATCH 07/23] :wrench: --- packages/webgpu/cpp/jsi/NativeObject.h | 1 - packages/webgpu/cpp/jsi/RNFJSIConverter.h | 100 ---------------------- packages/webgpu/cpp/jsi/RNFJSIHelper.h | 51 ----------- 3 files changed, 152 deletions(-) delete mode 100644 packages/webgpu/cpp/jsi/RNFJSIHelper.h diff --git a/packages/webgpu/cpp/jsi/NativeObject.h b/packages/webgpu/cpp/jsi/NativeObject.h index 9e09d4cd1..8c859f590 100644 --- a/packages/webgpu/cpp/jsi/NativeObject.h +++ b/packages/webgpu/cpp/jsi/NativeObject.h @@ -14,7 +14,6 @@ #include #include -#include "RNFJSIHelper.h" #include "WGPULogger.h" // Forward declare to avoid circular dependency diff --git a/packages/webgpu/cpp/jsi/RNFJSIConverter.h b/packages/webgpu/cpp/jsi/RNFJSIConverter.h index 81d744e72..47c090bd3 100644 --- a/packages/webgpu/cpp/jsi/RNFJSIConverter.h +++ b/packages/webgpu/cpp/jsi/RNFJSIConverter.h @@ -5,13 +5,10 @@ #pragma once #include -#include -#include #include #include #include #include -#include #include #include #include @@ -20,7 +17,6 @@ #include #include "RNFEnumMapper.h" -#include "RNFJSIHelper.h" #include "RNFPromise.h" #include "Unions.h" @@ -275,102 +271,6 @@ template struct JSIConverter> { } }; -// std::unordered_map <> Record -template struct JSIConverter> { - static std::unordered_map fromJSI(jsi::Runtime& runtime, const jsi::Value& arg, bool outOfBound) { - jsi::Object object = arg.asObject(runtime); - jsi::Array propertyNames = object.getPropertyNames(runtime); - size_t length = propertyNames.size(runtime); - - std::unordered_map map; - map.reserve(length); - for (size_t i = 0; i < length; ++i) { - std::string key = propertyNames.getValueAtIndex(runtime, i).asString(runtime).utf8(runtime); - jsi::Value value = object.getProperty(runtime, key.c_str()); - map.emplace(key, JSIConverter::fromJSI(runtime, value, outOfBound)); - } - return map; - } - static jsi::Value toJSI(jsi::Runtime& runtime, const std::unordered_map& map) { - jsi::Object object(runtime); - for (const auto& pair : map) { - jsi::Value value = JSIConverter::toJSI(runtime, pair.second); - jsi::String key = jsi::String::createFromUtf8(runtime, pair.first); - object.setProperty(runtime, key, std::move(value)); - } - return object; - } -}; - -// HostObject (non-NativeState) <> {} -template struct is_shared_ptr_to_host_object : std::false_type {}; - -// Only match HostObject types that are NOT NativeState types -template -struct is_shared_ptr_to_host_object> - : std::bool_constant && - !std::is_base_of_v> {}; - -template struct JSIConverter::value>> { - using TPointee = typename T::element_type; - -#if DEBUG - inline static std::string getFriendlyTypename() { - std::string name = std::string(typeid(TPointee).name()); -#if __has_include() - int status = 0; - char* demangled_name = abi::__cxa_demangle(name.c_str(), NULL, NULL, &status); - if (status == 0) { - name = demangled_name; - std::free(demangled_name); - } -#endif - return name; - } - - inline static std::string invalidTypeErrorMessage(const std::string& typeDescription, const std::string& reason) { - return "Cannot convert \"" + typeDescription + "\" to HostObject<" + getFriendlyTypename() + ">! " + reason; - } -#endif - - static T fromJSI(jsi::Runtime& runtime, const jsi::Value& arg, bool outOfBound) { -#if DEBUG - if (arg.isUndefined()) { - [[unlikely]]; - throw jsi::JSError(runtime, invalidTypeErrorMessage("undefined", "It is undefined!")); - } - if (!arg.isObject()) { - [[unlikely]]; - std::string stringRepresentation = arg.toString(runtime).utf8(runtime); - throw jsi::JSError(runtime, invalidTypeErrorMessage(stringRepresentation, "It is not an object!")); - } -#endif - jsi::Object object = arg.getObject(runtime); -#if DEBUG - if (!object.isHostObject(runtime)) { - [[unlikely]]; - std::string stringRepresentation = arg.toString(runtime).utf8(runtime); - throw jsi::JSError(runtime, invalidTypeErrorMessage(stringRepresentation, "It is a different HostObject!")); - } -#endif - return object.getHostObject(runtime); - } - static jsi::Value toJSI(jsi::Runtime& runtime, const T& arg) { -#if DEBUG - if (arg == nullptr) { - [[unlikely]]; - throw jsi::JSError(runtime, "Cannot convert nullptr to HostObject<" + getFriendlyTypename() + ">!"); - } -#endif - auto result = jsi::Object::createFromHostObject(runtime, arg); - auto memoryPressure = arg->getMemoryPressure(); - if (memoryPressure > 0) { - result.setExternalMemoryPressure(runtime, memoryPressure); - } - return result; - } -}; - // NativeState <> {} template struct is_shared_ptr_to_native_state : std::false_type {}; diff --git a/packages/webgpu/cpp/jsi/RNFJSIHelper.h b/packages/webgpu/cpp/jsi/RNFJSIHelper.h deleted file mode 100644 index 620dce000..000000000 --- a/packages/webgpu/cpp/jsi/RNFJSIHelper.h +++ /dev/null @@ -1,51 +0,0 @@ -// -// Created by Hanno Gödecke on 15.05.24. -// - -#pragma once - -#include "RNFRuntimeState.h" -#include -#include -#include - -namespace margelo { - -namespace jsi = facebook::jsi; - -class JSIHelper { -public: - /** - * Takes a jsi::Function and wraps it in a shared_ptr so its shareable. - * Every jsi::Function you intend to share or hold should be wrapped using this function. - */ - static std::shared_ptr createSharedJsiFunction(jsi::Runtime& runtime, jsi::Function&& function) { - auto runtimeState = rnwgpu::RNFRuntimeState::get(runtime); - std::weak_ptr runtimeStateWeak = runtimeState; - std::shared_ptr sharedFunction(new jsi::Function(std::move(function)), [runtimeStateWeak](jsi::Function* ptr) { - if (!runtimeStateWeak.expired()) { - // Only delete the jsi::Function when the runtime it created is still alive. - // Otherwise leak memory. We do this on purpose, as sometimes we would keep - // references to JSI objects past the lifetime of its runtime (e.g., - // shared values references from the RN VM holds reference to JSI objects - // on the UI runtime). When the runtime is terminated, the orphaned JSI - // objects would crash the app when their destructors are called, because - // they call into a memory that's managed by the terminated runtime. We - // accept the tradeoff of leaking memory here, as it has a limited impact. - // This scenario can only occur when the React instance is torn down which - // happens in development mode during app reloads, or in production when - // the app is being shut down gracefully by the system. An alternative - // solution would require us to keep track of all JSI values that are in - // use which would require additional data structure and compute spent on - // bookkeeping that only for the sake of destroying the values in time - // before the runtime is terminated. Note that the underlying memory that - // jsi::Value refers to is managed by the VM and gets freed along with the - // runtime. - delete ptr; - } - }); - - return sharedFunction; - } -}; -} // namespace margelo From e47eb4e9ad50a6815d173dbc67ed4738954cc642 Mon Sep 17 00:00:00 2001 From: William Candillon Date: Mon, 12 Jan 2026 17:12:23 +0100 Subject: [PATCH 08/23] :wrench: --- packages/webgpu/android/CMakeLists.txt | 3 +- .../cpp/jsi/{RNFEnumMapper.h => EnumMapper.h} | 8 +- .../jsi/{RNFJSIConverter.h => JSIConverter.h} | 16 +-- packages/webgpu/cpp/jsi/NativeObject.h | 20 +-- .../cpp/jsi/{RNFPromise.cpp => Promise.cpp} | 9 +- .../cpp/jsi/{RNFPromise.h => Promise.h} | 7 +- packages/webgpu/cpp/jsi/RNFRuntimeState.cpp | 18 --- packages/webgpu/cpp/jsi/RNFRuntimeState.h | 130 ------------------ packages/webgpu/cpp/rnwgpu/ArrayBuffer.h | 20 ++- packages/webgpu/cpp/rnwgpu/api/GPU.cpp | 6 +- packages/webgpu/cpp/rnwgpu/api/GPUAdapter.cpp | 4 +- .../cpp/rnwgpu/api/GPUCompilationInfo.h | 11 +- packages/webgpu/cpp/rnwgpu/api/GPUDevice.cpp | 16 +-- packages/webgpu/cpp/rnwgpu/api/GPUError.h | 18 +-- packages/webgpu/cpp/rnwgpu/api/GPUExtent3D.h | 17 +-- packages/webgpu/cpp/rnwgpu/api/GPUOrigin2D.h | 16 +-- packages/webgpu/cpp/rnwgpu/api/GPUOrigin3D.h | 16 +-- .../webgpu/cpp/rnwgpu/api/GPUShaderModule.cpp | 4 +- packages/webgpu/cpp/rnwgpu/api/RNWebGPU.h | 14 +- .../api/descriptors/GPUBindGroupDescriptor.h | 7 +- .../api/descriptors/GPUBindGroupEntry.h | 7 +- .../GPUBindGroupLayoutDescriptor.h | 7 +- .../api/descriptors/GPUBindGroupLayoutEntry.h | 7 +- .../api/descriptors/GPUBlendComponent.h | 7 +- .../rnwgpu/api/descriptors/GPUBlendState.h | 7 +- .../rnwgpu/api/descriptors/GPUBufferBinding.h | 7 +- .../api/descriptors/GPUBufferBindingLayout.h | 7 +- .../api/descriptors/GPUBufferDescriptor.h | 7 +- .../api/descriptors/GPUCanvasConfiguration.h | 7 +- .../cpp/rnwgpu/api/descriptors/GPUColor.h | 7 +- .../api/descriptors/GPUColorTargetState.h | 7 +- .../descriptors/GPUCommandBufferDescriptor.h | 7 +- .../descriptors/GPUCommandEncoderDescriptor.h | 7 +- .../descriptors/GPUComputePassDescriptor.h | 7 +- .../GPUComputePassTimestampWrites.h | 7 +- .../GPUComputePipelineDescriptor.h | 7 +- .../api/descriptors/GPUDepthStencilState.h | 7 +- .../api/descriptors/GPUDeviceDescriptor.h | 7 +- .../GPUExternalTextureBindingLayout.h | 7 +- .../GPUExternalTextureDescriptor.h | 7 +- .../rnwgpu/api/descriptors/GPUFragmentState.h | 7 +- .../api/descriptors/GPUImageCopyBuffer.h | 7 +- .../descriptors/GPUImageCopyExternalImage.h | 7 +- .../api/descriptors/GPUImageCopyTexture.h | 7 +- .../descriptors/GPUImageCopyTextureTagged.h | 7 +- .../api/descriptors/GPUImageDataLayout.h | 7 +- .../api/descriptors/GPUMultisampleState.h | 7 +- .../descriptors/GPUPipelineLayoutDescriptor.h | 7 +- .../api/descriptors/GPUPrimitiveState.h | 7 +- .../api/descriptors/GPUProgrammableStage.h | 7 +- .../api/descriptors/GPUQuerySetDescriptor.h | 7 +- .../api/descriptors/GPUQueueDescriptor.h | 7 +- .../descriptors/GPURenderBundleDescriptor.h | 7 +- .../GPURenderBundleEncoderDescriptor.h | 7 +- .../GPURenderPassColorAttachment.h | 7 +- .../GPURenderPassDepthStencilAttachment.h | 7 +- .../api/descriptors/GPURenderPassDescriptor.h | 7 +- .../GPURenderPassTimestampWrites.h | 7 +- .../descriptors/GPURenderPipelineDescriptor.h | 7 +- .../descriptors/GPURequestAdapterOptions.h | 7 +- .../api/descriptors/GPUSamplerBindingLayout.h | 7 +- .../api/descriptors/GPUSamplerDescriptor.h | 7 +- .../GPUShaderModuleCompilationHint.h | 7 +- .../descriptors/GPUShaderModuleDescriptor.h | 7 +- .../api/descriptors/GPUStencilFaceState.h | 7 +- .../GPUStorageTextureBindingLayout.h | 7 +- .../api/descriptors/GPUTextureBindingLayout.h | 7 +- .../api/descriptors/GPUTextureDescriptor.h | 7 +- .../descriptors/GPUTextureViewDescriptor.h | 7 +- .../descriptors/GPUUncapturedErrorEventInit.h | 7 +- .../api/descriptors/GPUVertexAttribute.h | 7 +- .../api/descriptors/GPUVertexBufferLayout.h | 7 +- .../rnwgpu/api/descriptors/GPUVertexState.h | 7 +- .../cpp/rnwgpu/api/descriptors/Unions.h | 6 +- .../cpp/rnwgpu/async/AsyncTaskHandle.cpp | 20 +-- .../webgpu/cpp/rnwgpu/async/AsyncTaskHandle.h | 4 +- .../webgpu/scripts/codegen/Descriptors.ts | 18 +-- .../scripts/codegen/templates/Unions.ts | 6 +- 78 files changed, 266 insertions(+), 519 deletions(-) rename packages/webgpu/cpp/jsi/{RNFEnumMapper.h => EnumMapper.h} (95%) rename packages/webgpu/cpp/jsi/{RNFJSIConverter.h => JSIConverter.h} (98%) rename packages/webgpu/cpp/jsi/{RNFPromise.cpp => Promise.cpp} (92%) rename packages/webgpu/cpp/jsi/{RNFPromise.h => Promise.h} (88%) delete mode 100644 packages/webgpu/cpp/jsi/RNFRuntimeState.cpp delete mode 100644 packages/webgpu/cpp/jsi/RNFRuntimeState.h diff --git a/packages/webgpu/android/CMakeLists.txt b/packages/webgpu/android/CMakeLists.txt index b1f818e1b..7363a5a80 100644 --- a/packages/webgpu/android/CMakeLists.txt +++ b/packages/webgpu/android/CMakeLists.txt @@ -44,8 +44,7 @@ add_library(${PACKAGE_NAME} SHARED ../cpp/rnwgpu/api/GPUComputePipeline.cpp ../cpp/rnwgpu/api/GPUCanvasContext.cpp ../cpp/rnwgpu/RNWebGPUManager.cpp - ../cpp/jsi/RNFPromise.cpp - ../cpp/jsi/RNFRuntimeState.cpp + ../cpp/jsi/Promise.cpp ../cpp/rnwgpu/async/AsyncRunner.cpp ../cpp/rnwgpu/async/AsyncTaskHandle.cpp ../cpp/rnwgpu/async/JSIMicrotaskDispatcher.cpp diff --git a/packages/webgpu/cpp/jsi/RNFEnumMapper.h b/packages/webgpu/cpp/jsi/EnumMapper.h similarity index 95% rename from packages/webgpu/cpp/jsi/RNFEnumMapper.h rename to packages/webgpu/cpp/jsi/EnumMapper.h index 67153bf3a..e95a25f69 100644 --- a/packages/webgpu/cpp/jsi/RNFEnumMapper.h +++ b/packages/webgpu/cpp/jsi/EnumMapper.h @@ -1,13 +1,9 @@ -// -// Created by Marc Rousavy on 22.02.24. -// - #pragma once #include #include -namespace margelo { +namespace rnwgpu { namespace EnumMapper { // Add these two methods in namespace "EnumMapper" to allow parsing a custom enum: @@ -46,4 +42,4 @@ namespace EnumMapper { } } // namespace EnumMapper -} // namespace margelo +} // namespace rnwgpu diff --git a/packages/webgpu/cpp/jsi/RNFJSIConverter.h b/packages/webgpu/cpp/jsi/JSIConverter.h similarity index 98% rename from packages/webgpu/cpp/jsi/RNFJSIConverter.h rename to packages/webgpu/cpp/jsi/JSIConverter.h index 47c090bd3..5c6f386be 100644 --- a/packages/webgpu/cpp/jsi/RNFJSIConverter.h +++ b/packages/webgpu/cpp/jsi/JSIConverter.h @@ -1,7 +1,3 @@ -// -// Created by Marc Rousavy on 21.02.24. -// - #pragma once #include @@ -16,8 +12,8 @@ #include -#include "RNFEnumMapper.h" -#include "RNFPromise.h" +#include "EnumMapper.h" +#include "Promise.h" #include "Unions.h" @@ -30,7 +26,7 @@ #include #endif -namespace margelo { +namespace rnwgpu { namespace jsi = facebook::jsi; @@ -208,8 +204,8 @@ template <> struct JSIConverter { } static jsi::Value toJSI(jsi::Runtime& runtime, rnwgpu::async::AsyncTaskHandle&& handle) { - return Promise::createPromise(runtime, [handle = std::move(handle)](jsi::Runtime& runtime, - std::shared_ptr promise) mutable { + return rnwgpu::Promise::createPromise(runtime, [handle = std::move(handle)](jsi::Runtime& runtime, + std::shared_ptr promise) mutable { if (!handle.valid()) { promise->resolve(jsi::Value::undefined()); return; @@ -466,4 +462,4 @@ struct JSIConverter> { } }; -} // namespace margelo +} // namespace rnwgpu diff --git a/packages/webgpu/cpp/jsi/NativeObject.h b/packages/webgpu/cpp/jsi/NativeObject.h index 8c859f590..81938f72c 100644 --- a/packages/webgpu/cpp/jsi/NativeObject.h +++ b/packages/webgpu/cpp/jsi/NativeObject.h @@ -17,12 +17,12 @@ #include "WGPULogger.h" // Forward declare to avoid circular dependency -namespace margelo { +namespace rnwgpu { template struct JSIConverter; -} // namespace margelo +} // namespace rnwgpu // Include the converter - must come after forward declaration -#include "RNFJSIConverter.h" +#include "JSIConverter.h" namespace rnwgpu { @@ -272,7 +272,7 @@ class NativeObject : public jsi::NativeState, return jsi::Value::undefined(); } else { ReturnType result = (native.get()->*getter)(); - return margelo::JSIConverter>::toJSI( + return rnwgpu::JSIConverter>::toJSI( rt, std::move(result)); } }); @@ -305,7 +305,7 @@ class NativeObject : public jsi::NativeState, const jsi::Value *args, size_t count) -> jsi::Value { auto native = Derived::fromValue(rt, thisVal); auto value = - margelo::JSIConverter>::fromJSI(rt, args[0], false); + rnwgpu::JSIConverter>::fromJSI(rt, args[0], false); (native.get()->*setter)(std::move(value)); return jsi::Value::undefined(); }); @@ -352,7 +352,7 @@ class NativeObject : public jsi::NativeState, const jsi::Value *args, size_t count) -> jsi::Value { auto native = Derived::fromValue(rt, thisVal); ReturnType result = (native.get()->*getter)(); - return margelo::JSIConverter>::toJSI(rt, + return rnwgpu::JSIConverter>::toJSI(rt, std::move(result)); }); @@ -363,7 +363,7 @@ class NativeObject : public jsi::NativeState, const jsi::Value *args, size_t count) -> jsi::Value { auto native = Derived::fromValue(rt, thisVal); auto value = - margelo::JSIConverter>::fromJSI(rt, args[0], false); + rnwgpu::JSIConverter>::fromJSI(rt, args[0], false); (native.get()->*setter)(std::move(value)); return jsi::Value::undefined(); }); @@ -390,7 +390,7 @@ class NativeObject : public jsi::NativeState, jsi::Runtime &runtime, const jsi::Value *args, std::index_sequence, size_t count) { if constexpr (std::is_same_v) { - (obj->*method)(margelo::JSIConverter>::fromJSI( + (obj->*method)(rnwgpu::JSIConverter>::fromJSI( runtime, args[Is], Is >= count)...); return jsi::Value::undefined(); } else if constexpr (std::is_same_v) { @@ -398,9 +398,9 @@ class NativeObject : public jsi::NativeState, // This requires the method signature to match HostFunction return (obj->*method)(runtime, jsi::Value::undefined(), args, count); } else { - ReturnType result = (obj->*method)(margelo::JSIConverter>::fromJSI( + ReturnType result = (obj->*method)(rnwgpu::JSIConverter>::fromJSI( runtime, args[Is], Is >= count)...); - return margelo::JSIConverter>::toJSI(runtime, + return rnwgpu::JSIConverter>::toJSI(runtime, std::move(result)); } } diff --git a/packages/webgpu/cpp/jsi/RNFPromise.cpp b/packages/webgpu/cpp/jsi/Promise.cpp similarity index 92% rename from packages/webgpu/cpp/jsi/RNFPromise.cpp rename to packages/webgpu/cpp/jsi/Promise.cpp index f2d92b71f..5d11e58b5 100644 --- a/packages/webgpu/cpp/jsi/RNFPromise.cpp +++ b/packages/webgpu/cpp/jsi/Promise.cpp @@ -1,7 +1,4 @@ -// -// Created by Marc Rousavy on 22.02.24. -// -#include "RNFPromise.h" +#include "Promise.h" #include #include #include @@ -9,7 +6,7 @@ #include #include -namespace margelo { +namespace rnwgpu { namespace jsi = facebook::jsi; @@ -44,4 +41,4 @@ void Promise::reject(std::string message) { _rejecter.call(runtime, error.value()); } -} // namespace margelo +} // namespace rnwgpu diff --git a/packages/webgpu/cpp/jsi/RNFPromise.h b/packages/webgpu/cpp/jsi/Promise.h similarity index 88% rename from packages/webgpu/cpp/jsi/RNFPromise.h rename to packages/webgpu/cpp/jsi/Promise.h index 0b0e85b11..b6b8d111a 100644 --- a/packages/webgpu/cpp/jsi/RNFPromise.h +++ b/packages/webgpu/cpp/jsi/Promise.h @@ -1,6 +1,3 @@ -// -// Created by Marc Rousavy on 22.02.24. -// #pragma once #include @@ -9,7 +6,7 @@ #include #include -namespace margelo { +namespace rnwgpu { namespace jsi = facebook::jsi; @@ -35,4 +32,4 @@ class Promise { static jsi::Value createPromise(jsi::Runtime& runtime, RunPromise run); }; -} // namespace margelo +} // namespace rnwgpu diff --git a/packages/webgpu/cpp/jsi/RNFRuntimeState.cpp b/packages/webgpu/cpp/jsi/RNFRuntimeState.cpp deleted file mode 100644 index 38844ec10..000000000 --- a/packages/webgpu/cpp/jsi/RNFRuntimeState.cpp +++ /dev/null @@ -1,18 +0,0 @@ -#include "RNFRuntimeState.h" - -namespace rnwgpu { - -const facebook::jsi::UUID RNFRuntimeState::kRuntimeStateKey = facebook::jsi::UUID(); - -std::shared_ptr RNFRuntimeState::get(facebook::jsi::Runtime& runtime) { - auto existing = runtime.getRuntimeData(kRuntimeStateKey); - if (existing) { - return std::static_pointer_cast(existing); - } - - auto state = std::shared_ptr(new RNFRuntimeState()); - runtime.setRuntimeData(kRuntimeStateKey, state); - return state; -} - -} // namespace rnwgpu diff --git a/packages/webgpu/cpp/jsi/RNFRuntimeState.h b/packages/webgpu/cpp/jsi/RNFRuntimeState.h deleted file mode 100644 index 26cdb733a..000000000 --- a/packages/webgpu/cpp/jsi/RNFRuntimeState.h +++ /dev/null @@ -1,130 +0,0 @@ -#pragma once - -#include - -#include -#include -#include -#include - -namespace rnwgpu { - -namespace jsi = facebook::jsi; - -/** - * Runtime state management using Hermes' runtime.setRuntimeData API. - * This replaces the old RuntimeLifecycleMonitor/RuntimeAwareCache system. - */ -class RNFRuntimeState { -public: - // UUID key for storing our runtime state - static const jsi::UUID kRuntimeStateKey; - - /** - * Get or create the runtime state for the given runtime - */ - static std::shared_ptr get(jsi::Runtime& runtime); - - /** - * Template cache that can store any type T per object pointer - */ - template - class ObjectCache { - public: - std::shared_ptr getOrCreate(void* object) { - std::lock_guard lock(mutex_); - auto it = cache_.find(object); - if (it != cache_.end()) { - return it->second; - } - - auto value = std::make_shared(); - cache_[object] = value; - return value; - } - - void remove(void* object) { - std::lock_guard lock(mutex_); - cache_.erase(object); - } - - void clear() { - std::lock_guard lock(mutex_); - cache_.clear(); - } - - private: - std::mutex mutex_; - std::unordered_map> cache_; - }; - - /** - * Get or create a cache for a specific type T - */ - template - std::shared_ptr> getCache() { - std::lock_guard lock(mutex_); - - // Use type_info as key for the cache type - const std::type_info& typeId = typeid(T); - auto it = typeCaches_.find(&typeId); - - if (it != typeCaches_.end()) { - return std::static_pointer_cast>(it->second); - } - - auto cache = std::make_shared>(); - typeCaches_[&typeId] = cache; - return cache; - } - - /** - * Store a prototype object for a given type key. - * Used by NativeObject to cache prototypes per runtime. - */ - void setPrototype(void* typeKey, std::shared_ptr prototype) { - std::lock_guard lock(mutex_); - prototypes_[typeKey] = std::move(prototype); - } - - /** - * Get a cached prototype for a given type key. - * Returns nullptr if not found. - */ - std::shared_ptr getPrototype(void* typeKey) { - std::lock_guard lock(mutex_); - auto it = prototypes_.find(typeKey); - if (it != prototypes_.end()) { - return it->second; - } - return nullptr; - } - -private: - RNFRuntimeState() = default; - - std::mutex mutex_; - // Map from type_info to cache instance - std::unordered_map> typeCaches_; - // Map from type key to prototype object (for NativeObject pattern) - std::unordered_map> prototypes_; -}; - -/** - * Template helper for runtime-aware caching compatible with the old API - * This provides a migration path from RuntimeAwareCache - */ -template -class RuntimeAwareCache { -public: - T& get(jsi::Runtime& rt) { - auto state = RNFRuntimeState::get(rt); - auto cache = state->getCache(); - - // For compatibility, we use the runtime pointer as the object key - auto ptr = cache->getOrCreate(&rt); - return *ptr; - } -}; - -} // namespace rnwgpu diff --git a/packages/webgpu/cpp/rnwgpu/ArrayBuffer.h b/packages/webgpu/cpp/rnwgpu/ArrayBuffer.h index 2529e3a00..4b28cbd12 100644 --- a/packages/webgpu/cpp/rnwgpu/ArrayBuffer.h +++ b/packages/webgpu/cpp/rnwgpu/ArrayBuffer.h @@ -3,7 +3,7 @@ #include -#include "RNFJSIConverter.h" +#include "JSIConverter.h" namespace rnwgpu { @@ -24,21 +24,17 @@ struct ArrayBuffer : jsi::MutableBuffer { size_t _bytesPerElement; }; -} // namespace rnwgpu - -namespace margelo { - -static std::shared_ptr +static std::shared_ptr createArrayBufferFromJSI(jsi::Runtime &runtime, const jsi::ArrayBuffer &arrayBuffer, size_t bytesPerElement) { auto size = arrayBuffer.size(runtime); - return std::make_shared(arrayBuffer.data(runtime), size, - bytesPerElement); + return std::make_shared(arrayBuffer.data(runtime), size, + bytesPerElement); } -template <> struct JSIConverter> { - static std::shared_ptr +template <> struct JSIConverter> { + static std::shared_ptr fromJSI(jsi::Runtime &runtime, const jsi::Value &arg, bool outOfBound) { if (arg.isObject()) { auto obj = arg.getObject(runtime); @@ -64,9 +60,9 @@ template <> struct JSIConverter> { } static jsi::Value toJSI(jsi::Runtime &runtime, - std::shared_ptr arg) { + std::shared_ptr arg) { return jsi::ArrayBuffer(runtime, arg); } }; -} // namespace margelo +} // namespace rnwgpu diff --git a/packages/webgpu/cpp/rnwgpu/api/GPU.cpp b/packages/webgpu/cpp/rnwgpu/api/GPU.cpp index d904d0745..ddae2a776 100644 --- a/packages/webgpu/cpp/rnwgpu/api/GPU.cpp +++ b/packages/webgpu/cpp/rnwgpu/api/GPU.cpp @@ -8,7 +8,7 @@ #include #include "Convertors.h" -#include "RNFJSIConverter.h" +#include "JSIConverter.h" #include "rnwgpu/async/JSIMicrotaskDispatcher.h" namespace rnwgpu { @@ -59,7 +59,7 @@ async::AsyncTaskHandle GPU::requestAdapter( adapterHost); resolve([result = std::move(result)](jsi::Runtime &runtime) mutable { - return margelo::JSIConverter::toJSI(runtime, + return JSIConverter::toJSI(runtime, result); }); } else { @@ -68,7 +68,7 @@ async::AsyncTaskHandle GPU::requestAdapter( nullptr); resolve([result = std::move(result)](jsi::Runtime &runtime) mutable { - return margelo::JSIConverter::toJSI(runtime, + return JSIConverter::toJSI(runtime, result); }); } diff --git a/packages/webgpu/cpp/rnwgpu/api/GPUAdapter.cpp b/packages/webgpu/cpp/rnwgpu/api/GPUAdapter.cpp index 81bad6390..85e8d3908 100644 --- a/packages/webgpu/cpp/rnwgpu/api/GPUAdapter.cpp +++ b/packages/webgpu/cpp/rnwgpu/api/GPUAdapter.cpp @@ -10,7 +10,7 @@ #include "Convertors.h" #include "GPUFeatures.h" -#include "RNFJSIConverter.h" +#include "JSIConverter.h" #include "WGPULogger.h" namespace rnwgpu { @@ -140,7 +140,7 @@ async::AsyncTaskHandle GPUAdapter::requestDevice( *deviceLostBinding = deviceHost; resolve([deviceHost = std::move(deviceHost)]( jsi::Runtime &runtime) mutable { - return margelo::JSIConverter>::toJSI( + return JSIConverter>::toJSI( runtime, deviceHost); }); }); diff --git a/packages/webgpu/cpp/rnwgpu/api/GPUCompilationInfo.h b/packages/webgpu/cpp/rnwgpu/api/GPUCompilationInfo.h index 58f3dd880..f12bd443d 100644 --- a/packages/webgpu/cpp/rnwgpu/api/GPUCompilationInfo.h +++ b/packages/webgpu/cpp/rnwgpu/api/GPUCompilationInfo.h @@ -44,17 +44,14 @@ class GPUCompilationInfo : public NativeObject { friend class GPUShaderModule; }; -} // namespace rnwgpu - -namespace margelo { template <> -struct JSIConverter> { - static std::vector +struct JSIConverter> { + static std::vector fromJSI(jsi::Runtime &runtime, const jsi::Value &arg, bool outOfBounds) { throw std::runtime_error("Invalid GPUCompilationMessageData::fromJSI()"); } static jsi::Value toJSI(jsi::Runtime &runtime, - std::vector arg) { + std::vector arg) { jsi::Array result = jsi::Array(runtime, arg.size()); for (size_t i = 0; i < arg.size(); i++) { const auto &message = arg[i]; @@ -80,4 +77,4 @@ struct JSIConverter> { } }; -} // namespace margelo +} // namespace rnwgpu diff --git a/packages/webgpu/cpp/rnwgpu/api/GPUDevice.cpp b/packages/webgpu/cpp/rnwgpu/api/GPUDevice.cpp index 2ae578c6e..896a66f0b 100644 --- a/packages/webgpu/cpp/rnwgpu/api/GPUDevice.cpp +++ b/packages/webgpu/cpp/rnwgpu/api/GPUDevice.cpp @@ -7,7 +7,7 @@ #include #include "Convertors.h" -#include "RNFJSIConverter.h" +#include "JSIConverter.h" #include "GPUFeatures.h" @@ -26,7 +26,7 @@ void GPUDevice::notifyDeviceLost(wgpu::DeviceLostReason reason, auto resolve = std::move(*_lostResolve); _lostResolve.reset(); resolve([info = _lostInfo](jsi::Runtime &runtime) mutable { - return margelo::JSIConverter>::toJSI( + return JSIConverter>::toJSI( runtime, info); }); } @@ -262,8 +262,7 @@ async::AsyncTaskHandle GPUDevice::createComputePipelineAsync( pipeline) { pipelineHolder->_instance = pipeline; resolve([pipelineHolder](jsi::Runtime &runtime) mutable { - return margelo:: - JSIConverter>::toJSI( + return JSIConverter>::toJSI( runtime, pipelineHolder); }); } else { @@ -303,8 +302,7 @@ async::AsyncTaskHandle GPUDevice::createRenderPipelineAsync( pipeline) { pipelineHolder->_instance = pipeline; resolve([pipelineHolder](jsi::Runtime &runtime) mutable { - return margelo:: - JSIConverter>::toJSI( + return JSIConverter>::toJSI( runtime, pipelineHolder); }); } else { @@ -359,7 +357,7 @@ async::AsyncTaskHandle GPUDevice::popErrorScope() { resolve([result = std::move(result)](jsi::Runtime &runtime) mutable { - return margelo::JSIConverter::toJSI(runtime, + return JSIConverter::toJSI(runtime, result); }); }); @@ -390,7 +388,7 @@ async::AsyncTaskHandle GPUDevice::getLost() { const async::AsyncTaskHandle::ResolveFunction &resolve, const async::AsyncTaskHandle::RejectFunction & /*reject*/) { resolve([info](jsi::Runtime &runtime) mutable { - return margelo::JSIConverter< + return JSIConverter< std::shared_ptr>::toJSI(runtime, info); }); }, @@ -402,7 +400,7 @@ async::AsyncTaskHandle GPUDevice::getLost() { const async::AsyncTaskHandle::RejectFunction & /*reject*/) { if (_lostSettled && _lostInfo) { resolve([info = _lostInfo](jsi::Runtime &runtime) mutable { - return margelo::JSIConverter< + return JSIConverter< std::shared_ptr>::toJSI(runtime, info); }); return; diff --git a/packages/webgpu/cpp/rnwgpu/api/GPUError.h b/packages/webgpu/cpp/rnwgpu/api/GPUError.h index b6afa97f8..7b03a3dfb 100644 --- a/packages/webgpu/cpp/rnwgpu/api/GPUError.h +++ b/packages/webgpu/cpp/rnwgpu/api/GPUError.h @@ -6,8 +6,8 @@ #include "webgpu/webgpu_cpp.h" -#include "RNFEnumMapper.h" -#include "RNFJSIConverter.h" +#include "EnumMapper.h" +#include "JSIConverter.h" namespace rnwgpu { @@ -21,19 +21,13 @@ class GPUError { std::string message; }; -} // namespace rnwgpu - -namespace margelo { - -using namespace rnwgpu; // NOLINT(build/namespaces) - -template <> struct JSIConverter> { - static std::shared_ptr +template <> struct JSIConverter> { + static std::shared_ptr fromJSI(jsi::Runtime &runtime, const jsi::Value &arg, bool outOfBounds) { throw std::runtime_error("Invalid GPUBindGroupEntry::fromJSI()"); } static jsi::Value toJSI(jsi::Runtime &runtime, - std::shared_ptr arg) { + std::shared_ptr arg) { jsi::Object result(runtime); result.setProperty( runtime, "message", @@ -42,4 +36,4 @@ template <> struct JSIConverter> { } }; -} // namespace margelo +} // namespace rnwgpu diff --git a/packages/webgpu/cpp/rnwgpu/api/GPUExtent3D.h b/packages/webgpu/cpp/rnwgpu/api/GPUExtent3D.h index 2223a1528..4dda4f3c5 100644 --- a/packages/webgpu/cpp/rnwgpu/api/GPUExtent3D.h +++ b/packages/webgpu/cpp/rnwgpu/api/GPUExtent3D.h @@ -2,7 +2,7 @@ #include -#include "RNFJSIConverter.h" +#include "JSIConverter.h" #include "webgpu/webgpu_cpp.h" @@ -14,14 +14,10 @@ struct GPUExtent3D { double depthOrArrayLayers = 1; }; -} // namespace rnwgpu - -namespace margelo { - -template <> struct JSIConverter> { - static std::shared_ptr +template <> struct JSIConverter> { + static std::shared_ptr fromJSI(jsi::Runtime &runtime, const jsi::Value &arg, bool outOfBounds) { - auto result = std::make_unique(); + auto result = std::make_unique(); if (!outOfBounds && arg.isObject()) { if (arg.getObject(runtime).isArray(runtime)) { auto array = arg.getObject(runtime).asArray(runtime); @@ -61,9 +57,10 @@ template <> struct JSIConverter> { return result; } static jsi::Value toJSI(jsi::Runtime &runtime, - std::shared_ptr arg) { + std::shared_ptr arg) { // No conversions here return jsi::Value::null(); } }; -} // namespace margelo + +} // namespace rnwgpu diff --git a/packages/webgpu/cpp/rnwgpu/api/GPUOrigin2D.h b/packages/webgpu/cpp/rnwgpu/api/GPUOrigin2D.h index 00f4c4381..35eeec97a 100644 --- a/packages/webgpu/cpp/rnwgpu/api/GPUOrigin2D.h +++ b/packages/webgpu/cpp/rnwgpu/api/GPUOrigin2D.h @@ -2,7 +2,7 @@ #include -#include "RNFJSIConverter.h" +#include "JSIConverter.h" #include "webgpu/webgpu_cpp.h" @@ -13,14 +13,10 @@ struct GPUOrigin2D { double y = 0; }; -} // namespace rnwgpu - -namespace margelo { - -template <> struct JSIConverter> { - static std::shared_ptr +template <> struct JSIConverter> { + static std::shared_ptr fromJSI(jsi::Runtime &runtime, const jsi::Value &arg, bool outOfBounds) { - auto result = std::make_unique(); + auto result = std::make_unique(); if (!outOfBounds && arg.isObject()) { if (arg.getObject(runtime).isArray(runtime)) { auto array = arg.getObject(runtime).asArray(runtime); @@ -50,10 +46,10 @@ template <> struct JSIConverter> { return result; } static jsi::Value toJSI(jsi::Runtime &runtime, - std::shared_ptr arg) { + std::shared_ptr arg) { // No conversions here return jsi::Value::null(); } }; -} // namespace margelo +} // namespace rnwgpu diff --git a/packages/webgpu/cpp/rnwgpu/api/GPUOrigin3D.h b/packages/webgpu/cpp/rnwgpu/api/GPUOrigin3D.h index efec2a68f..5f8893f7b 100644 --- a/packages/webgpu/cpp/rnwgpu/api/GPUOrigin3D.h +++ b/packages/webgpu/cpp/rnwgpu/api/GPUOrigin3D.h @@ -2,7 +2,7 @@ #include -#include "RNFJSIConverter.h" +#include "JSIConverter.h" #include "webgpu/webgpu_cpp.h" @@ -14,14 +14,10 @@ struct GPUOrigin3D { double z = 0; }; -} // namespace rnwgpu - -namespace margelo { - -template <> struct JSIConverter> { - static std::shared_ptr +template <> struct JSIConverter> { + static std::shared_ptr fromJSI(jsi::Runtime &runtime, const jsi::Value &arg, bool outOfBounds) { - auto result = std::make_unique(); + auto result = std::make_unique(); if (!outOfBounds && arg.isObject()) { if (arg.getObject(runtime).isArray(runtime)) { auto array = arg.getObject(runtime).asArray(runtime); @@ -57,10 +53,10 @@ template <> struct JSIConverter> { return result; } static jsi::Value toJSI(jsi::Runtime &runtime, - std::shared_ptr arg) { + std::shared_ptr arg) { // No conversions here return jsi::Value::null(); } }; -} // namespace margelo +} // namespace rnwgpu diff --git a/packages/webgpu/cpp/rnwgpu/api/GPUShaderModule.cpp b/packages/webgpu/cpp/rnwgpu/api/GPUShaderModule.cpp index a49450dc5..4a93cc628 100644 --- a/packages/webgpu/cpp/rnwgpu/api/GPUShaderModule.cpp +++ b/packages/webgpu/cpp/rnwgpu/api/GPUShaderModule.cpp @@ -3,7 +3,7 @@ #include #include -#include "RNFJSIConverter.h" +#include "JSIConverter.h" namespace rnwgpu { @@ -41,7 +41,7 @@ async::AsyncTaskHandle GPUShaderModule::getCompilationInfo() { resolve( [result = std::move(result)](jsi::Runtime &runtime) mutable { - return margelo::JSIConverter< + return JSIConverter< std::shared_ptr>::toJSI(runtime, result); }); diff --git a/packages/webgpu/cpp/rnwgpu/api/RNWebGPU.h b/packages/webgpu/cpp/rnwgpu/api/RNWebGPU.h index 3bf797aa3..00fbe0468 100644 --- a/packages/webgpu/cpp/rnwgpu/api/RNWebGPU.h +++ b/packages/webgpu/cpp/rnwgpu/api/RNWebGPU.h @@ -77,15 +77,11 @@ class RNWebGPU : public NativeObject { std::shared_ptr _platformContext; }; -} // namespace rnwgpu - -namespace margelo { - -template <> struct JSIConverter> { - static std::shared_ptr +template <> struct JSIConverter> { + static std::shared_ptr fromJSI(jsi::Runtime &runtime, const jsi::Value &arg, bool outOfBounds) { if (!outOfBounds && arg.isObject()) { - auto result = std::make_unique(); + auto result = std::make_unique(); auto val = arg.asObject(runtime); if (val.hasProperty(runtime, "_data")) { auto value = val.getPropertyAsObject(runtime, "_data"); @@ -106,9 +102,9 @@ template <> struct JSIConverter> { } } static jsi::Value toJSI(jsi::Runtime &runtime, - std::shared_ptr arg) { + std::shared_ptr arg) { throw std::runtime_error("Invalid Blob::toJSI()"); } }; -} // namespace margelo +} // namespace rnwgpu diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBindGroupDescriptor.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBindGroupDescriptor.h index 1404b46b2..5addd6e1e 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBindGroupDescriptor.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBindGroupDescriptor.h @@ -6,7 +6,7 @@ #include "webgpu/webgpu_cpp.h" -#include "RNFJSIConverter.h" +#include "JSIConverter.h" #include "WGPULogger.h" #include "GPUBindGroupEntry.h" @@ -25,9 +25,8 @@ struct GPUBindGroupDescriptor { } // namespace rnwgpu -namespace margelo { +namespace rnwgpu { -using namespace rnwgpu; // NOLINT(build/namespaces) template <> struct JSIConverter> { @@ -64,4 +63,4 @@ struct JSIConverter> { } }; -} // namespace margelo \ No newline at end of file +} // namespace rnwgpu \ No newline at end of file diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBindGroupEntry.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBindGroupEntry.h index cb6549ebb..cfb34f170 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBindGroupEntry.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBindGroupEntry.h @@ -9,7 +9,7 @@ #include "GPUExternalTexture.h" #include "GPUSampler.h" #include "GPUTextureView.h" -#include "RNFJSIConverter.h" +#include "JSIConverter.h" #include "WGPULogger.h" namespace jsi = facebook::jsi; @@ -26,9 +26,8 @@ struct GPUBindGroupEntry { } // namespace rnwgpu -namespace margelo { +namespace rnwgpu { -using namespace rnwgpu; // NOLINT(build/namespaces) template <> struct JSIConverter> { static std::shared_ptr @@ -71,4 +70,4 @@ template <> struct JSIConverter> { } }; -} // namespace margelo +} // namespace rnwgpu diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBindGroupLayoutDescriptor.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBindGroupLayoutDescriptor.h index 94602cc0a..ea77544ff 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBindGroupLayoutDescriptor.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBindGroupLayoutDescriptor.h @@ -6,7 +6,7 @@ #include "webgpu/webgpu_cpp.h" -#include "RNFJSIConverter.h" +#include "JSIConverter.h" #include "WGPULogger.h" #include "GPUBindGroupLayoutEntry.h" @@ -23,9 +23,8 @@ struct GPUBindGroupLayoutDescriptor { } // namespace rnwgpu -namespace margelo { +namespace rnwgpu { -using namespace rnwgpu; // NOLINT(build/namespaces) template <> struct JSIConverter> { @@ -56,4 +55,4 @@ struct JSIConverter> { } }; -} // namespace margelo \ No newline at end of file +} // namespace rnwgpu \ No newline at end of file diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBindGroupLayoutEntry.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBindGroupLayoutEntry.h index 5d509a16c..42014f862 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBindGroupLayoutEntry.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBindGroupLayoutEntry.h @@ -4,7 +4,7 @@ #include "webgpu/webgpu_cpp.h" -#include "RNFJSIConverter.h" +#include "JSIConverter.h" #include "WGPULogger.h" #include "GPUBufferBindingLayout.h" @@ -34,9 +34,8 @@ struct GPUBindGroupLayoutEntry { } // namespace rnwgpu -namespace margelo { +namespace rnwgpu { -using namespace rnwgpu; // NOLINT(build/namespaces) template <> struct JSIConverter> { @@ -97,4 +96,4 @@ struct JSIConverter> { } }; -} // namespace margelo \ No newline at end of file +} // namespace rnwgpu \ No newline at end of file diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBlendComponent.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBlendComponent.h index 65610578e..91808628c 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBlendComponent.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBlendComponent.h @@ -4,7 +4,7 @@ #include "webgpu/webgpu_cpp.h" -#include "RNFJSIConverter.h" +#include "JSIConverter.h" #include "WGPULogger.h" namespace jsi = facebook::jsi; @@ -19,9 +19,8 @@ struct GPUBlendComponent { } // namespace rnwgpu -namespace margelo { +namespace rnwgpu { -using namespace rnwgpu; // NOLINT(build/namespaces) template <> struct JSIConverter> { static std::shared_ptr @@ -57,4 +56,4 @@ template <> struct JSIConverter> { } }; -} // namespace margelo \ No newline at end of file +} // namespace rnwgpu \ No newline at end of file diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBlendState.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBlendState.h index 443e6b0a2..899b12b7d 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBlendState.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBlendState.h @@ -4,7 +4,7 @@ #include "webgpu/webgpu_cpp.h" -#include "RNFJSIConverter.h" +#include "JSIConverter.h" #include "WGPULogger.h" #include "GPUBlendComponent.h" @@ -20,9 +20,8 @@ struct GPUBlendState { } // namespace rnwgpu -namespace margelo { +namespace rnwgpu { -using namespace rnwgpu; // NOLINT(build/namespaces) template <> struct JSIConverter> { static std::shared_ptr @@ -52,4 +51,4 @@ template <> struct JSIConverter> { } }; -} // namespace margelo \ No newline at end of file +} // namespace rnwgpu \ No newline at end of file diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBufferBinding.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBufferBinding.h index b1133a482..71170240f 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBufferBinding.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBufferBinding.h @@ -4,7 +4,7 @@ #include "webgpu/webgpu_cpp.h" -#include "RNFJSIConverter.h" +#include "JSIConverter.h" #include "WGPULogger.h" #include "GPUBuffer.h" @@ -21,9 +21,8 @@ struct GPUBufferBinding { } // namespace rnwgpu -namespace margelo { +namespace rnwgpu { -using namespace rnwgpu; // NOLINT(build/namespaces) template <> struct JSIConverter> { static std::shared_ptr @@ -56,4 +55,4 @@ template <> struct JSIConverter> { } }; -} // namespace margelo \ No newline at end of file +} // namespace rnwgpu \ No newline at end of file diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBufferBindingLayout.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBufferBindingLayout.h index 734f1a11a..f108757df 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBufferBindingLayout.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBufferBindingLayout.h @@ -4,7 +4,7 @@ #include "webgpu/webgpu_cpp.h" -#include "RNFJSIConverter.h" +#include "JSIConverter.h" #include "WGPULogger.h" namespace jsi = facebook::jsi; @@ -19,9 +19,8 @@ struct GPUBufferBindingLayout { } // namespace rnwgpu -namespace margelo { +namespace rnwgpu { -using namespace rnwgpu; // NOLINT(build/namespaces) template <> struct JSIConverter> { @@ -56,4 +55,4 @@ struct JSIConverter> { } }; -} // namespace margelo \ No newline at end of file +} // namespace rnwgpu \ No newline at end of file diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBufferDescriptor.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBufferDescriptor.h index 8ba549498..fc2f57b57 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBufferDescriptor.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBufferDescriptor.h @@ -5,7 +5,7 @@ #include "webgpu/webgpu_cpp.h" -#include "RNFJSIConverter.h" +#include "JSIConverter.h" #include "WGPULogger.h" namespace jsi = facebook::jsi; @@ -21,9 +21,8 @@ struct GPUBufferDescriptor { } // namespace rnwgpu -namespace margelo { +namespace rnwgpu { -using namespace rnwgpu; // NOLINT(build/namespaces) template <> struct JSIConverter> { static std::shared_ptr @@ -59,4 +58,4 @@ template <> struct JSIConverter> { } }; -} // namespace margelo \ No newline at end of file +} // namespace rnwgpu \ No newline at end of file diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUCanvasConfiguration.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUCanvasConfiguration.h index 8f1a22213..3013539f1 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUCanvasConfiguration.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUCanvasConfiguration.h @@ -5,7 +5,7 @@ #include "webgpu/webgpu_cpp.h" -#include "RNFJSIConverter.h" +#include "JSIConverter.h" #include "GPUDevice.h" @@ -24,9 +24,8 @@ struct GPUCanvasConfiguration { } // namespace rnwgpu -namespace margelo { +namespace rnwgpu { -using namespace rnwgpu; // NOLINT(build/namespaces) // NOLINT(build/namespaces) template <> struct JSIConverter> { @@ -75,4 +74,4 @@ struct JSIConverter> { } }; -} // namespace margelo +} // namespace rnwgpu diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUColor.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUColor.h index aecab9e48..76173ab98 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUColor.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUColor.h @@ -4,7 +4,7 @@ #include "webgpu/webgpu_cpp.h" -#include "RNFJSIConverter.h" +#include "JSIConverter.h" #include "WGPULogger.h" namespace jsi = facebook::jsi; @@ -20,9 +20,8 @@ struct GPUColor { } // namespace rnwgpu -namespace margelo { +namespace rnwgpu { -using namespace rnwgpu; // NOLINT(build/namespaces) template <> struct JSIConverter> { static std::shared_ptr @@ -66,4 +65,4 @@ template <> struct JSIConverter> { } }; -} // namespace margelo +} // namespace rnwgpu diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUColorTargetState.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUColorTargetState.h index 55bf06b95..c58f390f8 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUColorTargetState.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUColorTargetState.h @@ -4,7 +4,7 @@ #include "webgpu/webgpu_cpp.h" -#include "RNFJSIConverter.h" +#include "JSIConverter.h" #include "WGPULogger.h" #include "GPUBlendState.h" @@ -21,9 +21,8 @@ struct GPUColorTargetState { } // namespace rnwgpu -namespace margelo { +namespace rnwgpu { -using namespace rnwgpu; // NOLINT(build/namespaces) template <> struct JSIConverter> { static std::shared_ptr @@ -58,4 +57,4 @@ template <> struct JSIConverter> { } }; -} // namespace margelo \ No newline at end of file +} // namespace rnwgpu \ No newline at end of file diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUCommandBufferDescriptor.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUCommandBufferDescriptor.h index 3fc988563..91cf922dc 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUCommandBufferDescriptor.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUCommandBufferDescriptor.h @@ -5,7 +5,7 @@ #include "webgpu/webgpu_cpp.h" -#include "RNFJSIConverter.h" +#include "JSIConverter.h" #include "WGPULogger.h" namespace jsi = facebook::jsi; @@ -18,9 +18,8 @@ struct GPUCommandBufferDescriptor { } // namespace rnwgpu -namespace margelo { +namespace rnwgpu { -using namespace rnwgpu; // NOLINT(build/namespaces) template <> struct JSIConverter> { @@ -45,4 +44,4 @@ struct JSIConverter> { } }; -} // namespace margelo \ No newline at end of file +} // namespace rnwgpu \ No newline at end of file diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUCommandEncoderDescriptor.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUCommandEncoderDescriptor.h index 47b093a88..fcf32a91c 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUCommandEncoderDescriptor.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUCommandEncoderDescriptor.h @@ -5,7 +5,7 @@ #include "webgpu/webgpu_cpp.h" -#include "RNFJSIConverter.h" +#include "JSIConverter.h" #include "WGPULogger.h" namespace jsi = facebook::jsi; @@ -18,9 +18,8 @@ struct GPUCommandEncoderDescriptor { } // namespace rnwgpu -namespace margelo { +namespace rnwgpu { -using namespace rnwgpu; // NOLINT(build/namespaces) template <> struct JSIConverter> { @@ -45,4 +44,4 @@ struct JSIConverter> { } }; -} // namespace margelo \ No newline at end of file +} // namespace rnwgpu \ No newline at end of file diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUComputePassDescriptor.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUComputePassDescriptor.h index 38178133f..1d019e845 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUComputePassDescriptor.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUComputePassDescriptor.h @@ -5,7 +5,7 @@ #include "webgpu/webgpu_cpp.h" -#include "RNFJSIConverter.h" +#include "JSIConverter.h" #include "WGPULogger.h" #include "GPUComputePassTimestampWrites.h" @@ -22,9 +22,8 @@ struct GPUComputePassDescriptor { } // namespace rnwgpu -namespace margelo { +namespace rnwgpu { -using namespace rnwgpu; // NOLINT(build/namespaces) template <> struct JSIConverter> { @@ -56,4 +55,4 @@ struct JSIConverter> { } }; -} // namespace margelo \ No newline at end of file +} // namespace rnwgpu \ No newline at end of file diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUComputePassTimestampWrites.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUComputePassTimestampWrites.h index bdc052b61..d02d18687 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUComputePassTimestampWrites.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUComputePassTimestampWrites.h @@ -4,7 +4,7 @@ #include "webgpu/webgpu_cpp.h" -#include "RNFJSIConverter.h" +#include "JSIConverter.h" #include "WGPULogger.h" #include "GPUQuerySet.h" @@ -21,9 +21,8 @@ struct GPUComputePassTimestampWrites { } // namespace rnwgpu -namespace margelo { +namespace rnwgpu { -using namespace rnwgpu; // NOLINT(build/namespaces) template <> struct JSIConverter> { @@ -58,4 +57,4 @@ struct JSIConverter> { } }; -} // namespace margelo \ No newline at end of file +} // namespace rnwgpu \ No newline at end of file diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUComputePipelineDescriptor.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUComputePipelineDescriptor.h index 2308ca221..b113669e1 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUComputePipelineDescriptor.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUComputePipelineDescriptor.h @@ -5,7 +5,7 @@ #include "webgpu/webgpu_cpp.h" -#include "RNFJSIConverter.h" +#include "JSIConverter.h" #include "WGPULogger.h" #include "GPUPipelineLayout.h" @@ -24,9 +24,8 @@ struct GPUComputePipelineDescriptor { } // namespace rnwgpu -namespace margelo { +namespace rnwgpu { -using namespace rnwgpu; // NOLINT(build/namespaces) template <> struct JSIConverter> { @@ -67,4 +66,4 @@ struct JSIConverter> { } }; -} // namespace margelo \ No newline at end of file +} // namespace rnwgpu \ No newline at end of file diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUDepthStencilState.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUDepthStencilState.h index c739d9a5f..81288d1b7 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUDepthStencilState.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUDepthStencilState.h @@ -4,7 +4,7 @@ #include "webgpu/webgpu_cpp.h" -#include "RNFJSIConverter.h" +#include "JSIConverter.h" #include "WGPULogger.h" #include "GPUStencilFaceState.h" @@ -30,9 +30,8 @@ struct GPUDepthStencilState { } // namespace rnwgpu -namespace margelo { +namespace rnwgpu { -using namespace rnwgpu; // NOLINT(build/namespaces) template <> struct JSIConverter> { static std::shared_ptr @@ -103,4 +102,4 @@ template <> struct JSIConverter> { } }; -} // namespace margelo \ No newline at end of file +} // namespace rnwgpu \ No newline at end of file diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUDeviceDescriptor.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUDeviceDescriptor.h index eba0e1811..9129313c1 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUDeviceDescriptor.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUDeviceDescriptor.h @@ -7,7 +7,7 @@ #include "webgpu/webgpu_cpp.h" -#include "RNFJSIConverter.h" +#include "JSIConverter.h" #include "WGPULogger.h" #include "GPUQueueDescriptor.h" @@ -28,9 +28,8 @@ struct GPUDeviceDescriptor { } // namespace rnwgpu -namespace margelo { +namespace rnwgpu { -using namespace rnwgpu; // NOLINT(build/namespaces) // We add this extra convertor because we found so library that are sending // invalid feature elements @@ -99,4 +98,4 @@ template <> struct JSIConverter> { } }; -} // namespace margelo +} // namespace rnwgpu diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUExternalTextureBindingLayout.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUExternalTextureBindingLayout.h index 5363079de..bd1968635 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUExternalTextureBindingLayout.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUExternalTextureBindingLayout.h @@ -4,7 +4,7 @@ #include "webgpu/webgpu_cpp.h" -#include "RNFJSIConverter.h" +#include "JSIConverter.h" #include "WGPULogger.h" namespace jsi = facebook::jsi; @@ -15,9 +15,8 @@ struct GPUExternalTextureBindingLayout {}; } // namespace rnwgpu -namespace margelo { +namespace rnwgpu { -using namespace rnwgpu; // NOLINT(build/namespaces) template <> struct JSIConverter> { @@ -38,4 +37,4 @@ struct JSIConverter> { } }; -} // namespace margelo \ No newline at end of file +} // namespace rnwgpu \ No newline at end of file diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUExternalTextureDescriptor.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUExternalTextureDescriptor.h index e2bda5c92..06fb2564f 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUExternalTextureDescriptor.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUExternalTextureDescriptor.h @@ -9,7 +9,7 @@ #include "Convertors.h" -#include "RNFJSIConverter.h" +#include "JSIConverter.h" #include "WGPULogger.h" namespace jsi = facebook::jsi; @@ -34,9 +34,8 @@ static bool conv(wgpu::ExternalTextureDescriptor &out, } } // namespace rnwgpu -namespace margelo { +namespace rnwgpu { -using namespace rnwgpu; // NOLINT(build/namespaces) template <> struct JSIConverter> { @@ -79,4 +78,4 @@ struct JSIConverter> { } }; -} // namespace margelo +} // namespace rnwgpu diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUFragmentState.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUFragmentState.h index f5e1ae4f0..0d728419d 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUFragmentState.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUFragmentState.h @@ -8,7 +8,7 @@ #include "webgpu/webgpu_cpp.h" -#include "RNFJSIConverter.h" +#include "JSIConverter.h" #include "WGPULogger.h" #include "GPUColorTargetState.h" @@ -30,9 +30,8 @@ struct GPUFragmentState { } // namespace rnwgpu -namespace margelo { +namespace rnwgpu { -using namespace rnwgpu; // NOLINT(build/namespaces) template <> struct JSIConverter> { static std::shared_ptr @@ -73,4 +72,4 @@ template <> struct JSIConverter> { } }; -} // namespace margelo \ No newline at end of file +} // namespace rnwgpu \ No newline at end of file diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUImageCopyBuffer.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUImageCopyBuffer.h index 93d9da35a..10b685db5 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUImageCopyBuffer.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUImageCopyBuffer.h @@ -4,7 +4,7 @@ #include "webgpu/webgpu_cpp.h" -#include "RNFJSIConverter.h" +#include "JSIConverter.h" #include "WGPULogger.h" #include "GPUBuffer.h" @@ -22,9 +22,8 @@ struct GPUImageCopyBuffer { } // namespace rnwgpu -namespace margelo { +namespace rnwgpu { -using namespace rnwgpu; // NOLINT(build/namespaces) template <> struct JSIConverter> { static std::shared_ptr @@ -62,4 +61,4 @@ template <> struct JSIConverter> { } }; -} // namespace margelo \ No newline at end of file +} // namespace rnwgpu \ No newline at end of file diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUImageCopyExternalImage.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUImageCopyExternalImage.h index 0b4b1df0e..622b59acb 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUImageCopyExternalImage.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUImageCopyExternalImage.h @@ -8,7 +8,7 @@ #include "webgpu/webgpu_cpp.h" #include "Convertors.h" -#include "RNFJSIConverter.h" +#include "JSIConverter.h" #include "GPUOrigin2D.h" #include "ImageBitmap.h" @@ -25,9 +25,8 @@ struct GPUImageCopyExternalImage { } // namespace rnwgpu -namespace margelo { +namespace rnwgpu { -using namespace rnwgpu; // NOLINT(build/namespaces) template <> struct JSIConverter> { @@ -62,4 +61,4 @@ struct JSIConverter> { } }; -} // namespace margelo +} // namespace rnwgpu diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUImageCopyTexture.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUImageCopyTexture.h index 2e554cd6d..7e284aa15 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUImageCopyTexture.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUImageCopyTexture.h @@ -4,7 +4,7 @@ #include "webgpu/webgpu_cpp.h" -#include "RNFJSIConverter.h" +#include "JSIConverter.h" #include "WGPULogger.h" #include "GPUOrigin3D.h" @@ -23,9 +23,8 @@ struct GPUImageCopyTexture { } // namespace rnwgpu -namespace margelo { +namespace rnwgpu { -using namespace rnwgpu; // NOLINT(build/namespaces) template <> struct JSIConverter> { static std::shared_ptr @@ -65,4 +64,4 @@ template <> struct JSIConverter> { } }; -} // namespace margelo \ No newline at end of file +} // namespace rnwgpu \ No newline at end of file diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUImageCopyTextureTagged.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUImageCopyTextureTagged.h index c400ecf8b..66cc3d918 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUImageCopyTextureTagged.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUImageCopyTextureTagged.h @@ -4,7 +4,7 @@ #include "webgpu/webgpu_cpp.h" -#include "RNFJSIConverter.h" +#include "JSIConverter.h" #include "WGPULogger.h" #include "External.h" @@ -26,9 +26,8 @@ struct GPUImageCopyTextureTagged { } // namespace rnwgpu -namespace margelo { +namespace rnwgpu { -using namespace rnwgpu; // NOLINT(build/namespaces) template <> struct JSIConverter> { @@ -81,4 +80,4 @@ struct JSIConverter> { } }; -} // namespace margelo \ No newline at end of file +} // namespace rnwgpu \ No newline at end of file diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUImageDataLayout.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUImageDataLayout.h index b6413d340..edc854541 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUImageDataLayout.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUImageDataLayout.h @@ -4,7 +4,7 @@ #include "webgpu/webgpu_cpp.h" -#include "RNFJSIConverter.h" +#include "JSIConverter.h" #include "WGPULogger.h" namespace jsi = facebook::jsi; @@ -19,9 +19,8 @@ struct GPUImageDataLayout { } // namespace rnwgpu -namespace margelo { +namespace rnwgpu { -using namespace rnwgpu; // NOLINT(build/namespaces) template <> struct JSIConverter> { static std::shared_ptr @@ -54,4 +53,4 @@ template <> struct JSIConverter> { } }; -} // namespace margelo \ No newline at end of file +} // namespace rnwgpu \ No newline at end of file diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUMultisampleState.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUMultisampleState.h index bc0149a7e..8ee999d52 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUMultisampleState.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUMultisampleState.h @@ -4,7 +4,7 @@ #include "webgpu/webgpu_cpp.h" -#include "RNFJSIConverter.h" +#include "JSIConverter.h" #include "WGPULogger.h" namespace jsi = facebook::jsi; @@ -19,9 +19,8 @@ struct GPUMultisampleState { } // namespace rnwgpu -namespace margelo { +namespace rnwgpu { -using namespace rnwgpu; // NOLINT(build/namespaces) template <> struct JSIConverter> { static std::shared_ptr @@ -54,4 +53,4 @@ template <> struct JSIConverter> { } }; -} // namespace margelo \ No newline at end of file +} // namespace rnwgpu \ No newline at end of file diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUPipelineLayoutDescriptor.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUPipelineLayoutDescriptor.h index 22ae4ecfd..e0999515d 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUPipelineLayoutDescriptor.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUPipelineLayoutDescriptor.h @@ -6,7 +6,7 @@ #include "webgpu/webgpu_cpp.h" -#include "RNFJSIConverter.h" +#include "JSIConverter.h" #include "WGPULogger.h" #include "GPUBindGroupLayout.h" @@ -23,9 +23,8 @@ struct GPUPipelineLayoutDescriptor { } // namespace rnwgpu -namespace margelo { +namespace rnwgpu { -using namespace rnwgpu; // NOLINT(build/namespaces) template <> struct JSIConverter> { @@ -57,4 +56,4 @@ struct JSIConverter> { } }; -} // namespace margelo \ No newline at end of file +} // namespace rnwgpu \ No newline at end of file diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUPrimitiveState.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUPrimitiveState.h index 3c56e71f3..6cdf9377e 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUPrimitiveState.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUPrimitiveState.h @@ -4,7 +4,7 @@ #include "webgpu/webgpu_cpp.h" -#include "RNFJSIConverter.h" +#include "JSIConverter.h" #include "WGPULogger.h" namespace jsi = facebook::jsi; @@ -21,9 +21,8 @@ struct GPUPrimitiveState { } // namespace rnwgpu -namespace margelo { +namespace rnwgpu { -using namespace rnwgpu; // NOLINT(build/namespaces) template <> struct JSIConverter> { static std::shared_ptr @@ -69,4 +68,4 @@ template <> struct JSIConverter> { } }; -} // namespace margelo \ No newline at end of file +} // namespace rnwgpu \ No newline at end of file diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUProgrammableStage.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUProgrammableStage.h index 5c252709e..aaad5c5eb 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUProgrammableStage.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUProgrammableStage.h @@ -6,7 +6,7 @@ #include "webgpu/webgpu_cpp.h" -#include "RNFJSIConverter.h" +#include "JSIConverter.h" #include "WGPULogger.h" #include "GPUShaderModule.h" @@ -24,9 +24,8 @@ struct GPUProgrammableStage { } // namespace rnwgpu -namespace margelo { +namespace rnwgpu { -using namespace rnwgpu; // NOLINT(build/namespaces) template <> struct JSIConverter> { static std::shared_ptr @@ -61,4 +60,4 @@ template <> struct JSIConverter> { } }; -} // namespace margelo \ No newline at end of file +} // namespace rnwgpu \ No newline at end of file diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUQuerySetDescriptor.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUQuerySetDescriptor.h index ce5ccf357..42fb41722 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUQuerySetDescriptor.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUQuerySetDescriptor.h @@ -5,7 +5,7 @@ #include "webgpu/webgpu_cpp.h" -#include "RNFJSIConverter.h" +#include "JSIConverter.h" #include "WGPULogger.h" namespace jsi = facebook::jsi; @@ -20,9 +20,8 @@ struct GPUQuerySetDescriptor { } // namespace rnwgpu -namespace margelo { +namespace rnwgpu { -using namespace rnwgpu; // NOLINT(build/namespaces) template <> struct JSIConverter> { @@ -55,4 +54,4 @@ struct JSIConverter> { } }; -} // namespace margelo \ No newline at end of file +} // namespace rnwgpu \ No newline at end of file diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUQueueDescriptor.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUQueueDescriptor.h index 7b335fc5d..128c261e1 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUQueueDescriptor.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUQueueDescriptor.h @@ -5,7 +5,7 @@ #include "webgpu/webgpu_cpp.h" -#include "RNFJSIConverter.h" +#include "JSIConverter.h" #include "WGPULogger.h" namespace jsi = facebook::jsi; @@ -18,9 +18,8 @@ struct GPUQueueDescriptor { } // namespace rnwgpu -namespace margelo { +namespace rnwgpu { -using namespace rnwgpu; // NOLINT(build/namespaces) template <> struct JSIConverter> { static std::shared_ptr @@ -43,4 +42,4 @@ template <> struct JSIConverter> { } }; -} // namespace margelo \ No newline at end of file +} // namespace rnwgpu \ No newline at end of file diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPURenderBundleDescriptor.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPURenderBundleDescriptor.h index 96d289838..5adfbc4fb 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPURenderBundleDescriptor.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPURenderBundleDescriptor.h @@ -5,7 +5,7 @@ #include "webgpu/webgpu_cpp.h" -#include "RNFJSIConverter.h" +#include "JSIConverter.h" #include "WGPULogger.h" namespace jsi = facebook::jsi; @@ -18,9 +18,8 @@ struct GPURenderBundleDescriptor { } // namespace rnwgpu -namespace margelo { +namespace rnwgpu { -using namespace rnwgpu; // NOLINT(build/namespaces) template <> struct JSIConverter> { @@ -45,4 +44,4 @@ struct JSIConverter> { } }; -} // namespace margelo \ No newline at end of file +} // namespace rnwgpu \ No newline at end of file diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPURenderBundleEncoderDescriptor.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPURenderBundleEncoderDescriptor.h index fe87247ba..0942047b0 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPURenderBundleEncoderDescriptor.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPURenderBundleEncoderDescriptor.h @@ -6,7 +6,7 @@ #include "webgpu/webgpu_cpp.h" -#include "RNFJSIConverter.h" +#include "JSIConverter.h" #include "WGPULogger.h" namespace jsi = facebook::jsi; @@ -25,9 +25,8 @@ struct GPURenderBundleEncoderDescriptor { } // namespace rnwgpu -namespace margelo { +namespace rnwgpu { -using namespace rnwgpu; // NOLINT(build/namespaces) template <> struct JSIConverter> { @@ -80,4 +79,4 @@ struct JSIConverter> { } }; -} // namespace margelo \ No newline at end of file +} // namespace rnwgpu \ No newline at end of file diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPURenderPassColorAttachment.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPURenderPassColorAttachment.h index bfde2e7b5..d6f112751 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPURenderPassColorAttachment.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPURenderPassColorAttachment.h @@ -4,7 +4,7 @@ #include "webgpu/webgpu_cpp.h" -#include "RNFJSIConverter.h" +#include "JSIConverter.h" #include "WGPULogger.h" #include "GPUColor.h" @@ -26,9 +26,8 @@ struct GPURenderPassColorAttachment { } // namespace rnwgpu -namespace margelo { +namespace rnwgpu { -using namespace rnwgpu; // NOLINT(build/namespaces) template <> struct JSIConverter> { @@ -81,4 +80,4 @@ struct JSIConverter> { } }; -} // namespace margelo \ No newline at end of file +} // namespace rnwgpu \ No newline at end of file diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPURenderPassDepthStencilAttachment.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPURenderPassDepthStencilAttachment.h index 05f76490c..02607b86e 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPURenderPassDepthStencilAttachment.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPURenderPassDepthStencilAttachment.h @@ -4,7 +4,7 @@ #include "webgpu/webgpu_cpp.h" -#include "RNFJSIConverter.h" +#include "JSIConverter.h" #include "WGPULogger.h" #include "GPUTextureView.h" @@ -27,9 +27,8 @@ struct GPURenderPassDepthStencilAttachment { } // namespace rnwgpu -namespace margelo { +namespace rnwgpu { -using namespace rnwgpu; // NOLINT(build/namespaces) template <> struct JSIConverter< @@ -101,4 +100,4 @@ struct JSIConverter< } }; -} // namespace margelo \ No newline at end of file +} // namespace rnwgpu \ No newline at end of file diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPURenderPassDescriptor.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPURenderPassDescriptor.h index 75c4d6959..57def1c09 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPURenderPassDescriptor.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPURenderPassDescriptor.h @@ -7,7 +7,7 @@ #include "webgpu/webgpu_cpp.h" -#include "RNFJSIConverter.h" +#include "JSIConverter.h" #include "WGPULogger.h" #include "GPUQuerySet.h" @@ -34,9 +34,8 @@ struct GPURenderPassDescriptor { } // namespace rnwgpu -namespace margelo { +namespace rnwgpu { -using namespace rnwgpu; // NOLINT(build/namespaces) template <> struct JSIConverter> { @@ -92,4 +91,4 @@ struct JSIConverter> { } }; -} // namespace margelo \ No newline at end of file +} // namespace rnwgpu \ No newline at end of file diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPURenderPassTimestampWrites.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPURenderPassTimestampWrites.h index 569519606..4913661c1 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPURenderPassTimestampWrites.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPURenderPassTimestampWrites.h @@ -4,7 +4,7 @@ #include "webgpu/webgpu_cpp.h" -#include "RNFJSIConverter.h" +#include "JSIConverter.h" #include "WGPULogger.h" #include "GPUQuerySet.h" @@ -21,9 +21,8 @@ struct GPURenderPassTimestampWrites { } // namespace rnwgpu -namespace margelo { +namespace rnwgpu { -using namespace rnwgpu; // NOLINT(build/namespaces) template <> struct JSIConverter> { @@ -58,4 +57,4 @@ struct JSIConverter> { } }; -} // namespace margelo \ No newline at end of file +} // namespace rnwgpu \ No newline at end of file diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPURenderPipelineDescriptor.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPURenderPipelineDescriptor.h index 8b6ad814c..2f02360d2 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPURenderPipelineDescriptor.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPURenderPipelineDescriptor.h @@ -5,7 +5,7 @@ #include "webgpu/webgpu_cpp.h" -#include "RNFJSIConverter.h" +#include "JSIConverter.h" #include "WGPULogger.h" #include "GPUDepthStencilState.h" @@ -35,9 +35,8 @@ struct GPURenderPipelineDescriptor { } // namespace rnwgpu -namespace margelo { +namespace rnwgpu { -using namespace rnwgpu; // NOLINT(build/namespaces) template <> struct JSIConverter> { @@ -103,4 +102,4 @@ struct JSIConverter> { } }; -} // namespace margelo \ No newline at end of file +} // namespace rnwgpu \ No newline at end of file diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPURequestAdapterOptions.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPURequestAdapterOptions.h index 7ce18a64f..878379f8e 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPURequestAdapterOptions.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPURequestAdapterOptions.h @@ -4,7 +4,7 @@ #include "webgpu/webgpu_cpp.h" -#include "RNFJSIConverter.h" +#include "JSIConverter.h" #include "WGPULogger.h" namespace jsi = facebook::jsi; @@ -18,9 +18,8 @@ struct GPURequestAdapterOptions { } // namespace rnwgpu -namespace margelo { +namespace rnwgpu { -using namespace rnwgpu; // NOLINT(build/namespaces) template <> struct JSIConverter> { @@ -51,4 +50,4 @@ struct JSIConverter> { } }; -} // namespace margelo \ No newline at end of file +} // namespace rnwgpu \ No newline at end of file diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUSamplerBindingLayout.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUSamplerBindingLayout.h index 7d4c15ce1..ecfce53a1 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUSamplerBindingLayout.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUSamplerBindingLayout.h @@ -4,7 +4,7 @@ #include "webgpu/webgpu_cpp.h" -#include "RNFJSIConverter.h" +#include "JSIConverter.h" #include "WGPULogger.h" namespace jsi = facebook::jsi; @@ -17,9 +17,8 @@ struct GPUSamplerBindingLayout { } // namespace rnwgpu -namespace margelo { +namespace rnwgpu { -using namespace rnwgpu; // NOLINT(build/namespaces) template <> struct JSIConverter> { @@ -45,4 +44,4 @@ struct JSIConverter> { } }; -} // namespace margelo \ No newline at end of file +} // namespace rnwgpu \ No newline at end of file diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUSamplerDescriptor.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUSamplerDescriptor.h index fdf87671e..abcd3415f 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUSamplerDescriptor.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUSamplerDescriptor.h @@ -5,7 +5,7 @@ #include "webgpu/webgpu_cpp.h" -#include "RNFJSIConverter.h" +#include "JSIConverter.h" #include "WGPULogger.h" namespace jsi = facebook::jsi; @@ -28,9 +28,8 @@ struct GPUSamplerDescriptor { } // namespace rnwgpu -namespace margelo { +namespace rnwgpu { -using namespace rnwgpu; // NOLINT(build/namespaces) template <> struct JSIConverter> { static std::shared_ptr @@ -110,4 +109,4 @@ template <> struct JSIConverter> { } }; -} // namespace margelo \ No newline at end of file +} // namespace rnwgpu \ No newline at end of file diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUShaderModuleCompilationHint.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUShaderModuleCompilationHint.h index d0887b12f..dc1c80dac 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUShaderModuleCompilationHint.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUShaderModuleCompilationHint.h @@ -5,7 +5,7 @@ #include "webgpu/webgpu_cpp.h" -#include "RNFJSIConverter.h" +#include "JSIConverter.h" #include "WGPULogger.h" #include "GPUPipelineLayout.h" @@ -23,9 +23,8 @@ struct GPUShaderModuleCompilationHint { } // namespace rnwgpu -namespace margelo { +namespace rnwgpu { -using namespace rnwgpu; // NOLINT(build/namespaces) template <> struct JSIConverter> { @@ -60,4 +59,4 @@ struct JSIConverter> { } }; -} // namespace margelo \ No newline at end of file +} // namespace rnwgpu \ No newline at end of file diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUShaderModuleDescriptor.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUShaderModuleDescriptor.h index 3bc9dc9f4..6bab5ffd7 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUShaderModuleDescriptor.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUShaderModuleDescriptor.h @@ -6,7 +6,7 @@ #include "webgpu/webgpu_cpp.h" -#include "RNFJSIConverter.h" +#include "JSIConverter.h" #include "WGPULogger.h" #include "GPUShaderModuleCompilationHint.h" @@ -24,9 +24,8 @@ struct GPUShaderModuleDescriptor { } // namespace rnwgpu -namespace margelo { +namespace rnwgpu { -using namespace rnwgpu; // NOLINT(build/namespaces) template <> struct JSIConverter> { @@ -62,4 +61,4 @@ struct JSIConverter> { } }; -} // namespace margelo \ No newline at end of file +} // namespace rnwgpu \ No newline at end of file diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUStencilFaceState.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUStencilFaceState.h index 2c4ab16c9..38857b9c5 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUStencilFaceState.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUStencilFaceState.h @@ -4,7 +4,7 @@ #include "webgpu/webgpu_cpp.h" -#include "RNFJSIConverter.h" +#include "JSIConverter.h" #include "WGPULogger.h" namespace jsi = facebook::jsi; @@ -20,9 +20,8 @@ struct GPUStencilFaceState { } // namespace rnwgpu -namespace margelo { +namespace rnwgpu { -using namespace rnwgpu; // NOLINT(build/namespaces) template <> struct JSIConverter> { static std::shared_ptr @@ -64,4 +63,4 @@ template <> struct JSIConverter> { } }; -} // namespace margelo \ No newline at end of file +} // namespace rnwgpu \ No newline at end of file diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUStorageTextureBindingLayout.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUStorageTextureBindingLayout.h index cd4566646..40e393282 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUStorageTextureBindingLayout.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUStorageTextureBindingLayout.h @@ -4,7 +4,7 @@ #include "webgpu/webgpu_cpp.h" -#include "RNFJSIConverter.h" +#include "JSIConverter.h" #include "WGPULogger.h" namespace jsi = facebook::jsi; @@ -20,9 +20,8 @@ struct GPUStorageTextureBindingLayout { } // namespace rnwgpu -namespace margelo { +namespace rnwgpu { -using namespace rnwgpu; // NOLINT(build/namespaces) template <> struct JSIConverter> { @@ -59,4 +58,4 @@ struct JSIConverter> { } }; -} // namespace margelo \ No newline at end of file +} // namespace rnwgpu \ No newline at end of file diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUTextureBindingLayout.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUTextureBindingLayout.h index 59fbbe679..a411a3da2 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUTextureBindingLayout.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUTextureBindingLayout.h @@ -4,7 +4,7 @@ #include "webgpu/webgpu_cpp.h" -#include "RNFJSIConverter.h" +#include "JSIConverter.h" #include "WGPULogger.h" namespace jsi = facebook::jsi; @@ -20,9 +20,8 @@ struct GPUTextureBindingLayout { } // namespace rnwgpu -namespace margelo { +namespace rnwgpu { -using namespace rnwgpu; // NOLINT(build/namespaces) template <> struct JSIConverter> { @@ -59,4 +58,4 @@ struct JSIConverter> { } }; -} // namespace margelo \ No newline at end of file +} // namespace rnwgpu \ No newline at end of file diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUTextureDescriptor.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUTextureDescriptor.h index 3f6a5439f..40ca7c735 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUTextureDescriptor.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUTextureDescriptor.h @@ -6,7 +6,7 @@ #include "webgpu/webgpu_cpp.h" -#include "RNFJSIConverter.h" +#include "JSIConverter.h" #include "WGPULogger.h" #include "GPUExtent3D.h" @@ -29,9 +29,8 @@ struct GPUTextureDescriptor { } // namespace rnwgpu -namespace margelo { +namespace rnwgpu { -using namespace rnwgpu; // NOLINT(build/namespaces) template <> struct JSIConverter> { static std::shared_ptr @@ -91,4 +90,4 @@ template <> struct JSIConverter> { } }; -} // namespace margelo \ No newline at end of file +} // namespace rnwgpu \ No newline at end of file diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUTextureViewDescriptor.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUTextureViewDescriptor.h index 29178b702..7690460cf 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUTextureViewDescriptor.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUTextureViewDescriptor.h @@ -5,7 +5,7 @@ #include "webgpu/webgpu_cpp.h" -#include "RNFJSIConverter.h" +#include "JSIConverter.h" #include "WGPULogger.h" namespace jsi = facebook::jsi; @@ -26,9 +26,8 @@ struct GPUTextureViewDescriptor { } // namespace rnwgpu -namespace margelo { +namespace rnwgpu { -using namespace rnwgpu; // NOLINT(build/namespaces) template <> struct JSIConverter> { @@ -91,4 +90,4 @@ struct JSIConverter> { } }; -} // namespace margelo \ No newline at end of file +} // namespace rnwgpu \ No newline at end of file diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUUncapturedErrorEventInit.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUUncapturedErrorEventInit.h index 53d720bd8..c4c9e8c8f 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUUncapturedErrorEventInit.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUUncapturedErrorEventInit.h @@ -4,7 +4,7 @@ #include "webgpu/webgpu_cpp.h" -#include "RNFJSIConverter.h" +#include "JSIConverter.h" #include "WGPULogger.h" #include "GPUError.h" @@ -22,9 +22,8 @@ struct GPUUncapturedErrorEventInit { } // namespace rnwgpu -namespace margelo { +namespace rnwgpu { -using namespace rnwgpu; // NOLINT(build/namespaces) template <> struct JSIConverter> { @@ -64,4 +63,4 @@ struct JSIConverter> { } }; -} // namespace margelo \ No newline at end of file +} // namespace rnwgpu \ No newline at end of file diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUVertexAttribute.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUVertexAttribute.h index 3c651c1c1..d1ee1b0c7 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUVertexAttribute.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUVertexAttribute.h @@ -4,7 +4,7 @@ #include "webgpu/webgpu_cpp.h" -#include "RNFJSIConverter.h" +#include "JSIConverter.h" #include "WGPULogger.h" namespace jsi = facebook::jsi; @@ -19,9 +19,8 @@ struct GPUVertexAttribute { } // namespace rnwgpu -namespace margelo { +namespace rnwgpu { -using namespace rnwgpu; // NOLINT(build/namespaces) template <> struct JSIConverter> { static std::shared_ptr @@ -53,4 +52,4 @@ template <> struct JSIConverter> { } }; -} // namespace margelo \ No newline at end of file +} // namespace rnwgpu \ No newline at end of file diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUVertexBufferLayout.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUVertexBufferLayout.h index f77eca199..f40b176d2 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUVertexBufferLayout.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUVertexBufferLayout.h @@ -5,7 +5,7 @@ #include "webgpu/webgpu_cpp.h" -#include "RNFJSIConverter.h" +#include "JSIConverter.h" #include "WGPULogger.h" #include "GPUVertexAttribute.h" @@ -23,9 +23,8 @@ struct GPUVertexBufferLayout { } // namespace rnwgpu -namespace margelo { +namespace rnwgpu { -using namespace rnwgpu; // NOLINT(build/namespaces) template <> struct JSIConverter> { @@ -62,4 +61,4 @@ struct JSIConverter> { } }; -} // namespace margelo \ No newline at end of file +} // namespace rnwgpu \ No newline at end of file diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUVertexState.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUVertexState.h index 9a05ab0c4..138c197cf 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUVertexState.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUVertexState.h @@ -8,7 +8,7 @@ #include "webgpu/webgpu_cpp.h" -#include "RNFJSIConverter.h" +#include "JSIConverter.h" #include "WGPULogger.h" #include "GPUShaderModule.h" @@ -30,9 +30,8 @@ struct GPUVertexState { } // namespace rnwgpu -namespace margelo { +namespace rnwgpu { -using namespace rnwgpu; // NOLINT(build/namespaces) template <> struct JSIConverter> { static std::shared_ptr @@ -73,4 +72,4 @@ template <> struct JSIConverter> { } }; -} // namespace margelo \ No newline at end of file +} // namespace rnwgpu \ No newline at end of file diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/Unions.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/Unions.h index 6909fed1f..595fd7e4e 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/Unions.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/Unions.h @@ -3,10 +3,10 @@ #include #include "External.h" -#include "RNFEnumMapper.h" +#include "EnumMapper.h" #include "webgpu/webgpu_cpp.h" -namespace margelo { +namespace rnwgpu { namespace EnumMapper { inline void convertJSUnionToEnum(const std::string &inUnion, @@ -1981,4 +1981,4 @@ inline void convertEnumToJSUnion(rnwgpu::PremultiplyAlpha inEnum, } } // namespace EnumMapper -} // namespace margelo +} // namespace rnwgpu diff --git a/packages/webgpu/cpp/rnwgpu/async/AsyncTaskHandle.cpp b/packages/webgpu/cpp/rnwgpu/async/AsyncTaskHandle.cpp index 06df96af4..6b262005a 100644 --- a/packages/webgpu/cpp/rnwgpu/async/AsyncTaskHandle.cpp +++ b/packages/webgpu/cpp/rnwgpu/async/AsyncTaskHandle.cpp @@ -3,13 +3,13 @@ #include #include -#include "RNFPromise.h" +#include "Promise.h" #include "AsyncRunner.h" namespace rnwgpu::async { -using Action = std::function; +using Action = std::function; struct AsyncTaskHandle::State : public std::enable_shared_from_this { @@ -17,17 +17,17 @@ struct AsyncTaskHandle::State : runner(std::move(runner)), keepPumping(keepPumping) {} void settle(Action action); - void attachPromise(const std::shared_ptr &promise); + void attachPromise(const std::shared_ptr &promise); void schedule(Action action); ResolveFunction createResolveFunction(); RejectFunction createRejectFunction(); - std::shared_ptr currentPromise(); + std::shared_ptr currentPromise(); std::mutex mutex; std::weak_ptr runner; - std::shared_ptr promise; + std::shared_ptr promise; std::optional pendingAction; bool settled = false; std::shared_ptr keepAlive; @@ -59,7 +59,7 @@ void AsyncTaskHandle::State::settle(Action action) { } void AsyncTaskHandle::State::attachPromise( - const std::shared_ptr &newPromise) { + const std::shared_ptr &newPromise) { std::optional actionToSchedule; { std::lock_guard lock(mutex); @@ -114,7 +114,7 @@ AsyncTaskHandle::State::createResolveFunction() { }; self->settle( [factory = std::move(resolvedFactory)]( - jsi::Runtime &runtime, margelo::Promise &promise) mutable { + jsi::Runtime &runtime, rnwgpu::Promise &promise) mutable { auto value = factory(runtime); promise.resolve(std::move(value)); }); @@ -127,14 +127,14 @@ AsyncTaskHandle::RejectFunction AsyncTaskHandle::State::createRejectFunction() { return [weakSelf](std::string reason) { if (auto self = weakSelf.lock()) { self->settle([reason = std::move(reason)](jsi::Runtime & /*runtime*/, - margelo::Promise &promise) { + rnwgpu::Promise &promise) { promise.reject(reason); }); } }; } -std::shared_ptr AsyncTaskHandle::State::currentPromise() { +std::shared_ptr AsyncTaskHandle::State::currentPromise() { std::lock_guard lock(mutex); return promise; } @@ -172,7 +172,7 @@ AsyncTaskHandle::RejectFunction AsyncTaskHandle::createRejectFunction() const { } void AsyncTaskHandle::attachPromise( - const std::shared_ptr &promise) const { + const std::shared_ptr &promise) const { if (_state) { _state->attachPromise(promise); } diff --git a/packages/webgpu/cpp/rnwgpu/async/AsyncTaskHandle.h b/packages/webgpu/cpp/rnwgpu/async/AsyncTaskHandle.h index 745b90bbd..cb6c7a2a4 100644 --- a/packages/webgpu/cpp/rnwgpu/async/AsyncTaskHandle.h +++ b/packages/webgpu/cpp/rnwgpu/async/AsyncTaskHandle.h @@ -10,7 +10,7 @@ #include "AsyncDispatcher.h" -namespace margelo { +namespace rnwgpu { class Promise; } @@ -43,7 +43,7 @@ class AsyncTaskHandle { ResolveFunction createResolveFunction() const; RejectFunction createRejectFunction() const; - void attachPromise(const std::shared_ptr &promise) const; + void attachPromise(const std::shared_ptr &promise) const; static AsyncTaskHandle create(const std::shared_ptr &runner, bool keepPumping); diff --git a/packages/webgpu/scripts/codegen/Descriptors.ts b/packages/webgpu/scripts/codegen/Descriptors.ts index 1eb3850b4..181d37a21 100644 --- a/packages/webgpu/scripts/codegen/Descriptors.ts +++ b/packages/webgpu/scripts/codegen/Descriptors.ts @@ -269,7 +269,7 @@ ${Array.from(dependencies) #include "webgpu/webgpu_cpp.h" #include "WGPULogger.h" -#include "RNFJSIConverter.h" +#include "JSIConverter.h" ${Array.from(dependencies) .filter((dep) => dep[0] !== dep[0].toLowerCase()) @@ -289,17 +289,11 @@ struct ${name} { .join("\n ")} }; -} // namespace rnwgpu - -namespace margelo { - -using namespace rnwgpu; // NOLINT(build/namespaces) - template <> -struct JSIConverter> { - static std::shared_ptr +struct JSIConverter> { + static std::shared_ptr<${name}> fromJSI(jsi::Runtime &runtime, const jsi::Value &arg, bool outOfBounds) { - auto result = std::make_unique(); + auto result = std::make_unique<${name}>(); if (!outOfBounds && arg.isObject()) { auto value = arg.getObject(runtime); ${props.map((prop) => (prop.name === "layout" && (prop.type === "std::variant>" || prop.type === "std::optional>>") ? layoutProp : jsiProp(prop))).join("\n")} @@ -309,10 +303,10 @@ struct JSIConverter> { } static jsi::Value toJSI(jsi::Runtime &runtime, - std::shared_ptr arg) { + std::shared_ptr<${name}> arg) { throw std::runtime_error("Invalid ${name}::toJSI()"); } }; -} // namespace margelo`; +} // namespace rnwgpu`; }; diff --git a/packages/webgpu/scripts/codegen/templates/Unions.ts b/packages/webgpu/scripts/codegen/templates/Unions.ts index a1d3e762b..41eec1381 100644 --- a/packages/webgpu/scripts/codegen/templates/Unions.ts +++ b/packages/webgpu/scripts/codegen/templates/Unions.ts @@ -14,9 +14,9 @@ export const Unions = (unions: Union[]) => { #include "webgpu/webgpu_cpp.h" #include "External.h" -#include "RNFEnumMapper.h" +#include "EnumMapper.h" -namespace margelo { +namespace rnwgpu { namespace EnumMapper { ${unions @@ -28,7 +28,7 @@ ${unions .map((union) => Union(union)) .join("\n")} } // namespace EnumMapper -} // namespace margelo +} // namespace rnwgpu `; }; From 96bcb6b8bfd7afd80ad5d02b72abc4393668419e Mon Sep 17 00:00:00 2001 From: William Candillon Date: Mon, 12 Jan 2026 17:13:07 +0100 Subject: [PATCH 09/23] :wrench: --- apps/example/src/Triangle/HelloTriangle.tsx | 2 -- 1 file changed, 2 deletions(-) diff --git a/apps/example/src/Triangle/HelloTriangle.tsx b/apps/example/src/Triangle/HelloTriangle.tsx index 19824c526..3e28d6c12 100644 --- a/apps/example/src/Triangle/HelloTriangle.tsx +++ b/apps/example/src/Triangle/HelloTriangle.tsx @@ -13,8 +13,6 @@ export function HelloTriangle() { if (!adapter) { throw new Error("No adapter"); } - console.log(adapter); - console.log(adapter instanceof GPUAdapter); const device = await adapter.requestDevice(); const presentationFormat = navigator.gpu.getPreferredCanvasFormat(); From 8c26f53586a6ef1208459f768d975f8671291f3a Mon Sep 17 00:00:00 2001 From: William Candillon Date: Mon, 12 Jan 2026 17:46:22 +0100 Subject: [PATCH 10/23] :wrench: --- apps/example/ios/Podfile.lock | 20 +- packages/webgpu/cpp/jsi/NativeObject.h | 36 + .../webgpu/cpp/rnwgpu/RNWebGPUManager.cpp | 89 +- .../rnwgpu/api/descriptors/GPUBufferUsage.h | 59 +- .../rnwgpu/api/descriptors/GPUColorWrite.h | 36 +- .../cpp/rnwgpu/api/descriptors/GPUMapMode.h | 24 +- .../rnwgpu/api/descriptors/GPUShaderStage.h | 28 +- .../rnwgpu/api/descriptors/GPUTextureUsage.h | 45 +- packages/webgpu/package.json | 1 + packages/webgpu/src/main/index.tsx | 170 -- yarn.lock | 1764 +++++++++-------- 11 files changed, 1106 insertions(+), 1166 deletions(-) diff --git a/apps/example/ios/Podfile.lock b/apps/example/ios/Podfile.lock index f75a99dd0..fa950bfe6 100644 --- a/apps/example/ios/Podfile.lock +++ b/apps/example/ios/Podfile.lock @@ -1748,7 +1748,7 @@ PODS: - React-RCTFBReactNativeSpec - ReactCommon/turbomodule/core - SocketRocket - - react-native-safe-area-context (5.6.1): + - react-native-safe-area-context (5.6.2): - boost - DoubleConversion - fast_float @@ -1766,8 +1766,8 @@ PODS: - React-graphics - React-ImageManager - React-jsi - - react-native-safe-area-context/common (= 5.6.1) - - react-native-safe-area-context/fabric (= 5.6.1) + - react-native-safe-area-context/common (= 5.6.2) + - react-native-safe-area-context/fabric (= 5.6.2) - React-NativeModulesApple - React-RCTFabric - React-renderercss @@ -1778,7 +1778,7 @@ PODS: - ReactCommon/turbomodule/core - SocketRocket - Yoga - - react-native-safe-area-context/common (5.6.1): + - react-native-safe-area-context/common (5.6.2): - boost - DoubleConversion - fast_float @@ -1806,7 +1806,7 @@ PODS: - ReactCommon/turbomodule/core - SocketRocket - Yoga - - react-native-safe-area-context/fabric (5.6.1): + - react-native-safe-area-context/fabric (5.6.2): - boost - DoubleConversion - fast_float @@ -2398,7 +2398,7 @@ PODS: - React-perflogger (= 0.81.4) - React-utils (= 0.81.4) - SocketRocket - - ReactNativeHost (0.5.13): + - ReactNativeHost (0.5.15): - boost - DoubleConversion - fast_float @@ -2432,7 +2432,7 @@ PODS: - React-Core - React-jsi - ReactTestApp-Resources (1.0.0-dev) - - RNGestureHandler (2.28.0): + - RNGestureHandler (2.30.0): - boost - DoubleConversion - fast_float @@ -2901,7 +2901,7 @@ SPEC CHECKSUMS: React-logger: a3cb5b29c32b8e447b5a96919340e89334062b48 React-Mapbuffer: 9d2434a42701d6144ca18f0ca1c4507808ca7696 React-microtasksnativemodule: 75b6604b667d297292345302cc5bfb6b6aeccc1b - react-native-safe-area-context: c6e2edd1c1da07bdce287fa9d9e60c5f7b514616 + react-native-safe-area-context: c00143b4823773bba23f2f19f85663ae89ceb460 react-native-skia: 5bf2b2107cd7f2d806fd364f5e16b1c7554ed3cd react-native-wgpu: e54fcee5946cc2cee4814f63f425be358f097b14 React-NativeModulesApple: 879fbdc5dcff7136abceb7880fe8a2022a1bd7c3 @@ -2934,10 +2934,10 @@ SPEC CHECKSUMS: ReactAppDependencyProvider: 433ddfb4536948630aadd5bd925aff8a632d2fe3 ReactCodegen: 64dbbed4e9e0264d799578ea78492479a66fba4a ReactCommon: 394c6b92765cf6d211c2c3f7f6bc601dffb316a6 - ReactNativeHost: 40e374201201cc54f9ef41458f2e412fbdde0d62 + ReactNativeHost: f5e054387e917216a2a021a3f7fdc4f9f158e7e4 ReactTestApp-DevSupport: 9b7bbba5e8fed998e763809171d9906a1375f9d3 ReactTestApp-Resources: 1bd9ff10e4c24f2ad87101a32023721ae923bccf - RNGestureHandler: 3a73f098d74712952870e948b3d9cf7b6cae9961 + RNGestureHandler: e37bdb684df1ac17c7e1d8f71a3311b2793c186b RNReanimated: 4e53390354d1eed1398ab51ace22b869be6ce611 SocketRocket: d4aabe649be1e368d1318fdf28a022d714d65748 Yoga: a3ed390a19db0459bd6839823a6ac6d9c6db198d diff --git a/packages/webgpu/cpp/jsi/NativeObject.h b/packages/webgpu/cpp/jsi/NativeObject.h index 81938f72c..1496d32ac 100644 --- a/packages/webgpu/cpp/jsi/NativeObject.h +++ b/packages/webgpu/cpp/jsi/NativeObject.h @@ -144,6 +144,42 @@ class NativeObject : public jsi::NativeState, entry.prototype = std::move(prototype); } + /** + * Install a constructor function on the global object. + * This enables `instanceof` checks: `obj instanceof ClassName` + * + * The constructor throws if called directly (these objects are only + * created internally by the native code). + */ + static void installConstructor(jsi::Runtime &runtime) { + installPrototype(runtime); + + auto &entry = getPrototypeCache().get(runtime); + if (!entry.prototype.has_value()) { + return; + } + + // Create a constructor function that throws when called directly + auto ctor = jsi::Function::createFromHostFunction( + runtime, jsi::PropNameID::forUtf8(runtime, Derived::CLASS_NAME), 0, + [](jsi::Runtime &rt, const jsi::Value & /*thisVal*/, + const jsi::Value * /*args*/, size_t /*count*/) -> jsi::Value { + throw jsi::JSError( + rt, std::string("Illegal constructor: ") + Derived::CLASS_NAME + + " objects are created by the WebGPU API"); + }); + + // Set the prototype property on the constructor + // This is what makes `instanceof` work + ctor.setProperty(runtime, "prototype", *entry.prototype); + + // Set constructor property on prototype pointing back to constructor + entry.prototype->setProperty(runtime, "constructor", ctor); + + // Install on global + runtime.global().setProperty(runtime, Derived::CLASS_NAME, std::move(ctor)); + } + /** * Create a JS object with native state attached. */ diff --git a/packages/webgpu/cpp/rnwgpu/RNWebGPUManager.cpp b/packages/webgpu/cpp/rnwgpu/RNWebGPUManager.cpp index 7eab32315..32117d03b 100644 --- a/packages/webgpu/cpp/rnwgpu/RNWebGPUManager.cpp +++ b/packages/webgpu/cpp/rnwgpu/RNWebGPUManager.cpp @@ -3,6 +3,35 @@ #include "GPU.h" #include "RNWebGPU.h" +// GPU API classes (for instanceof support) +#include "GPUAdapter.h" +#include "GPUAdapterInfo.h" +#include "GPUBindGroup.h" +#include "GPUBindGroupLayout.h" +#include "GPUBuffer.h" +#include "GPUCanvasContext.h" +#include "GPUCommandBuffer.h" +#include "GPUCommandEncoder.h" +#include "GPUCompilationInfo.h" +#include "GPUCompilationMessage.h" +#include "GPUComputePassEncoder.h" +#include "GPUComputePipeline.h" +#include "GPUDevice.h" +#include "GPUDeviceLostInfo.h" +#include "GPUExternalTexture.h" +#include "GPUPipelineLayout.h" +#include "GPUQuerySet.h" +#include "GPUQueue.h" +#include "GPURenderBundle.h" +#include "GPURenderBundleEncoder.h" +#include "GPURenderPassEncoder.h" +#include "GPURenderPipeline.h" +#include "GPUSampler.h" +#include "GPUShaderModule.h" +#include "GPUSupportedLimits.h" +#include "GPUTexture.h" +#include "GPUTextureView.h" + // Enums #include "GPUBufferUsage.h" #include "GPUColorWrite.h" @@ -28,29 +57,47 @@ RNWebGPUManager::RNWebGPUManager( _jsRuntime->global().setProperty(*_jsRuntime, "RNWebGPU", RNWebGPU::create(*_jsRuntime, rnWebGPU)); - auto bufferUsage = std::make_shared(); - _jsRuntime->global().setProperty( - *_jsRuntime, "GPUBufferUsage", - GPUBufferUsage::create(*_jsRuntime, std::move(bufferUsage))); - - auto colorWrite = std::make_shared(); - _jsRuntime->global().setProperty( - *_jsRuntime, "GPUColorWrite", - GPUColorWrite::create(*_jsRuntime, std::move(colorWrite))); + // Install constructors for instanceof support + GPU::installConstructor(*_jsRuntime); + GPUAdapter::installConstructor(*_jsRuntime); + GPUAdapterInfo::installConstructor(*_jsRuntime); + GPUBindGroup::installConstructor(*_jsRuntime); + GPUBindGroupLayout::installConstructor(*_jsRuntime); + GPUBuffer::installConstructor(*_jsRuntime); + GPUCanvasContext::installConstructor(*_jsRuntime); + GPUCommandBuffer::installConstructor(*_jsRuntime); + GPUCommandEncoder::installConstructor(*_jsRuntime); + GPUCompilationInfo::installConstructor(*_jsRuntime); + GPUCompilationMessage::installConstructor(*_jsRuntime); + GPUComputePassEncoder::installConstructor(*_jsRuntime); + GPUComputePipeline::installConstructor(*_jsRuntime); + GPUDevice::installConstructor(*_jsRuntime); + GPUDeviceLostInfo::installConstructor(*_jsRuntime); + GPUExternalTexture::installConstructor(*_jsRuntime); + GPUPipelineLayout::installConstructor(*_jsRuntime); + GPUQuerySet::installConstructor(*_jsRuntime); + GPUQueue::installConstructor(*_jsRuntime); + GPURenderBundle::installConstructor(*_jsRuntime); + GPURenderBundleEncoder::installConstructor(*_jsRuntime); + GPURenderPassEncoder::installConstructor(*_jsRuntime); + GPURenderPipeline::installConstructor(*_jsRuntime); + GPUSampler::installConstructor(*_jsRuntime); + GPUShaderModule::installConstructor(*_jsRuntime); + GPUSupportedLimits::installConstructor(*_jsRuntime); + GPUTexture::installConstructor(*_jsRuntime); + GPUTextureView::installConstructor(*_jsRuntime); - auto mapMode = std::make_shared(); + // Install constant objects as plain JS objects with own properties + _jsRuntime->global().setProperty(*_jsRuntime, "GPUBufferUsage", + GPUBufferUsage::create(*_jsRuntime)); + _jsRuntime->global().setProperty(*_jsRuntime, "GPUColorWrite", + GPUColorWrite::create(*_jsRuntime)); _jsRuntime->global().setProperty(*_jsRuntime, "GPUMapMode", - GPUMapMode::create(*_jsRuntime, mapMode)); - - auto shaderStage = std::make_shared(); - _jsRuntime->global().setProperty( - *_jsRuntime, "GPUShaderStage", - GPUShaderStage::create(*_jsRuntime, std::move(shaderStage))); - - auto textureUsage = std::make_shared(); - _jsRuntime->global().setProperty( - *_jsRuntime, "GPUTextureUsage", - GPUTextureUsage::create(*_jsRuntime, std::move(textureUsage))); + GPUMapMode::create(*_jsRuntime)); + _jsRuntime->global().setProperty(*_jsRuntime, "GPUShaderStage", + GPUShaderStage::create(*_jsRuntime)); + _jsRuntime->global().setProperty(*_jsRuntime, "GPUTextureUsage", + GPUTextureUsage::create(*_jsRuntime)); } RNWebGPUManager::~RNWebGPUManager() { diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBufferUsage.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBufferUsage.h index 2c9f0286b..24f18e5da 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBufferUsage.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBufferUsage.h @@ -1,7 +1,6 @@ #pragma once -#include -#include +#include #include "webgpu/webgpu_cpp.h" @@ -9,38 +8,32 @@ namespace rnwgpu { namespace jsi = facebook::jsi; -class GPUBufferUsage : public NativeObject { +class GPUBufferUsage { public: - static constexpr const char *CLASS_NAME = "GPUBufferUsage"; - - GPUBufferUsage() : NativeObject(CLASS_NAME) {} - -public: - double MapRead() { return static_cast(wgpu::BufferUsage::MapRead); } - double MapWrite() { return static_cast(wgpu::BufferUsage::MapWrite); } - double CopySrc() { return static_cast(wgpu::BufferUsage::CopySrc); } - double CopyDst() { return static_cast(wgpu::BufferUsage::CopyDst); } - double Index() { return static_cast(wgpu::BufferUsage::Index); } - double Vertex() { return static_cast(wgpu::BufferUsage::Vertex); } - double Uniform() { return static_cast(wgpu::BufferUsage::Uniform); } - double Storage() { return static_cast(wgpu::BufferUsage::Storage); } - double Indirect() { return static_cast(wgpu::BufferUsage::Indirect); } - double QueryResolve() { - return static_cast(wgpu::BufferUsage::QueryResolve); - } - - static void definePrototype(jsi::Runtime &runtime, jsi::Object &prototype) { - installGetter(runtime, prototype, "MAP_READ", &GPUBufferUsage::MapRead); - installGetter(runtime, prototype, "MAP_WRITE", &GPUBufferUsage::MapWrite); - installGetter(runtime, prototype, "COPY_SRC", &GPUBufferUsage::CopySrc); - installGetter(runtime, prototype, "COPY_DST", &GPUBufferUsage::CopyDst); - installGetter(runtime, prototype, "INDEX", &GPUBufferUsage::Index); - installGetter(runtime, prototype, "VERTEX", &GPUBufferUsage::Vertex); - installGetter(runtime, prototype, "UNIFORM", &GPUBufferUsage::Uniform); - installGetter(runtime, prototype, "STORAGE", &GPUBufferUsage::Storage); - installGetter(runtime, prototype, "INDIRECT", &GPUBufferUsage::Indirect); - installGetter(runtime, prototype, "QUERY_RESOLVE", - &GPUBufferUsage::QueryResolve); + static jsi::Object create(jsi::Runtime &runtime) { + jsi::Object obj(runtime); + obj.setProperty(runtime, "MAP_READ", + static_cast(wgpu::BufferUsage::MapRead)); + obj.setProperty(runtime, "MAP_WRITE", + static_cast(wgpu::BufferUsage::MapWrite)); + obj.setProperty(runtime, "COPY_SRC", + static_cast(wgpu::BufferUsage::CopySrc)); + obj.setProperty(runtime, "COPY_DST", + static_cast(wgpu::BufferUsage::CopyDst)); + obj.setProperty(runtime, "INDEX", + static_cast(wgpu::BufferUsage::Index)); + obj.setProperty(runtime, "VERTEX", + static_cast(wgpu::BufferUsage::Vertex)); + obj.setProperty(runtime, "UNIFORM", + static_cast(wgpu::BufferUsage::Uniform)); + obj.setProperty(runtime, "STORAGE", + static_cast(wgpu::BufferUsage::Storage)); + obj.setProperty(runtime, "INDIRECT", + static_cast(wgpu::BufferUsage::Indirect)); + obj.setProperty(runtime, "QUERY_RESOLVE", + static_cast(wgpu::BufferUsage::QueryResolve)); + return obj; } }; + } // namespace rnwgpu diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUColorWrite.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUColorWrite.h index 31deb5145..6804fb40f 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUColorWrite.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUColorWrite.h @@ -1,7 +1,6 @@ #pragma once -#include -#include +#include #include "webgpu/webgpu_cpp.h" @@ -9,25 +8,22 @@ namespace rnwgpu { namespace jsi = facebook::jsi; -class GPUColorWrite : public NativeObject { +class GPUColorWrite { public: - static constexpr const char *CLASS_NAME = "GPUColorWrite"; - - GPUColorWrite() : NativeObject(CLASS_NAME) {} - -public: - double Red() { return static_cast(wgpu::ColorWriteMask::Red); } - double Green() { return static_cast(wgpu::ColorWriteMask::Green); } - double Blue() { return static_cast(wgpu::ColorWriteMask::Blue); } - double Alpha() { return static_cast(wgpu::ColorWriteMask::Alpha); } - double All() { return static_cast(wgpu::ColorWriteMask::All); } - - static void definePrototype(jsi::Runtime &runtime, jsi::Object &prototype) { - installGetter(runtime, prototype, "RED", &GPUColorWrite::Red); - installGetter(runtime, prototype, "GREEN", &GPUColorWrite::Green); - installGetter(runtime, prototype, "BLUE", &GPUColorWrite::Blue); - installGetter(runtime, prototype, "ALPHA", &GPUColorWrite::Alpha); - installGetter(runtime, prototype, "ALL", &GPUColorWrite::All); + static jsi::Object create(jsi::Runtime &runtime) { + jsi::Object obj(runtime); + obj.setProperty(runtime, "RED", + static_cast(wgpu::ColorWriteMask::Red)); + obj.setProperty(runtime, "GREEN", + static_cast(wgpu::ColorWriteMask::Green)); + obj.setProperty(runtime, "BLUE", + static_cast(wgpu::ColorWriteMask::Blue)); + obj.setProperty(runtime, "ALPHA", + static_cast(wgpu::ColorWriteMask::Alpha)); + obj.setProperty(runtime, "ALL", + static_cast(wgpu::ColorWriteMask::All)); + return obj; } }; + } // namespace rnwgpu diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUMapMode.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUMapMode.h index 9a0b3f131..68b78c113 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUMapMode.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUMapMode.h @@ -1,7 +1,6 @@ #pragma once -#include -#include +#include #include "webgpu/webgpu_cpp.h" @@ -9,19 +8,16 @@ namespace rnwgpu { namespace jsi = facebook::jsi; -class GPUMapMode : public NativeObject { +class GPUMapMode { public: - static constexpr const char *CLASS_NAME = "GPUMapMode"; - - GPUMapMode() : NativeObject(CLASS_NAME) {} - -public: - double Read() { return static_cast(wgpu::MapMode::Read); } - double Write() { return static_cast(wgpu::MapMode::Write); } - - static void definePrototype(jsi::Runtime &runtime, jsi::Object &prototype) { - installGetter(runtime, prototype, "READ", &GPUMapMode::Read); - installGetter(runtime, prototype, "WRITE", &GPUMapMode::Write); + static jsi::Object create(jsi::Runtime &runtime) { + jsi::Object obj(runtime); + obj.setProperty(runtime, "READ", + static_cast(wgpu::MapMode::Read)); + obj.setProperty(runtime, "WRITE", + static_cast(wgpu::MapMode::Write)); + return obj; } }; + } // namespace rnwgpu diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUShaderStage.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUShaderStage.h index 9f6b13df2..c9b69645c 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUShaderStage.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUShaderStage.h @@ -1,7 +1,6 @@ #pragma once -#include -#include +#include #include "webgpu/webgpu_cpp.h" @@ -9,21 +8,18 @@ namespace rnwgpu { namespace jsi = facebook::jsi; -class GPUShaderStage : public NativeObject { +class GPUShaderStage { public: - static constexpr const char *CLASS_NAME = "GPUShaderStage"; - - GPUShaderStage() : NativeObject(CLASS_NAME) {} - -public: - double Vertex() { return static_cast(wgpu::ShaderStage::Vertex); } - double Fragment() { return static_cast(wgpu::ShaderStage::Fragment); } - double Compute() { return static_cast(wgpu::ShaderStage::Compute); } - - static void definePrototype(jsi::Runtime &runtime, jsi::Object &prototype) { - installGetter(runtime, prototype, "VERTEX", &GPUShaderStage::Vertex); - installGetter(runtime, prototype, "FRAGMENT", &GPUShaderStage::Fragment); - installGetter(runtime, prototype, "COMPUTE", &GPUShaderStage::Compute); + static jsi::Object create(jsi::Runtime &runtime) { + jsi::Object obj(runtime); + obj.setProperty(runtime, "VERTEX", + static_cast(wgpu::ShaderStage::Vertex)); + obj.setProperty(runtime, "FRAGMENT", + static_cast(wgpu::ShaderStage::Fragment)); + obj.setProperty(runtime, "COMPUTE", + static_cast(wgpu::ShaderStage::Compute)); + return obj; } }; + } // namespace rnwgpu diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUTextureUsage.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUTextureUsage.h index 0e32de154..f4c654259 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUTextureUsage.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUTextureUsage.h @@ -1,7 +1,6 @@ #pragma once -#include -#include +#include #include "webgpu/webgpu_cpp.h" @@ -9,34 +8,22 @@ namespace rnwgpu { namespace jsi = facebook::jsi; -class GPUTextureUsage : public NativeObject { +class GPUTextureUsage { public: - static constexpr const char *CLASS_NAME = "GPUTextureUsage"; - - GPUTextureUsage() : NativeObject(CLASS_NAME) {} - -public: - double CopySrc() { return static_cast(wgpu::TextureUsage::CopySrc); } - double CopyDst() { return static_cast(wgpu::TextureUsage::CopyDst); } - double TextureBinding() { - return static_cast(wgpu::TextureUsage::TextureBinding); - } - double StorageBinding() { - return static_cast(wgpu::TextureUsage::StorageBinding); - } - double RenderAttachment() { - return static_cast(wgpu::TextureUsage::RenderAttachment); - } - - static void definePrototype(jsi::Runtime &runtime, jsi::Object &prototype) { - installGetter(runtime, prototype, "COPY_SRC", &GPUTextureUsage::CopySrc); - installGetter(runtime, prototype, "COPY_DST", &GPUTextureUsage::CopyDst); - installGetter(runtime, prototype, "TEXTURE_BINDING", - &GPUTextureUsage::TextureBinding); - installGetter(runtime, prototype, "STORAGE_BINDING", - &GPUTextureUsage::StorageBinding); - installGetter(runtime, prototype, "RENDER_ATTACHMENT", - &GPUTextureUsage::RenderAttachment); + static jsi::Object create(jsi::Runtime &runtime) { + jsi::Object obj(runtime); + obj.setProperty(runtime, "COPY_SRC", + static_cast(wgpu::TextureUsage::CopySrc)); + obj.setProperty(runtime, "COPY_DST", + static_cast(wgpu::TextureUsage::CopyDst)); + obj.setProperty(runtime, "TEXTURE_BINDING", + static_cast(wgpu::TextureUsage::TextureBinding)); + obj.setProperty(runtime, "STORAGE_BINDING", + static_cast(wgpu::TextureUsage::StorageBinding)); + obj.setProperty(runtime, "RENDER_ATTACHMENT", + static_cast(wgpu::TextureUsage::RenderAttachment)); + return obj; } }; + } // namespace rnwgpu diff --git a/packages/webgpu/package.json b/packages/webgpu/package.json index 43c7b4b85..0778d1695 100644 --- a/packages/webgpu/package.json +++ b/packages/webgpu/package.json @@ -65,6 +65,7 @@ "@types/seedrandom": "^3.0.8", "@types/ws": "^8.5.10", "@webgpu/types": "0.1.65", + "baseline-browser-mapping": "^2.9.14", "clang-format": "^1.8.0", "del-cli": "^5.1.0", "eslint": "9.35.0", diff --git a/packages/webgpu/src/main/index.tsx b/packages/webgpu/src/main/index.tsx index 3bcbe6c22..bfd47577a 100644 --- a/packages/webgpu/src/main/index.tsx +++ b/packages/webgpu/src/main/index.tsx @@ -1,4 +1,3 @@ -/* eslint-disable @typescript-eslint/no-explicit-any */ import WebGPUModule from "../NativeWebGPUModule"; export * from "../Canvas"; @@ -8,175 +7,6 @@ export * from "../hooks"; export { default as WebGPUModule } from "../NativeWebGPUModule"; -const GPU: any = {}; -GPU[Symbol.hasInstance] = function (instance: object) { - return "__brand" in instance && instance.__brand === "GPU"; -}; - -const GPUAdapter: any = {}; -GPUAdapter[Symbol.hasInstance] = function (instance: object) { - return "__brand" in instance && instance.__brand === "GPUAdapter"; -}; - -const GPUAdapterInfo: any = {}; -GPUAdapterInfo[Symbol.hasInstance] = function (instance: object) { - return "__brand" in instance && instance.__brand === "GPUAdapterInfo"; -}; - -const GPUBindGroup: any = {}; -GPUBindGroup[Symbol.hasInstance] = function (instance: object) { - return "__brand" in instance && instance.__brand === "GPUBindGroup"; -}; - -const GPUBindGroupLayout: any = {}; -GPUBindGroupLayout[Symbol.hasInstance] = function (instance: object) { - return "__brand" in instance && instance.__brand === "GPUBindGroupLayout"; -}; - -const GPUBuffer: any = {}; -GPUBuffer[Symbol.hasInstance] = function (instance: object) { - return "__brand" in instance && instance.__brand === "GPUBuffer"; -}; - -const GPUCanvasContext: any = {}; -GPUCanvasContext[Symbol.hasInstance] = function (instance: object) { - return "__brand" in instance && instance.__brand === "GPUCanvasContext"; -}; - -const GPUCommandBuffer: any = {}; -GPUCommandBuffer[Symbol.hasInstance] = function (instance: object) { - return "__brand" in instance && instance.__brand === "GPUCommandBuffer"; -}; - -const GPUCommandEncoder: any = {}; -GPUCommandEncoder[Symbol.hasInstance] = function (instance: object) { - return "__brand" in instance && instance.__brand === "GPUCommandEncoder"; -}; - -const GPUCompilationInfo: any = {}; -GPUCompilationInfo[Symbol.hasInstance] = function (instance: object) { - return "__brand" in instance && instance.__brand === "GPUCompilationInfo"; -}; - -const GPUCompilationMessage: any = {}; -GPUCompilationMessage[Symbol.hasInstance] = function (instance: object) { - return "__brand" in instance && instance.__brand === "GPUCompilationMessage"; -}; - -const GPUComputePassEncoder: any = {}; -GPUComputePassEncoder[Symbol.hasInstance] = function (instance: object) { - return "__brand" in instance && instance.__brand === "GPUComputePassEncoder"; -}; - -const GPUComputePipeline: any = {}; -GPUComputePipeline[Symbol.hasInstance] = function (instance: object) { - return "__brand" in instance && instance.__brand === "GPUComputePipeline"; -}; - -const GPUDevice: any = {}; -GPUDevice[Symbol.hasInstance] = function (instance: object) { - return "__brand" in instance && instance.__brand === "GPUDevice"; -}; - -const GPUDeviceLostInfo: any = {}; -GPUDeviceLostInfo[Symbol.hasInstance] = function (instance: object) { - return "__brand" in instance && instance.__brand === "GPUDeviceLostInfo"; -}; - -const GPUError: any = {}; -GPUError[Symbol.hasInstance] = function (instance: object) { - return "__brand" in instance && instance.__brand === "GPUError"; -}; - -const GPUExternalTexture: any = {}; -GPUExternalTexture[Symbol.hasInstance] = function (instance: object) { - return "__brand" in instance && instance.__brand === "GPUExternalTexture"; -}; - -const GPUPipelineLayout: any = {}; -GPUPipelineLayout[Symbol.hasInstance] = function (instance: object) { - return "__brand" in instance && instance.__brand === "GPUPipelineLayout"; -}; - -const GPUQuerySet: any = {}; -GPUQuerySet[Symbol.hasInstance] = function (instance: object) { - return "__brand" in instance && instance.__brand === "GPUQuerySet"; -}; - -const GPUQueue: any = {}; -GPUQueue[Symbol.hasInstance] = function (instance: object) { - return "__brand" in instance && instance.__brand === "GPUQueue"; -}; - -const GPURenderBundle: any = {}; -GPURenderBundle[Symbol.hasInstance] = function (instance: object) { - return "__brand" in instance && instance.__brand === "GPURenderBundle"; -}; - -const GPURenderBundleEncoder: any = {}; -GPURenderBundleEncoder[Symbol.hasInstance] = function (instance: object) { - return "__brand" in instance && instance.__brand === "GPURenderBundleEncoder"; -}; - -const GPURenderPassEncoder: any = {}; -GPURenderPassEncoder[Symbol.hasInstance] = function (instance: object) { - return "__brand" in instance && instance.__brand === "GPURenderPassEncoder"; -}; - -const GPURenderPipeline: any = {}; -GPURenderPipeline[Symbol.hasInstance] = function (instance: object) { - return "__brand" in instance && instance.__brand === "GPURenderPipeline"; -}; - -const GPUSampler: any = {}; -GPUSampler[Symbol.hasInstance] = function (instance: object) { - return "__brand" in instance && instance.__brand === "GPUSampler"; -}; - -const GPUShaderModule: any = {}; -GPUShaderModule[Symbol.hasInstance] = function (instance: object) { - return "__brand" in instance && instance.__brand === "GPUShaderModule"; -}; - -const GPUTexture: any = {}; -GPUTexture[Symbol.hasInstance] = function (instance: object) { - return "__brand" in instance && instance.__brand === "GPUTexture"; -}; - -const GPUTextureView: any = {}; -GPUTextureView[Symbol.hasInstance] = function (instance: object) { - return "__brand" in instance && instance.__brand === "GPUTextureView"; -}; - -global.GPU = GPU; -global.GPUAdapter = GPUAdapter; -global.GPUAdapterInfo = GPUAdapterInfo; -global.GPUBindGroup = GPUBindGroup; -global.GPUBindGroupLayout = GPUBindGroupLayout; -global.GPUBuffer = GPUBuffer; -global.GPUCanvasContext = GPUCanvasContext; -global.GPUCommandBuffer = GPUCommandBuffer; -global.GPUCommandEncoder = GPUCommandEncoder; -global.GPUCompilationInfo = GPUCompilationInfo; -global.GPUCompilationMessage = GPUCompilationMessage; -global.GPUComputePassEncoder = GPUComputePassEncoder; -global.GPUComputePipeline = GPUComputePipeline; -global.GPUDevice = GPUDevice; -global.GPUDeviceLostInfo = GPUDeviceLostInfo; -global.GPUError = GPUError; -global.GPUExternalTexture = GPUExternalTexture; -global.GPUPipelineLayout = GPUPipelineLayout; -global.GPUQuerySet = GPUQuerySet; -global.GPUQueue = GPUQueue; -global.GPURenderBundle = GPURenderBundle; -global.GPURenderBundleEncoder = GPURenderBundleEncoder; -global.GPURenderPassEncoder = GPURenderPassEncoder; -global.GPURenderPipeline = GPURenderPipeline; -global.GPUSampler = GPUSampler; -global.GPUShaderModule = GPUShaderModule; -global.GPUTexture = GPUTexture; -global.GPUTextureView = GPUTextureView; - WebGPUModule.install(); if (!navigator) { diff --git a/yarn.lock b/yarn.lock index 766610bc0..467b298c7 100644 --- a/yarn.lock +++ b/yarn.lock @@ -16,39 +16,39 @@ __metadata: languageName: node linkType: hard -"@babel/compat-data@npm:^7.20.5, @babel/compat-data@npm:^7.27.2, @babel/compat-data@npm:^7.27.7, @babel/compat-data@npm:^7.28.0": - version: 7.28.4 - resolution: "@babel/compat-data@npm:7.28.4" - checksum: 9f6f5289bbe5a29e3f9c737577a797205a91f19371b50af8942257d9cb590d44eb950154e4f2a3d5de4105f97a49d6fbc8daebe0db1e6eee04f5a4bf73536bfc +"@babel/compat-data@npm:^7.20.5, @babel/compat-data@npm:^7.27.2, @babel/compat-data@npm:^7.27.7, @babel/compat-data@npm:^7.28.5": + version: 7.28.5 + resolution: "@babel/compat-data@npm:7.28.5" + checksum: d7bcb3ee713752dc27b89800bfb39f9ac5f3edc46b4f5bb9906e1fe6b6110c7b245dd502602ea66f93790480c228605e9a601f27c07016f24b56772e97bedbdf languageName: node linkType: hard "@babel/core@npm:^7.11.6, @babel/core@npm:^7.12.3, @babel/core@npm:^7.13.16, @babel/core@npm:^7.14.0, @babel/core@npm:^7.18.5, @babel/core@npm:^7.20.0, @babel/core@npm:^7.23.9, @babel/core@npm:^7.25.0, @babel/core@npm:^7.25.2": - version: 7.28.4 - resolution: "@babel/core@npm:7.28.4" + version: 7.28.5 + resolution: "@babel/core@npm:7.28.5" dependencies: "@babel/code-frame": ^7.27.1 - "@babel/generator": ^7.28.3 + "@babel/generator": ^7.28.5 "@babel/helper-compilation-targets": ^7.27.2 "@babel/helper-module-transforms": ^7.28.3 "@babel/helpers": ^7.28.4 - "@babel/parser": ^7.28.4 + "@babel/parser": ^7.28.5 "@babel/template": ^7.27.2 - "@babel/traverse": ^7.28.4 - "@babel/types": ^7.28.4 + "@babel/traverse": ^7.28.5 + "@babel/types": ^7.28.5 "@jridgewell/remapping": ^2.3.5 convert-source-map: ^2.0.0 debug: ^4.1.0 gensync: ^1.0.0-beta.2 json5: ^2.2.3 semver: ^6.3.1 - checksum: f55b90b2c61a6461f5c0ccab74d32af9c67448c43c629529ba7ec3c61d87fa8c408cc9305bfb1f5b09e671d25436d44eaf75c48dee5dc0a5c5e21c01290f5134 + checksum: 1ee35b20448f73e9d531091ad4f9e8198dc8f0cebb783263fbff1807342209882ddcaf419be04111326b6f0e494222f7055d71da316c437a6a784d230c11ab9f languageName: node linkType: hard "@babel/eslint-parser@npm:^7.18.2, @babel/eslint-parser@npm:^7.25.1": - version: 7.28.4 - resolution: "@babel/eslint-parser@npm:7.28.4" + version: 7.28.5 + resolution: "@babel/eslint-parser@npm:7.28.5" dependencies: "@nicolo-ribaudo/eslint-scope-5-internals": 5.1.1-v1 eslint-visitor-keys: ^2.1.0 @@ -56,20 +56,20 @@ __metadata: peerDependencies: "@babel/core": ^7.11.0 eslint: ^7.5.0 || ^8.0.0 || ^9.0.0 - checksum: 32fb41c8648e169bc8570e25b4657475e165e1a49b8c6610f9bf86f311bbcc8dfa73f004977015688763aa6af17f48c690720bbc7b7b99695557adb267a9a7ff + checksum: 8daaf6f24d3f78c18bc4cf2bf1bedda3d829f330f385b85acf630adde3de7a703abf0d2615afea09244caa713dded01aa3c00f3637ea70568b2e8c547067fb99 languageName: node linkType: hard -"@babel/generator@npm:^7.20.0, @babel/generator@npm:^7.25.0, @babel/generator@npm:^7.28.3, @babel/generator@npm:^7.7.2": - version: 7.28.3 - resolution: "@babel/generator@npm:7.28.3" +"@babel/generator@npm:^7.20.0, @babel/generator@npm:^7.25.0, @babel/generator@npm:^7.28.5, @babel/generator@npm:^7.7.2": + version: 7.28.5 + resolution: "@babel/generator@npm:7.28.5" dependencies: - "@babel/parser": ^7.28.3 - "@babel/types": ^7.28.2 + "@babel/parser": ^7.28.5 + "@babel/types": ^7.28.5 "@jridgewell/gen-mapping": ^0.3.12 "@jridgewell/trace-mapping": ^0.3.28 jsesc: ^3.0.2 - checksum: e2202bf2b9c8a94f7e7a0a049fda0ee037d055c46922e85afa3bbc53309113f859b8193894f991045d7865226028b8f4f06152ed315ab414451932016dba5e42 + checksum: 3e86fa0197bb33394a85a73dbbca92bb1b3f250a30294c7e327359c0978ad90f36f3d71c7f2965a3fc349cfa82becc8f87e7421c75796c8bc48dd9010dd866d1 languageName: node linkType: hard @@ -95,33 +95,33 @@ __metadata: languageName: node linkType: hard -"@babel/helper-create-class-features-plugin@npm:^7.18.6, @babel/helper-create-class-features-plugin@npm:^7.27.1, @babel/helper-create-class-features-plugin@npm:^7.28.3": - version: 7.28.3 - resolution: "@babel/helper-create-class-features-plugin@npm:7.28.3" +"@babel/helper-create-class-features-plugin@npm:^7.18.6, @babel/helper-create-class-features-plugin@npm:^7.27.1, @babel/helper-create-class-features-plugin@npm:^7.28.3, @babel/helper-create-class-features-plugin@npm:^7.28.5": + version: 7.28.5 + resolution: "@babel/helper-create-class-features-plugin@npm:7.28.5" dependencies: "@babel/helper-annotate-as-pure": ^7.27.3 - "@babel/helper-member-expression-to-functions": ^7.27.1 + "@babel/helper-member-expression-to-functions": ^7.28.5 "@babel/helper-optimise-call-expression": ^7.27.1 "@babel/helper-replace-supers": ^7.27.1 "@babel/helper-skip-transparent-expression-wrappers": ^7.27.1 - "@babel/traverse": ^7.28.3 + "@babel/traverse": ^7.28.5 semver: ^6.3.1 peerDependencies: "@babel/core": ^7.0.0 - checksum: 6d918e5e9c88ad1a262ab7b1a3caede1bbf95f8276c96846d8b0c1af251c85a0c868a9f1bbbaebdeb199e44dfd0e10fbe22935e56bedd1aa41ba4a7162bfa86c + checksum: 98f94a27bcde0cf0b847c41e1307057a1caddd131fb5fa0b1566e0c15ccc20b0ebab9667d782bffcd3eac9262226b18e86dcf30ab0f4dc5d14b1e1bf243aba49 languageName: node linkType: hard "@babel/helper-create-regexp-features-plugin@npm:^7.18.6, @babel/helper-create-regexp-features-plugin@npm:^7.27.1": - version: 7.27.1 - resolution: "@babel/helper-create-regexp-features-plugin@npm:7.27.1" + version: 7.28.5 + resolution: "@babel/helper-create-regexp-features-plugin@npm:7.28.5" dependencies: - "@babel/helper-annotate-as-pure": ^7.27.1 - regexpu-core: ^6.2.0 + "@babel/helper-annotate-as-pure": ^7.27.3 + regexpu-core: ^6.3.1 semver: ^6.3.1 peerDependencies: "@babel/core": ^7.0.0 - checksum: 2ede6bbad0016a9262fd281ce8f1a5d69e6179dcec4ea282830e924c29a29b66b0544ecb92e4ef4acdaf2c4c990931d7dc442dbcd6a8bcec4bad73923ef70934 + checksum: de202103e6ff8cd8da0d62eb269fcceb29857f3fa16173f0ff38188fd514e9ad4901aef1d590ff8ba25381644b42eaf70ad9ba91fda59fe7aa6a5e694cdde267 languageName: node linkType: hard @@ -156,13 +156,13 @@ __metadata: languageName: node linkType: hard -"@babel/helper-member-expression-to-functions@npm:^7.27.1": - version: 7.27.1 - resolution: "@babel/helper-member-expression-to-functions@npm:7.27.1" +"@babel/helper-member-expression-to-functions@npm:^7.27.1, @babel/helper-member-expression-to-functions@npm:^7.28.5": + version: 7.28.5 + resolution: "@babel/helper-member-expression-to-functions@npm:7.28.5" dependencies: - "@babel/traverse": ^7.27.1 - "@babel/types": ^7.27.1 - checksum: b13a3d120015a6fd2f6e6c2ff789cd12498745ef028710cba612cfb751b91ace700c3f96c1689228d1dcb41e9d4cf83d6dff8627dcb0c8da12d79440e783c6b8 + "@babel/traverse": ^7.28.5 + "@babel/types": ^7.28.5 + checksum: 447d385233bae2eea713df1785f819b5a5ca272950740da123c42d23f491045120f0fbbb5609c091f7a9bbd40f289a442846dde0cb1bf0c59440fa093690cf7c languageName: node linkType: hard @@ -248,10 +248,10 @@ __metadata: languageName: node linkType: hard -"@babel/helper-validator-identifier@npm:^7.27.1": - version: 7.27.1 - resolution: "@babel/helper-validator-identifier@npm:7.27.1" - checksum: 3c7e8391e59d6c85baeefe9afb86432f2ab821c6232b00ea9082a51d3e7e95a2f3fb083d74dc1f49ac82cf238e1d2295dafcb001f7b0fab479f3f56af5eaaa47 +"@babel/helper-validator-identifier@npm:^7.27.1, @babel/helper-validator-identifier@npm:^7.28.5": + version: 7.28.5 + resolution: "@babel/helper-validator-identifier@npm:7.28.5" + checksum: 5a251a6848e9712aea0338f659a1a3bd334d26219d5511164544ca8ec20774f098c3a6661e9da65a0d085c745c00bb62c8fada38a62f08fa1f8053bc0aeb57e4 languageName: node linkType: hard @@ -283,26 +283,26 @@ __metadata: languageName: node linkType: hard -"@babel/parser@npm:^7.1.0, @babel/parser@npm:^7.13.16, @babel/parser@npm:^7.14.7, @babel/parser@npm:^7.20.0, @babel/parser@npm:^7.20.7, @babel/parser@npm:^7.23.9, @babel/parser@npm:^7.25.3, @babel/parser@npm:^7.27.2, @babel/parser@npm:^7.28.3, @babel/parser@npm:^7.28.4": - version: 7.28.4 - resolution: "@babel/parser@npm:7.28.4" +"@babel/parser@npm:^7.1.0, @babel/parser@npm:^7.13.16, @babel/parser@npm:^7.14.7, @babel/parser@npm:^7.20.0, @babel/parser@npm:^7.20.7, @babel/parser@npm:^7.23.9, @babel/parser@npm:^7.25.3, @babel/parser@npm:^7.27.2, @babel/parser@npm:^7.28.5": + version: 7.28.5 + resolution: "@babel/parser@npm:7.28.5" dependencies: - "@babel/types": ^7.28.4 + "@babel/types": ^7.28.5 bin: parser: ./bin/babel-parser.js - checksum: d95e283fe1153039b396926ef567ca1ab114afb5c732a23bbcbbd0465ac59971aeb6a63f37593ce7671a52d34ec52b23008c999d68241b42d26928c540464063 + checksum: 5c2456e3f26c70d4a3ce1a220b529a91a2df26c54a2894fd0dea2342699ea1067ffdda9f0715eeab61da46ff546fd5661bc70be6d8d11977cbe21f5f0478819a languageName: node linkType: hard -"@babel/plugin-bugfix-firefox-class-in-computed-class-key@npm:^7.27.1": - version: 7.27.1 - resolution: "@babel/plugin-bugfix-firefox-class-in-computed-class-key@npm:7.27.1" +"@babel/plugin-bugfix-firefox-class-in-computed-class-key@npm:^7.28.5": + version: 7.28.5 + resolution: "@babel/plugin-bugfix-firefox-class-in-computed-class-key@npm:7.28.5" dependencies: "@babel/helper-plugin-utils": ^7.27.1 - "@babel/traverse": ^7.27.1 + "@babel/traverse": ^7.28.5 peerDependencies: "@babel/core": ^7.0.0 - checksum: 72f24b9487e445fa61cf8be552aad394a648c2bb445c38d39d1df003186d9685b87dd8d388c950f438ea0ca44c82099d9c49252fb681c719cc72edf02bbe0304 + checksum: 749b40a963d5633f554cad0336245cb6c1c1393c70a3fddcf302d86a1a42b35efdd2ed62056b88db66f3900887ae1cee9a3eeec89799c22e0cf65059f0dfd142 languageName: node linkType: hard @@ -766,14 +766,14 @@ __metadata: languageName: node linkType: hard -"@babel/plugin-transform-block-scoping@npm:^7.0.0, @babel/plugin-transform-block-scoping@npm:^7.25.0, @babel/plugin-transform-block-scoping@npm:^7.28.0": - version: 7.28.4 - resolution: "@babel/plugin-transform-block-scoping@npm:7.28.4" +"@babel/plugin-transform-block-scoping@npm:^7.0.0, @babel/plugin-transform-block-scoping@npm:^7.25.0, @babel/plugin-transform-block-scoping@npm:^7.28.5": + version: 7.28.5 + resolution: "@babel/plugin-transform-block-scoping@npm:7.28.5" dependencies: "@babel/helper-plugin-utils": ^7.27.1 peerDependencies: "@babel/core": ^7.0.0-0 - checksum: 7f62eae907c0b4f85b9cc024da949697e57d17f2107ca4a240011174762d4c546b856ccbd5ba83ecb4bc9eb50150ea46558d551a5b05d3f25aace88a65fa4e04 + checksum: 2cbc11c9b61097b61806c279211a4c4f5e85a5ca7fd52228efbf3a729178d330142a00a93695dbacc2898477e5fa9e34e7637f18323247ebebb84f43005560f3 languageName: node linkType: hard @@ -801,7 +801,7 @@ __metadata: languageName: node linkType: hard -"@babel/plugin-transform-classes@npm:^7.0.0, @babel/plugin-transform-classes@npm:^7.0.0-0, @babel/plugin-transform-classes@npm:^7.25.4, @babel/plugin-transform-classes@npm:^7.28.3": +"@babel/plugin-transform-classes@npm:^7.0.0, @babel/plugin-transform-classes@npm:^7.0.0-0, @babel/plugin-transform-classes@npm:^7.25.4, @babel/plugin-transform-classes@npm:^7.28.4": version: 7.28.4 resolution: "@babel/plugin-transform-classes@npm:7.28.4" dependencies: @@ -829,15 +829,15 @@ __metadata: languageName: node linkType: hard -"@babel/plugin-transform-destructuring@npm:^7.20.0, @babel/plugin-transform-destructuring@npm:^7.24.8, @babel/plugin-transform-destructuring@npm:^7.28.0": - version: 7.28.0 - resolution: "@babel/plugin-transform-destructuring@npm:7.28.0" +"@babel/plugin-transform-destructuring@npm:^7.20.0, @babel/plugin-transform-destructuring@npm:^7.24.8, @babel/plugin-transform-destructuring@npm:^7.28.0, @babel/plugin-transform-destructuring@npm:^7.28.5": + version: 7.28.5 + resolution: "@babel/plugin-transform-destructuring@npm:7.28.5" dependencies: "@babel/helper-plugin-utils": ^7.27.1 - "@babel/traverse": ^7.28.0 + "@babel/traverse": ^7.28.5 peerDependencies: "@babel/core": ^7.0.0-0 - checksum: 5b464d6a03c6eaa1327b60ffc1630ca977db0256938b34e281e65c81c965680e930a6bac043272942d6d4bbd7d1eddded0b7231779429ba51275e092e7367859 + checksum: 74a06e55e715cfda0fdd8be53d2655d64dfdc28dffaede329d42548fd5b1449ad26a4ce43a24c3fd277b96f8b2010c7b3915afa8297911cda740cc5cc3a81f38 languageName: node linkType: hard @@ -899,14 +899,14 @@ __metadata: languageName: node linkType: hard -"@babel/plugin-transform-exponentiation-operator@npm:^7.27.1": - version: 7.27.1 - resolution: "@babel/plugin-transform-exponentiation-operator@npm:7.27.1" +"@babel/plugin-transform-exponentiation-operator@npm:^7.28.5": + version: 7.28.5 + resolution: "@babel/plugin-transform-exponentiation-operator@npm:7.28.5" dependencies: "@babel/helper-plugin-utils": ^7.27.1 peerDependencies: "@babel/core": ^7.0.0-0 - checksum: 4ff4a0f30babc457a5ae8564deda209599627c2ce647284a0e8e66f65b44f6d968cf77761a4cc31b45b61693f0810479248c79e681681d8ccb39d0c52944c1fd + checksum: da9bb5acd35c9fba92b802641f9462b82334158a149c78a739a04576a1e62be41057a201a41c022dda263bb73ac1a26521bbc997c7fc067f54d487af297995f4 languageName: node linkType: hard @@ -980,14 +980,14 @@ __metadata: languageName: node linkType: hard -"@babel/plugin-transform-logical-assignment-operators@npm:^7.24.7, @babel/plugin-transform-logical-assignment-operators@npm:^7.27.1": - version: 7.27.1 - resolution: "@babel/plugin-transform-logical-assignment-operators@npm:7.27.1" +"@babel/plugin-transform-logical-assignment-operators@npm:^7.24.7, @babel/plugin-transform-logical-assignment-operators@npm:^7.28.5": + version: 7.28.5 + resolution: "@babel/plugin-transform-logical-assignment-operators@npm:7.28.5" dependencies: "@babel/helper-plugin-utils": ^7.27.1 peerDependencies: "@babel/core": ^7.0.0-0 - checksum: 2757955d81d65cc4701c17b83720745f6858f7a1d1d58117e379c204f47adbeb066b778596b6168bdbf4a22c229aab595d79a9abc261d0c6bfd62d4419466e73 + checksum: c76778f4b186cc4f0b7e3658d91c690678bdb2b9d032f189213016d6177f2564709b79b386523b022b7d52e52331fd91f280f7c7bf85d835e0758b4b0d371447 languageName: node linkType: hard @@ -1026,17 +1026,17 @@ __metadata: languageName: node linkType: hard -"@babel/plugin-transform-modules-systemjs@npm:^7.27.1": - version: 7.27.1 - resolution: "@babel/plugin-transform-modules-systemjs@npm:7.27.1" +"@babel/plugin-transform-modules-systemjs@npm:^7.28.5": + version: 7.28.5 + resolution: "@babel/plugin-transform-modules-systemjs@npm:7.28.5" dependencies: - "@babel/helper-module-transforms": ^7.27.1 + "@babel/helper-module-transforms": ^7.28.3 "@babel/helper-plugin-utils": ^7.27.1 - "@babel/helper-validator-identifier": ^7.27.1 - "@babel/traverse": ^7.27.1 + "@babel/helper-validator-identifier": ^7.28.5 + "@babel/traverse": ^7.28.5 peerDependencies: "@babel/core": ^7.0.0-0 - checksum: 7c17a8973676c18525d87f277944616596f1b154cc2b9263bfd78ecdbf5f4288ec46c7f58017321ca3e3d6dfeb96875467b95311a39719b475d42a157525d87f + checksum: 646748dcf968c107fedfbff38aa37f7a9ebf2ccdf51fd9f578c6cd323371db36bbc5fe0d995544db168f39be9bca32a85fbf3bfff4742d2bed22e21c2847fa46 languageName: node linkType: hard @@ -1097,7 +1097,7 @@ __metadata: languageName: node linkType: hard -"@babel/plugin-transform-object-rest-spread@npm:^7.24.7, @babel/plugin-transform-object-rest-spread@npm:^7.28.0": +"@babel/plugin-transform-object-rest-spread@npm:^7.24.7, @babel/plugin-transform-object-rest-spread@npm:^7.28.4": version: 7.28.4 resolution: "@babel/plugin-transform-object-rest-spread@npm:7.28.4" dependencies: @@ -1135,15 +1135,15 @@ __metadata: languageName: node linkType: hard -"@babel/plugin-transform-optional-chaining@npm:^7.0.0-0, @babel/plugin-transform-optional-chaining@npm:^7.24.8, @babel/plugin-transform-optional-chaining@npm:^7.27.1": - version: 7.27.1 - resolution: "@babel/plugin-transform-optional-chaining@npm:7.27.1" +"@babel/plugin-transform-optional-chaining@npm:^7.0.0-0, @babel/plugin-transform-optional-chaining@npm:^7.24.8, @babel/plugin-transform-optional-chaining@npm:^7.27.1, @babel/plugin-transform-optional-chaining@npm:^7.28.5": + version: 7.28.5 + resolution: "@babel/plugin-transform-optional-chaining@npm:7.28.5" dependencies: "@babel/helper-plugin-utils": ^7.27.1 "@babel/helper-skip-transparent-expression-wrappers": ^7.27.1 peerDependencies: "@babel/core": ^7.0.0-0 - checksum: c4428d31f182d724db6f10575669aad3dbccceb0dea26aa9071fa89f11b3456278da3097fcc78937639a13c105a82cd452dc0218ce51abdbcf7626a013b928a5 + checksum: 78c2be52b32e893c992aca52ef84130b3540e2ca0e1ff0e45f8d2ccc213b3c6e2b43f8dd2c86a0976acf3cdff97d4488c23b86d7a3e67daa517013089f44af1d languageName: node linkType: hard @@ -1194,7 +1194,7 @@ __metadata: languageName: node linkType: hard -"@babel/plugin-transform-react-display-name@npm:^7.0.0, @babel/plugin-transform-react-display-name@npm:^7.24.7, @babel/plugin-transform-react-display-name@npm:^7.27.1": +"@babel/plugin-transform-react-display-name@npm:^7.0.0, @babel/plugin-transform-react-display-name@npm:^7.24.7, @babel/plugin-transform-react-display-name@npm:^7.28.0": version: 7.28.0 resolution: "@babel/plugin-transform-react-display-name@npm:7.28.0" dependencies: @@ -1265,7 +1265,7 @@ __metadata: languageName: node linkType: hard -"@babel/plugin-transform-regenerator@npm:^7.24.7, @babel/plugin-transform-regenerator@npm:^7.28.3": +"@babel/plugin-transform-regenerator@npm:^7.24.7, @babel/plugin-transform-regenerator@npm:^7.28.4": version: 7.28.4 resolution: "@babel/plugin-transform-regenerator@npm:7.28.4" dependencies: @@ -1300,8 +1300,8 @@ __metadata: linkType: hard "@babel/plugin-transform-runtime@npm:^7.0.0, @babel/plugin-transform-runtime@npm:^7.24.7": - version: 7.28.3 - resolution: "@babel/plugin-transform-runtime@npm:7.28.3" + version: 7.28.5 + resolution: "@babel/plugin-transform-runtime@npm:7.28.5" dependencies: "@babel/helper-module-imports": ^7.27.1 "@babel/helper-plugin-utils": ^7.27.1 @@ -1311,7 +1311,7 @@ __metadata: semver: ^6.3.1 peerDependencies: "@babel/core": ^7.0.0-0 - checksum: 63d2fc05d5bfcb96f31be54b095d72a89f0a03c8de10f5d742b18b174e2731bcdc27292e8deec66c2e88cebf8298393123d5e767526f6fffbc75cb8144ef66c6 + checksum: 5bb66f366c5bb22d0c890667ecd0f1fde9db86ac04df62b21fc2bbf58531eb84068bb0bf38fb1c496c8f78a917c59a884f6c1f8b205b8689d155e72fcf1d442d languageName: node linkType: hard @@ -1371,18 +1371,18 @@ __metadata: languageName: node linkType: hard -"@babel/plugin-transform-typescript@npm:^7.25.2, @babel/plugin-transform-typescript@npm:^7.27.1, @babel/plugin-transform-typescript@npm:^7.5.0": - version: 7.28.0 - resolution: "@babel/plugin-transform-typescript@npm:7.28.0" +"@babel/plugin-transform-typescript@npm:^7.25.2, @babel/plugin-transform-typescript@npm:^7.28.5, @babel/plugin-transform-typescript@npm:^7.5.0": + version: 7.28.5 + resolution: "@babel/plugin-transform-typescript@npm:7.28.5" dependencies: "@babel/helper-annotate-as-pure": ^7.27.3 - "@babel/helper-create-class-features-plugin": ^7.27.1 + "@babel/helper-create-class-features-plugin": ^7.28.5 "@babel/helper-plugin-utils": ^7.27.1 "@babel/helper-skip-transparent-expression-wrappers": ^7.27.1 "@babel/plugin-syntax-typescript": ^7.27.1 peerDependencies: "@babel/core": ^7.0.0-0 - checksum: 14c1024bcd57fcd469d90cf0c15c3cd4e771e2eb2cd9afee3aa79b59c8ed103654f7c5c71cdb3bfe31c1d0cb08bfad8c80f5aa1d24b4b454bd21301d5925533d + checksum: 202785e9cc6fb04efba091b3d5560cc8089cdc54df12fafa3d32ed7089e8d7a95b92b2fb1b53ec3e4db3bbafe56e8b32a3530cac004b3e493e902def8666001d languageName: node linkType: hard @@ -1434,14 +1434,14 @@ __metadata: linkType: hard "@babel/preset-env@npm:^7.18.2, @babel/preset-env@npm:^7.25.0": - version: 7.28.3 - resolution: "@babel/preset-env@npm:7.28.3" + version: 7.28.5 + resolution: "@babel/preset-env@npm:7.28.5" dependencies: - "@babel/compat-data": ^7.28.0 + "@babel/compat-data": ^7.28.5 "@babel/helper-compilation-targets": ^7.27.2 "@babel/helper-plugin-utils": ^7.27.1 "@babel/helper-validator-option": ^7.27.1 - "@babel/plugin-bugfix-firefox-class-in-computed-class-key": ^7.27.1 + "@babel/plugin-bugfix-firefox-class-in-computed-class-key": ^7.28.5 "@babel/plugin-bugfix-safari-class-field-initializer-scope": ^7.27.1 "@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression": ^7.27.1 "@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining": ^7.27.1 @@ -1454,42 +1454,42 @@ __metadata: "@babel/plugin-transform-async-generator-functions": ^7.28.0 "@babel/plugin-transform-async-to-generator": ^7.27.1 "@babel/plugin-transform-block-scoped-functions": ^7.27.1 - "@babel/plugin-transform-block-scoping": ^7.28.0 + "@babel/plugin-transform-block-scoping": ^7.28.5 "@babel/plugin-transform-class-properties": ^7.27.1 "@babel/plugin-transform-class-static-block": ^7.28.3 - "@babel/plugin-transform-classes": ^7.28.3 + "@babel/plugin-transform-classes": ^7.28.4 "@babel/plugin-transform-computed-properties": ^7.27.1 - "@babel/plugin-transform-destructuring": ^7.28.0 + "@babel/plugin-transform-destructuring": ^7.28.5 "@babel/plugin-transform-dotall-regex": ^7.27.1 "@babel/plugin-transform-duplicate-keys": ^7.27.1 "@babel/plugin-transform-duplicate-named-capturing-groups-regex": ^7.27.1 "@babel/plugin-transform-dynamic-import": ^7.27.1 "@babel/plugin-transform-explicit-resource-management": ^7.28.0 - "@babel/plugin-transform-exponentiation-operator": ^7.27.1 + "@babel/plugin-transform-exponentiation-operator": ^7.28.5 "@babel/plugin-transform-export-namespace-from": ^7.27.1 "@babel/plugin-transform-for-of": ^7.27.1 "@babel/plugin-transform-function-name": ^7.27.1 "@babel/plugin-transform-json-strings": ^7.27.1 "@babel/plugin-transform-literals": ^7.27.1 - "@babel/plugin-transform-logical-assignment-operators": ^7.27.1 + "@babel/plugin-transform-logical-assignment-operators": ^7.28.5 "@babel/plugin-transform-member-expression-literals": ^7.27.1 "@babel/plugin-transform-modules-amd": ^7.27.1 "@babel/plugin-transform-modules-commonjs": ^7.27.1 - "@babel/plugin-transform-modules-systemjs": ^7.27.1 + "@babel/plugin-transform-modules-systemjs": ^7.28.5 "@babel/plugin-transform-modules-umd": ^7.27.1 "@babel/plugin-transform-named-capturing-groups-regex": ^7.27.1 "@babel/plugin-transform-new-target": ^7.27.1 "@babel/plugin-transform-nullish-coalescing-operator": ^7.27.1 "@babel/plugin-transform-numeric-separator": ^7.27.1 - "@babel/plugin-transform-object-rest-spread": ^7.28.0 + "@babel/plugin-transform-object-rest-spread": ^7.28.4 "@babel/plugin-transform-object-super": ^7.27.1 "@babel/plugin-transform-optional-catch-binding": ^7.27.1 - "@babel/plugin-transform-optional-chaining": ^7.27.1 + "@babel/plugin-transform-optional-chaining": ^7.28.5 "@babel/plugin-transform-parameters": ^7.27.7 "@babel/plugin-transform-private-methods": ^7.27.1 "@babel/plugin-transform-private-property-in-object": ^7.27.1 "@babel/plugin-transform-property-literals": ^7.27.1 - "@babel/plugin-transform-regenerator": ^7.28.3 + "@babel/plugin-transform-regenerator": ^7.28.4 "@babel/plugin-transform-regexp-modifiers": ^7.27.1 "@babel/plugin-transform-reserved-words": ^7.27.1 "@babel/plugin-transform-shorthand-properties": ^7.27.1 @@ -1509,7 +1509,7 @@ __metadata: semver: ^6.3.1 peerDependencies: "@babel/core": ^7.0.0-0 - checksum: c4e70f69b727d21eedd4de201ac082e951482f2d28a388e401e7937fd6f15bc1a49a63c12f59e87a18d237ac037a5b29d983f3bb82f1196d6444ae5b605ac6e2 + checksum: 9e17ba89c5d8cbea0fde564ea29e6dc17ad43f6ebf1c11347af69a04cf69dbc62c3124d2afe46412bfa41dddde3aaabfeffc0d68bed96f6ea0c4d8fbf652e761 languageName: node linkType: hard @@ -1540,33 +1540,33 @@ __metadata: linkType: hard "@babel/preset-react@npm:^7.17.12": - version: 7.27.1 - resolution: "@babel/preset-react@npm:7.27.1" + version: 7.28.5 + resolution: "@babel/preset-react@npm:7.28.5" dependencies: "@babel/helper-plugin-utils": ^7.27.1 "@babel/helper-validator-option": ^7.27.1 - "@babel/plugin-transform-react-display-name": ^7.27.1 + "@babel/plugin-transform-react-display-name": ^7.28.0 "@babel/plugin-transform-react-jsx": ^7.27.1 "@babel/plugin-transform-react-jsx-development": ^7.27.1 "@babel/plugin-transform-react-pure-annotations": ^7.27.1 peerDependencies: "@babel/core": ^7.0.0-0 - checksum: 00bc146f9c742eed804c598d3f31b7d889c1baf8c768989b7f84a93ca527dd1518d3b86781e89ca45cae6dbee136510d3a121658e01416c5578aecf751517bb5 + checksum: 13bc1fe4dde0a29d00323e46749e5beb457844507cb3afa2fefbd85d283c2d4836f9e4a780be735de58a44c505870476dc2838f1f8faf9d6f056481e65f1a0fb languageName: node linkType: hard "@babel/preset-typescript@npm:^7.13.0, @babel/preset-typescript@npm:^7.16.7, @babel/preset-typescript@npm:^7.17.12": - version: 7.27.1 - resolution: "@babel/preset-typescript@npm:7.27.1" + version: 7.28.5 + resolution: "@babel/preset-typescript@npm:7.28.5" dependencies: "@babel/helper-plugin-utils": ^7.27.1 "@babel/helper-validator-option": ^7.27.1 "@babel/plugin-syntax-jsx": ^7.27.1 "@babel/plugin-transform-modules-commonjs": ^7.27.1 - "@babel/plugin-transform-typescript": ^7.27.1 + "@babel/plugin-transform-typescript": ^7.28.5 peerDependencies: "@babel/core": ^7.0.0-0 - checksum: 38020f1b23e88ec4fbffd5737da455d8939244bddfb48a2516aef93fb5947bd9163fb807ce6eff3e43fa5ffe9113aa131305fef0fb5053998410bbfcfe6ce0ec + checksum: 22f889835d9db1e627846e71ca2f02e2d24e2eb9ebcf9845b3b1d37bd3a53787967bafabbbcb342f06aaf7627399a7102ba6ca18f9a0e17066c865d680d2ceb9 languageName: node linkType: hard @@ -1603,28 +1603,28 @@ __metadata: languageName: node linkType: hard -"@babel/traverse--for-generate-function-map@npm:@babel/traverse@^7.25.3, @babel/traverse@npm:^7.20.0, @babel/traverse@npm:^7.25.3, @babel/traverse@npm:^7.27.1, @babel/traverse@npm:^7.28.0, @babel/traverse@npm:^7.28.3, @babel/traverse@npm:^7.28.4": - version: 7.28.4 - resolution: "@babel/traverse@npm:7.28.4" +"@babel/traverse--for-generate-function-map@npm:@babel/traverse@^7.25.3, @babel/traverse@npm:^7.20.0, @babel/traverse@npm:^7.25.3, @babel/traverse@npm:^7.27.1, @babel/traverse@npm:^7.28.0, @babel/traverse@npm:^7.28.3, @babel/traverse@npm:^7.28.4, @babel/traverse@npm:^7.28.5": + version: 7.28.5 + resolution: "@babel/traverse@npm:7.28.5" dependencies: "@babel/code-frame": ^7.27.1 - "@babel/generator": ^7.28.3 + "@babel/generator": ^7.28.5 "@babel/helper-globals": ^7.28.0 - "@babel/parser": ^7.28.4 + "@babel/parser": ^7.28.5 "@babel/template": ^7.27.2 - "@babel/types": ^7.28.4 + "@babel/types": ^7.28.5 debug: ^4.3.1 - checksum: d603b8ce4e55ba4fc7b28d3362cc2b1b20bc887e471c8a59fe87b2578c26803c9ef8fcd118081dd8283ea78e0e9a6df9d88c8520033c6aaf81eec30d2a669151 + checksum: e028ee9654f44be7c2a2df268455cee72d5c424c9ae536785f8f7c8680356f7b977c77ad76909d07eeed09ff1e125ce01cf783011f66b56c838791a85fa6af04 languageName: node linkType: hard -"@babel/types@npm:^7.0.0, @babel/types@npm:^7.20.0, @babel/types@npm:^7.20.7, @babel/types@npm:^7.24.7, @babel/types@npm:^7.25.2, @babel/types@npm:^7.27.1, @babel/types@npm:^7.27.3, @babel/types@npm:^7.28.2, @babel/types@npm:^7.28.4, @babel/types@npm:^7.3.3, @babel/types@npm:^7.4.4": - version: 7.28.4 - resolution: "@babel/types@npm:7.28.4" +"@babel/types@npm:^7.0.0, @babel/types@npm:^7.20.0, @babel/types@npm:^7.20.7, @babel/types@npm:^7.24.7, @babel/types@npm:^7.25.2, @babel/types@npm:^7.27.1, @babel/types@npm:^7.27.3, @babel/types@npm:^7.28.2, @babel/types@npm:^7.28.4, @babel/types@npm:^7.28.5, @babel/types@npm:^7.3.3, @babel/types@npm:^7.4.4": + version: 7.28.5 + resolution: "@babel/types@npm:7.28.5" dependencies: "@babel/helper-string-parser": ^7.27.1 - "@babel/helper-validator-identifier": ^7.27.1 - checksum: a369b4fb73415a2ed902a15576b49696ae9777ddee394a7a904c62e6fbb31f43906b0147ae0b8f03ac17f20c248eac093df349e33c65c94617b12e524b759694 + "@babel/helper-validator-identifier": ^7.28.5 + checksum: 5bc266af9e55ff92f9ddf33d83a42c9de1a87f9579d0ed62ef94a741a081692dd410a4fbbab18d514b83e135083ff05bc0e37003834801c9514b9d8ad748070d languageName: node linkType: hard @@ -1699,21 +1699,21 @@ __metadata: linkType: hard "@emnapi/core@npm:^1.4.3": - version: 1.5.0 - resolution: "@emnapi/core@npm:1.5.0" + version: 1.8.1 + resolution: "@emnapi/core@npm:1.8.1" dependencies: "@emnapi/wasi-threads": 1.1.0 tslib: ^2.4.0 - checksum: 089a506a4f6a2416b9917050802c20ac76b350b1160116482c3542cf89cd707c832ca18c163ddac4e9cb1df06f02e6cd324cadc60b82aed27d51e0baca1f4b4f + checksum: 2a2fb36f4e2f90e25f419f8979435160313664bbb833d852d9de4487ff47f05fd36bf2cd77c3555f704ec2b67ce3a949ed5542598664c775cdd5ef35ae1c85a4 languageName: node linkType: hard "@emnapi/runtime@npm:^1.4.3": - version: 1.5.0 - resolution: "@emnapi/runtime@npm:1.5.0" + version: 1.8.1 + resolution: "@emnapi/runtime@npm:1.8.1" dependencies: tslib: ^2.4.0 - checksum: 03b23bdc0bb72bce4d8967ca29d623c2599af18977975c10532577db2ec89a57d97d2c76c5c4bde856c7c29302b9f7af357e921c42bd952bdda206972185819a + checksum: 0000a91d2d0ec3aaa37cbab9c360de3ff8250592f3ce4706b8c9c6d93e54151e623a8983c85543f33cb6f66cf30bb24bf0ddde466de484d6a6bf1fb2650382de languageName: node linkType: hard @@ -1726,214 +1726,214 @@ __metadata: languageName: node linkType: hard -"@esbuild/aix-ppc64@npm:0.25.10": - version: 0.25.10 - resolution: "@esbuild/aix-ppc64@npm:0.25.10" +"@esbuild/aix-ppc64@npm:0.27.2": + version: 0.27.2 + resolution: "@esbuild/aix-ppc64@npm:0.27.2" conditions: os=aix & cpu=ppc64 languageName: node linkType: hard -"@esbuild/android-arm64@npm:0.25.10": - version: 0.25.10 - resolution: "@esbuild/android-arm64@npm:0.25.10" +"@esbuild/android-arm64@npm:0.27.2": + version: 0.27.2 + resolution: "@esbuild/android-arm64@npm:0.27.2" conditions: os=android & cpu=arm64 languageName: node linkType: hard -"@esbuild/android-arm@npm:0.25.10": - version: 0.25.10 - resolution: "@esbuild/android-arm@npm:0.25.10" +"@esbuild/android-arm@npm:0.27.2": + version: 0.27.2 + resolution: "@esbuild/android-arm@npm:0.27.2" conditions: os=android & cpu=arm languageName: node linkType: hard -"@esbuild/android-x64@npm:0.25.10": - version: 0.25.10 - resolution: "@esbuild/android-x64@npm:0.25.10" +"@esbuild/android-x64@npm:0.27.2": + version: 0.27.2 + resolution: "@esbuild/android-x64@npm:0.27.2" conditions: os=android & cpu=x64 languageName: node linkType: hard -"@esbuild/darwin-arm64@npm:0.25.10": - version: 0.25.10 - resolution: "@esbuild/darwin-arm64@npm:0.25.10" +"@esbuild/darwin-arm64@npm:0.27.2": + version: 0.27.2 + resolution: "@esbuild/darwin-arm64@npm:0.27.2" conditions: os=darwin & cpu=arm64 languageName: node linkType: hard -"@esbuild/darwin-x64@npm:0.25.10": - version: 0.25.10 - resolution: "@esbuild/darwin-x64@npm:0.25.10" +"@esbuild/darwin-x64@npm:0.27.2": + version: 0.27.2 + resolution: "@esbuild/darwin-x64@npm:0.27.2" conditions: os=darwin & cpu=x64 languageName: node linkType: hard -"@esbuild/freebsd-arm64@npm:0.25.10": - version: 0.25.10 - resolution: "@esbuild/freebsd-arm64@npm:0.25.10" +"@esbuild/freebsd-arm64@npm:0.27.2": + version: 0.27.2 + resolution: "@esbuild/freebsd-arm64@npm:0.27.2" conditions: os=freebsd & cpu=arm64 languageName: node linkType: hard -"@esbuild/freebsd-x64@npm:0.25.10": - version: 0.25.10 - resolution: "@esbuild/freebsd-x64@npm:0.25.10" +"@esbuild/freebsd-x64@npm:0.27.2": + version: 0.27.2 + resolution: "@esbuild/freebsd-x64@npm:0.27.2" conditions: os=freebsd & cpu=x64 languageName: node linkType: hard -"@esbuild/linux-arm64@npm:0.25.10": - version: 0.25.10 - resolution: "@esbuild/linux-arm64@npm:0.25.10" +"@esbuild/linux-arm64@npm:0.27.2": + version: 0.27.2 + resolution: "@esbuild/linux-arm64@npm:0.27.2" conditions: os=linux & cpu=arm64 languageName: node linkType: hard -"@esbuild/linux-arm@npm:0.25.10": - version: 0.25.10 - resolution: "@esbuild/linux-arm@npm:0.25.10" +"@esbuild/linux-arm@npm:0.27.2": + version: 0.27.2 + resolution: "@esbuild/linux-arm@npm:0.27.2" conditions: os=linux & cpu=arm languageName: node linkType: hard -"@esbuild/linux-ia32@npm:0.25.10": - version: 0.25.10 - resolution: "@esbuild/linux-ia32@npm:0.25.10" +"@esbuild/linux-ia32@npm:0.27.2": + version: 0.27.2 + resolution: "@esbuild/linux-ia32@npm:0.27.2" conditions: os=linux & cpu=ia32 languageName: node linkType: hard -"@esbuild/linux-loong64@npm:0.25.10": - version: 0.25.10 - resolution: "@esbuild/linux-loong64@npm:0.25.10" +"@esbuild/linux-loong64@npm:0.27.2": + version: 0.27.2 + resolution: "@esbuild/linux-loong64@npm:0.27.2" conditions: os=linux & cpu=loong64 languageName: node linkType: hard -"@esbuild/linux-mips64el@npm:0.25.10": - version: 0.25.10 - resolution: "@esbuild/linux-mips64el@npm:0.25.10" +"@esbuild/linux-mips64el@npm:0.27.2": + version: 0.27.2 + resolution: "@esbuild/linux-mips64el@npm:0.27.2" conditions: os=linux & cpu=mips64el languageName: node linkType: hard -"@esbuild/linux-ppc64@npm:0.25.10": - version: 0.25.10 - resolution: "@esbuild/linux-ppc64@npm:0.25.10" +"@esbuild/linux-ppc64@npm:0.27.2": + version: 0.27.2 + resolution: "@esbuild/linux-ppc64@npm:0.27.2" conditions: os=linux & cpu=ppc64 languageName: node linkType: hard -"@esbuild/linux-riscv64@npm:0.25.10": - version: 0.25.10 - resolution: "@esbuild/linux-riscv64@npm:0.25.10" +"@esbuild/linux-riscv64@npm:0.27.2": + version: 0.27.2 + resolution: "@esbuild/linux-riscv64@npm:0.27.2" conditions: os=linux & cpu=riscv64 languageName: node linkType: hard -"@esbuild/linux-s390x@npm:0.25.10": - version: 0.25.10 - resolution: "@esbuild/linux-s390x@npm:0.25.10" +"@esbuild/linux-s390x@npm:0.27.2": + version: 0.27.2 + resolution: "@esbuild/linux-s390x@npm:0.27.2" conditions: os=linux & cpu=s390x languageName: node linkType: hard -"@esbuild/linux-x64@npm:0.25.10": - version: 0.25.10 - resolution: "@esbuild/linux-x64@npm:0.25.10" +"@esbuild/linux-x64@npm:0.27.2": + version: 0.27.2 + resolution: "@esbuild/linux-x64@npm:0.27.2" conditions: os=linux & cpu=x64 languageName: node linkType: hard -"@esbuild/netbsd-arm64@npm:0.25.10": - version: 0.25.10 - resolution: "@esbuild/netbsd-arm64@npm:0.25.10" +"@esbuild/netbsd-arm64@npm:0.27.2": + version: 0.27.2 + resolution: "@esbuild/netbsd-arm64@npm:0.27.2" conditions: os=netbsd & cpu=arm64 languageName: node linkType: hard -"@esbuild/netbsd-x64@npm:0.25.10": - version: 0.25.10 - resolution: "@esbuild/netbsd-x64@npm:0.25.10" +"@esbuild/netbsd-x64@npm:0.27.2": + version: 0.27.2 + resolution: "@esbuild/netbsd-x64@npm:0.27.2" conditions: os=netbsd & cpu=x64 languageName: node linkType: hard -"@esbuild/openbsd-arm64@npm:0.25.10": - version: 0.25.10 - resolution: "@esbuild/openbsd-arm64@npm:0.25.10" +"@esbuild/openbsd-arm64@npm:0.27.2": + version: 0.27.2 + resolution: "@esbuild/openbsd-arm64@npm:0.27.2" conditions: os=openbsd & cpu=arm64 languageName: node linkType: hard -"@esbuild/openbsd-x64@npm:0.25.10": - version: 0.25.10 - resolution: "@esbuild/openbsd-x64@npm:0.25.10" +"@esbuild/openbsd-x64@npm:0.27.2": + version: 0.27.2 + resolution: "@esbuild/openbsd-x64@npm:0.27.2" conditions: os=openbsd & cpu=x64 languageName: node linkType: hard -"@esbuild/openharmony-arm64@npm:0.25.10": - version: 0.25.10 - resolution: "@esbuild/openharmony-arm64@npm:0.25.10" +"@esbuild/openharmony-arm64@npm:0.27.2": + version: 0.27.2 + resolution: "@esbuild/openharmony-arm64@npm:0.27.2" conditions: os=openharmony & cpu=arm64 languageName: node linkType: hard -"@esbuild/sunos-x64@npm:0.25.10": - version: 0.25.10 - resolution: "@esbuild/sunos-x64@npm:0.25.10" +"@esbuild/sunos-x64@npm:0.27.2": + version: 0.27.2 + resolution: "@esbuild/sunos-x64@npm:0.27.2" conditions: os=sunos & cpu=x64 languageName: node linkType: hard -"@esbuild/win32-arm64@npm:0.25.10": - version: 0.25.10 - resolution: "@esbuild/win32-arm64@npm:0.25.10" +"@esbuild/win32-arm64@npm:0.27.2": + version: 0.27.2 + resolution: "@esbuild/win32-arm64@npm:0.27.2" conditions: os=win32 & cpu=arm64 languageName: node linkType: hard -"@esbuild/win32-ia32@npm:0.25.10": - version: 0.25.10 - resolution: "@esbuild/win32-ia32@npm:0.25.10" +"@esbuild/win32-ia32@npm:0.27.2": + version: 0.27.2 + resolution: "@esbuild/win32-ia32@npm:0.27.2" conditions: os=win32 & cpu=ia32 languageName: node linkType: hard -"@esbuild/win32-x64@npm:0.25.10": - version: 0.25.10 - resolution: "@esbuild/win32-x64@npm:0.25.10" +"@esbuild/win32-x64@npm:0.27.2": + version: 0.27.2 + resolution: "@esbuild/win32-x64@npm:0.27.2" conditions: os=win32 & cpu=x64 languageName: node linkType: hard -"@eslint-community/eslint-utils@npm:^4.2.0, @eslint-community/eslint-utils@npm:^4.4.0, @eslint-community/eslint-utils@npm:^4.7.0, @eslint-community/eslint-utils@npm:^4.8.0": - version: 4.9.0 - resolution: "@eslint-community/eslint-utils@npm:4.9.0" +"@eslint-community/eslint-utils@npm:^4.2.0, @eslint-community/eslint-utils@npm:^4.4.0, @eslint-community/eslint-utils@npm:^4.8.0, @eslint-community/eslint-utils@npm:^4.9.1": + version: 4.9.1 + resolution: "@eslint-community/eslint-utils@npm:4.9.1" dependencies: eslint-visitor-keys: ^3.4.3 peerDependencies: eslint: ^6.0.0 || ^7.0.0 || >=8.0.0 - checksum: ae9b98eea006d1354368804b0116b8b45017a4e47b486d1b9cfa048a8ed3dc69b9b074eb2b2acb14034e6897c24048fd42b6a6816d9dc8bb9daad79db7d478d2 + checksum: 0a27c2d676c4be6b329ebb5dd8f6c5ef5fae9a019ff575655306d72874bb26f3ab20e0b241a5f086464bb1f2511ca26a29ff6f80c1e2b0b02eca4686b4dfe1b5 languageName: node linkType: hard -"@eslint-community/regexpp@npm:^4.10.0, @eslint-community/regexpp@npm:^4.12.1, @eslint-community/regexpp@npm:^4.4.0": - version: 4.12.1 - resolution: "@eslint-community/regexpp@npm:4.12.1" - checksum: 0d628680e204bc316d545b4993d3658427ca404ae646ce541fcc65306b8c712c340e5e573e30fb9f85f4855c0c5f6dca9868931f2fcced06417fbe1a0c6cd2d6 +"@eslint-community/regexpp@npm:^4.10.0, @eslint-community/regexpp@npm:^4.12.1, @eslint-community/regexpp@npm:^4.12.2, @eslint-community/regexpp@npm:^4.4.0": + version: 4.12.2 + resolution: "@eslint-community/regexpp@npm:4.12.2" + checksum: 1770bc81f676a72f65c7200b5675ff7a349786521f30e66125faaf767fde1ba1c19c3790e16ba8508a62a3933afcfc806a893858b3b5906faf693d862b9e4120 languageName: node linkType: hard "@eslint/config-array@npm:^0.21.0": - version: 0.21.0 - resolution: "@eslint/config-array@npm:0.21.0" + version: 0.21.1 + resolution: "@eslint/config-array@npm:0.21.1" dependencies: - "@eslint/object-schema": ^2.1.6 + "@eslint/object-schema": ^2.1.7 debug: ^4.3.1 minimatch: ^3.1.2 - checksum: 84d3ae7cb755af94dc158a74389f4c560757b13f2bb908f598f927b87b70a38e8152015ea2e9557c1b4afc5130ee1356f6cad682050d67aae0468bbef98bc3a8 + checksum: fc5b57803b059f7c1f62950ef83baf045a01887fc00551f9e87ac119246fcc6d71c854a7f678accc79cbf829ed010e8135c755a154b0f54b129c538950cd7e6a languageName: node linkType: hard @@ -1954,8 +1954,8 @@ __metadata: linkType: hard "@eslint/eslintrc@npm:^3.3.1": - version: 3.3.1 - resolution: "@eslint/eslintrc@npm:3.3.1" + version: 3.3.3 + resolution: "@eslint/eslintrc@npm:3.3.3" dependencies: ajv: ^6.12.4 debug: ^4.3.2 @@ -1963,10 +1963,10 @@ __metadata: globals: ^14.0.0 ignore: ^5.2.0 import-fresh: ^3.2.1 - js-yaml: ^4.1.0 + js-yaml: ^4.1.1 minimatch: ^3.1.2 strip-json-comments: ^3.1.1 - checksum: 8241f998f0857abf5a615072273b90b1244d75c1c45d217c6a8eb444c6e12bbb5506b4879c14fb262eb72b7d8e3d2f0542da2db1a7f414a12496ebb790fb4d62 + checksum: d1e16e47f1bb29af32defa597eaf84ac0ff8c06760c0a5f4933c604cd9d931d48c89bed96252222f22abac231898a53bc41385a5e6129257f0060b5ec431bdb2 languageName: node linkType: hard @@ -1977,10 +1977,10 @@ __metadata: languageName: node linkType: hard -"@eslint/object-schema@npm:^2.1.6": - version: 2.1.6 - resolution: "@eslint/object-schema@npm:2.1.6" - checksum: e32e565319f6544d36d3fa69a3e163120722d12d666d1a4525c9a6f02e9b54c29d9b1f03139e25d7e759e08dda8da433590bc23c09db8d511162157ef1b86a4c +"@eslint/object-schema@npm:^2.1.7": + version: 2.1.7 + resolution: "@eslint/object-schema@npm:2.1.7" + checksum: fc5708f192476956544def13455d60fd1bafbf8f062d1e05ec5c06dd470b02078eaf721e696a8b31c1c45d2056723a514b941ae5eea1398cc7e38eba6711a775 languageName: node linkType: hard @@ -2041,6 +2041,22 @@ __metadata: languageName: node linkType: hard +"@isaacs/balanced-match@npm:^4.0.1": + version: 4.0.1 + resolution: "@isaacs/balanced-match@npm:4.0.1" + checksum: 102fbc6d2c0d5edf8f6dbf2b3feb21695a21bc850f11bc47c4f06aa83bd8884fde3fe9d6d797d619901d96865fdcb4569ac2a54c937992c48885c5e3d9967fe8 + languageName: node + linkType: hard + +"@isaacs/brace-expansion@npm:^5.0.0": + version: 5.0.0 + resolution: "@isaacs/brace-expansion@npm:5.0.0" + dependencies: + "@isaacs/balanced-match": ^4.0.1 + checksum: d7a3b8b0ddbf0ccd8eeb1300e29dd0a0c02147e823d8138f248375a365682360620895c66d113e05ee02389318c654379b0e538b996345b83c914941786705b1 + languageName: node + linkType: hard + "@isaacs/cliui@npm:^8.0.2": version: 8.0.2 resolution: "@isaacs/cliui@npm:8.0.2" @@ -2451,25 +2467,25 @@ __metadata: languageName: node linkType: hard -"@npmcli/agent@npm:^3.0.0": - version: 3.0.0 - resolution: "@npmcli/agent@npm:3.0.0" +"@npmcli/agent@npm:^4.0.0": + version: 4.0.0 + resolution: "@npmcli/agent@npm:4.0.0" dependencies: agent-base: ^7.1.0 http-proxy-agent: ^7.0.0 https-proxy-agent: ^7.0.1 - lru-cache: ^10.0.1 + lru-cache: ^11.2.1 socks-proxy-agent: ^8.0.3 - checksum: e8fc25d536250ed3e669813b36e8c6d805628b472353c57afd8c4fde0fcfcf3dda4ffe22f7af8c9070812ec2e7a03fb41d7151547cef3508efe661a5a3add20f + checksum: 89ae20b44859ff8d4de56ade319d8ceaa267a0742d6f7345fe98aa5cd8614ced7db85ea4dc5bfbd6614dbb200a10b134e087143582534c939e8a02219e8665c8 languageName: node linkType: hard -"@npmcli/fs@npm:^4.0.0": - version: 4.0.0 - resolution: "@npmcli/fs@npm:4.0.0" +"@npmcli/fs@npm:^5.0.0": + version: 5.0.0 + resolution: "@npmcli/fs@npm:5.0.0" dependencies: semver: ^7.3.5 - checksum: 68951c589e9a4328698a35fd82fe71909a257d6f2ede0434d236fa55634f0fbcad9bb8755553ce5849bd25ee6f019f4d435921ac715c853582c4a7f5983c8d4a + checksum: 897dac32eb37e011800112d406b9ea2ebd96f1dab01bb8fbeb59191b86f6825dffed6a89f3b6c824753d10f8735b76d630927bd7610e9e123b129ef2e5f02cb5 languageName: node linkType: hard @@ -2761,9 +2777,9 @@ __metadata: languageName: node linkType: hard -"@react-native-macos/virtualized-lists@npm:0.79.0": - version: 0.79.0 - resolution: "@react-native-macos/virtualized-lists@npm:0.79.0" +"@react-native-macos/virtualized-lists@npm:0.79.1": + version: 0.79.1 + resolution: "@react-native-macos/virtualized-lists@npm:0.79.1" dependencies: invariant: ^2.2.4 nullthrows: ^1.1.1 @@ -2774,7 +2790,7 @@ __metadata: peerDependenciesMeta: "@types/react": optional: true - checksum: d7c3f0d4696440c9f29cb496ee40c43159aace9687345835afc686454ccbb01316ec359d7ae7996d71ff394ab97a157771c7903c52cdb97474a400a7840624b8 + checksum: 846cad109a2deb30a1cf1b18bcdf4c262c0d9c06ccc9af3b9a22c06f2ef53a9d63920e405a3f828b210ddba10c98b1abf32939d2730603389577d4164ee5da8f languageName: node linkType: hard @@ -2799,10 +2815,10 @@ __metadata: languageName: node linkType: hard -"@react-native/assets-registry@npm:0.82.1": - version: 0.82.1 - resolution: "@react-native/assets-registry@npm:0.82.1" - checksum: f511a248f455c7fe2bae330ed15929294d5d25e5d8aa27e148588a554bde31a1ddf54d08ebc21128cabe9978be4604b2e8ad4343566c9840fc49e2b0d119cbc6 +"@react-native/assets-registry@npm:0.83.1": + version: 0.83.1 + resolution: "@react-native/assets-registry@npm:0.83.1" + checksum: ec788b086fb1be0813d47660c34cdd758eb54dada0e9e1a2e8b55d888adab3bd9e6431742d645317f94033522805fc2c7902aa9de567d7c77d37b9619d927cd5 languageName: node linkType: hard @@ -2999,9 +3015,9 @@ __metadata: languageName: node linkType: hard -"@react-native/codegen@npm:0.82.1": - version: 0.82.1 - resolution: "@react-native/codegen@npm:0.82.1" +"@react-native/codegen@npm:0.83.1": + version: 0.83.1 + resolution: "@react-native/codegen@npm:0.83.1" dependencies: "@babel/core": ^7.25.2 "@babel/parser": ^7.25.3 @@ -3012,7 +3028,7 @@ __metadata: yargs: ^17.6.2 peerDependencies: "@babel/core": "*" - checksum: d965d9f387a62e27a75d80546a6c825b21a42b56738eedf294b59221c117345148daa0362af5b793a2d5ce3e089e3682dd4bdd9548235ab040543f0aa21d46f0 + checksum: 49c7e79b81d2595df33617b29aea981716ac36d92083301977c896a8299d1e1ce86054a804c85e1411a3732fd4e1b71e6e9edf53830b577ec5a9dd9120ca45a0 languageName: node linkType: hard @@ -3080,16 +3096,16 @@ __metadata: languageName: node linkType: hard -"@react-native/community-cli-plugin@npm:0.82.1": - version: 0.82.1 - resolution: "@react-native/community-cli-plugin@npm:0.82.1" +"@react-native/community-cli-plugin@npm:0.83.1": + version: 0.83.1 + resolution: "@react-native/community-cli-plugin@npm:0.83.1" dependencies: - "@react-native/dev-middleware": 0.82.1 + "@react-native/dev-middleware": 0.83.1 debug: ^4.4.0 invariant: ^2.2.4 - metro: ^0.83.1 - metro-config: ^0.83.1 - metro-core: ^0.83.1 + metro: ^0.83.3 + metro-config: ^0.83.3 + metro-core: ^0.83.3 semver: ^7.1.3 peerDependencies: "@react-native-community/cli": "*" @@ -3099,7 +3115,7 @@ __metadata: optional: true "@react-native/metro-config": optional: true - checksum: 680aef3270c56a73467ba40f7de416d32fef8b7e484421fccd437f940692eee76382e82eddd0a4749675b855d642fd6c83b147136bdcf03ee84f36ed38f7e0de + checksum: 75d2a9e4de37bb4eb59d787e31c12e4e36db363b765d6ceaae68ab1f4c7cad021f9f8358eeef4c795949172d6af94f4d93081f98e4110a39d14868cecfde75bd languageName: node linkType: hard @@ -3124,20 +3140,20 @@ __metadata: languageName: node linkType: hard -"@react-native/debugger-frontend@npm:0.82.1": - version: 0.82.1 - resolution: "@react-native/debugger-frontend@npm:0.82.1" - checksum: b767c7586c782a130d3579a1d8c137a8c55361d579028e44a31b220c566ab793a83b256b39eb114a759e07031574cd142cae1bdc1ec80dc02e7a6a191409548e +"@react-native/debugger-frontend@npm:0.83.1": + version: 0.83.1 + resolution: "@react-native/debugger-frontend@npm:0.83.1" + checksum: 6eb15797a5a136a99443e9d8ee1da14a22cc3fdf629272811018a046d2d5abc0c9f60ccc41d7f95c5e04fbd361b4cdae924f79b81f7a11bdb119e15a072c08f7 languageName: node linkType: hard -"@react-native/debugger-shell@npm:0.82.1": - version: 0.82.1 - resolution: "@react-native/debugger-shell@npm:0.82.1" +"@react-native/debugger-shell@npm:0.83.1": + version: 0.83.1 + resolution: "@react-native/debugger-shell@npm:0.83.1" dependencies: cross-spawn: ^7.0.6 fb-dotslash: 0.5.8 - checksum: 9b4ec7f413d5e776a7361f1a5e8ecc7dbc8b56c7fc119fec1895f4821071a7b95b2a3db0cef016614a1eb50288df0282c7f7cf5944e3934bc8694529556f44e8 + checksum: 22f45aeb7f3f9f93c7e9615b66bf158e7f3764d5c31e4aea80b85ffef28369d82a2e6208c7dca80e0ceeadf3fa17616f4c90b8fdbab41826a8c72d4ff194309b languageName: node linkType: hard @@ -3200,13 +3216,13 @@ __metadata: languageName: node linkType: hard -"@react-native/dev-middleware@npm:0.82.1": - version: 0.82.1 - resolution: "@react-native/dev-middleware@npm:0.82.1" +"@react-native/dev-middleware@npm:0.83.1": + version: 0.83.1 + resolution: "@react-native/dev-middleware@npm:0.83.1" dependencies: "@isaacs/ttlcache": ^1.4.1 - "@react-native/debugger-frontend": 0.82.1 - "@react-native/debugger-shell": 0.82.1 + "@react-native/debugger-frontend": 0.83.1 + "@react-native/debugger-shell": 0.83.1 chrome-launcher: ^0.15.2 chromium-edge-launcher: ^0.2.0 connect: ^3.6.5 @@ -3215,8 +3231,8 @@ __metadata: nullthrows: ^1.1.1 open: ^7.0.3 serve-static: ^1.16.2 - ws: ^6.2.3 - checksum: 0fed27cb7d7bd9e2e3b9cd20776000ec730ea6672779ccd971e831c67a4b25adcda9d82e0042d3f37e1311736add0d4bb51519c463ea81a11565a2bac1cee68c + ws: ^7.5.10 + checksum: d8439119cd99a8db0649b97a1f459222f49bb9425e1248d1466e4f7f4a104915d1e6ccc11403a5a0f3aa810eea3aa836f921ff11f44c4d3a06769d96083beb86 languageName: node linkType: hard @@ -3271,10 +3287,10 @@ __metadata: languageName: node linkType: hard -"@react-native/gradle-plugin@npm:0.82.1": - version: 0.82.1 - resolution: "@react-native/gradle-plugin@npm:0.82.1" - checksum: 7e7e2d768a8ff599dba5ef7b0a417e1d14a032a3344cc1e57852d4ebee1587dc877f83ae9dd4beae3b27fe2389d235227df12bd8aaa9be8b6ef1c7784419e0de +"@react-native/gradle-plugin@npm:0.83.1": + version: 0.83.1 + resolution: "@react-native/gradle-plugin@npm:0.83.1" + checksum: dcf126b36fc46d06d2c8e5482a63566aca36273c3b2da79c67e158ea82f25445775456077afc1fbaf0c198d3307aa94bda814d177c31a149fc1ee06ab0614105 languageName: node linkType: hard @@ -3306,10 +3322,10 @@ __metadata: languageName: node linkType: hard -"@react-native/js-polyfills@npm:0.82.1": - version: 0.82.1 - resolution: "@react-native/js-polyfills@npm:0.82.1" - checksum: 271d5bcff95d3867237ae4ec4745247c7048ea950912b3c31c8bbffd801c714509294b04d176c8121389788a192680f482b21e99ab24c9b2dcbce37acfdeaa5f +"@react-native/js-polyfills@npm:0.83.1": + version: 0.83.1 + resolution: "@react-native/js-polyfills@npm:0.83.1" + checksum: 1c3fbceac6371252d6e54f9e76b852bfaec7a7472455f9856467dd73a87b8445eda03fb38fc65bc9abd76606e6e52041c754db41f2a23c74dbf5e052e9af129a languageName: node linkType: hard @@ -3374,10 +3390,10 @@ __metadata: languageName: node linkType: hard -"@react-native/normalize-colors@npm:0.82.1": - version: 0.82.1 - resolution: "@react-native/normalize-colors@npm:0.82.1" - checksum: d180cc6591989a3d490ad4454d63a19ec9be796314632adb29051515eb31e98fbdd12903c00750d4ce023306e159a2498867bf6f25bcf11a8ed48e5486482947 +"@react-native/normalize-colors@npm:0.83.1": + version: 0.83.1 + resolution: "@react-native/normalize-colors@npm:0.83.1" + checksum: dd87c889218522affe58059d424404cee28f168bc3641f015ee2620c55b3e29930d279eed6916f866c166bb53d425cd160ccfaab546a6123b6c74e9931eac5d1 languageName: node linkType: hard @@ -3446,20 +3462,20 @@ __metadata: languageName: node linkType: hard -"@react-native/virtualized-lists@npm:0.82.1": - version: 0.82.1 - resolution: "@react-native/virtualized-lists@npm:0.82.1" +"@react-native/virtualized-lists@npm:0.83.1": + version: 0.83.1 + resolution: "@react-native/virtualized-lists@npm:0.83.1" dependencies: invariant: ^2.2.4 nullthrows: ^1.1.1 peerDependencies: - "@types/react": ^19.1.1 + "@types/react": ^19.2.0 react: "*" react-native: "*" peerDependenciesMeta: "@types/react": optional: true - checksum: 4961af57d477f16c1b7e0b584e9f54cef876bbb738b3e628b5dfc8ddc157f83bbe1b3e9d8a0c426f41018cdec5d1073f2ffe23b830e288c7d8b730753700608a + checksum: 35205e505c53ff95c71434c82d02d11a454c28d603189b84c83207fa121874d3c6e5a0b0605495fbaa6eef797a71aa42df8d1780e2e2c64ee1e6b2548a815e27 languageName: node linkType: hard @@ -3632,11 +3648,11 @@ __metadata: linkType: hard "@rnx-kit/metro-config@npm:^2.0.0": - version: 2.1.2 - resolution: "@rnx-kit/metro-config@npm:2.1.2" + version: 2.2.1 + resolution: "@rnx-kit/metro-config@npm:2.2.1" dependencies: "@rnx-kit/tools-node": ^3.0.0 - "@rnx-kit/tools-react-native": ^2.0.0 + "@rnx-kit/tools-react-native": ^2.3.1 "@rnx-kit/tools-workspaces": ^0.2.0 peerDependencies: "@react-native/metro-config": "*" @@ -3645,32 +3661,32 @@ __metadata: peerDependenciesMeta: "@react-native/metro-config": optional: true - checksum: cd7ce21fe7f0f6ca64dae9394734ecbefc1b786c84914bc19005cd2c4212aa2bb0dfc725fd9ea8349e9954469f64ce316ccfdfa7770edf58d01a5a82ddf143c3 + checksum: 0e6d394ebe877063bef23d8913a6a7a01060e03f0b55dec382cef5b99623e8b0f5b779ec93d5494b0b4126324cd6038debc8fe0d2155b9d8dae4925af190e6a0 languageName: node linkType: hard "@rnx-kit/react-native-host@npm:^0.5.11": - version: 0.5.13 - resolution: "@rnx-kit/react-native-host@npm:0.5.13" + version: 0.5.15 + resolution: "@rnx-kit/react-native-host@npm:0.5.15" peerDependencies: react-native: ">=0.66" - checksum: bfa24b38b5d75bb6977c9758221e4c70a12bef794fd3de0849f1251533505911e62ea29019dfc1569097789ca2f40d063b5891b826e68167131fd5abb1746af3 + checksum: 772ef4d7155fbedcd01de96dd70abb6b0c25d8a8f00e8e26e09deb5ffa0251fd0c3f9eaabdd802ac4710aae01730e5940925088cf1df1e4edf52fe3823d990d6 languageName: node linkType: hard -"@rnx-kit/tools-node@npm:^3.0.0": - version: 3.0.2 - resolution: "@rnx-kit/tools-node@npm:3.0.2" - checksum: 9ece015d4d489950916a1ba9fff91bd2751f0a2d280aaab6c4d156a7be96a1fe4b88da76499540b006c9df15f316dec3ade5de84f87f814ede67513ca5aa0b49 +"@rnx-kit/tools-node@npm:^3.0.0, @rnx-kit/tools-node@npm:^3.0.3": + version: 3.0.3 + resolution: "@rnx-kit/tools-node@npm:3.0.3" + checksum: 658b17db3c52417dfe9fb41f5483f9b74d2d7ab130427b104a740b9cc41aedf727a48e191e5f8c3c5b61b7d662f71fc7571f9f106b3c3adcd8b7ff8df03da881 languageName: node linkType: hard -"@rnx-kit/tools-react-native@npm:^2.0.0, @rnx-kit/tools-react-native@npm:^2.1.0": - version: 2.3.0 - resolution: "@rnx-kit/tools-react-native@npm:2.3.0" +"@rnx-kit/tools-react-native@npm:^2.1.0, @rnx-kit/tools-react-native@npm:^2.3.1": + version: 2.3.2 + resolution: "@rnx-kit/tools-react-native@npm:2.3.2" dependencies: - "@rnx-kit/tools-node": ^3.0.0 - checksum: 91795e3029684e2c33fb63ff04600be98a9a25c1be914267888a2b750423af3f1fbd79f9b421201f84d07f8b0f2ffef3b74e64fdb416542f2d1faaba45275eea + "@rnx-kit/tools-node": ^3.0.3 + checksum: 530caf9f27dc0d948cc62b5b1a3a99935ade9c503aa77864272e2f6450a1645e3fca15801120d0b3f964d781a66872aff7678ca4dda09ae0eaef5cbeb8129bf9 languageName: node linkType: hard @@ -4048,9 +4064,9 @@ __metadata: linkType: hard "@types/lodash@npm:^4.17.5": - version: 4.17.20 - resolution: "@types/lodash@npm:4.17.20" - checksum: dc7bb4653514dd91117a4c4cec2c37e2b5a163d7643445e4757d76a360fabe064422ec7a42dde7450c5e7e0e7e678d5e6eae6d2a919abcddf581d81e63e63839 + version: 4.17.23 + resolution: "@types/lodash@npm:4.17.23" + checksum: 38638641526759688656b9930c0a2714536bdc2b84d5a2d4dc4b7825ba39a74ceedcc9971a9c7511189dad987426135b647616e4f49f2d67893617bdb7c85f84 languageName: node linkType: hard @@ -4088,11 +4104,11 @@ __metadata: linkType: hard "@types/node@npm:*": - version: 24.7.2 - resolution: "@types/node@npm:24.7.2" + version: 25.0.6 + resolution: "@types/node@npm:25.0.6" dependencies: - undici-types: ~7.14.0 - checksum: dd676a9041e36825e9c6917b34105da0c3f390ee95cca8e050a9efb7d55851dcb48d05f23700eb5540a22a8d4fd3da289b4c07a3888aeb74d3304dcb07b813b0 + undici-types: ~7.16.0 + checksum: 21a75e51758e23183c43ad3542681abd35d7ae09dc84e5a3b0a2bcfb5778681ad155023dc86fe8095c692d2823af90ed18d3af0c39d991ef2f246585bff27962 languageName: node linkType: hard @@ -4106,11 +4122,11 @@ __metadata: linkType: hard "@types/node@npm:^20.14.7": - version: 20.19.21 - resolution: "@types/node@npm:20.19.21" + version: 20.19.28 + resolution: "@types/node@npm:20.19.28" dependencies: undici-types: ~6.21.0 - checksum: 79eeb55b109a54e212d963870d0a9184bbc1b6ed07a26a52d9aa87c15f594648d3832876b37635e5fb5c6206acd9240209394579d4e6ec0870d1b78cfa4c13d2 + checksum: c59372e6cfd8c315dda31619fef41085550412e4911ca0d6995c3340f7e55cf17772310d0669a25e5bd5458e98cdb8a30ec03bc822014d94ebbe91e6f7b5edb4 languageName: node linkType: hard @@ -4168,11 +4184,11 @@ __metadata: linkType: hard "@types/react-dom@npm:^19.2.2": - version: 19.2.2 - resolution: "@types/react-dom@npm:19.2.2" + version: 19.2.3 + resolution: "@types/react-dom@npm:19.2.3" peerDependencies: "@types/react": ^19.2.0 - checksum: a9e16d59f89b2794a3b062766de2eedf98cf66e59de7560de5beb95fb8742161b2dc4751530380c38d51320bc99b8a1d66fa113cee9b5d0f138ef6fb49fb4ce9 + checksum: b9c548f7378979cd8384444ae6c96f7a933b98e341c271c33e74231f27bf3082f04ad7c2927f1b1e6d8af35ccf83e549fce4978ebe0a02ded5a8803aa5f80e06 languageName: node linkType: hard @@ -4196,11 +4212,11 @@ __metadata: linkType: hard "@types/react-reconciler@npm:^0.32.0": - version: 0.32.2 - resolution: "@types/react-reconciler@npm:0.32.2" + version: 0.32.3 + resolution: "@types/react-reconciler@npm:0.32.3" peerDependencies: "@types/react": "*" - checksum: 95a26656510b4491d857d78c1714a441e899021dca228086c5979c569c6a44832600ea156efbd7d3cb75ed052e35431cc294d46ce0b0f4a7c59915d59e6355e2 + checksum: 0540cd5dc836952524834c1c242ccd4f8e48b40a2799157cd2c0216bef423c4682c5b72bcd84920a10732f005a8fa480b6b6b806d9e98c878727f87df399a573 languageName: node linkType: hard @@ -4214,12 +4230,12 @@ __metadata: linkType: hard "@types/react@npm:^18.2.44": - version: 18.3.26 - resolution: "@types/react@npm:18.3.26" + version: 18.3.27 + resolution: "@types/react@npm:18.3.27" dependencies: "@types/prop-types": "*" - csstype: ^3.0.2 - checksum: ecff0da9f9a1d1663152ffd1283a6e3f20e1255dedc99259d535f01ac0916535f7bcd0fd1783f6cec1729fe5cfe4a79e78eb9a4b1447af81ae86561a1bc66f6d + csstype: ^3.2.2 + checksum: c74d0ab5155226998a52b568f6280536205f8fe4317f77bd5d5258bc131cc9134a2db68dc818cb8e8402a2f229843c4a5bde339faf7e64d441630e569a9e5421 languageName: node linkType: hard @@ -4296,20 +4312,20 @@ __metadata: linkType: hard "@types/yargs@npm:^15.0.0": - version: 15.0.19 - resolution: "@types/yargs@npm:15.0.19" + version: 15.0.20 + resolution: "@types/yargs@npm:15.0.20" dependencies: "@types/yargs-parser": "*" - checksum: 6a509db36304825674f4f00300323dce2b4d850e75819c3db87e9e9f213ac2c4c6ed3247a3e4eed6e8e45b3f191b133a356d3391dd694d9ea27a0507d914ef4c + checksum: 7e33bed59f7d44f32f6c0f6da07e8aa79605d725fcdd223febe45ccfa5254da3bc0f70242553021fd9491b637ae99ddee84e5dd05d1771a71986619a73cbf897 languageName: node linkType: hard "@types/yargs@npm:^17.0.8": - version: 17.0.33 - resolution: "@types/yargs@npm:17.0.33" + version: 17.0.35 + resolution: "@types/yargs@npm:17.0.35" dependencies: "@types/yargs-parser": "*" - checksum: ee013f257472ab643cb0584cf3e1ff9b0c44bca1c9ba662395300a7f1a6c55fa9d41bd40ddff42d99f5d95febb3907c9ff600fbcb92dadbec22c6a76de7e1236 + checksum: ebf1f5373388cfcbf9cfb5e56ce7a77c0ba2450420f26f3701010ca92df48cce7e14e4245ed1f17178a38ff8702467a6f4047742775b8e2fd06dec8f4f3501ce languageName: node linkType: hard @@ -4370,23 +4386,22 @@ __metadata: linkType: hard "@typescript-eslint/eslint-plugin@npm:^8.44.0": - version: 8.46.1 - resolution: "@typescript-eslint/eslint-plugin@npm:8.46.1" - dependencies: - "@eslint-community/regexpp": ^4.10.0 - "@typescript-eslint/scope-manager": 8.46.1 - "@typescript-eslint/type-utils": 8.46.1 - "@typescript-eslint/utils": 8.46.1 - "@typescript-eslint/visitor-keys": 8.46.1 - graphemer: ^1.4.0 - ignore: ^7.0.0 + version: 8.52.0 + resolution: "@typescript-eslint/eslint-plugin@npm:8.52.0" + dependencies: + "@eslint-community/regexpp": ^4.12.2 + "@typescript-eslint/scope-manager": 8.52.0 + "@typescript-eslint/type-utils": 8.52.0 + "@typescript-eslint/utils": 8.52.0 + "@typescript-eslint/visitor-keys": 8.52.0 + ignore: ^7.0.5 natural-compare: ^1.4.0 - ts-api-utils: ^2.1.0 + ts-api-utils: ^2.4.0 peerDependencies: - "@typescript-eslint/parser": ^8.46.1 + "@typescript-eslint/parser": ^8.52.0 eslint: ^8.57.0 || ^9.0.0 typescript: ">=4.8.4 <6.0.0" - checksum: c2c3191632bdf62b2202e2a1c81df08e17d8128b5d5008a808a6dd39143fcc53ce4d9a7ab613aa43cac1748246e7f752b3d8d0aef1f77f605079797427db40a9 + checksum: 5ddeb82d9ef17b19a108e14c16ebd82fcc3517ee48adc76bab621188a335b750d7f7286d135c3ff7dcf3cad7c357e2769d0fb11134fb06a1ce999d214e32b3d8 languageName: node linkType: hard @@ -4426,31 +4441,31 @@ __metadata: linkType: hard "@typescript-eslint/parser@npm:^8.44.0": - version: 8.46.1 - resolution: "@typescript-eslint/parser@npm:8.46.1" + version: 8.52.0 + resolution: "@typescript-eslint/parser@npm:8.52.0" dependencies: - "@typescript-eslint/scope-manager": 8.46.1 - "@typescript-eslint/types": 8.46.1 - "@typescript-eslint/typescript-estree": 8.46.1 - "@typescript-eslint/visitor-keys": 8.46.1 - debug: ^4.3.4 + "@typescript-eslint/scope-manager": 8.52.0 + "@typescript-eslint/types": 8.52.0 + "@typescript-eslint/typescript-estree": 8.52.0 + "@typescript-eslint/visitor-keys": 8.52.0 + debug: ^4.4.3 peerDependencies: eslint: ^8.57.0 || ^9.0.0 typescript: ">=4.8.4 <6.0.0" - checksum: 0e4ae0b7a33f1dabc6d027ed299463d901ea48aa20373692a5f67ba2848f14ea322a6a0fed1c86f8936002fc3262d6d7f7e439ea4e5fdf6871a1c0571f011acf + checksum: ec421ea73847fdc6da54346cc01db9f460bcb6329e36d7f5fda7567e1f3dc510a64233e614350cdfec876ab2cee1bc38f00caa3157c5f047eea2395d45c07d87 languageName: node linkType: hard -"@typescript-eslint/project-service@npm:8.46.1": - version: 8.46.1 - resolution: "@typescript-eslint/project-service@npm:8.46.1" +"@typescript-eslint/project-service@npm:8.52.0": + version: 8.52.0 + resolution: "@typescript-eslint/project-service@npm:8.52.0" dependencies: - "@typescript-eslint/tsconfig-utils": ^8.46.1 - "@typescript-eslint/types": ^8.46.1 - debug: ^4.3.4 + "@typescript-eslint/tsconfig-utils": ^8.52.0 + "@typescript-eslint/types": ^8.52.0 + debug: ^4.4.3 peerDependencies: typescript: ">=4.8.4 <6.0.0" - checksum: c03bc00fd678ac920e51110546495467d6939dbc7a3d08c2e08f709a0e429924eb8fbefebf42abf246e84a569584931a42783c4926bcbdbf8adb872975c062d1 + checksum: f27900d176aeb9a9c6c0f241011b9f55971015f62bc123d271f1046071834702e0caa7bd82ade4e24e5e48af1696fced0c53444d8f763e66fae7ead78dfd0a5d languageName: node linkType: hard @@ -4474,22 +4489,22 @@ __metadata: languageName: node linkType: hard -"@typescript-eslint/scope-manager@npm:8.46.1": - version: 8.46.1 - resolution: "@typescript-eslint/scope-manager@npm:8.46.1" +"@typescript-eslint/scope-manager@npm:8.52.0": + version: 8.52.0 + resolution: "@typescript-eslint/scope-manager@npm:8.52.0" dependencies: - "@typescript-eslint/types": 8.46.1 - "@typescript-eslint/visitor-keys": 8.46.1 - checksum: ab2789a571c4db5d12292e993f66f720af1f2584d950959abf007296906a038e48a443206896c535b9b4f7d225658f5886910d78ea804ed22829079d82e7ba09 + "@typescript-eslint/types": 8.52.0 + "@typescript-eslint/visitor-keys": 8.52.0 + checksum: e28a58da6a4ff32436f823e48674a16f26dfbd81126f4c5c785d66958c2a65409dce3998a7f3e4ca366c1cda6fed7e9cace6a37ab0e7848e30ff0d550fad1c64 languageName: node linkType: hard -"@typescript-eslint/tsconfig-utils@npm:8.46.1, @typescript-eslint/tsconfig-utils@npm:^8.46.1": - version: 8.46.1 - resolution: "@typescript-eslint/tsconfig-utils@npm:8.46.1" +"@typescript-eslint/tsconfig-utils@npm:8.52.0, @typescript-eslint/tsconfig-utils@npm:^8.52.0": + version: 8.52.0 + resolution: "@typescript-eslint/tsconfig-utils@npm:8.52.0" peerDependencies: typescript: ">=4.8.4 <6.0.0" - checksum: 3251b631db3399e491ef5da5dee782e5eb30503d017bfc3736825448d7fb557956467d5ed500908f9cf92c4c87b1960f12db70986d1735009fd9816ba0bd7d6e + checksum: 0538a4092ece026a1567100f5cb019bb947268a246eb5a222abfcc73e91c3c1ee734d21c411f200a52fed5aa050067cee76bd469d04954664374b1f752ab6aea languageName: node linkType: hard @@ -4527,19 +4542,19 @@ __metadata: languageName: node linkType: hard -"@typescript-eslint/type-utils@npm:8.46.1": - version: 8.46.1 - resolution: "@typescript-eslint/type-utils@npm:8.46.1" +"@typescript-eslint/type-utils@npm:8.52.0": + version: 8.52.0 + resolution: "@typescript-eslint/type-utils@npm:8.52.0" dependencies: - "@typescript-eslint/types": 8.46.1 - "@typescript-eslint/typescript-estree": 8.46.1 - "@typescript-eslint/utils": 8.46.1 - debug: ^4.3.4 - ts-api-utils: ^2.1.0 + "@typescript-eslint/types": 8.52.0 + "@typescript-eslint/typescript-estree": 8.52.0 + "@typescript-eslint/utils": 8.52.0 + debug: ^4.4.3 + ts-api-utils: ^2.4.0 peerDependencies: eslint: ^8.57.0 || ^9.0.0 typescript: ">=4.8.4 <6.0.0" - checksum: aa1f7a0eaedc12f50e35105274a868add5bce1e9bc55fbdfe69a13e8b0538982787f34f56f1964f59059049aa797d53f2be50bf1da9dbad1a661e58e0d9eb33c + checksum: 172d22b4b740a9b367b0b079c8f1e61cb6610db6b31e84f37e021430941f1104fcea68391bc65a84e469386aa46d80e17a14f67bc082d15358b928d9c9161144 languageName: node linkType: hard @@ -4557,10 +4572,10 @@ __metadata: languageName: node linkType: hard -"@typescript-eslint/types@npm:8.46.1, @typescript-eslint/types@npm:^8.46.1": - version: 8.46.1 - resolution: "@typescript-eslint/types@npm:8.46.1" - checksum: 28ded6e2f952ccc54f54f9d880237dfccc814a8601cc56cbfbec9879e695ad831023d07bc8989ce4b9ca8891d50bb3f19af80f50a9512ee1600013b7b84b1d77 +"@typescript-eslint/types@npm:8.52.0, @typescript-eslint/types@npm:^8.52.0": + version: 8.52.0 + resolution: "@typescript-eslint/types@npm:8.52.0" + checksum: 3bf4058a46ea2bb31dc8a828916cac63719f0dab33d5351e43012e6ad9c47c815856a3b4858d9fb0403d1baac6409cead73f64b7391521f11f20e52444af2961 languageName: node linkType: hard @@ -4601,23 +4616,22 @@ __metadata: languageName: node linkType: hard -"@typescript-eslint/typescript-estree@npm:8.46.1": - version: 8.46.1 - resolution: "@typescript-eslint/typescript-estree@npm:8.46.1" +"@typescript-eslint/typescript-estree@npm:8.52.0": + version: 8.52.0 + resolution: "@typescript-eslint/typescript-estree@npm:8.52.0" dependencies: - "@typescript-eslint/project-service": 8.46.1 - "@typescript-eslint/tsconfig-utils": 8.46.1 - "@typescript-eslint/types": 8.46.1 - "@typescript-eslint/visitor-keys": 8.46.1 - debug: ^4.3.4 - fast-glob: ^3.3.2 - is-glob: ^4.0.3 - minimatch: ^9.0.4 - semver: ^7.6.0 - ts-api-utils: ^2.1.0 + "@typescript-eslint/project-service": 8.52.0 + "@typescript-eslint/tsconfig-utils": 8.52.0 + "@typescript-eslint/types": 8.52.0 + "@typescript-eslint/visitor-keys": 8.52.0 + debug: ^4.4.3 + minimatch: ^9.0.5 + semver: ^7.7.3 + tinyglobby: ^0.2.15 + ts-api-utils: ^2.4.0 peerDependencies: typescript: ">=4.8.4 <6.0.0" - checksum: d5968a1b9fa8f9469b260b9f0d85cbf16aecd65737a2e78dea0a8b00114370973b9acc6d619ebdec7d8a5bfceb7649d6726e902b462fe003ea627b2b13bca25a + checksum: 16fbe17f4ff8cfcf5f58ce09c44ef1c487244a3303b9b3dfd25cba9664a630b482cd6d2f276560f96a481f55932c8d3f9dcda38fded9d387c05cfc60a6288b83 languageName: node linkType: hard @@ -4653,18 +4667,18 @@ __metadata: languageName: node linkType: hard -"@typescript-eslint/utils@npm:8.46.1, @typescript-eslint/utils@npm:^6.0.0 || ^7.0.0 || ^8.0.0": - version: 8.46.1 - resolution: "@typescript-eslint/utils@npm:8.46.1" +"@typescript-eslint/utils@npm:8.52.0, @typescript-eslint/utils@npm:^6.0.0 || ^7.0.0 || ^8.0.0": + version: 8.52.0 + resolution: "@typescript-eslint/utils@npm:8.52.0" dependencies: - "@eslint-community/eslint-utils": ^4.7.0 - "@typescript-eslint/scope-manager": 8.46.1 - "@typescript-eslint/types": 8.46.1 - "@typescript-eslint/typescript-estree": 8.46.1 + "@eslint-community/eslint-utils": ^4.9.1 + "@typescript-eslint/scope-manager": 8.52.0 + "@typescript-eslint/types": 8.52.0 + "@typescript-eslint/typescript-estree": 8.52.0 peerDependencies: eslint: ^8.57.0 || ^9.0.0 typescript: ">=4.8.4 <6.0.0" - checksum: 2268b31a50960825556ba9bd22a231b97aa65fa489b8ddd697931224448efc9f1e429492303de99f5abbfbfca58fb6495834451fdfbcaa9c4c1446d2f557c702 + checksum: 08392eb917b5ab32eb812f96135e674af233e943cd150e3073d67b3df3abd958ec9959e3efb230978a5b150f9ea8fb05706323c675ff182976d9a307eb2503bf languageName: node linkType: hard @@ -4688,13 +4702,13 @@ __metadata: languageName: node linkType: hard -"@typescript-eslint/visitor-keys@npm:8.46.1": - version: 8.46.1 - resolution: "@typescript-eslint/visitor-keys@npm:8.46.1" +"@typescript-eslint/visitor-keys@npm:8.52.0": + version: 8.52.0 + resolution: "@typescript-eslint/visitor-keys@npm:8.52.0" dependencies: - "@typescript-eslint/types": 8.46.1 + "@typescript-eslint/types": 8.52.0 eslint-visitor-keys: ^4.2.1 - checksum: 18ce08a42cf0e0ddbb3c48a9084d320a67991311830e29cf79f33ecfdadf4680f8d10807e86551b49df55ccf023c24868ba9c85cc688a6075374f14b6fff59c4 + checksum: 8b071589a5480f8408aa1564648747e3aa31f4c39ddea1f0a43b06faf40b2aba04696b5c64b4f432f58b55af1241cdba23718af1a0f0b81f70609ca0b9716ae2 languageName: node linkType: hard @@ -4834,9 +4848,9 @@ __metadata: linkType: hard "@webgpu/types@npm:^0.1.42": - version: 0.1.65 - resolution: "@webgpu/types@npm:0.1.65" - checksum: 14bd01c725eaab0c4b80129a37f2cb11a92d5d3a60396f132affc2f30ae0995d8e2351b993c4cc3b8e0792e85d6a8edd1511e1072dd8c89911653701eaa388a9 + version: 0.1.68 + resolution: "@webgpu/types@npm:0.1.68" + checksum: 8d9a70eed269db83805b9ea8d922db0c0735502c1b67f2b12d30912b6e9de5f4a004b8afa68f15573b4c1624735a8ecc7d78c25488f1cb4a256b85997832c4e2 languageName: node linkType: hard @@ -4893,10 +4907,10 @@ __metadata: languageName: unknown linkType: soft -"abbrev@npm:^3.0.0": - version: 3.0.1 - resolution: "abbrev@npm:3.0.1" - checksum: e70b209f5f408dd3a3bbd0eec4b10a2ffd64704a4a3821d0969d84928cc490a8eb60f85b78a95622c1841113edac10161c62e52f5e7d0027aa26786a8136e02e +"abbrev@npm:^4.0.0": + version: 4.0.0 + resolution: "abbrev@npm:4.0.0" + checksum: d0344b63d28e763f259b4898c41bdc92c08e9d06d0da5617d0bbe4d78244e46daea88c510a2f9472af59b031d9060ec1a999653144e793fd029a59dae2f56dc8 languageName: node linkType: hard @@ -4909,7 +4923,7 @@ __metadata: languageName: node linkType: hard -"accepts@npm:^1.3.7, accepts@npm:~1.3.7": +"accepts@npm:^1.3.7, accepts@npm:~1.3.8": version: 1.3.8 resolution: "accepts@npm:1.3.8" dependencies: @@ -5494,20 +5508,20 @@ __metadata: linkType: hard "bare-events@npm:^2.5.4, bare-events@npm:^2.7.0": - version: 2.8.0 - resolution: "bare-events@npm:2.8.0" + version: 2.8.2 + resolution: "bare-events@npm:2.8.2" peerDependencies: bare-abort-controller: "*" peerDependenciesMeta: bare-abort-controller: optional: true - checksum: e7debb8d6a668232b07e645895ee569b15005bd99a60966800301dc45e9a687c8a403460dad69ec4b3200d623250210e3ac81181e2f024591ee13c698e77477c + checksum: 97e6fc825bc984363a1f695c9a962b1b9f0ea467baa95d7059565a0aa31f4b5fc0f5eb71c087456ae3a436f39fce14a6147a12dd63aac0ff1d20cc5ad64cd780 languageName: node linkType: hard "bare-fs@npm:^4.0.1": - version: 4.4.10 - resolution: "bare-fs@npm:4.4.10" + version: 4.5.2 + resolution: "bare-fs@npm:4.5.2" dependencies: bare-events: ^2.5.4 bare-path: ^3.0.0 @@ -5519,7 +5533,7 @@ __metadata: peerDependenciesMeta: bare-buffer: optional: true - checksum: 7a3990b7e76ccdfda39068cd4f9b9be79338fd06b661748917f59e633f65edcd6cc63399f69379ee53ba6a6b6d5244795732329cdfef9e11193cd50c07c3b878 + checksum: 3812b86ee476c029c797d69c9d692aec6fc652bc63141e6520b004cbe196cdcbaf645fd8b71c0ba3aec85f7995a5e49b9cfe77fa0e53a4a7afb175948456de3f languageName: node linkType: hard @@ -5557,11 +5571,11 @@ __metadata: linkType: hard "bare-url@npm:^2.2.2": - version: 2.3.0 - resolution: "bare-url@npm:2.3.0" + version: 2.3.2 + resolution: "bare-url@npm:2.3.2" dependencies: bare-path: ^3.0.0 - checksum: 3bc031d05bd35f1cc48e276b6a9c284c18b133c85575d758a44642d30a191e7d5548d469b2dc55e384cbabb3a4f44be5cafbad8653b330fe6bcefe6d3ec81c73 + checksum: 7b2a6335a55a010ffcc863f62cc5bfaa216b383bc05a8e7fb30caccb5600e09d403ad482fc671582eba531bbca4a891dba8eefa866f2e2d222b0a72f2460c340 languageName: node linkType: hard @@ -5572,19 +5586,19 @@ __metadata: languageName: node linkType: hard -"baseline-browser-mapping@npm:^2.8.9": - version: 2.8.16 - resolution: "baseline-browser-mapping@npm:2.8.16" +"baseline-browser-mapping@npm:^2.9.0, baseline-browser-mapping@npm:^2.9.14": + version: 2.9.14 + resolution: "baseline-browser-mapping@npm:2.9.14" bin: baseline-browser-mapping: dist/cli.js - checksum: 929b3f2b5f4beb3b9e02b660a4a8b24f62e43cc7efdc38a726ef061137f9529d3372e1c70298eacde191ac70f5defd21ae4a29ff9e470c4c2b7fd7be68320241 + checksum: c760c7cb5090b17c91aea2d7ad633d61491fea77f4eea1b2141b2b0d441ac887d3b433494c50e1490c2ba403e62e05606ad438a396c60bb41562c898a9fd7c6d languageName: node linkType: hard "basic-ftp@npm:^5.0.2": - version: 5.0.5 - resolution: "basic-ftp@npm:5.0.5" - checksum: bc82d1c1c61cd838eaca96d68ece888bacf07546642fb6b9b8328ed410756f5935f8cf43a42cb44bb343e0565e28e908adc54c298bd2f1a6e0976871fb11fec6 + version: 5.1.0 + resolution: "basic-ftp@npm:5.1.0" + checksum: 883670e2bb7bc89e542f2f4aa649dab142b4ac852195dea3e08f892e4ac2d0772bde1f689fd8cf6e7113535bb0b61d9ed6351334f5e5b56a17cac64a9b58d351 languageName: node linkType: hard @@ -5634,18 +5648,18 @@ __metadata: languageName: node linkType: hard -"browserslist@npm:^4.20.4, browserslist@npm:^4.24.0, browserslist@npm:^4.26.3": - version: 4.26.3 - resolution: "browserslist@npm:4.26.3" +"browserslist@npm:^4.20.4, browserslist@npm:^4.24.0, browserslist@npm:^4.28.0": + version: 4.28.1 + resolution: "browserslist@npm:4.28.1" dependencies: - baseline-browser-mapping: ^2.8.9 - caniuse-lite: ^1.0.30001746 - electron-to-chromium: ^1.5.227 - node-releases: ^2.0.21 - update-browserslist-db: ^1.1.3 + baseline-browser-mapping: ^2.9.0 + caniuse-lite: ^1.0.30001759 + electron-to-chromium: ^1.5.263 + node-releases: ^2.0.27 + update-browserslist-db: ^1.2.0 bin: browserslist: cli.js - checksum: aa5bbcda9db1eeb9952b4c2f11f9a5a2247da7bcce7fa14d3cc215e67246a93394eda2f86378a41c3f73e6e1a1561bf0e7eade93c5392cb6d37bc66f70d0c53f + checksum: 895357d912ae5a88a3fa454d2d280e9869e13432df30ca8918e206c0783b3b59375b178fdaf16d0041a1cf21ac45c8eb0a20f96f73dbd9662abf4cf613177a1e languageName: node linkType: hard @@ -5699,23 +5713,22 @@ __metadata: languageName: node linkType: hard -"cacache@npm:^19.0.1": - version: 19.0.1 - resolution: "cacache@npm:19.0.1" +"cacache@npm:^20.0.1": + version: 20.0.3 + resolution: "cacache@npm:20.0.3" dependencies: - "@npmcli/fs": ^4.0.0 + "@npmcli/fs": ^5.0.0 fs-minipass: ^3.0.0 - glob: ^10.2.2 - lru-cache: ^10.0.1 + glob: ^13.0.0 + lru-cache: ^11.1.0 minipass: ^7.0.3 minipass-collect: ^2.0.1 minipass-flush: ^1.0.5 minipass-pipeline: ^1.2.4 p-map: ^7.0.2 - ssri: ^12.0.0 - tar: ^7.4.3 - unique-filename: ^4.0.0 - checksum: e95684717de6881b4cdaa949fa7574e3171946421cd8291769dd3d2417dbf7abf4aa557d1f968cca83dcbc95bed2a281072b09abfc977c942413146ef7ed4525 + ssri: ^13.0.0 + unique-filename: ^5.0.0 + checksum: 595e6b91d72972d596e1e9ccab8ddbf08b773f27240220b1b5b1b7b3f52173cfbcf095212e5d7acd86c3bd453c28e69b116469889c511615ef3589523d542639 languageName: node linkType: hard @@ -5809,10 +5822,10 @@ __metadata: languageName: node linkType: hard -"caniuse-lite@npm:^1.0.30001746": - version: 1.0.30001750 - resolution: "caniuse-lite@npm:1.0.30001750" - checksum: 4a50a24ceed75cde8a8cd8b370a8c044463c26cc171eb30d1e738cd55b328c599b6e2602ec79e3e9d3b15d56e3cc980f02dd2f82784f91410544fa49c6d09cad +"caniuse-lite@npm:^1.0.30001759": + version: 1.0.30001764 + resolution: "caniuse-lite@npm:1.0.30001764" + checksum: 10cfa46c5d11659d7c9c5151213b00b27876da66723f3c757e3f3294de1c477d3a89fff0efe03d0d787727fea2ca27910a0b68a5ac69483aedd474827eb52b96 languageName: node linkType: hard @@ -6030,9 +6043,9 @@ __metadata: linkType: hard "collect-v8-coverage@npm:^1.0.0": - version: 1.0.2 - resolution: "collect-v8-coverage@npm:1.0.2" - checksum: c10f41c39ab84629d16f9f6137bc8a63d332244383fc368caf2d2052b5e04c20cd1fd70f66fcf4e2422b84c8226598b776d39d5f2d2a51867cc1ed5d1982b4da + version: 1.0.3 + resolution: "collect-v8-coverage@npm:1.0.3" + checksum: ed1d1ebc9c05e7263fffa3ad6440031db6a1fdd9f574435aa689effcdfe9f2b93aba8ec600f9c7b99124cd6ff5d9415c17961d84ae829a72251a4fe668a49b63 languageName: node linkType: hard @@ -6197,11 +6210,11 @@ __metadata: linkType: hard "core-js-compat@npm:^3.43.0": - version: 3.46.0 - resolution: "core-js-compat@npm:3.46.0" + version: 3.47.0 + resolution: "core-js-compat@npm:3.47.0" dependencies: - browserslist: ^4.26.3 - checksum: 16d381c51e34d38ecc65d429d5a5c1dbd198f70b5a0a6256a3a41dcb8523e07f0a8682f6349298a55ff6e9d039e131d67b07fe863047a28672ae5f10373c57cf + browserslist: ^4.28.0 + checksum: 425c8cb4c3277a11f3d7d4752c53e5903892635126ed1cdc326a1cd7d961606c5d2c951493f1c783e624f9cdc1ec791c6db68dc19988d68f112d7d82a4c39c9a languageName: node linkType: hard @@ -6324,10 +6337,10 @@ __metadata: languageName: node linkType: hard -"csstype@npm:^3.0.2": - version: 3.1.3 - resolution: "csstype@npm:3.1.3" - checksum: 8db785cc92d259102725b3c694ec0c823f5619a84741b5c7991b8ad135dfaa66093038a1cc63e03361a6cd28d122be48f2106ae72334e067dd619a51f49eddf7 +"csstype@npm:^3.2.2": + version: 3.2.3 + resolution: "csstype@npm:3.2.3" + checksum: cb882521b3398958a1ce6ca98c011aec0bde1c77ecaf8a1dd4db3b112a189939beae3b1308243b2fe50fc27eb3edeb0f73a5a4d91d928765dc6d5ecc7bda92ee languageName: node linkType: hard @@ -6697,9 +6710,9 @@ __metadata: linkType: hard "dayjs@npm:^1.8.15": - version: 1.11.18 - resolution: "dayjs@npm:1.11.18" - checksum: cc90054bad30ab011417a7a474b2ffa70e7a28ca6f834d7e86fe53a408a40a14c174f26155072628670e9eda4c48c4ed0d847d2edf83d47c0bfb78be15bbf2dd + version: 1.11.19 + resolution: "dayjs@npm:1.11.19" + checksum: dfafcca2c67cc6e542fd880d77f1d91667efd323edc28f0487b470b184a11cc97696163ed5be1142ea2a031045b27a0d0555e72f60a63275e0e0401ac24bea5d languageName: node linkType: hard @@ -6772,14 +6785,14 @@ __metadata: linkType: hard "dedent@npm:^1.0.0": - version: 1.7.0 - resolution: "dedent@npm:1.7.0" + version: 1.7.1 + resolution: "dedent@npm:1.7.1" peerDependencies: babel-plugin-macros: ^3.1.0 peerDependenciesMeta: babel-plugin-macros: optional: true - checksum: e07a21b7ae078f2c6502b46e6e9fb3f5592dc48ad8c6142d501d1a85ee04cd3add5d62260a9b20f87674a80edada2032918ca0718597752c5cb90b36ab5066ec + checksum: 66dc34f61dabc85597a95ce8678c93f0793ec437cc6510e0e6c14da159ce15c6209dee483aa3cccb3238a2f708382c4d26eeb1a47a4c1831a0b7bb56873041cf languageName: node linkType: hard @@ -6905,7 +6918,7 @@ __metadata: languageName: node linkType: hard -"depd@npm:2.0.0": +"depd@npm:2.0.0, depd@npm:~2.0.0": version: 2.0.0 resolution: "depd@npm:2.0.0" checksum: abbe19c768c97ee2eed6282d8ce3031126662252c58d711f646921c9623f9052e3e1906443066beec1095832f534e57c523b7333f8e7e0d93051ab6baef5ab3a @@ -6983,10 +6996,10 @@ __metadata: languageName: node linkType: hard -"electron-to-chromium@npm:^1.5.227": - version: 1.5.235 - resolution: "electron-to-chromium@npm:1.5.235" - checksum: 95ce99421bac64614f0c4439cd361aa6e2ba4618f2192bef6c06d366da8b5130b2dadb30c237c85404cea4865ab56a7c76ae42ca8c1a1410e32d39165a3d9e81 +"electron-to-chromium@npm:^1.5.263": + version: 1.5.267 + resolution: "electron-to-chromium@npm:1.5.267" + checksum: 923a21ea4c3f2536eb7ccf80e92d9368a2e5a13e6deccb1d94c31b5a5b4e10e722149b85db9892e9819150f1c43462692a92dc85ba0c205a4eb578e173b3ab36 languageName: node linkType: hard @@ -7051,11 +7064,11 @@ __metadata: linkType: hard "envinfo@npm:^7.10.0": - version: 7.18.0 - resolution: "envinfo@npm:7.18.0" + version: 7.21.0 + resolution: "envinfo@npm:7.21.0" bin: envinfo: dist/cli.js - checksum: 1a4d0094d9aede737e3a1ea59756d6dff440ba2a7e87509cae3a8f69ef8748cba952e9a6c0f66e54bc12a90902d32a082b0934dfc156ca4252e18fe5a0c4d11d + checksum: c9526266810a328396c387c0580d6fc10f6ce8464074ae6eaef6798e2a05b5800b480b2eaf739cf523e3bfb407baba2ef23ff8edebb76c2b8fa7fbac995b3b9b languageName: node linkType: hard @@ -7085,18 +7098,18 @@ __metadata: linkType: hard "errorhandler@npm:^1.5.1": - version: 1.5.1 - resolution: "errorhandler@npm:1.5.1" + version: 1.5.2 + resolution: "errorhandler@npm:1.5.2" dependencies: - accepts: ~1.3.7 + accepts: ~1.3.8 escape-html: ~1.0.3 - checksum: 73b7abb08fb751107e9bebecc33c40c0641a54be8bda8e4a045f3f5cb7b805041927fef5629ea39b1737799eb52fe2499ca531f11ac51b0294ccc4667d72cb91 + checksum: 7ce0a598cc2c52840e32b46d2da8c7b0a4594aa67e93db46112cf791d4c8a4a1299af7f7aa65253d2e9d42af4d275c96387c0d186427df5ee93d33670bdac541 languageName: node linkType: hard -"es-abstract@npm:^1.17.5, es-abstract@npm:^1.23.2, es-abstract@npm:^1.23.3, es-abstract@npm:^1.23.5, es-abstract@npm:^1.23.6, es-abstract@npm:^1.23.9, es-abstract@npm:^1.24.0": - version: 1.24.0 - resolution: "es-abstract@npm:1.24.0" +"es-abstract@npm:^1.17.5, es-abstract@npm:^1.23.2, es-abstract@npm:^1.23.3, es-abstract@npm:^1.23.5, es-abstract@npm:^1.23.6, es-abstract@npm:^1.23.9, es-abstract@npm:^1.24.0, es-abstract@npm:^1.24.1": + version: 1.24.1 + resolution: "es-abstract@npm:1.24.1" dependencies: array-buffer-byte-length: ^1.0.2 arraybuffer.prototype.slice: ^1.0.4 @@ -7152,7 +7165,7 @@ __metadata: typed-array-length: ^1.0.7 unbox-primitive: ^1.1.0 which-typed-array: ^1.1.19 - checksum: 06b3d605e56e3da9d16d4db2629a42dac1ca31f2961a41d15c860422a266115e865b43e82d6b9da81a0fabbbb65ebc12fb68b0b755bc9dbddacb6bf7450e96df + checksum: 84896f97ac812bd9d884f1e5372ae71dbdbef364d2e178defdb712a0aae8c9df66f447b472ad54e3e1fa5aa9a84f3c11b5f35007d629cf975699c5f885aeb0c5 languageName: node linkType: hard @@ -7171,26 +7184,26 @@ __metadata: linkType: hard "es-iterator-helpers@npm:^1.2.1": - version: 1.2.1 - resolution: "es-iterator-helpers@npm:1.2.1" + version: 1.2.2 + resolution: "es-iterator-helpers@npm:1.2.2" dependencies: call-bind: ^1.0.8 - call-bound: ^1.0.3 + call-bound: ^1.0.4 define-properties: ^1.2.1 - es-abstract: ^1.23.6 + es-abstract: ^1.24.1 es-errors: ^1.3.0 - es-set-tostringtag: ^2.0.3 + es-set-tostringtag: ^2.1.0 function-bind: ^1.1.2 - get-intrinsic: ^1.2.6 + get-intrinsic: ^1.3.0 globalthis: ^1.0.4 gopd: ^1.2.0 has-property-descriptors: ^1.0.2 has-proto: ^1.2.0 has-symbols: ^1.1.0 internal-slot: ^1.1.0 - iterator.prototype: ^1.1.4 + iterator.prototype: ^1.1.5 safe-array-concat: ^1.1.3 - checksum: 952808dd1df3643d67ec7adf20c30b36e5eecadfbf36354e6f39ed3266c8e0acf3446ce9bc465e38723d613cb1d915c1c07c140df65bdce85da012a6e7bda62b + checksum: 33e148b592d41630ea53b20ec8d6f2ca7516871c43bdf1619fdb4c770361c625f134ff4276332d6e08e9f59d1cd75532a74723f56176c4599e0387f51750e286 languageName: node linkType: hard @@ -7203,7 +7216,7 @@ __metadata: languageName: node linkType: hard -"es-set-tostringtag@npm:^2.0.3, es-set-tostringtag@npm:^2.1.0": +"es-set-tostringtag@npm:^2.1.0": version: 2.1.0 resolution: "es-set-tostringtag@npm:2.1.0" dependencies: @@ -7235,36 +7248,36 @@ __metadata: languageName: node linkType: hard -"esbuild@npm:~0.25.0": - version: 0.25.10 - resolution: "esbuild@npm:0.25.10" - dependencies: - "@esbuild/aix-ppc64": 0.25.10 - "@esbuild/android-arm": 0.25.10 - "@esbuild/android-arm64": 0.25.10 - "@esbuild/android-x64": 0.25.10 - "@esbuild/darwin-arm64": 0.25.10 - "@esbuild/darwin-x64": 0.25.10 - "@esbuild/freebsd-arm64": 0.25.10 - "@esbuild/freebsd-x64": 0.25.10 - "@esbuild/linux-arm": 0.25.10 - "@esbuild/linux-arm64": 0.25.10 - "@esbuild/linux-ia32": 0.25.10 - "@esbuild/linux-loong64": 0.25.10 - "@esbuild/linux-mips64el": 0.25.10 - "@esbuild/linux-ppc64": 0.25.10 - "@esbuild/linux-riscv64": 0.25.10 - "@esbuild/linux-s390x": 0.25.10 - "@esbuild/linux-x64": 0.25.10 - "@esbuild/netbsd-arm64": 0.25.10 - "@esbuild/netbsd-x64": 0.25.10 - "@esbuild/openbsd-arm64": 0.25.10 - "@esbuild/openbsd-x64": 0.25.10 - "@esbuild/openharmony-arm64": 0.25.10 - "@esbuild/sunos-x64": 0.25.10 - "@esbuild/win32-arm64": 0.25.10 - "@esbuild/win32-ia32": 0.25.10 - "@esbuild/win32-x64": 0.25.10 +"esbuild@npm:~0.27.0": + version: 0.27.2 + resolution: "esbuild@npm:0.27.2" + dependencies: + "@esbuild/aix-ppc64": 0.27.2 + "@esbuild/android-arm": 0.27.2 + "@esbuild/android-arm64": 0.27.2 + "@esbuild/android-x64": 0.27.2 + "@esbuild/darwin-arm64": 0.27.2 + "@esbuild/darwin-x64": 0.27.2 + "@esbuild/freebsd-arm64": 0.27.2 + "@esbuild/freebsd-x64": 0.27.2 + "@esbuild/linux-arm": 0.27.2 + "@esbuild/linux-arm64": 0.27.2 + "@esbuild/linux-ia32": 0.27.2 + "@esbuild/linux-loong64": 0.27.2 + "@esbuild/linux-mips64el": 0.27.2 + "@esbuild/linux-ppc64": 0.27.2 + "@esbuild/linux-riscv64": 0.27.2 + "@esbuild/linux-s390x": 0.27.2 + "@esbuild/linux-x64": 0.27.2 + "@esbuild/netbsd-arm64": 0.27.2 + "@esbuild/netbsd-x64": 0.27.2 + "@esbuild/openbsd-arm64": 0.27.2 + "@esbuild/openbsd-x64": 0.27.2 + "@esbuild/openharmony-arm64": 0.27.2 + "@esbuild/sunos-x64": 0.27.2 + "@esbuild/win32-arm64": 0.27.2 + "@esbuild/win32-ia32": 0.27.2 + "@esbuild/win32-x64": 0.27.2 dependenciesMeta: "@esbuild/aix-ppc64": optional: true @@ -7320,7 +7333,7 @@ __metadata: optional: true bin: esbuild: bin/esbuild - checksum: 1e7f8a3b3eaf3af3e260bd4a815f5b8c8a9fc9cbd640d05585a22df23381017dd41859ef7c5a36678416751c3056c88b6313f481736be8610d3524a5711e5655 + checksum: 62ec92f8f40ad19922ae7d8dbf0427e41744120a77cc95abdf099dfb484d65fbe3c70cc55b8eccb7f6cb0d14e871ff1f2f76376d476915c2a6d2b800269261b2 languageName: node linkType: hard @@ -7793,11 +7806,11 @@ __metadata: linkType: hard "esquery@npm:^1.5.0": - version: 1.6.0 - resolution: "esquery@npm:1.6.0" + version: 1.7.0 + resolution: "esquery@npm:1.7.0" dependencies: estraverse: ^5.1.0 - checksum: 08ec4fe446d9ab27186da274d979558557fbdbbd10968fa9758552482720c54152a5640e08b9009e5a30706b66aba510692054d4129d32d0e12e05bbc0b96fb2 + checksum: 3239792b68cf39fe18966d0ca01549bb15556734f0144308fd213739b0f153671ae916013fce0bca032044a4dbcda98b43c1c667f20c20a54dec3597ac0d7c27 languageName: node linkType: hard @@ -8013,11 +8026,11 @@ __metadata: linkType: hard "fastq@npm:^1.6.0": - version: 1.19.1 - resolution: "fastq@npm:1.19.1" + version: 1.20.1 + resolution: "fastq@npm:1.20.1" dependencies: reusify: ^1.0.4 - checksum: 7691d1794fb84ad0ec2a185f10e00f0e1713b894e2c9c4d42f0bc0ba5f8c00e6e655a202074ca0b91b9c3d977aab7c30c41a8dc069fb5368576ac0054870a0e6 + checksum: 49128edbf05e682bee3c1db3d2dfc7da195469065ef014d8368c555d829932313ae2ddf584bb03146409b0d5d9fdb387c471075483a7319b52f777ad91128ed8 languageName: node linkType: hard @@ -8209,9 +8222,9 @@ __metadata: linkType: hard "flow-parser@npm:0.*": - version: 0.288.0 - resolution: "flow-parser@npm:0.288.0" - checksum: 44de63335e0c651e1cc78eb97ac6dea593cd5b625542ab382abb69435feba56d7d1f96f4c2079d13298916bdb44956ceafb9342e7e1dd9e735f5f42e215e994b + version: 0.296.1 + resolution: "flow-parser@npm:0.296.1" + checksum: a9f7291a05753d9cb0374f8971fff088063caf854abbd7c08d0774cd131b8e7f358d2adaab87abf2681c475ade52fcb5fb20a6f4b55daabc2b08994f31d1f490 languageName: node linkType: hard @@ -8235,19 +8248,19 @@ __metadata: linkType: hard "form-data@npm:^4.0.4": - version: 4.0.4 - resolution: "form-data@npm:4.0.4" + version: 4.0.5 + resolution: "form-data@npm:4.0.5" dependencies: asynckit: ^0.4.0 combined-stream: ^1.0.8 es-set-tostringtag: ^2.1.0 hasown: ^2.0.2 mime-types: ^2.1.12 - checksum: 9b7788836df9fa5a6999e0c02515b001946b2a868cfe53f026c69e2c537a2ff9fbfb8e9d2b678744628f3dc7a2d6e14e4e45dfaf68aa6239727f0bdb8ce0abf2 + checksum: af8328413c16d0cded5fccc975a44d227c5120fd46a9e81de8acf619d43ed838414cc6d7792195b30b248f76a65246949a129a4dadd148721948f90cd6d4fb69 languageName: node linkType: hard -"fresh@npm:0.5.2": +"fresh@npm:~0.5.2": version: 0.5.2 resolution: "fresh@npm:0.5.2" checksum: 13ea8b08f91e669a64e3ba3a20eb79d7ca5379a81f1ff7f4310d54e2320645503cc0c78daedc93dfb6191287295f6479544a649c64d8e41a1c0fb0c221552346 @@ -8426,11 +8439,11 @@ __metadata: linkType: hard "get-tsconfig@npm:^4.10.0, get-tsconfig@npm:^4.7.5": - version: 4.12.0 - resolution: "get-tsconfig@npm:4.12.0" + version: 4.13.0 + resolution: "get-tsconfig@npm:4.13.0" dependencies: resolve-pkg-maps: ^1.0.0 - checksum: 5a7f9f8f787473bc6cc337c77689d97c52c01e175b12b7d1f9d0d92e632de6f0fc046144009a49996438ae4feef98940867e16a16d67f1d1144e053e20efaac2 + checksum: b3cfa1316dd8842e038f6a3dc02ae87d9f3a227f14b79ac4b1c81bf6fc75de4dfc3355c4117612e183f5147dad49c8132841c7fdd7a4508531d820a9b90acc51 languageName: node linkType: hard @@ -8476,9 +8489,9 @@ __metadata: languageName: node linkType: hard -"glob@npm:^10.2.2, glob@npm:^10.3.7": - version: 10.4.5 - resolution: "glob@npm:10.4.5" +"glob@npm:^10.3.7": + version: 10.5.0 + resolution: "glob@npm:10.5.0" dependencies: foreground-child: ^3.1.0 jackspeak: ^3.1.2 @@ -8488,7 +8501,18 @@ __metadata: path-scurry: ^1.11.1 bin: glob: dist/esm/bin.mjs - checksum: 0bc725de5e4862f9f387fd0f2b274baf16850dcd2714502ccf471ee401803997983e2c05590cb65f9675a3c6f2a58e7a53f9e365704108c6ad3cbf1d60934c4a + checksum: cda96c074878abca9657bd984d2396945cf0d64283f6feeb40d738fe2da642be0010ad5210a1646244a5fc3511b0cab5a374569b3de5a12b8a63d392f18c6043 + languageName: node + linkType: hard + +"glob@npm:^13.0.0": + version: 13.0.0 + resolution: "glob@npm:13.0.0" + dependencies: + minimatch: ^10.1.1 + minipass: ^7.1.2 + path-scurry: ^2.0.0 + checksum: 963730222b0acc85a0d2616c08ba3a5d5b5f33fbf69182791967b8a02245db505577a6fc19836d5d58e1cbbfb414ad4f62f605a0372ab05cd9e6998efe944369 languageName: node linkType: hard @@ -8648,10 +8672,10 @@ __metadata: languageName: node linkType: hard -"hermes-compiler@npm:0.0.0": - version: 0.0.0 - resolution: "hermes-compiler@npm:0.0.0" - checksum: 8b6fc8a64c2fa18c9aa6ddb8831c92253b6a2f10adf7d5d8f361b574f07e91b64f0c44b1370665075c33c17dd71c02fd19422124a3d2aa1717c37006ab12a1f0 +"hermes-compiler@npm:0.14.0": + version: 0.14.0 + resolution: "hermes-compiler@npm:0.14.0" + checksum: 5b614ebe621e92550efd77a6aefe85d9cbab865386dc36de9895d4684ba0af13623d045b99f5b834f91a42ba3f00982462908eaf7cb6c8423056e9d5c8280ab3 languageName: node linkType: hard @@ -8776,16 +8800,16 @@ __metadata: languageName: node linkType: hard -"http-errors@npm:2.0.0": - version: 2.0.0 - resolution: "http-errors@npm:2.0.0" +"http-errors@npm:~2.0.1": + version: 2.0.1 + resolution: "http-errors@npm:2.0.1" dependencies: - depd: 2.0.0 - inherits: 2.0.4 - setprototypeof: 1.2.0 - statuses: 2.0.1 - toidentifier: 1.0.1 - checksum: 9b0a3782665c52ce9dc658a0d1560bcb0214ba5699e4ea15aefb2a496e2ca83db03ebc42e1cce4ac1f413e4e0d2d736a3fd755772c556a9a06853ba2a0b7d920 + depd: ~2.0.0 + inherits: ~2.0.4 + setprototypeof: ~1.2.0 + statuses: ~2.0.2 + toidentifier: ~1.0.1 + checksum: 155d1a100a06e4964597013109590b97540a177b69c3600bbc93efc746465a99a2b718f43cdf76b3791af994bbe3a5711002046bf668cdc007ea44cea6df7ccd languageName: node linkType: hard @@ -8862,7 +8886,7 @@ __metadata: languageName: node linkType: hard -"ignore@npm:^7.0.0": +"ignore@npm:^7.0.5": version: 7.0.5 resolution: "ignore@npm:7.0.5" checksum: d0862bf64d3d58bf34d5fb0a9f725bec9ca5ce8cd1aecc8f28034269e8f69b8009ffd79ca3eda96962a6a444687781cd5efdb8c7c8ddc0a6996e36d31c217f14 @@ -8943,7 +8967,7 @@ __metadata: languageName: node linkType: hard -"inherits@npm:2, inherits@npm:2.0.4, inherits@npm:^2.0.3, inherits@npm:^2.0.4, inherits@npm:~2.0.3": +"inherits@npm:2, inherits@npm:^2.0.3, inherits@npm:^2.0.4, inherits@npm:~2.0.3, inherits@npm:~2.0.4": version: 2.0.4 resolution: "inherits@npm:2.0.4" checksum: 4a48a733847879d6cf6691860a6b1e3f0f4754176e4d71494c41f3475553768b10f84b5ce1d40fbd0e34e6bfbb864ee35858ad4dd2cf31e02fc4a154b724d7f1 @@ -9004,9 +9028,9 @@ __metadata: linkType: hard "ip-address@npm:^10.0.1": - version: 10.0.1 - resolution: "ip-address@npm:10.0.1" - checksum: 525d5391cfd31a91f80f5857e98487aeaa8474e860a6725a0b6461ac8e436c7f8c869774dece391c8f8e7486306a34a4d1c094778c4c583a3f1f2cd905e5ed50 + version: 10.1.0 + resolution: "ip-address@npm:10.1.0" + checksum: 76b1abcdf52a32e2e05ca1f202f3a8ab8547e5651a9233781b330271bd7f1a741067748d71c4cbb9d9906d9f1fa69e7ddc8b4a11130db4534fdab0e908c84e0d languageName: node linkType: hard @@ -9093,7 +9117,7 @@ __metadata: languageName: node linkType: hard -"is-core-module@npm:^2.13.0, is-core-module@npm:^2.16.0, is-core-module@npm:^2.16.1, is-core-module@npm:^2.5.0": +"is-core-module@npm:^2.13.0, is-core-module@npm:^2.16.1, is-core-module@npm:^2.5.0": version: 2.16.1 resolution: "is-core-module@npm:2.16.1" dependencies: @@ -9556,7 +9580,7 @@ __metadata: languageName: node linkType: hard -"iterator.prototype@npm:^1.1.4": +"iterator.prototype@npm:^1.1.5": version: 1.1.5 resolution: "iterator.prototype@npm:1.1.5" dependencies: @@ -10054,25 +10078,25 @@ __metadata: linkType: hard "js-yaml@npm:^3.13.1": - version: 3.14.1 - resolution: "js-yaml@npm:3.14.1" + version: 3.14.2 + resolution: "js-yaml@npm:3.14.2" dependencies: argparse: ^1.0.7 esprima: ^4.0.0 bin: js-yaml: bin/js-yaml.js - checksum: bef146085f472d44dee30ec34e5cf36bf89164f5d585435a3d3da89e52622dff0b188a580e4ad091c3341889e14cb88cac6e4deb16dc5b1e9623bb0601fc255c + checksum: 626fc207734a3452d6ba84e1c8c226240e6d431426ed94d0ab043c50926d97c509629c08b1d636f5d27815833b7cfd225865631da9fb33cb957374490bf3e90b languageName: node linkType: hard -"js-yaml@npm:^4.0.0, js-yaml@npm:^4.1.0": - version: 4.1.0 - resolution: "js-yaml@npm:4.1.0" +"js-yaml@npm:^4.0.0, js-yaml@npm:^4.1.0, js-yaml@npm:^4.1.1": + version: 4.1.1 + resolution: "js-yaml@npm:4.1.1" dependencies: argparse: ^2.0.1 bin: js-yaml: bin/js-yaml.js - checksum: c7830dfd456c3ef2c6e355cc5a92e6700ceafa1d14bba54497b34a99f0376cecbb3e9ac14d3e5849b426d5a5140709a66237a8c991c675431271c4ce5504151a + checksum: ea2339c6930fe048ec31b007b3c90be2714ab3e7defcc2c27ebf30c74fd940358f29070b4345af0019ef151875bf3bc3f8644bea1bab0372652b5044813ac02d languageName: node linkType: hard @@ -10404,13 +10428,20 @@ __metadata: languageName: node linkType: hard -"lru-cache@npm:^10.0.1, lru-cache@npm:^10.2.0": +"lru-cache@npm:^10.2.0": version: 10.4.3 resolution: "lru-cache@npm:10.4.3" checksum: 6476138d2125387a6d20f100608c2583d415a4f64a0fecf30c9e2dda976614f09cad4baa0842447bd37dd459a7bd27f57d9d8f8ce558805abd487c583f3d774a languageName: node linkType: hard +"lru-cache@npm:^11.0.0, lru-cache@npm:^11.1.0, lru-cache@npm:^11.2.1": + version: 11.2.4 + resolution: "lru-cache@npm:11.2.4" + checksum: cb8cf72b80a506593f51880bd5a765380d6d8eb82e99b2fbb2f22fe39e5f2f641d47a2509e74cc294617f32a4e90ae8f6214740fe00bc79a6178854f00419b24 + languageName: node + linkType: hard + "lru-cache@npm:^5.1.1": version: 5.1.1 resolution: "lru-cache@npm:5.1.1" @@ -10455,22 +10486,22 @@ __metadata: languageName: node linkType: hard -"make-fetch-happen@npm:^14.0.3": - version: 14.0.3 - resolution: "make-fetch-happen@npm:14.0.3" +"make-fetch-happen@npm:^15.0.0": + version: 15.0.3 + resolution: "make-fetch-happen@npm:15.0.3" dependencies: - "@npmcli/agent": ^3.0.0 - cacache: ^19.0.1 + "@npmcli/agent": ^4.0.0 + cacache: ^20.0.1 http-cache-semantics: ^4.1.1 minipass: ^7.0.2 - minipass-fetch: ^4.0.0 + minipass-fetch: ^5.0.0 minipass-flush: ^1.0.5 minipass-pipeline: ^1.2.4 negotiator: ^1.0.0 - proc-log: ^5.0.0 + proc-log: ^6.0.0 promise-retry: ^2.0.1 - ssri: ^12.0.0 - checksum: 6fb2fee6da3d98f1953b03d315826b5c5a4ea1f908481afc113782d8027e19f080c85ae998454de4e5f27a681d3ec58d57278f0868d4e0b736f51d396b661691 + ssri: ^13.0.0 + checksum: 4fb9dbb739b33565c85dacdcff7eb9388d8f36f326a59dc13375f01af809c42c48aa5d1f4840ee36623b2461a15476e1e79e4548ca1af30b42e1e324705ac8b3 languageName: node linkType: hard @@ -10696,7 +10727,7 @@ __metadata: languageName: node linkType: hard -"metro-config@npm:0.83.3, metro-config@npm:^0.83.1": +"metro-config@npm:0.83.3, metro-config@npm:^0.83.1, metro-config@npm:^0.83.3": version: 0.83.3 resolution: "metro-config@npm:0.83.3" dependencies: @@ -10734,7 +10765,7 @@ __metadata: languageName: node linkType: hard -"metro-core@npm:0.83.3, metro-core@npm:^0.83.1": +"metro-core@npm:0.83.3, metro-core@npm:^0.83.1, metro-core@npm:^0.83.3": version: 0.83.3 resolution: "metro-core@npm:0.83.3" dependencies: @@ -10879,7 +10910,7 @@ __metadata: languageName: node linkType: hard -"metro-runtime@npm:0.83.3, metro-runtime@npm:^0.83.1": +"metro-runtime@npm:0.83.3, metro-runtime@npm:^0.83.1, metro-runtime@npm:^0.83.3": version: 0.83.3 resolution: "metro-runtime@npm:0.83.3" dependencies: @@ -10924,7 +10955,7 @@ __metadata: languageName: node linkType: hard -"metro-source-map@npm:0.83.3, metro-source-map@npm:^0.83.1": +"metro-source-map@npm:0.83.3, metro-source-map@npm:^0.83.1, metro-source-map@npm:^0.83.3": version: 0.83.3 resolution: "metro-source-map@npm:0.83.3" dependencies: @@ -11198,7 +11229,7 @@ __metadata: languageName: node linkType: hard -"metro@npm:0.83.3, metro@npm:^0.83.1": +"metro@npm:0.83.3, metro@npm:^0.83.1, metro@npm:^0.83.3": version: 0.83.3 resolution: "metro@npm:0.83.3" dependencies: @@ -11306,6 +11337,15 @@ __metadata: languageName: node linkType: hard +"minimatch@npm:^10.1.1": + version: 10.1.1 + resolution: "minimatch@npm:10.1.1" + dependencies: + "@isaacs/brace-expansion": ^5.0.0 + checksum: 8820c0be92994f57281f0a7a2cc4268dcc4b610f9a1ab666685716b4efe4b5898b43c835a8f22298875b31c7a278a5e3b7e253eee7c886546bb0b61fb94bca6b + languageName: node + linkType: hard + "minimatch@npm:^3.0.2, minimatch@npm:^3.0.4, minimatch@npm:^3.1.1, minimatch@npm:^3.1.2": version: 3.1.2 resolution: "minimatch@npm:3.1.2" @@ -11324,7 +11364,7 @@ __metadata: languageName: node linkType: hard -"minimatch@npm:^9.0.3, minimatch@npm:^9.0.4": +"minimatch@npm:^9.0.3, minimatch@npm:^9.0.4, minimatch@npm:^9.0.5": version: 9.0.5 resolution: "minimatch@npm:9.0.5" dependencies: @@ -11360,9 +11400,9 @@ __metadata: languageName: node linkType: hard -"minipass-fetch@npm:^4.0.0": - version: 4.0.1 - resolution: "minipass-fetch@npm:4.0.1" +"minipass-fetch@npm:^5.0.0": + version: 5.0.0 + resolution: "minipass-fetch@npm:5.0.0" dependencies: encoding: ^0.1.13 minipass: ^7.0.3 @@ -11371,7 +11411,7 @@ __metadata: dependenciesMeta: encoding: optional: true - checksum: 3dfca705ce887ca9ff14d73e8d8593996dea1a1ecd8101fdbb9c10549d1f9670bc8fb66ad0192769ead4c2dc01b4f9ca1cf567ded365adff17827a303b948140 + checksum: 416645d1e54c09fdfe64ec1676541ac2f6f2af3abc7ad25f2f22c4518535997c1ecd2c0c586ea8a5c6499ad7d8f97671f50ff38488ada54bf61fde309f731379 languageName: node linkType: hard @@ -11606,29 +11646,29 @@ __metadata: linkType: hard "node-forge@npm:^1": - version: 1.3.1 - resolution: "node-forge@npm:1.3.1" - checksum: 08fb072d3d670599c89a1704b3e9c649ff1b998256737f0e06fbd1a5bf41cae4457ccaee32d95052d80bbafd9ffe01284e078c8071f0267dc9744e51c5ed42a9 + version: 1.3.3 + resolution: "node-forge@npm:1.3.3" + checksum: 045b650d61eeba57588744b7be4671044e83871e2c4dc5d4a38a8eb5af7e55fa790c93ba9db1d1ee14a567d25fde41e97a5132e076cff738622e0916c77b48d2 languageName: node linkType: hard "node-gyp@npm:latest": - version: 11.4.2 - resolution: "node-gyp@npm:11.4.2" + version: 12.1.0 + resolution: "node-gyp@npm:12.1.0" dependencies: env-paths: ^2.2.0 exponential-backoff: ^3.1.1 graceful-fs: ^4.2.6 - make-fetch-happen: ^14.0.3 - nopt: ^8.0.0 - proc-log: ^5.0.0 + make-fetch-happen: ^15.0.0 + nopt: ^9.0.0 + proc-log: ^6.0.0 semver: ^7.3.5 - tar: ^7.4.3 + tar: ^7.5.2 tinyglobby: ^0.2.12 - which: ^5.0.0 + which: ^6.0.0 bin: node-gyp: bin/node-gyp.js - checksum: d8041cee7ec60c86fb2961d77c12a2d083a481fb28b08e6d9583153186c0e7766044dc30bdb1f3ac01ddc5763b83caeed3d1ea35787ec4ffd8cc4aeedfc34f2b + checksum: 198d91c535fe9940bcdc0db4e578f94cf9872e0d068e88ef2f4656924248bb67245b270b48eded6634c7513841c0cd42f3da3ac9d77c8e16437fcd90703b9ef3 languageName: node linkType: hard @@ -11639,10 +11679,10 @@ __metadata: languageName: node linkType: hard -"node-releases@npm:^2.0.21": - version: 2.0.23 - resolution: "node-releases@npm:2.0.23" - checksum: dc3194ffdf04975f8525a5e175c03f5a95cecd7607b6b0e80d28aaa03900706d920722b5f2ae2e8e28e029e6ae75f0d0f7eae87e8ee2a363c704785e3118f13d +"node-releases@npm:^2.0.27": + version: 2.0.27 + resolution: "node-releases@npm:2.0.27" + checksum: a9a54079d894704c2ec728a690b41fbc779a710f5d47b46fa3e460acff08a3e7dfa7108e5599b2db390aa31dac062c47c5118317201f12784188dc5b415f692d languageName: node linkType: hard @@ -11653,14 +11693,14 @@ __metadata: languageName: node linkType: hard -"nopt@npm:^8.0.0": - version: 8.1.0 - resolution: "nopt@npm:8.1.0" +"nopt@npm:^9.0.0": + version: 9.0.0 + resolution: "nopt@npm:9.0.0" dependencies: - abbrev: ^3.0.0 + abbrev: ^4.0.0 bin: nopt: bin/nopt.js - checksum: 49cfd3eb6f565e292bf61f2ff1373a457238804d5a5a63a8d786c923007498cba89f3648e3b952bc10203e3e7285752abf5b14eaf012edb821e84f24e881a92a + checksum: 7a5d9ab0629eaec1944a95438cc4efa6418ed2834aa8eb21a1bea579a7d8ac3e30120131855376a96ef59ab0e23ad8e0bc94d3349770a95e5cb7119339f7c7fb languageName: node linkType: hard @@ -11808,21 +11848,21 @@ __metadata: languageName: node linkType: hard -"on-finished@npm:2.4.1": - version: 2.4.1 - resolution: "on-finished@npm:2.4.1" +"on-finished@npm:~2.3.0": + version: 2.3.0 + resolution: "on-finished@npm:2.3.0" dependencies: ee-first: 1.1.1 - checksum: d20929a25e7f0bb62f937a425b5edeb4e4cde0540d77ba146ec9357f00b0d497cdb3b9b05b9c8e46222407d1548d08166bff69cc56dfa55ba0e4469228920ff0 + checksum: 1db595bd963b0124d6fa261d18320422407b8f01dc65863840f3ddaaf7bcad5b28ff6847286703ca53f4ec19595bd67a2f1253db79fc4094911ec6aa8df1671b languageName: node linkType: hard -"on-finished@npm:~2.3.0": - version: 2.3.0 - resolution: "on-finished@npm:2.3.0" +"on-finished@npm:~2.4.1": + version: 2.4.1 + resolution: "on-finished@npm:2.4.1" dependencies: ee-first: 1.1.1 - checksum: 1db595bd963b0124d6fa261d18320422407b8f01dc65863840f3ddaaf7bcad5b28ff6847286703ca53f4ec19595bd67a2f1253db79fc4094911ec6aa8df1671b + checksum: d20929a25e7f0bb62f937a425b5edeb4e4cde0540d77ba146ec9357f00b0d497cdb3b9b05b9c8e46222407d1548d08166bff69cc56dfa55ba0e4469228920ff0 languageName: node linkType: hard @@ -11976,9 +12016,9 @@ __metadata: linkType: hard "p-map@npm:^7.0.2": - version: 7.0.3 - resolution: "p-map@npm:7.0.3" - checksum: 8c92d533acf82f0d12f7e196edccff773f384098bbb048acdd55a08778ce4fc8889d8f1bde72969487bd96f9c63212698d79744c20bedfce36c5b00b46d369f8 + version: 7.0.4 + resolution: "p-map@npm:7.0.4" + checksum: 4be2097e942f2fd3a4f4b0c6585c721f23851de8ad6484d20c472b3ea4937d5cd9a59914c832b1bceac7bf9d149001938036b82a52de0bc381f61ff2d35d26a5 languageName: node linkType: hard @@ -12112,6 +12152,16 @@ __metadata: languageName: node linkType: hard +"path-scurry@npm:^2.0.0": + version: 2.0.1 + resolution: "path-scurry@npm:2.0.1" + dependencies: + lru-cache: ^11.0.0 + minipass: ^7.1.2 + checksum: a022c6c38fed836079d03f96540eafd4cd989acf287b99613c82300107f366e889513ad8b671a2039a9d251122621f9c6fa649f0bd4d50acf95a6943a6692dbf + languageName: node + linkType: hard + "path-type@npm:^4.0.0": version: 4.0.0 resolution: "path-type@npm:4.0.0" @@ -12233,11 +12283,11 @@ __metadata: linkType: hard "prettier-linter-helpers@npm:^1.0.0": - version: 1.0.0 - resolution: "prettier-linter-helpers@npm:1.0.0" + version: 1.0.1 + resolution: "prettier-linter-helpers@npm:1.0.1" dependencies: fast-diff: ^1.1.2 - checksum: 00ce8011cf6430158d27f9c92cfea0a7699405633f7f1d4a45f07e21bf78e99895911cbcdc3853db3a824201a7c745bd49bfea8abd5fb9883e765a90f74f8392 + checksum: 2dc35f5036a35f4c4f5e645887edda1436acb63687a7f12b2383e0a6f3c1f76b8a0a4709fe4d82e19157210feb5984b159bb714d43290022911ab53d606474ec languageName: node linkType: hard @@ -12251,11 +12301,11 @@ __metadata: linkType: hard "prettier@npm:^3.0.3, prettier@npm:^3.6.2": - version: 3.6.2 - resolution: "prettier@npm:3.6.2" + version: 3.7.4 + resolution: "prettier@npm:3.7.4" bin: prettier: bin/prettier.cjs - checksum: 0206f5f437892e8858f298af8850bf9d0ef1c22e21107a213ba56bfb9c2387a2020bfda244a20161d8e3dad40c6b04101609a55d370dece53d0a31893b64f861 + checksum: 955e37e87b1151ca3b3282463f5295f4c415821884791df152ff66e6eb1c5257115153cccba61b13962546100dd00ae45670ff27077dcab04c977d84036eaf80 languageName: node linkType: hard @@ -12282,10 +12332,10 @@ __metadata: languageName: node linkType: hard -"proc-log@npm:^5.0.0": - version: 5.0.0 - resolution: "proc-log@npm:5.0.0" - checksum: c78b26ecef6d5cce4a7489a1e9923d7b4b1679028c8654aef0463b27f4a90b0946cd598f55799da602895c52feb085ec76381d007ab8dcceebd40b89c2f9dfe0 +"proc-log@npm:^6.0.0": + version: 6.1.0 + resolution: "proc-log@npm:6.1.0" + checksum: ac450ff8244e95b0c9935b52d629fef92ae69b7e39aea19972a8234259614d644402dd62ce9cb094f4a637d8a4514cba90c1456ad785a40ad5b64d502875a817 languageName: node linkType: hard @@ -12561,8 +12611,8 @@ __metadata: linkType: hard "react-native-gesture-handler@npm:^2.28.0": - version: 2.28.0 - resolution: "react-native-gesture-handler@npm:2.28.0" + version: 2.30.0 + resolution: "react-native-gesture-handler@npm:2.30.0" dependencies: "@egjs/hammerjs": ^2.0.17 hoist-non-react-statics: ^3.3.0 @@ -12570,7 +12620,7 @@ __metadata: peerDependencies: react: "*" react-native: "*" - checksum: 7bcd7db784b12565fdd5916bbebc2d3511a63159ca553d33e430008940ba7d209f1e85ef02968a920ed19c414fabe7d2c18cc0e967dd4889aae266788562d1e9 + checksum: 130a1cc04879ea11808472dbe2f4e346baca0cb52713279f3d4b5fbd397324bef2379f1f60bf0ce1763e12a8656267abb0e879418fb37c81fc6bbdcdb7fc797d languageName: node linkType: hard @@ -12585,11 +12635,11 @@ __metadata: linkType: hard "react-native-macos@npm:^0.79.0": - version: 0.79.0 - resolution: "react-native-macos@npm:0.79.0" + version: 0.79.1 + resolution: "react-native-macos@npm:0.79.1" dependencies: "@jest/create-cache-key-function": ^29.7.0 - "@react-native-macos/virtualized-lists": 0.79.0 + "@react-native-macos/virtualized-lists": 0.79.1 "@react-native/assets-registry": 0.79.6 "@react-native/codegen": 0.79.6 "@react-native/community-cli-plugin": 0.79.6 @@ -12635,7 +12685,7 @@ __metadata: bin: react-native: cli.js react-native-macos: cli.js - checksum: 088a44e865b211de42eff7692eb417c7fca949aff96b9cb3a149c6f0e6f39a9565f7011dad8a80c51abd8fad98a5e38413f99bb4b3b065039265450dfbfa3625 + checksum: f02970aae150e556e493b0cdb216bb02e60217dabb77c9b7efe6c84600e271dbce81d4c3a15a4e31212561a83d683b003c6fbf3b81e19268efead9c22c1b3eca languageName: node linkType: hard @@ -12664,12 +12714,12 @@ __metadata: linkType: hard "react-native-safe-area-context@npm:^5.4.0": - version: 5.6.1 - resolution: "react-native-safe-area-context@npm:5.6.1" + version: 5.6.2 + resolution: "react-native-safe-area-context@npm:5.6.2" peerDependencies: react: "*" react-native: "*" - checksum: f346615d5f8f26c0c8459d29c149ea3f66684b8ae79cea6fd48d118d039851a69a92955d67b455d0e7ab46639155c4357ebf58ec1859b2377ee459e2a04b602b + checksum: 7b15cdd07df4f3650cf443fb322ee2d51b3ab45c652789cbea4cb48a8e6fd2b66e2be01e9f63e614ceaf28d9d228af681ca8857b2ed8dabe48f23964076d40c3 languageName: node linkType: hard @@ -12751,6 +12801,7 @@ __metadata: "@types/seedrandom": ^3.0.8 "@types/ws": ^8.5.10 "@webgpu/types": 0.1.65 + baseline-browser-mapping: ^2.9.14 clang-format: ^1.8.0 del-cli: ^5.1.0 eslint: 9.35.0 @@ -12784,17 +12835,17 @@ __metadata: linkType: soft "react-native@npm:*": - version: 0.82.1 - resolution: "react-native@npm:0.82.1" + version: 0.83.1 + resolution: "react-native@npm:0.83.1" dependencies: "@jest/create-cache-key-function": ^29.7.0 - "@react-native/assets-registry": 0.82.1 - "@react-native/codegen": 0.82.1 - "@react-native/community-cli-plugin": 0.82.1 - "@react-native/gradle-plugin": 0.82.1 - "@react-native/js-polyfills": 0.82.1 - "@react-native/normalize-colors": 0.82.1 - "@react-native/virtualized-lists": 0.82.1 + "@react-native/assets-registry": 0.83.1 + "@react-native/codegen": 0.83.1 + "@react-native/community-cli-plugin": 0.83.1 + "@react-native/gradle-plugin": 0.83.1 + "@react-native/js-polyfills": 0.83.1 + "@react-native/normalize-colors": 0.83.1 + "@react-native/virtualized-lists": 0.83.1 abort-controller: ^3.0.0 anser: ^1.4.9 ansi-regex: ^5.0.0 @@ -12804,33 +12855,33 @@ __metadata: commander: ^12.0.0 flow-enums-runtime: ^0.0.6 glob: ^7.1.1 - hermes-compiler: 0.0.0 + hermes-compiler: 0.14.0 invariant: ^2.2.4 jest-environment-node: ^29.7.0 memoize-one: ^5.0.0 - metro-runtime: ^0.83.1 - metro-source-map: ^0.83.1 + metro-runtime: ^0.83.3 + metro-source-map: ^0.83.3 nullthrows: ^1.1.1 pretty-format: ^29.7.0 promise: ^8.3.0 react-devtools-core: ^6.1.5 react-refresh: ^0.14.0 regenerator-runtime: ^0.13.2 - scheduler: 0.26.0 + scheduler: 0.27.0 semver: ^7.1.3 stacktrace-parser: ^0.1.10 whatwg-fetch: ^3.0.0 - ws: ^6.2.3 + ws: ^7.5.10 yargs: ^17.6.2 peerDependencies: "@types/react": ^19.1.1 - react: ^19.1.1 + react: ^19.2.0 peerDependenciesMeta: "@types/react": optional: true bin: react-native: cli.js - checksum: 16c5945aae14bd8d7113d2751ad558d91a0bc8cfbffd8ad588722635aac404b512be5ef0f5953ce62b9808ae7ddcbefac909575bcf7da013d06146ab0d48f29a + checksum: 9de956e38287afb5d989a1dde5d5488d6c2499f6acb90d07a9526e92c0822b0c9884cd871cfe42daacc2f006bc95acc8d395ba794af415758b2a8a7e8ca1cce8 languageName: node linkType: hard @@ -13088,7 +13139,7 @@ __metadata: languageName: node linkType: hard -"regexpu-core@npm:^6.2.0": +"regexpu-core@npm:^6.3.1": version: 6.4.0 resolution: "regexpu-core@npm:6.4.0" dependencies: @@ -13186,15 +13237,15 @@ __metadata: linkType: hard "resolve@npm:^1.1.10, resolve@npm:^1.1.6, resolve@npm:^1.20.0, resolve@npm:^1.22.10, resolve@npm:^1.22.4": - version: 1.22.10 - resolution: "resolve@npm:1.22.10" + version: 1.22.11 + resolution: "resolve@npm:1.22.11" dependencies: - is-core-module: ^2.16.0 + is-core-module: ^2.16.1 path-parse: ^1.0.7 supports-preserve-symlinks-flag: ^1.0.0 bin: resolve: bin/resolve - checksum: ab7a32ff4046fcd7c6fdd525b24a7527847d03c3650c733b909b01b757f92eb23510afa9cc3e9bf3f26a3e073b48c88c706dfd4c1d2fb4a16a96b73b6328ddcf + checksum: 6d5baa2156b95a65ac431e7642e21106584e9f4194da50871cae8bc1bbd2b53bb7cee573c92543d83bb999620b224a087f62379d800ed1ccb189da6df5d78d50 languageName: node linkType: hard @@ -13212,15 +13263,15 @@ __metadata: linkType: hard "resolve@patch:resolve@^1.1.10#~builtin, resolve@patch:resolve@^1.1.6#~builtin, resolve@patch:resolve@^1.20.0#~builtin, resolve@patch:resolve@^1.22.10#~builtin, resolve@patch:resolve@^1.22.4#~builtin": - version: 1.22.10 - resolution: "resolve@patch:resolve@npm%3A1.22.10#~builtin::version=1.22.10&hash=c3c19d" + version: 1.22.11 + resolution: "resolve@patch:resolve@npm%3A1.22.11#~builtin::version=1.22.11&hash=c3c19d" dependencies: - is-core-module: ^2.16.0 + is-core-module: ^2.16.1 path-parse: ^1.0.7 supports-preserve-symlinks-flag: ^1.0.0 bin: resolve: bin/resolve - checksum: 8aac1e4e4628bd00bf4b94b23de137dd3fe44097a8d528fd66db74484be929936e20c696e1a3edf4488f37e14180b73df6f600992baea3e089e8674291f16c9d + checksum: 1462da84ac3410d7c2e12e4f5f25c1423d8a174c3b4245c43eafea85e7bbe6af3eb7ec10a4850b5e518e8531608604742b8cbd761e1acd7ad1035108b7c98013 languageName: node linkType: hard @@ -13388,6 +13439,13 @@ __metadata: languageName: node linkType: hard +"scheduler@npm:0.27.0": + version: 0.27.0 + resolution: "scheduler@npm:0.27.0" + checksum: 92644ead0a9443e20f9d24132fe93675b156209b9eeb35ea245f8a86768d0cc0fcca56f341eeef21d9b6dd8e72d6d5e260eb5a41d34b05cd605dd45a29f572ef + languageName: node + linkType: hard + "scheduler@npm:^0.23.0": version: 0.23.2 resolution: "scheduler@npm:0.23.2" @@ -13441,24 +13499,24 @@ __metadata: languageName: node linkType: hard -"send@npm:0.19.0": - version: 0.19.0 - resolution: "send@npm:0.19.0" +"send@npm:~0.19.1": + version: 0.19.2 + resolution: "send@npm:0.19.2" dependencies: debug: 2.6.9 depd: 2.0.0 destroy: 1.2.0 - encodeurl: ~1.0.2 + encodeurl: ~2.0.0 escape-html: ~1.0.3 etag: ~1.8.1 - fresh: 0.5.2 - http-errors: 2.0.0 + fresh: ~0.5.2 + http-errors: ~2.0.1 mime: 1.6.0 ms: 2.1.3 - on-finished: 2.4.1 + on-finished: ~2.4.1 range-parser: ~1.2.1 - statuses: 2.0.1 - checksum: 5ae11bd900c1c2575525e2aa622e856804e2f96a09281ec1e39610d089f53aa69e13fd8db84b52f001d0318cf4bb0b3b904ad532fc4c0014eb90d32db0cff55f + statuses: ~2.0.2 + checksum: f9e11b718b48dbea72daa6a80e36e5a00fb6d01b1a6cfda8b3135c9ca9db84257738283da23371f437148ccd8f400e6171cd2a3642fb43fda462da407d9d30c0 languageName: node linkType: hard @@ -13470,14 +13528,14 @@ __metadata: linkType: hard "serve-static@npm:^1.13.1, serve-static@npm:^1.16.2": - version: 1.16.2 - resolution: "serve-static@npm:1.16.2" + version: 1.16.3 + resolution: "serve-static@npm:1.16.3" dependencies: encodeurl: ~2.0.0 escape-html: ~1.0.3 parseurl: ~1.3.3 - send: 0.19.0 - checksum: dffc52feb4cc5c68e66d0c7f3c1824d4e989f71050aefc9bd5f822a42c54c9b814f595fc5f2b717f4c7cc05396145f3e90422af31186a93f76cf15f707019759 + send: ~0.19.1 + checksum: ec7599540215e6676b223ea768bf7c256819180bf14f89d0b5d249a61bbb8f10b05b2a53048a153cb2cc7f3b367f1227d2fb715fe4b09d07299a9233eda1a453 languageName: node linkType: hard @@ -13532,7 +13590,7 @@ __metadata: languageName: node linkType: hard -"setprototypeof@npm:1.2.0": +"setprototypeof@npm:~1.2.0": version: 1.2.0 resolution: "setprototypeof@npm:1.2.0" checksum: be18cbbf70e7d8097c97f713a2e76edf84e87299b40d085c6bf8b65314e994cc15e2e317727342fa6996e38e1f52c59720b53fe621e2eb593a6847bf0356db89 @@ -13791,12 +13849,12 @@ __metadata: languageName: node linkType: hard -"ssri@npm:^12.0.0": - version: 12.0.0 - resolution: "ssri@npm:12.0.0" +"ssri@npm:^13.0.0": + version: 13.0.0 + resolution: "ssri@npm:13.0.0" dependencies: minipass: ^7.0.3 - checksum: ef4b6b0ae47b4a69896f5f1c4375f953b9435388c053c36d27998bc3d73e046969ccde61ab659e679142971a0b08e50478a1228f62edb994105b280f17900c98 + checksum: 9705dff9e686b11f3035fb4c3d44ce690359a15a54adcd6a18951f2763f670877321178dc72c37a2b804dba3287ecaa48726dbd0cff79b2715b1cc24521b3af3 languageName: node linkType: hard @@ -13832,13 +13890,6 @@ __metadata: languageName: node linkType: hard -"statuses@npm:2.0.1": - version: 2.0.1 - resolution: "statuses@npm:2.0.1" - checksum: 18c7623fdb8f646fb213ca4051be4df7efb3484d4ab662937ca6fbef7ced9b9e12842709872eb3020cc3504b93bde88935c9f6417489627a7786f24f8031cbcb - languageName: node - linkType: hard - "statuses@npm:~1.5.0": version: 1.5.0 resolution: "statuses@npm:1.5.0" @@ -13846,6 +13897,13 @@ __metadata: languageName: node linkType: hard +"statuses@npm:~2.0.2": + version: 2.0.2 + resolution: "statuses@npm:2.0.2" + checksum: 6927feb50c2a75b2a4caab2c565491f7a93ad3d8dbad7b1398d52359e9243a20e2ebe35e33726dee945125ef7a515e9097d8a1b910ba2bbd818265a2f6c39879 + languageName: node + linkType: hard + "stop-iteration-iterator@npm:^1.1.0": version: 1.1.0 resolution: "stop-iteration-iterator@npm:1.1.0" @@ -14154,16 +14212,16 @@ __metadata: languageName: node linkType: hard -"tar@npm:^7.4.3": - version: 7.5.1 - resolution: "tar@npm:7.5.1" +"tar@npm:^7.5.2": + version: 7.5.2 + resolution: "tar@npm:7.5.2" dependencies: "@isaacs/fs-minipass": ^4.0.0 chownr: ^3.0.0 minipass: ^7.1.2 minizlib: ^3.1.0 yallist: ^5.0.0 - checksum: dbd55d4c3bd9e3c69aed137d9dc9fcb8f86afd103c28d97d52728ca80708f4c84b07e0a01d0bf1c8e820be84d37632325debf19f672a06e0c605c57a03636fd0 + checksum: 192559b0e7af17d57c7747592ef22c14d5eba2d9c35996320ccd20c3e2038160fe8d928fc5c08b2aa1b170c4d0a18c119441e81eae8f227ca2028d5bcaa6bf23 languageName: node linkType: hard @@ -14191,8 +14249,8 @@ __metadata: linkType: hard "terser@npm:^5.15.0": - version: 5.44.0 - resolution: "terser@npm:5.44.0" + version: 5.44.1 + resolution: "terser@npm:5.44.1" dependencies: "@jridgewell/source-map": ^0.3.3 acorn: ^8.15.0 @@ -14200,7 +14258,7 @@ __metadata: source-map-support: ~0.5.20 bin: terser: bin/terser - checksum: 4e1868d9662ea280dad7b49cfe61b7693187be2b529b31b1f86782db00833c03ba05f2b82fc513d928e937260f2a5fbf42a93724e86eaf55f069288f934ccdb3 + checksum: 1113c5711bb53127f9886e3c906fde8a93a665b532db9c7e36ff7bf287e032ed48ea0e5a3a1a27f6a27c3c0f934e47e7590fcd15c76b7b7bd44ad751b8a9ede4 languageName: node linkType: hard @@ -14256,13 +14314,13 @@ __metadata: linkType: hard "tinyest@npm:~0.1.0-alpha.1": - version: 0.1.1 - resolution: "tinyest@npm:0.1.1" - checksum: 8f3352dc071cd146fdbd6e498af68588d20d283b26c2453f0f71dcbe609538cf296f1b189a94ead2cca8e2385c7ae4f2041eacfc5eab0e048fa8987ebbdf7bbf + version: 0.1.2 + resolution: "tinyest@npm:0.1.2" + checksum: b40e8d444a5801ae813694a35cb843549d45afc26c3302c741ef2b95fbe9f393eb25403a5c6eed2ea05a25118ccbf372e3d996c87b3c5da363399afe60763302 languageName: node linkType: hard -"tinyglobby@npm:^0.2.12, tinyglobby@npm:^0.2.13": +"tinyglobby@npm:^0.2.12, tinyglobby@npm:^0.2.13, tinyglobby@npm:^0.2.15": version: 0.2.15 resolution: "tinyglobby@npm:0.2.15" dependencies: @@ -14288,7 +14346,7 @@ __metadata: languageName: node linkType: hard -"toidentifier@npm:1.0.1": +"toidentifier@npm:~1.0.1": version: 1.0.1 resolution: "toidentifier@npm:1.0.1" checksum: 952c29e2a85d7123239b5cfdd889a0dde47ab0497f0913d70588f19c53f7e0b5327c95f4651e413c74b785147f9637b17410ac8c846d5d4a20a5a33eb6dc3a45 @@ -14331,12 +14389,12 @@ __metadata: languageName: node linkType: hard -"ts-api-utils@npm:^2.1.0": - version: 2.1.0 - resolution: "ts-api-utils@npm:2.1.0" +"ts-api-utils@npm:^2.4.0": + version: 2.4.0 + resolution: "ts-api-utils@npm:2.4.0" peerDependencies: typescript: ">=4.8.4" - checksum: 5b1ef89105654d93d67582308bd8dfe4bbf6874fccbcaa729b08fbb00a940fd4c691ca6d0d2b18c3c70878d9a7e503421b7cc473dbc3d0d54258b86401d4b15d + checksum: beae72a4fa22a7cc91a8a0f3dfb487d72e30f06ac50ff72f327d061dea2d4940c6451d36578d949caad3893d4d2c7d42d53b7663597ccda54ad32cdb842c3e34 languageName: node linkType: hard @@ -14395,10 +14453,10 @@ __metadata: linkType: hard "tsx@npm:^4.20.5": - version: 4.20.6 - resolution: "tsx@npm:4.20.6" + version: 4.21.0 + resolution: "tsx@npm:4.21.0" dependencies: - esbuild: ~0.25.0 + esbuild: ~0.27.0 fsevents: ~2.3.3 get-tsconfig: ^4.7.5 dependenciesMeta: @@ -14406,62 +14464,62 @@ __metadata: optional: true bin: tsx: dist/cli.mjs - checksum: d514bea59ec58fe7746271dd287b52e6e482a2236dd486d2fbf2eab11810ad2bc37e064210580824ce1c91a3e1ddd952499e6f48055e087abff5472468ac0d7b + checksum: 50c98e4b6e66d1c30f72925c8e5e7be1a02377574de7cd367d7e7a6d4af43ca8ff659f91c654e7628b25a5498015e32f090529b92c679b0342811e1cf682e8cf languageName: node linkType: hard -"turbo-darwin-64@npm:2.5.8": - version: 2.5.8 - resolution: "turbo-darwin-64@npm:2.5.8" +"turbo-darwin-64@npm:2.7.4": + version: 2.7.4 + resolution: "turbo-darwin-64@npm:2.7.4" conditions: os=darwin & cpu=x64 languageName: node linkType: hard -"turbo-darwin-arm64@npm:2.5.8": - version: 2.5.8 - resolution: "turbo-darwin-arm64@npm:2.5.8" +"turbo-darwin-arm64@npm:2.7.4": + version: 2.7.4 + resolution: "turbo-darwin-arm64@npm:2.7.4" conditions: os=darwin & cpu=arm64 languageName: node linkType: hard -"turbo-linux-64@npm:2.5.8": - version: 2.5.8 - resolution: "turbo-linux-64@npm:2.5.8" +"turbo-linux-64@npm:2.7.4": + version: 2.7.4 + resolution: "turbo-linux-64@npm:2.7.4" conditions: os=linux & cpu=x64 languageName: node linkType: hard -"turbo-linux-arm64@npm:2.5.8": - version: 2.5.8 - resolution: "turbo-linux-arm64@npm:2.5.8" +"turbo-linux-arm64@npm:2.7.4": + version: 2.7.4 + resolution: "turbo-linux-arm64@npm:2.7.4" conditions: os=linux & cpu=arm64 languageName: node linkType: hard -"turbo-windows-64@npm:2.5.8": - version: 2.5.8 - resolution: "turbo-windows-64@npm:2.5.8" +"turbo-windows-64@npm:2.7.4": + version: 2.7.4 + resolution: "turbo-windows-64@npm:2.7.4" conditions: os=win32 & cpu=x64 languageName: node linkType: hard -"turbo-windows-arm64@npm:2.5.8": - version: 2.5.8 - resolution: "turbo-windows-arm64@npm:2.5.8" +"turbo-windows-arm64@npm:2.7.4": + version: 2.7.4 + resolution: "turbo-windows-arm64@npm:2.7.4" conditions: os=win32 & cpu=arm64 languageName: node linkType: hard "turbo@npm:^2.1.0": - version: 2.5.8 - resolution: "turbo@npm:2.5.8" - dependencies: - turbo-darwin-64: 2.5.8 - turbo-darwin-arm64: 2.5.8 - turbo-linux-64: 2.5.8 - turbo-linux-arm64: 2.5.8 - turbo-windows-64: 2.5.8 - turbo-windows-arm64: 2.5.8 + version: 2.7.4 + resolution: "turbo@npm:2.7.4" + dependencies: + turbo-darwin-64: 2.7.4 + turbo-darwin-arm64: 2.7.4 + turbo-linux-64: 2.7.4 + turbo-linux-arm64: 2.7.4 + turbo-windows-64: 2.7.4 + turbo-windows-arm64: 2.7.4 dependenciesMeta: turbo-darwin-64: optional: true @@ -14477,7 +14535,7 @@ __metadata: optional: true bin: turbo: bin/turbo - checksum: f1d6d84e828f7f2d41ae7598507267c7ed8de22307507a304da8353ce4e47cf38c1c7c26e6249c1247ea7702eebd6c062b6fcf037c565b2a94417690956c8cb5 + checksum: 1f06ff6b0d02e2dd572791fc4979fcfb941e0127a65aec9dceb61c725f86910779f353576f395e2a6cf7336b496b6bbf6f3f4a3ae785ef80622a0378dd96c7b3 languageName: node linkType: hard @@ -14686,10 +14744,10 @@ __metadata: languageName: node linkType: hard -"undici-types@npm:~7.14.0": - version: 7.14.0 - resolution: "undici-types@npm:7.14.0" - checksum: bd28cb36b33a51359f02c27b84bfe8563cdad57bdab0aa6ac605ce64d51aff49fd0aa4cb2d3b043caaa93c3ec42e96b5757df5d2d9bcc06a5f3e71899c765035 +"undici-types@npm:~7.16.0": + version: 7.16.0 + resolution: "undici-types@npm:7.16.0" + checksum: 1ef68fc6c5bad200c8b6f17de8e5bc5cfdcadc164ba8d7208cd087cfa8583d922d8316a7fd76c9a658c22b4123d3ff847429185094484fbc65377d695c905857 languageName: node linkType: hard @@ -14724,21 +14782,21 @@ __metadata: languageName: node linkType: hard -"unique-filename@npm:^4.0.0": - version: 4.0.0 - resolution: "unique-filename@npm:4.0.0" +"unique-filename@npm:^5.0.0": + version: 5.0.0 + resolution: "unique-filename@npm:5.0.0" dependencies: - unique-slug: ^5.0.0 - checksum: 6a62094fcac286b9ec39edbd1f8f64ff92383baa430af303dfed1ffda5e47a08a6b316408554abfddd9730c78b6106bef4ca4d02c1231a735ddd56ced77573df + unique-slug: ^6.0.0 + checksum: a5f67085caef74bdd2a6869a200ed5d68d171f5cc38435a836b5fd12cce4e4eb55e6a190298035c325053a5687ed7a3c96f0a91e82215fd14729769d9ac57d9b languageName: node linkType: hard -"unique-slug@npm:^5.0.0": - version: 5.0.0 - resolution: "unique-slug@npm:5.0.0" +"unique-slug@npm:^6.0.0": + version: 6.0.0 + resolution: "unique-slug@npm:6.0.0" dependencies: imurmurhash: ^0.1.4 - checksum: 222d0322bc7bbf6e45c08967863212398313ef73423f4125e075f893a02405a5ffdbaaf150f7dd1e99f8861348a486dd079186d27c5f2c60e465b7dcbb1d3e5b + checksum: ad6cf238b10292d944521714d31bc9f3ca79fa80cb7a154aad183056493f98e85de669412c6bbfe527ffa9bdeff36d3dd4d5bccaf562c794f2580ab11932b691 languageName: node linkType: hard @@ -14830,9 +14888,9 @@ __metadata: languageName: node linkType: hard -"update-browserslist-db@npm:^1.1.3": - version: 1.1.3 - resolution: "update-browserslist-db@npm:1.1.3" +"update-browserslist-db@npm:^1.2.0": + version: 1.2.3 + resolution: "update-browserslist-db@npm:1.2.3" dependencies: escalade: ^3.2.0 picocolors: ^1.1.1 @@ -14840,7 +14898,7 @@ __metadata: browserslist: ">= 4.21.0" bin: update-browserslist-db: cli.js - checksum: 7b6d8d08c34af25ee435bccac542bedcb9e57c710f3c42421615631a80aa6dd28b0a81c9d2afbef53799d482fb41453f714b8a7a0a8003e3b4ec8fb1abb819af + checksum: 6f209a97ae8eacdd3a1ef2eb365adf49d1e2a757e5b2dd4ac87dc8c99236cbe3e572d3e605a87dd7b538a11751b71d9f93edc47c7405262a293a493d155316cd languageName: node linkType: hard @@ -14940,14 +14998,14 @@ __metadata: languageName: node linkType: hard -"vega-dataflow@npm:^5.7.3, vega-dataflow@npm:^5.7.4, vega-dataflow@npm:^5.7.5, vega-dataflow@npm:^5.7.7, vega-dataflow@npm:~5.7.3": - version: 5.7.7 - resolution: "vega-dataflow@npm:5.7.7" +"vega-dataflow@npm:^5.7.3, vega-dataflow@npm:^5.7.4, vega-dataflow@npm:^5.7.5, vega-dataflow@npm:^5.7.8, vega-dataflow@npm:~5.7.3": + version: 5.7.8 + resolution: "vega-dataflow@npm:5.7.8" dependencies: - vega-format: ^1.1.3 - vega-loader: ^4.5.3 - vega-util: ^1.17.3 - checksum: 43c1c039fea007dbca1a7c942821ac734a3068b3ef848f87b3b51265eb2dbd63796f58295313dda9ee8a6d308d9dfb7083530f69a5ffb0f756ce5345544cc60e + vega-format: ^1.1.4 + vega-loader: ^4.5.4 + vega-util: ^1.17.4 + checksum: edc99cc15fbef422171c4bcfbe9e3fe53c1961be1bc87194e5141c176e65853b31448e57b7dede0f9641e75ff83728750a741d63d8fe507146d1d691e4270515 languageName: node linkType: hard @@ -14995,13 +15053,13 @@ __metadata: languageName: node linkType: hard -"vega-expression@npm:^5.0.0, vega-expression@npm:^5.2.0": - version: 5.2.0 - resolution: "vega-expression@npm:5.2.0" +"vega-expression@npm:^5.0.0, vega-expression@npm:^5.2.1": + version: 5.2.1 + resolution: "vega-expression@npm:5.2.1" dependencies: "@types/estree": ^1.0.0 - vega-util: ^1.17.3 - checksum: 38df3b25ea994b28ec59fba869b9cb1e87518cedd3525886dc7aef5205372bac323635cd7be9907e4d71281e129689f475d3a688ea1ed015f4607088a27ca72a + vega-util: ^1.17.4 + checksum: d4331a522405c339c1fd0c8f8c60798d1acbcad0cbe6e5200afcdcefe58793c30d9d4b0d0d9eca937bfcb1fd8a33b335c540d580ae4d27ffa8939267b1fca6ac languageName: node linkType: hard @@ -15034,16 +15092,16 @@ __metadata: languageName: node linkType: hard -"vega-format@npm:^1.0.4, vega-format@npm:^1.1.3": - version: 1.1.3 - resolution: "vega-format@npm:1.1.3" +"vega-format@npm:^1.0.4, vega-format@npm:^1.1.4": + version: 1.1.4 + resolution: "vega-format@npm:1.1.4" dependencies: d3-array: ^3.2.2 d3-format: ^3.1.0 d3-time-format: ^4.1.0 - vega-time: ^2.1.3 - vega-util: ^1.17.3 - checksum: ed46385be98ed837bc23f2578e6e81bfe30be18de0c2bacea8d3d02811d62ca91631f875ffae385be201b669e55f4e1d48cbf926a5377da02ff73f12f8e4f9bf + vega-time: ^2.1.4 + vega-util: ^1.17.4 + checksum: d0967d0aefa8c755c4351e6deefcbdb751ff2a2f920ffadcfcb342f925bfd9b7d570ac0628bbe3de6a648556da5e9cbf134659462237f8c500ea3d6ab55e946f languageName: node linkType: hard @@ -15061,21 +15119,21 @@ __metadata: linkType: hard "vega-functions@npm:^5.10.0, vega-functions@npm:^5.12.1": - version: 5.18.0 - resolution: "vega-functions@npm:5.18.0" + version: 5.18.1 + resolution: "vega-functions@npm:5.18.1" dependencies: d3-array: ^3.2.2 d3-color: ^3.1.0 d3-geo: ^3.1.0 - vega-dataflow: ^5.7.7 - vega-expression: ^5.2.0 - vega-scale: ^7.4.2 - vega-scenegraph: ^4.13.1 - vega-selections: ^5.6.0 + vega-dataflow: ^5.7.8 + vega-expression: ^5.2.1 + vega-scale: ^7.4.3 + vega-scenegraph: ^4.13.2 + vega-selections: ^5.6.1 vega-statistics: ^1.9.0 - vega-time: ^2.1.3 - vega-util: ^1.17.3 - checksum: 3255bc908079d7f901c66e96dd65aa2a825a7be7e74b74d1ed6a07ba52e1e2419a9281c730be9251f2272803aaeb9a11b21ad9994fc1435f6e1a5aa9043d9e23 + vega-time: ^2.1.4 + vega-util: ^1.17.4 + checksum: 9f1e36eba28123c132c4598de0350f4b425bdc3ebf8bcdf07632c37abd4128870f216552c6d75e4b43dcc76efbff443b5b7b81b452ba5e329560e1bede03c2bf languageName: node linkType: hard @@ -15164,16 +15222,16 @@ __metadata: languageName: node linkType: hard -"vega-loader@npm:^4.3.3, vega-loader@npm:^4.5.3": - version: 4.5.3 - resolution: "vega-loader@npm:4.5.3" +"vega-loader@npm:^4.3.3, vega-loader@npm:^4.5.4": + version: 4.5.4 + resolution: "vega-loader@npm:4.5.4" dependencies: d3-dsv: ^3.0.1 node-fetch: ^2.6.7 topojson-client: ^3.1.0 - vega-format: ^1.1.3 - vega-util: ^1.17.3 - checksum: f3b87f12725de843ecd6a44f29800d5aae9966c1b07d632a70fef87cae93f433bc5e47ba25f45f99725f988cb424016453d1b0452ca695401b7b40c47b47b411 + vega-format: ^1.1.4 + vega-util: ^1.17.4 + checksum: 27de0ea61284bdaa83adaa1c9e474380134859962313aa22aeef21864b8de5de0eef6683db301d13fc63d7ea2ee9d5aa3d0307cc01fdc978648ac4952b610934 languageName: node linkType: hard @@ -15204,13 +15262,13 @@ __metadata: linkType: hard "vega-projection@npm:^1.4.5": - version: 1.6.2 - resolution: "vega-projection@npm:1.6.2" + version: 1.6.3 + resolution: "vega-projection@npm:1.6.3" dependencies: d3-geo: ^3.1.0 d3-geo-projection: ^4.0.0 - vega-scale: ^7.4.2 - checksum: 55deb14c22b4d39ec3d1248dc1718d2ae9addad8d11937617158a8c979fcfdaacf274ee55cebd111a72d6489af25c8351a5e7dbcc19bddb3221bf28ae5dd140d + vega-scale: ^7.4.3 + checksum: 785e5bbfc2b2d3ad586e8aef2dfeec6a30aa63084f2ed17f49c0564a9b15cf43a3f85bf03a32fe028731adc40c316b28c426db7ec3ead668544cfa85307aafcf languageName: node linkType: hard @@ -15237,12 +15295,12 @@ __metadata: linkType: hard "vega-runtime@npm:^6.1.3": - version: 6.2.1 - resolution: "vega-runtime@npm:6.2.1" + version: 6.2.2 + resolution: "vega-runtime@npm:6.2.2" dependencies: - vega-dataflow: ^5.7.7 - vega-util: ^1.17.3 - checksum: 5481f943c18c4277d3f0aabd3e06a2d37b57fde52ef2d2e93ade759184f530bbca4ed38e3708342338dac7d56ce94eb3c3cb30ef2e3d10a7b8ab796dee40e8e4 + vega-dataflow: ^5.7.8 + vega-util: ^1.17.4 + checksum: a726c95e6d29ca554b210895adb348dd0f6ba3131df58a4e9de6c6d7089a4b8aa2935116dcea1dad839676b389e22bfec6b4880fa086f4b8e1dad4c5bd71a41e languageName: node linkType: hard @@ -15256,17 +15314,17 @@ __metadata: languageName: node linkType: hard -"vega-scale@npm:^7.0.3, vega-scale@npm:^7.1.1, vega-scale@npm:^7.4.2": - version: 7.4.2 - resolution: "vega-scale@npm:7.4.2" +"vega-scale@npm:^7.0.3, vega-scale@npm:^7.1.1, vega-scale@npm:^7.4.3": + version: 7.4.3 + resolution: "vega-scale@npm:7.4.3" dependencies: d3-array: ^3.2.2 d3-interpolate: ^3.0.1 d3-scale: ^4.0.2 d3-scale-chromatic: ^3.1.0 - vega-time: ^2.1.3 - vega-util: ^1.17.3 - checksum: 3168ad4e9e80075f8d521947070225906085bdfeafe774c31f7549b3b80d31d5cb3f94e9cd8d408098bfe6431347fa95ae7654b006d7893f33057a789cc75156 + vega-time: ^2.1.4 + vega-util: ^1.17.4 + checksum: 8ea9a93ea36584f402242bf6f3b6adaf39d8e6d605d9c6134449676bd9eb87aaf56c83fcded1b75a6aa8196d62c2c2ebe1bc52f0a22d87169d2b0e336ec42e25 languageName: node linkType: hard @@ -15283,17 +15341,17 @@ __metadata: languageName: node linkType: hard -"vega-scenegraph@npm:^4.10.2, vega-scenegraph@npm:^4.13.1, vega-scenegraph@npm:^4.9.2, vega-scenegraph@npm:^4.9.3, vega-scenegraph@npm:^4.9.4": - version: 4.13.1 - resolution: "vega-scenegraph@npm:4.13.1" +"vega-scenegraph@npm:^4.10.2, vega-scenegraph@npm:^4.13.2, vega-scenegraph@npm:^4.9.2, vega-scenegraph@npm:^4.9.3, vega-scenegraph@npm:^4.9.4": + version: 4.13.2 + resolution: "vega-scenegraph@npm:4.13.2" dependencies: d3-path: ^3.1.0 d3-shape: ^3.2.0 vega-canvas: ^1.2.7 - vega-loader: ^4.5.3 - vega-scale: ^7.4.2 - vega-util: ^1.17.3 - checksum: 66ef0e8fd50f3794aece2f951c2c092518e52448b4ecd334cca944e1161b3c1b9680b8743ca0358c1b3e92e1b81aaa6ce5042dce5c5a20e3bcdd22613378b7d0 + vega-loader: ^4.5.4 + vega-scale: ^7.4.3 + vega-util: ^1.17.4 + checksum: d6bb56485028ea87320fd94202726bb1d6bf85c48163f9fe1063647ab4c03dcfed021d4736172920b075642c2da217471c4d4862bc01eb83d185ee3f6b05eb85 languageName: node linkType: hard @@ -15318,14 +15376,14 @@ __metadata: languageName: node linkType: hard -"vega-selections@npm:^5.3.1, vega-selections@npm:^5.6.0": - version: 5.6.0 - resolution: "vega-selections@npm:5.6.0" +"vega-selections@npm:^5.3.1, vega-selections@npm:^5.6.1": + version: 5.6.3 + resolution: "vega-selections@npm:5.6.3" dependencies: d3-array: 3.2.4 - vega-expression: ^5.2.0 - vega-util: ^1.17.3 - checksum: 6533b003fbc4cd523ae5c7650e5e905007fe37ac3db01ad6f652b62b3ab6a846441ddd38018a7e13cf275e176d92c193e2100c02aac8f03788f51326aeafd5fd + vega-expression: ^5.2.1 + vega-util: ^1.17.4 + checksum: ab0a7b2e35ccac2575860a9593520c22c473660b0983a9eeeaf897882e172954b2f15c16eb93c797535d0decf218348a01eb0087252808dc47a9f7b20c1b1d11 languageName: node linkType: hard @@ -15357,14 +15415,14 @@ __metadata: languageName: node linkType: hard -"vega-time@npm:^2.0.3, vega-time@npm:^2.0.4, vega-time@npm:^2.1.3": - version: 2.1.3 - resolution: "vega-time@npm:2.1.3" +"vega-time@npm:^2.0.3, vega-time@npm:^2.0.4, vega-time@npm:^2.1.4": + version: 2.1.4 + resolution: "vega-time@npm:2.1.4" dependencies: d3-array: ^3.2.2 d3-time: ^3.1.0 - vega-util: ^1.17.3 - checksum: c2a72ac6593ea1fabab95b72ce33b89a6ce2161330bcbaaa6508d61bbcd7edc940a9e76ae6d9a979be9d7c81eef4b26cd3592209bac201eca7356dfea7cc38ac + vega-util: ^1.17.4 + checksum: 344c8aaf23502cd5631a010144c4618f8e756f95e4bda4a86031a6e6c6041d964c1efa181d2648ab656121d1166df5b7cc05177ae2c20804f14f3e776405fd45 languageName: node linkType: hard @@ -15410,10 +15468,10 @@ __metadata: languageName: node linkType: hard -"vega-util@npm:^1.15.0, vega-util@npm:^1.15.2, vega-util@npm:^1.16.0, vega-util@npm:^1.16.1, vega-util@npm:^1.17.1, vega-util@npm:^1.17.3": - version: 1.17.3 - resolution: "vega-util@npm:1.17.3" - checksum: d8bb21e2cb2ffa005bc3d9859d13aca8a0f13d6a143b8e12598c307de011ce1bc947402769e735ceb62d3b4e648214bdc00664aea1d819ad56563090e96d44b5 +"vega-util@npm:^1.15.0, vega-util@npm:^1.15.2, vega-util@npm:^1.16.0, vega-util@npm:^1.16.1, vega-util@npm:^1.17.1, vega-util@npm:^1.17.4": + version: 1.17.4 + resolution: "vega-util@npm:1.17.4" + checksum: 07b4808fc5d43afc20566a15f4d02465c13d20ec8f36859f4be3ffad9ed3b12220c20efaa12aaf9bcc7b0a07003a513f038cbcebc6e3e90e2bfc3456be085bd0 languageName: node linkType: hard @@ -15470,15 +15528,15 @@ __metadata: linkType: hard "vega-wordcloud@npm:~4.1.3": - version: 4.1.6 - resolution: "vega-wordcloud@npm:4.1.6" + version: 4.1.7 + resolution: "vega-wordcloud@npm:4.1.7" dependencies: vega-canvas: ^1.2.7 - vega-dataflow: ^5.7.7 - vega-scale: ^7.4.2 + vega-dataflow: ^5.7.8 + vega-scale: ^7.4.3 vega-statistics: ^1.9.0 - vega-util: ^1.17.3 - checksum: 5f0cd55d6d4fcec1345be496eec57b38cd78b8294d4f88ea0cacc6241fc64543b50f4a3165640f93e73cf0a3d8866218673ce3720a467741c778a413899207e8 + vega-util: ^1.17.4 + checksum: 4c8270206126682706e53ad556364c63afcb1cc051603978cd5473a0602368a85a057bce8cf4ec6aa128b900139246735869e30cdd5c61d6724263c29182d448 languageName: node linkType: hard @@ -15666,14 +15724,14 @@ __metadata: languageName: node linkType: hard -"which@npm:^5.0.0": - version: 5.0.0 - resolution: "which@npm:5.0.0" +"which@npm:^6.0.0": + version: 6.0.0 + resolution: "which@npm:6.0.0" dependencies: isexe: ^3.1.1 bin: node-which: bin/which.js - checksum: 6ec99e89ba32c7e748b8a3144e64bfc74aa63e2b2eacbb61a0060ad0b961eb1a632b08fb1de067ed59b002cec3e21de18299216ebf2325ef0f78e0f121e14e90 + checksum: df19b2cd8aac94b333fa29b42e8e371a21e634a742a3b156716f7752a5afe1d73fb5d8bce9b89326f453d96879e8fe626eb421e0117eb1a3ce9fd8c97f6b7db9 languageName: node linkType: hard @@ -15770,8 +15828,8 @@ __metadata: linkType: hard "ws@npm:^8.18.0, ws@npm:^8.18.3": - version: 8.18.3 - resolution: "ws@npm:8.18.3" + version: 8.19.0 + resolution: "ws@npm:8.19.0" peerDependencies: bufferutil: ^4.0.1 utf-8-validate: ">=5.0.2" @@ -15780,7 +15838,7 @@ __metadata: optional: true utf-8-validate: optional: true - checksum: d64ef1631227bd0c5fe21b3eb3646c9c91229402fb963d12d87b49af0a1ef757277083af23a5f85742bae1e520feddfb434cb882ea59249b15673c16dc3f36e0 + checksum: 7a426122c373e053a65a2affbcdcdbf8f643ba0265577afd4e08595397ca244c05de81570300711e2363a9dab5aea3ae644b445bc7468b1ebbb51bfe2efb20e1 languageName: node linkType: hard @@ -15834,11 +15892,11 @@ __metadata: linkType: hard "yaml@npm:^2.2.1, yaml@npm:^2.6.1": - version: 2.8.1 - resolution: "yaml@npm:2.8.1" + version: 2.8.2 + resolution: "yaml@npm:2.8.2" bin: yaml: bin.mjs - checksum: 35b46150d48bc1da2fd5b1521a48a4fa36d68deaabe496f3c3fa9646d5796b6b974f3930a02c4b5aee6c85c860d7d7f79009416724465e835f40b87898c36de4 + checksum: 5ffd9f23bc7a450129cbd49dcf91418988f154ede10c83fd28ab293661ac2783c05da19a28d76a22cbd77828eae25d4bd7453f9a9fe2d287d085d72db46fd105 languageName: node linkType: hard @@ -15959,8 +16017,8 @@ __metadata: linkType: hard "zustand@npm:^5.0.3": - version: 5.0.8 - resolution: "zustand@npm:5.0.8" + version: 5.0.10 + resolution: "zustand@npm:5.0.10" peerDependencies: "@types/react": ">=18.0.0" immer: ">=9.0.6" @@ -15975,6 +16033,6 @@ __metadata: optional: true use-sync-external-store: optional: true - checksum: 1a0f896f335e21841509a605fb61db34342497c5073f8c4b69889a669f829c9cf39d0282d68ac8fec1c8814cdaa89ee6711d59989feb80dc0364f19ac72e75e0 + checksum: 52d39ad5a0a496a443ced50e773a47df4bda4f718c96e45a08c92675e45d7ac77ce75903b8e3754f17a2e99c71f5864ae8c2b2477aeb4c6f5c2a19e3e64e57ba languageName: node linkType: hard From 71146783500fe6b17089fb5256ec9347b08d2371 Mon Sep 17 00:00:00 2001 From: William Candillon Date: Wed, 14 Jan 2026 12:03:34 +0100 Subject: [PATCH 11/23] :wrench: --- apps/example/ios/Podfile.lock | 126 +++++++++--------- packages/webgpu/android/CMakeLists.txt | 2 + packages/webgpu/cpp/jsi/NativeObject.h | 94 ++++++++++--- packages/webgpu/cpp/jsi/RuntimeAwareCache.cpp | 7 + .../cpp/jsi/RuntimeLifecycleMonitor.cpp | 72 ++++++++++ .../webgpu/cpp/jsi/RuntimeLifecycleMonitor.h | 32 +++++ .../webgpu/cpp/rnwgpu/RNWebGPUManager.cpp | 4 + 7 files changed, 259 insertions(+), 78 deletions(-) create mode 100644 packages/webgpu/cpp/jsi/RuntimeAwareCache.cpp create mode 100644 packages/webgpu/cpp/jsi/RuntimeLifecycleMonitor.cpp create mode 100644 packages/webgpu/cpp/jsi/RuntimeLifecycleMonitor.h diff --git a/apps/example/ios/Podfile.lock b/apps/example/ios/Podfile.lock index fa950bfe6..a5c0bd284 100644 --- a/apps/example/ios/Podfile.lock +++ b/apps/example/ios/Podfile.lock @@ -2868,80 +2868,80 @@ SPEC CHECKSUMS: fmt: a40bb5bd0294ea969aaaba240a927bd33d878cdd glog: 5683914934d5b6e4240e497e0f4a3b42d1854183 hermes-engine: 35c763d57c9832d0eef764316ca1c4d043581394 - RCT-Folly: 846fda9475e61ec7bcbf8a3fe81edfcaeb090669 + RCT-Folly: 59ec0ac1f2f39672a0c6e6cecdd39383b764646f RCTDeprecation: c0ed3249a97243002615517dff789bf4666cf585 RCTRequired: 58719f5124f9267b5f9649c08bf23d9aea845b23 RCTTypeSafety: 4aefa8328ab1f86da273f08517f1f6b343f6c2cc React: 2073376f47c71b7e9a0af7535986a77522ce1049 React-callinvoker: 751b6f2c83347a0486391c3f266f291f0f53b27e - React-Core: dff5d29973349b11dd6631c9498456d75f846d5e - React-CoreModules: c0ae04452e4c5d30e06f8e94692a49107657f537 - React-cxxreact: 376fd672c95dfb64ad5cc246e6a1e9edb78dec4c + React-Core: 7195661f0b48e7ea46c3360ccb575288a20c932c + React-CoreModules: 14f0054ab46000dd3b816d6528af3bd600d82073 + React-cxxreact: 7f602425c63096c398dac13cd7a300efd7c281ae React-debug: 7b56a0a7da432353287d2eedac727903e35278f5 - React-defaultsnativemodule: 393b81aaa6211408f50a6ef00a277847256dd881 - React-domnativemodule: 5fb5829baa7a7a0f217019cbad1eb226d94f7062 - React-Fabric: a17c4ae35503673b57b91c2d1388429e7cbee452 - React-FabricComponents: a76572ddeba78ebe4ec58615291e9db4a55cd46a - React-FabricImage: d806eb2695d7ef355ec28d1a21f5a14ac26b1cae - React-featureflags: 1690ec3c453920b6308e23a4e24eb9c3632f9c75 - React-featureflagsnativemodule: 7b7e8483fc671c5a33aefd699b7c7a3c0bdfdfec - React-graphics: ea146ee799dc816524a3a0922fc7be0b5a52dcc1 - React-hermes: fcbdc45ecf38259fe3b12642bd0757c52270a107 - React-idlecallbacksnativemodule: a353f9162eaa7ad787e68aba9f52a1cfa8154098 - React-ImageManager: ec5cf55ce9cc81719eb5f1f51d23d04db851c86c - React-jserrorhandler: 594c593f3d60f527be081e2cace7710c2bd9f524 - React-jsi: 59ec3190dd364cca86a58869e7755477d2468948 - React-jsiexecutor: b87d78a2e8dd7a6f56e9cdac038da45de98c944f - React-jsinspector: b9204adf1af622c98e78af96ec1bca615c2ce2bd - React-jsinspectorcdp: 4a356fa69e412d35d3a38c44d4a6cc555c5931e8 - React-jsinspectornetwork: 7820056773178f321cbf18689e1ffcd38276a878 - React-jsinspectortracing: b341c5ef6e031a33e0bd462d67fd397e8e9cd612 - React-jsitooling: 401655e05cb966b0081225c5201d90734a567cb9 - React-jsitracing: 67eff6dea0cb58a1e7bd8b49243012d88c0f511e - React-logger: a3cb5b29c32b8e447b5a96919340e89334062b48 - React-Mapbuffer: 9d2434a42701d6144ca18f0ca1c4507808ca7696 - React-microtasksnativemodule: 75b6604b667d297292345302cc5bfb6b6aeccc1b - react-native-safe-area-context: c00143b4823773bba23f2f19f85663ae89ceb460 - react-native-skia: 5bf2b2107cd7f2d806fd364f5e16b1c7554ed3cd - react-native-wgpu: e54fcee5946cc2cee4814f63f425be358f097b14 - React-NativeModulesApple: 879fbdc5dcff7136abceb7880fe8a2022a1bd7c3 + React-defaultsnativemodule: 695d8a0b40f735edb3c4031e0f049e567fdac47a + React-domnativemodule: 6d66c1f61f277d008d98cae650ce2c025b89d3b9 + React-Fabric: 997d4115d688f483cb409a1290171bff3c93dab4 + React-FabricComponents: 8167e5e363ca3a3fe394d8afee355e4072bea1db + React-FabricImage: f8f9f2c97657116702acc670e3f4357bc842bed3 + React-featureflags: dfb4d0d527d55dd968231370f6832b9197ee653d + React-featureflagsnativemodule: c63cfd8fe95cd98f12ebb37daa919c4544810a45 + React-graphics: fd795f1c2a1133a08dde31725b20949edd545dca + React-hermes: 0a167bbb02c242664745e82154578c64e90a88e5 + React-idlecallbacksnativemodule: 1798c6aa33ddc7c2e9fa3c3d67729728639889e9 + React-ImageManager: c498ee6945dffacc82bfa175aa3264212f27c70b + React-jserrorhandler: 216951fea62fc26c600f4c96f0dc4fd53d1e7a9b + React-jsi: 9c27d27d3007b73c702ad3fd5a6166557c741020 + React-jsiexecutor: 2b24f4ed4026344a27f717bf947a434cbbeeff7a + React-jsinspector: 02394b059c48805780f7d977366317a24168d00e + React-jsinspectorcdp: f4b6d5c5c9db05ef44d082716714f90cfeed96bb + React-jsinspectornetwork: e7c77d01b5f0664e24c0bec1aea27d5e3d7fb746 + React-jsinspectortracing: aaa96a4e53abb88dc6d47da3b5744c710652fef9 + React-jsitooling: 226e5f4147c7b6f1ae1954a8406ffa713f3da828 + React-jsitracing: 8a2fbeaa9c53c3f0b23904ccffefc890eae48d71 + React-logger: 1767babce2d28c3251039ce05556714a2c8c6ded + React-Mapbuffer: 33f678ee25b6c0ee2b01b1ecec08e3e02424cefe + React-microtasksnativemodule: 44b44a4d3cd6ffb85d928abf741acdc26722de2e + react-native-safe-area-context: 54d812805f3c4e08a4580ad086cbde1d8780c2e4 + react-native-skia: 4df548eb44d05ce5e35679b15a9d765e5724126e + react-native-wgpu: fa7a2c0ddafb2317422878cba8dbbbcd1c38c18f + React-NativeModulesApple: b5d18bc109c45c9a1c6b71664991b5cc3adc4e48 React-oscompat: 93b5535ea7f7dff46aaee4f78309a70979bdde9d - React-perflogger: 5536d2df3d18fe0920263466f7b46a56351c0510 - React-performancetimeline: 9041c53efa07f537164dcfe7670a36642352f4c2 + React-perflogger: a03d913e3205b00aee4128082abe42fd45ce0c98 + React-performancetimeline: 9b5986cc15afafb9bf246d7dd55bdd138df94451 React-RCTActionSheet: 42195ae666e6d79b4af2346770f765b7c29435b9 - React-RCTAnimation: fa103ccc3503b1ed8dedca7e62e7823937748843 - React-RCTAppDelegate: 665d4baf19424cef08276e9ac0d8771eec4519f9 - React-RCTBlob: 0fa9530c255644db095f2c4fd8d89738d9d9ecc0 - React-RCTFabric: 1fcd8af6e25f92532f56b4ba092e58662c14d156 - React-RCTFBReactNativeSpec: db171247585774f9f0a30f75109cc51568686213 - React-RCTImage: ba824e61ce2e920a239a65d130b83c3a1d426dff - React-RCTLinking: d2dc199c37e71e6f505d9eca3e5c33be930014d4 - React-RCTNetwork: 87137d4b9bd77e5068f854dd5c1f30d4b072faf6 - React-RCTRuntime: 137fafaa808a8b7e76a510e8be45f9f827899daa - React-RCTSettings: 71f5c7fd7b5f4e725a4e2114a4b4373d0e46048f - React-RCTText: b94d4699b49285bee22b8ebf768924d607eccee3 - React-RCTVibration: 6e3993c4f6c36a3899059f9a9ead560ddaf5a7d7 + React-RCTAnimation: 5c10527683128c56ff2c09297fb080f7c35bd293 + React-RCTAppDelegate: c616bd5b0d12f0b21dfacee9cd2d512c6df013aa + React-RCTBlob: 6e3757bdd7dce6fd9788c0dd675fd6b6c432db9d + React-RCTFabric: e8f3b9da97477710bf0904a62eb5b5209c964694 + React-RCTFBReactNativeSpec: c042f8d60d44ad9e2c722da89323c0bdab7a37af + React-RCTImage: a3482fe1ae562d1bab08b42d4670a7c9a21813cd + React-RCTLinking: d82b9adb141aef9d2b38d446b837ae7017ab60aa + React-RCTNetwork: fa9350dd99354c5695964f589bd4790bdd4f6a85 + React-RCTRuntime: be99a38cd23388c08921d8969c82a1997a11ec90 + React-RCTSettings: b7f4a03f44dba1d3a4dc6770843547b203ca9129 + React-RCTText: 91dc597a5f6b27fd1048bb287c41ea05eeca9333 + React-RCTVibration: 27b09ddf74bddfa30a58d20e48f885ea6ed6c9d9 React-rendererconsistency: b4785e5ed837dc7c242bbc5fdd464b33ef5bfae7 - React-renderercss: e6fb0ba387b389c595ffa86b8b628716d31f58dc - React-rendererdebug: 60a03de5c7ea59bf2d39791eb43c4c0f5d8b24e3 - React-RuntimeApple: 3df6788cd9b938bb8cb28298d80b5fbd98a4d852 - React-RuntimeCore: fad8adb4172c414c00ff6980250caf35601a0f5d - React-runtimeexecutor: d2db7e72d97751855ea0bf5273d2ac84e5ea390c - React-RuntimeHermes: 04faa4cf9a285136a6d73738787fe36020170613 - React-runtimescheduler: f6a1c9555e7131b4a8b64cce01489ad0405f6e8d - React-timing: 1e6a8acb66e2b7ac9d418956617fd1fdb19322fd - React-utils: 52bbb03f130319ef82e4c3bc7a85eaacdb1fec87 - ReactAppDependencyProvider: 433ddfb4536948630aadd5bd925aff8a632d2fe3 - ReactCodegen: 64dbbed4e9e0264d799578ea78492479a66fba4a - ReactCommon: 394c6b92765cf6d211c2c3f7f6bc601dffb316a6 - ReactNativeHost: f5e054387e917216a2a021a3f7fdc4f9f158e7e4 - ReactTestApp-DevSupport: 9b7bbba5e8fed998e763809171d9906a1375f9d3 + React-renderercss: cef3f26df2ddec558ce3c0790fc574b4fb62ce67 + React-rendererdebug: e68433ae67738caeb672a6c8cc993e9276b298a9 + React-RuntimeApple: dc1d4709bf847bc695dbe6e8aaf3e22ef25aef02 + React-RuntimeCore: ca3473c8b6578693fa3bad4d44240098d49d6723 + React-runtimeexecutor: 0db3ca0b09cd72489cef3a3729349b3c2cf13320 + React-RuntimeHermes: f92cabaf97ef2546a74360eddfc1c74a34cb9ff8 + React-runtimescheduler: 06aea75069e0d556a75d258bfc89eb0ebd5d557e + React-timing: 1a90df9a04d8e7fd165ff7fa0918b9595c776373 + React-utils: 92115441fb55ce01ded4abfb5e9336a74cd93e9c + ReactAppDependencyProvider: b20fba6c3d091a393925890009999472c8f94d95 + ReactCodegen: cf03d376a26d393f818d511240b026fc8c95313c + ReactCommon: 00df7b9f859c9d02181844255bb89a8bca544374 + ReactNativeHost: b63ce830e7c5b4e3adcf556b2ef41665da189da0 + ReactTestApp-DevSupport: c7bff1aee7663f2fb1eefcf60c41573f02916c41 ReactTestApp-Resources: 1bd9ff10e4c24f2ad87101a32023721ae923bccf - RNGestureHandler: e37bdb684df1ac17c7e1d8f71a3311b2793c186b - RNReanimated: 4e53390354d1eed1398ab51ace22b869be6ce611 + RNGestureHandler: 92ad734ef0da16d69d0a325b7e1e9ae80bdce1f9 + RNReanimated: 83cc191ee98a1e9269d1166628cdfe4f4fcc4ccd SocketRocket: d4aabe649be1e368d1318fdf28a022d714d65748 - Yoga: a3ed390a19db0459bd6839823a6ac6d9c6db198d + Yoga: 922d794dce2af9c437f864bf4093abfa7a131adb PODFILE CHECKSUM: b4c1d70c599aba416a49b6bad5eea5084b4e43d0 -COCOAPODS: 1.16.2 +COCOAPODS: 1.15.2 diff --git a/packages/webgpu/android/CMakeLists.txt b/packages/webgpu/android/CMakeLists.txt index 7363a5a80..cd198bd7d 100644 --- a/packages/webgpu/android/CMakeLists.txt +++ b/packages/webgpu/android/CMakeLists.txt @@ -45,6 +45,8 @@ add_library(${PACKAGE_NAME} SHARED ../cpp/rnwgpu/api/GPUCanvasContext.cpp ../cpp/rnwgpu/RNWebGPUManager.cpp ../cpp/jsi/Promise.cpp + ../cpp/jsi/RuntimeLifecycleMonitor.cpp + ../cpp/jsi/RuntimeAwareCache.cpp ../cpp/rnwgpu/async/AsyncRunner.cpp ../cpp/rnwgpu/async/AsyncTaskHandle.cpp ../cpp/rnwgpu/async/JSIMicrotaskDispatcher.cpp diff --git a/packages/webgpu/cpp/jsi/NativeObject.h b/packages/webgpu/cpp/jsi/NativeObject.h index 1496d32ac..ed76dccf7 100644 --- a/packages/webgpu/cpp/jsi/NativeObject.h +++ b/packages/webgpu/cpp/jsi/NativeObject.h @@ -4,6 +4,7 @@ #pragma once +#include #include #include #include @@ -14,6 +15,7 @@ #include #include +#include "RuntimeLifecycleMonitor.h" #include "WGPULogger.h" // Forward declare to avoid circular dependency @@ -38,26 +40,81 @@ struct PrototypeCacheEntry { }; /** - * Simple runtime-aware cache that stores data per-runtime. - * Used by NativeObject to cache prototypes per runtime. + * Base class for runtime-aware caches. Provides static storage for the + * main runtime pointer, which must be set during initialization. */ -template class PrototypeCache { +class BaseRuntimeAwareCache { public: + static void setMainJsRuntime(jsi::Runtime *rt) { _mainRuntime = rt; } + +protected: + static jsi::Runtime *getMainJsRuntime() { + assert(_mainRuntime != nullptr && + "Expected main Javascript runtime to be set in the " + "BaseRuntimeAwareCache class."); + return _mainRuntime; + } + +private: + static jsi::Runtime *_mainRuntime; +}; + +/** + * Runtime-aware cache that stores data per-runtime and automatically + * cleans up when a runtime is destroyed. + * + * This follows the same pattern as React Native Skia's RuntimeAwareCache: + * - For the primary/main runtime: uses a simple member variable (zero overhead) + * - For secondary runtimes: tracks lifecycle and auto-cleans on destruction + * + * The assumption is that the main runtime outlives the cache itself, + * so we don't need to register for its destruction events. + */ +template +class RuntimeAwareCache : public BaseRuntimeAwareCache, + public RuntimeLifecycleListener { +public: + void onRuntimeDestroyed(jsi::Runtime *rt) override { + if (getMainJsRuntime() != rt) { + // We are removing a secondary runtime + _secondaryRuntimeCaches.erase(rt); + } + } + + ~RuntimeAwareCache() { + for (auto &cache : _secondaryRuntimeCaches) { + RuntimeLifecycleMonitor::removeListener( + *static_cast(cache.first), this); + } + } + T &get(jsi::Runtime &rt) { - std::lock_guard lock(mutex_); - // Use runtime address as key - auto it = cache_.find(&rt); - if (it != cache_.end()) { - return it->second; + // We check if we're accessing the main runtime - this is the happy path + // to avoid us having to lookup by runtime for caches that only has a single + // runtime + if (getMainJsRuntime() == &rt) { + return _primaryCache; + } else { + if (_secondaryRuntimeCaches.count(&rt) == 0) { + // We only add listener when the secondary runtime is used, this assumes + // that the secondary runtime is terminated first. This lets us avoid + // additional complexity for the majority of cases when objects are not + // shared between runtimes. Otherwise we'd have to register all objects + // with the RuntimeMonitor as opposed to only registering ones that are + // used in secondary runtime. Note that we can't register listener here + // with the primary runtime as it may run on a separate thread. + RuntimeLifecycleMonitor::addListener(rt, this); + + T cache; + _secondaryRuntimeCaches.emplace(&rt, std::move(cache)); + } } - // Create new entry for this runtime - auto result = cache_.emplace(&rt, T{}); - return result.first->second; + return _secondaryRuntimeCaches.at(&rt); } private: - std::mutex mutex_; - std::unordered_map cache_; + std::unordered_map _secondaryRuntimeCaches; + T _primaryCache; }; /** @@ -98,9 +155,10 @@ class NativeObject : public jsi::NativeState, /** * Get the prototype cache for this type. * Each NativeObject type has its own static cache. + * Uses RuntimeAwareCache to properly handle runtime lifecycle. */ - static PrototypeCache &getPrototypeCache() { - static PrototypeCache cache; + static RuntimeAwareCache &getPrototypeCache() { + static RuntimeAwareCache cache; return cache; } @@ -339,6 +397,9 @@ class NativeObject : public jsi::NativeState, 1, [setter](jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args, size_t count) -> jsi::Value { + if (count < 1) { + throw jsi::JSError(rt, "Setter requires a value argument"); + } auto native = Derived::fromValue(rt, thisVal); auto value = rnwgpu::JSIConverter>::fromJSI(rt, args[0], false); @@ -397,6 +458,9 @@ class NativeObject : public jsi::NativeState, 1, [setter](jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args, size_t count) -> jsi::Value { + if (count < 1) { + throw jsi::JSError(rt, "Setter requires a value argument"); + } auto native = Derived::fromValue(rt, thisVal); auto value = rnwgpu::JSIConverter>::fromJSI(rt, args[0], false); diff --git a/packages/webgpu/cpp/jsi/RuntimeAwareCache.cpp b/packages/webgpu/cpp/jsi/RuntimeAwareCache.cpp new file mode 100644 index 000000000..a5401d5b1 --- /dev/null +++ b/packages/webgpu/cpp/jsi/RuntimeAwareCache.cpp @@ -0,0 +1,7 @@ +#include "NativeObject.h" + +namespace rnwgpu { + +jsi::Runtime *BaseRuntimeAwareCache::_mainRuntime = nullptr; + +} // namespace rnwgpu diff --git a/packages/webgpu/cpp/jsi/RuntimeLifecycleMonitor.cpp b/packages/webgpu/cpp/jsi/RuntimeLifecycleMonitor.cpp new file mode 100644 index 000000000..25a4db10a --- /dev/null +++ b/packages/webgpu/cpp/jsi/RuntimeLifecycleMonitor.cpp @@ -0,0 +1,72 @@ +#include "RuntimeLifecycleMonitor.h" + +#include +#include +#include +#include + +namespace rnwgpu { + +static std::unordered_map> + listeners; +static std::mutex listenersMutex; + +struct RuntimeLifecycleMonitorObject : public jsi::HostObject { + jsi::Runtime *_rt; + explicit RuntimeLifecycleMonitorObject(jsi::Runtime *rt) : _rt(rt) {} + ~RuntimeLifecycleMonitorObject() { + std::unordered_set listenersCopy; + { + std::lock_guard lock(listenersMutex); + auto listenersSet = listeners.find(_rt); + if (listenersSet != listeners.end()) { + listenersCopy = listenersSet->second; + listeners.erase(listenersSet); + } + } + for (auto listener : listenersCopy) { + listener->onRuntimeDestroyed(_rt); + } + } +}; + +void RuntimeLifecycleMonitor::addListener(jsi::Runtime &rt, + RuntimeLifecycleListener *listener) { + bool shouldInstallMonitor = false; + { + std::lock_guard lock(listenersMutex); + auto listenersSet = listeners.find(&rt); + if (listenersSet == listeners.end()) { + std::unordered_set newSet; + newSet.insert(listener); + listeners.emplace(&rt, std::move(newSet)); + shouldInstallMonitor = true; + } else { + listenersSet->second.insert(listener); + } + } + if (shouldInstallMonitor) { + // We install a global host object in the provided runtime, this way we can + // use that host object destructor to get notified when the runtime is being + // terminated. We use a unique name for the object as it gets saved with the + // runtime's global object. + rt.global().setProperty( + rt, "__rnwgpu_rt_lifecycle_monitor", + jsi::Object::createFromHostObject( + rt, std::make_shared(&rt))); + } +} + +void RuntimeLifecycleMonitor::removeListener( + jsi::Runtime &rt, RuntimeLifecycleListener *listener) { + std::lock_guard lock(listenersMutex); + auto listenersSet = listeners.find(&rt); + if (listenersSet == listeners.end()) { + // nothing to do here + } else { + listenersSet->second.erase(listener); + } +} + +} // namespace rnwgpu diff --git a/packages/webgpu/cpp/jsi/RuntimeLifecycleMonitor.h b/packages/webgpu/cpp/jsi/RuntimeLifecycleMonitor.h new file mode 100644 index 000000000..7e45b2208 --- /dev/null +++ b/packages/webgpu/cpp/jsi/RuntimeLifecycleMonitor.h @@ -0,0 +1,32 @@ +#pragma once + +#include + +#include + +namespace rnwgpu { + +namespace jsi = facebook::jsi; + +/** + * Listener interface that allows for getting notified when a jsi::Runtime + * instance is destroyed. + */ +struct RuntimeLifecycleListener { + virtual ~RuntimeLifecycleListener() {} + virtual void onRuntimeDestroyed(jsi::Runtime *) = 0; +}; + +/** + * This class provides an API via static methods for registering and + * unregistering runtime lifecycle listeners. The listeners can be used to + * cleanup any data that references a given jsi::Runtime instance before it gets + * destroyed. + */ +struct RuntimeLifecycleMonitor { + static void addListener(jsi::Runtime &rt, RuntimeLifecycleListener *listener); + static void removeListener(jsi::Runtime &rt, + RuntimeLifecycleListener *listener); +}; + +} // namespace rnwgpu diff --git a/packages/webgpu/cpp/rnwgpu/RNWebGPUManager.cpp b/packages/webgpu/cpp/rnwgpu/RNWebGPUManager.cpp index 32117d03b..c346459a9 100644 --- a/packages/webgpu/cpp/rnwgpu/RNWebGPUManager.cpp +++ b/packages/webgpu/cpp/rnwgpu/RNWebGPUManager.cpp @@ -1,6 +1,7 @@ #include "RNWebGPUManager.h" #include "GPU.h" +#include "NativeObject.h" #include "RNWebGPU.h" // GPU API classes (for instanceof support) @@ -51,6 +52,9 @@ RNWebGPUManager::RNWebGPUManager( : _jsRuntime(jsRuntime), _jsCallInvoker(jsCallInvoker), _platformContext(platformContext) { + // Register main runtime for RuntimeAwareCache + BaseRuntimeAwareCache::setMainJsRuntime(_jsRuntime); + auto gpu = std::make_shared(*_jsRuntime); auto rnWebGPU = std::make_shared(gpu, _platformContext); _gpu = gpu->get(); From e232578607f6d170e7dcfa51b12877e64a914ec4 Mon Sep 17 00:00:00 2001 From: William Candillon Date: Wed, 14 Jan 2026 12:15:53 +0100 Subject: [PATCH 12/23] :wrench: --- externals/dawn | 2 +- .../webgpu/cpp/rnwgpu/RNWebGPUManager.cpp | 8 + packages/webgpu/cpp/rnwgpu/api/GPU.cpp | 6 +- .../cpp/rnwgpu/api/GPUCompilationInfo.h | 3 +- packages/webgpu/cpp/rnwgpu/api/GPUDevice.cpp | 202 ++++++++++-------- packages/webgpu/cpp/rnwgpu/api/GPUError.h | 44 ++-- .../webgpu/cpp/rnwgpu/api/GPUInternalError.h | 31 +++ .../cpp/rnwgpu/api/GPUOutOfMemoryError.h | 33 +++ .../webgpu/cpp/rnwgpu/api/GPUShaderModule.cpp | 11 +- .../cpp/rnwgpu/api/GPUValidationError.h | 32 +++ packages/webgpu/cpp/rnwgpu/api/ImageBitmap.h | 2 +- packages/webgpu/cpp/rnwgpu/api/RNWebGPU.h | 3 +- .../api/descriptors/GPUBindGroupDescriptor.h | 1 - .../api/descriptors/GPUBindGroupEntry.h | 1 - .../GPUBindGroupLayoutDescriptor.h | 1 - .../api/descriptors/GPUBindGroupLayoutEntry.h | 1 - .../api/descriptors/GPUBlendComponent.h | 1 - .../rnwgpu/api/descriptors/GPUBlendState.h | 1 - .../rnwgpu/api/descriptors/GPUBufferBinding.h | 1 - .../api/descriptors/GPUBufferBindingLayout.h | 1 - .../api/descriptors/GPUBufferDescriptor.h | 1 - .../api/descriptors/GPUCanvasConfiguration.h | 1 - .../cpp/rnwgpu/api/descriptors/GPUColor.h | 1 - .../api/descriptors/GPUColorTargetState.h | 1 - .../descriptors/GPUCommandBufferDescriptor.h | 1 - .../descriptors/GPUCommandEncoderDescriptor.h | 1 - .../descriptors/GPUComputePassDescriptor.h | 1 - .../GPUComputePassTimestampWrites.h | 1 - .../GPUComputePipelineDescriptor.h | 1 - .../api/descriptors/GPUDepthStencilState.h | 1 - .../api/descriptors/GPUDeviceDescriptor.h | 1 - .../GPUExternalTextureBindingLayout.h | 1 - .../GPUExternalTextureDescriptor.h | 1 - .../rnwgpu/api/descriptors/GPUFragmentState.h | 1 - .../api/descriptors/GPUImageCopyBuffer.h | 1 - .../descriptors/GPUImageCopyExternalImage.h | 1 - .../api/descriptors/GPUImageCopyTexture.h | 1 - .../descriptors/GPUImageCopyTextureTagged.h | 1 - .../api/descriptors/GPUImageDataLayout.h | 1 - .../cpp/rnwgpu/api/descriptors/GPUMapMode.h | 3 +- .../api/descriptors/GPUMultisampleState.h | 1 - .../descriptors/GPUPipelineLayoutDescriptor.h | 1 - .../api/descriptors/GPUPrimitiveState.h | 1 - .../api/descriptors/GPUProgrammableStage.h | 1 - .../api/descriptors/GPUQuerySetDescriptor.h | 1 - .../api/descriptors/GPUQueueDescriptor.h | 1 - .../descriptors/GPURenderBundleDescriptor.h | 1 - .../GPURenderBundleEncoderDescriptor.h | 1 - .../GPURenderPassColorAttachment.h | 1 - .../GPURenderPassDepthStencilAttachment.h | 1 - .../api/descriptors/GPURenderPassDescriptor.h | 1 - .../GPURenderPassTimestampWrites.h | 1 - .../descriptors/GPURenderPipelineDescriptor.h | 1 - .../descriptors/GPURequestAdapterOptions.h | 1 - .../api/descriptors/GPUSamplerBindingLayout.h | 1 - .../api/descriptors/GPUSamplerDescriptor.h | 1 - .../GPUShaderModuleCompilationHint.h | 1 - .../descriptors/GPUShaderModuleDescriptor.h | 1 - .../api/descriptors/GPUStencilFaceState.h | 1 - .../GPUStorageTextureBindingLayout.h | 1 - .../api/descriptors/GPUTextureBindingLayout.h | 1 - .../api/descriptors/GPUTextureDescriptor.h | 1 - .../descriptors/GPUTextureViewDescriptor.h | 1 - .../descriptors/GPUUncapturedErrorEventInit.h | 1 - .../api/descriptors/GPUVertexAttribute.h | 1 - .../api/descriptors/GPUVertexBufferLayout.h | 1 - .../rnwgpu/api/descriptors/GPUVertexState.h | 1 - .../cpp/rnwgpu/api/descriptors/Unions.h | 2 +- .../webgpu/src/__tests__/Constants.spec.ts | 20 ++ 69 files changed, 267 insertions(+), 189 deletions(-) create mode 100644 packages/webgpu/cpp/rnwgpu/api/GPUInternalError.h create mode 100644 packages/webgpu/cpp/rnwgpu/api/GPUOutOfMemoryError.h create mode 100644 packages/webgpu/cpp/rnwgpu/api/GPUValidationError.h diff --git a/externals/dawn b/externals/dawn index ffb6058ec..c84d448f3 160000 --- a/externals/dawn +++ b/externals/dawn @@ -1 +1 @@ -Subproject commit ffb6058ec90b7012360b9c287ea6f3f329993d38 +Subproject commit c84d448f3c3ebe2cfa1b1a4dfe51d7de47c96ede diff --git a/packages/webgpu/cpp/rnwgpu/RNWebGPUManager.cpp b/packages/webgpu/cpp/rnwgpu/RNWebGPUManager.cpp index c346459a9..e4713d46a 100644 --- a/packages/webgpu/cpp/rnwgpu/RNWebGPUManager.cpp +++ b/packages/webgpu/cpp/rnwgpu/RNWebGPUManager.cpp @@ -19,7 +19,10 @@ #include "GPUComputePipeline.h" #include "GPUDevice.h" #include "GPUDeviceLostInfo.h" +#include "GPUError.h" #include "GPUExternalTexture.h" +#include "GPUInternalError.h" +#include "GPUOutOfMemoryError.h" #include "GPUPipelineLayout.h" #include "GPUQuerySet.h" #include "GPUQueue.h" @@ -32,6 +35,7 @@ #include "GPUSupportedLimits.h" #include "GPUTexture.h" #include "GPUTextureView.h" +#include "GPUValidationError.h" // Enums #include "GPUBufferUsage.h" @@ -77,7 +81,11 @@ RNWebGPUManager::RNWebGPUManager( GPUComputePipeline::installConstructor(*_jsRuntime); GPUDevice::installConstructor(*_jsRuntime); GPUDeviceLostInfo::installConstructor(*_jsRuntime); + GPUError::installConstructor(*_jsRuntime); GPUExternalTexture::installConstructor(*_jsRuntime); + GPUInternalError::installConstructor(*_jsRuntime); + GPUOutOfMemoryError::installConstructor(*_jsRuntime); + GPUValidationError::installConstructor(*_jsRuntime); GPUPipelineLayout::installConstructor(*_jsRuntime); GPUQuerySet::installConstructor(*_jsRuntime); GPUQueue::installConstructor(*_jsRuntime); diff --git a/packages/webgpu/cpp/rnwgpu/api/GPU.cpp b/packages/webgpu/cpp/rnwgpu/api/GPU.cpp index ddae2a776..764a9aa32 100644 --- a/packages/webgpu/cpp/rnwgpu/api/GPU.cpp +++ b/packages/webgpu/cpp/rnwgpu/api/GPU.cpp @@ -59,8 +59,7 @@ async::AsyncTaskHandle GPU::requestAdapter( adapterHost); resolve([result = std::move(result)](jsi::Runtime &runtime) mutable { - return JSIConverter::toJSI(runtime, - result); + return JSIConverter::toJSI(runtime, result); }); } else { auto result = @@ -68,8 +67,7 @@ async::AsyncTaskHandle GPU::requestAdapter( nullptr); resolve([result = std::move(result)](jsi::Runtime &runtime) mutable { - return JSIConverter::toJSI(runtime, - result); + return JSIConverter::toJSI(runtime, result); }); } }); diff --git a/packages/webgpu/cpp/rnwgpu/api/GPUCompilationInfo.h b/packages/webgpu/cpp/rnwgpu/api/GPUCompilationInfo.h index f12bd443d..583f83f1c 100644 --- a/packages/webgpu/cpp/rnwgpu/api/GPUCompilationInfo.h +++ b/packages/webgpu/cpp/rnwgpu/api/GPUCompilationInfo.h @@ -44,8 +44,7 @@ class GPUCompilationInfo : public NativeObject { friend class GPUShaderModule; }; -template <> -struct JSIConverter> { +template <> struct JSIConverter> { static std::vector fromJSI(jsi::Runtime &runtime, const jsi::Value &arg, bool outOfBounds) { throw std::runtime_error("Invalid GPUCompilationMessageData::fromJSI()"); diff --git a/packages/webgpu/cpp/rnwgpu/api/GPUDevice.cpp b/packages/webgpu/cpp/rnwgpu/api/GPUDevice.cpp index 896a66f0b..c467b750d 100644 --- a/packages/webgpu/cpp/rnwgpu/api/GPUDevice.cpp +++ b/packages/webgpu/cpp/rnwgpu/api/GPUDevice.cpp @@ -10,6 +10,9 @@ #include "JSIConverter.h" #include "GPUFeatures.h" +#include "GPUInternalError.h" +#include "GPUOutOfMemoryError.h" +#include "GPUValidationError.h" namespace rnwgpu { @@ -26,8 +29,8 @@ void GPUDevice::notifyDeviceLost(wgpu::DeviceLostReason reason, auto resolve = std::move(*_lostResolve); _lostResolve.reset(); resolve([info = _lostInfo](jsi::Runtime &runtime) mutable { - return JSIConverter>::toJSI( - runtime, info); + return JSIConverter>::toJSI(runtime, + info); }); } @@ -248,30 +251,31 @@ async::AsyncTaskHandle GPUDevice::createComputePipelineAsync( descriptor->label.has_value() ? descriptor->label.value() : ""); auto pipelineHolder = std::make_shared(nullptr, label); - return _async->postTask( - [device = _instance, desc, descriptor, - pipelineHolder](const async::AsyncTaskHandle::ResolveFunction &resolve, - const async::AsyncTaskHandle::RejectFunction &reject) { - (void)descriptor; - device.CreateComputePipelineAsync( - &desc, wgpu::CallbackMode::AllowProcessEvents, - [pipelineHolder, resolve, - reject](wgpu::CreatePipelineAsyncStatus status, - wgpu::ComputePipeline pipeline, const char *msg) mutable { - if (status == wgpu::CreatePipelineAsyncStatus::Success && - pipeline) { - pipelineHolder->_instance = pipeline; - resolve([pipelineHolder](jsi::Runtime &runtime) mutable { - return JSIConverter>::toJSI( - runtime, pipelineHolder); - }); - } else { - std::string error = msg ? std::string(msg) - : "Failed to create compute pipeline"; - reject(std::move(error)); - } + return _async->postTask([device = _instance, desc, descriptor, + pipelineHolder]( + const async::AsyncTaskHandle::ResolveFunction + &resolve, + const async::AsyncTaskHandle::RejectFunction + &reject) { + (void)descriptor; + device.CreateComputePipelineAsync( + &desc, wgpu::CallbackMode::AllowProcessEvents, + [pipelineHolder, resolve, + reject](wgpu::CreatePipelineAsyncStatus status, + wgpu::ComputePipeline pipeline, const char *msg) mutable { + if (status == wgpu::CreatePipelineAsyncStatus::Success && pipeline) { + pipelineHolder->_instance = pipeline; + resolve([pipelineHolder](jsi::Runtime &runtime) mutable { + return JSIConverter>::toJSI( + runtime, pipelineHolder); }); - }); + } else { + std::string error = + msg ? std::string(msg) : "Failed to create compute pipeline"; + reject(std::move(error)); + } + }); + }); } async::AsyncTaskHandle GPUDevice::createRenderPipelineAsync( @@ -288,30 +292,31 @@ async::AsyncTaskHandle GPUDevice::createRenderPipelineAsync( descriptor->label.has_value() ? descriptor->label.value() : ""); auto pipelineHolder = std::make_shared(nullptr, label); - return _async->postTask( - [device = _instance, desc, descriptor, - pipelineHolder](const async::AsyncTaskHandle::ResolveFunction &resolve, - const async::AsyncTaskHandle::RejectFunction &reject) { - (void)descriptor; - device.CreateRenderPipelineAsync( - &desc, wgpu::CallbackMode::AllowProcessEvents, - [pipelineHolder, resolve, - reject](wgpu::CreatePipelineAsyncStatus status, - wgpu::RenderPipeline pipeline, const char *msg) mutable { - if (status == wgpu::CreatePipelineAsyncStatus::Success && - pipeline) { - pipelineHolder->_instance = pipeline; - resolve([pipelineHolder](jsi::Runtime &runtime) mutable { - return JSIConverter>::toJSI( - runtime, pipelineHolder); - }); - } else { - std::string error = - msg ? std::string(msg) : "Failed to create render pipeline"; - reject(std::move(error)); - } + return _async->postTask([device = _instance, desc, descriptor, + pipelineHolder]( + const async::AsyncTaskHandle::ResolveFunction + &resolve, + const async::AsyncTaskHandle::RejectFunction + &reject) { + (void)descriptor; + device.CreateRenderPipelineAsync( + &desc, wgpu::CallbackMode::AllowProcessEvents, + [pipelineHolder, resolve, + reject](wgpu::CreatePipelineAsyncStatus status, + wgpu::RenderPipeline pipeline, const char *msg) mutable { + if (status == wgpu::CreatePipelineAsyncStatus::Success && pipeline) { + pipelineHolder->_instance = pipeline; + resolve([pipelineHolder](jsi::Runtime &runtime) mutable { + return JSIConverter>::toJSI( + runtime, pipelineHolder); }); - }); + } else { + std::string error = + msg ? std::string(msg) : "Failed to create render pipeline"; + reject(std::move(error)); + } + }); + }); } void GPUDevice::pushErrorScope(wgpu::ErrorFilter filter) { @@ -321,47 +326,60 @@ void GPUDevice::pushErrorScope(wgpu::ErrorFilter filter) { async::AsyncTaskHandle GPUDevice::popErrorScope() { auto device = _instance; - return _async->postTask( - [device](const async::AsyncTaskHandle::ResolveFunction &resolve, - const async::AsyncTaskHandle::RejectFunction &reject) { - device.PopErrorScope( - wgpu::CallbackMode::AllowProcessEvents, - [resolve, reject](wgpu::PopErrorScopeStatus status, - wgpu::ErrorType type, wgpu::StringView message) { - if (status == wgpu::PopErrorScopeStatus::Error || - status == wgpu::PopErrorScopeStatus::CallbackCancelled) { - reject("PopErrorScope failed"); - return; - } - - std::variant> result = - nullptr; - - switch (type) { - case wgpu::ErrorType::NoError: - break; - case wgpu::ErrorType::OutOfMemory: - case wgpu::ErrorType::Validation: - case wgpu::ErrorType::Internal: - case wgpu::ErrorType::Unknown: { - std::string messageString = - message.length ? std::string(message.data, message.length) - : ""; - result = std::make_shared(type, messageString); - break; - } - default: - reject("Unhandled GPU error type"); - return; - } - - resolve([result = - std::move(result)](jsi::Runtime &runtime) mutable { - return JSIConverter::toJSI(runtime, - result); - }); + return _async->postTask([device](const async::AsyncTaskHandle::ResolveFunction + &resolve, + const async::AsyncTaskHandle::RejectFunction + &reject) { + device.PopErrorScope( + wgpu::CallbackMode::AllowProcessEvents, + [resolve, reject](wgpu::PopErrorScopeStatus status, + wgpu::ErrorType type, wgpu::StringView message) { + if (status == wgpu::PopErrorScopeStatus::Error || + status == wgpu::PopErrorScopeStatus::CallbackCancelled) { + reject("PopErrorScope failed"); + return; + } + + std::string messageString = + message.length ? std::string(message.data, message.length) : ""; + + switch (type) { + case wgpu::ErrorType::NoError: + resolve([](jsi::Runtime &runtime) mutable { + return jsi::Value::null(); }); - }); + break; + case wgpu::ErrorType::Validation: { + auto error = std::make_shared(messageString); + resolve([error](jsi::Runtime &runtime) mutable { + return JSIConverter>::toJSI( + runtime, error); + }); + break; + } + case wgpu::ErrorType::OutOfMemory: { + auto error = std::make_shared(messageString); + resolve([error](jsi::Runtime &runtime) mutable { + return JSIConverter>::toJSI( + runtime, error); + }); + break; + } + case wgpu::ErrorType::Internal: + case wgpu::ErrorType::Unknown: { + auto error = std::make_shared(messageString); + resolve([error](jsi::Runtime &runtime) mutable { + return JSIConverter>::toJSI( + runtime, error); + }); + break; + } + default: + reject("Unhandled GPU error type"); + return; + } + }); + }); } std::unordered_set GPUDevice::getFeatures() { @@ -388,8 +406,8 @@ async::AsyncTaskHandle GPUDevice::getLost() { const async::AsyncTaskHandle::ResolveFunction &resolve, const async::AsyncTaskHandle::RejectFunction & /*reject*/) { resolve([info](jsi::Runtime &runtime) mutable { - return JSIConverter< - std::shared_ptr>::toJSI(runtime, info); + return JSIConverter>::toJSI( + runtime, info); }); }, false); @@ -400,8 +418,8 @@ async::AsyncTaskHandle GPUDevice::getLost() { const async::AsyncTaskHandle::RejectFunction & /*reject*/) { if (_lostSettled && _lostInfo) { resolve([info = _lostInfo](jsi::Runtime &runtime) mutable { - return JSIConverter< - std::shared_ptr>::toJSI(runtime, info); + return JSIConverter>::toJSI( + runtime, info); }); return; } diff --git a/packages/webgpu/cpp/rnwgpu/api/GPUError.h b/packages/webgpu/cpp/rnwgpu/api/GPUError.h index 7b03a3dfb..676fd7417 100644 --- a/packages/webgpu/cpp/rnwgpu/api/GPUError.h +++ b/packages/webgpu/cpp/rnwgpu/api/GPUError.h @@ -1,39 +1,35 @@ #pragma once -#include #include -#include -#include "webgpu/webgpu_cpp.h" - -#include "EnumMapper.h" -#include "JSIConverter.h" +#include "NativeObject.h" namespace rnwgpu { -class GPUError { +namespace jsi = facebook::jsi; +class GPUError : public NativeObject { public: - GPUError(wgpu::ErrorType aType, std::string aMessage) - : type(aType), message(std::move(aMessage)) {} + static constexpr const char *CLASS_NAME = "GPUError"; - wgpu::ErrorType type; - std::string message; -}; + explicit GPUError(std::string message) + : NativeObject(CLASS_NAME), _message(std::move(message)) {} -template <> struct JSIConverter> { - static std::shared_ptr - fromJSI(jsi::Runtime &runtime, const jsi::Value &arg, bool outOfBounds) { - throw std::runtime_error("Invalid GPUBindGroupEntry::fromJSI()"); - } - static jsi::Value toJSI(jsi::Runtime &runtime, - std::shared_ptr arg) { - jsi::Object result(runtime); - result.setProperty( - runtime, "message", - jsi::String::createFromUtf8(runtime, arg->message.c_str())); - return result; +public: + std::string getBrand() { return CLASS_NAME; } + std::string getMessage() { return _message; } + + static void definePrototype(jsi::Runtime &runtime, jsi::Object &prototype) { + installGetter(runtime, prototype, "__brand", &GPUError::getBrand); + installGetter(runtime, prototype, "message", &GPUError::getMessage); } + +protected: + // Protected constructor for subclasses + GPUError(const char *className, std::string message) + : NativeObject(className), _message(std::move(message)) {} + + std::string _message; }; } // namespace rnwgpu diff --git a/packages/webgpu/cpp/rnwgpu/api/GPUInternalError.h b/packages/webgpu/cpp/rnwgpu/api/GPUInternalError.h new file mode 100644 index 000000000..1d1a9620b --- /dev/null +++ b/packages/webgpu/cpp/rnwgpu/api/GPUInternalError.h @@ -0,0 +1,31 @@ +#pragma once + +#include + +#include "NativeObject.h" + +namespace rnwgpu { + +namespace jsi = facebook::jsi; + +class GPUInternalError : public NativeObject { +public: + static constexpr const char *CLASS_NAME = "GPUInternalError"; + + explicit GPUInternalError(std::string message) + : NativeObject(CLASS_NAME), _message(std::move(message)) {} + +public: + std::string getBrand() { return CLASS_NAME; } + std::string getMessage() { return _message; } + + static void definePrototype(jsi::Runtime &runtime, jsi::Object &prototype) { + installGetter(runtime, prototype, "__brand", &GPUInternalError::getBrand); + installGetter(runtime, prototype, "message", &GPUInternalError::getMessage); + } + +private: + std::string _message; +}; + +} // namespace rnwgpu diff --git a/packages/webgpu/cpp/rnwgpu/api/GPUOutOfMemoryError.h b/packages/webgpu/cpp/rnwgpu/api/GPUOutOfMemoryError.h new file mode 100644 index 000000000..1eb1e0ee6 --- /dev/null +++ b/packages/webgpu/cpp/rnwgpu/api/GPUOutOfMemoryError.h @@ -0,0 +1,33 @@ +#pragma once + +#include + +#include "NativeObject.h" + +namespace rnwgpu { + +namespace jsi = facebook::jsi; + +class GPUOutOfMemoryError : public NativeObject { +public: + static constexpr const char *CLASS_NAME = "GPUOutOfMemoryError"; + + explicit GPUOutOfMemoryError(std::string message) + : NativeObject(CLASS_NAME), _message(std::move(message)) {} + +public: + std::string getBrand() { return CLASS_NAME; } + std::string getMessage() { return _message; } + + static void definePrototype(jsi::Runtime &runtime, jsi::Object &prototype) { + installGetter(runtime, prototype, "__brand", + &GPUOutOfMemoryError::getBrand); + installGetter(runtime, prototype, "message", + &GPUOutOfMemoryError::getMessage); + } + +private: + std::string _message; +}; + +} // namespace rnwgpu diff --git a/packages/webgpu/cpp/rnwgpu/api/GPUShaderModule.cpp b/packages/webgpu/cpp/rnwgpu/api/GPUShaderModule.cpp index 4a93cc628..0127a9c5e 100644 --- a/packages/webgpu/cpp/rnwgpu/api/GPUShaderModule.cpp +++ b/packages/webgpu/cpp/rnwgpu/api/GPUShaderModule.cpp @@ -39,12 +39,11 @@ async::AsyncTaskHandle GPUShaderModule::getCompilationInfo() { result->_messages.push_back(std::move(message)); } - resolve( - [result = std::move(result)](jsi::Runtime &runtime) mutable { - return JSIConverter< - std::shared_ptr>::toJSI(runtime, - result); - }); + resolve([result = + std::move(result)](jsi::Runtime &runtime) mutable { + return JSIConverter>::toJSI( + runtime, result); + }); }); }); } diff --git a/packages/webgpu/cpp/rnwgpu/api/GPUValidationError.h b/packages/webgpu/cpp/rnwgpu/api/GPUValidationError.h new file mode 100644 index 000000000..372b5d358 --- /dev/null +++ b/packages/webgpu/cpp/rnwgpu/api/GPUValidationError.h @@ -0,0 +1,32 @@ +#pragma once + +#include + +#include "NativeObject.h" + +namespace rnwgpu { + +namespace jsi = facebook::jsi; + +class GPUValidationError : public NativeObject { +public: + static constexpr const char *CLASS_NAME = "GPUValidationError"; + + explicit GPUValidationError(std::string message) + : NativeObject(CLASS_NAME), _message(std::move(message)) {} + +public: + std::string getBrand() { return CLASS_NAME; } + std::string getMessage() { return _message; } + + static void definePrototype(jsi::Runtime &runtime, jsi::Object &prototype) { + installGetter(runtime, prototype, "__brand", &GPUValidationError::getBrand); + installGetter(runtime, prototype, "message", + &GPUValidationError::getMessage); + } + +private: + std::string _message; +}; + +} // namespace rnwgpu diff --git a/packages/webgpu/cpp/rnwgpu/api/ImageBitmap.h b/packages/webgpu/cpp/rnwgpu/api/ImageBitmap.h index 9df66fc5c..a5407151f 100644 --- a/packages/webgpu/cpp/rnwgpu/api/ImageBitmap.h +++ b/packages/webgpu/cpp/rnwgpu/api/ImageBitmap.h @@ -4,8 +4,8 @@ #include "webgpu/webgpu_cpp.h" -#include "PlatformContext.h" #include "NativeObject.h" +#include "PlatformContext.h" namespace rnwgpu { diff --git a/packages/webgpu/cpp/rnwgpu/api/RNWebGPU.h b/packages/webgpu/cpp/rnwgpu/api/RNWebGPU.h index 00fbe0468..8ae87a2ea 100644 --- a/packages/webgpu/cpp/rnwgpu/api/RNWebGPU.h +++ b/packages/webgpu/cpp/rnwgpu/api/RNWebGPU.h @@ -101,8 +101,7 @@ template <> struct JSIConverter> { throw std::runtime_error("Invalid Blob::fromJSI()"); } } - static jsi::Value toJSI(jsi::Runtime &runtime, - std::shared_ptr arg) { + static jsi::Value toJSI(jsi::Runtime &runtime, std::shared_ptr arg) { throw std::runtime_error("Invalid Blob::toJSI()"); } }; diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBindGroupDescriptor.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBindGroupDescriptor.h index 5addd6e1e..9893898b8 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBindGroupDescriptor.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBindGroupDescriptor.h @@ -27,7 +27,6 @@ struct GPUBindGroupDescriptor { namespace rnwgpu { - template <> struct JSIConverter> { static std::shared_ptr diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBindGroupEntry.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBindGroupEntry.h index cfb34f170..ef1570503 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBindGroupEntry.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBindGroupEntry.h @@ -28,7 +28,6 @@ struct GPUBindGroupEntry { namespace rnwgpu { - template <> struct JSIConverter> { static std::shared_ptr fromJSI(jsi::Runtime &runtime, const jsi::Value &arg, bool outOfBounds) { diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBindGroupLayoutDescriptor.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBindGroupLayoutDescriptor.h index ea77544ff..01722bc8c 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBindGroupLayoutDescriptor.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBindGroupLayoutDescriptor.h @@ -25,7 +25,6 @@ struct GPUBindGroupLayoutDescriptor { namespace rnwgpu { - template <> struct JSIConverter> { static std::shared_ptr diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBindGroupLayoutEntry.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBindGroupLayoutEntry.h index 42014f862..5d044a941 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBindGroupLayoutEntry.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBindGroupLayoutEntry.h @@ -36,7 +36,6 @@ struct GPUBindGroupLayoutEntry { namespace rnwgpu { - template <> struct JSIConverter> { static std::shared_ptr diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBlendComponent.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBlendComponent.h index 91808628c..a9db7526c 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBlendComponent.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBlendComponent.h @@ -21,7 +21,6 @@ struct GPUBlendComponent { namespace rnwgpu { - template <> struct JSIConverter> { static std::shared_ptr fromJSI(jsi::Runtime &runtime, const jsi::Value &arg, bool outOfBounds) { diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBlendState.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBlendState.h index 899b12b7d..b51f547c9 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBlendState.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBlendState.h @@ -22,7 +22,6 @@ struct GPUBlendState { namespace rnwgpu { - template <> struct JSIConverter> { static std::shared_ptr fromJSI(jsi::Runtime &runtime, const jsi::Value &arg, bool outOfBounds) { diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBufferBinding.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBufferBinding.h index 71170240f..b0dceca71 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBufferBinding.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBufferBinding.h @@ -23,7 +23,6 @@ struct GPUBufferBinding { namespace rnwgpu { - template <> struct JSIConverter> { static std::shared_ptr fromJSI(jsi::Runtime &runtime, const jsi::Value &arg, bool outOfBounds) { diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBufferBindingLayout.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBufferBindingLayout.h index f108757df..5150b9029 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBufferBindingLayout.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBufferBindingLayout.h @@ -21,7 +21,6 @@ struct GPUBufferBindingLayout { namespace rnwgpu { - template <> struct JSIConverter> { static std::shared_ptr diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBufferDescriptor.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBufferDescriptor.h index fc2f57b57..a80129444 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBufferDescriptor.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBufferDescriptor.h @@ -23,7 +23,6 @@ struct GPUBufferDescriptor { namespace rnwgpu { - template <> struct JSIConverter> { static std::shared_ptr fromJSI(jsi::Runtime &runtime, const jsi::Value &arg, bool outOfBounds) { diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUCanvasConfiguration.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUCanvasConfiguration.h index 3013539f1..c27b4a7fb 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUCanvasConfiguration.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUCanvasConfiguration.h @@ -26,7 +26,6 @@ struct GPUCanvasConfiguration { namespace rnwgpu { - template <> struct JSIConverter> { static std::shared_ptr diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUColor.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUColor.h index 76173ab98..7b472ecc1 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUColor.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUColor.h @@ -22,7 +22,6 @@ struct GPUColor { namespace rnwgpu { - template <> struct JSIConverter> { static std::shared_ptr fromJSI(jsi::Runtime &runtime, const jsi::Value &arg, bool outOfBounds) { diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUColorTargetState.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUColorTargetState.h index c58f390f8..b850428c0 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUColorTargetState.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUColorTargetState.h @@ -23,7 +23,6 @@ struct GPUColorTargetState { namespace rnwgpu { - template <> struct JSIConverter> { static std::shared_ptr fromJSI(jsi::Runtime &runtime, const jsi::Value &arg, bool outOfBounds) { diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUCommandBufferDescriptor.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUCommandBufferDescriptor.h index 91cf922dc..5d572660c 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUCommandBufferDescriptor.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUCommandBufferDescriptor.h @@ -20,7 +20,6 @@ struct GPUCommandBufferDescriptor { namespace rnwgpu { - template <> struct JSIConverter> { static std::shared_ptr diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUCommandEncoderDescriptor.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUCommandEncoderDescriptor.h index fcf32a91c..f84fbacda 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUCommandEncoderDescriptor.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUCommandEncoderDescriptor.h @@ -20,7 +20,6 @@ struct GPUCommandEncoderDescriptor { namespace rnwgpu { - template <> struct JSIConverter> { static std::shared_ptr diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUComputePassDescriptor.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUComputePassDescriptor.h index 1d019e845..bbd7abd56 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUComputePassDescriptor.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUComputePassDescriptor.h @@ -24,7 +24,6 @@ struct GPUComputePassDescriptor { namespace rnwgpu { - template <> struct JSIConverter> { static std::shared_ptr diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUComputePassTimestampWrites.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUComputePassTimestampWrites.h index d02d18687..3f25413c2 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUComputePassTimestampWrites.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUComputePassTimestampWrites.h @@ -23,7 +23,6 @@ struct GPUComputePassTimestampWrites { namespace rnwgpu { - template <> struct JSIConverter> { static std::shared_ptr diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUComputePipelineDescriptor.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUComputePipelineDescriptor.h index b113669e1..9ed70a047 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUComputePipelineDescriptor.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUComputePipelineDescriptor.h @@ -26,7 +26,6 @@ struct GPUComputePipelineDescriptor { namespace rnwgpu { - template <> struct JSIConverter> { static std::shared_ptr diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUDepthStencilState.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUDepthStencilState.h index 81288d1b7..b307dec15 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUDepthStencilState.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUDepthStencilState.h @@ -32,7 +32,6 @@ struct GPUDepthStencilState { namespace rnwgpu { - template <> struct JSIConverter> { static std::shared_ptr fromJSI(jsi::Runtime &runtime, const jsi::Value &arg, bool outOfBounds) { diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUDeviceDescriptor.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUDeviceDescriptor.h index 9129313c1..5ec068b48 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUDeviceDescriptor.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUDeviceDescriptor.h @@ -30,7 +30,6 @@ struct GPUDeviceDescriptor { namespace rnwgpu { - // We add this extra convertor because we found so library that are sending // invalid feature elements template <> struct JSIConverter> { diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUExternalTextureBindingLayout.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUExternalTextureBindingLayout.h index bd1968635..a296a15df 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUExternalTextureBindingLayout.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUExternalTextureBindingLayout.h @@ -17,7 +17,6 @@ struct GPUExternalTextureBindingLayout {}; namespace rnwgpu { - template <> struct JSIConverter> { static std::shared_ptr diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUExternalTextureDescriptor.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUExternalTextureDescriptor.h index 06fb2564f..fba6721ee 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUExternalTextureDescriptor.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUExternalTextureDescriptor.h @@ -36,7 +36,6 @@ static bool conv(wgpu::ExternalTextureDescriptor &out, namespace rnwgpu { - template <> struct JSIConverter> { static std::shared_ptr diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUFragmentState.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUFragmentState.h index 0d728419d..1a39b718e 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUFragmentState.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUFragmentState.h @@ -32,7 +32,6 @@ struct GPUFragmentState { namespace rnwgpu { - template <> struct JSIConverter> { static std::shared_ptr fromJSI(jsi::Runtime &runtime, const jsi::Value &arg, bool outOfBounds) { diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUImageCopyBuffer.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUImageCopyBuffer.h index 10b685db5..4f5359a06 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUImageCopyBuffer.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUImageCopyBuffer.h @@ -24,7 +24,6 @@ struct GPUImageCopyBuffer { namespace rnwgpu { - template <> struct JSIConverter> { static std::shared_ptr fromJSI(jsi::Runtime &runtime, const jsi::Value &arg, bool outOfBounds) { diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUImageCopyExternalImage.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUImageCopyExternalImage.h index 622b59acb..9e0bc2da8 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUImageCopyExternalImage.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUImageCopyExternalImage.h @@ -27,7 +27,6 @@ struct GPUImageCopyExternalImage { namespace rnwgpu { - template <> struct JSIConverter> { static std::shared_ptr diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUImageCopyTexture.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUImageCopyTexture.h index 7e284aa15..b9324423c 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUImageCopyTexture.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUImageCopyTexture.h @@ -25,7 +25,6 @@ struct GPUImageCopyTexture { namespace rnwgpu { - template <> struct JSIConverter> { static std::shared_ptr fromJSI(jsi::Runtime &runtime, const jsi::Value &arg, bool outOfBounds) { diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUImageCopyTextureTagged.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUImageCopyTextureTagged.h index 66cc3d918..88c3693fe 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUImageCopyTextureTagged.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUImageCopyTextureTagged.h @@ -28,7 +28,6 @@ struct GPUImageCopyTextureTagged { namespace rnwgpu { - template <> struct JSIConverter> { static std::shared_ptr diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUImageDataLayout.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUImageDataLayout.h index edc854541..cf8a4fba1 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUImageDataLayout.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUImageDataLayout.h @@ -21,7 +21,6 @@ struct GPUImageDataLayout { namespace rnwgpu { - template <> struct JSIConverter> { static std::shared_ptr fromJSI(jsi::Runtime &runtime, const jsi::Value &arg, bool outOfBounds) { diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUMapMode.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUMapMode.h index 68b78c113..2cd0c0cca 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUMapMode.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUMapMode.h @@ -12,8 +12,7 @@ class GPUMapMode { public: static jsi::Object create(jsi::Runtime &runtime) { jsi::Object obj(runtime); - obj.setProperty(runtime, "READ", - static_cast(wgpu::MapMode::Read)); + obj.setProperty(runtime, "READ", static_cast(wgpu::MapMode::Read)); obj.setProperty(runtime, "WRITE", static_cast(wgpu::MapMode::Write)); return obj; diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUMultisampleState.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUMultisampleState.h index 8ee999d52..cbe7f3bf8 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUMultisampleState.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUMultisampleState.h @@ -21,7 +21,6 @@ struct GPUMultisampleState { namespace rnwgpu { - template <> struct JSIConverter> { static std::shared_ptr fromJSI(jsi::Runtime &runtime, const jsi::Value &arg, bool outOfBounds) { diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUPipelineLayoutDescriptor.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUPipelineLayoutDescriptor.h index e0999515d..fbcafd281 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUPipelineLayoutDescriptor.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUPipelineLayoutDescriptor.h @@ -25,7 +25,6 @@ struct GPUPipelineLayoutDescriptor { namespace rnwgpu { - template <> struct JSIConverter> { static std::shared_ptr diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUPrimitiveState.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUPrimitiveState.h index 6cdf9377e..fc917f2de 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUPrimitiveState.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUPrimitiveState.h @@ -23,7 +23,6 @@ struct GPUPrimitiveState { namespace rnwgpu { - template <> struct JSIConverter> { static std::shared_ptr fromJSI(jsi::Runtime &runtime, const jsi::Value &arg, bool outOfBounds) { diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUProgrammableStage.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUProgrammableStage.h index aaad5c5eb..90da61444 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUProgrammableStage.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUProgrammableStage.h @@ -26,7 +26,6 @@ struct GPUProgrammableStage { namespace rnwgpu { - template <> struct JSIConverter> { static std::shared_ptr fromJSI(jsi::Runtime &runtime, const jsi::Value &arg, bool outOfBounds) { diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUQuerySetDescriptor.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUQuerySetDescriptor.h index 42fb41722..4a218bc14 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUQuerySetDescriptor.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUQuerySetDescriptor.h @@ -22,7 +22,6 @@ struct GPUQuerySetDescriptor { namespace rnwgpu { - template <> struct JSIConverter> { static std::shared_ptr diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUQueueDescriptor.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUQueueDescriptor.h index 128c261e1..dd7dfea00 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUQueueDescriptor.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUQueueDescriptor.h @@ -20,7 +20,6 @@ struct GPUQueueDescriptor { namespace rnwgpu { - template <> struct JSIConverter> { static std::shared_ptr fromJSI(jsi::Runtime &runtime, const jsi::Value &arg, bool outOfBounds) { diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPURenderBundleDescriptor.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPURenderBundleDescriptor.h index 5adfbc4fb..0fae5fefb 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPURenderBundleDescriptor.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPURenderBundleDescriptor.h @@ -20,7 +20,6 @@ struct GPURenderBundleDescriptor { namespace rnwgpu { - template <> struct JSIConverter> { static std::shared_ptr diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPURenderBundleEncoderDescriptor.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPURenderBundleEncoderDescriptor.h index 0942047b0..fddda4464 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPURenderBundleEncoderDescriptor.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPURenderBundleEncoderDescriptor.h @@ -27,7 +27,6 @@ struct GPURenderBundleEncoderDescriptor { namespace rnwgpu { - template <> struct JSIConverter> { static std::shared_ptr diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPURenderPassColorAttachment.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPURenderPassColorAttachment.h index d6f112751..aacab18d3 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPURenderPassColorAttachment.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPURenderPassColorAttachment.h @@ -28,7 +28,6 @@ struct GPURenderPassColorAttachment { namespace rnwgpu { - template <> struct JSIConverter> { static std::shared_ptr diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPURenderPassDepthStencilAttachment.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPURenderPassDepthStencilAttachment.h index 02607b86e..5efe666d3 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPURenderPassDepthStencilAttachment.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPURenderPassDepthStencilAttachment.h @@ -29,7 +29,6 @@ struct GPURenderPassDepthStencilAttachment { namespace rnwgpu { - template <> struct JSIConverter< std::shared_ptr> { diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPURenderPassDescriptor.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPURenderPassDescriptor.h index 57def1c09..768bc5b36 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPURenderPassDescriptor.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPURenderPassDescriptor.h @@ -36,7 +36,6 @@ struct GPURenderPassDescriptor { namespace rnwgpu { - template <> struct JSIConverter> { static std::shared_ptr diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPURenderPassTimestampWrites.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPURenderPassTimestampWrites.h index 4913661c1..bc94e9d23 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPURenderPassTimestampWrites.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPURenderPassTimestampWrites.h @@ -23,7 +23,6 @@ struct GPURenderPassTimestampWrites { namespace rnwgpu { - template <> struct JSIConverter> { static std::shared_ptr diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPURenderPipelineDescriptor.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPURenderPipelineDescriptor.h index 2f02360d2..7ceb9d632 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPURenderPipelineDescriptor.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPURenderPipelineDescriptor.h @@ -37,7 +37,6 @@ struct GPURenderPipelineDescriptor { namespace rnwgpu { - template <> struct JSIConverter> { static std::shared_ptr diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPURequestAdapterOptions.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPURequestAdapterOptions.h index 878379f8e..8f3113df8 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPURequestAdapterOptions.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPURequestAdapterOptions.h @@ -20,7 +20,6 @@ struct GPURequestAdapterOptions { namespace rnwgpu { - template <> struct JSIConverter> { static std::shared_ptr diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUSamplerBindingLayout.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUSamplerBindingLayout.h index ecfce53a1..c60c9aa10 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUSamplerBindingLayout.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUSamplerBindingLayout.h @@ -19,7 +19,6 @@ struct GPUSamplerBindingLayout { namespace rnwgpu { - template <> struct JSIConverter> { static std::shared_ptr diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUSamplerDescriptor.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUSamplerDescriptor.h index abcd3415f..8da56963a 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUSamplerDescriptor.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUSamplerDescriptor.h @@ -30,7 +30,6 @@ struct GPUSamplerDescriptor { namespace rnwgpu { - template <> struct JSIConverter> { static std::shared_ptr fromJSI(jsi::Runtime &runtime, const jsi::Value &arg, bool outOfBounds) { diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUShaderModuleCompilationHint.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUShaderModuleCompilationHint.h index dc1c80dac..12c182f3a 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUShaderModuleCompilationHint.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUShaderModuleCompilationHint.h @@ -25,7 +25,6 @@ struct GPUShaderModuleCompilationHint { namespace rnwgpu { - template <> struct JSIConverter> { static std::shared_ptr diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUShaderModuleDescriptor.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUShaderModuleDescriptor.h index 6bab5ffd7..d3e6dc629 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUShaderModuleDescriptor.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUShaderModuleDescriptor.h @@ -26,7 +26,6 @@ struct GPUShaderModuleDescriptor { namespace rnwgpu { - template <> struct JSIConverter> { static std::shared_ptr diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUStencilFaceState.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUStencilFaceState.h index 38857b9c5..007dd6447 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUStencilFaceState.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUStencilFaceState.h @@ -22,7 +22,6 @@ struct GPUStencilFaceState { namespace rnwgpu { - template <> struct JSIConverter> { static std::shared_ptr fromJSI(jsi::Runtime &runtime, const jsi::Value &arg, bool outOfBounds) { diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUStorageTextureBindingLayout.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUStorageTextureBindingLayout.h index 40e393282..0d9a49420 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUStorageTextureBindingLayout.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUStorageTextureBindingLayout.h @@ -22,7 +22,6 @@ struct GPUStorageTextureBindingLayout { namespace rnwgpu { - template <> struct JSIConverter> { static std::shared_ptr diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUTextureBindingLayout.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUTextureBindingLayout.h index a411a3da2..76c0e7f7e 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUTextureBindingLayout.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUTextureBindingLayout.h @@ -22,7 +22,6 @@ struct GPUTextureBindingLayout { namespace rnwgpu { - template <> struct JSIConverter> { static std::shared_ptr diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUTextureDescriptor.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUTextureDescriptor.h index 40ca7c735..758ebd28b 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUTextureDescriptor.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUTextureDescriptor.h @@ -31,7 +31,6 @@ struct GPUTextureDescriptor { namespace rnwgpu { - template <> struct JSIConverter> { static std::shared_ptr fromJSI(jsi::Runtime &runtime, const jsi::Value &arg, bool outOfBounds) { diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUTextureViewDescriptor.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUTextureViewDescriptor.h index 7690460cf..c429eaf87 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUTextureViewDescriptor.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUTextureViewDescriptor.h @@ -28,7 +28,6 @@ struct GPUTextureViewDescriptor { namespace rnwgpu { - template <> struct JSIConverter> { static std::shared_ptr diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUUncapturedErrorEventInit.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUUncapturedErrorEventInit.h index c4c9e8c8f..cc4f82da5 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUUncapturedErrorEventInit.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUUncapturedErrorEventInit.h @@ -24,7 +24,6 @@ struct GPUUncapturedErrorEventInit { namespace rnwgpu { - template <> struct JSIConverter> { static std::shared_ptr diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUVertexAttribute.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUVertexAttribute.h index d1ee1b0c7..fe521d929 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUVertexAttribute.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUVertexAttribute.h @@ -21,7 +21,6 @@ struct GPUVertexAttribute { namespace rnwgpu { - template <> struct JSIConverter> { static std::shared_ptr fromJSI(jsi::Runtime &runtime, const jsi::Value &arg, bool outOfBounds) { diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUVertexBufferLayout.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUVertexBufferLayout.h index f40b176d2..8360ca8c2 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUVertexBufferLayout.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUVertexBufferLayout.h @@ -25,7 +25,6 @@ struct GPUVertexBufferLayout { namespace rnwgpu { - template <> struct JSIConverter> { static std::shared_ptr diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUVertexState.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUVertexState.h index 138c197cf..0a45ed5a7 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUVertexState.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/GPUVertexState.h @@ -32,7 +32,6 @@ struct GPUVertexState { namespace rnwgpu { - template <> struct JSIConverter> { static std::shared_ptr fromJSI(jsi::Runtime &runtime, const jsi::Value &arg, bool outOfBounds) { diff --git a/packages/webgpu/cpp/rnwgpu/api/descriptors/Unions.h b/packages/webgpu/cpp/rnwgpu/api/descriptors/Unions.h index 595fd7e4e..3240eaf9d 100644 --- a/packages/webgpu/cpp/rnwgpu/api/descriptors/Unions.h +++ b/packages/webgpu/cpp/rnwgpu/api/descriptors/Unions.h @@ -2,8 +2,8 @@ #include -#include "External.h" #include "EnumMapper.h" +#include "External.h" #include "webgpu/webgpu_cpp.h" namespace rnwgpu { diff --git a/packages/webgpu/src/__tests__/Constants.spec.ts b/packages/webgpu/src/__tests__/Constants.spec.ts index a3e0c9555..1b1b3d391 100644 --- a/packages/webgpu/src/__tests__/Constants.spec.ts +++ b/packages/webgpu/src/__tests__/Constants.spec.ts @@ -86,4 +86,24 @@ describe("WebGPUConstants", () => { ); expect(result).toEqual([true, true]); }); + it("GPUError instanceof", async () => { + const result = await client.eval(({ device }) => { + device.pushErrorScope("validation"); + device.createSampler({ + maxAnisotropy: 0, // Invalid, maxAnisotropy must be at least 1. + }); + return device.popErrorScope().then((error) => { + if (error) { + return [ + error instanceof GPUError, + error instanceof GPUValidationError, + error instanceof GPUOutOfMemoryError, + error instanceof GPUInternalError, + ]; + } + return [false, false, false, false]; + }); + }); + expect(result).toEqual([false, true, false, false]); + }); }); From 381d3d15ebb2937cdf28a4cdd77262727160af71 Mon Sep 17 00:00:00 2001 From: William Candillon Date: Fri, 16 Jan 2026 16:32:49 +0100 Subject: [PATCH 13/23] :wrench: --- apps/example/ios/Podfile.lock | 20 +++--- packages/webgpu/cpp/jsi/NativeObject.h | 88 ++++++++++++++++++++++++-- 2 files changed, 91 insertions(+), 17 deletions(-) diff --git a/apps/example/ios/Podfile.lock b/apps/example/ios/Podfile.lock index 27af2f27a..da63aab41 100644 --- a/apps/example/ios/Podfile.lock +++ b/apps/example/ios/Podfile.lock @@ -1748,7 +1748,7 @@ PODS: - React-RCTFBReactNativeSpec - ReactCommon/turbomodule/core - SocketRocket - - react-native-safe-area-context (5.6.2): + - react-native-safe-area-context (5.6.1): - boost - DoubleConversion - fast_float @@ -1766,8 +1766,8 @@ PODS: - React-graphics - React-ImageManager - React-jsi - - react-native-safe-area-context/common (= 5.6.2) - - react-native-safe-area-context/fabric (= 5.6.2) + - react-native-safe-area-context/common (= 5.6.1) + - react-native-safe-area-context/fabric (= 5.6.1) - React-NativeModulesApple - React-RCTFabric - React-renderercss @@ -1778,7 +1778,7 @@ PODS: - ReactCommon/turbomodule/core - SocketRocket - Yoga - - react-native-safe-area-context/common (5.6.2): + - react-native-safe-area-context/common (5.6.1): - boost - DoubleConversion - fast_float @@ -1806,7 +1806,7 @@ PODS: - ReactCommon/turbomodule/core - SocketRocket - Yoga - - react-native-safe-area-context/fabric (5.6.2): + - react-native-safe-area-context/fabric (5.6.1): - boost - DoubleConversion - fast_float @@ -2398,7 +2398,7 @@ PODS: - React-perflogger (= 0.81.4) - React-utils (= 0.81.4) - SocketRocket - - ReactNativeHost (0.5.15): + - ReactNativeHost (0.5.13): - boost - DoubleConversion - fast_float @@ -2432,7 +2432,7 @@ PODS: - React-Core - React-jsi - ReactTestApp-Resources (1.0.0-dev) - - RNGestureHandler (2.30.0): + - RNGestureHandler (2.28.0): - boost - DoubleConversion - fast_float @@ -2936,7 +2936,7 @@ SPEC CHECKSUMS: React-logger: a3cb5b29c32b8e447b5a96919340e89334062b48 React-Mapbuffer: 9d2434a42701d6144ca18f0ca1c4507808ca7696 React-microtasksnativemodule: 75b6604b667d297292345302cc5bfb6b6aeccc1b - react-native-safe-area-context: c00143b4823773bba23f2f19f85663ae89ceb460 + react-native-safe-area-context: c6e2edd1c1da07bdce287fa9d9e60c5f7b514616 react-native-skia: 5bf2b2107cd7f2d806fd364f5e16b1c7554ed3cd react-native-wgpu: e54fcee5946cc2cee4814f63f425be358f097b14 React-NativeModulesApple: 879fbdc5dcff7136abceb7880fe8a2022a1bd7c3 @@ -2969,10 +2969,10 @@ SPEC CHECKSUMS: ReactAppDependencyProvider: 433ddfb4536948630aadd5bd925aff8a632d2fe3 ReactCodegen: 64dbbed4e9e0264d799578ea78492479a66fba4a ReactCommon: 394c6b92765cf6d211c2c3f7f6bc601dffb316a6 - ReactNativeHost: f5e054387e917216a2a021a3f7fdc4f9f158e7e4 + ReactNativeHost: 40e374201201cc54f9ef41458f2e412fbdde0d62 ReactTestApp-DevSupport: 9b7bbba5e8fed998e763809171d9906a1375f9d3 ReactTestApp-Resources: 1bd9ff10e4c24f2ad87101a32023721ae923bccf - RNGestureHandler: e37bdb684df1ac17c7e1d8f71a3311b2793c186b + RNGestureHandler: 3a73f098d74712952870e948b3d9cf7b6cae9961 RNReanimated: 464375ff2caa801358547c44eca894ff0bf68e74 RNWorklets: 8068c8af4b241eb2c19221310729e4c440bee023 SocketRocket: d4aabe649be1e368d1318fdf28a022d714d65748 diff --git a/packages/webgpu/cpp/jsi/NativeObject.h b/packages/webgpu/cpp/jsi/NativeObject.h index ed76dccf7..6764312c1 100644 --- a/packages/webgpu/cpp/jsi/NativeObject.h +++ b/packages/webgpu/cpp/jsi/NativeObject.h @@ -208,6 +208,10 @@ class NativeObject : public jsi::NativeState, * * The constructor throws if called directly (these objects are only * created internally by the native code). + * + * Since we don't use prototype chain inheritance (to support Reanimated), + * we implement `instanceof` via Symbol.hasInstance which checks the __brand + * property instead. */ static void installConstructor(jsi::Runtime &runtime) { installPrototype(runtime); @@ -227,19 +231,63 @@ class NativeObject : public jsi::NativeState, " objects are created by the WebGPU API"); }); - // Set the prototype property on the constructor - // This is what makes `instanceof` work + // Set the prototype property on the constructor (for consistency) ctor.setProperty(runtime, "prototype", *entry.prototype); // Set constructor property on prototype pointing back to constructor entry.prototype->setProperty(runtime, "constructor", ctor); + // Implement Symbol.hasInstance for instanceof support + // Since we copy properties instead of using setPrototypeOf, we need + // custom instanceof behavior that checks the __brand property + auto symbolCtor = runtime.global().getPropertyAsObject(runtime, "Symbol"); + auto hasInstance = symbolCtor.getProperty(runtime, "hasInstance"); + if (!hasInstance.isUndefined()) { + auto hasInstanceFunc = jsi::Function::createFromHostFunction( + runtime, + jsi::PropNameID::forUtf8(runtime, + std::string("[Symbol.hasInstance]")), + 1, + [](jsi::Runtime &rt, const jsi::Value & /*thisVal*/, + const jsi::Value *args, size_t count) -> jsi::Value { + if (count < 1 || !args[0].isObject()) { + return jsi::Value(false); + } + auto obj = args[0].getObject(rt); + auto brand = obj.getProperty(rt, "__brand"); + if (!brand.isString()) { + return jsi::Value(false); + } + return jsi::Value(brand.getString(rt).utf8(rt) == + Derived::CLASS_NAME); + }); + + // Use Object.defineProperty to set the symbol property + auto objectCtor = + runtime.global().getPropertyAsObject(runtime, "Object"); + auto defineProperty = + objectCtor.getPropertyAsFunction(runtime, "defineProperty"); + jsi::Object descriptor(runtime); + descriptor.setProperty(runtime, "value", hasInstanceFunc); + descriptor.setProperty(runtime, "writable", false); + descriptor.setProperty(runtime, "enumerable", false); + descriptor.setProperty(runtime, "configurable", true); + defineProperty.call(runtime, ctor, hasInstance, descriptor); + } + // Install on global runtime.global().setProperty(runtime, Derived::CLASS_NAME, std::move(ctor)); } /** * Create a JS object with native state attached. + * + * Instead of using Object.setPrototypeOf (which would change the prototype + * chain and break Reanimated's isPlainJSObject check), we copy all properties + * from the cached prototype directly onto the new object. This ensures: + * 1. Object.getPrototypeOf(obj) === Object.prototype (passes isPlainJSObject) + * 2. The object still has all WebGPU methods and getters + * 3. The native state is preserved when serialized by Reanimated/Worklets */ static jsi::Value create(jsi::Runtime &runtime, std::shared_ptr instance) { @@ -254,15 +302,41 @@ class NativeObject : public jsi::NativeState, // Attach native state obj.setNativeState(runtime, instance); - // Set prototype + // Copy all properties from the prototype to the object + // This keeps Object.prototype as the prototype (important for Reanimated) + // while still giving the object all its methods and getters auto &entry = getPrototypeCache().get(runtime); if (entry.prototype.has_value()) { - // Use Object.setPrototypeOf to set the prototype auto objectCtor = runtime.global().getPropertyAsObject(runtime, "Object"); - auto setPrototypeOf = - objectCtor.getPropertyAsFunction(runtime, "setPrototypeOf"); - setPrototypeOf.call(runtime, obj, *entry.prototype); + + // Get all property names from prototype (including non-enumerable) + auto getOwnPropertyNames = + objectCtor.getPropertyAsFunction(runtime, "getOwnPropertyNames"); + auto getOwnPropertyDescriptor = + objectCtor.getPropertyAsFunction(runtime, "getOwnPropertyDescriptor"); + auto defineProperty = + objectCtor.getPropertyAsFunction(runtime, "defineProperty"); + + auto names = + getOwnPropertyNames.call(runtime, *entry.prototype).asObject(runtime); + auto namesArray = names.asArray(runtime); + size_t length = namesArray.size(runtime); + + for (size_t i = 0; i < length; i++) { + auto name = namesArray.getValueAtIndex(runtime, i); + // Skip 'constructor' property + if (name.isString() && + name.getString(runtime).utf8(runtime) == "constructor") { + continue; + } + // Get the property descriptor and define it on the new object + auto descriptor = + getOwnPropertyDescriptor.call(runtime, *entry.prototype, name); + if (!descriptor.isUndefined()) { + defineProperty.call(runtime, obj, name, descriptor); + } + } } // Set memory pressure hint for GC From b8580f2eb12a379d6ef7e6c91821350684d53589 Mon Sep 17 00:00:00 2001 From: William Candillon Date: Sat, 17 Jan 2026 09:28:33 +0100 Subject: [PATCH 14/23] :wrench: --- apps/example/src/Reanimated/Reanimated.tsx | 26 ++ packages/webgpu/cpp/jsi/NativeObject.h | 261 ++++++++++++------ .../webgpu/cpp/rnwgpu/RNWebGPUManager.cpp | 98 +++++++ packages/webgpu/cpp/rnwgpu/RNWebGPUManager.h | 7 + packages/webgpu/cpp/rnwgpu/api/RNWebGPU.h | 145 ++++++++++ 5 files changed, 457 insertions(+), 80 deletions(-) diff --git a/apps/example/src/Reanimated/Reanimated.tsx b/apps/example/src/Reanimated/Reanimated.tsx index 6a56c7d16..01c61ff0c 100644 --- a/apps/example/src/Reanimated/Reanimated.tsx +++ b/apps/example/src/Reanimated/Reanimated.tsx @@ -4,9 +4,35 @@ import type { CanvasRef, RNCanvasContext } from "react-native-wgpu"; import { Canvas } from "react-native-wgpu"; import type { SharedValue } from "react-native-reanimated"; import { runOnUI, useSharedValue } from "react-native-reanimated"; +import { registerCustomSerializable } from "react-native-worklets"; import { redFragWGSL, triangleVertWGSL } from "../Triangle/triangle"; +// Declare global WebGPU worklet helper functions (installed on main runtime) +declare function __webgpuIsWebGPUObject(obj: unknown): boolean; +declare function __webgpuBox( + obj: object, +): { unbox: () => object; __boxedWebGPU: true }; + +// Register WebGPU objects for Worklets serialization at module load time +// This allows GPUDevice, GPUCanvasContext, etc. to be passed to worklets +// The unbox() method automatically installs the prototype on the UI runtime if needed +registerCustomSerializable({ + name: "WebGPU", + determine: (value: object): value is object => { + "worklet"; + return __webgpuIsWebGPUObject(value); + }, + pack: (value: object) => { + "worklet"; + return __webgpuBox(value); + }, + unpack: (boxed: { unbox: () => object }) => { + "worklet"; + return boxed.unbox(); + }, +}); + const webGPUDemo = ( runAnimation: SharedValue, device: GPUDevice, diff --git a/packages/webgpu/cpp/jsi/NativeObject.h b/packages/webgpu/cpp/jsi/NativeObject.h index 6764312c1..7f0d6e44e 100644 --- a/packages/webgpu/cpp/jsi/NativeObject.h +++ b/packages/webgpu/cpp/jsi/NativeObject.h @@ -30,6 +30,44 @@ namespace rnwgpu { namespace jsi = facebook::jsi; +// Forward declaration +template class NativeObject; + +/** + * Registry for NativeObject prototype installers. + * This allows BoxedWebGPUObject::unbox() to install prototypes on any runtime + * by looking up the brand name and calling the appropriate installer. + */ +class NativeObjectRegistry { +public: + using InstallerFunc = std::function; + + static NativeObjectRegistry &getInstance() { + static NativeObjectRegistry instance; + return instance; + } + + void registerInstaller(const std::string &brand, InstallerFunc installer) { + std::lock_guard lock(_mutex); + _installers[brand] = std::move(installer); + } + + bool installPrototype(jsi::Runtime &runtime, const std::string &brand) { + std::lock_guard lock(_mutex); + auto it = _installers.find(brand); + if (it != _installers.end()) { + it->second(runtime); + return true; + } + return false; + } + +private: + NativeObjectRegistry() = default; + std::mutex _mutex; + std::unordered_map _installers; +}; + /** * Per-runtime cache entry for a prototype object. * Uses std::optional so the prototype is stored directly @@ -117,6 +155,95 @@ class RuntimeAwareCache : public BaseRuntimeAwareCache, T _primaryCache; }; +/** + * BoxedWebGPUObject is a HostObject wrapper that holds a reference to ANY + * WebGPU NativeObject. This is used for Reanimated/Worklets serialization. + * + * Since NativeObject uses NativeState (not HostObject), Worklets can't + * serialize them directly. But Worklets CAN serialize HostObjects. + * + * This class stores: + * - The NativeState from the original object + * - The brand name for prototype reconstruction + * + * Usage pattern with registerCustomSerializable: + * - pack(): Call WebGPU.box(obj) to create a BoxedWebGPUObject (HostObject) + * - The HostObject is serialized by Worklets and transferred to UI runtime + * - unpack(): Call boxed.unbox() to get back the original object with prototype + * + * This is similar to NitroModules.box()/unbox() pattern. + */ +class BoxedWebGPUObject : public jsi::HostObject { +public: + BoxedWebGPUObject(std::shared_ptr nativeState, + const std::string &brand) + : _nativeState(std::move(nativeState)), _brand(brand) {} + + jsi::Value get(jsi::Runtime &runtime, const jsi::PropNameID &name) override { + auto propName = name.utf8(runtime); + if (propName == "unbox") { + return jsi::Function::createFromHostFunction( + runtime, jsi::PropNameID::forUtf8(runtime, "unbox"), 0, + [this](jsi::Runtime &rt, const jsi::Value & /*thisVal*/, + const jsi::Value * /*args*/, + size_t /*count*/) -> jsi::Value { + // Try to get the prototype from the global constructor + auto ctor = rt.global().getProperty(rt, _brand.c_str()); + if (!ctor.isObject()) { + // Constructor doesn't exist on this runtime - install it + NativeObjectRegistry::getInstance().installPrototype(rt, _brand); + ctor = rt.global().getProperty(rt, _brand.c_str()); + } + + // Create a new object and attach the native state + jsi::Object obj(rt); + obj.setNativeState(rt, _nativeState); + + // Set the prototype if constructor exists + if (ctor.isObject()) { + auto ctorObj = ctor.getObject(rt); + auto proto = ctorObj.getProperty(rt, "prototype"); + if (proto.isObject()) { + auto objectCtor = + rt.global().getPropertyAsObject(rt, "Object"); + auto setPrototypeOf = + objectCtor.getPropertyAsFunction(rt, "setPrototypeOf"); + setPrototypeOf.call(rt, obj, proto); + } + } + + return std::move(obj); + }); + } + if (propName == "__boxedWebGPU") { + return jsi::Value(true); + } + if (propName == "__brand") { + return jsi::String::createFromUtf8(runtime, _brand); + } + return jsi::Value::undefined(); + } + + void set(jsi::Runtime &runtime, const jsi::PropNameID &name, + const jsi::Value &value) override { + throw jsi::JSError(runtime, "BoxedWebGPUObject is read-only"); + } + + std::vector + getPropertyNames(jsi::Runtime &runtime) override { + std::vector names; + names.reserve(3); + names.push_back(jsi::PropNameID::forUtf8(runtime, "unbox")); + names.push_back(jsi::PropNameID::forUtf8(runtime, "__boxedWebGPU")); + names.push_back(jsi::PropNameID::forUtf8(runtime, "__brand")); + return names; + } + +private: + std::shared_ptr _nativeState; + std::string _brand; +}; + /** * Base class for native objects using the NativeState pattern. * @@ -209,11 +336,18 @@ class NativeObject : public jsi::NativeState, * The constructor throws if called directly (these objects are only * created internally by the native code). * - * Since we don't use prototype chain inheritance (to support Reanimated), - * we implement `instanceof` via Symbol.hasInstance which checks the __brand - * property instead. + * Also registers this class with NativeObjectRegistry so that + * BoxedWebGPUObject::unbox() can install prototypes on secondary runtimes. */ static void installConstructor(jsi::Runtime &runtime) { + // Register this class's installer in the registry (only needs to happen once) + static std::once_flag registryFlag; + std::call_once(registryFlag, []() { + NativeObjectRegistry::getInstance().registerInstaller( + Derived::CLASS_NAME, + [](jsi::Runtime &rt) { Derived::installConstructor(rt); }); + }); + installPrototype(runtime); auto &entry = getPrototypeCache().get(runtime); @@ -231,63 +365,19 @@ class NativeObject : public jsi::NativeState, " objects are created by the WebGPU API"); }); - // Set the prototype property on the constructor (for consistency) + // Set the prototype property on the constructor + // This is what makes `instanceof` work ctor.setProperty(runtime, "prototype", *entry.prototype); // Set constructor property on prototype pointing back to constructor entry.prototype->setProperty(runtime, "constructor", ctor); - // Implement Symbol.hasInstance for instanceof support - // Since we copy properties instead of using setPrototypeOf, we need - // custom instanceof behavior that checks the __brand property - auto symbolCtor = runtime.global().getPropertyAsObject(runtime, "Symbol"); - auto hasInstance = symbolCtor.getProperty(runtime, "hasInstance"); - if (!hasInstance.isUndefined()) { - auto hasInstanceFunc = jsi::Function::createFromHostFunction( - runtime, - jsi::PropNameID::forUtf8(runtime, - std::string("[Symbol.hasInstance]")), - 1, - [](jsi::Runtime &rt, const jsi::Value & /*thisVal*/, - const jsi::Value *args, size_t count) -> jsi::Value { - if (count < 1 || !args[0].isObject()) { - return jsi::Value(false); - } - auto obj = args[0].getObject(rt); - auto brand = obj.getProperty(rt, "__brand"); - if (!brand.isString()) { - return jsi::Value(false); - } - return jsi::Value(brand.getString(rt).utf8(rt) == - Derived::CLASS_NAME); - }); - - // Use Object.defineProperty to set the symbol property - auto objectCtor = - runtime.global().getPropertyAsObject(runtime, "Object"); - auto defineProperty = - objectCtor.getPropertyAsFunction(runtime, "defineProperty"); - jsi::Object descriptor(runtime); - descriptor.setProperty(runtime, "value", hasInstanceFunc); - descriptor.setProperty(runtime, "writable", false); - descriptor.setProperty(runtime, "enumerable", false); - descriptor.setProperty(runtime, "configurable", true); - defineProperty.call(runtime, ctor, hasInstance, descriptor); - } - // Install on global runtime.global().setProperty(runtime, Derived::CLASS_NAME, std::move(ctor)); } /** * Create a JS object with native state attached. - * - * Instead of using Object.setPrototypeOf (which would change the prototype - * chain and break Reanimated's isPlainJSObject check), we copy all properties - * from the cached prototype directly onto the new object. This ensures: - * 1. Object.getPrototypeOf(obj) === Object.prototype (passes isPlainJSObject) - * 2. The object still has all WebGPU methods and getters - * 3. The native state is preserved when serialized by Reanimated/Worklets */ static jsi::Value create(jsi::Runtime &runtime, std::shared_ptr instance) { @@ -302,41 +392,15 @@ class NativeObject : public jsi::NativeState, // Attach native state obj.setNativeState(runtime, instance); - // Copy all properties from the prototype to the object - // This keeps Object.prototype as the prototype (important for Reanimated) - // while still giving the object all its methods and getters + // Set prototype auto &entry = getPrototypeCache().get(runtime); if (entry.prototype.has_value()) { + // Use Object.setPrototypeOf to set the prototype auto objectCtor = runtime.global().getPropertyAsObject(runtime, "Object"); - - // Get all property names from prototype (including non-enumerable) - auto getOwnPropertyNames = - objectCtor.getPropertyAsFunction(runtime, "getOwnPropertyNames"); - auto getOwnPropertyDescriptor = - objectCtor.getPropertyAsFunction(runtime, "getOwnPropertyDescriptor"); - auto defineProperty = - objectCtor.getPropertyAsFunction(runtime, "defineProperty"); - - auto names = - getOwnPropertyNames.call(runtime, *entry.prototype).asObject(runtime); - auto namesArray = names.asArray(runtime); - size_t length = namesArray.size(runtime); - - for (size_t i = 0; i < length; i++) { - auto name = namesArray.getValueAtIndex(runtime, i); - // Skip 'constructor' property - if (name.isString() && - name.getString(runtime).utf8(runtime) == "constructor") { - continue; - } - // Get the property descriptor and define it on the new object - auto descriptor = - getOwnPropertyDescriptor.call(runtime, *entry.prototype, name); - if (!descriptor.isUndefined()) { - defineProperty.call(runtime, obj, name, descriptor); - } - } + auto setPrototypeOf = + objectCtor.getPropertyAsFunction(runtime, "setPrototypeOf"); + setPrototypeOf.call(runtime, obj, *entry.prototype); } // Set memory pressure hint for GC @@ -368,6 +432,43 @@ class NativeObject : public jsi::NativeState, return obj.getNativeState(runtime); } + /** + * Box a NativeObject into a HostObject for Worklets serialization. + * + * This is used with registerCustomSerializable to transfer WebGPU objects + * between runtimes. The boxed object is a HostObject (which Worklets can + * serialize), and calling unbox() on it recreates the full NativeObject + * with its prototype. + * + * Usage: + * pack: (value) => { 'worklet'; return RNWebGPU.box(value); } + * unpack: (boxed) => { 'worklet'; return boxed.unbox(); } + */ + static jsi::Value box(jsi::Runtime &runtime, const jsi::Value &value) { + if (!value.isObject()) { + throw jsi::JSError(runtime, "box() requires an object"); + } + auto obj = value.getObject(runtime); + if (!obj.hasNativeState(runtime)) { + throw jsi::JSError(runtime, "Object has no native state"); + } + auto nativeState = obj.getNativeState(runtime); + auto boxed = + std::make_shared(nativeState, Derived::CLASS_NAME); + return jsi::Object::createFromHostObject(runtime, boxed); + } + + /** + * Check if a value is a WebGPU NativeObject (has the right NativeState) + */ + static bool isNativeObject(jsi::Runtime &runtime, const jsi::Value &value) { + if (!value.isObject()) { + return false; + } + jsi::Object obj = value.getObject(runtime); + return obj.hasNativeState(runtime); + } + /** * Memory pressure for GC hints. Override in derived classes. */ diff --git a/packages/webgpu/cpp/rnwgpu/RNWebGPUManager.cpp b/packages/webgpu/cpp/rnwgpu/RNWebGPUManager.cpp index e4713d46a..a138b8fbf 100644 --- a/packages/webgpu/cpp/rnwgpu/RNWebGPUManager.cpp +++ b/packages/webgpu/cpp/rnwgpu/RNWebGPUManager.cpp @@ -110,6 +110,104 @@ RNWebGPUManager::RNWebGPUManager( GPUShaderStage::create(*_jsRuntime)); _jsRuntime->global().setProperty(*_jsRuntime, "GPUTextureUsage", GPUTextureUsage::create(*_jsRuntime)); + + // Install global helper functions for Worklets serialization + // These are standalone functions that don't require RNWebGPU instance + installWebGPUWorkletHelpers(*_jsRuntime); +} + +void RNWebGPUManager::installWebGPUWorkletHelpers(jsi::Runtime &runtime) { + // __webgpuIsWebGPUObject - checks if a value is a WebGPU NativeObject + auto isWebGPUObjectFunc = jsi::Function::createFromHostFunction( + runtime, jsi::PropNameID::forUtf8(runtime, "__webgpuIsWebGPUObject"), 1, + [](jsi::Runtime &rt, const jsi::Value & /*thisVal*/, + const jsi::Value *args, size_t count) -> jsi::Value { + if (count < 1 || !args[0].isObject()) { + return jsi::Value(false); + } + auto obj = args[0].getObject(rt); + + // Check if it has native state + if (!obj.hasNativeState(rt)) { + return jsi::Value(false); + } + + // Check if it has Symbol.toStringTag on its prototype (WebGPU objects do) + auto objectCtor = rt.global().getPropertyAsObject(rt, "Object"); + auto getPrototypeOf = + objectCtor.getPropertyAsFunction(rt, "getPrototypeOf"); + auto proto = getPrototypeOf.call(rt, obj); + + if (!proto.isObject()) { + return jsi::Value(false); + } + + auto protoObj = proto.getObject(rt); + auto symbolCtor = rt.global().getPropertyAsObject(rt, "Symbol"); + auto toStringTag = symbolCtor.getProperty(rt, "toStringTag"); + if (toStringTag.isUndefined()) { + return jsi::Value(false); + } + + auto getOwnPropertyDescriptor = + objectCtor.getPropertyAsFunction(rt, "getOwnPropertyDescriptor"); + auto desc = getOwnPropertyDescriptor.call(rt, protoObj, toStringTag); + return jsi::Value(desc.isObject()); + }); + runtime.global().setProperty(runtime, "__webgpuIsWebGPUObject", + std::move(isWebGPUObjectFunc)); + + // __webgpuBox - boxes a WebGPU object for Worklets serialization + auto boxFunc = jsi::Function::createFromHostFunction( + runtime, jsi::PropNameID::forUtf8(runtime, "__webgpuBox"), 1, + [](jsi::Runtime &rt, const jsi::Value & /*thisVal*/, + const jsi::Value *args, size_t count) -> jsi::Value { + if (count < 1 || !args[0].isObject()) { + throw jsi::JSError(rt, "__webgpuBox() requires a WebGPU object argument"); + } + + auto obj = args[0].getObject(rt); + + // Check if it has native state + if (!obj.hasNativeState(rt)) { + throw jsi::JSError(rt, "Object has no native state - not a WebGPU object"); + } + + // Get the brand name from Symbol.toStringTag on the prototype + auto objectCtor = rt.global().getPropertyAsObject(rt, "Object"); + auto getPrototypeOf = + objectCtor.getPropertyAsFunction(rt, "getPrototypeOf"); + auto proto = getPrototypeOf.call(rt, obj); + + std::string brand; + if (proto.isObject()) { + auto protoObj = proto.getObject(rt); + auto symbolCtor = rt.global().getPropertyAsObject(rt, "Symbol"); + auto toStringTag = symbolCtor.getProperty(rt, "toStringTag"); + if (!toStringTag.isUndefined()) { + auto getOwnPropertyDescriptor = + objectCtor.getPropertyAsFunction(rt, "getOwnPropertyDescriptor"); + auto desc = getOwnPropertyDescriptor.call(rt, protoObj, toStringTag); + if (desc.isObject()) { + auto descObj = desc.getObject(rt); + auto value = descObj.getProperty(rt, "value"); + if (value.isString()) { + brand = value.getString(rt).utf8(rt); + } + } + } + } + + if (brand.empty()) { + throw jsi::JSError( + rt, "Cannot determine WebGPU object type - no Symbol.toStringTag found"); + } + + auto nativeState = obj.getNativeState(rt); + auto boxed = std::make_shared(nativeState, brand); + return jsi::Object::createFromHostObject(rt, boxed); + }); + runtime.global().setProperty(runtime, "__webgpuBox", std::move(boxFunc)); } RNWebGPUManager::~RNWebGPUManager() { diff --git a/packages/webgpu/cpp/rnwgpu/RNWebGPUManager.h b/packages/webgpu/cpp/rnwgpu/RNWebGPUManager.h index 1155914c7..2043c9658 100644 --- a/packages/webgpu/cpp/rnwgpu/RNWebGPUManager.h +++ b/packages/webgpu/cpp/rnwgpu/RNWebGPUManager.h @@ -27,6 +27,13 @@ class RNWebGPUManager { std::shared_ptr platformContext); ~RNWebGPUManager(); + /** + * Install global helper functions for Worklets serialization. + * This installs __webgpuIsWebGPUObject and __webgpuBox on the global object. + * Can be called on any runtime (main JS, UI, or custom worklet runtimes). + */ + static void installWebGPUWorkletHelpers(jsi::Runtime &runtime); + private: jsi::Runtime *_jsRuntime; std::shared_ptr _jsCallInvoker; diff --git a/packages/webgpu/cpp/rnwgpu/api/RNWebGPU.h b/packages/webgpu/cpp/rnwgpu/api/RNWebGPU.h index 8ae87a2ea..bb214c817 100644 --- a/packages/webgpu/cpp/rnwgpu/api/RNWebGPU.h +++ b/packages/webgpu/cpp/rnwgpu/api/RNWebGPU.h @@ -34,6 +34,121 @@ class RNWebGPU : public NativeObject { std::shared_ptr getGPU() { return _gpu; } + /** + * Box any WebGPU NativeObject into a HostObject for Worklets serialization. + * + * This function checks if the object has native state and a prototype with + * Symbol.toStringTag (which identifies the WebGPU class name), then creates + * a BoxedWebGPUObject that can be serialized by Worklets. + * + * Usage with registerCustomSerializable: + * pack: (value) => { 'worklet'; return RNWebGPU.box(value); } + * unpack: (boxed) => { 'worklet'; return boxed.unbox(); } + */ + jsi::Value box(jsi::Runtime &runtime, const jsi::Value &thisVal, + const jsi::Value *args, size_t count) { + if (count < 1 || !args[0].isObject()) { + throw jsi::JSError(runtime, "box() requires a WebGPU object argument"); + } + + auto obj = args[0].getObject(runtime); + + // Check if it has native state + if (!obj.hasNativeState(runtime)) { + throw jsi::JSError(runtime, "Object has no native state - not a WebGPU object"); + } + + // Get the brand name from Symbol.toStringTag on the prototype + auto objectCtor = runtime.global().getPropertyAsObject(runtime, "Object"); + auto getPrototypeOf = + objectCtor.getPropertyAsFunction(runtime, "getPrototypeOf"); + auto proto = getPrototypeOf.call(runtime, obj); + + std::string brand; + if (proto.isObject()) { + auto protoObj = proto.getObject(runtime); + auto symbolCtor = runtime.global().getPropertyAsObject(runtime, "Symbol"); + auto toStringTag = symbolCtor.getProperty(runtime, "toStringTag"); + if (!toStringTag.isUndefined()) { + // Get the Symbol.toStringTag property value from the prototype + auto getOwnPropertyDescriptor = + objectCtor.getPropertyAsFunction(runtime, "getOwnPropertyDescriptor"); + auto desc = getOwnPropertyDescriptor.call(runtime, protoObj, toStringTag); + if (desc.isObject()) { + auto descObj = desc.getObject(runtime); + auto value = descObj.getProperty(runtime, "value"); + if (value.isString()) { + brand = value.getString(runtime).utf8(runtime); + } + } + } + } + + if (brand.empty()) { + throw jsi::JSError( + runtime, "Cannot determine WebGPU object type - no Symbol.toStringTag found"); + } + + auto nativeState = obj.getNativeState(runtime); + auto boxed = std::make_shared(nativeState, brand); + return jsi::Object::createFromHostObject(runtime, boxed); + } + + /** + * Check if a value is a boxed WebGPU object (created by box()) + */ + jsi::Value isBoxedWebGPUObject(jsi::Runtime &runtime, const jsi::Value &thisVal, + const jsi::Value *args, size_t count) { + if (count < 1 || !args[0].isObject()) { + return jsi::Value(false); + } + auto obj = args[0].getObject(runtime); + if (!obj.isHostObject(runtime)) { + return jsi::Value(false); + } + // Check for __boxedWebGPU marker + auto marker = obj.getProperty(runtime, "__boxedWebGPU"); + return jsi::Value(marker.isBool() && marker.getBool()); + } + + /** + * Check if a value is a WebGPU NativeObject (has native state and WebGPU prototype) + */ + jsi::Value isWebGPUObject(jsi::Runtime &runtime, const jsi::Value &thisVal, + const jsi::Value *args, size_t count) { + if (count < 1 || !args[0].isObject()) { + return jsi::Value(false); + } + auto obj = args[0].getObject(runtime); + + // Check if it has native state + if (!obj.hasNativeState(runtime)) { + return jsi::Value(false); + } + + // Check if it has Symbol.toStringTag on its prototype (WebGPU objects do) + auto objectCtor = runtime.global().getPropertyAsObject(runtime, "Object"); + auto getPrototypeOf = + objectCtor.getPropertyAsFunction(runtime, "getPrototypeOf"); + auto proto = getPrototypeOf.call(runtime, obj); + + if (!proto.isObject()) { + return jsi::Value(false); + } + + auto protoObj = proto.getObject(runtime); + auto symbolCtor = runtime.global().getPropertyAsObject(runtime, "Symbol"); + auto toStringTag = symbolCtor.getProperty(runtime, "toStringTag"); + if (toStringTag.isUndefined()) { + return jsi::Value(false); + } + + auto getOwnPropertyDescriptor = + objectCtor.getPropertyAsFunction(runtime, "getOwnPropertyDescriptor"); + auto desc = getOwnPropertyDescriptor.call(runtime, protoObj, toStringTag); + return jsi::Value(desc.isObject()); + } + bool getFabric() { return true; } std::shared_ptr @@ -70,6 +185,36 @@ class RNWebGPU : public NativeObject { &RNWebGPU::getNativeSurface); installMethod(runtime, prototype, "MakeWebGPUCanvasContext", &RNWebGPU::MakeWebGPUCanvasContext); + + // Install box() - boxes a WebGPU object for Worklets serialization + auto boxFunc = jsi::Function::createFromHostFunction( + runtime, jsi::PropNameID::forUtf8(runtime, "box"), 1, + [](jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args, + size_t count) -> jsi::Value { + auto native = RNWebGPU::fromValue(rt, thisVal); + return native->box(rt, thisVal, args, count); + }); + prototype.setProperty(runtime, "box", boxFunc); + + // Install isWebGPUObject() - checks if a value is a WebGPU NativeObject + auto isWebGPUObjectFunc = jsi::Function::createFromHostFunction( + runtime, jsi::PropNameID::forUtf8(runtime, "isWebGPUObject"), 1, + [](jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args, + size_t count) -> jsi::Value { + auto native = RNWebGPU::fromValue(rt, thisVal); + return native->isWebGPUObject(rt, thisVal, args, count); + }); + prototype.setProperty(runtime, "isWebGPUObject", isWebGPUObjectFunc); + + // Install isBoxedWebGPUObject() - checks if a value is a boxed WebGPU object + auto isBoxedWebGPUObjectFunc = jsi::Function::createFromHostFunction( + runtime, jsi::PropNameID::forUtf8(runtime, "isBoxedWebGPUObject"), 1, + [](jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args, + size_t count) -> jsi::Value { + auto native = RNWebGPU::fromValue(rt, thisVal); + return native->isBoxedWebGPUObject(rt, thisVal, args, count); + }); + prototype.setProperty(runtime, "isBoxedWebGPUObject", isBoxedWebGPUObjectFunc); } private: From fbaef86bc82db696f7117bc8f21efd8b2176eeb3 Mon Sep 17 00:00:00 2001 From: William Candillon Date: Sat, 17 Jan 2026 09:35:31 +0100 Subject: [PATCH 15/23] :wrench: --- packages/webgpu/cpp/jsi/NativeObject.h | 37 ------ packages/webgpu/cpp/rnwgpu/api/RNWebGPU.h | 145 ---------------------- 2 files changed, 182 deletions(-) diff --git a/packages/webgpu/cpp/jsi/NativeObject.h b/packages/webgpu/cpp/jsi/NativeObject.h index 7f0d6e44e..a07a8168e 100644 --- a/packages/webgpu/cpp/jsi/NativeObject.h +++ b/packages/webgpu/cpp/jsi/NativeObject.h @@ -432,43 +432,6 @@ class NativeObject : public jsi::NativeState, return obj.getNativeState(runtime); } - /** - * Box a NativeObject into a HostObject for Worklets serialization. - * - * This is used with registerCustomSerializable to transfer WebGPU objects - * between runtimes. The boxed object is a HostObject (which Worklets can - * serialize), and calling unbox() on it recreates the full NativeObject - * with its prototype. - * - * Usage: - * pack: (value) => { 'worklet'; return RNWebGPU.box(value); } - * unpack: (boxed) => { 'worklet'; return boxed.unbox(); } - */ - static jsi::Value box(jsi::Runtime &runtime, const jsi::Value &value) { - if (!value.isObject()) { - throw jsi::JSError(runtime, "box() requires an object"); - } - auto obj = value.getObject(runtime); - if (!obj.hasNativeState(runtime)) { - throw jsi::JSError(runtime, "Object has no native state"); - } - auto nativeState = obj.getNativeState(runtime); - auto boxed = - std::make_shared(nativeState, Derived::CLASS_NAME); - return jsi::Object::createFromHostObject(runtime, boxed); - } - - /** - * Check if a value is a WebGPU NativeObject (has the right NativeState) - */ - static bool isNativeObject(jsi::Runtime &runtime, const jsi::Value &value) { - if (!value.isObject()) { - return false; - } - jsi::Object obj = value.getObject(runtime); - return obj.hasNativeState(runtime); - } - /** * Memory pressure for GC hints. Override in derived classes. */ diff --git a/packages/webgpu/cpp/rnwgpu/api/RNWebGPU.h b/packages/webgpu/cpp/rnwgpu/api/RNWebGPU.h index bb214c817..8ae87a2ea 100644 --- a/packages/webgpu/cpp/rnwgpu/api/RNWebGPU.h +++ b/packages/webgpu/cpp/rnwgpu/api/RNWebGPU.h @@ -34,121 +34,6 @@ class RNWebGPU : public NativeObject { std::shared_ptr getGPU() { return _gpu; } - /** - * Box any WebGPU NativeObject into a HostObject for Worklets serialization. - * - * This function checks if the object has native state and a prototype with - * Symbol.toStringTag (which identifies the WebGPU class name), then creates - * a BoxedWebGPUObject that can be serialized by Worklets. - * - * Usage with registerCustomSerializable: - * pack: (value) => { 'worklet'; return RNWebGPU.box(value); } - * unpack: (boxed) => { 'worklet'; return boxed.unbox(); } - */ - jsi::Value box(jsi::Runtime &runtime, const jsi::Value &thisVal, - const jsi::Value *args, size_t count) { - if (count < 1 || !args[0].isObject()) { - throw jsi::JSError(runtime, "box() requires a WebGPU object argument"); - } - - auto obj = args[0].getObject(runtime); - - // Check if it has native state - if (!obj.hasNativeState(runtime)) { - throw jsi::JSError(runtime, "Object has no native state - not a WebGPU object"); - } - - // Get the brand name from Symbol.toStringTag on the prototype - auto objectCtor = runtime.global().getPropertyAsObject(runtime, "Object"); - auto getPrototypeOf = - objectCtor.getPropertyAsFunction(runtime, "getPrototypeOf"); - auto proto = getPrototypeOf.call(runtime, obj); - - std::string brand; - if (proto.isObject()) { - auto protoObj = proto.getObject(runtime); - auto symbolCtor = runtime.global().getPropertyAsObject(runtime, "Symbol"); - auto toStringTag = symbolCtor.getProperty(runtime, "toStringTag"); - if (!toStringTag.isUndefined()) { - // Get the Symbol.toStringTag property value from the prototype - auto getOwnPropertyDescriptor = - objectCtor.getPropertyAsFunction(runtime, "getOwnPropertyDescriptor"); - auto desc = getOwnPropertyDescriptor.call(runtime, protoObj, toStringTag); - if (desc.isObject()) { - auto descObj = desc.getObject(runtime); - auto value = descObj.getProperty(runtime, "value"); - if (value.isString()) { - brand = value.getString(runtime).utf8(runtime); - } - } - } - } - - if (brand.empty()) { - throw jsi::JSError( - runtime, "Cannot determine WebGPU object type - no Symbol.toStringTag found"); - } - - auto nativeState = obj.getNativeState(runtime); - auto boxed = std::make_shared(nativeState, brand); - return jsi::Object::createFromHostObject(runtime, boxed); - } - - /** - * Check if a value is a boxed WebGPU object (created by box()) - */ - jsi::Value isBoxedWebGPUObject(jsi::Runtime &runtime, const jsi::Value &thisVal, - const jsi::Value *args, size_t count) { - if (count < 1 || !args[0].isObject()) { - return jsi::Value(false); - } - auto obj = args[0].getObject(runtime); - if (!obj.isHostObject(runtime)) { - return jsi::Value(false); - } - // Check for __boxedWebGPU marker - auto marker = obj.getProperty(runtime, "__boxedWebGPU"); - return jsi::Value(marker.isBool() && marker.getBool()); - } - - /** - * Check if a value is a WebGPU NativeObject (has native state and WebGPU prototype) - */ - jsi::Value isWebGPUObject(jsi::Runtime &runtime, const jsi::Value &thisVal, - const jsi::Value *args, size_t count) { - if (count < 1 || !args[0].isObject()) { - return jsi::Value(false); - } - auto obj = args[0].getObject(runtime); - - // Check if it has native state - if (!obj.hasNativeState(runtime)) { - return jsi::Value(false); - } - - // Check if it has Symbol.toStringTag on its prototype (WebGPU objects do) - auto objectCtor = runtime.global().getPropertyAsObject(runtime, "Object"); - auto getPrototypeOf = - objectCtor.getPropertyAsFunction(runtime, "getPrototypeOf"); - auto proto = getPrototypeOf.call(runtime, obj); - - if (!proto.isObject()) { - return jsi::Value(false); - } - - auto protoObj = proto.getObject(runtime); - auto symbolCtor = runtime.global().getPropertyAsObject(runtime, "Symbol"); - auto toStringTag = symbolCtor.getProperty(runtime, "toStringTag"); - if (toStringTag.isUndefined()) { - return jsi::Value(false); - } - - auto getOwnPropertyDescriptor = - objectCtor.getPropertyAsFunction(runtime, "getOwnPropertyDescriptor"); - auto desc = getOwnPropertyDescriptor.call(runtime, protoObj, toStringTag); - return jsi::Value(desc.isObject()); - } - bool getFabric() { return true; } std::shared_ptr @@ -185,36 +70,6 @@ class RNWebGPU : public NativeObject { &RNWebGPU::getNativeSurface); installMethod(runtime, prototype, "MakeWebGPUCanvasContext", &RNWebGPU::MakeWebGPUCanvasContext); - - // Install box() - boxes a WebGPU object for Worklets serialization - auto boxFunc = jsi::Function::createFromHostFunction( - runtime, jsi::PropNameID::forUtf8(runtime, "box"), 1, - [](jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args, - size_t count) -> jsi::Value { - auto native = RNWebGPU::fromValue(rt, thisVal); - return native->box(rt, thisVal, args, count); - }); - prototype.setProperty(runtime, "box", boxFunc); - - // Install isWebGPUObject() - checks if a value is a WebGPU NativeObject - auto isWebGPUObjectFunc = jsi::Function::createFromHostFunction( - runtime, jsi::PropNameID::forUtf8(runtime, "isWebGPUObject"), 1, - [](jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args, - size_t count) -> jsi::Value { - auto native = RNWebGPU::fromValue(rt, thisVal); - return native->isWebGPUObject(rt, thisVal, args, count); - }); - prototype.setProperty(runtime, "isWebGPUObject", isWebGPUObjectFunc); - - // Install isBoxedWebGPUObject() - checks if a value is a boxed WebGPU object - auto isBoxedWebGPUObjectFunc = jsi::Function::createFromHostFunction( - runtime, jsi::PropNameID::forUtf8(runtime, "isBoxedWebGPUObject"), 1, - [](jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args, - size_t count) -> jsi::Value { - auto native = RNWebGPU::fromValue(rt, thisVal); - return native->isBoxedWebGPUObject(rt, thisVal, args, count); - }); - prototype.setProperty(runtime, "isBoxedWebGPUObject", isBoxedWebGPUObjectFunc); } private: From ecff126f231906a2bc7b18715636b3137eb4ad36 Mon Sep 17 00:00:00 2001 From: William Candillon Date: Sat, 17 Jan 2026 10:54:14 +0100 Subject: [PATCH 16/23] :wrench: --- packages/webgpu/cpp/jsi/NativeObject.h | 81 +------------- packages/webgpu/cpp/jsi/RuntimeAwareCache.cpp | 2 +- packages/webgpu/cpp/jsi/RuntimeAwareCache.h | 102 ++++++++++++++++++ 3 files changed, 104 insertions(+), 81 deletions(-) create mode 100644 packages/webgpu/cpp/jsi/RuntimeAwareCache.h diff --git a/packages/webgpu/cpp/jsi/NativeObject.h b/packages/webgpu/cpp/jsi/NativeObject.h index a07a8168e..cbeb91533 100644 --- a/packages/webgpu/cpp/jsi/NativeObject.h +++ b/packages/webgpu/cpp/jsi/NativeObject.h @@ -4,7 +4,6 @@ #pragma once -#include #include #include #include @@ -15,7 +14,7 @@ #include #include -#include "RuntimeLifecycleMonitor.h" +#include "RuntimeAwareCache.h" #include "WGPULogger.h" // Forward declare to avoid circular dependency @@ -77,84 +76,6 @@ struct PrototypeCacheEntry { std::optional prototype; }; -/** - * Base class for runtime-aware caches. Provides static storage for the - * main runtime pointer, which must be set during initialization. - */ -class BaseRuntimeAwareCache { -public: - static void setMainJsRuntime(jsi::Runtime *rt) { _mainRuntime = rt; } - -protected: - static jsi::Runtime *getMainJsRuntime() { - assert(_mainRuntime != nullptr && - "Expected main Javascript runtime to be set in the " - "BaseRuntimeAwareCache class."); - return _mainRuntime; - } - -private: - static jsi::Runtime *_mainRuntime; -}; - -/** - * Runtime-aware cache that stores data per-runtime and automatically - * cleans up when a runtime is destroyed. - * - * This follows the same pattern as React Native Skia's RuntimeAwareCache: - * - For the primary/main runtime: uses a simple member variable (zero overhead) - * - For secondary runtimes: tracks lifecycle and auto-cleans on destruction - * - * The assumption is that the main runtime outlives the cache itself, - * so we don't need to register for its destruction events. - */ -template -class RuntimeAwareCache : public BaseRuntimeAwareCache, - public RuntimeLifecycleListener { -public: - void onRuntimeDestroyed(jsi::Runtime *rt) override { - if (getMainJsRuntime() != rt) { - // We are removing a secondary runtime - _secondaryRuntimeCaches.erase(rt); - } - } - - ~RuntimeAwareCache() { - for (auto &cache : _secondaryRuntimeCaches) { - RuntimeLifecycleMonitor::removeListener( - *static_cast(cache.first), this); - } - } - - T &get(jsi::Runtime &rt) { - // We check if we're accessing the main runtime - this is the happy path - // to avoid us having to lookup by runtime for caches that only has a single - // runtime - if (getMainJsRuntime() == &rt) { - return _primaryCache; - } else { - if (_secondaryRuntimeCaches.count(&rt) == 0) { - // We only add listener when the secondary runtime is used, this assumes - // that the secondary runtime is terminated first. This lets us avoid - // additional complexity for the majority of cases when objects are not - // shared between runtimes. Otherwise we'd have to register all objects - // with the RuntimeMonitor as opposed to only registering ones that are - // used in secondary runtime. Note that we can't register listener here - // with the primary runtime as it may run on a separate thread. - RuntimeLifecycleMonitor::addListener(rt, this); - - T cache; - _secondaryRuntimeCaches.emplace(&rt, std::move(cache)); - } - } - return _secondaryRuntimeCaches.at(&rt); - } - -private: - std::unordered_map _secondaryRuntimeCaches; - T _primaryCache; -}; - /** * BoxedWebGPUObject is a HostObject wrapper that holds a reference to ANY * WebGPU NativeObject. This is used for Reanimated/Worklets serialization. diff --git a/packages/webgpu/cpp/jsi/RuntimeAwareCache.cpp b/packages/webgpu/cpp/jsi/RuntimeAwareCache.cpp index a5401d5b1..ea77f96b0 100644 --- a/packages/webgpu/cpp/jsi/RuntimeAwareCache.cpp +++ b/packages/webgpu/cpp/jsi/RuntimeAwareCache.cpp @@ -1,4 +1,4 @@ -#include "NativeObject.h" +#include "RuntimeAwareCache.h" namespace rnwgpu { diff --git a/packages/webgpu/cpp/jsi/RuntimeAwareCache.h b/packages/webgpu/cpp/jsi/RuntimeAwareCache.h new file mode 100644 index 000000000..75567f503 --- /dev/null +++ b/packages/webgpu/cpp/jsi/RuntimeAwareCache.h @@ -0,0 +1,102 @@ +#pragma once + +#include + +#include +#include +#include +#include + +#include "RuntimeLifecycleMonitor.h" + +namespace rnwgpu { + +namespace jsi = facebook::jsi; + +class BaseRuntimeAwareCache { +public: + static void setMainJsRuntime(jsi::Runtime *rt) { _mainRuntime = rt; } + +protected: + static jsi::Runtime *getMainJsRuntime() { + assert(_mainRuntime != nullptr && + "Expected main Javascript runtime to be set in the " + "BaseRuntimeAwareCache class."); + + return _mainRuntime; + } + +private: + static jsi::Runtime *_mainRuntime; +}; + +/** + * Provides a way to keep data specific to a jsi::Runtime instance that gets + * cleaned up when that runtime is destroyed. This is necessary because JSI does + * not allow for its associated objects to be retained past the runtime + * lifetime. If an object (e.g. jsi::Values or jsi::Function instances) is kept + * after the runtime is torn down, its destructor (once it is destroyed + * eventually) will result in a crash (JSI objects keep a pointer to memory + * managed by the runtime, accessing that portion of the memory after runtime is + * deleted is the root cause of that crash). + * + * In order to provide an efficient implementation that does not add an overhead + * for the cases when only a single runtime is used, which is the primary + * usecase, the following assumption has been made: Only for secondary runtimes + * we track destruction and clean up the store associated with that runtime. For + * the first runtime we assume that the object holding the store is destroyed + * prior to the destruction of that runtime. + * + * The above assumption makes it work without any overhead when only single + * runtime is in use. Specifically, we don't perform any additional operations + * related to tracking runtime lifecycle when only a single runtime is used. + */ +template +class RuntimeAwareCache : public BaseRuntimeAwareCache, + public RuntimeLifecycleListener { + +public: + void onRuntimeDestroyed(jsi::Runtime *rt) override { + if (getMainJsRuntime() != rt) { + // We are removing a secondary runtime + _secondaryRuntimeCaches.erase(rt); + } + } + + ~RuntimeAwareCache() { + for (auto &cache : _secondaryRuntimeCaches) { + RuntimeLifecycleMonitor::removeListener( + *static_cast(cache.first), this); + } + } + + T &get(jsi::Runtime &rt) { + // We check if we're accessing the main runtime - this is the happy path + // to avoid us having to lookup by runtime for caches that only has a single + // runtime + if (getMainJsRuntime() == &rt) { + return _primaryCache; + } else { + if (_secondaryRuntimeCaches.count(&rt) == 0) { + // We only add listener when the secondary runtime is used, this assumes + // that the secondary runtime is terminated first. This lets us avoid + // additional complexity for the majority of cases when objects are not + // shared between runtimes. Otherwise we'd have to register all objects + // with the RuntimeMonitor as opposed to only registering ones that are + // used in secondary runtime. Note that we can't register listener here + // with the primary runtime as it may run on a separate thread. + RuntimeLifecycleMonitor::addListener(rt, this); + + T cache; + _secondaryRuntimeCaches.emplace(&rt, std::move(cache)); + } + } + return _secondaryRuntimeCaches.at(&rt); + } + +private: + std::unordered_map _secondaryRuntimeCaches; + T _primaryCache; +}; + +} // namespace rnwgpu From 83bafd6bd1fe0b9f4ec66c99c746d318eec70acf Mon Sep 17 00:00:00 2001 From: William Candillon Date: Sat, 17 Jan 2026 10:56:58 +0100 Subject: [PATCH 17/23] :wrench: --- .../webgpu/cpp/rnwgpu/RNWebGPUManager.cpp | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/packages/webgpu/cpp/rnwgpu/RNWebGPUManager.cpp b/packages/webgpu/cpp/rnwgpu/RNWebGPUManager.cpp index a138b8fbf..10362bd35 100644 --- a/packages/webgpu/cpp/rnwgpu/RNWebGPUManager.cpp +++ b/packages/webgpu/cpp/rnwgpu/RNWebGPUManager.cpp @@ -132,7 +132,8 @@ void RNWebGPUManager::installWebGPUWorkletHelpers(jsi::Runtime &runtime) { return jsi::Value(false); } - // Check if it has Symbol.toStringTag on its prototype (WebGPU objects do) + // Check if it has Symbol.toStringTag on its prototype (WebGPU objects + // do) auto objectCtor = rt.global().getPropertyAsObject(rt, "Object"); auto getPrototypeOf = objectCtor.getPropertyAsFunction(rt, "getPrototypeOf"); @@ -163,14 +164,16 @@ void RNWebGPUManager::installWebGPUWorkletHelpers(jsi::Runtime &runtime) { [](jsi::Runtime &rt, const jsi::Value & /*thisVal*/, const jsi::Value *args, size_t count) -> jsi::Value { if (count < 1 || !args[0].isObject()) { - throw jsi::JSError(rt, "__webgpuBox() requires a WebGPU object argument"); + throw jsi::JSError(rt, + "__webgpuBox() requires a WebGPU object argument"); } auto obj = args[0].getObject(rt); // Check if it has native state if (!obj.hasNativeState(rt)) { - throw jsi::JSError(rt, "Object has no native state - not a WebGPU object"); + throw jsi::JSError( + rt, "Object has no native state - not a WebGPU object"); } // Get the brand name from Symbol.toStringTag on the prototype @@ -185,9 +188,10 @@ void RNWebGPUManager::installWebGPUWorkletHelpers(jsi::Runtime &runtime) { auto symbolCtor = rt.global().getPropertyAsObject(rt, "Symbol"); auto toStringTag = symbolCtor.getProperty(rt, "toStringTag"); if (!toStringTag.isUndefined()) { - auto getOwnPropertyDescriptor = - objectCtor.getPropertyAsFunction(rt, "getOwnPropertyDescriptor"); - auto desc = getOwnPropertyDescriptor.call(rt, protoObj, toStringTag); + auto getOwnPropertyDescriptor = objectCtor.getPropertyAsFunction( + rt, "getOwnPropertyDescriptor"); + auto desc = + getOwnPropertyDescriptor.call(rt, protoObj, toStringTag); if (desc.isObject()) { auto descObj = desc.getObject(rt); auto value = descObj.getProperty(rt, "value"); @@ -199,8 +203,8 @@ void RNWebGPUManager::installWebGPUWorkletHelpers(jsi::Runtime &runtime) { } if (brand.empty()) { - throw jsi::JSError( - rt, "Cannot determine WebGPU object type - no Symbol.toStringTag found"); + throw jsi::JSError(rt, "Cannot determine WebGPU object type - no " + "Symbol.toStringTag found"); } auto nativeState = obj.getNativeState(rt); From 499ac4f7c5d1b3541e2994a52c27818be71bea7b Mon Sep 17 00:00:00 2001 From: William Candillon Date: Sat, 17 Jan 2026 11:03:11 +0100 Subject: [PATCH 18/23] :wrench: --- packages/webgpu/cpp/jsi/RuntimeAwareCache.h | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/packages/webgpu/cpp/jsi/RuntimeAwareCache.h b/packages/webgpu/cpp/jsi/RuntimeAwareCache.h index 75567f503..5d7a0a2c0 100644 --- a/packages/webgpu/cpp/jsi/RuntimeAwareCache.h +++ b/packages/webgpu/cpp/jsi/RuntimeAwareCache.h @@ -56,6 +56,8 @@ class RuntimeAwareCache : public BaseRuntimeAwareCache, public RuntimeLifecycleListener { public: + RuntimeAwareCache() : _primaryCache(new T()) {} + void onRuntimeDestroyed(jsi::Runtime *rt) override { if (getMainJsRuntime() != rt) { // We are removing a secondary runtime @@ -68,6 +70,10 @@ class RuntimeAwareCache : public BaseRuntimeAwareCache, RuntimeLifecycleMonitor::removeListener( *static_cast(cache.first), this); } + // Note: we intentionally don't delete _primaryCache here. + // If the runtime is still alive, we could delete it, but tracking + // that adds complexity. The cache is typically static and lives + // for the app's lifetime anyway. } T &get(jsi::Runtime &rt) { @@ -75,7 +81,16 @@ class RuntimeAwareCache : public BaseRuntimeAwareCache, // to avoid us having to lookup by runtime for caches that only has a single // runtime if (getMainJsRuntime() == &rt) { - return _primaryCache; + // Check if the main runtime has changed (e.g., during hot reload). + // If so, we need to invalidate the primary cache since it contains + // JSI objects from the old runtime that are now invalid. + // We intentionally leak the old cache - we cannot safely destroy + // JSI objects after their runtime is gone. + if (_primaryCacheRuntime != &rt) { + _primaryCache = new T(); + _primaryCacheRuntime = &rt; + } + return *_primaryCache; } else { if (_secondaryRuntimeCaches.count(&rt) == 0) { // We only add listener when the secondary runtime is used, this assumes @@ -96,7 +111,8 @@ class RuntimeAwareCache : public BaseRuntimeAwareCache, private: std::unordered_map _secondaryRuntimeCaches; - T _primaryCache; + T *_primaryCache; + jsi::Runtime *_primaryCacheRuntime = nullptr; }; } // namespace rnwgpu From 19ed15cd175ad4dcd8b5c96dd062db30e1cef492 Mon Sep 17 00:00:00 2001 From: William Candillon Date: Sat, 17 Jan 2026 11:08:36 +0100 Subject: [PATCH 19/23] :wrench: --- packages/webgpu/cpp/jsi/NativeObject.h | 46 +++++++++++++++++---- packages/webgpu/cpp/jsi/RuntimeAwareCache.h | 26 ++---------- 2 files changed, 43 insertions(+), 29 deletions(-) diff --git a/packages/webgpu/cpp/jsi/NativeObject.h b/packages/webgpu/cpp/jsi/NativeObject.h index cbeb91533..a90927721 100644 --- a/packages/webgpu/cpp/jsi/NativeObject.h +++ b/packages/webgpu/cpp/jsi/NativeObject.h @@ -76,6 +76,36 @@ struct PrototypeCacheEntry { std::optional prototype; }; +/** + * Wrapper for static RuntimeAwareCache that handles hot reload. + * + * When used with static storage (like prototype caches), the cache persists + * across hot reloads. But the JSI objects inside become invalid when the + * runtime is destroyed. This wrapper tracks which runtime the cache was + * created for and allocates a new cache when the runtime changes. + * + * The old cache is intentionally leaked - we cannot safely destroy JSI + * objects after their runtime is gone. + */ +template struct StaticRuntimeAwareCache { + RuntimeAwareCache *cache = nullptr; + jsi::Runtime *cacheRuntime = nullptr; + + RuntimeAwareCache &get(jsi::Runtime &rt) { + auto mainRuntime = BaseRuntimeAwareCache::getMainJsRuntime(); + if (&rt == mainRuntime && cacheRuntime != mainRuntime) { + // Main runtime changed (hot reload) - allocate new cache, leak old one + cache = new RuntimeAwareCache(); + cacheRuntime = mainRuntime; + } + if (cache == nullptr) { + cache = new RuntimeAwareCache(); + cacheRuntime = mainRuntime; + } + return *cache; + } +}; + /** * BoxedWebGPUObject is a HostObject wrapper that holds a reference to ANY * WebGPU NativeObject. This is used for Reanimated/Worklets serialization. @@ -203,11 +233,13 @@ class NativeObject : public jsi::NativeState, /** * Get the prototype cache for this type. * Each NativeObject type has its own static cache. - * Uses RuntimeAwareCache to properly handle runtime lifecycle. + * Uses StaticRuntimeAwareCache to properly handle runtime lifecycle + * and hot reload (where the main runtime is destroyed and recreated). */ - static RuntimeAwareCache &getPrototypeCache() { - static RuntimeAwareCache cache; - return cache; + static RuntimeAwareCache & + getPrototypeCache(jsi::Runtime &runtime) { + static StaticRuntimeAwareCache cache; + return cache.get(runtime); } /** @@ -215,7 +247,7 @@ class NativeObject : public jsi::NativeState, * Called automatically by create(), but can be called manually. */ static void installPrototype(jsi::Runtime &runtime) { - auto &entry = getPrototypeCache().get(runtime); + auto &entry = getPrototypeCache(runtime).get(runtime); if (entry.prototype.has_value()) { return; // Already installed } @@ -271,7 +303,7 @@ class NativeObject : public jsi::NativeState, installPrototype(runtime); - auto &entry = getPrototypeCache().get(runtime); + auto &entry = getPrototypeCache(runtime).get(runtime); if (!entry.prototype.has_value()) { return; } @@ -314,7 +346,7 @@ class NativeObject : public jsi::NativeState, obj.setNativeState(runtime, instance); // Set prototype - auto &entry = getPrototypeCache().get(runtime); + auto &entry = getPrototypeCache(runtime).get(runtime); if (entry.prototype.has_value()) { // Use Object.setPrototypeOf to set the prototype auto objectCtor = diff --git a/packages/webgpu/cpp/jsi/RuntimeAwareCache.h b/packages/webgpu/cpp/jsi/RuntimeAwareCache.h index 5d7a0a2c0..ff5ec539e 100644 --- a/packages/webgpu/cpp/jsi/RuntimeAwareCache.h +++ b/packages/webgpu/cpp/jsi/RuntimeAwareCache.h @@ -16,8 +16,6 @@ namespace jsi = facebook::jsi; class BaseRuntimeAwareCache { public: static void setMainJsRuntime(jsi::Runtime *rt) { _mainRuntime = rt; } - -protected: static jsi::Runtime *getMainJsRuntime() { assert(_mainRuntime != nullptr && "Expected main Javascript runtime to be set in the " @@ -56,8 +54,6 @@ class RuntimeAwareCache : public BaseRuntimeAwareCache, public RuntimeLifecycleListener { public: - RuntimeAwareCache() : _primaryCache(new T()) {} - void onRuntimeDestroyed(jsi::Runtime *rt) override { if (getMainJsRuntime() != rt) { // We are removing a secondary runtime @@ -70,10 +66,6 @@ class RuntimeAwareCache : public BaseRuntimeAwareCache, RuntimeLifecycleMonitor::removeListener( *static_cast(cache.first), this); } - // Note: we intentionally don't delete _primaryCache here. - // If the runtime is still alive, we could delete it, but tracking - // that adds complexity. The cache is typically static and lives - // for the app's lifetime anyway. } T &get(jsi::Runtime &rt) { @@ -81,22 +73,13 @@ class RuntimeAwareCache : public BaseRuntimeAwareCache, // to avoid us having to lookup by runtime for caches that only has a single // runtime if (getMainJsRuntime() == &rt) { - // Check if the main runtime has changed (e.g., during hot reload). - // If so, we need to invalidate the primary cache since it contains - // JSI objects from the old runtime that are now invalid. - // We intentionally leak the old cache - we cannot safely destroy - // JSI objects after their runtime is gone. - if (_primaryCacheRuntime != &rt) { - _primaryCache = new T(); - _primaryCacheRuntime = &rt; - } - return *_primaryCache; + return _primaryCache; } else { if (_secondaryRuntimeCaches.count(&rt) == 0) { - // We only add listener when the secondary runtime is used, this assumes + // we only add listener when the secondary runtime is used, this assumes // that the secondary runtime is terminated first. This lets us avoid // additional complexity for the majority of cases when objects are not - // shared between runtimes. Otherwise we'd have to register all objects + // shared between runtimes. Otherwise we'd have to register all objecrts // with the RuntimeMonitor as opposed to only registering ones that are // used in secondary runtime. Note that we can't register listener here // with the primary runtime as it may run on a separate thread. @@ -111,8 +94,7 @@ class RuntimeAwareCache : public BaseRuntimeAwareCache, private: std::unordered_map _secondaryRuntimeCaches; - T *_primaryCache; - jsi::Runtime *_primaryCacheRuntime = nullptr; + T _primaryCache; }; } // namespace rnwgpu From aa4f5a56f9a8146142712a44470daaad81faf493 Mon Sep 17 00:00:00 2001 From: William Candillon Date: Sat, 17 Jan 2026 11:18:23 +0100 Subject: [PATCH 20/23] :wrench: --- apps/example/src/Reanimated/Reanimated.tsx | 26 +------------ packages/webgpu/package.json | 14 ++++++- packages/webgpu/src/external/ModuleProxy.ts | 30 ++++++++++++++ packages/webgpu/src/external/index.ts | 1 + .../external/reanimated/ReanimatedProxy.ts | 19 +++++++++ .../src/external/reanimated/WorkletsProxy.ts | 19 +++++++++ .../webgpu/src/external/reanimated/index.ts | 3 ++ .../reanimated/registerWebGPUSerializable.ts | 39 +++++++++++++++++++ packages/webgpu/src/index.tsx | 1 + 9 files changed, 127 insertions(+), 25 deletions(-) create mode 100644 packages/webgpu/src/external/ModuleProxy.ts create mode 100644 packages/webgpu/src/external/index.ts create mode 100644 packages/webgpu/src/external/reanimated/ReanimatedProxy.ts create mode 100644 packages/webgpu/src/external/reanimated/WorkletsProxy.ts create mode 100644 packages/webgpu/src/external/reanimated/index.ts create mode 100644 packages/webgpu/src/external/reanimated/registerWebGPUSerializable.ts diff --git a/apps/example/src/Reanimated/Reanimated.tsx b/apps/example/src/Reanimated/Reanimated.tsx index 01c61ff0c..b77cfdd15 100644 --- a/apps/example/src/Reanimated/Reanimated.tsx +++ b/apps/example/src/Reanimated/Reanimated.tsx @@ -1,37 +1,15 @@ import React, { useEffect, useRef } from "react"; import { StyleSheet, View } from "react-native"; import type { CanvasRef, RNCanvasContext } from "react-native-wgpu"; -import { Canvas } from "react-native-wgpu"; +import { Canvas, registerWebGPUSerializable } from "react-native-wgpu"; import type { SharedValue } from "react-native-reanimated"; import { runOnUI, useSharedValue } from "react-native-reanimated"; -import { registerCustomSerializable } from "react-native-worklets"; import { redFragWGSL, triangleVertWGSL } from "../Triangle/triangle"; -// Declare global WebGPU worklet helper functions (installed on main runtime) -declare function __webgpuIsWebGPUObject(obj: unknown): boolean; -declare function __webgpuBox( - obj: object, -): { unbox: () => object; __boxedWebGPU: true }; - // Register WebGPU objects for Worklets serialization at module load time // This allows GPUDevice, GPUCanvasContext, etc. to be passed to worklets -// The unbox() method automatically installs the prototype on the UI runtime if needed -registerCustomSerializable({ - name: "WebGPU", - determine: (value: object): value is object => { - "worklet"; - return __webgpuIsWebGPUObject(value); - }, - pack: (value: object) => { - "worklet"; - return __webgpuBox(value); - }, - unpack: (boxed: { unbox: () => object }) => { - "worklet"; - return boxed.unbox(); - }, -}); +registerWebGPUSerializable(); const webGPUDemo = ( runAnimation: SharedValue, diff --git a/packages/webgpu/package.json b/packages/webgpu/package.json index 0778d1695..5711d9ec6 100644 --- a/packages/webgpu/package.json +++ b/packages/webgpu/package.json @@ -57,6 +57,8 @@ }, "devDependencies": { "@types/jest": "^29.5.12", + "react-native-reanimated": "^3.16.0", + "react-native-worklets": "^1.0.0", "@types/lodash": "^4.17.5", "@types/node": "^20.14.7", "@types/pixelmatch": "5.2.4", @@ -95,7 +97,17 @@ }, "peerDependencies": { "react": "*", - "react-native": "*" + "react-native": "*", + "react-native-reanimated": ">=3.16.0", + "react-native-worklets": ">=1.0.0" + }, + "peerDependenciesMeta": { + "react-native-reanimated": { + "optional": true + }, + "react-native-worklets": { + "optional": true + } }, "react-native-builder-bob": { "source": "src", diff --git a/packages/webgpu/src/external/ModuleProxy.ts b/packages/webgpu/src/external/ModuleProxy.ts new file mode 100644 index 000000000..ddb417506 --- /dev/null +++ b/packages/webgpu/src/external/ModuleProxy.ts @@ -0,0 +1,30 @@ +// https://github.com/mrousavy/react-native-vision-camera/blob/main/package/src/dependencies/ModuleProxy.ts +type ImportType = ReturnType; + +/** + * Create a lazily-imported module proxy. + * This is useful for lazily requiring optional dependencies. + */ +export const createModuleProxy = ( + getModule: () => ImportType +): TModule => { + const holder: { module: TModule | undefined } = { module: undefined }; + + const proxy = new Proxy(holder, { + get: (target, property) => { + if (target.module == null) { + // lazy initialize module via require() + // caller needs to make sure the require() call is wrapped in a try/catch + target.module = getModule() as TModule; + } + return target.module[property as keyof typeof holder.module]; + }, + }); + return proxy as unknown as TModule; +}; + +export class OptionalDependencyNotInstalledError extends Error { + constructor(name: string) { + super(`${name} is not installed!`); + } +} diff --git a/packages/webgpu/src/external/index.ts b/packages/webgpu/src/external/index.ts new file mode 100644 index 000000000..1cd6a354a --- /dev/null +++ b/packages/webgpu/src/external/index.ts @@ -0,0 +1 @@ +export * from "./reanimated"; diff --git a/packages/webgpu/src/external/reanimated/ReanimatedProxy.ts b/packages/webgpu/src/external/reanimated/ReanimatedProxy.ts new file mode 100644 index 000000000..2f4623fef --- /dev/null +++ b/packages/webgpu/src/external/reanimated/ReanimatedProxy.ts @@ -0,0 +1,19 @@ +import type * as ReanimatedT from "react-native-reanimated"; + +import { + OptionalDependencyNotInstalledError, + createModuleProxy, +} from "../ModuleProxy"; + +type TReanimated = typeof ReanimatedT; + +const Reanimated = createModuleProxy(() => { + try { + return require("react-native-reanimated"); + } catch (e) { + throw new OptionalDependencyNotInstalledError("react-native-reanimated"); + } +}); + +// eslint-disable-next-line import/no-default-export +export default Reanimated; diff --git a/packages/webgpu/src/external/reanimated/WorkletsProxy.ts b/packages/webgpu/src/external/reanimated/WorkletsProxy.ts new file mode 100644 index 000000000..6f19daf14 --- /dev/null +++ b/packages/webgpu/src/external/reanimated/WorkletsProxy.ts @@ -0,0 +1,19 @@ +import type * as WorkletsT from "react-native-worklets"; + +import { + OptionalDependencyNotInstalledError, + createModuleProxy, +} from "../ModuleProxy"; + +type TWorklets = typeof WorkletsT; + +const Worklets = createModuleProxy(() => { + try { + return require("react-native-worklets"); + } catch (e) { + throw new OptionalDependencyNotInstalledError("react-native-worklets"); + } +}); + +// eslint-disable-next-line import/no-default-export +export default Worklets; diff --git a/packages/webgpu/src/external/reanimated/index.ts b/packages/webgpu/src/external/reanimated/index.ts new file mode 100644 index 000000000..1e36d5e5c --- /dev/null +++ b/packages/webgpu/src/external/reanimated/index.ts @@ -0,0 +1,3 @@ +export { registerWebGPUSerializable } from "./registerWebGPUSerializable"; +export { default as Reanimated } from "./ReanimatedProxy"; +export { default as Worklets } from "./WorkletsProxy"; diff --git a/packages/webgpu/src/external/reanimated/registerWebGPUSerializable.ts b/packages/webgpu/src/external/reanimated/registerWebGPUSerializable.ts new file mode 100644 index 000000000..4f35528a8 --- /dev/null +++ b/packages/webgpu/src/external/reanimated/registerWebGPUSerializable.ts @@ -0,0 +1,39 @@ +import Worklets from "./WorkletsProxy"; + +// Declare global WebGPU worklet helper functions (installed on main runtime) +declare function __webgpuIsWebGPUObject(obj: unknown): boolean; +declare function __webgpuBox( + obj: object +): { unbox: () => object; __boxedWebGPU: true }; + +let isRegistered = false; + +/** + * Register WebGPU objects for Worklets serialization. + * This allows GPUDevice, GPUCanvasContext, etc. to be passed to worklets. + * The unbox() method automatically installs the prototype on the UI runtime if needed. + * + * Call this once before using WebGPU objects in worklets. + */ +export const registerWebGPUSerializable = () => { + if (isRegistered) { + return; + } + isRegistered = true; + + Worklets.registerCustomSerializable({ + name: "WebGPU", + determine: (value: object): value is object => { + "worklet"; + return __webgpuIsWebGPUObject(value); + }, + pack: (value: object) => { + "worklet"; + return __webgpuBox(value); + }, + unpack: (boxed: { unbox: () => object }) => { + "worklet"; + return boxed.unbox(); + }, + }); +}; diff --git a/packages/webgpu/src/index.tsx b/packages/webgpu/src/index.tsx index 46875c256..e3ebd637c 100644 --- a/packages/webgpu/src/index.tsx +++ b/packages/webgpu/src/index.tsx @@ -3,6 +3,7 @@ import type { NativeCanvas, RNCanvasContext } from "./types"; export * from "./main"; +export * from "./external"; declare global { interface Navigator { From 99641428e3dde8ddf92b965e16bd72a34d280488 Mon Sep 17 00:00:00 2001 From: William Candillon Date: Sat, 17 Jan 2026 11:55:45 +0100 Subject: [PATCH 21/23] :wrench: --- apps/example/ios/Podfile.lock | 20 ++--- apps/example/src/Reanimated/Reanimated.tsx | 13 ++- packages/webgpu/package.json | 6 +- .../src/external/reanimated/WorkletsProxy.ts | 19 ----- .../webgpu/src/external/reanimated/index.ts | 3 +- ...able.ts => registerWebGPUForReanimated.ts} | 19 +++-- yarn.lock | 84 +++++++++++++++++-- 7 files changed, 107 insertions(+), 57 deletions(-) delete mode 100644 packages/webgpu/src/external/reanimated/WorkletsProxy.ts rename packages/webgpu/src/external/reanimated/{registerWebGPUSerializable.ts => registerWebGPUForReanimated.ts} (59%) diff --git a/apps/example/ios/Podfile.lock b/apps/example/ios/Podfile.lock index da63aab41..27af2f27a 100644 --- a/apps/example/ios/Podfile.lock +++ b/apps/example/ios/Podfile.lock @@ -1748,7 +1748,7 @@ PODS: - React-RCTFBReactNativeSpec - ReactCommon/turbomodule/core - SocketRocket - - react-native-safe-area-context (5.6.1): + - react-native-safe-area-context (5.6.2): - boost - DoubleConversion - fast_float @@ -1766,8 +1766,8 @@ PODS: - React-graphics - React-ImageManager - React-jsi - - react-native-safe-area-context/common (= 5.6.1) - - react-native-safe-area-context/fabric (= 5.6.1) + - react-native-safe-area-context/common (= 5.6.2) + - react-native-safe-area-context/fabric (= 5.6.2) - React-NativeModulesApple - React-RCTFabric - React-renderercss @@ -1778,7 +1778,7 @@ PODS: - ReactCommon/turbomodule/core - SocketRocket - Yoga - - react-native-safe-area-context/common (5.6.1): + - react-native-safe-area-context/common (5.6.2): - boost - DoubleConversion - fast_float @@ -1806,7 +1806,7 @@ PODS: - ReactCommon/turbomodule/core - SocketRocket - Yoga - - react-native-safe-area-context/fabric (5.6.1): + - react-native-safe-area-context/fabric (5.6.2): - boost - DoubleConversion - fast_float @@ -2398,7 +2398,7 @@ PODS: - React-perflogger (= 0.81.4) - React-utils (= 0.81.4) - SocketRocket - - ReactNativeHost (0.5.13): + - ReactNativeHost (0.5.15): - boost - DoubleConversion - fast_float @@ -2432,7 +2432,7 @@ PODS: - React-Core - React-jsi - ReactTestApp-Resources (1.0.0-dev) - - RNGestureHandler (2.28.0): + - RNGestureHandler (2.30.0): - boost - DoubleConversion - fast_float @@ -2936,7 +2936,7 @@ SPEC CHECKSUMS: React-logger: a3cb5b29c32b8e447b5a96919340e89334062b48 React-Mapbuffer: 9d2434a42701d6144ca18f0ca1c4507808ca7696 React-microtasksnativemodule: 75b6604b667d297292345302cc5bfb6b6aeccc1b - react-native-safe-area-context: c6e2edd1c1da07bdce287fa9d9e60c5f7b514616 + react-native-safe-area-context: c00143b4823773bba23f2f19f85663ae89ceb460 react-native-skia: 5bf2b2107cd7f2d806fd364f5e16b1c7554ed3cd react-native-wgpu: e54fcee5946cc2cee4814f63f425be358f097b14 React-NativeModulesApple: 879fbdc5dcff7136abceb7880fe8a2022a1bd7c3 @@ -2969,10 +2969,10 @@ SPEC CHECKSUMS: ReactAppDependencyProvider: 433ddfb4536948630aadd5bd925aff8a632d2fe3 ReactCodegen: 64dbbed4e9e0264d799578ea78492479a66fba4a ReactCommon: 394c6b92765cf6d211c2c3f7f6bc601dffb316a6 - ReactNativeHost: 40e374201201cc54f9ef41458f2e412fbdde0d62 + ReactNativeHost: f5e054387e917216a2a021a3f7fdc4f9f158e7e4 ReactTestApp-DevSupport: 9b7bbba5e8fed998e763809171d9906a1375f9d3 ReactTestApp-Resources: 1bd9ff10e4c24f2ad87101a32023721ae923bccf - RNGestureHandler: 3a73f098d74712952870e948b3d9cf7b6cae9961 + RNGestureHandler: e37bdb684df1ac17c7e1d8f71a3311b2793c186b RNReanimated: 464375ff2caa801358547c44eca894ff0bf68e74 RNWorklets: 8068c8af4b241eb2c19221310729e4c440bee023 SocketRocket: d4aabe649be1e368d1318fdf28a022d714d65748 diff --git a/apps/example/src/Reanimated/Reanimated.tsx b/apps/example/src/Reanimated/Reanimated.tsx index b77cfdd15..0fa887703 100644 --- a/apps/example/src/Reanimated/Reanimated.tsx +++ b/apps/example/src/Reanimated/Reanimated.tsx @@ -1,24 +1,22 @@ import React, { useEffect, useRef } from "react"; import { StyleSheet, View } from "react-native"; import type { CanvasRef, RNCanvasContext } from "react-native-wgpu"; -import { Canvas, registerWebGPUSerializable } from "react-native-wgpu"; +import { Canvas, registerWebGPUForReanimated } from "react-native-wgpu"; import type { SharedValue } from "react-native-reanimated"; import { runOnUI, useSharedValue } from "react-native-reanimated"; import { redFragWGSL, triangleVertWGSL } from "../Triangle/triangle"; -// Register WebGPU objects for Worklets serialization at module load time -// This allows GPUDevice, GPUCanvasContext, etc. to be passed to worklets -registerWebGPUSerializable(); +// Register WebGPU objects for Worklets serialization +registerWebGPUForReanimated(); const webGPUDemo = ( runAnimation: SharedValue, device: GPUDevice, context: RNCanvasContext, + presentationFormat: GPUTextureFormat, ) => { "worklet"; - const presentationFormat = navigator.gpu.getPreferredCanvasFormat(); - if (!context) { throw new Error("No context"); } @@ -112,8 +110,9 @@ export function Reanimated() { console.error("Failed to get GPU canvas context"); return; } + const presentationFormat = navigator.gpu.getPreferredCanvasFormat(); // TODO: stop the animation on unmount - runOnUI(webGPUDemo)(runAnimation, device, ctx); + runOnUI(webGPUDemo)(runAnimation, device, ctx, presentationFormat); }; initWebGPU(); return () => { diff --git a/packages/webgpu/package.json b/packages/webgpu/package.json index 5711d9ec6..fdc05c2e2 100644 --- a/packages/webgpu/package.json +++ b/packages/webgpu/package.json @@ -57,8 +57,6 @@ }, "devDependencies": { "@types/jest": "^29.5.12", - "react-native-reanimated": "^3.16.0", - "react-native-worklets": "^1.0.0", "@types/lodash": "^4.17.5", "@types/node": "^20.14.7", "@types/pixelmatch": "5.2.4", @@ -84,7 +82,9 @@ "react": "19.1.0", "react-native": "0.81.4", "react-native-builder-bob": "^0.23.2", + "react-native-reanimated": "^3.16.0", "react-native-web": "^0.21.2", + "react-native-worklets": "^0.7.0", "rimraf": "^5.0.7", "seedrandom": "^3.0.5", "teapot": "^1.0.0", @@ -99,7 +99,7 @@ "react": "*", "react-native": "*", "react-native-reanimated": ">=3.16.0", - "react-native-worklets": ">=1.0.0" + "react-native-worklets": ">=0.7.0" }, "peerDependenciesMeta": { "react-native-reanimated": { diff --git a/packages/webgpu/src/external/reanimated/WorkletsProxy.ts b/packages/webgpu/src/external/reanimated/WorkletsProxy.ts deleted file mode 100644 index 6f19daf14..000000000 --- a/packages/webgpu/src/external/reanimated/WorkletsProxy.ts +++ /dev/null @@ -1,19 +0,0 @@ -import type * as WorkletsT from "react-native-worklets"; - -import { - OptionalDependencyNotInstalledError, - createModuleProxy, -} from "../ModuleProxy"; - -type TWorklets = typeof WorkletsT; - -const Worklets = createModuleProxy(() => { - try { - return require("react-native-worklets"); - } catch (e) { - throw new OptionalDependencyNotInstalledError("react-native-worklets"); - } -}); - -// eslint-disable-next-line import/no-default-export -export default Worklets; diff --git a/packages/webgpu/src/external/reanimated/index.ts b/packages/webgpu/src/external/reanimated/index.ts index 1e36d5e5c..60f283e91 100644 --- a/packages/webgpu/src/external/reanimated/index.ts +++ b/packages/webgpu/src/external/reanimated/index.ts @@ -1,3 +1,2 @@ -export { registerWebGPUSerializable } from "./registerWebGPUSerializable"; +export { registerWebGPUForReanimated } from "./registerWebGPUForReanimated"; export { default as Reanimated } from "./ReanimatedProxy"; -export { default as Worklets } from "./WorkletsProxy"; diff --git a/packages/webgpu/src/external/reanimated/registerWebGPUSerializable.ts b/packages/webgpu/src/external/reanimated/registerWebGPUForReanimated.ts similarity index 59% rename from packages/webgpu/src/external/reanimated/registerWebGPUSerializable.ts rename to packages/webgpu/src/external/reanimated/registerWebGPUForReanimated.ts index 4f35528a8..ea3b1c368 100644 --- a/packages/webgpu/src/external/reanimated/registerWebGPUSerializable.ts +++ b/packages/webgpu/src/external/reanimated/registerWebGPUForReanimated.ts @@ -1,6 +1,4 @@ -import Worklets from "./WorkletsProxy"; - -// Declare global WebGPU worklet helper functions (installed on main runtime) +// Declare global WebGPU worklet helper functions (installed by native module) declare function __webgpuIsWebGPUObject(obj: unknown): boolean; declare function __webgpuBox( obj: object @@ -11,17 +9,24 @@ let isRegistered = false; /** * Register WebGPU objects for Worklets serialization. * This allows GPUDevice, GPUCanvasContext, etc. to be passed to worklets. - * The unbox() method automatically installs the prototype on the UI runtime if needed. * - * Call this once before using WebGPU objects in worklets. + * Call this once in your App.tsx before using WebGPU objects in worklets: + * + * ```tsx + * import { registerWebGPUForReanimated } from "react-native-wgpu"; + * registerWebGPUForReanimated(); + * ``` */ -export const registerWebGPUSerializable = () => { +export const registerWebGPUForReanimated = () => { if (isRegistered) { return; } isRegistered = true; - Worklets.registerCustomSerializable({ + // eslint-disable-next-line @typescript-eslint/no-var-requires + const { registerCustomSerializable } = require("react-native-worklets"); + + registerCustomSerializable({ name: "WebGPU", determine: (value: object): value is object => { "worklet"; diff --git a/yarn.lock b/yarn.lock index 9f86c17e3..e5a72a7cd 100644 --- a/yarn.lock +++ b/yarn.lock @@ -718,7 +718,7 @@ __metadata: languageName: node linkType: hard -"@babel/plugin-transform-arrow-functions@npm:7.27.1, @babel/plugin-transform-arrow-functions@npm:^7.0.0, @babel/plugin-transform-arrow-functions@npm:^7.24.7, @babel/plugin-transform-arrow-functions@npm:^7.27.1": +"@babel/plugin-transform-arrow-functions@npm:7.27.1, @babel/plugin-transform-arrow-functions@npm:^7.0.0, @babel/plugin-transform-arrow-functions@npm:^7.0.0-0, @babel/plugin-transform-arrow-functions@npm:^7.24.7, @babel/plugin-transform-arrow-functions@npm:^7.27.1": version: 7.27.1 resolution: "@babel/plugin-transform-arrow-functions@npm:7.27.1" dependencies: @@ -789,7 +789,7 @@ __metadata: languageName: node linkType: hard -"@babel/plugin-transform-class-properties@npm:^7.25.4, @babel/plugin-transform-class-properties@npm:^7.28.6": +"@babel/plugin-transform-class-properties@npm:^7.0.0-0, @babel/plugin-transform-class-properties@npm:^7.25.4, @babel/plugin-transform-class-properties@npm:^7.28.6": version: 7.28.6 resolution: "@babel/plugin-transform-class-properties@npm:7.28.6" dependencies: @@ -829,7 +829,7 @@ __metadata: languageName: node linkType: hard -"@babel/plugin-transform-classes@npm:^7.0.0, @babel/plugin-transform-classes@npm:^7.25.4, @babel/plugin-transform-classes@npm:^7.28.6": +"@babel/plugin-transform-classes@npm:^7.0.0, @babel/plugin-transform-classes@npm:^7.0.0-0, @babel/plugin-transform-classes@npm:^7.25.4, @babel/plugin-transform-classes@npm:^7.28.6": version: 7.28.6 resolution: "@babel/plugin-transform-classes@npm:7.28.6" dependencies: @@ -1114,7 +1114,7 @@ __metadata: languageName: node linkType: hard -"@babel/plugin-transform-nullish-coalescing-operator@npm:^7.24.7, @babel/plugin-transform-nullish-coalescing-operator@npm:^7.28.6": +"@babel/plugin-transform-nullish-coalescing-operator@npm:^7.0.0-0, @babel/plugin-transform-nullish-coalescing-operator@npm:^7.24.7, @babel/plugin-transform-nullish-coalescing-operator@npm:^7.28.6": version: 7.28.6 resolution: "@babel/plugin-transform-nullish-coalescing-operator@npm:7.28.6" dependencies: @@ -1186,7 +1186,7 @@ __metadata: languageName: node linkType: hard -"@babel/plugin-transform-optional-chaining@npm:^7.24.8, @babel/plugin-transform-optional-chaining@npm:^7.27.1, @babel/plugin-transform-optional-chaining@npm:^7.28.6": +"@babel/plugin-transform-optional-chaining@npm:^7.0.0-0, @babel/plugin-transform-optional-chaining@npm:^7.24.8, @babel/plugin-transform-optional-chaining@npm:^7.27.1, @babel/plugin-transform-optional-chaining@npm:^7.28.6": version: 7.28.6 resolution: "@babel/plugin-transform-optional-chaining@npm:7.28.6" dependencies: @@ -1366,7 +1366,7 @@ __metadata: languageName: node linkType: hard -"@babel/plugin-transform-shorthand-properties@npm:7.27.1, @babel/plugin-transform-shorthand-properties@npm:^7.0.0, @babel/plugin-transform-shorthand-properties@npm:^7.24.7, @babel/plugin-transform-shorthand-properties@npm:^7.27.1": +"@babel/plugin-transform-shorthand-properties@npm:7.27.1, @babel/plugin-transform-shorthand-properties@npm:^7.0.0, @babel/plugin-transform-shorthand-properties@npm:^7.0.0-0, @babel/plugin-transform-shorthand-properties@npm:^7.24.7, @babel/plugin-transform-shorthand-properties@npm:^7.27.1": version: 7.27.1 resolution: "@babel/plugin-transform-shorthand-properties@npm:7.27.1" dependencies: @@ -1400,7 +1400,7 @@ __metadata: languageName: node linkType: hard -"@babel/plugin-transform-template-literals@npm:7.27.1, @babel/plugin-transform-template-literals@npm:^7.27.1": +"@babel/plugin-transform-template-literals@npm:7.27.1, @babel/plugin-transform-template-literals@npm:^7.0.0-0, @babel/plugin-transform-template-literals@npm:^7.27.1": version: 7.27.1 resolution: "@babel/plugin-transform-template-literals@npm:7.27.1" dependencies: @@ -1460,7 +1460,7 @@ __metadata: languageName: node linkType: hard -"@babel/plugin-transform-unicode-regex@npm:7.27.1, @babel/plugin-transform-unicode-regex@npm:^7.0.0, @babel/plugin-transform-unicode-regex@npm:^7.24.7, @babel/plugin-transform-unicode-regex@npm:^7.27.1": +"@babel/plugin-transform-unicode-regex@npm:7.27.1, @babel/plugin-transform-unicode-regex@npm:^7.0.0, @babel/plugin-transform-unicode-regex@npm:^7.0.0-0, @babel/plugin-transform-unicode-regex@npm:^7.24.7, @babel/plugin-transform-unicode-regex@npm:^7.27.1": version: 7.27.1 resolution: "@babel/plugin-transform-unicode-regex@npm:7.27.1" dependencies: @@ -1621,7 +1621,7 @@ __metadata: languageName: node linkType: hard -"@babel/preset-typescript@npm:^7.13.0, @babel/preset-typescript@npm:^7.17.12": +"@babel/preset-typescript@npm:^7.13.0, @babel/preset-typescript@npm:^7.16.7, @babel/preset-typescript@npm:^7.17.12": version: 7.28.5 resolution: "@babel/preset-typescript@npm:7.28.5" dependencies: @@ -12691,6 +12691,16 @@ __metadata: languageName: node linkType: hard +"react-native-is-edge-to-edge@npm:1.1.7": + version: 1.1.7 + resolution: "react-native-is-edge-to-edge@npm:1.1.7" + peerDependencies: + react: "*" + react-native: "*" + checksum: 4cdf2b2fb5b131f2015c26d2cb7688b4a0c5f3c8474b1bf0ddfa9eabb0263df440c87262ae8f812a6ecab0d5310df0373bddad4b51f53dabb2ffee01e9ef0f44 + languageName: node + linkType: hard + "react-native-is-edge-to-edge@npm:1.2.1": version: 1.2.1 resolution: "react-native-is-edge-to-edge@npm:1.2.1" @@ -12770,6 +12780,30 @@ __metadata: languageName: node linkType: hard +"react-native-reanimated@npm:^3.16.0": + version: 3.19.5 + resolution: "react-native-reanimated@npm:3.19.5" + dependencies: + "@babel/plugin-transform-arrow-functions": ^7.0.0-0 + "@babel/plugin-transform-class-properties": ^7.0.0-0 + "@babel/plugin-transform-classes": ^7.0.0-0 + "@babel/plugin-transform-nullish-coalescing-operator": ^7.0.0-0 + "@babel/plugin-transform-optional-chaining": ^7.0.0-0 + "@babel/plugin-transform-shorthand-properties": ^7.0.0-0 + "@babel/plugin-transform-template-literals": ^7.0.0-0 + "@babel/plugin-transform-unicode-regex": ^7.0.0-0 + "@babel/preset-typescript": ^7.16.7 + convert-source-map: ^2.0.0 + invariant: ^2.2.4 + react-native-is-edge-to-edge: 1.1.7 + peerDependencies: + "@babel/core": ^7.0.0-0 + react: "*" + react-native: "*" + checksum: d3e5e38c23bd0f86e19110c1e16353a3b58166cb3a13ec1b600b5bbe287d8c57ab199023231b7960fd11b5c605f2a78428d7b80f28818e74eaecde1360dec4f6 + languageName: node + linkType: hard + "react-native-safe-area-context@npm:^5.4.0": version: 5.6.2 resolution: "react-native-safe-area-context@npm:5.6.2" @@ -12875,7 +12909,9 @@ __metadata: react: 19.1.0 react-native: 0.81.4 react-native-builder-bob: ^0.23.2 + react-native-reanimated: ^3.16.0 react-native-web: ^0.21.2 + react-native-worklets: ^0.7.0 rimraf: ^5.0.7 seedrandom: ^3.0.5 teapot: ^1.0.0 @@ -12888,6 +12924,13 @@ __metadata: peerDependencies: react: "*" react-native: "*" + react-native-reanimated: ">=3.16.0" + react-native-worklets: ">=0.7.0" + peerDependenciesMeta: + react-native-reanimated: + optional: true + react-native-worklets: + optional: true languageName: unknown linkType: soft @@ -12914,6 +12957,29 @@ __metadata: languageName: node linkType: hard +"react-native-worklets@npm:^0.7.0": + version: 0.7.2 + resolution: "react-native-worklets@npm:0.7.2" + dependencies: + "@babel/plugin-transform-arrow-functions": 7.27.1 + "@babel/plugin-transform-class-properties": 7.27.1 + "@babel/plugin-transform-classes": 7.28.4 + "@babel/plugin-transform-nullish-coalescing-operator": 7.27.1 + "@babel/plugin-transform-optional-chaining": 7.27.1 + "@babel/plugin-transform-shorthand-properties": 7.27.1 + "@babel/plugin-transform-template-literals": 7.27.1 + "@babel/plugin-transform-unicode-regex": 7.27.1 + "@babel/preset-typescript": 7.27.1 + convert-source-map: 2.0.0 + semver: 7.7.3 + peerDependencies: + "@babel/core": "*" + react: "*" + react-native: "*" + checksum: a1d220499c40e44286b4b5f97e6e0483ec6f84cda7f87db56e4c5c49b0991d749b9087d03915a7dfb8d5aa892308d9ba8661403e48a5fad8396e91b7b35228a2 + languageName: node + linkType: hard + "react-native@npm:*": version: 0.83.1 resolution: "react-native@npm:0.83.1" From 46823baf9a72b151c911b0dfdf2a74420399f231 Mon Sep 17 00:00:00 2001 From: William Candillon Date: Sat, 17 Jan 2026 12:08:57 +0100 Subject: [PATCH 22/23] :wrench: --- README.md | 34 ++++++++++++++++++++++++++++++++++ packages/webgpu/README.md | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 68 insertions(+) diff --git a/README.md b/README.md index 5193ac765..19690b3c6 100644 --- a/README.md +++ b/README.md @@ -222,6 +222,40 @@ device.queue.copyExternalImageToTexture( ); ``` +### Reanimated Integration + +React Native WebGPU supports running WebGPU rendering on the UI thread using [React Native Reanimated](https://docs.swmansion.com/react-native-reanimated/) and [React Native Worklets](https://github.com/margelo/react-native-worklets). + +First, install the optional peer dependencies: + +```sh +npm install react-native-reanimated react-native-worklets +``` + +Then, register WebGPU for Reanimated serialization by calling `registerWebGPUForReanimated()` at the top of your file, before defining any worklets: + +```tsx +import { Canvas, registerWebGPUForReanimated } from "react-native-wgpu"; +import { runOnUI } from "react-native-reanimated"; + +// Call this before defining worklets that use WebGPU objects +registerWebGPUForReanimated(); + +const renderFrame = (device: GPUDevice, context: GPUCanvasContext) => { + "worklet"; + // WebGPU rendering code runs on the UI thread + const commandEncoder = device.createCommandEncoder(); + // ... render ... + device.queue.submit([commandEncoder.finish()]); + context.present(); +}; + +// Initialize WebGPU on main thread, then run on UI thread +const device = await adapter.requestDevice(); +const context = canvasRef.current.getContext("webgpu"); +runOnUI(renderFrame)(device, context); +``` + ## Troubleshooting ### iOS diff --git a/packages/webgpu/README.md b/packages/webgpu/README.md index 5193ac765..19690b3c6 100644 --- a/packages/webgpu/README.md +++ b/packages/webgpu/README.md @@ -222,6 +222,40 @@ device.queue.copyExternalImageToTexture( ); ``` +### Reanimated Integration + +React Native WebGPU supports running WebGPU rendering on the UI thread using [React Native Reanimated](https://docs.swmansion.com/react-native-reanimated/) and [React Native Worklets](https://github.com/margelo/react-native-worklets). + +First, install the optional peer dependencies: + +```sh +npm install react-native-reanimated react-native-worklets +``` + +Then, register WebGPU for Reanimated serialization by calling `registerWebGPUForReanimated()` at the top of your file, before defining any worklets: + +```tsx +import { Canvas, registerWebGPUForReanimated } from "react-native-wgpu"; +import { runOnUI } from "react-native-reanimated"; + +// Call this before defining worklets that use WebGPU objects +registerWebGPUForReanimated(); + +const renderFrame = (device: GPUDevice, context: GPUCanvasContext) => { + "worklet"; + // WebGPU rendering code runs on the UI thread + const commandEncoder = device.createCommandEncoder(); + // ... render ... + device.queue.submit([commandEncoder.finish()]); + context.present(); +}; + +// Initialize WebGPU on main thread, then run on UI thread +const device = await adapter.requestDevice(); +const context = canvasRef.current.getContext("webgpu"); +runOnUI(renderFrame)(device, context); +``` + ## Troubleshooting ### iOS From a34585e425b127a5db70b6e0913642f59f8d680d Mon Sep 17 00:00:00 2001 From: William Candillon Date: Sat, 17 Jan 2026 12:35:06 +0100 Subject: [PATCH 23/23] :wrench: (#302) --- README.md | 7 +-- apps/example/ios/Podfile.lock | 14 +++--- apps/example/package.json | 2 +- apps/example/src/Reanimated/Reanimated.tsx | 5 +-- packages/webgpu/README.md | 7 +-- packages/webgpu/babel.config.js | 1 + .../reanimated/registerWebGPUForReanimated.ts | 45 +++++++++---------- packages/webgpu/src/index.tsx | 1 - packages/webgpu/src/main/index.tsx | 3 ++ yarn.lock | 27 +---------- 10 files changed, 41 insertions(+), 71 deletions(-) diff --git a/README.md b/README.md index 19690b3c6..0ae1359b4 100644 --- a/README.md +++ b/README.md @@ -232,15 +232,12 @@ First, install the optional peer dependencies: npm install react-native-reanimated react-native-worklets ``` -Then, register WebGPU for Reanimated serialization by calling `registerWebGPUForReanimated()` at the top of your file, before defining any worklets: +WebGPU objects are automatically registered for Worklets serialization when the module loads. You can pass WebGPU objects like `GPUDevice` and `GPUCanvasContext` directly to worklets: ```tsx -import { Canvas, registerWebGPUForReanimated } from "react-native-wgpu"; +import { Canvas } from "react-native-wgpu"; import { runOnUI } from "react-native-reanimated"; -// Call this before defining worklets that use WebGPU objects -registerWebGPUForReanimated(); - const renderFrame = (device: GPUDevice, context: GPUCanvasContext) => { "worklet"; // WebGPU rendering code runs on the UI thread diff --git a/apps/example/ios/Podfile.lock b/apps/example/ios/Podfile.lock index 27af2f27a..7a048fa41 100644 --- a/apps/example/ios/Podfile.lock +++ b/apps/example/ios/Podfile.lock @@ -2552,7 +2552,7 @@ PODS: - RNWorklets - SocketRocket - Yoga - - RNWorklets (0.7.1): + - RNWorklets (0.7.2): - boost - DoubleConversion - fast_float @@ -2579,10 +2579,10 @@ PODS: - ReactCodegen - ReactCommon/turbomodule/bridging - ReactCommon/turbomodule/core - - RNWorklets/worklets (= 0.7.1) + - RNWorklets/worklets (= 0.7.2) - SocketRocket - Yoga - - RNWorklets/worklets (0.7.1): + - RNWorklets/worklets (0.7.2): - boost - DoubleConversion - fast_float @@ -2609,10 +2609,10 @@ PODS: - ReactCodegen - ReactCommon/turbomodule/bridging - ReactCommon/turbomodule/core - - RNWorklets/worklets/apple (= 0.7.1) + - RNWorklets/worklets/apple (= 0.7.2) - SocketRocket - Yoga - - RNWorklets/worklets/apple (0.7.1): + - RNWorklets/worklets/apple (0.7.2): - boost - DoubleConversion - fast_float @@ -2967,14 +2967,14 @@ SPEC CHECKSUMS: React-timing: 1e6a8acb66e2b7ac9d418956617fd1fdb19322fd React-utils: 52bbb03f130319ef82e4c3bc7a85eaacdb1fec87 ReactAppDependencyProvider: 433ddfb4536948630aadd5bd925aff8a632d2fe3 - ReactCodegen: 64dbbed4e9e0264d799578ea78492479a66fba4a + ReactCodegen: 7042ec4a7316b59e8f247b8fa312891179d24f5a ReactCommon: 394c6b92765cf6d211c2c3f7f6bc601dffb316a6 ReactNativeHost: f5e054387e917216a2a021a3f7fdc4f9f158e7e4 ReactTestApp-DevSupport: 9b7bbba5e8fed998e763809171d9906a1375f9d3 ReactTestApp-Resources: 1bd9ff10e4c24f2ad87101a32023721ae923bccf RNGestureHandler: e37bdb684df1ac17c7e1d8f71a3311b2793c186b RNReanimated: 464375ff2caa801358547c44eca894ff0bf68e74 - RNWorklets: 8068c8af4b241eb2c19221310729e4c440bee023 + RNWorklets: ee58e869ea579800ec5f2f1cb6ae195fd3537546 SocketRocket: d4aabe649be1e368d1318fdf28a022d714d65748 Yoga: a3ed390a19db0459bd6839823a6ac6d9c6db198d diff --git a/apps/example/package.json b/apps/example/package.json index 9d11cc163..c7aebf8f1 100644 --- a/apps/example/package.json +++ b/apps/example/package.json @@ -37,7 +37,7 @@ "react-native-safe-area-context": "^5.4.0", "react-native-web": "^0.21.2", "react-native-wgpu": "*", - "react-native-worklets": "0.7.1", + "react-native-worklets": "0.7.2", "teapot": "^1.0.0", "three": "0.172.0", "typegpu": "^0.3.2", diff --git a/apps/example/src/Reanimated/Reanimated.tsx b/apps/example/src/Reanimated/Reanimated.tsx index 0fa887703..fa1fa36b6 100644 --- a/apps/example/src/Reanimated/Reanimated.tsx +++ b/apps/example/src/Reanimated/Reanimated.tsx @@ -1,15 +1,12 @@ import React, { useEffect, useRef } from "react"; import { StyleSheet, View } from "react-native"; import type { CanvasRef, RNCanvasContext } from "react-native-wgpu"; -import { Canvas, registerWebGPUForReanimated } from "react-native-wgpu"; +import { Canvas } from "react-native-wgpu"; import type { SharedValue } from "react-native-reanimated"; import { runOnUI, useSharedValue } from "react-native-reanimated"; import { redFragWGSL, triangleVertWGSL } from "../Triangle/triangle"; -// Register WebGPU objects for Worklets serialization -registerWebGPUForReanimated(); - const webGPUDemo = ( runAnimation: SharedValue, device: GPUDevice, diff --git a/packages/webgpu/README.md b/packages/webgpu/README.md index 19690b3c6..0ae1359b4 100644 --- a/packages/webgpu/README.md +++ b/packages/webgpu/README.md @@ -232,15 +232,12 @@ First, install the optional peer dependencies: npm install react-native-reanimated react-native-worklets ``` -Then, register WebGPU for Reanimated serialization by calling `registerWebGPUForReanimated()` at the top of your file, before defining any worklets: +WebGPU objects are automatically registered for Worklets serialization when the module loads. You can pass WebGPU objects like `GPUDevice` and `GPUCanvasContext` directly to worklets: ```tsx -import { Canvas, registerWebGPUForReanimated } from "react-native-wgpu"; +import { Canvas } from "react-native-wgpu"; import { runOnUI } from "react-native-reanimated"; -// Call this before defining worklets that use WebGPU objects -registerWebGPUForReanimated(); - const renderFrame = (device: GPUDevice, context: GPUCanvasContext) => { "worklet"; // WebGPU rendering code runs on the UI thread diff --git a/packages/webgpu/babel.config.js b/packages/webgpu/babel.config.js index af1668c3a..39cd3276e 100644 --- a/packages/webgpu/babel.config.js +++ b/packages/webgpu/babel.config.js @@ -1,3 +1,4 @@ module.exports = { presets: ['module:@react-native/babel-preset'], + plugins: ['react-native-worklets/plugin'], }; \ No newline at end of file diff --git a/packages/webgpu/src/external/reanimated/registerWebGPUForReanimated.ts b/packages/webgpu/src/external/reanimated/registerWebGPUForReanimated.ts index ea3b1c368..e331b731a 100644 --- a/packages/webgpu/src/external/reanimated/registerWebGPUForReanimated.ts +++ b/packages/webgpu/src/external/reanimated/registerWebGPUForReanimated.ts @@ -10,12 +10,7 @@ let isRegistered = false; * Register WebGPU objects for Worklets serialization. * This allows GPUDevice, GPUCanvasContext, etc. to be passed to worklets. * - * Call this once in your App.tsx before using WebGPU objects in worklets: - * - * ```tsx - * import { registerWebGPUForReanimated } from "react-native-wgpu"; - * registerWebGPUForReanimated(); - * ``` + * This is called automatically when the module loads if react-native-worklets is installed. */ export const registerWebGPUForReanimated = () => { if (isRegistered) { @@ -23,22 +18,26 @@ export const registerWebGPUForReanimated = () => { } isRegistered = true; - // eslint-disable-next-line @typescript-eslint/no-var-requires - const { registerCustomSerializable } = require("react-native-worklets"); + try { + // eslint-disable-next-line @typescript-eslint/no-var-requires + const { registerCustomSerializable } = require("react-native-worklets"); - registerCustomSerializable({ - name: "WebGPU", - determine: (value: object): value is object => { - "worklet"; - return __webgpuIsWebGPUObject(value); - }, - pack: (value: object) => { - "worklet"; - return __webgpuBox(value); - }, - unpack: (boxed: { unbox: () => object }) => { - "worklet"; - return boxed.unbox(); - }, - }); + registerCustomSerializable({ + name: "WebGPU", + determine: (value: object): value is object => { + "worklet"; + return __webgpuIsWebGPUObject(value); + }, + pack: (value: object) => { + "worklet"; + return __webgpuBox(value); + }, + unpack: (boxed: { unbox: () => object }) => { + "worklet"; + return boxed.unbox(); + }, + }); + } catch { + // react-native-worklets not installed, skip registration + } }; diff --git a/packages/webgpu/src/index.tsx b/packages/webgpu/src/index.tsx index e3ebd637c..46875c256 100644 --- a/packages/webgpu/src/index.tsx +++ b/packages/webgpu/src/index.tsx @@ -3,7 +3,6 @@ import type { NativeCanvas, RNCanvasContext } from "./types"; export * from "./main"; -export * from "./external"; declare global { interface Navigator { diff --git a/packages/webgpu/src/main/index.tsx b/packages/webgpu/src/main/index.tsx index bfd47577a..faa58e07d 100644 --- a/packages/webgpu/src/main/index.tsx +++ b/packages/webgpu/src/main/index.tsx @@ -1,3 +1,4 @@ +import { registerWebGPUForReanimated } from "../external"; import WebGPUModule from "../NativeWebGPUModule"; export * from "../Canvas"; @@ -9,6 +10,8 @@ export { default as WebGPUModule } from "../NativeWebGPUModule"; WebGPUModule.install(); +registerWebGPUForReanimated(); + if (!navigator) { // @ts-expect-error Navigation object is more complex than this, setting it to an empty object to add gpu property navigator = { diff --git a/yarn.lock b/yarn.lock index e5a72a7cd..3a95e5357 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4964,7 +4964,7 @@ __metadata: react-native-test-app: 4.4.10 react-native-web: ^0.21.2 react-native-wgpu: "*" - react-native-worklets: 0.7.1 + react-native-worklets: 0.7.2 react-test-renderer: 18.2.0 teapot: ^1.0.0 three: 0.172.0 @@ -12934,30 +12934,7 @@ __metadata: languageName: unknown linkType: soft -"react-native-worklets@npm:0.7.1": - version: 0.7.1 - resolution: "react-native-worklets@npm:0.7.1" - dependencies: - "@babel/plugin-transform-arrow-functions": 7.27.1 - "@babel/plugin-transform-class-properties": 7.27.1 - "@babel/plugin-transform-classes": 7.28.4 - "@babel/plugin-transform-nullish-coalescing-operator": 7.27.1 - "@babel/plugin-transform-optional-chaining": 7.27.1 - "@babel/plugin-transform-shorthand-properties": 7.27.1 - "@babel/plugin-transform-template-literals": 7.27.1 - "@babel/plugin-transform-unicode-regex": 7.27.1 - "@babel/preset-typescript": 7.27.1 - convert-source-map: 2.0.0 - semver: 7.7.3 - peerDependencies: - "@babel/core": "*" - react: "*" - react-native: "*" - checksum: d6ca920ce53cad6ad45ac8379914adfaf73a92d76dc7c68d9b8a8a2913f7042ec8d60bbb6fcf72afe593993d087cbe6277c3f81927d2c0ade9a94acaf58b5dc3 - languageName: node - linkType: hard - -"react-native-worklets@npm:^0.7.0": +"react-native-worklets@npm:0.7.2, react-native-worklets@npm:^0.7.0": version: 0.7.2 resolution: "react-native-worklets@npm:0.7.2" dependencies: