Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 13 additions & 49 deletions apps/example/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1865,7 +1865,7 @@ PODS:
- ReactCommon/turbomodule/core
- SocketRocket
- Yoga
- react-native-wgpu (0.5.0):
- react-native-wgpu (0.5.1):
- boost
- DoubleConversion
- fast_float
Expand Down Expand Up @@ -2460,7 +2460,7 @@ PODS:
- ReactCommon/turbomodule/core
- SocketRocket
- Yoga
- RNReanimated (4.2.1):
- RNReanimated (3.19.1):
- boost
- DoubleConversion
- fast_float
Expand All @@ -2487,11 +2487,11 @@ PODS:
- ReactCodegen
- ReactCommon/turbomodule/bridging
- ReactCommon/turbomodule/core
- RNReanimated/reanimated (= 4.2.1)
- RNWorklets
- RNReanimated/reanimated (= 3.19.1)
- RNReanimated/worklets (= 3.19.1)
- SocketRocket
- Yoga
- RNReanimated/reanimated (4.2.1):
- RNReanimated/reanimated (3.19.1):
- boost
- DoubleConversion
- fast_float
Expand All @@ -2518,11 +2518,10 @@ PODS:
- ReactCodegen
- ReactCommon/turbomodule/bridging
- ReactCommon/turbomodule/core
- RNReanimated/reanimated/apple (= 4.2.1)
- RNWorklets
- RNReanimated/reanimated/apple (= 3.19.1)
- SocketRocket
- Yoga
- RNReanimated/reanimated/apple (4.2.1):
- RNReanimated/reanimated/apple (3.19.1):
- boost
- DoubleConversion
- fast_float
Expand All @@ -2549,10 +2548,9 @@ PODS:
- ReactCodegen
- ReactCommon/turbomodule/bridging
- ReactCommon/turbomodule/core
- RNWorklets
- SocketRocket
- Yoga
- RNWorklets (0.7.2):
- RNReanimated/worklets (3.19.1):
- boost
- DoubleConversion
- fast_float
Expand All @@ -2579,40 +2577,10 @@ PODS:
- ReactCodegen
- ReactCommon/turbomodule/bridging
- ReactCommon/turbomodule/core
- RNWorklets/worklets (= 0.7.2)
- RNReanimated/worklets/apple (= 3.19.1)
- SocketRocket
- Yoga
- RNWorklets/worklets (0.7.2):
- boost
- DoubleConversion
- fast_float
- fmt
- glog
- hermes-engine
- RCT-Folly
- RCT-Folly/Fabric
- RCTRequired
- RCTTypeSafety
- React-Core
- React-debug
- React-Fabric
- React-featureflags
- React-graphics
- React-hermes
- React-ImageManager
- React-jsi
- React-NativeModulesApple
- React-RCTFabric
- React-renderercss
- React-rendererdebug
- React-utils
- ReactCodegen
- ReactCommon/turbomodule/bridging
- ReactCommon/turbomodule/core
- RNWorklets/worklets/apple (= 0.7.2)
- SocketRocket
- Yoga
- RNWorklets/worklets/apple (0.7.2):
- RNReanimated/worklets/apple (3.19.1):
- boost
- DoubleConversion
- fast_float
Expand Down Expand Up @@ -2724,7 +2692,6 @@ DEPENDENCIES:
- ReactTestApp-Resources (from `..`)
- RNGestureHandler (from `../../../node_modules/react-native-gesture-handler`)
- RNReanimated (from `../../../node_modules/react-native-reanimated`)
- RNWorklets (from `../../../node_modules/react-native-worklets`)
- SocketRocket (~> 0.7.1)
- Yoga (from `../../../node_modules/react-native/ReactCommon/yoga`)

Expand Down Expand Up @@ -2890,8 +2857,6 @@ EXTERNAL SOURCES:
:path: "../../../node_modules/react-native-gesture-handler"
RNReanimated:
:path: "../../../node_modules/react-native-reanimated"
RNWorklets:
:path: "../../../node_modules/react-native-worklets"
Yoga:
:path: "../../../node_modules/react-native/ReactCommon/yoga"

