From 493419f77890fe44127e99421a79528d42e7d71f Mon Sep 17 00:00:00 2001 From: William Candillon Date: Sat, 14 Dec 2024 08:34:47 +0100 Subject: [PATCH] :green_heart: --- apps/example/ios/Podfile.lock | 4 +-- .../webgpu/cpp/rnwgpu/api/GPUAdapterInfo.h | 32 ++++++++----------- packages/webgpu/package.json | 2 +- packages/webgpu/src/__tests__/GPU.spec.ts | 1 + 4 files changed, 17 insertions(+), 22 deletions(-) diff --git a/apps/example/ios/Podfile.lock b/apps/example/ios/Podfile.lock index 773ce50bf..34836dfb3 100644 --- a/apps/example/ios/Podfile.lock +++ b/apps/example/ios/Podfile.lock @@ -937,7 +937,7 @@ PODS: - React-debug - react-native-safe-area-context (4.11.0): - React-Core - - react-native-wgpu (0.1.19): + - react-native-wgpu (0.1.21): - DoubleConversion - glog - hermes-engine @@ -1528,7 +1528,7 @@ SPEC CHECKSUMS: React-logger: 29fa3e048f5f67fe396bc08af7606426d9bd7b5d React-Mapbuffer: bf56147c9775491e53122a94c423ac201417e326 react-native-safe-area-context: 851c62c48dce80ccaa5637b6aa5991a1bc36eca9 - react-native-wgpu: 5fd8cb5fd7bd00c88831d29438697d897fb680e8 + react-native-wgpu: 5308faeb6d85925394351968f7970cd00eead0cc React-nativeconfig: 9f223cd321823afdecf59ed00861ab2d69ee0fc1 React-NativeModulesApple: ff7efaff7098639db5631236cfd91d60abff04c0 React-perflogger: 32ed45d9cee02cf6639acae34251590dccd30994 diff --git a/packages/webgpu/cpp/rnwgpu/api/GPUAdapterInfo.h b/packages/webgpu/cpp/rnwgpu/api/GPUAdapterInfo.h index 640b1b6a0..36cb514c9 100644 --- a/packages/webgpu/cpp/rnwgpu/api/GPUAdapterInfo.h +++ b/packages/webgpu/cpp/rnwgpu/api/GPUAdapterInfo.h @@ -18,35 +18,26 @@ namespace m = margelo; class GPUAdapterInfo : public m::HybridObject { public: - explicit GPUAdapterInfo(wgpu::AdapterInfo &instance) - : HybridObject("GPUAdapterInfo"), _instance(std::move(instance)) {} + explicit GPUAdapterInfo(wgpu::AdapterInfo &info) + : HybridObject("GPUAdapterInfo"), _vendor(info.vendor), + _architecture(info.architecture), + _device(info.device), + _description(info.description) {} public: std::string getBrand() { return _name; } std::string getVendor() { - if (_instance.vendor.length) { - return _instance.vendor.data; - } - return ""; + return _vendor; } std::string getArchitecture() { - if (_instance.architecture.length) { - return _instance.architecture.data; - } - return ""; + return _architecture; } std::string getDevice() { - if (_instance.device.length) { - return _instance.device.data; - } - return ""; + return _device; } std::string getDescription() { - if (_instance.device.length) { - return _instance.device.data; - } - return ""; + return _description; } void loadHybridMethods() override { @@ -60,7 +51,10 @@ class GPUAdapterInfo : public m::HybridObject { } private: - wgpu::AdapterInfo _instance; + std::string _vendor; + std::string _architecture; + std::string _device; + std::string _description; }; } // namespace rnwgpu diff --git a/packages/webgpu/package.json b/packages/webgpu/package.json index 3d4ddd4dc..90561370a 100644 --- a/packages/webgpu/package.json +++ b/packages/webgpu/package.json @@ -1,6 +1,6 @@ { "name": "react-native-wgpu", - "version": "0.1.21", + "version": "0.1.22", "description": "React Native WebGPU", "main": "lib/commonjs/index", "module": "lib/module/index", diff --git a/packages/webgpu/src/__tests__/GPU.spec.ts b/packages/webgpu/src/__tests__/GPU.spec.ts index a07341fa8..eeee2c34a 100644 --- a/packages/webgpu/src/__tests__/GPU.spec.ts +++ b/packages/webgpu/src/__tests__/GPU.spec.ts @@ -66,6 +66,7 @@ describe("Adapter", () => { }; }); }); + console.log(result); expect(result).toBeDefined(); expect(result!.vendor).toBeDefined(); expect(result!.architecture).toBeDefined();