react-native-wgpu 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (208) hide show
  1. package/LICENSE +20 -0
  2. package/README.md +31 -0
  3. package/android/CMakeLists.txt +74 -0
  4. package/android/build.gradle +166 -0
  5. package/android/cpp/cpp-adapter.cpp +12 -0
  6. package/android/gradle.properties +5 -0
  7. package/android/src/main/AndroidManifest.xml +3 -0
  8. package/android/src/main/AndroidManifestNew.xml +2 -0
  9. package/android/src/main/java/com/webgpu/WebGPUModule.java +39 -0
  10. package/android/src/main/java/com/webgpu/WebGPUView.java +24 -0
  11. package/android/src/main/java/com/webgpu/WebGPUViewManager.java +31 -0
  12. package/android/src/main/java/com/webgpu/WebGPUViewPackage.java +26 -0
  13. package/android/src/newarch/WgpuViewManagerSpec.java +24 -0
  14. package/android/src/oldarch/WebGPUViewManagerSpec.java +11 -0
  15. package/cpp/Logger.h +82 -0
  16. package/cpp/dawn/dawn_proc_table.h +308 -0
  17. package/cpp/dawn/webgpu.h +4201 -0
  18. package/cpp/dawn/webgpu_cpp.h +8985 -0
  19. package/cpp/dawn/webgpu_cpp_print.h +2460 -0
  20. package/cpp/dawn/wire/client/webgpu.h +339 -0
  21. package/cpp/dawn/wire/client/webgpu_cpp.h +9140 -0
  22. package/cpp/jsi/RNFEnumMapper.h +49 -0
  23. package/cpp/jsi/RNFHybridObject.cpp +145 -0
  24. package/cpp/jsi/RNFHybridObject.h +162 -0
  25. package/cpp/jsi/RNFJSIConverter.h +412 -0
  26. package/cpp/jsi/RNFJSIHelper.h +49 -0
  27. package/cpp/jsi/RNFPointerHolder.h +95 -0
  28. package/cpp/jsi/RNFPromise.cpp +45 -0
  29. package/cpp/jsi/RNFPromise.h +38 -0
  30. package/cpp/jsi/RNFRuntimeCache.cpp +57 -0
  31. package/cpp/jsi/RNFRuntimeCache.h +79 -0
  32. package/cpp/jsi/RNFWorkletRuntimeCollector.h +43 -0
  33. package/cpp/jsi/RNFWorkletRuntimeRegistry.cpp +11 -0
  34. package/cpp/jsi/RNFWorkletRuntimeRegistry.h +44 -0
  35. package/cpp/rnwgpu/MutableBuffer.h +48 -0
  36. package/cpp/rnwgpu/RNWebGPUManager.cpp +60 -0
  37. package/cpp/rnwgpu/RNWebGPUManager.h +30 -0
  38. package/cpp/rnwgpu/api/GPU.cpp +40 -0
  39. package/cpp/rnwgpu/api/GPU.h +43 -0
  40. package/cpp/rnwgpu/api/GPUAdapter.cpp +33 -0
  41. package/cpp/rnwgpu/api/GPUAdapter.h +40 -0
  42. package/cpp/rnwgpu/api/GPUAdapterInfo.h +33 -0
  43. package/cpp/rnwgpu/api/GPUBindGroup.h +38 -0
  44. package/cpp/rnwgpu/api/GPUBindGroupLayout.h +39 -0
  45. package/cpp/rnwgpu/api/GPUBuffer.cpp +16 -0
  46. package/cpp/rnwgpu/api/GPUBuffer.h +44 -0
  47. package/cpp/rnwgpu/api/GPUCanvasContext.h +33 -0
  48. package/cpp/rnwgpu/api/GPUCommandBuffer.h +38 -0
  49. package/cpp/rnwgpu/api/GPUCommandEncoder.h +38 -0
  50. package/cpp/rnwgpu/api/GPUCompilationInfo.h +33 -0
  51. package/cpp/rnwgpu/api/GPUCompilationMessage.h +33 -0
  52. package/cpp/rnwgpu/api/GPUComputePassEncoder.h +40 -0
  53. package/cpp/rnwgpu/api/GPUComputePipeline.h +39 -0
  54. package/cpp/rnwgpu/api/GPUDevice.cpp +12 -0
  55. package/cpp/rnwgpu/api/GPUDevice.h +45 -0
  56. package/cpp/rnwgpu/api/GPUDeviceLostInfo.h +33 -0
  57. package/cpp/rnwgpu/api/GPUExternalTexture.h +39 -0
  58. package/cpp/rnwgpu/api/GPUPipelineLayout.h +38 -0
  59. package/cpp/rnwgpu/api/GPUQuerySet.h +38 -0
  60. package/cpp/rnwgpu/api/GPUQueue.h +38 -0
  61. package/cpp/rnwgpu/api/GPURenderBundle.h +38 -0
  62. package/cpp/rnwgpu/api/GPURenderBundleEncoder.h +40 -0
  63. package/cpp/rnwgpu/api/GPURenderPassEncoder.h +40 -0
  64. package/cpp/rnwgpu/api/GPURenderPipeline.h +38 -0
  65. package/cpp/rnwgpu/api/GPUSampler.h +38 -0
  66. package/cpp/rnwgpu/api/GPUShaderModule.h +38 -0
  67. package/cpp/rnwgpu/api/GPUSupportedLimits.h +33 -0
  68. package/cpp/rnwgpu/api/GPUTexture.h +38 -0
  69. package/cpp/rnwgpu/api/GPUTextureView.h +38 -0
  70. package/cpp/rnwgpu/api/GPUUncapturedErrorEvent.h +33 -0
  71. package/cpp/rnwgpu/api/descriptors/GPUBindGroupDescriptor.h +81 -0
  72. package/cpp/rnwgpu/api/descriptors/GPUBindGroupEntry.h +67 -0
  73. package/cpp/rnwgpu/api/descriptors/GPUBindGroupLayoutDescriptor.h +69 -0
  74. package/cpp/rnwgpu/api/descriptors/GPUBindGroupLayoutEntry.h +95 -0
  75. package/cpp/rnwgpu/api/descriptors/GPUBlendComponent.h +56 -0
  76. package/cpp/rnwgpu/api/descriptors/GPUBlendState.h +65 -0
  77. package/cpp/rnwgpu/api/descriptors/GPUBufferBinding.h +72 -0
  78. package/cpp/rnwgpu/api/descriptors/GPUBufferBindingLayout.h +62 -0
  79. package/cpp/rnwgpu/api/descriptors/GPUBufferDescriptor.h +85 -0
  80. package/cpp/rnwgpu/api/descriptors/GPUBufferUsage.h +43 -0
  81. package/cpp/rnwgpu/api/descriptors/GPUCanvasConfiguration.h +93 -0
  82. package/cpp/rnwgpu/api/descriptors/GPUColorDict.h +81 -0
  83. package/cpp/rnwgpu/api/descriptors/GPUColorTargetState.h +69 -0
  84. package/cpp/rnwgpu/api/descriptors/GPUColorWrite.h +31 -0
  85. package/cpp/rnwgpu/api/descriptors/GPUComputePassDescriptor.h +62 -0
  86. package/cpp/rnwgpu/api/descriptors/GPUComputePassTimestampWrites.h +80 -0
  87. package/cpp/rnwgpu/api/descriptors/GPUComputePipelineDescriptor.h +82 -0
  88. package/cpp/rnwgpu/api/descriptors/GPUDepthStencilState.h +126 -0
  89. package/cpp/rnwgpu/api/descriptors/GPUDeviceDescriptor.h +69 -0
  90. package/cpp/rnwgpu/api/descriptors/GPUExtent3DDict.h +76 -0
  91. package/cpp/rnwgpu/api/descriptors/GPUExtent3DDictStrict.h +91 -0
  92. package/cpp/rnwgpu/api/descriptors/GPUExternalTextureBindingLayout.h +44 -0
  93. package/cpp/rnwgpu/api/descriptors/GPUExternalTextureDescriptor.h +75 -0
  94. package/cpp/rnwgpu/api/descriptors/GPUFragmentState.h +85 -0
  95. package/cpp/rnwgpu/api/descriptors/GPUImageCopyBuffer.h +83 -0
  96. package/cpp/rnwgpu/api/descriptors/GPUImageCopyExternalImage.h +66 -0
  97. package/cpp/rnwgpu/api/descriptors/GPUImageCopyTexture.h +74 -0
  98. package/cpp/rnwgpu/api/descriptors/GPUImageCopyTextureTagged.h +88 -0
  99. package/cpp/rnwgpu/api/descriptors/GPUImageDataLayout.h +70 -0
  100. package/cpp/rnwgpu/api/descriptors/GPUMapMode.h +25 -0
  101. package/cpp/rnwgpu/api/descriptors/GPUMultisampleState.h +68 -0
  102. package/cpp/rnwgpu/api/descriptors/GPUOrigin2DDict.h +61 -0
  103. package/cpp/rnwgpu/api/descriptors/GPUOrigin2DDictStrict.h +75 -0
  104. package/cpp/rnwgpu/api/descriptors/GPUOrigin3DDict.h +71 -0
  105. package/cpp/rnwgpu/api/descriptors/GPUPipelineErrorInit.h +54 -0
  106. package/cpp/rnwgpu/api/descriptors/GPUPipelineLayoutDescriptor.h +72 -0
  107. package/cpp/rnwgpu/api/descriptors/GPUPrimitiveState.h +66 -0
  108. package/cpp/rnwgpu/api/descriptors/GPUProgrammableStage.h +72 -0
  109. package/cpp/rnwgpu/api/descriptors/GPUQuerySetDescriptor.h +81 -0
  110. package/cpp/rnwgpu/api/descriptors/GPURenderBundleEncoderDescriptor.h +102 -0
  111. package/cpp/rnwgpu/api/descriptors/GPURenderPassColorAttachment.h +105 -0
  112. package/cpp/rnwgpu/api/descriptors/GPURenderPassDepthStencilAttachment.h +118 -0
  113. package/cpp/rnwgpu/api/descriptors/GPURenderPassDescriptor.h +100 -0
  114. package/cpp/rnwgpu/api/descriptors/GPURenderPassLayout.h +83 -0
  115. package/cpp/rnwgpu/api/descriptors/GPURenderPassTimestampWrites.h +80 -0
  116. package/cpp/rnwgpu/api/descriptors/GPURenderPipelineDescriptor.h +104 -0
  117. package/cpp/rnwgpu/api/descriptors/GPURequestAdapterOptions.h +56 -0
  118. package/cpp/rnwgpu/api/descriptors/GPUSamplerBindingLayout.h +48 -0
  119. package/cpp/rnwgpu/api/descriptors/GPUSamplerDescriptor.h +116 -0
  120. package/cpp/rnwgpu/api/descriptors/GPUShaderModuleCompilationHint.h +64 -0
  121. package/cpp/rnwgpu/api/descriptors/GPUShaderModuleDescriptor.h +88 -0
  122. package/cpp/rnwgpu/api/descriptors/GPUShaderStage.h +27 -0
  123. package/cpp/rnwgpu/api/descriptors/GPUStencilFaceState.h +61 -0
  124. package/cpp/rnwgpu/api/descriptors/GPUStorageTextureBindingLayout.h +67 -0
  125. package/cpp/rnwgpu/api/descriptors/GPUTextureBindingLayout.h +58 -0
  126. package/cpp/rnwgpu/api/descriptors/GPUTextureDescriptor.h +123 -0
  127. package/cpp/rnwgpu/api/descriptors/GPUTextureUsage.h +40 -0
  128. package/cpp/rnwgpu/api/descriptors/GPUTextureViewDescriptor.h +113 -0
  129. package/cpp/rnwgpu/api/descriptors/GPUUncapturedErrorEventInit.h +71 -0
  130. package/cpp/rnwgpu/api/descriptors/GPUVertexAttribute.h +80 -0
  131. package/cpp/rnwgpu/api/descriptors/GPUVertexBufferLayout.h +73 -0
  132. package/cpp/rnwgpu/api/descriptors/GPUVertexState.h +77 -0
  133. package/cpp/rnwgpu/api/descriptors/Unions.h +1645 -0
  134. package/cpp/webgpu/webgpu.h +33 -0
  135. package/cpp/webgpu/webgpu_cpp.h +33 -0
  136. package/cpp/webgpu/webgpu_cpp_chained_struct.h +55 -0
  137. package/cpp/webgpu/webgpu_enum_class_bitmasks.h +161 -0
  138. package/ios/RNFAppleLogger.mm +22 -0
  139. package/ios/Utils.h +5 -0
  140. package/ios/Utils.m +26 -0
  141. package/ios/WebGPUModule.h +18 -0
  142. package/ios/WebGPUModule.mm +77 -0
  143. package/ios/WebGPUView.h +15 -0
  144. package/ios/WebGPUView.mm +58 -0
  145. package/ios/WebGPUViewManager.mm +21 -0
  146. package/lib/commonjs/WebGPUNativeModule.js +10 -0
  147. package/lib/commonjs/WebGPUNativeModule.js.map +1 -0
  148. package/lib/commonjs/WebGPUViewNativeComponent.js +11 -0
  149. package/lib/commonjs/WebGPUViewNativeComponent.js.map +1 -0
  150. package/lib/commonjs/index.js +45 -0
  151. package/lib/commonjs/index.js.map +1 -0
  152. package/lib/module/WebGPUNativeModule.js +4 -0
  153. package/lib/module/WebGPUNativeModule.js.map +1 -0
  154. package/lib/module/WebGPUViewNativeComponent.js +4 -0
  155. package/lib/module/WebGPUViewNativeComponent.js.map +1 -0
  156. package/lib/module/index.js +9 -0
  157. package/lib/module/index.js.map +1 -0
  158. package/lib/typescript/babel.config.d.ts +2 -0
  159. package/lib/typescript/babel.config.d.ts.map +1 -0
  160. package/lib/typescript/jest.config.d.ts +5 -0
  161. package/lib/typescript/jest.config.d.ts.map +1 -0
  162. package/lib/typescript/lib/commonjs/WebGPUNativeModule.d.ts +5 -0
  163. package/lib/typescript/lib/commonjs/WebGPUNativeModule.d.ts.map +1 -0
  164. package/lib/typescript/lib/commonjs/WebGPUViewNativeComponent.d.ts +4 -0
  165. package/lib/typescript/lib/commonjs/WebGPUViewNativeComponent.d.ts.map +1 -0
  166. package/lib/typescript/lib/commonjs/index.d.ts +5 -0
  167. package/lib/typescript/lib/commonjs/index.d.ts.map +1 -0
  168. package/lib/typescript/lib/module/WebGPUNativeModule.d.ts +3 -0
  169. package/lib/typescript/lib/module/WebGPUNativeModule.d.ts.map +1 -0
  170. package/lib/typescript/lib/module/WebGPUViewNativeComponent.d.ts +4 -0
  171. package/lib/typescript/lib/module/WebGPUViewNativeComponent.d.ts.map +1 -0
  172. package/lib/typescript/lib/module/index.d.ts +5 -0
  173. package/lib/typescript/lib/module/index.d.ts.map +1 -0
  174. package/lib/typescript/scripts/build/copy-artifacts.d.ts +2 -0
  175. package/lib/typescript/scripts/build/copy-artifacts.d.ts.map +1 -0
  176. package/lib/typescript/scripts/build/dawn.d.ts +2 -0
  177. package/lib/typescript/scripts/build/dawn.d.ts.map +1 -0
  178. package/lib/typescript/scripts/build/util.d.ts +13 -0
  179. package/lib/typescript/scripts/build/util.d.ts.map +1 -0
  180. package/lib/typescript/scripts/codegen/codegen.d.ts +2 -0
  181. package/lib/typescript/scripts/codegen/codegen.d.ts.map +1 -0
  182. package/lib/typescript/scripts/codegen/model/dawn.d.ts +2 -0
  183. package/lib/typescript/scripts/codegen/model/dawn.d.ts.map +1 -0
  184. package/lib/typescript/scripts/codegen/model/model.d.ts +8 -0
  185. package/lib/typescript/scripts/codegen/model/model.d.ts.map +1 -0
  186. package/lib/typescript/scripts/codegen/templates/Descriptor.d.ts +4 -0
  187. package/lib/typescript/scripts/codegen/templates/Descriptor.d.ts.map +1 -0
  188. package/lib/typescript/scripts/codegen/templates/Enum.d.ts +3 -0
  189. package/lib/typescript/scripts/codegen/templates/Enum.d.ts.map +1 -0
  190. package/lib/typescript/scripts/codegen/templates/HybridObject.d.ts +3 -0
  191. package/lib/typescript/scripts/codegen/templates/HybridObject.d.ts.map +1 -0
  192. package/lib/typescript/scripts/codegen/templates/Unions.d.ts +6 -0
  193. package/lib/typescript/scripts/codegen/templates/Unions.d.ts.map +1 -0
  194. package/lib/typescript/scripts/codegen/templates/common.d.ts +9 -0
  195. package/lib/typescript/scripts/codegen/templates/common.d.ts.map +1 -0
  196. package/lib/typescript/scripts/codegen/util.d.ts +2 -0
  197. package/lib/typescript/scripts/codegen/util.d.ts.map +1 -0
  198. package/lib/typescript/src/WebGPUNativeModule.d.ts +7 -0
  199. package/lib/typescript/src/WebGPUNativeModule.d.ts.map +1 -0
  200. package/lib/typescript/src/WebGPUViewNativeComponent.d.ts +8 -0
  201. package/lib/typescript/src/WebGPUViewNativeComponent.d.ts.map +1 -0
  202. package/lib/typescript/src/index.d.ts +9 -0
  203. package/lib/typescript/src/index.d.ts.map +1 -0
  204. package/package.json +120 -0
  205. package/react-native-webgpu.podspec +56 -0
  206. package/src/WebGPUNativeModule.ts +9 -0
  207. package/src/WebGPUViewNativeComponent.ts +9 -0
  208. package/src/index.tsx +13 -0