Expand Down Expand Up @@ -2938,7 +2903,7 @@ SPEC CHECKSUMS:
React-microtasksnativemodule: 75b6604b667d297292345302cc5bfb6b6aeccc1b
react-native-safe-area-context: c00143b4823773bba23f2f19f85663ae89ceb460
react-native-skia: 5bf2b2107cd7f2d806fd364f5e16b1c7554ed3cd
react-native-wgpu: e54fcee5946cc2cee4814f63f425be358f097b14
react-native-wgpu: 73132f915ab99a1ce2b0fdafcfa9a6523c11ceec
React-NativeModulesApple: 879fbdc5dcff7136abceb7880fe8a2022a1bd7c3
React-oscompat: 93b5535ea7f7dff46aaee4f78309a70979bdde9d
React-perflogger: 5536d2df3d18fe0920263466f7b46a56351c0510
Expand Down Expand Up @@ -2967,14 +2932,13 @@ SPEC CHECKSUMS:
React-timing: 1e6a8acb66e2b7ac9d418956617fd1fdb19322fd
React-utils: 52bbb03f130319ef82e4c3bc7a85eaacdb1fec87
ReactAppDependencyProvider: 433ddfb4536948630aadd5bd925aff8a632d2fe3
ReactCodegen: 7042ec4a7316b59e8f247b8fa312891179d24f5a
ReactCodegen: 64dbbed4e9e0264d799578ea78492479a66fba4a
ReactCommon: 394c6b92765cf6d211c2c3f7f6bc601dffb316a6
ReactNativeHost: f5e054387e917216a2a021a3f7fdc4f9f158e7e4
ReactTestApp-DevSupport: 9b7bbba5e8fed998e763809171d9906a1375f9d3
ReactTestApp-Resources: 1bd9ff10e4c24f2ad87101a32023721ae923bccf
RNGestureHandler: e37bdb684df1ac17c7e1d8f71a3311b2793c186b
RNReanimated: 464375ff2caa801358547c44eca894ff0bf68e74
RNWorklets: ee58e869ea579800ec5f2f1cb6ae195fd3537546
RNReanimated: 4e53390354d1eed1398ab51ace22b869be6ce611
SocketRocket: d4aabe649be1e368d1318fdf28a022d714d65748
Yoga: a3ed390a19db0459bd6839823a6ac6d9c6db198d

Expand Down
11 changes: 10 additions & 1 deletion packages/webgpu/babel.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
const plugins = [];

try {
require.resolve('react-native-worklets/plugin');
plugins.push('react-native-worklets/plugin');
} catch {
// react-native-worklets is optional
}

module.exports = {
presets: ['module:@react-native/babel-preset'],
plugins: ['react-native-worklets/plugin'],
plugins,
};
3 changes: 0 additions & 3 deletions packages/webgpu/cpp/rnwgpu/api/GPU.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
#include <memory>
#include <string>
#include <unordered_set>
#include <variant>

#include "Unions.h"

Expand All @@ -17,8 +16,6 @@
#include "GPUAdapter.h"
#include "GPURequestAdapterOptions.h"

#include <webgpu/webgpu.h>

