react-native-wgpu 0.1.0 → 0.1.2
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 +26 -0
- package/android/cpp/cpp-adapter.cpp +66 -3
- package/android/src/main/java/com/webgpu/WebGPUModule.java +64 -22
- 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 +16 -0
- package/cpp/rnwgpu/RNWebGPUManager.cpp +14 -9
- package/cpp/rnwgpu/RNWebGPUManager.h +12 -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 +100 -23
- package/cpp/rnwgpu/api/GPU.h +24 -6
- package/cpp/rnwgpu/api/GPUAdapter.cpp +122 -8
- 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 +43 -7
- 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 +110 -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/ImageData.h +50 -0
- package/cpp/rnwgpu/api/Navigator.h +46 -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 +25 -34
- 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 +16 -0
- package/ios/IOSPlatformContext.mm +18 -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 +49 -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 +158 -19
- package/lib/commonjs/index.js.map +1 -1
- package/lib/module/Canvas.js +42 -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 +144 -6
- package/lib/module/index.js.map +1 -1
- 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/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 +2 -3
- package/lib/typescript/src/Canvas.d.ts +22 -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 +2 -7
- package/lib/typescript/src/index.d.ts.map +1 -1
- 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 +68 -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 +172 -8
- 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
|
@@ -5,26 +5,28 @@
|
|
|
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 "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::QuerySetDescriptor _instance;
|
|
21
|
-
|
|
22
|
-
std::string label;
|
|
18
|
+
struct GPUQuerySetDescriptor {
|
|
19
|
+
wgpu::QueryType type; // GPUQueryType
|
|
20
|
+
double count; // GPUSize32
|
|
21
|
+
std::optional<std::string> label; // string
|
|
23
22
|
};
|
|
23
|
+
|
|
24
24
|
} // namespace rnwgpu
|
|
25
25
|
|
|
26
26
|
namespace margelo {
|
|
27
27
|
|
|
28
|
+
using namespace rnwgpu; // NOLINT(build/namespaces)
|
|
29
|
+
|
|
28
30
|
template <>
|
|
29
31
|
struct JSIConverter<std::shared_ptr<rnwgpu::GPUQuerySetDescriptor>> {
|
|
30
32
|
static std::shared_ptr<rnwgpu::GPUQuerySetDescriptor>
|
|
@@ -33,49 +35,27 @@ struct JSIConverter<std::shared_ptr<rnwgpu::GPUQuerySetDescriptor>> {
|
|
|
33
35
|
if (!outOfBounds && arg.isObject()) {
|
|
34
36
|
auto value = arg.getObject(runtime);
|
|
35
37
|
if (value.hasProperty(runtime, "type")) {
|
|
36
|
-
auto
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
throw std::runtime_error(
|
|
40
|
-
"Property GPUQuerySetDescriptor::type is required");
|
|
41
|
-
}
|
|
42
|
-
} else {
|
|
43
|
-
throw std::runtime_error(
|
|
44
|
-
"Property GPUQuerySetDescriptor::type is not defined");
|
|
38
|
+
auto prop = value.getProperty(runtime, "type");
|
|
39
|
+
result->type =
|
|
40
|
+
JSIConverter<wgpu::QueryType>::fromJSI(runtime, prop, false);
|
|
45
41
|
}
|
|
46
42
|
if (value.hasProperty(runtime, "count")) {
|
|
47
|
-
auto
|
|
48
|
-
|
|
49
|
-
if (count.isUndefined()) {
|
|
50
|
-
throw std::runtime_error(
|
|
51
|
-
"Property GPUQuerySetDescriptor::count is required");
|
|
52
|
-
}
|
|
53
|
-
} else {
|
|
54
|
-
throw std::runtime_error(
|
|
55
|
-
"Property GPUQuerySetDescriptor::count is not defined");
|
|
43
|
+
auto prop = value.getProperty(runtime, "count");
|
|
44
|
+
result->count = JSIConverter<double>::fromJSI(runtime, prop, false);
|
|
56
45
|
}
|
|
57
46
|
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
|
-
}
|
|
47
|
+
auto prop = value.getProperty(runtime, "label");
|
|
48
|
+
result->label = JSIConverter<std::optional<std::string>>::fromJSI(
|
|
49
|
+
runtime, prop, false);
|
|
65
50
|
}
|
|
66
51
|
}
|
|
67
|
-
|
|
68
|
-
result->_instance.type);
|
|
69
|
-
rnwgpu::Logger::logToConsole("GPUQuerySetDescriptor::count = %f",
|
|
70
|
-
result->_instance.count);
|
|
71
|
-
rnwgpu::Logger::logToConsole("GPUQuerySetDescriptor::label = %f",
|
|
72
|
-
result->_instance.label);
|
|
52
|
+
|
|
73
53
|
return result;
|
|
74
54
|
}
|
|
75
55
|
static jsi::Value toJSI(jsi::Runtime &runtime,
|
|
76
56
|
std::shared_ptr<rnwgpu::GPUQuerySetDescriptor> arg) {
|
|
77
|
-
|
|
78
|
-
return jsi::Value::null();
|
|
57
|
+
throw std::runtime_error("Invalid GPUQuerySetDescriptor::toJSI()");
|
|
79
58
|
}
|
|
80
59
|
};
|
|
81
|
-
|
|
60
|
+
|
|
61
|
+
} // namespace margelo
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
|
|
3
|
+
#include <memory>
|
|
4
|
+
#include <string>
|
|
5
|
+
|
|
6
|
+
#include "webgpu/webgpu_cpp.h"
|
|
7
|
+
|
|
8
|
+
#include "RNFJSIConverter.h"
|
|
9
|
+
#include "WGPULogger.h"
|
|
10
|
+
|
|
11
|
+
#include "RNFHybridObject.h"
|
|
12
|
+
|
|
13
|
+
namespace jsi = facebook::jsi;
|
|
14
|
+
namespace m = margelo;
|
|
15
|
+
|
|
16
|
+
namespace rnwgpu {
|
|
17
|
+
|
|
18
|
+
struct GPUQueueDescriptor {
|
|
19
|
+
std::optional<std::string> label; // string
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
} // namespace rnwgpu
|
|
23
|
+
|
|
24
|
+
namespace margelo {
|
|
25
|
+
|
|
26
|
+
using namespace rnwgpu; // NOLINT(build/namespaces)
|
|
27
|
+
|
|
28
|
+
template <> struct JSIConverter<std::shared_ptr<rnwgpu::GPUQueueDescriptor>> {
|
|
29
|
+
static std::shared_ptr<rnwgpu::GPUQueueDescriptor>
|
|
30
|
+
fromJSI(jsi::Runtime &runtime, const jsi::Value &arg, bool outOfBounds) {
|
|
31
|
+
auto result = std::make_unique<rnwgpu::GPUQueueDescriptor>();
|
|
32
|
+
if (!outOfBounds && arg.isObject()) {
|
|
33
|
+
auto value = arg.getObject(runtime);
|
|
34
|
+
if (value.hasProperty(runtime, "label")) {
|
|
35
|
+
auto prop = value.getProperty(runtime, "label");
|
|
36
|
+
result->label = JSIConverter<std::optional<std::string>>::fromJSI(
|
|
37
|
+
runtime, prop, false);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
return result;
|
|
42
|
+
}
|
|
43
|
+
static jsi::Value toJSI(jsi::Runtime &runtime,
|
|
44
|
+
std::shared_ptr<rnwgpu::GPUQueueDescriptor> arg) {
|
|
45
|
+
throw std::runtime_error("Invalid GPUQueueDescriptor::toJSI()");
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
} // namespace margelo
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
|
|
3
|
+
#include <memory>
|
|
4
|
+
#include <string>
|
|
5
|
+
|
|
6
|
+
#include "webgpu/webgpu_cpp.h"
|
|
7
|
+
|
|
8
|
+
#include "RNFJSIConverter.h"
|
|
9
|
+
#include "WGPULogger.h"
|
|
10
|
+
|
|
11
|
+
#include "RNFHybridObject.h"
|
|
12
|
+
|
|
13
|
+
namespace jsi = facebook::jsi;
|
|
14
|
+
namespace m = margelo;
|
|
15
|
+
|
|
16
|
+
namespace rnwgpu {
|
|
17
|
+
|
|
18
|
+
struct GPURenderBundleDescriptor {
|
|
19
|
+
std::optional<std::string> label; // string
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
} // namespace rnwgpu
|
|
23
|
+
|
|
24
|
+
namespace margelo {
|
|
25
|
+
|
|
26
|
+
using namespace rnwgpu; // NOLINT(build/namespaces)
|
|
27
|
+
|
|
28
|
+
template <>
|
|
29
|
+
struct JSIConverter<std::shared_ptr<rnwgpu::GPURenderBundleDescriptor>> {
|
|
30
|
+
static std::shared_ptr<rnwgpu::GPURenderBundleDescriptor>
|
|
31
|
+
fromJSI(jsi::Runtime &runtime, const jsi::Value &arg, bool outOfBounds) {
|
|
32
|
+
auto result = std::make_unique<rnwgpu::GPURenderBundleDescriptor>();
|
|
33
|
+
if (!outOfBounds && arg.isObject()) {
|
|
34
|
+
auto value = arg.getObject(runtime);
|
|
35
|
+
if (value.hasProperty(runtime, "label")) {
|
|
36
|
+
auto prop = value.getProperty(runtime, "label");
|
|
37
|
+
result->label = JSIConverter<std::optional<std::string>>::fromJSI(
|
|
38
|
+
runtime, prop, false);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
return result;
|
|
43
|
+
}
|
|
44
|
+
static jsi::Value
|
|
45
|
+
toJSI(jsi::Runtime &runtime,
|
|
46
|
+
std::shared_ptr<rnwgpu::GPURenderBundleDescriptor> arg) {
|
|
47
|
+
throw std::runtime_error("Invalid GPURenderBundleDescriptor::toJSI()");
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
} // namespace margelo
|
|
@@ -2,29 +2,36 @@
|
|
|
2
2
|
|
|
3
3
|
#include <memory>
|
|
4
4
|
#include <string>
|
|
5
|
+
#include <vector>
|
|
5
6
|
|
|
6
7
|
#include "webgpu/webgpu_cpp.h"
|
|
7
8
|
|
|
8
|
-
#include "Logger.h"
|
|
9
9
|
#include "RNFJSIConverter.h"
|
|
10
|
-
#include
|
|
10
|
+
#include "WGPULogger.h"
|
|
11
|
+
|
|
12
|
+
#include "RNFHybridObject.h"
|
|
11
13
|
|
|
12
14
|
namespace jsi = facebook::jsi;
|
|
15
|
+
namespace m = margelo;
|
|
13
16
|
|
|
14
17
|
namespace rnwgpu {
|
|
15
18
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
std::
|
|
19
|
+
struct GPURenderBundleEncoderDescriptor {
|
|
20
|
+
std::optional<bool> depthReadOnly; // boolean
|
|
21
|
+
std::optional<bool> stencilReadOnly; // boolean
|
|
22
|
+
std::vector<std::variant<std::nullptr_t, wgpu::TextureFormat>>
|
|
23
|
+
colorFormats; // Iterable<GPUTextureFormat | null>
|
|
24
|
+
std::optional<wgpu::TextureFormat> depthStencilFormat; // GPUTextureFormat
|
|
25
|
+
std::optional<double> sampleCount; // GPUSize32
|
|
26
|
+
std::optional<std::string> label; // string
|
|
23
27
|
};
|
|
28
|
+
|
|
24
29
|
} // namespace rnwgpu
|
|
25
30
|
|
|
26
31
|
namespace margelo {
|
|
27
32
|
|
|
33
|
+
using namespace rnwgpu; // NOLINT(build/namespaces)
|
|
34
|
+
|
|
28
35
|
template <>
|
|
29
36
|
struct JSIConverter<std::shared_ptr<rnwgpu::GPURenderBundleEncoderDescriptor>> {
|
|
30
37
|
static std::shared_ptr<rnwgpu::GPURenderBundleEncoderDescriptor>
|
|
@@ -33,70 +40,47 @@ struct JSIConverter<std::shared_ptr<rnwgpu::GPURenderBundleEncoderDescriptor>> {
|
|
|
33
40
|
if (!outOfBounds && arg.isObject()) {
|
|
34
41
|
auto value = arg.getObject(runtime);
|
|
35
42
|
if (value.hasProperty(runtime, "depthReadOnly")) {
|
|
36
|
-
auto
|
|
43
|
+
auto prop = value.getProperty(runtime, "depthReadOnly");
|
|
44
|
+
result->depthReadOnly =
|
|
45
|
+
JSIConverter<std::optional<bool>>::fromJSI(runtime, prop, false);
|
|
37
46
|
}
|
|
38
47
|
if (value.hasProperty(runtime, "stencilReadOnly")) {
|
|
39
|
-
auto
|
|
48
|
+
auto prop = value.getProperty(runtime, "stencilReadOnly");
|
|
49
|
+
result->stencilReadOnly =
|
|
50
|
+
JSIConverter<std::optional<bool>>::fromJSI(runtime, prop, false);
|
|
40
51
|
}
|
|
41
52
|
if (value.hasProperty(runtime, "colorFormats")) {
|
|
42
|
-
auto
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
"Property GPURenderBundleEncoderDescriptor::colorFormats is "
|
|
47
|
-
"required");
|
|
48
|
-
}
|
|
49
|
-
} else {
|
|
50
|
-
throw std::runtime_error(
|
|
51
|
-
"Property GPURenderBundleEncoderDescriptor::colorFormats is not "
|
|
52
|
-
"defined");
|
|
53
|
+
auto prop = value.getProperty(runtime, "colorFormats");
|
|
54
|
+
result->colorFormats = JSIConverter<
|
|
55
|
+
std::vector<std::variant<std::nullptr_t, wgpu::TextureFormat>>>::
|
|
56
|
+
fromJSI(runtime, prop, false);
|
|
53
57
|
}
|
|
54
58
|
if (value.hasProperty(runtime, "depthStencilFormat")) {
|
|
55
|
-
auto
|
|
56
|
-
|
|
59
|
+
auto prop = value.getProperty(runtime, "depthStencilFormat");
|
|
60
|
+
result->depthStencilFormat =
|
|
61
|
+
JSIConverter<std::optional<wgpu::TextureFormat>>::fromJSI(
|
|
62
|
+
runtime, prop, false);
|
|
57
63
|
}
|
|
58
64
|
if (value.hasProperty(runtime, "sampleCount")) {
|
|
59
|
-
auto
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
result->_instance.sampleCount =
|
|
63
|
-
static_cast<wgpu::Size32>(sampleCount.getNumber());
|
|
64
|
-
}
|
|
65
|
+
auto prop = value.getProperty(runtime, "sampleCount");
|
|
66
|
+
result->sampleCount =
|
|
67
|
+
JSIConverter<std::optional<double>>::fromJSI(runtime, prop, false);
|
|
65
68
|
}
|
|
66
69
|
if (value.hasProperty(runtime, "label")) {
|
|
67
|
-
auto
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
auto str = label.asString(runtime).utf8(runtime);
|
|
71
|
-
result->label = str;
|
|
72
|
-
result->_instance.label = result->label.c_str();
|
|
73
|
-
}
|
|
70
|
+
auto prop = value.getProperty(runtime, "label");
|
|
71
|
+
result->label = JSIConverter<std::optional<std::string>>::fromJSI(
|
|
72
|
+
runtime, prop, false);
|
|
74
73
|
}
|
|
75
74
|
}
|
|
76
|
-
|
|
77
|
-
"GPURenderBundleEncoderDescriptor::depthReadOnly = %f",
|
|
78
|
-
result->_instance.depthReadOnly);
|
|
79
|
-
rnwgpu::Logger::logToConsole(
|
|
80
|
-
"GPURenderBundleEncoderDescriptor::stencilReadOnly = %f",
|
|
81
|
-
result->_instance.stencilReadOnly);
|
|
82
|
-
rnwgpu::Logger::logToConsole(
|
|
83
|
-
"GPURenderBundleEncoderDescriptor::colorFormats = %f",
|
|
84
|
-
result->_instance.colorFormats);
|
|
85
|
-
rnwgpu::Logger::logToConsole(
|
|
86
|
-
"GPURenderBundleEncoderDescriptor::depthStencilFormat = %f",
|
|
87
|
-
result->_instance.depthStencilFormat);
|
|
88
|
-
rnwgpu::Logger::logToConsole(
|
|
89
|
-
"GPURenderBundleEncoderDescriptor::sampleCount = %f",
|
|
90
|
-
result->_instance.sampleCount);
|
|
91
|
-
rnwgpu::Logger::logToConsole("GPURenderBundleEncoderDescriptor::label = %f",
|
|
92
|
-
result->_instance.label);
|
|
75
|
+
|
|
93
76
|
return result;
|
|
94
77
|
}
|
|
95
78
|
static jsi::Value
|
|
96
79
|
toJSI(jsi::Runtime &runtime,
|
|
97
80
|
std::shared_ptr<rnwgpu::GPURenderBundleEncoderDescriptor> arg) {
|
|
98
|
-
|
|
99
|
-
|
|
81
|
+
throw std::runtime_error(
|
|
82
|
+
"Invalid GPURenderBundleEncoderDescriptor::toJSI()");
|
|
100
83
|
}
|
|
101
84
|
};
|
|
102
|
-
|
|
85
|
+
|
|
86
|
+
} // namespace margelo
|
|
@@ -1,28 +1,37 @@
|
|
|
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 "GPUColor.h"
|
|
11
|
+
#include "GPUTextureView.h"
|
|
12
|
+
#include "RNFHybridObject.h"
|
|
11
13
|
|
|
12
14
|
namespace jsi = facebook::jsi;
|
|
15
|
+
namespace m = margelo;
|
|
13
16
|
|
|
14
17
|
namespace rnwgpu {
|
|
15
18
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
struct GPURenderPassColorAttachment {
|
|
20
|
+
std::shared_ptr<GPUTextureView> view; // GPUTextureView
|
|
21
|
+
std::optional<double> depthSlice; // GPUIntegerCoordinate
|
|
22
|
+
std::optional<std::shared_ptr<GPUTextureView>>
|
|
23
|
+
resolveTarget; // GPUTextureView
|
|
24
|
+
std::optional<std::shared_ptr<GPUColor>> clearValue; // GPUColor
|
|
25
|
+
wgpu::LoadOp loadOp; // GPULoadOp
|
|
26
|
+
wgpu::StoreOp storeOp; // GPUStoreOp
|
|
21
27
|
};
|
|
28
|
+
|
|
22
29
|
} // namespace rnwgpu
|
|
23
30
|
|
|
24
31
|
namespace margelo {
|
|
25
32
|
|
|
33
|
+
using namespace rnwgpu; // NOLINT(build/namespaces)
|
|
34
|
+
|
|
26
35
|
template <>
|
|
27
36
|
struct JSIConverter<std::shared_ptr<rnwgpu::GPURenderPassColorAttachment>> {
|
|
28
37
|
static std::shared_ptr<rnwgpu::GPURenderPassColorAttachment>
|
|
@@ -31,75 +40,47 @@ struct JSIConverter<std::shared_ptr<rnwgpu::GPURenderPassColorAttachment>> {
|
|
|
31
40
|
if (!outOfBounds && arg.isObject()) {
|
|
32
41
|
auto value = arg.getObject(runtime);
|
|
33
42
|
if (value.hasProperty(runtime, "view")) {
|
|
34
|
-
auto
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
throw std::runtime_error(
|
|
38
|
-
"Property GPURenderPassColorAttachment::view is required");
|
|
39
|
-
}
|
|
40
|
-
} else {
|
|
41
|
-
throw std::runtime_error(
|
|
42
|
-
"Property GPURenderPassColorAttachment::view is not defined");
|
|
43
|
+
auto prop = value.getProperty(runtime, "view");
|
|
44
|
+
result->view = JSIConverter<std::shared_ptr<GPUTextureView>>::fromJSI(
|
|
45
|
+
runtime, prop, false);
|
|
43
46
|
}
|
|
44
47
|
if (value.hasProperty(runtime, "depthSlice")) {
|
|
45
|
-
auto
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
result->_instance.depthSlice =
|
|
49
|
-
static_cast<wgpu::IntegerCoordinate>(depthSlice.getNumber());
|
|
50
|
-
}
|
|
48
|
+
auto prop = value.getProperty(runtime, "depthSlice");
|
|
49
|
+
result->depthSlice =
|
|
50
|
+
JSIConverter<std::optional<double>>::fromJSI(runtime, prop, false);
|
|
51
51
|
}
|
|
52
52
|
if (value.hasProperty(runtime, "resolveTarget")) {
|
|
53
|
-
auto
|
|
53
|
+
auto prop = value.getProperty(runtime, "resolveTarget");
|
|
54
|
+
result->resolveTarget = JSIConverter<
|
|
55
|
+
std::optional<std::shared_ptr<GPUTextureView>>>::fromJSI(runtime,
|
|
56
|
+
prop,
|
|
57
|
+
false);
|
|
54
58
|
}
|
|
55
59
|
if (value.hasProperty(runtime, "clearValue")) {
|
|
56
|
-
auto
|
|
60
|
+
auto prop = value.getProperty(runtime, "clearValue");
|
|
61
|
+
result->clearValue =
|
|
62
|
+
JSIConverter<std::optional<std::shared_ptr<GPUColor>>>::fromJSI(
|
|
63
|
+
runtime, prop, false);
|
|
57
64
|
}
|
|
58
65
|
if (value.hasProperty(runtime, "loadOp")) {
|
|
59
|
-
auto
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
throw std::runtime_error(
|
|
63
|
-
"Property GPURenderPassColorAttachment::loadOp is required");
|
|
64
|
-
}
|
|
65
|
-
} else {
|
|
66
|
-
throw std::runtime_error(
|
|
67
|
-
"Property GPURenderPassColorAttachment::loadOp is not defined");
|
|
66
|
+
auto prop = value.getProperty(runtime, "loadOp");
|
|
67
|
+
result->loadOp =
|
|
68
|
+
JSIConverter<wgpu::LoadOp>::fromJSI(runtime, prop, false);
|
|
68
69
|
}
|
|
69
70
|
if (value.hasProperty(runtime, "storeOp")) {
|
|
70
|
-
auto
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
throw std::runtime_error(
|
|
74
|
-
"Property GPURenderPassColorAttachment::storeOp is required");
|
|
75
|
-
}
|
|
76
|
-
} else {
|
|
77
|
-
throw std::runtime_error(
|
|
78
|
-
"Property GPURenderPassColorAttachment::storeOp is not defined");
|
|
71
|
+
auto prop = value.getProperty(runtime, "storeOp");
|
|
72
|
+
result->storeOp =
|
|
73
|
+
JSIConverter<wgpu::StoreOp>::fromJSI(runtime, prop, false);
|
|
79
74
|
}
|
|
80
75
|
}
|
|
81
|
-
|
|
82
|
-
result->_instance.view);
|
|
83
|
-
rnwgpu::Logger::logToConsole(
|
|
84
|
-
"GPURenderPassColorAttachment::depthSlice = %f",
|
|
85
|
-
result->_instance.depthSlice);
|
|
86
|
-
rnwgpu::Logger::logToConsole(
|
|
87
|
-
"GPURenderPassColorAttachment::resolveTarget = %f",
|
|
88
|
-
result->_instance.resolveTarget);
|
|
89
|
-
rnwgpu::Logger::logToConsole(
|
|
90
|
-
"GPURenderPassColorAttachment::clearValue = %f",
|
|
91
|
-
result->_instance.clearValue);
|
|
92
|
-
rnwgpu::Logger::logToConsole("GPURenderPassColorAttachment::loadOp = %f",
|
|
93
|
-
result->_instance.loadOp);
|
|
94
|
-
rnwgpu::Logger::logToConsole("GPURenderPassColorAttachment::storeOp = %f",
|
|
95
|
-
result->_instance.storeOp);
|
|
76
|
+
|
|
96
77
|
return result;
|
|
97
78
|
}
|
|
98
79
|
static jsi::Value
|
|
99
80
|
toJSI(jsi::Runtime &runtime,
|
|
100
81
|
std::shared_ptr<rnwgpu::GPURenderPassColorAttachment> arg) {
|
|
101
|
-
|
|
102
|
-
return jsi::Value::null();
|
|
82
|
+
throw std::runtime_error("Invalid GPURenderPassColorAttachment::toJSI()");
|
|
103
83
|
}
|
|
104
84
|
};
|
|
105
|
-
|
|
85
|
+
|
|
86
|
+
} // namespace margelo
|
|
@@ -1,28 +1,38 @@
|
|
|
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 "GPUTextureView.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::
|
|
18
|
+
struct GPURenderPassDepthStencilAttachment {
|
|
19
|
+
std::shared_ptr<GPUTextureView> view; // GPUTextureView
|
|
20
|
+
std::optional<double> depthClearValue; // number
|
|
21
|
+
std::optional<wgpu::LoadOp> depthLoadOp; // GPULoadOp
|
|
22
|
+
std::optional<wgpu::StoreOp> depthStoreOp; // GPUStoreOp
|
|
23
|
+
std::optional<bool> depthReadOnly; // boolean
|
|
24
|
+
std::optional<double> stencilClearValue; // GPUStencilValue
|
|
25
|
+
std::optional<wgpu::LoadOp> stencilLoadOp; // GPULoadOp
|
|
26
|
+
std::optional<wgpu::StoreOp> stencilStoreOp; // GPUStoreOp
|
|
27
|
+
std::optional<bool> stencilReadOnly; // boolean
|
|
21
28
|
};
|
|
29
|
+
|
|
22
30
|
} // namespace rnwgpu
|
|
23
31
|
|
|
24
32
|
namespace margelo {
|
|
25
33
|
|
|
34
|
+
using namespace rnwgpu; // NOLINT(build/namespaces)
|
|
35
|
+
|
|
26
36
|
template <>
|
|
27
37
|
struct JSIConverter<
|
|
28
38
|
std::shared_ptr<rnwgpu::GPURenderPassDepthStencilAttachment>> {
|
|
@@ -33,86 +43,64 @@ struct JSIConverter<
|
|
|
33
43
|
if (!outOfBounds && arg.isObject()) {
|
|
34
44
|
auto value = arg.getObject(runtime);
|
|
35
45
|
if (value.hasProperty(runtime, "view")) {
|
|
36
|
-
auto
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
throw std::runtime_error(
|
|
40
|
-
"Property GPURenderPassDepthStencilAttachment::view is required");
|
|
41
|
-
}
|
|
42
|
-
} else {
|
|
43
|
-
throw std::runtime_error(
|
|
44
|
-
"Property GPURenderPassDepthStencilAttachment::view is not "
|
|
45
|
-
"defined");
|
|
46
|
+
auto prop = value.getProperty(runtime, "view");
|
|
47
|
+
result->view = JSIConverter<std::shared_ptr<GPUTextureView>>::fromJSI(
|
|
48
|
+
runtime, prop, false);
|
|
46
49
|
}
|
|
47
50
|
if (value.hasProperty(runtime, "depthClearValue")) {
|
|
48
|
-
auto
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
result->_instance.depthClearValue = depthClearValue.getNumber();
|
|
52
|
-
}
|
|
51
|
+
auto prop = value.getProperty(runtime, "depthClearValue");
|
|
52
|
+
result->depthClearValue =
|
|
53
|
+
JSIConverter<std::optional<double>>::fromJSI(runtime, prop, false);
|
|
53
54
|
}
|
|
54
55
|
if (value.hasProperty(runtime, "depthLoadOp")) {
|
|
55
|
-
auto
|
|
56
|
+
auto prop = value.getProperty(runtime, "depthLoadOp");
|
|
57
|
+
result->depthLoadOp =
|
|
58
|
+
JSIConverter<std::optional<wgpu::LoadOp>>::fromJSI(runtime, prop,
|
|
59
|
+
false);
|
|
56
60
|
}
|
|
57
61
|
if (value.hasProperty(runtime, "depthStoreOp")) {
|
|
58
|
-
auto
|
|
62
|
+
auto prop = value.getProperty(runtime, "depthStoreOp");
|
|
63
|
+
result->depthStoreOp =
|
|
64
|
+
JSIConverter<std::optional<wgpu::StoreOp>>::fromJSI(runtime, prop,
|
|
65
|
+
false);
|
|
59
66
|
}
|
|
60
67
|
if (value.hasProperty(runtime, "depthReadOnly")) {
|
|
61
|
-
auto
|
|
68
|
+
auto prop = value.getProperty(runtime, "depthReadOnly");
|
|
69
|
+
result->depthReadOnly =
|
|
70
|
+
JSIConverter<std::optional<bool>>::fromJSI(runtime, prop, false);
|
|
62
71
|
}
|
|
63
72
|
if (value.hasProperty(runtime, "stencilClearValue")) {
|
|
64
|
-
auto
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
if (stencilClearValue.isNumber()) {
|
|
68
|
-
result->_instance.stencilClearValue =
|
|
69
|
-
static_cast<wgpu::StencilValue>(stencilClearValue.getNumber());
|
|
70
|
-
}
|
|
73
|
+
auto prop = value.getProperty(runtime, "stencilClearValue");
|
|
74
|
+
result->stencilClearValue =
|
|
75
|
+
JSIConverter<std::optional<double>>::fromJSI(runtime, prop, false);
|
|
71
76
|
}
|
|
72
77
|
if (value.hasProperty(runtime, "stencilLoadOp")) {
|
|
73
|
-
auto
|
|
78
|
+
auto prop = value.getProperty(runtime, "stencilLoadOp");
|
|
79
|
+
result->stencilLoadOp =
|
|
80
|
+
JSIConverter<std::optional<wgpu::LoadOp>>::fromJSI(runtime, prop,
|
|
81
|
+
false);
|
|
74
82
|
}
|
|
75
83
|
if (value.hasProperty(runtime, "stencilStoreOp")) {
|
|
76
|
-
auto
|
|
84
|
+
auto prop = value.getProperty(runtime, "stencilStoreOp");
|
|
85
|
+
result->stencilStoreOp =
|
|
86
|
+
JSIConverter<std::optional<wgpu::StoreOp>>::fromJSI(runtime, prop,
|
|
87
|
+
false);
|
|
77
88
|
}
|
|
78
89
|
if (value.hasProperty(runtime, "stencilReadOnly")) {
|
|
79
|
-
auto
|
|
90
|
+
auto prop = value.getProperty(runtime, "stencilReadOnly");
|
|
91
|
+
result->stencilReadOnly =
|
|
92
|
+
JSIConverter<std::optional<bool>>::fromJSI(runtime, prop, false);
|
|
80
93
|
}
|
|
81
94
|
}
|
|
82
|
-
|
|
83
|
-
"GPURenderPassDepthStencilAttachment::view = %f",
|
|
84
|
-
result->_instance.view);
|
|
85
|
-
rnwgpu::Logger::logToConsole(
|
|
86
|
-
"GPURenderPassDepthStencilAttachment::depthClearValue = %f",
|
|
87
|
-
result->_instance.depthClearValue);
|
|
88
|
-
rnwgpu::Logger::logToConsole(
|
|
89
|
-
"GPURenderPassDepthStencilAttachment::depthLoadOp = %f",
|
|
90
|
-
result->_instance.depthLoadOp);
|
|
91
|
-
rnwgpu::Logger::logToConsole(
|
|
92
|
-
"GPURenderPassDepthStencilAttachment::depthStoreOp = %f",
|
|
93
|
-
result->_instance.depthStoreOp);
|
|
94
|
-
rnwgpu::Logger::logToConsole(
|
|
95
|
-
"GPURenderPassDepthStencilAttachment::depthReadOnly = %f",
|
|
96
|
-
result->_instance.depthReadOnly);
|
|
97
|
-
rnwgpu::Logger::logToConsole(
|
|
98
|
-
"GPURenderPassDepthStencilAttachment::stencilClearValue = %f",
|
|
99
|
-
result->_instance.stencilClearValue);
|
|
100
|
-
rnwgpu::Logger::logToConsole(
|
|
101
|
-
"GPURenderPassDepthStencilAttachment::stencilLoadOp = %f",
|
|
102
|
-
result->_instance.stencilLoadOp);
|
|
103
|
-
rnwgpu::Logger::logToConsole(
|
|
104
|
-
"GPURenderPassDepthStencilAttachment::stencilStoreOp = %f",
|
|
105
|
-
result->_instance.stencilStoreOp);
|
|
106
|
-
rnwgpu::Logger::logToConsole(
|
|
107
|
-
"GPURenderPassDepthStencilAttachment::stencilReadOnly = %f",
|
|
108
|
-
result->_instance.stencilReadOnly);
|
|
95
|
+
|
|
109
96
|
return result;
|
|
110
97
|
}
|
|
111
98
|
static jsi::Value
|
|
112
99
|
toJSI(jsi::Runtime &runtime,
|
|
113
100
|
std::shared_ptr<rnwgpu::GPURenderPassDepthStencilAttachment> arg) {
|
|
114
|
-
|
|
115
|
-
|
|
101
|
+
throw std::runtime_error(
|
|
102
|
+
"Invalid GPURenderPassDepthStencilAttachment::toJSI()");
|
|
116
103
|
}
|
|
117
104
|
};
|
|
118
|
-
|
|
105
|
+
|
|
106
|
+
} // namespace margelo
|