react-native-wgpu 0.1.0 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +221 -13
- package/android/CMakeLists.txt +15 -1
- package/android/build.gradle +0 -18
- package/android/cpp/AndroidPlatformContext.h +132 -0
- package/android/cpp/cpp-adapter.cpp +70 -4
- package/android/src/main/java/com/webgpu/WebGPUModule.java +69 -21
- package/android/src/main/java/com/webgpu/WebGPUView.java +63 -8
- package/android/src/main/java/com/webgpu/WebGPUViewManager.java +5 -6
- package/android/src/newarch/{WgpuViewManagerSpec.java → com/webgpu/WebGPUViewManagerSpec.java} +5 -5
- package/android/src/oldarch/com/webgpu/NativeWebGPUModuleSpec.java +23 -0
- package/android/src/oldarch/{WebGPUViewManagerSpec.java → com/webgpu/WebGPUViewManagerSpec.java} +1 -1
- package/cpp/{Logger.h → WGPULogger.h} +13 -6
- package/cpp/dawn/webgpu.h +9 -0
- package/cpp/dawn/webgpu_cpp.h +95 -43
- package/cpp/dawn/webgpu_cpp_print.h +6 -0
- package/cpp/dawn/wire/client/webgpu_cpp.h +80 -43
- package/cpp/jsi/RNFHybridObject.cpp +1 -1
- package/cpp/jsi/RNFHybridObject.h +4 -4
- package/cpp/jsi/RNFJSIConverter.h +204 -17
- package/cpp/rnwgpu/ArrayBuffer.h +72 -0
- package/cpp/rnwgpu/PlatformContext.h +29 -0
- package/cpp/rnwgpu/RNWebGPUManager.cpp +13 -11
- package/cpp/rnwgpu/RNWebGPUManager.h +9 -1
- package/cpp/rnwgpu/SurfaceRegistry.h +36 -0
- package/cpp/rnwgpu/api/AsyncRunner.h +30 -0
- package/cpp/rnwgpu/api/Canvas.h +55 -0
- package/cpp/rnwgpu/api/Convertors.h +765 -0
- package/cpp/rnwgpu/api/External.h +12 -0
- package/cpp/rnwgpu/api/GPU.cpp +81 -23
- package/cpp/rnwgpu/api/GPU.h +24 -6
- package/cpp/rnwgpu/api/GPUAdapter.cpp +138 -24
- package/cpp/rnwgpu/api/GPUAdapter.h +24 -5
- package/cpp/rnwgpu/api/GPUAdapterInfo.h +19 -7
- package/cpp/rnwgpu/api/GPUBindGroup.cpp +3 -0
- package/cpp/rnwgpu/api/GPUBindGroup.h +11 -4
- package/cpp/rnwgpu/api/GPUBindGroupLayout.h +11 -4
- package/cpp/rnwgpu/api/GPUBuffer.cpp +82 -7
- package/cpp/rnwgpu/api/GPUBuffer.h +44 -8
- package/cpp/rnwgpu/api/GPUCanvasContext.cpp +63 -0
- package/cpp/rnwgpu/api/GPUCanvasContext.h +51 -8
- package/cpp/rnwgpu/api/GPUCommandBuffer.h +11 -4
- package/cpp/rnwgpu/api/GPUCommandEncoder.cpp +177 -0
- package/cpp/rnwgpu/api/GPUCommandEncoder.h +75 -3
- package/cpp/rnwgpu/api/GPUCompilationInfo.h +65 -8
- package/cpp/rnwgpu/api/GPUCompilationMessage.h +6 -4
- package/cpp/rnwgpu/api/GPUComputePassEncoder.cpp +58 -0
- package/cpp/rnwgpu/api/GPUComputePassEncoder.h +49 -3
- package/cpp/rnwgpu/api/GPUComputePipeline.cpp +11 -0
- package/cpp/rnwgpu/api/GPUComputePipeline.h +18 -3
- package/cpp/rnwgpu/api/GPUDevice.cpp +330 -3
- package/cpp/rnwgpu/api/GPUDevice.h +119 -5
- package/cpp/rnwgpu/api/GPUDeviceLostInfo.cpp +6 -0
- package/cpp/rnwgpu/api/GPUDeviceLostInfo.h +14 -7
- package/cpp/rnwgpu/api/GPUError.h +42 -0
- package/cpp/rnwgpu/api/GPUExtent3D.h +69 -0
- package/cpp/rnwgpu/api/GPUExternalTexture.h +11 -4
- package/cpp/rnwgpu/api/GPUFeatures.h +221 -0
- package/cpp/rnwgpu/api/GPUOrigin2D.h +59 -0
- package/cpp/rnwgpu/api/GPUOrigin3D.h +66 -0
- package/cpp/rnwgpu/api/GPUPipelineLayout.h +11 -4
- package/cpp/rnwgpu/api/GPUQuerySet.cpp +11 -0
- package/cpp/rnwgpu/api/GPUQuerySet.h +19 -5
- package/cpp/rnwgpu/api/GPUQueue.cpp +153 -0
- package/cpp/rnwgpu/api/GPUQueue.h +45 -4
- package/cpp/rnwgpu/api/GPURenderBundle.h +11 -4
- package/cpp/rnwgpu/api/GPURenderBundleEncoder.cpp +128 -0
- package/cpp/rnwgpu/api/GPURenderBundleEncoder.h +72 -3
- package/cpp/rnwgpu/api/GPURenderPassEncoder.cpp +161 -0
- package/cpp/rnwgpu/api/GPURenderPassEncoder.h +93 -3
- package/cpp/rnwgpu/api/GPURenderPipeline.cpp +13 -0
- package/cpp/rnwgpu/api/GPURenderPipeline.h +18 -3
- package/cpp/rnwgpu/api/GPUSampler.h +11 -4
- package/cpp/rnwgpu/api/GPUShaderModule.cpp +39 -0
- package/cpp/rnwgpu/api/GPUShaderModule.h +23 -4
- package/cpp/rnwgpu/api/GPUSupportedLimits.cpp +133 -0
- package/cpp/rnwgpu/api/GPUSupportedLimits.h +128 -4
- package/cpp/rnwgpu/api/GPUTexture.cpp +47 -0
- package/cpp/rnwgpu/api/GPUTexture.h +38 -4
- package/cpp/rnwgpu/api/GPUTextureView.h +11 -4
- package/cpp/rnwgpu/api/ImageBitmap.h +34 -0
- package/cpp/rnwgpu/api/RNWebGPU.h +100 -0
- package/cpp/rnwgpu/api/WebGPUCanvasContextFactory.h +59 -0
- package/cpp/rnwgpu/api/descriptors/GPUBindGroupDescriptor.h +31 -43
- package/cpp/rnwgpu/api/descriptors/GPUBindGroupEntry.h +40 -31
- package/cpp/rnwgpu/api/descriptors/GPUBindGroupLayoutDescriptor.h +24 -32
- package/cpp/rnwgpu/api/descriptors/GPUBindGroupLayoutEntry.h +56 -49
- package/cpp/rnwgpu/api/descriptors/GPUBlendComponent.h +27 -20
- package/cpp/rnwgpu/api/descriptors/GPUBlendState.h +23 -31
- package/cpp/rnwgpu/api/descriptors/GPUBufferBinding.h +25 -36
- package/cpp/rnwgpu/api/descriptors/GPUBufferBindingLayout.h +25 -25
- package/cpp/rnwgpu/api/descriptors/GPUBufferDescriptor.h +26 -46
- package/cpp/rnwgpu/api/descriptors/GPUCanvasConfiguration.h +31 -53
- package/cpp/rnwgpu/api/descriptors/GPUColor.h +72 -0
- package/cpp/rnwgpu/api/descriptors/GPUColorTargetState.h +27 -33
- package/cpp/rnwgpu/api/descriptors/GPUCommandBufferDescriptor.h +51 -0
- package/cpp/rnwgpu/api/descriptors/GPUCommandEncoderDescriptor.h +51 -0
- package/cpp/rnwgpu/api/descriptors/GPUComputePassDescriptor.h +24 -25
- package/cpp/rnwgpu/api/descriptors/GPUComputePassTimestampWrites.h +25 -42
- package/cpp/rnwgpu/api/descriptors/GPUComputePipelineDescriptor.h +32 -42
- package/cpp/rnwgpu/api/descriptors/GPUDepthStencilState.h +58 -76
- package/cpp/rnwgpu/api/descriptors/GPUDeviceDescriptor.h +38 -30
- package/cpp/rnwgpu/api/descriptors/GPUExternalTextureBindingLayout.h +11 -11
- package/cpp/rnwgpu/api/descriptors/GPUExternalTextureDescriptor.h +43 -34
- package/cpp/rnwgpu/api/descriptors/GPUFragmentState.h +39 -46
- package/cpp/rnwgpu/api/descriptors/GPUImageCopyBuffer.h +29 -45
- package/cpp/rnwgpu/api/descriptors/GPUImageCopyExternalImage.h +32 -31
- package/cpp/rnwgpu/api/descriptors/GPUImageCopyTexture.h +32 -36
- package/cpp/rnwgpu/api/descriptors/GPUImageCopyTextureTagged.h +42 -44
- package/cpp/rnwgpu/api/descriptors/GPUImageDataLayout.h +24 -34
- package/cpp/rnwgpu/api/descriptors/GPUMultisampleState.h +24 -32
- package/cpp/rnwgpu/api/descriptors/GPUPipelineLayoutDescriptor.h +25 -35
- package/cpp/rnwgpu/api/descriptors/GPUPrimitiveState.h +35 -26
- package/cpp/rnwgpu/api/descriptors/GPUProgrammableStage.h +29 -35
- package/cpp/rnwgpu/api/descriptors/GPUQuerySetDescriptor.h +23 -43
- package/cpp/rnwgpu/api/descriptors/GPUQueueDescriptor.h +49 -0
- package/cpp/rnwgpu/api/descriptors/GPURenderBundleDescriptor.h +51 -0
- package/cpp/rnwgpu/api/descriptors/GPURenderBundleEncoderDescriptor.h +41 -57
- package/cpp/rnwgpu/api/descriptors/GPURenderPassColorAttachment.h +42 -61
- package/cpp/rnwgpu/api/descriptors/GPURenderPassDepthStencilAttachment.h +54 -66
- package/cpp/rnwgpu/api/descriptors/GPURenderPassDescriptor.h +52 -55
- package/cpp/rnwgpu/api/descriptors/GPURenderPassTimestampWrites.h +25 -42
- package/cpp/rnwgpu/api/descriptors/GPURenderPipelineDescriptor.h +60 -56
- package/cpp/rnwgpu/api/descriptors/GPURequestAdapterOptions.h +21 -20
- package/cpp/rnwgpu/api/descriptors/GPUSamplerBindingLayout.h +17 -14
- package/cpp/rnwgpu/api/descriptors/GPUSamplerDescriptor.h +63 -63
- package/cpp/rnwgpu/api/descriptors/GPUShaderModuleCompilationHint.h +28 -27
- package/cpp/rnwgpu/api/descriptors/GPUShaderModuleDescriptor.h +28 -49
- package/cpp/rnwgpu/api/descriptors/GPUStencilFaceState.h +32 -23
- package/cpp/rnwgpu/api/descriptors/GPUStorageTextureBindingLayout.h +27 -29
- package/cpp/rnwgpu/api/descriptors/GPUTextureBindingLayout.h +27 -20
- package/cpp/rnwgpu/api/descriptors/GPUTextureDescriptor.h +49 -76
- package/cpp/rnwgpu/api/descriptors/GPUTextureViewDescriptor.h +48 -64
- package/cpp/rnwgpu/api/descriptors/GPUUncapturedErrorEventInit.h +29 -31
- package/cpp/rnwgpu/api/descriptors/GPUVertexAttribute.h +23 -44
- package/cpp/rnwgpu/api/descriptors/GPUVertexBufferLayout.h +30 -36
- package/cpp/rnwgpu/api/descriptors/GPUVertexState.h +39 -38
- package/cpp/rnwgpu/api/descriptors/Unions.h +57 -2
- package/ios/IOSPlatformContext.h +19 -0
- package/ios/IOSPlatformContext.mm +68 -0
- package/ios/MetalView.h +10 -0
- package/ios/MetalView.mm +27 -0
- package/ios/SurfaceUtils.h +13 -0
- package/ios/SurfaceUtils.mm +24 -0
- package/ios/WebGPUModule.h +8 -7
- package/ios/WebGPUModule.mm +47 -14
- package/ios/WebGPUView.h +6 -3
- package/ios/WebGPUView.mm +36 -24
- package/ios/WebGPUViewComponentDescriptor.h +61 -0
- package/ios/WebGPUViewManager.mm +6 -4
- package/lib/commonjs/Canvas.js +47 -0
- package/lib/commonjs/Canvas.js.map +1 -0
- package/lib/commonjs/{WebGPUNativeModule.js → NativeWebGPUModule.js} +1 -1
- package/lib/commonjs/{WebGPUNativeModule.js.map → NativeWebGPUModule.js.map} +1 -1
- package/lib/commonjs/WebGPUView.js +2 -0
- package/lib/commonjs/WebGPUView.js.map +1 -0
- package/lib/commonjs/WebGPUViewNativeComponent.js.map +1 -1
- package/lib/commonjs/index.js +183 -19
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/utils.js +39 -0
- package/lib/commonjs/utils.js.map +1 -0
- package/lib/module/Canvas.js +40 -0
- package/lib/module/Canvas.js.map +1 -0
- package/lib/module/{WebGPUNativeModule.js → NativeWebGPUModule.js} +1 -1
- package/lib/module/NativeWebGPUModule.js.map +1 -0
- package/lib/module/WebGPUView.js +2 -0
- package/lib/module/WebGPUView.js.map +1 -0
- package/lib/module/WebGPUViewNativeComponent.js.map +1 -1
- package/lib/module/index.js +158 -6
- package/lib/module/index.js.map +1 -1
- package/lib/module/utils.js +31 -0
- package/lib/module/utils.js.map +1 -0
- package/lib/typescript/example/src/Triangle/triangle.d.ts +3 -0
- package/lib/typescript/example/src/Triangle/triangle.d.ts.map +1 -0
- package/lib/typescript/example/src/Wireframe/Shaders.d.ts +3 -0
- package/lib/typescript/example/src/Wireframe/Shaders.d.ts.map +1 -0
- package/lib/typescript/example/src/Wireframe/models.d.ts +29 -0
- package/lib/typescript/example/src/Wireframe/models.d.ts.map +1 -0
- package/lib/typescript/example/src/components/DrawingContext.d.ts +13 -0
- package/lib/typescript/example/src/components/DrawingContext.d.ts.map +1 -0
- package/lib/typescript/example/src/components/cube.d.ts +7 -0
- package/lib/typescript/example/src/components/cube.d.ts.map +1 -0
- package/lib/typescript/example/src/components/meshes/sphere.d.ts +12 -0
- package/lib/typescript/example/src/components/meshes/sphere.d.ts.map +1 -0
- package/lib/typescript/example/src/components/meshes/teapot.d.ts +6 -0
- package/lib/typescript/example/src/components/meshes/teapot.d.ts.map +1 -0
- package/lib/typescript/example/src/components/meshes/utils.d.ts +10 -0
- package/lib/typescript/example/src/components/meshes/utils.d.ts.map +1 -0
- package/lib/typescript/jest.config.d.ts +4 -0
- package/lib/typescript/lib/commonjs/Canvas.d.ts +4 -0
- package/lib/typescript/lib/commonjs/Canvas.d.ts.map +1 -0
- package/lib/typescript/lib/commonjs/{WebGPUNativeModule.d.ts → NativeWebGPUModule.d.ts} +1 -1
- package/lib/typescript/lib/commonjs/NativeWebGPUModule.d.ts.map +1 -0
- package/lib/typescript/lib/commonjs/WebGPUView.d.ts +1 -0
- package/lib/typescript/lib/commonjs/WebGPUView.d.ts.map +1 -0
- package/lib/typescript/lib/commonjs/index.d.ts +0 -2
- package/lib/typescript/lib/commonjs/utils.d.ts +5 -0
- package/lib/typescript/lib/commonjs/utils.d.ts.map +1 -0
- package/lib/typescript/lib/module/Canvas.d.ts +2 -0
- package/lib/typescript/lib/module/Canvas.d.ts.map +1 -0
- package/lib/typescript/lib/module/{WebGPUNativeModule.d.ts → NativeWebGPUModule.d.ts} +1 -1
- package/lib/typescript/lib/module/NativeWebGPUModule.d.ts.map +1 -0
- package/lib/typescript/lib/module/WebGPUView.d.ts +1 -0
- package/lib/typescript/lib/module/WebGPUView.d.ts.map +1 -0
- package/lib/typescript/lib/module/index.d.ts +3 -3
- package/lib/typescript/lib/module/utils.d.ts +3 -0
- package/lib/typescript/lib/module/utils.d.ts.map +1 -0
- package/lib/typescript/src/Canvas.d.ts +29 -0
- package/lib/typescript/src/Canvas.d.ts.map +1 -0
- package/lib/typescript/src/{WebGPUNativeModule.d.ts → NativeWebGPUModule.d.ts} +2 -1
- package/lib/typescript/src/NativeWebGPUModule.d.ts.map +1 -0
- package/lib/typescript/src/WebGPUView.d.ts +1 -0
- package/lib/typescript/src/WebGPUView.d.ts.map +1 -0
- package/lib/typescript/src/WebGPUViewNativeComponent.d.ts +2 -1
- package/lib/typescript/src/WebGPUViewNativeComponent.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +3 -7
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/utils.d.ts +7 -0
- package/lib/typescript/src/utils.d.ts.map +1 -0
- package/libs/android/arm64-v8a/libwebgpu_dawn.so +0 -0
- package/libs/android/armeabi-v7a/libwebgpu_dawn.so +0 -0
- package/libs/android/x86/libwebgpu_dawn.so +0 -0
- package/libs/android/x86_64/libwebgpu_dawn.so +0 -0
- package/libs/dawn.json +4597 -0
- package/libs/ios/arm64_iphoneos/libwebgpu_dawn.a +0 -0
- package/libs/ios/arm64_iphonesimulator/libwebgpu_dawn.a +0 -0
- package/libs/ios/libwebgpu_dawn.a +0 -0
- package/libs/ios/libwebgpu_dawn.xcframework/Info.plist +44 -0
- package/libs/ios/libwebgpu_dawn.xcframework/ios-arm64/libwebgpu_dawn.a +0 -0
- package/libs/ios/libwebgpu_dawn.xcframework/ios-arm64_x86_64-simulator/libwebgpu_dawn.a +0 -0
- package/libs/ios/x86_64_iphonesimulator/libwebgpu_dawn.a +0 -0
- package/package.json +25 -8
- package/{react-native-webgpu.podspec → react-native-wgpu.podspec} +6 -9
- package/src/Canvas.tsx +73 -0
- package/src/{WebGPUNativeModule.ts → NativeWebGPUModule.ts} +1 -0
- package/src/WebGPUView.tsx +0 -0
- package/src/WebGPUViewNativeComponent.ts +2 -1
- package/src/index.tsx +191 -8
- package/src/utils.ts +40 -0
- package/android/src/main/AndroidManifestNew.xml +0 -2
- package/cpp/rnwgpu/MutableBuffer.h +0 -48
- package/cpp/rnwgpu/api/GPUUncapturedErrorEvent.h +0 -33
- package/cpp/rnwgpu/api/descriptors/GPUColorDict.h +0 -81
- package/cpp/rnwgpu/api/descriptors/GPUExtent3DDict.h +0 -76
- package/cpp/rnwgpu/api/descriptors/GPUExtent3DDictStrict.h +0 -91
- package/cpp/rnwgpu/api/descriptors/GPUOrigin2DDict.h +0 -61
- package/cpp/rnwgpu/api/descriptors/GPUOrigin2DDictStrict.h +0 -75
- package/cpp/rnwgpu/api/descriptors/GPUOrigin3DDict.h +0 -71
- package/cpp/rnwgpu/api/descriptors/GPUPipelineErrorInit.h +0 -54
- package/cpp/rnwgpu/api/descriptors/GPURenderPassLayout.h +0 -83
- package/ios/RNFAppleLogger.mm +0 -22
- package/ios/Utils.h +0 -5
- package/ios/Utils.m +0 -26
- package/lib/module/WebGPUNativeModule.js.map +0 -1
- package/lib/typescript/lib/commonjs/WebGPUNativeModule.d.ts.map +0 -1
- package/lib/typescript/lib/module/WebGPUNativeModule.d.ts.map +0 -1
- package/lib/typescript/scripts/build/copy-artifacts.d.ts +0 -2
- package/lib/typescript/scripts/build/copy-artifacts.d.ts.map +0 -1
- package/lib/typescript/scripts/build/dawn.d.ts +0 -2
- package/lib/typescript/scripts/build/dawn.d.ts.map +0 -1
- package/lib/typescript/scripts/build/util.d.ts +0 -13
- package/lib/typescript/scripts/build/util.d.ts.map +0 -1
- package/lib/typescript/scripts/codegen/codegen.d.ts +0 -2
- package/lib/typescript/scripts/codegen/codegen.d.ts.map +0 -1
- package/lib/typescript/scripts/codegen/model/dawn.d.ts +0 -2
- package/lib/typescript/scripts/codegen/model/dawn.d.ts.map +0 -1
- package/lib/typescript/scripts/codegen/model/model.d.ts +0 -8
- package/lib/typescript/scripts/codegen/model/model.d.ts.map +0 -1
- package/lib/typescript/scripts/codegen/templates/Descriptor.d.ts +0 -4
- package/lib/typescript/scripts/codegen/templates/Descriptor.d.ts.map +0 -1
- package/lib/typescript/scripts/codegen/templates/Enum.d.ts +0 -3
- package/lib/typescript/scripts/codegen/templates/Enum.d.ts.map +0 -1
- package/lib/typescript/scripts/codegen/templates/HybridObject.d.ts +0 -3
- package/lib/typescript/scripts/codegen/templates/HybridObject.d.ts.map +0 -1
- package/lib/typescript/scripts/codegen/templates/Unions.d.ts +0 -6
- package/lib/typescript/scripts/codegen/templates/Unions.d.ts.map +0 -1
- package/lib/typescript/scripts/codegen/templates/common.d.ts +0 -9
- package/lib/typescript/scripts/codegen/templates/common.d.ts.map +0 -1
- package/lib/typescript/scripts/codegen/util.d.ts +0 -2
- package/lib/typescript/scripts/codegen/util.d.ts.map +0 -1
- package/lib/typescript/src/WebGPUNativeModule.d.ts.map +0 -1
|
@@ -2,29 +2,44 @@
|
|
|
2
2
|
|
|
3
3
|
#include <memory>
|
|
4
4
|
#include <string>
|
|
5
|
+
#include <variant>
|
|
6
|
+
#include <vector>
|
|
5
7
|
|
|
6
8
|
#include "webgpu/webgpu_cpp.h"
|
|
7
9
|
|
|
8
|
-
#include "Logger.h"
|
|
9
10
|
#include "RNFJSIConverter.h"
|
|
10
|
-
#include
|
|
11
|
+
#include "WGPULogger.h"
|
|
12
|
+
|
|
13
|
+
#include "GPUQuerySet.h"
|
|
14
|
+
#include "GPURenderPassColorAttachment.h"
|
|
15
|
+
#include "GPURenderPassDepthStencilAttachment.h"
|
|
16
|
+
#include "GPURenderPassTimestampWrites.h"
|
|
17
|
+
#include "RNFHybridObject.h"
|
|
11
18
|
|
|
12
19
|
namespace jsi = facebook::jsi;
|
|
20
|
+
namespace m = margelo;
|
|
13
21
|
|
|
14
22
|
namespace rnwgpu {
|
|
15
23
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
std::
|
|
24
|
+
struct GPURenderPassDescriptor {
|
|
25
|
+
std::vector<std::variant<std::nullptr_t,
|
|
26
|
+
std::shared_ptr<GPURenderPassColorAttachment>>>
|
|
27
|
+
colorAttachments; // Iterable<GPURenderPassColorAttachment | null>
|
|
28
|
+
std::optional<std::shared_ptr<GPURenderPassDepthStencilAttachment>>
|
|
29
|
+
depthStencilAttachment; // GPURenderPassDepthStencilAttachment
|
|
30
|
+
std::optional<std::shared_ptr<GPUQuerySet>> occlusionQuerySet; // GPUQuerySet
|
|
31
|
+
std::optional<std::shared_ptr<GPURenderPassTimestampWrites>>
|
|
32
|
+
timestampWrites; // GPURenderPassTimestampWrites
|
|
33
|
+
std::optional<double> maxDrawCount; // GPUSize64
|
|
34
|
+
std::optional<std::string> label; // string
|
|
23
35
|
};
|
|
36
|
+
|
|
24
37
|
} // namespace rnwgpu
|
|
25
38
|
|
|
26
39
|
namespace margelo {
|
|
27
40
|
|
|
41
|
+
using namespace rnwgpu; // NOLINT(build/namespaces)
|
|
42
|
+
|
|
28
43
|
template <>
|
|
29
44
|
struct JSIConverter<std::shared_ptr<rnwgpu::GPURenderPassDescriptor>> {
|
|
30
45
|
static std::shared_ptr<rnwgpu::GPURenderPassDescriptor>
|
|
@@ -33,68 +48,50 @@ struct JSIConverter<std::shared_ptr<rnwgpu::GPURenderPassDescriptor>> {
|
|
|
33
48
|
if (!outOfBounds && arg.isObject()) {
|
|
34
49
|
auto value = arg.getObject(runtime);
|
|
35
50
|
if (value.hasProperty(runtime, "colorAttachments")) {
|
|
36
|
-
auto
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
"Property GPURenderPassDescriptor::colorAttachments is required");
|
|
41
|
-
}
|
|
42
|
-
} else {
|
|
43
|
-
throw std::runtime_error(
|
|
44
|
-
"Property GPURenderPassDescriptor::colorAttachments is not "
|
|
45
|
-
"defined");
|
|
51
|
+
auto prop = value.getProperty(runtime, "colorAttachments");
|
|
52
|
+
result->colorAttachments = JSIConverter<std::vector<std::variant<
|
|
53
|
+
std::nullptr_t, std::shared_ptr<GPURenderPassColorAttachment>>>>::
|
|
54
|
+
fromJSI(runtime, prop, false);
|
|
46
55
|
}
|
|
47
56
|
if (value.hasProperty(runtime, "depthStencilAttachment")) {
|
|
48
|
-
auto
|
|
49
|
-
|
|
57
|
+
auto prop = value.getProperty(runtime, "depthStencilAttachment");
|
|
58
|
+
result->depthStencilAttachment =
|
|
59
|
+
JSIConverter<std::optional<std::shared_ptr<
|
|
60
|
+
GPURenderPassDepthStencilAttachment>>>::fromJSI(runtime, prop,
|
|
61
|
+
false);
|
|
50
62
|
}
|
|
51
63
|
if (value.hasProperty(runtime, "occlusionQuerySet")) {
|
|
52
|
-
auto
|
|
53
|
-
|
|
64
|
+
auto prop = value.getProperty(runtime, "occlusionQuerySet");
|
|
65
|
+
result->occlusionQuerySet =
|
|
66
|
+
JSIConverter<std::optional<std::shared_ptr<GPUQuerySet>>>::fromJSI(
|
|
67
|
+
runtime, prop, false);
|
|
54
68
|
}
|
|
55
69
|
if (value.hasProperty(runtime, "timestampWrites")) {
|
|
56
|
-
auto
|
|
70
|
+
auto prop = value.getProperty(runtime, "timestampWrites");
|
|
71
|
+
result->timestampWrites = JSIConverter<std::optional<
|
|
72
|
+
std::shared_ptr<GPURenderPassTimestampWrites>>>::fromJSI(runtime,
|
|
73
|
+
prop,
|
|
74
|
+
false);
|
|
57
75
|
}
|
|
58
76
|
if (value.hasProperty(runtime, "maxDrawCount")) {
|
|
59
|
-
auto
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
result->_instance.maxDrawCount = maxDrawCount.getNumber();
|
|
63
|
-
}
|
|
77
|
+
auto prop = value.getProperty(runtime, "maxDrawCount");
|
|
78
|
+
result->maxDrawCount =
|
|
79
|
+
JSIConverter<std::optional<double>>::fromJSI(runtime, prop, false);
|
|
64
80
|
}
|
|
65
81
|
if (value.hasProperty(runtime, "label")) {
|
|
66
|
-
auto
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
auto str = label.asString(runtime).utf8(runtime);
|
|
70
|
-
result->label = str;
|
|
71
|
-
result->_instance.label = result->label.c_str();
|
|
72
|
-
}
|
|
82
|
+
auto prop = value.getProperty(runtime, "label");
|
|
83
|
+
result->label = JSIConverter<std::optional<std::string>>::fromJSI(
|
|
84
|
+
runtime, prop, false);
|
|
73
85
|
}
|
|
74
86
|
}
|
|
75
|
-
|
|
76
|
-
"GPURenderPassDescriptor::colorAttachments = %f",
|
|
77
|
-
result->_instance.colorAttachments);
|
|
78
|
-
rnwgpu::Logger::logToConsole(
|
|
79
|
-
"GPURenderPassDescriptor::depthStencilAttachment = %f",
|
|
80
|
-
result->_instance.depthStencilAttachment);
|
|
81
|
-
rnwgpu::Logger::logToConsole(
|
|
82
|
-
"GPURenderPassDescriptor::occlusionQuerySet = %f",
|
|
83
|
-
result->_instance.occlusionQuerySet);
|
|
84
|
-
rnwgpu::Logger::logToConsole(
|
|
85
|
-
"GPURenderPassDescriptor::timestampWrites = %f",
|
|
86
|
-
result->_instance.timestampWrites);
|
|
87
|
-
rnwgpu::Logger::logToConsole("GPURenderPassDescriptor::maxDrawCount = %f",
|
|
88
|
-
result->_instance.maxDrawCount);
|
|
89
|
-
rnwgpu::Logger::logToConsole("GPURenderPassDescriptor::label = %f",
|
|
90
|
-
result->_instance.label);
|
|
87
|
+
|
|
91
88
|
return result;
|
|
92
89
|
}
|
|
93
90
|
static jsi::Value
|
|
94
91
|
toJSI(jsi::Runtime &runtime,
|
|
95
92
|
std::shared_ptr<rnwgpu::GPURenderPassDescriptor> arg) {
|
|
96
|
-
|
|
97
|
-
return jsi::Value::null();
|
|
93
|
+
throw std::runtime_error("Invalid GPURenderPassDescriptor::toJSI()");
|
|
98
94
|
}
|
|
99
95
|
};
|
|
100
|
-
|
|
96
|
+
|
|
97
|
+
} // namespace margelo
|
|
@@ -1,28 +1,32 @@
|
|
|
1
1
|
#pragma once
|
|
2
2
|
|
|
3
3
|
#include <memory>
|
|
4
|
-
#include <string>
|
|
5
4
|
|
|
6
5
|
#include "webgpu/webgpu_cpp.h"
|
|
7
6
|
|
|
8
|
-
#include "Logger.h"
|
|
9
7
|
#include "RNFJSIConverter.h"
|
|
10
|
-
#include
|
|
8
|
+
#include "WGPULogger.h"
|
|
9
|
+
|
|
10
|
+
#include "GPUQuerySet.h"
|
|
11
|
+
#include "RNFHybridObject.h"
|
|
11
12
|
|
|
12
13
|
namespace jsi = facebook::jsi;
|
|
14
|
+
namespace m = margelo;
|
|
13
15
|
|
|
14
16
|
namespace rnwgpu {
|
|
15
17
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
wgpu::RenderPassTimestampWrites _instance;
|
|
18
|
+
struct GPURenderPassTimestampWrites {
|
|
19
|
+
std::shared_ptr<GPUQuerySet> querySet; // GPUQuerySet
|
|
20
|
+
std::optional<double> beginningOfPassWriteIndex; // GPUSize32
|
|
21
|
+
std::optional<double> endOfPassWriteIndex; // GPUSize32
|
|
21
22
|
};
|
|
23
|
+
|
|
22
24
|
} // namespace rnwgpu
|
|
23
25
|
|
|
24
26
|
namespace margelo {
|
|
25
27
|
|
|
28
|
+
using namespace rnwgpu; // NOLINT(build/namespaces)
|
|
29
|
+
|
|
26
30
|
template <>
|
|
27
31
|
struct JSIConverter<std::shared_ptr<rnwgpu::GPURenderPassTimestampWrites>> {
|
|
28
32
|
static std::shared_ptr<rnwgpu::GPURenderPassTimestampWrites>
|
|
@@ -31,50 +35,29 @@ struct JSIConverter<std::shared_ptr<rnwgpu::GPURenderPassTimestampWrites>> {
|
|
|
31
35
|
if (!outOfBounds && arg.isObject()) {
|
|
32
36
|
auto value = arg.getObject(runtime);
|
|
33
37
|
if (value.hasProperty(runtime, "querySet")) {
|
|
34
|
-
auto
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
throw std::runtime_error(
|
|
38
|
-
"Property GPURenderPassTimestampWrites::querySet is required");
|
|
39
|
-
}
|
|
40
|
-
} else {
|
|
41
|
-
throw std::runtime_error(
|
|
42
|
-
"Property GPURenderPassTimestampWrites::querySet is not defined");
|
|
38
|
+
auto prop = value.getProperty(runtime, "querySet");
|
|
39
|
+
result->querySet = JSIConverter<std::shared_ptr<GPUQuerySet>>::fromJSI(
|
|
40
|
+
runtime, prop, false);
|
|
43
41
|
}
|
|
44
42
|
if (value.hasProperty(runtime, "beginningOfPassWriteIndex")) {
|
|
45
|
-
auto
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
if (beginningOfPassWriteIndex.isNumber()) {
|
|
49
|
-
result->_instance.beginningOfPassWriteIndex =
|
|
50
|
-
static_cast<wgpu::Size32>(beginningOfPassWriteIndex.getNumber());
|
|
51
|
-
}
|
|
43
|
+
auto prop = value.getProperty(runtime, "beginningOfPassWriteIndex");
|
|
44
|
+
result->beginningOfPassWriteIndex =
|
|
45
|
+
JSIConverter<std::optional<double>>::fromJSI(runtime, prop, false);
|
|
52
46
|
}
|
|
53
47
|
if (value.hasProperty(runtime, "endOfPassWriteIndex")) {
|
|
54
|
-
auto
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
if (endOfPassWriteIndex.isNumber()) {
|
|
58
|
-
result->_instance.endOfPassWriteIndex =
|
|
59
|
-
static_cast<wgpu::Size32>(endOfPassWriteIndex.getNumber());
|
|
60
|
-
}
|
|
48
|
+
auto prop = value.getProperty(runtime, "endOfPassWriteIndex");
|
|
49
|
+
result->endOfPassWriteIndex =
|
|
50
|
+
JSIConverter<std::optional<double>>::fromJSI(runtime, prop, false);
|
|
61
51
|
}
|
|
62
52
|
}
|
|
63
|
-
|
|
64
|
-
result->_instance.querySet);
|
|
65
|
-
rnwgpu::Logger::logToConsole(
|
|
66
|
-
"GPURenderPassTimestampWrites::beginningOfPassWriteIndex = %f",
|
|
67
|
-
result->_instance.beginningOfPassWriteIndex);
|
|
68
|
-
rnwgpu::Logger::logToConsole(
|
|
69
|
-
"GPURenderPassTimestampWrites::endOfPassWriteIndex = %f",
|
|
70
|
-
result->_instance.endOfPassWriteIndex);
|
|
53
|
+
|
|
71
54
|
return result;
|
|
72
55
|
}
|
|
73
56
|
static jsi::Value
|
|
74
57
|
toJSI(jsi::Runtime &runtime,
|
|
75
58
|
std::shared_ptr<rnwgpu::GPURenderPassTimestampWrites> arg) {
|
|
76
|
-
|
|
77
|
-
return jsi::Value::null();
|
|
59
|
+
throw std::runtime_error("Invalid GPURenderPassTimestampWrites::toJSI()");
|
|
78
60
|
}
|
|
79
61
|
};
|
|
80
|
-
|
|
62
|
+
|
|
63
|
+
} // namespace margelo
|
|
@@ -5,26 +5,42 @@
|
|
|
5
5
|
|
|
6
6
|
#include "webgpu/webgpu_cpp.h"
|
|
7
7
|
|
|
8
|
-
#include "Logger.h"
|
|
9
8
|
#include "RNFJSIConverter.h"
|
|
10
|
-
#include
|
|
9
|
+
#include "WGPULogger.h"
|
|
10
|
+
|
|
11
|
+
#include "GPUDepthStencilState.h"
|
|
12
|
+
#include "GPUFragmentState.h"
|
|
13
|
+
#include "GPUMultisampleState.h"
|
|
14
|
+
#include "GPUPipelineLayout.h"
|
|
15
|
+
#include "GPUPrimitiveState.h"
|
|
16
|
+
#include "GPUVertexState.h"
|
|
17
|
+
#include "RNFHybridObject.h"
|
|
11
18
|
|
|
12
19
|
namespace jsi = facebook::jsi;
|
|
20
|
+
namespace m = margelo;
|
|
13
21
|
|
|
14
22
|
namespace rnwgpu {
|
|
15
23
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
std::
|
|
24
|
+
struct GPURenderPipelineDescriptor {
|
|
25
|
+
std::shared_ptr<GPUVertexState> vertex; // GPUVertexState
|
|
26
|
+
std::optional<std::shared_ptr<GPUPrimitiveState>>
|
|
27
|
+
primitive; // GPUPrimitiveState
|
|
28
|
+
std::optional<std::shared_ptr<GPUDepthStencilState>>
|
|
29
|
+
depthStencil; // GPUDepthStencilState
|
|
30
|
+
std::optional<std::shared_ptr<GPUMultisampleState>>
|
|
31
|
+
multisample; // GPUMultisampleState
|
|
32
|
+
std::optional<std::shared_ptr<GPUFragmentState>> fragment; // GPUFragmentState
|
|
33
|
+
std::variant<std::nullptr_t, std::shared_ptr<GPUPipelineLayout>>
|
|
34
|
+
layout; // | GPUPipelineLayout | GPUAutoLayoutMode
|
|
35
|
+
std::optional<std::string> label; // string
|
|
23
36
|
};
|
|
37
|
+
|
|
24
38
|
} // namespace rnwgpu
|
|
25
39
|
|
|
26
40
|
namespace margelo {
|
|
27
41
|
|
|
42
|
+
using namespace rnwgpu; // NOLINT(build/namespaces)
|
|
43
|
+
|
|
28
44
|
template <>
|
|
29
45
|
struct JSIConverter<std::shared_ptr<rnwgpu::GPURenderPipelineDescriptor>> {
|
|
30
46
|
static std::shared_ptr<rnwgpu::GPURenderPipelineDescriptor>
|
|
@@ -33,72 +49,60 @@ struct JSIConverter<std::shared_ptr<rnwgpu::GPURenderPipelineDescriptor>> {
|
|
|
33
49
|
if (!outOfBounds && arg.isObject()) {
|
|
34
50
|
auto value = arg.getObject(runtime);
|
|
35
51
|
if (value.hasProperty(runtime, "vertex")) {
|
|
36
|
-
auto
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
throw std::runtime_error(
|
|
40
|
-
"Property GPURenderPipelineDescriptor::vertex is required");
|
|
41
|
-
}
|
|
42
|
-
} else {
|
|
43
|
-
throw std::runtime_error(
|
|
44
|
-
"Property GPURenderPipelineDescriptor::vertex is not defined");
|
|
52
|
+
auto prop = value.getProperty(runtime, "vertex");
|
|
53
|
+
result->vertex = JSIConverter<std::shared_ptr<GPUVertexState>>::fromJSI(
|
|
54
|
+
runtime, prop, false);
|
|
45
55
|
}
|
|
46
56
|
if (value.hasProperty(runtime, "primitive")) {
|
|
47
|
-
auto
|
|
57
|
+
auto prop = value.getProperty(runtime, "primitive");
|
|
58
|
+
result->primitive = JSIConverter<
|
|
59
|
+
std::optional<std::shared_ptr<GPUPrimitiveState>>>::fromJSI(runtime,
|
|
60
|
+
prop,
|
|
61
|
+
false);
|
|
48
62
|
}
|
|
49
63
|
if (value.hasProperty(runtime, "depthStencil")) {
|
|
50
|
-
auto
|
|
64
|
+
auto prop = value.getProperty(runtime, "depthStencil");
|
|
65
|
+
result->depthStencil =
|
|
66
|
+
JSIConverter<std::optional<std::shared_ptr<GPUDepthStencilState>>>::
|
|
67
|
+
fromJSI(runtime, prop, false);
|
|
51
68
|
}
|
|
52
69
|
if (value.hasProperty(runtime, "multisample")) {
|
|
53
|
-
auto
|
|
70
|
+
auto prop = value.getProperty(runtime, "multisample");
|
|
71
|
+
result->multisample =
|
|
72
|
+
JSIConverter<std::optional<std::shared_ptr<GPUMultisampleState>>>::
|
|
73
|
+
fromJSI(runtime, prop, false);
|
|
54
74
|
}
|
|
55
75
|
if (value.hasProperty(runtime, "fragment")) {
|
|
56
|
-
auto
|
|
76
|
+
auto prop = value.getProperty(runtime, "fragment");
|
|
77
|
+
result->fragment = JSIConverter<
|
|
78
|
+
std::optional<std::shared_ptr<GPUFragmentState>>>::fromJSI(runtime,
|
|
79
|
+
prop,
|
|
80
|
+
false);
|
|
57
81
|
}
|
|
58
82
|
if (value.hasProperty(runtime, "layout")) {
|
|
59
|
-
auto
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
83
|
+
auto prop = value.getProperty(runtime, "layout");
|
|
84
|
+
if (prop.isNull() || prop.isString()) {
|
|
85
|
+
result->layout = nullptr;
|
|
86
|
+
} else {
|
|
87
|
+
result->layout =
|
|
88
|
+
JSIConverter<std::shared_ptr<GPUPipelineLayout>>::fromJSI(
|
|
89
|
+
runtime, prop, false);
|
|
64
90
|
}
|
|
65
|
-
} else {
|
|
66
|
-
throw std::runtime_error(
|
|
67
|
-
"Property GPURenderPipelineDescriptor::layout is not defined");
|
|
68
91
|
}
|
|
69
92
|
if (value.hasProperty(runtime, "label")) {
|
|
70
|
-
auto
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
auto str = label.asString(runtime).utf8(runtime);
|
|
74
|
-
result->label = str;
|
|
75
|
-
result->_instance.label = result->label.c_str();
|
|
76
|
-
}
|
|
93
|
+
auto prop = value.getProperty(runtime, "label");
|
|
94
|
+
result->label = JSIConverter<std::optional<std::string>>::fromJSI(
|
|
95
|
+
runtime, prop, false);
|
|
77
96
|
}
|
|
78
97
|
}
|
|
79
|
-
|
|
80
|
-
result->_instance.vertex);
|
|
81
|
-
rnwgpu::Logger::logToConsole("GPURenderPipelineDescriptor::primitive = %f",
|
|
82
|
-
result->_instance.primitive);
|
|
83
|
-
rnwgpu::Logger::logToConsole(
|
|
84
|
-
"GPURenderPipelineDescriptor::depthStencil = %f",
|
|
85
|
-
result->_instance.depthStencil);
|
|
86
|
-
rnwgpu::Logger::logToConsole(
|
|
87
|
-
"GPURenderPipelineDescriptor::multisample = %f",
|
|
88
|
-
result->_instance.multisample);
|
|
89
|
-
rnwgpu::Logger::logToConsole("GPURenderPipelineDescriptor::fragment = %f",
|
|
90
|
-
result->_instance.fragment);
|
|
91
|
-
rnwgpu::Logger::logToConsole("GPURenderPipelineDescriptor::layout = %f",
|
|
92
|
-
result->_instance.layout);
|
|
93
|
-
rnwgpu::Logger::logToConsole("GPURenderPipelineDescriptor::label = %f",
|
|
94
|
-
result->_instance.label);
|
|
98
|
+
|
|
95
99
|
return result;
|
|
96
100
|
}
|
|
97
101
|
static jsi::Value
|
|
98
102
|
toJSI(jsi::Runtime &runtime,
|
|
99
103
|
std::shared_ptr<rnwgpu::GPURenderPipelineDescriptor> arg) {
|
|
100
|
-
|
|
101
|
-
return jsi::Value::null();
|
|
104
|
+
throw std::runtime_error("Invalid GPURenderPipelineDescriptor::toJSI()");
|
|
102
105
|
}
|
|
103
106
|
};
|
|
104
|
-
|
|
107
|
+
|
|
108
|
+
} // namespace margelo
|
|
@@ -1,28 +1,30 @@
|
|
|
1
1
|
#pragma once
|
|
2
2
|
|
|
3
3
|
#include <memory>
|
|
4
|
-
#include <string>
|
|
5
4
|
|
|
6
5
|
#include "webgpu/webgpu_cpp.h"
|
|
7
6
|
|
|
8
|
-
#include "Logger.h"
|
|
9
7
|
#include "RNFJSIConverter.h"
|
|
10
|
-
#include
|
|
8
|
+
#include "WGPULogger.h"
|
|
9
|
+
|
|
10
|
+
#include "RNFHybridObject.h"
|
|
11
11
|
|
|
12
12
|
namespace jsi = facebook::jsi;
|
|
13
|
+
namespace m = margelo;
|
|
13
14
|
|
|
14
15
|
namespace rnwgpu {
|
|
15
16
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
wgpu::RequestAdapterOptions _instance;
|
|
17
|
+
struct GPURequestAdapterOptions {
|
|
18
|
+
std::optional<wgpu::PowerPreference> powerPreference; // GPUPowerPreference
|
|
19
|
+
std::optional<bool> forceFallbackAdapter; // boolean
|
|
21
20
|
};
|
|
21
|
+
|
|
22
22
|
} // namespace rnwgpu
|
|
23
23
|
|
|
24
24
|
namespace margelo {
|
|
25
25
|
|
|
26
|
+
using namespace rnwgpu; // NOLINT(build/namespaces)
|
|
27
|
+
|
|
26
28
|
template <>
|
|
27
29
|
struct JSIConverter<std::shared_ptr<rnwgpu::GPURequestAdapterOptions>> {
|
|
28
30
|
static std::shared_ptr<rnwgpu::GPURequestAdapterOptions>
|
|
@@ -31,26 +33,25 @@ struct JSIConverter<std::shared_ptr<rnwgpu::GPURequestAdapterOptions>> {
|
|
|
31
33
|
if (!outOfBounds && arg.isObject()) {
|
|
32
34
|
auto value = arg.getObject(runtime);
|
|
33
35
|
if (value.hasProperty(runtime, "powerPreference")) {
|
|
34
|
-
auto
|
|
36
|
+
auto prop = value.getProperty(runtime, "powerPreference");
|
|
37
|
+
result->powerPreference =
|
|
38
|
+
JSIConverter<std::optional<wgpu::PowerPreference>>::fromJSI(
|
|
39
|
+
runtime, prop, false);
|
|
35
40
|
}
|
|
36
41
|
if (value.hasProperty(runtime, "forceFallbackAdapter")) {
|
|
37
|
-
auto
|
|
38
|
-
|
|
42
|
+
auto prop = value.getProperty(runtime, "forceFallbackAdapter");
|
|
43
|
+
result->forceFallbackAdapter =
|
|
44
|
+
JSIConverter<std::optional<bool>>::fromJSI(runtime, prop, false);
|
|
39
45
|
}
|
|
40
46
|
}
|
|
41
|
-
|
|
42
|
-
"GPURequestAdapterOptions::powerPreference = %f",
|
|
43
|
-
result->_instance.powerPreference);
|
|
44
|
-
rnwgpu::Logger::logToConsole(
|
|
45
|
-
"GPURequestAdapterOptions::forceFallbackAdapter = %f",
|
|
46
|
-
result->_instance.forceFallbackAdapter);
|
|
47
|
+
|
|
47
48
|
return result;
|
|
48
49
|
}
|
|
49
50
|
static jsi::Value
|
|
50
51
|
toJSI(jsi::Runtime &runtime,
|
|
51
52
|
std::shared_ptr<rnwgpu::GPURequestAdapterOptions> arg) {
|
|
52
|
-
|
|
53
|
-
return jsi::Value::null();
|
|
53
|
+
throw std::runtime_error("Invalid GPURequestAdapterOptions::toJSI()");
|
|
54
54
|
}
|
|
55
55
|
};
|
|
56
|
-
|
|
56
|
+
|
|
57
|
+
} // namespace margelo
|
|
@@ -1,28 +1,29 @@
|
|
|
1
1
|
#pragma once
|
|
2
2
|
|
|
3
3
|
#include <memory>
|
|
4
|
-
#include <string>
|
|
5
4
|
|
|
6
5
|
#include "webgpu/webgpu_cpp.h"
|
|
7
6
|
|
|
8
|
-
#include "Logger.h"
|
|
9
7
|
#include "RNFJSIConverter.h"
|
|
10
|
-
#include
|
|
8
|
+
#include "WGPULogger.h"
|
|
9
|
+
|
|
10
|
+
#include "RNFHybridObject.h"
|
|
11
11
|
|
|
12
12
|
namespace jsi = facebook::jsi;
|
|
13
|
+
namespace m = margelo;
|
|
13
14
|
|
|
14
15
|
namespace rnwgpu {
|
|
15
16
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
wgpu::SamplerBindingLayout *getInstance() { return &_instance; }
|
|
19
|
-
|
|
20
|
-
wgpu::SamplerBindingLayout _instance;
|
|
17
|
+
struct GPUSamplerBindingLayout {
|
|
18
|
+
std::optional<wgpu::SamplerBindingType> type; // GPUSamplerBindingType
|
|
21
19
|
};
|
|
20
|
+
|
|
22
21
|
} // namespace rnwgpu
|
|
23
22
|
|
|
24
23
|
namespace margelo {
|
|
25
24
|
|
|
25
|
+
using namespace rnwgpu; // NOLINT(build/namespaces)
|
|
26
|
+
|
|
26
27
|
template <>
|
|
27
28
|
struct JSIConverter<std::shared_ptr<rnwgpu::GPUSamplerBindingLayout>> {
|
|
28
29
|
static std::shared_ptr<rnwgpu::GPUSamplerBindingLayout>
|
|
@@ -31,18 +32,20 @@ struct JSIConverter<std::shared_ptr<rnwgpu::GPUSamplerBindingLayout>> {
|
|
|
31
32
|
if (!outOfBounds && arg.isObject()) {
|
|
32
33
|
auto value = arg.getObject(runtime);
|
|
33
34
|
if (value.hasProperty(runtime, "type")) {
|
|
34
|
-
auto
|
|
35
|
+
auto prop = value.getProperty(runtime, "type");
|
|
36
|
+
result->type =
|
|
37
|
+
JSIConverter<std::optional<wgpu::SamplerBindingType>>::fromJSI(
|
|
38
|
+
runtime, prop, false);
|
|
35
39
|
}
|
|
36
40
|
}
|
|
37
|
-
|
|
38
|
-
result->_instance.type);
|
|
41
|
+
|
|
39
42
|
return result;
|
|
40
43
|
}
|
|
41
44
|
static jsi::Value
|
|
42
45
|
toJSI(jsi::Runtime &runtime,
|
|
43
46
|
std::shared_ptr<rnwgpu::GPUSamplerBindingLayout> arg) {
|
|
44
|
-
|
|
45
|
-
return jsi::Value::null();
|
|
47
|
+
throw std::runtime_error("Invalid GPUSamplerBindingLayout::toJSI()");
|
|
46
48
|
}
|
|
47
49
|
};
|
|
48
|
-
|
|
50
|
+
|
|
51
|
+
} // namespace margelo
|