namespace rnwgpu {

namespace jsi = facebook::jsi;
Expand Down
1 change: 1 addition & 0 deletions packages/webgpu/cpp/rnwgpu/api/GPUBindGroup.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ class GPUBindGroup : public NativeObject<GPUBindGroup> {

static void definePrototype(jsi::Runtime &runtime, jsi::Object &prototype) {
installGetter(runtime, prototype, "__brand", &GPUBindGroup::getBrand);

installGetterSetter(runtime, prototype, "label", &GPUBindGroup::getLabel,
&GPUBindGroup::setLabel);
}
Expand Down
1 change: 1 addition & 0 deletions packages/webgpu/cpp/rnwgpu/api/GPUBindGroupLayout.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ class GPUBindGroupLayout : public NativeObject<GPUBindGroupLayout> {

static void definePrototype(jsi::Runtime &runtime, jsi::Object &prototype) {
installGetter(runtime, prototype, "__brand", &GPUBindGroupLayout::getBrand);

installGetterSetter(runtime, prototype, "label",
&GPUBindGroupLayout::getLabel,
&GPUBindGroupLayout::setLabel);
Expand Down
9 changes: 5 additions & 4 deletions packages/webgpu/cpp/rnwgpu/api/GPUBuffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,6 @@ class GPUBuffer : public NativeObject<GPUBuffer> {

size_t getMemoryPressure() override { return static_cast<size_t>(getSize()); }

private:
wgpu::Buffer _instance;
std::shared_ptr<async::AsyncRunner> _async;
std::string _label;
struct Mapping {
uint64_t start;
uint64_t end;
Expand All @@ -82,6 +78,11 @@ class GPUBuffer : public NativeObject<GPUBuffer> {
std::shared_ptr<ArrayBuffer> buffer;
};
std::vector<Mapping> mappings;

private:
wgpu::Buffer _instance;
std::shared_ptr<async::AsyncRunner> _async;
std::string _label;
};

} // namespace rnwgpu
1 change: 1 addition & 0 deletions packages/webgpu/cpp/rnwgpu/api/GPUCommandBuffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ class GPUCommandBuffer : public NativeObject<GPUCommandBuffer> {

static void definePrototype(jsi::Runtime &runtime, jsi::Object &prototype) {
installGetter(runtime, prototype, "__brand", &GPUCommandBuffer::getBrand);

installGetterSetter(runtime, prototype, "label",
&GPUCommandBuffer::getLabel,
&GPUCommandBuffer::setLabel);
Expand Down
1 change: 1 addition & 0 deletions packages/webgpu/cpp/rnwgpu/api/GPUCommandEncoder.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ class GPUCommandEncoder : public NativeObject<GPUCommandEncoder> {
&GPUCommandEncoder::popDebugGroup);
installMethod(runtime, prototype, "insertDebugMarker",
&GPUCommandEncoder::insertDebugMarker);

installGetterSetter(runtime, prototype, "label",
&GPUCommandEncoder::getLabel,
&GPUCommandEncoder::setLabel);
Expand Down
1 change: 1 addition & 0 deletions packages/webgpu/cpp/rnwgpu/api/GPUComputePassEncoder.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ class GPUComputePassEncoder : public NativeObject<GPUComputePassEncoder> {
&GPUComputePassEncoder::insertDebugMarker);
installMethod(runtime, prototype, "setBindGroup",
&GPUComputePassEncoder::setBindGroup);

installGetterSetter(runtime, prototype, "label",
&GPUComputePassEncoder::getLabel,
&GPUComputePassEncoder::setLabel);
Expand Down
4 changes: 3 additions & 1 deletion packages/webgpu/cpp/rnwgpu/api/GPUComputePipeline.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ class GPUComputePipeline : public NativeObject<GPUComputePipeline> {
installGetter(runtime, prototype, "__brand", &GPUComputePipeline::getBrand);
installMethod(runtime, prototype, "getBindGroupLayout",
&GPUComputePipeline::getBindGroupLayout);

installGetterSetter(runtime, prototype, "label",
&GPUComputePipeline::getLabel,
&GPUComputePipeline::setLabel);
Expand All @@ -51,10 +52,11 @@ class GPUComputePipeline : public NativeObject<GPUComputePipeline> {
return 16 * 1024;
}

friend class GPUDevice;

private:
wgpu::ComputePipeline _instance;
std::string _label;
friend class GPUDevice;
};

} // namespace rnwgpu
1 change: 1 addition & 0 deletions packages/webgpu/cpp/rnwgpu/api/GPUExternalTexture.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ class GPUExternalTexture : public NativeObject<GPUExternalTexture> {

static void definePrototype(jsi::Runtime &runtime, jsi::Object &prototype) {
installGetter(runtime, prototype, "__brand", &GPUExternalTexture::getBrand);

installGetterSetter(runtime, prototype, "label",
&GPUExternalTexture::getLabel,
&GPUExternalTexture::setLabel);
Expand Down
1 change: 1 addition & 0 deletions packages/webgpu/cpp/rnwgpu/api/GPUPipelineLayout.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ class GPUPipelineLayout : public NativeObject<GPUPipelineLayout> {

static void definePrototype(jsi::Runtime &runtime, jsi::Object &prototype) {
installGetter(runtime, prototype, "__brand", &GPUPipelineLayout::getBrand);

installGetterSetter(runtime, prototype, "label",
&GPUPipelineLayout::getLabel,
&GPUPipelineLayout::setLabel);
Expand Down
1 change: 1 addition & 0 deletions packages/webgpu/cpp/rnwgpu/api/GPUQueue.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ class GPUQueue : public NativeObject<GPUQueue> {
installMethod(runtime, prototype, "writeTexture", &GPUQueue::writeTexture);
installMethod(runtime, prototype, "copyExternalImageToTexture",
&GPUQueue::copyExternalImageToTexture);

installGetterSetter(runtime, prototype, "label", &GPUQueue::getLabel,
&GPUQueue::setLabel);
}
Expand Down
1 change: 1 addition & 0 deletions packages/webgpu/cpp/rnwgpu/api/GPURenderBundle.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ class GPURenderBundle : public NativeObject<GPURenderBundle> {

static void definePrototype(jsi::Runtime &runtime, jsi::Object &prototype) {
installGetter(runtime, prototype, "__brand", &GPURenderBundle::getBrand);

installGetterSetter(runtime, prototype, "label", &GPURenderBundle::getLabel,
&GPURenderBundle::setLabel);
}
Expand Down
1 change: 1 addition & 0 deletions packages/webgpu/cpp/rnwgpu/api/GPURenderBundleEncoder.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ class GPURenderBundleEncoder : public NativeObject<GPURenderBundleEncoder> {
&GPURenderBundleEncoder::drawIndirect);
installMethod(runtime, prototype, "drawIndexedIndirect",
&GPURenderBundleEncoder::drawIndexedIndirect);

installGetterSetter(runtime, prototype, "label",
&GPURenderBundleEncoder::getLabel,
&GPURenderBundleEncoder::setLabel);
Expand Down
1 change: 1 addition & 0 deletions packages/webgpu/cpp/rnwgpu/api/GPURenderPassEncoder.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ class GPURenderPassEncoder : public NativeObject<GPURenderPassEncoder> {
&GPURenderPassEncoder::drawIndirect);
installMethod(runtime, prototype, "drawIndexedIndirect",
&GPURenderPassEncoder::drawIndexedIndirect);

installGetterSetter(runtime, prototype, "label",
&GPURenderPassEncoder::getLabel,
&GPURenderPassEncoder::setLabel);
Expand Down
4 changes: 3 additions & 1 deletion packages/webgpu/cpp/rnwgpu/api/GPURenderPipeline.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ class GPURenderPipeline : public NativeObject<GPURenderPipeline> {
installGetter(runtime, prototype, "__brand", &GPURenderPipeline::getBrand);
installMethod(runtime, prototype, "getBindGroupLayout",
&GPURenderPipeline::getBindGroupLayout);

installGetterSetter(runtime, prototype, "label",
&GPURenderPipeline::getLabel,
&GPURenderPipeline::setLabel);
Expand All @@ -52,10 +53,11 @@ class GPURenderPipeline : public NativeObject<GPURenderPipeline> {
return 24 * 1024;
}

friend class GPUDevice;

private:
wgpu::RenderPipeline _instance;
std::string _label;
friend class GPUDevice;
};

} // namespace rnwgpu
1 change: 1 addition & 0 deletions packages/webgpu/cpp/rnwgpu/api/GPUSampler.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ class GPUSampler : public NativeObject<GPUSampler> {

static void definePrototype(jsi::Runtime &runtime, jsi::Object &prototype) {
installGetter(runtime, prototype, "__brand", &GPUSampler::getBrand);

installGetterSetter(runtime, prototype, "label", &GPUSampler::getLabel,
&GPUSampler::setLabel);
}
Expand Down
1 change: 1 addition & 0 deletions packages/webgpu/cpp/rnwgpu/api/GPUShaderModule.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ class GPUShaderModule : public NativeObject<GPUShaderModule> {
installGetter(runtime, prototype, "__brand", &GPUShaderModule::getBrand);
installMethod(runtime, prototype, "getCompilationInfo",
&GPUShaderModule::getCompilationInfo);

installGetterSetter(runtime, prototype, "label", &GPUShaderModule::getLabel,
&GPUShaderModule::setLabel);
}
Expand Down
1 change: 1 addition & 0 deletions packages/webgpu/cpp/rnwgpu/api/GPUSupportedLimits.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ class GPUSupportedLimits : public NativeObject<GPUSupportedLimits> {

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",
Expand Down
1 change: 1 addition & 0 deletions packages/webgpu/cpp/rnwgpu/api/GPUTextureView.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ class GPUTextureView : public NativeObject<GPUTextureView> {

static void definePrototype(jsi::Runtime &runtime, jsi::Object &prototype) {
installGetter(runtime, prototype, "__brand", &GPUTextureView::getBrand);

installGetterSetter(runtime, prototype, "label", &GPUTextureView::getLabel,
&GPUTextureView::setLabel);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,4 @@ struct JSIConverter<std::shared_ptr<rnwgpu::GPUBindGroupDescriptor>> {
}
};

} // namespace rnwgpu
} // namespace rnwgpu
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,4 @@ struct JSIConverter<std::shared_ptr<rnwgpu::GPUBindGroupLayoutDescriptor>> {
}
};

} // namespace rnwgpu
} // namespace rnwgpu
Original file line number Diff line number Diff line change
Expand Up @@ -95,4 +95,4 @@ struct JSIConverter<std::shared_ptr<rnwgpu::GPUBindGroupLayoutEntry>> {
}
};

} // namespace rnwgpu
} // namespace rnwgpu
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,4 @@ template <> struct JSIConverter<std::shared_ptr<rnwgpu::GPUBlendComponent>> {
}
};

} // namespace rnwgpu
} // namespace rnwgpu
2 changes: 1 addition & 1 deletion packages/webgpu/cpp/rnwgpu/api/descriptors/GPUBlendState.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,4 @@ template <> struct JSIConverter<std::shared_ptr<rnwgpu::GPUBlendState>> {
}
};

} // namespace rnwgpu
} // namespace rnwgpu
Loading
Loading