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
|
@@ -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::ComputePassTimestampWrites _instance;
|
|
18
|
+
struct GPUComputePassTimestampWrites {
|
|
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::GPUComputePassTimestampWrites>> {
|
|
28
32
|
static std::shared_ptr<rnwgpu::GPUComputePassTimestampWrites>
|
|
@@ -31,50 +35,29 @@ struct JSIConverter<std::shared_ptr<rnwgpu::GPUComputePassTimestampWrites>> {
|
|
|
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 GPUComputePassTimestampWrites::querySet is required");
|
|
39
|
-
}
|
|
40
|
-
} else {
|
|
41
|
-
throw std::runtime_error(
|
|
42
|
-
"Property GPUComputePassTimestampWrites::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
|
-
"GPUComputePassTimestampWrites::beginningOfPassWriteIndex = %f",
|
|
67
|
-
result->_instance.beginningOfPassWriteIndex);
|
|
68
|
-
rnwgpu::Logger::logToConsole(
|
|
69
|
-
"GPUComputePassTimestampWrites::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::GPUComputePassTimestampWrites> arg) {
|
|
76
|
-
|
|
77
|
-
return jsi::Value::null();
|
|
59
|
+
throw std::runtime_error("Invalid GPUComputePassTimestampWrites::toJSI()");
|
|
78
60
|
}
|
|
79
61
|
};
|
|
80
|
-
|
|
62
|
+
|
|
63
|
+
} // namespace margelo
|
|
@@ -5,26 +5,31 @@
|
|
|
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 "GPUPipelineLayout.h"
|
|
12
|
+
#include "GPUProgrammableStage.h"
|
|
13
|
+
#include "RNFHybridObject.h"
|
|
11
14
|
|
|
12
15
|
namespace jsi = facebook::jsi;
|
|
16
|
+
namespace m = margelo;
|
|
13
17
|
|
|
14
18
|
namespace rnwgpu {
|
|
15
19
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
std::string label;
|
|
20
|
+
struct GPUComputePipelineDescriptor {
|
|
21
|
+
std::shared_ptr<GPUProgrammableStage> compute; // GPUProgrammableStage
|
|
22
|
+
std::variant<std::nullptr_t, std::shared_ptr<GPUPipelineLayout>>
|
|
23
|
+
layout; // | GPUPipelineLayout | GPUAutoLayoutMode
|
|
24
|
+
std::optional<std::string> label; // string
|
|
23
25
|
};
|
|
26
|
+
|
|
24
27
|
} // namespace rnwgpu
|
|
25
28
|
|
|
26
29
|
namespace margelo {
|
|
27
30
|
|
|
31
|
+
using namespace rnwgpu; // NOLINT(build/namespaces)
|
|
32
|
+
|
|
28
33
|
template <>
|
|
29
34
|
struct JSIConverter<std::shared_ptr<rnwgpu::GPUComputePipelineDescriptor>> {
|
|
30
35
|
static std::shared_ptr<rnwgpu::GPUComputePipelineDescriptor>
|
|
@@ -33,50 +38,35 @@ struct JSIConverter<std::shared_ptr<rnwgpu::GPUComputePipelineDescriptor>> {
|
|
|
33
38
|
if (!outOfBounds && arg.isObject()) {
|
|
34
39
|
auto value = arg.getObject(runtime);
|
|
35
40
|
if (value.hasProperty(runtime, "compute")) {
|
|
36
|
-
auto
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
"Property GPUComputePipelineDescriptor::compute is required");
|
|
41
|
-
}
|
|
42
|
-
} else {
|
|
43
|
-
throw std::runtime_error(
|
|
44
|
-
"Property GPUComputePipelineDescriptor::compute is not defined");
|
|
41
|
+
auto prop = value.getProperty(runtime, "compute");
|
|
42
|
+
result->compute =
|
|
43
|
+
JSIConverter<std::shared_ptr<GPUProgrammableStage>>::fromJSI(
|
|
44
|
+
runtime, prop, false);
|
|
45
45
|
}
|
|
46
46
|
if (value.hasProperty(runtime, "layout")) {
|
|
47
|
-
auto
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
47
|
+
auto prop = value.getProperty(runtime, "layout");
|
|
48
|
+
if (prop.isNull() || prop.isString()) {
|
|
49
|
+
result->layout = nullptr;
|
|
50
|
+
} else {
|
|
51
|
+
result->layout =
|
|
52
|
+
JSIConverter<std::shared_ptr<GPUPipelineLayout>>::fromJSI(
|
|
53
|
+
runtime, prop, false);
|
|
52
54
|
}
|
|
53
|
-
} else {
|
|
54
|
-
throw std::runtime_error(
|
|
55
|
-
"Property GPUComputePipelineDescriptor::layout is not defined");
|
|
56
55
|
}
|
|
57
56
|
if (value.hasProperty(runtime, "label")) {
|
|
58
|
-
auto
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
auto str = label.asString(runtime).utf8(runtime);
|
|
62
|
-
result->label = str;
|
|
63
|
-
result->_instance.label = result->label.c_str();
|
|
64
|
-
}
|
|
57
|
+
auto prop = value.getProperty(runtime, "label");
|
|
58
|
+
result->label = JSIConverter<std::optional<std::string>>::fromJSI(
|
|
59
|
+
runtime, prop, false);
|
|
65
60
|
}
|
|
66
61
|
}
|
|
67
|
-
|
|
68
|
-
result->_instance.compute);
|
|
69
|
-
rnwgpu::Logger::logToConsole("GPUComputePipelineDescriptor::layout = %f",
|
|
70
|
-
result->_instance.layout);
|
|
71
|
-
rnwgpu::Logger::logToConsole("GPUComputePipelineDescriptor::label = %f",
|
|
72
|
-
result->_instance.label);
|
|
62
|
+
|
|
73
63
|
return result;
|
|
74
64
|
}
|
|
75
65
|
static jsi::Value
|
|
76
66
|
toJSI(jsi::Runtime &runtime,
|
|
77
67
|
std::shared_ptr<rnwgpu::GPUComputePipelineDescriptor> arg) {
|
|
78
|
-
|
|
79
|
-
return jsi::Value::null();
|
|
68
|
+
throw std::runtime_error("Invalid GPUComputePipelineDescriptor::toJSI()");
|
|
80
69
|
}
|
|
81
70
|
};
|
|
82
|
-
|
|
71
|
+
|
|
72
|
+
} // namespace margelo
|
|
@@ -1,28 +1,41 @@
|
|
|
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 "GPUStencilFaceState.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
|
-
|
|
18
|
+
struct GPUDepthStencilState {
|
|
19
|
+
wgpu::TextureFormat format; // GPUTextureFormat
|
|
20
|
+
std::optional<bool> depthWriteEnabled; // boolean
|
|
21
|
+
std::optional<wgpu::CompareFunction> depthCompare; // GPUCompareFunction
|
|
22
|
+
std::optional<std::shared_ptr<GPUStencilFaceState>>
|
|
23
|
+
stencilFront; // GPUStencilFaceState
|
|
24
|
+
std::optional<std::shared_ptr<GPUStencilFaceState>>
|
|
25
|
+
stencilBack; // GPUStencilFaceState
|
|
26
|
+
std::optional<double> stencilReadMask; // GPUStencilValue
|
|
27
|
+
std::optional<double> stencilWriteMask; // GPUStencilValue
|
|
28
|
+
std::optional<double> depthBias; // GPUDepthBias
|
|
29
|
+
std::optional<double> depthBiasSlopeScale; // number
|
|
30
|
+
std::optional<double> depthBiasClamp; // number
|
|
21
31
|
};
|
|
32
|
+
|
|
22
33
|
} // namespace rnwgpu
|
|
23
34
|
|
|
24
35
|
namespace margelo {
|
|
25
36
|
|
|
37
|
+
using namespace rnwgpu; // NOLINT(build/namespaces)
|
|
38
|
+
|
|
26
39
|
template <> struct JSIConverter<std::shared_ptr<rnwgpu::GPUDepthStencilState>> {
|
|
27
40
|
static std::shared_ptr<rnwgpu::GPUDepthStencilState>
|
|
28
41
|
fromJSI(jsi::Runtime &runtime, const jsi::Value &arg, bool outOfBounds) {
|
|
@@ -30,97 +43,66 @@ template <> struct JSIConverter<std::shared_ptr<rnwgpu::GPUDepthStencilState>> {
|
|
|
30
43
|
if (!outOfBounds && arg.isObject()) {
|
|
31
44
|
auto value = arg.getObject(runtime);
|
|
32
45
|
if (value.hasProperty(runtime, "format")) {
|
|
33
|
-
auto
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
throw std::runtime_error(
|
|
37
|
-
"Property GPUDepthStencilState::format is required");
|
|
38
|
-
}
|
|
39
|
-
} else {
|
|
40
|
-
throw std::runtime_error(
|
|
41
|
-
"Property GPUDepthStencilState::format is not defined");
|
|
46
|
+
auto prop = value.getProperty(runtime, "format");
|
|
47
|
+
result->format =
|
|
48
|
+
JSIConverter<wgpu::TextureFormat>::fromJSI(runtime, prop, false);
|
|
42
49
|
}
|
|
43
50
|
if (value.hasProperty(runtime, "depthWriteEnabled")) {
|
|
44
|
-
auto
|
|
45
|
-
|
|
51
|
+
auto prop = value.getProperty(runtime, "depthWriteEnabled");
|
|
52
|
+
result->depthWriteEnabled =
|
|
53
|
+
JSIConverter<std::optional<bool>>::fromJSI(runtime, prop, false);
|
|
46
54
|
}
|
|
47
55
|
if (value.hasProperty(runtime, "depthCompare")) {
|
|
48
|
-
auto
|
|
56
|
+
auto prop = value.getProperty(runtime, "depthCompare");
|
|
57
|
+
result->depthCompare =
|
|
58
|
+
JSIConverter<std::optional<wgpu::CompareFunction>>::fromJSI(
|
|
59
|
+
runtime, prop, false);
|
|
49
60
|
}
|
|
50
61
|
if (value.hasProperty(runtime, "stencilFront")) {
|
|
51
|
-
auto
|
|
62
|
+
auto prop = value.getProperty(runtime, "stencilFront");
|
|
63
|
+
result->stencilFront =
|
|
64
|
+
JSIConverter<std::optional<std::shared_ptr<GPUStencilFaceState>>>::
|
|
65
|
+
fromJSI(runtime, prop, false);
|
|
52
66
|
}
|
|
53
67
|
if (value.hasProperty(runtime, "stencilBack")) {
|
|
54
|
-
auto
|
|
68
|
+
auto prop = value.getProperty(runtime, "stencilBack");
|
|
69
|
+
result->stencilBack =
|
|
70
|
+
JSIConverter<std::optional<std::shared_ptr<GPUStencilFaceState>>>::
|
|
71
|
+
fromJSI(runtime, prop, false);
|
|
55
72
|
}
|
|
56
73
|
if (value.hasProperty(runtime, "stencilReadMask")) {
|
|
57
|
-
auto
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
result->_instance.stencilReadMask =
|
|
61
|
-
static_cast<wgpu::StencilValue>(stencilReadMask.getNumber());
|
|
62
|
-
}
|
|
74
|
+
auto prop = value.getProperty(runtime, "stencilReadMask");
|
|
75
|
+
result->stencilReadMask =
|
|
76
|
+
JSIConverter<std::optional<double>>::fromJSI(runtime, prop, false);
|
|
63
77
|
}
|
|
64
78
|
if (value.hasProperty(runtime, "stencilWriteMask")) {
|
|
65
|
-
auto
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
result->_instance.stencilWriteMask =
|
|
69
|
-
static_cast<wgpu::StencilValue>(stencilWriteMask.getNumber());
|
|
70
|
-
}
|
|
79
|
+
auto prop = value.getProperty(runtime, "stencilWriteMask");
|
|
80
|
+
result->stencilWriteMask =
|
|
81
|
+
JSIConverter<std::optional<double>>::fromJSI(runtime, prop, false);
|
|
71
82
|
}
|
|
72
83
|
if (value.hasProperty(runtime, "depthBias")) {
|
|
73
|
-
auto
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
result->_instance.depthBias =
|
|
77
|
-
static_cast<wgpu::DepthBias>(depthBias.getNumber());
|
|
78
|
-
}
|
|
84
|
+
auto prop = value.getProperty(runtime, "depthBias");
|
|
85
|
+
result->depthBias =
|
|
86
|
+
JSIConverter<std::optional<double>>::fromJSI(runtime, prop, false);
|
|
79
87
|
}
|
|
80
88
|
if (value.hasProperty(runtime, "depthBiasSlopeScale")) {
|
|
81
|
-
auto
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
if (depthBiasSlopeScale.isNumber()) {
|
|
85
|
-
result->_instance.depthBiasSlopeScale =
|
|
86
|
-
depthBiasSlopeScale.getNumber();
|
|
87
|
-
}
|
|
89
|
+
auto prop = value.getProperty(runtime, "depthBiasSlopeScale");
|
|
90
|
+
result->depthBiasSlopeScale =
|
|
91
|
+
JSIConverter<std::optional<double>>::fromJSI(runtime, prop, false);
|
|
88
92
|
}
|
|
89
93
|
if (value.hasProperty(runtime, "depthBiasClamp")) {
|
|
90
|
-
auto
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
result->_instance.depthBiasClamp = depthBiasClamp.getNumber();
|
|
94
|
-
}
|
|
94
|
+
auto prop = value.getProperty(runtime, "depthBiasClamp");
|
|
95
|
+
result->depthBiasClamp =
|
|
96
|
+
JSIConverter<std::optional<double>>::fromJSI(runtime, prop, false);
|
|
95
97
|
}
|
|
96
98
|
}
|
|
97
|
-
|
|
98
|
-
result->_instance.format);
|
|
99
|
-
rnwgpu::Logger::logToConsole("GPUDepthStencilState::depthWriteEnabled = %f",
|
|
100
|
-
result->_instance.depthWriteEnabled);
|
|
101
|
-
rnwgpu::Logger::logToConsole("GPUDepthStencilState::depthCompare = %f",
|
|
102
|
-
result->_instance.depthCompare);
|
|
103
|
-
rnwgpu::Logger::logToConsole("GPUDepthStencilState::stencilFront = %f",
|
|
104
|
-
result->_instance.stencilFront);
|
|
105
|
-
rnwgpu::Logger::logToConsole("GPUDepthStencilState::stencilBack = %f",
|
|
106
|
-
result->_instance.stencilBack);
|
|
107
|
-
rnwgpu::Logger::logToConsole("GPUDepthStencilState::stencilReadMask = %f",
|
|
108
|
-
result->_instance.stencilReadMask);
|
|
109
|
-
rnwgpu::Logger::logToConsole("GPUDepthStencilState::stencilWriteMask = %f",
|
|
110
|
-
result->_instance.stencilWriteMask);
|
|
111
|
-
rnwgpu::Logger::logToConsole("GPUDepthStencilState::depthBias = %f",
|
|
112
|
-
result->_instance.depthBias);
|
|
113
|
-
rnwgpu::Logger::logToConsole(
|
|
114
|
-
"GPUDepthStencilState::depthBiasSlopeScale = %f",
|
|
115
|
-
result->_instance.depthBiasSlopeScale);
|
|
116
|
-
rnwgpu::Logger::logToConsole("GPUDepthStencilState::depthBiasClamp = %f",
|
|
117
|
-
result->_instance.depthBiasClamp);
|
|
99
|
+
|
|
118
100
|
return result;
|
|
119
101
|
}
|
|
120
102
|
static jsi::Value toJSI(jsi::Runtime &runtime,
|
|
121
103
|
std::shared_ptr<rnwgpu::GPUDepthStencilState> arg) {
|
|
122
|
-
|
|
123
|
-
return jsi::Value::null();
|
|
104
|
+
throw std::runtime_error("Invalid GPUDepthStencilState::toJSI()");
|
|
124
105
|
}
|
|
125
106
|
};
|
|
126
|
-
|
|
107
|
+
|
|
108
|
+
} // namespace margelo
|
|
@@ -1,30 +1,39 @@
|
|
|
1
1
|
#pragma once
|
|
2
2
|
|
|
3
|
+
#include <map>
|
|
3
4
|
#include <memory>
|
|
4
5
|
#include <string>
|
|
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 "GPUQueueDescriptor.h"
|
|
14
|
+
#include "RNFHybridObject.h"
|
|
11
15
|
|
|
12
16
|
namespace jsi = facebook::jsi;
|
|
17
|
+
namespace m = margelo;
|
|
13
18
|
|
|
14
19
|
namespace rnwgpu {
|
|
15
20
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
struct GPUDeviceDescriptor {
|
|
22
|
+
std::optional<std::vector<wgpu::FeatureName>>
|
|
23
|
+
requiredFeatures; // Iterable<GPUFeatureName>
|
|
24
|
+
std::optional<std::map<std::string, double>>
|
|
25
|
+
requiredLimits; // Record< string, GPUSize64 >
|
|
26
|
+
std::optional<std::shared_ptr<GPUQueueDescriptor>>
|
|
27
|
+
defaultQueue; // GPUQueueDescriptor
|
|
28
|
+
std::optional<std::string> label; // string
|
|
23
29
|
};
|
|
30
|
+
|
|
24
31
|
} // namespace rnwgpu
|
|
25
32
|
|
|
26
33
|
namespace margelo {
|
|
27
34
|
|
|
35
|
+
using namespace rnwgpu; // NOLINT(build/namespaces)
|
|
36
|
+
|
|
28
37
|
template <> struct JSIConverter<std::shared_ptr<rnwgpu::GPUDeviceDescriptor>> {
|
|
29
38
|
static std::shared_ptr<rnwgpu::GPUDeviceDescriptor>
|
|
30
39
|
fromJSI(jsi::Runtime &runtime, const jsi::Value &arg, bool outOfBounds) {
|
|
@@ -32,38 +41,37 @@ template <> struct JSIConverter<std::shared_ptr<rnwgpu::GPUDeviceDescriptor>> {
|
|
|
32
41
|
if (!outOfBounds && arg.isObject()) {
|
|
33
42
|
auto value = arg.getObject(runtime);
|
|
34
43
|
if (value.hasProperty(runtime, "requiredFeatures")) {
|
|
35
|
-
auto
|
|
44
|
+
auto prop = value.getProperty(runtime, "requiredFeatures");
|
|
45
|
+
result->requiredFeatures = JSIConverter<
|
|
46
|
+
std::optional<std::vector<wgpu::FeatureName>>>::fromJSI(runtime,
|
|
47
|
+
prop,
|
|
48
|
+
false);
|
|
36
49
|
}
|
|
37
50
|
if (value.hasProperty(runtime, "requiredLimits")) {
|
|
38
|
-
auto
|
|
51
|
+
auto prop = value.getProperty(runtime, "requiredLimits");
|
|
52
|
+
result->requiredLimits =
|
|
53
|
+
JSIConverter<std::optional<std::map<std::string, double>>>::fromJSI(
|
|
54
|
+
runtime, prop, false);
|
|
39
55
|
}
|
|
40
56
|
if (value.hasProperty(runtime, "defaultQueue")) {
|
|
41
|
-
auto
|
|
57
|
+
auto prop = value.getProperty(runtime, "defaultQueue");
|
|
58
|
+
result->defaultQueue =
|
|
59
|
+
JSIConverter<std::optional<std::shared_ptr<GPUQueueDescriptor>>>::
|
|
60
|
+
fromJSI(runtime, prop, false);
|
|
42
61
|
}
|
|
43
62
|
if (value.hasProperty(runtime, "label")) {
|
|
44
|
-
auto
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
auto str = label.asString(runtime).utf8(runtime);
|
|
48
|
-
result->label = str;
|
|
49
|
-
result->_instance.label = result->label.c_str();
|
|
50
|
-
}
|
|
63
|
+
auto prop = value.getProperty(runtime, "label");
|
|
64
|
+
result->label = JSIConverter<std::optional<std::string>>::fromJSI(
|
|
65
|
+
runtime, prop, false);
|
|
51
66
|
}
|
|
52
67
|
}
|
|
53
|
-
|
|
54
|
-
result->_instance.requiredFeatures);
|
|
55
|
-
rnwgpu::Logger::logToConsole("GPUDeviceDescriptor::requiredLimits = %f",
|
|
56
|
-
result->_instance.requiredLimits);
|
|
57
|
-
rnwgpu::Logger::logToConsole("GPUDeviceDescriptor::defaultQueue = %f",
|
|
58
|
-
result->_instance.defaultQueue);
|
|
59
|
-
rnwgpu::Logger::logToConsole("GPUDeviceDescriptor::label = %f",
|
|
60
|
-
result->_instance.label);
|
|
68
|
+
|
|
61
69
|
return result;
|
|
62
70
|
}
|
|
63
71
|
static jsi::Value toJSI(jsi::Runtime &runtime,
|
|
64
72
|
std::shared_ptr<rnwgpu::GPUDeviceDescriptor> arg) {
|
|
65
|
-
|
|
66
|
-
return jsi::Value::null();
|
|
73
|
+
throw std::runtime_error("Invalid GPUDeviceDescriptor::toJSI()");
|
|
67
74
|
}
|
|
68
75
|
};
|
|
69
|
-
|
|
76
|
+
|
|
77
|
+
} // namespace margelo
|
|
@@ -1,28 +1,27 @@
|
|
|
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
|
-
public:
|
|
18
|
-
wgpu::ExternalTextureBindingLayout *getInstance() { return &_instance; }
|
|
17
|
+
struct GPUExternalTextureBindingLayout {};
|
|
19
18
|
|
|
20
|
-
wgpu::ExternalTextureBindingLayout _instance;
|
|
21
|
-
};
|
|
22
19
|
} // namespace rnwgpu
|
|
23
20
|
|
|
24
21
|
namespace margelo {
|
|
25
22
|
|
|
23
|
+
using namespace rnwgpu; // NOLINT(build/namespaces)
|
|
24
|
+
|
|
26
25
|
template <>
|
|
27
26
|
struct JSIConverter<std::shared_ptr<rnwgpu::GPUExternalTextureBindingLayout>> {
|
|
28
27
|
static std::shared_ptr<rnwgpu::GPUExternalTextureBindingLayout>
|
|
@@ -37,8 +36,9 @@ struct JSIConverter<std::shared_ptr<rnwgpu::GPUExternalTextureBindingLayout>> {
|
|
|
37
36
|
static jsi::Value
|
|
38
37
|
toJSI(jsi::Runtime &runtime,
|
|
39
38
|
std::shared_ptr<rnwgpu::GPUExternalTextureBindingLayout> arg) {
|
|
40
|
-
|
|
41
|
-
|
|
39
|
+
throw std::runtime_error(
|
|
40
|
+
"Invalid GPUExternalTextureBindingLayout::toJSI()");
|
|
42
41
|
}
|
|
43
42
|
};
|
|
44
|
-
|
|
43
|
+
|
|
44
|
+
} // namespace margelo
|