@@ -0,0 +1,44 @@
1
+ #pragma once
2
+
3
+ #include <future>
4
+ #include <memory>
5
+ #include <string>
6
+
7
+ #include "Unions.h"
8
+ #include <RNFHybridObject.h>
9
+
10
+ #include "MutableBuffer.h"
11
+
12
+ #include "webgpu/webgpu_cpp.h"
13
+
14
+ namespace rnwgpu {
15
+
16
+ namespace m = margelo;
17
+
18
+ class GPUBuffer : public m::HybridObject {
19
+ public:
20
+ explicit GPUBuffer(wgpu::Buffer instance, std::string label)
21
+ : HybridObject("GPUBuffer"), _instance(instance), _label(label) {}
22
+
23
+ public:
24
+ std::string getBrand() { return _name; }
25
+
26
+ std::shared_ptr<MutableJSIBuffer> getMappedRange(std::optional<size_t> offset,
27
+ std::optional<size_t> size);
28
+ void unmap();
29
+
30
+ std::string getLabel() { return _label; }
31
+
32
+ void loadHybridMethods() override {
33
+ registerHybridGetter("__brand", &GPUBuffer::getBrand, this);
34
+ registerHybridMethod("getMappedRange", &GPUBuffer::getMappedRange, this);
35
+ registerHybridMethod("unmap", &GPUBuffer::unmap, this);
36
+
37
+ registerHybridGetter("label", &GPUBuffer::getLabel, this);
38
+ }
39
+
40
+ private:
41
+ wgpu::Buffer _instance;
42
+ std::string _label;
43
+ };
44
+ } // namespace rnwgpu
@@ -0,0 +1,33 @@
1
+ #pragma once
2
+
3
+ #include <future>
4
+ #include <memory>
5
+ #include <string>
6
+
7
+ #include "Unions.h"
8
+ #include <RNFHybridObject.h>
9
+
10
+ #include "MutableBuffer.h"
11
+
12
+ #include "webgpu/webgpu_cpp.h"
13
+
14
+ namespace rnwgpu {
15
+
16
+ namespace m = margelo;
17
+
18
+ class GPUCanvasContext : public m::HybridObject {
19
+ public:
20
+ explicit GPUCanvasContext(wgpu::CanvasContext instance)
21
+ : HybridObject("GPUCanvasContext"), _instance(instance) {}
22
+
23
+ public:
24
+ std::string getBrand() { return _name; }
25
+
26
+ void loadHybridMethods() override {
27
+ registerHybridGetter("__brand", &GPUCanvasContext::getBrand, this);
28
+ }
29
+
30
+ private:
31
+ wgpu::CanvasContext _instance;
32
+ };
33
+ } // namespace rnwgpu
@@ -0,0 +1,38 @@
1
+ #pragma once
2
+
3
+ #include <future>
4
+ #include <memory>
5
+ #include <string>
6
+
7
+ #include "Unions.h"
8
+ #include <RNFHybridObject.h>
9
+
10
+ #include "MutableBuffer.h"
11
+
12
+ #include "webgpu/webgpu_cpp.h"
13
+
14
+ namespace rnwgpu {
15
+
16
+ namespace m = margelo;
17
+
18
+ class GPUCommandBuffer : public m::HybridObject {
19
+ public:
20
+ explicit GPUCommandBuffer(wgpu::CommandBuffer instance, std::string label)
21
+ : HybridObject("GPUCommandBuffer"), _instance(instance), _label(label) {}
22
+
23
+ public:
24
+ std::string getBrand() { return _name; }
25
+
26
+ std::string getLabel() { return _label; }
27
+
28
+ void loadHybridMethods() override {
29
+ registerHybridGetter("__brand", &GPUCommandBuffer::getBrand, this);
30
+
31
+ registerHybridGetter("label", &GPUCommandBuffer::getLabel, this);
32
+ }
33
+
34
+ private:
35
+ wgpu::CommandBuffer _instance;
36
+ std::string _label;
37
+ };
38
+ } // namespace rnwgpu
@@ -0,0 +1,38 @@
1
+ #pragma once
2
+
3
+ #include <future>
4
+ #include <memory>
5
+ #include <string>
6
+
7
+ #include "Unions.h"
8
+ #include <RNFHybridObject.h>
9
+
10
+ #include "MutableBuffer.h"
11
+
12
+ #include "webgpu/webgpu_cpp.h"
13
+
14
+ namespace rnwgpu {
15
+
16
+ namespace m = margelo;
17
+
18
+ class GPUCommandEncoder : public m::HybridObject {
19
+ public:
20
+ explicit GPUCommandEncoder(wgpu::CommandEncoder instance, std::string label)
21
+ : HybridObject("GPUCommandEncoder"), _instance(instance), _label(label) {}
22
+
23
+ public:
24
+ std::string getBrand() { return _name; }
25
+
26
+ std::string getLabel() { return _label; }
27
+
28
+ void loadHybridMethods() override {
29
+ registerHybridGetter("__brand", &GPUCommandEncoder::getBrand, this);
30
+
31
+ registerHybridGetter("label", &GPUCommandEncoder::getLabel, this);
32
+ }
33
+
34
+ private:
35
+ wgpu::CommandEncoder _instance;
36
+ std::string _label;
37
+ };
38
+ } // namespace rnwgpu
@@ -0,0 +1,33 @@
1
+ #pragma once
2
+
3
+ #include <future>
4
+ #include <memory>
5
+ #include <string>
6
+
7
+ #include "Unions.h"
8
+ #include <RNFHybridObject.h>
9
+
10
+ #include "MutableBuffer.h"
11
+
12
+ #include "webgpu/webgpu_cpp.h"
13
+
14
+ namespace rnwgpu {
15
+
16
+ namespace m = margelo;
17
+
18
+ class GPUCompilationInfo : public m::HybridObject {
19
+ public:
20
+ explicit GPUCompilationInfo(wgpu::CompilationInfo instance)
21
+ : HybridObject("GPUCompilationInfo"), _instance(instance) {}
22
+
23
+ public:
24
+ std::string getBrand() { return _name; }
25
+
26
+ void loadHybridMethods() override {
27
+ registerHybridGetter("__brand", &GPUCompilationInfo::getBrand, this);
28
+ }
29
+
30
+ private:
31
+ wgpu::CompilationInfo _instance;
32
+ };
33
+ } // namespace rnwgpu
@@ -0,0 +1,33 @@
1
+ #pragma once
2
+
3
+ #include <future>
4
+ #include <memory>
5
+ #include <string>
6
+
7
+ #include "Unions.h"
8
+ #include <RNFHybridObject.h>
9
+
10
+ #include "MutableBuffer.h"
11
+
12
+ #include "webgpu/webgpu_cpp.h"
13
+
14
+ namespace rnwgpu {
15
+
16
+ namespace m = margelo;
17
+
18
+ class GPUCompilationMessage : public m::HybridObject {
19
+ public:
20
+ explicit GPUCompilationMessage(wgpu::CompilationMessage instance)
21
+ : HybridObject("GPUCompilationMessage"), _instance(instance) {}
22
+
23
+ public:
24
+ std::string getBrand() { return _name; }
25
+
26
+ void loadHybridMethods() override {
27
+ registerHybridGetter("__brand", &GPUCompilationMessage::getBrand, this);
28
+ }
29
+
30
+ private:
31
+ wgpu::CompilationMessage _instance;
32
+ };
33
+ } // namespace rnwgpu
@@ -0,0 +1,40 @@
1
+ #pragma once
2
+
3
+ #include <future>
4
+ #include <memory>
5
+ #include <string>
6
+
7
+ #include "Unions.h"
8
+ #include <RNFHybridObject.h>
9
+
10
+ #include "MutableBuffer.h"
11
+
12
+ #include "webgpu/webgpu_cpp.h"
13
+
14
+ namespace rnwgpu {
15
+
16
+ namespace m = margelo;
17
+
18
+ class GPUComputePassEncoder : public m::HybridObject {
19
+ public:
20
+ explicit GPUComputePassEncoder(wgpu::ComputePassEncoder instance,
21
+ std::string label)
22
+ : HybridObject("GPUComputePassEncoder"), _instance(instance),
23
+ _label(label) {}
24
+
25
+ public:
26
+ std::string getBrand() { return _name; }
27
+
28
+ std::string getLabel() { return _label; }
29
+
30
+ void loadHybridMethods() override {
31
+ registerHybridGetter("__brand", &GPUComputePassEncoder::getBrand, this);
32
+
33
+ registerHybridGetter("label", &GPUComputePassEncoder::getLabel, this);
34
+ }
35
+
36
+ private:
37
+ wgpu::ComputePassEncoder _instance;
38
+ std::string _label;
39
+ };
40
+ } // namespace rnwgpu
@@ -0,0 +1,39 @@
1
+ #pragma once
2
+
3
+ #include <future>
4
+ #include <memory>
5
+ #include <string>
6
+
7
+ #include "Unions.h"
8
+ #include <RNFHybridObject.h>
9
+
10
+ #include "MutableBuffer.h"
11
+
12
+ #include "webgpu/webgpu_cpp.h"
13
+
14
+ namespace rnwgpu {
15
+
16
+ namespace m = margelo;
17
+
18
+ class GPUComputePipeline : public m::HybridObject {
19
+ public:
20
+ explicit GPUComputePipeline(wgpu::ComputePipeline instance, std::string label)
21
+ : HybridObject("GPUComputePipeline"), _instance(instance), _label(label) {
22
+ }
23
+
24
+ public:
25
+ std::string getBrand() { return _name; }
26
+
27
+ std::string getLabel() { return _label; }
28
+
29
+ void loadHybridMethods() override {
30
+ registerHybridGetter("__brand", &GPUComputePipeline::getBrand, this);
31
+
32
+ registerHybridGetter("label", &GPUComputePipeline::getLabel, this);
33
+ }
34
+
35
+ private:
36
+ wgpu::ComputePipeline _instance;
37
+ std::string _label;
38
+ };
39
+ } // namespace rnwgpu
@@ -0,0 +1,12 @@
1
+ #include "GPUDevice.h"
2
+
3
+ namespace rnwgpu {
4
+
5
+ std::shared_ptr<GPUBuffer>
6
+ GPUDevice::createBuffer(std::shared_ptr<GPUBufferDescriptor> descriptor) {
7
+ auto aDescriptor = descriptor->getInstance();
8
+ auto result = _instance.CreateBuffer(aDescriptor);
9
+ return std::make_shared<GPUBuffer>(result, descriptor->label);
10
+ }
11
+
12
+ } // namespace rnwgpu
@@ -0,0 +1,45 @@
1
+ #pragma once
2
+
3
+ #include <future>
4
+ #include <memory>
5
+ #include <string>
6
+
7
+ #include "Unions.h"
8
+ #include <RNFHybridObject.h>
9
+
10
+ #include "MutableBuffer.h"
11
+
12
+ #include "webgpu/webgpu_cpp.h"
13
+
14
+ #include "GPUBuffer.h"
15
+ #include "GPUBufferDescriptor.h"
16
+
17
+ namespace rnwgpu {
18
+
19
+ namespace m = margelo;
20
+
21
+ class GPUDevice : public m::HybridObject {
22
+ public:
23
+ explicit GPUDevice(wgpu::Device instance, std::string label)
24
+ : HybridObject("GPUDevice"), _instance(instance), _label(label) {}
25
+
26
+ public:
27
+ std::string getBrand() { return _name; }
28
+
29
+ std::shared_ptr<GPUBuffer>
30
+ createBuffer(std::shared_ptr<GPUBufferDescriptor> descriptor);
31
+
32
+ std::string getLabel() { return _label; }
33
+
34
+ void loadHybridMethods() override {
35
+ registerHybridGetter("__brand", &GPUDevice::getBrand, this);
36
+ registerHybridMethod("createBuffer", &GPUDevice::createBuffer, this);
37
+
38
+ registerHybridGetter("label", &GPUDevice::getLabel, this);
39
+ }
40
+
41
+ private:
42
+ wgpu::Device _instance;
43
+ std::string _label;
44
+ };
45
+ } // namespace rnwgpu
@@ -0,0 +1,33 @@
1
+ #pragma once
2
+
3
+ #include <future>
4
+ #include <memory>
5
+ #include <string>
6
+
7
+ #include "Unions.h"
8
+ #include <RNFHybridObject.h>
9
+
10
+ #include "MutableBuffer.h"
11
+
12
+ #include "webgpu/webgpu_cpp.h"
13
+
14
+ namespace rnwgpu {
15
+
16
+ namespace m = margelo;
17
+
18
+ class GPUDeviceLostInfo : public m::HybridObject {
19
+ public:
20
+ explicit GPUDeviceLostInfo(wgpu::DeviceLostInfo instance)
21
+ : HybridObject("GPUDeviceLostInfo"), _instance(instance) {}
22
+
23
+ public:
24
+ std::string getBrand() { return _name; }
25
+
26
+ void loadHybridMethods() override {
27
+ registerHybridGetter("__brand", &GPUDeviceLostInfo::getBrand, this);
28
+ }
29
+
30
+ private:
31
+ wgpu::DeviceLostInfo _instance;
32
+ };
33
+ } // namespace rnwgpu
@@ -0,0 +1,39 @@
1
+ #pragma once
2
+
3
+ #include <future>
4
+ #include <memory>
5
+ #include <string>
6
+
7
+ #include "Unions.h"
8
+ #include <RNFHybridObject.h>
9
+
10
+ #include "MutableBuffer.h"
11
+
12
+ #include "webgpu/webgpu_cpp.h"
13
+
14
+ namespace rnwgpu {
15
+
16
+ namespace m = margelo;
17
+
18
+ class GPUExternalTexture : public m::HybridObject {
19
+ public:
20
+ explicit GPUExternalTexture(wgpu::ExternalTexture instance, std::string label)
21
+ : HybridObject("GPUExternalTexture"), _instance(instance), _label(label) {
22
+ }
23
+
24
+ public:
25
+ std::string getBrand() { return _name; }
26
+
27
+ std::string getLabel() { return _label; }
28
+
29
+ void loadHybridMethods() override {
30
+ registerHybridGetter("__brand", &GPUExternalTexture::getBrand, this);
31
+
32
+ registerHybridGetter("label", &GPUExternalTexture::getLabel, this);
33
+ }
34
+
35
+ private:
36
+ wgpu::ExternalTexture _instance;
37
+ std::string _label;
38
+ };
39
+ } // namespace rnwgpu
@@ -0,0 +1,38 @@
1
+ #pragma once
2
+
3
+ #include <future>
4
+ #include <memory>
5
+ #include <string>
6
+
7
+ #include "Unions.h"
8
+ #include <RNFHybridObject.h>
9
+
10
+ #include "MutableBuffer.h"
11
+
12
+ #include "webgpu/webgpu_cpp.h"
13
+
14
+ namespace rnwgpu {
15
+
16
+ namespace m = margelo;
17
+
18
+ class GPUPipelineLayout : public m::HybridObject {
19
+ public:
20
+ explicit GPUPipelineLayout(wgpu::PipelineLayout instance, std::string label)
21
+ : HybridObject("GPUPipelineLayout"), _instance(instance), _label(label) {}
22
+
23
+ public:
24
+ std::string getBrand() { return _name; }
25
+
26
+ std::string getLabel() { return _label; }
27
+
28
+ void loadHybridMethods() override {
29
+ registerHybridGetter("__brand", &GPUPipelineLayout::getBrand, this);
30
+
31
+ registerHybridGetter("label", &GPUPipelineLayout::getLabel, this);
32
+ }
33
+
34
+ private:
35
+ wgpu::PipelineLayout _instance;
36
+ std::string _label;
37
+ };
38
+ } // namespace rnwgpu
@@ -0,0 +1,38 @@
1
+ #pragma once
2
+
3
+ #include <future>
4
+ #include <memory>
5
+ #include <string>
6
+
7
+ #include "Unions.h"
8
+ #include <RNFHybridObject.h>
9
+
10
+ #include "MutableBuffer.h"
11
+
12
+ #include "webgpu/webgpu_cpp.h"
13
+
14
+ namespace rnwgpu {
15
+
16
+ namespace m = margelo;
17
+
18
+ class GPUQuerySet : public m::HybridObject {
19
+ public:
20
+ explicit GPUQuerySet(wgpu::QuerySet instance, std::string label)
21
+ : HybridObject("GPUQuerySet"), _instance(instance), _label(label) {}
22
+
23
+ public:
24
+ std::string getBrand() { return _name; }
25
+
26
+ std::string getLabel() { return _label; }
27
+
28
+ void loadHybridMethods() override {
29
+ registerHybridGetter("__brand", &GPUQuerySet::getBrand, this);
30
+
31
+ registerHybridGetter("label", &GPUQuerySet::getLabel, this);
32
+ }
33
+
34
+ private:
35
+ wgpu::QuerySet _instance;
36
+ std::string _label;
37
+ };
38
+ } // namespace rnwgpu
@@ -0,0 +1,38 @@
1
+ #pragma once
2
+
3
+ #include <future>
4
+ #include <memory>
5
+ #include <string>
6
+
7
+ #include "Unions.h"
8
+ #include <RNFHybridObject.h>
9
+
10
+ #include "MutableBuffer.h"
11
+
12
+ #include "webgpu/webgpu_cpp.h"
13
+
14
+ namespace rnwgpu {
15
+
16
+ namespace m = margelo;
17
+
18
+ class GPUQueue : public m::HybridObject {
19
+ public:
20
+ explicit GPUQueue(wgpu::Queue instance, std::string label)
21
+ : HybridObject("GPUQueue"), _instance(instance), _label(label) {}
22
+
23
+ public:
24
+ std::string getBrand() { return _name; }
25
+
26
+ std::string getLabel() { return _label; }
27
+
28
+ void loadHybridMethods() override {
29
+ registerHybridGetter("__brand", &GPUQueue::getBrand, this);
30
+
31
+ registerHybridGetter("label", &GPUQueue::getLabel, this);
32
+ }
33
+
34
+ private:
35
+ wgpu::Queue _instance;
36
+ std::string _label;
37
+ };
38
+ } // namespace rnwgpu
@@ -0,0 +1,38 @@
1
+ #pragma once
2
+
3
+ #include <future>
4
+ #include <memory>
5
+ #include <string>
6
+
7
+ #include "Unions.h"
8
+ #include <RNFHybridObject.h>
9
+
10
+ #include "MutableBuffer.h"
11
+
12
+ #include "webgpu/webgpu_cpp.h"
13
+
14
+ namespace rnwgpu {
15
+
16
+ namespace m = margelo;
17
+
18
+ class GPURenderBundle : public m::HybridObject {
19
+ public:
20
+ explicit GPURenderBundle(wgpu::RenderBundle instance, std::string label)
21
+ : HybridObject("GPURenderBundle"), _instance(instance), _label(label) {}
22
+
23
+ public:
24
+ std::string getBrand() { return _name; }
25
+
26
+ std::string getLabel() { return _label; }
27
+
28
+ void loadHybridMethods() override {
29
+ registerHybridGetter("__brand", &GPURenderBundle::getBrand, this);
30
+
31
+ registerHybridGetter("label", &GPURenderBundle::getLabel, this);
32
+ }
33
+
34
+ private:
35
+ wgpu::RenderBundle _instance;
36
+ std::string _label;
37
+ };
38
+ } // namespace rnwgpu
@@ -0,0 +1,40 @@
1
+ #pragma once
2
+
3
+ #include <future>
4
+ #include <memory>
5
+ #include <string>
6
+
7
+ #include "Unions.h"
8
+ #include <RNFHybridObject.h>
9
+
10
+ #include "MutableBuffer.h"
11
+
12
+ #include "webgpu/webgpu_cpp.h"
13
+
14
+ namespace rnwgpu {
15
+
16
+ namespace m = margelo;
17
+
18
+ class GPURenderBundleEncoder : public m::HybridObject {
19
+ public:
20
+ explicit GPURenderBundleEncoder(wgpu::RenderBundleEncoder instance,
21
+ std::string label)
22
+ : HybridObject("GPURenderBundleEncoder"), _instance(instance),
23
+ _label(label) {}
24
+
25
+ public:
26
+ std::string getBrand() { return _name; }
27
+
28
+ std::string getLabel() { return _label; }
29
+
30
+ void loadHybridMethods() override {
31
+ registerHybridGetter("__brand", &GPURenderBundleEncoder::getBrand, this);
32
+
33
+ registerHybridGetter("label", &GPURenderBundleEncoder::getLabel, this);
34
+ }
35
+
36
+ private:
37
+ wgpu::RenderBundleEncoder _instance;
38
+ std::string _label;
39
+ };
40
+ } // namespace rnwgpu
@@ -0,0 +1,40 @@
1
+ #pragma once
2
+
3
+ #include <future>
4
+ #include <memory>
5
+ #include <string>
6
+
7
+ #include "Unions.h"
8
+ #include <RNFHybridObject.h>
9
+
10
+ #include "MutableBuffer.h"
11
+
12
+ #include "webgpu/webgpu_cpp.h"
13
+
14
+ namespace rnwgpu {
15
+
16
+ namespace m = margelo;
17
+
18
+ class GPURenderPassEncoder : public m::HybridObject {
19
+ public:
20
+ explicit GPURenderPassEncoder(wgpu::RenderPassEncoder instance,
21
+ std::string label)
22
+ : HybridObject("GPURenderPassEncoder"), _instance(instance),
23
+ _label(label) {}
24
+
25
+ public:
26
+ std::string getBrand() { return _name; }
27
+
28
+ std::string getLabel() { return _label; }
29
+
30
+ void loadHybridMethods() override {
31
+ registerHybridGetter("__brand", &GPURenderPassEncoder::getBrand, this);
32
+
33
+ registerHybridGetter("label", &GPURenderPassEncoder::getLabel, this);
34
+ }
35
+
36
+ private:
37
+ wgpu::RenderPassEncoder _instance;
38
+ std::string _label;
39
+ };
40
+ } // namespace rnwgpu