react-native-wgpu 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +20 -0
- package/README.md +31 -0
- package/android/CMakeLists.txt +74 -0
- package/android/build.gradle +166 -0
- package/android/cpp/cpp-adapter.cpp +12 -0
- package/android/gradle.properties +5 -0
- package/android/src/main/AndroidManifest.xml +3 -0
- package/android/src/main/AndroidManifestNew.xml +2 -0
- package/android/src/main/java/com/webgpu/WebGPUModule.java +39 -0
- package/android/src/main/java/com/webgpu/WebGPUView.java +24 -0
- package/android/src/main/java/com/webgpu/WebGPUViewManager.java +31 -0
- package/android/src/main/java/com/webgpu/WebGPUViewPackage.java +26 -0
- package/android/src/newarch/WgpuViewManagerSpec.java +24 -0
- package/android/src/oldarch/WebGPUViewManagerSpec.java +11 -0
- package/cpp/Logger.h +82 -0
- package/cpp/dawn/dawn_proc_table.h +308 -0
- package/cpp/dawn/webgpu.h +4201 -0
- package/cpp/dawn/webgpu_cpp.h +8985 -0
- package/cpp/dawn/webgpu_cpp_print.h +2460 -0
- package/cpp/dawn/wire/client/webgpu.h +339 -0
- package/cpp/dawn/wire/client/webgpu_cpp.h +9140 -0
- package/cpp/jsi/RNFEnumMapper.h +49 -0
- package/cpp/jsi/RNFHybridObject.cpp +145 -0
- package/cpp/jsi/RNFHybridObject.h +162 -0
- package/cpp/jsi/RNFJSIConverter.h +412 -0
- package/cpp/jsi/RNFJSIHelper.h +49 -0
- package/cpp/jsi/RNFPointerHolder.h +95 -0
- package/cpp/jsi/RNFPromise.cpp +45 -0
- package/cpp/jsi/RNFPromise.h +38 -0
- package/cpp/jsi/RNFRuntimeCache.cpp +57 -0
- package/cpp/jsi/RNFRuntimeCache.h +79 -0
- package/cpp/jsi/RNFWorkletRuntimeCollector.h +43 -0
- package/cpp/jsi/RNFWorkletRuntimeRegistry.cpp +11 -0
- package/cpp/jsi/RNFWorkletRuntimeRegistry.h +44 -0
- package/cpp/rnwgpu/MutableBuffer.h +48 -0
- package/cpp/rnwgpu/RNWebGPUManager.cpp +60 -0
- package/cpp/rnwgpu/RNWebGPUManager.h +30 -0
- package/cpp/rnwgpu/api/GPU.cpp +40 -0
- package/cpp/rnwgpu/api/GPU.h +43 -0
- package/cpp/rnwgpu/api/GPUAdapter.cpp +33 -0
- package/cpp/rnwgpu/api/GPUAdapter.h +40 -0
- package/cpp/rnwgpu/api/GPUAdapterInfo.h +33 -0
- package/cpp/rnwgpu/api/GPUBindGroup.h +38 -0
- package/cpp/rnwgpu/api/GPUBindGroupLayout.h +39 -0
- package/cpp/rnwgpu/api/GPUBuffer.cpp +16 -0
- package/cpp/rnwgpu/api/GPUBuffer.h +44 -0
- package/cpp/rnwgpu/api/GPUCanvasContext.h +33 -0
- package/cpp/rnwgpu/api/GPUCommandBuffer.h +38 -0
- package/cpp/rnwgpu/api/GPUCommandEncoder.h +38 -0
- package/cpp/rnwgpu/api/GPUCompilationInfo.h +33 -0
- package/cpp/rnwgpu/api/GPUCompilationMessage.h +33 -0
- package/cpp/rnwgpu/api/GPUComputePassEncoder.h +40 -0
- package/cpp/rnwgpu/api/GPUComputePipeline.h +39 -0
- package/cpp/rnwgpu/api/GPUDevice.cpp +12 -0
- package/cpp/rnwgpu/api/GPUDevice.h +45 -0
- package/cpp/rnwgpu/api/GPUDeviceLostInfo.h +33 -0
- package/cpp/rnwgpu/api/GPUExternalTexture.h +39 -0
- package/cpp/rnwgpu/api/GPUPipelineLayout.h +38 -0
- package/cpp/rnwgpu/api/GPUQuerySet.h +38 -0
- package/cpp/rnwgpu/api/GPUQueue.h +38 -0
- package/cpp/rnwgpu/api/GPURenderBundle.h +38 -0
- package/cpp/rnwgpu/api/GPURenderBundleEncoder.h +40 -0
- package/cpp/rnwgpu/api/GPURenderPassEncoder.h +40 -0
- package/cpp/rnwgpu/api/GPURenderPipeline.h +38 -0
- package/cpp/rnwgpu/api/GPUSampler.h +38 -0
- package/cpp/rnwgpu/api/GPUShaderModule.h +38 -0
- package/cpp/rnwgpu/api/GPUSupportedLimits.h +33 -0
- package/cpp/rnwgpu/api/GPUTexture.h +38 -0
- package/cpp/rnwgpu/api/GPUTextureView.h +38 -0
- package/cpp/rnwgpu/api/GPUUncapturedErrorEvent.h +33 -0
- package/cpp/rnwgpu/api/descriptors/GPUBindGroupDescriptor.h +81 -0
- package/cpp/rnwgpu/api/descriptors/GPUBindGroupEntry.h +67 -0
- package/cpp/rnwgpu/api/descriptors/GPUBindGroupLayoutDescriptor.h +69 -0
- package/cpp/rnwgpu/api/descriptors/GPUBindGroupLayoutEntry.h +95 -0
- package/cpp/rnwgpu/api/descriptors/GPUBlendComponent.h +56 -0
- package/cpp/rnwgpu/api/descriptors/GPUBlendState.h +65 -0
- package/cpp/rnwgpu/api/descriptors/GPUBufferBinding.h +72 -0
- package/cpp/rnwgpu/api/descriptors/GPUBufferBindingLayout.h +62 -0
- package/cpp/rnwgpu/api/descriptors/GPUBufferDescriptor.h +85 -0
- package/cpp/rnwgpu/api/descriptors/GPUBufferUsage.h +43 -0
- package/cpp/rnwgpu/api/descriptors/GPUCanvasConfiguration.h +93 -0
- package/cpp/rnwgpu/api/descriptors/GPUColorDict.h +81 -0
- package/cpp/rnwgpu/api/descriptors/GPUColorTargetState.h +69 -0
- package/cpp/rnwgpu/api/descriptors/GPUColorWrite.h +31 -0
- package/cpp/rnwgpu/api/descriptors/GPUComputePassDescriptor.h +62 -0
- package/cpp/rnwgpu/api/descriptors/GPUComputePassTimestampWrites.h +80 -0
- package/cpp/rnwgpu/api/descriptors/GPUComputePipelineDescriptor.h +82 -0
- package/cpp/rnwgpu/api/descriptors/GPUDepthStencilState.h +126 -0
- package/cpp/rnwgpu/api/descriptors/GPUDeviceDescriptor.h +69 -0
- package/cpp/rnwgpu/api/descriptors/GPUExtent3DDict.h +76 -0
- package/cpp/rnwgpu/api/descriptors/GPUExtent3DDictStrict.h +91 -0
- package/cpp/rnwgpu/api/descriptors/GPUExternalTextureBindingLayout.h +44 -0
- package/cpp/rnwgpu/api/descriptors/GPUExternalTextureDescriptor.h +75 -0
- package/cpp/rnwgpu/api/descriptors/GPUFragmentState.h +85 -0
- package/cpp/rnwgpu/api/descriptors/GPUImageCopyBuffer.h +83 -0
- package/cpp/rnwgpu/api/descriptors/GPUImageCopyExternalImage.h +66 -0
- package/cpp/rnwgpu/api/descriptors/GPUImageCopyTexture.h +74 -0
- package/cpp/rnwgpu/api/descriptors/GPUImageCopyTextureTagged.h +88 -0
- package/cpp/rnwgpu/api/descriptors/GPUImageDataLayout.h +70 -0
- package/cpp/rnwgpu/api/descriptors/GPUMapMode.h +25 -0
- package/cpp/rnwgpu/api/descriptors/GPUMultisampleState.h +68 -0
- package/cpp/rnwgpu/api/descriptors/GPUOrigin2DDict.h +61 -0
- package/cpp/rnwgpu/api/descriptors/GPUOrigin2DDictStrict.h +75 -0
- package/cpp/rnwgpu/api/descriptors/GPUOrigin3DDict.h +71 -0
- package/cpp/rnwgpu/api/descriptors/GPUPipelineErrorInit.h +54 -0
- package/cpp/rnwgpu/api/descriptors/GPUPipelineLayoutDescriptor.h +72 -0
- package/cpp/rnwgpu/api/descriptors/GPUPrimitiveState.h +66 -0
- package/cpp/rnwgpu/api/descriptors/GPUProgrammableStage.h +72 -0
- package/cpp/rnwgpu/api/descriptors/GPUQuerySetDescriptor.h +81 -0
- package/cpp/rnwgpu/api/descriptors/GPURenderBundleEncoderDescriptor.h +102 -0
- package/cpp/rnwgpu/api/descriptors/GPURenderPassColorAttachment.h +105 -0
- package/cpp/rnwgpu/api/descriptors/GPURenderPassDepthStencilAttachment.h +118 -0
- package/cpp/rnwgpu/api/descriptors/GPURenderPassDescriptor.h +100 -0
- package/cpp/rnwgpu/api/descriptors/GPURenderPassLayout.h +83 -0
- package/cpp/rnwgpu/api/descriptors/GPURenderPassTimestampWrites.h +80 -0
- package/cpp/rnwgpu/api/descriptors/GPURenderPipelineDescriptor.h +104 -0
- package/cpp/rnwgpu/api/descriptors/GPURequestAdapterOptions.h +56 -0
- package/cpp/rnwgpu/api/descriptors/GPUSamplerBindingLayout.h +48 -0
- package/cpp/rnwgpu/api/descriptors/GPUSamplerDescriptor.h +116 -0
- package/cpp/rnwgpu/api/descriptors/GPUShaderModuleCompilationHint.h +64 -0
- package/cpp/rnwgpu/api/descriptors/GPUShaderModuleDescriptor.h +88 -0
- package/cpp/rnwgpu/api/descriptors/GPUShaderStage.h +27 -0
- package/cpp/rnwgpu/api/descriptors/GPUStencilFaceState.h +61 -0
- package/cpp/rnwgpu/api/descriptors/GPUStorageTextureBindingLayout.h +67 -0
- package/cpp/rnwgpu/api/descriptors/GPUTextureBindingLayout.h +58 -0
- package/cpp/rnwgpu/api/descriptors/GPUTextureDescriptor.h +123 -0
- package/cpp/rnwgpu/api/descriptors/GPUTextureUsage.h +40 -0
- package/cpp/rnwgpu/api/descriptors/GPUTextureViewDescriptor.h +113 -0
- package/cpp/rnwgpu/api/descriptors/GPUUncapturedErrorEventInit.h +71 -0
- package/cpp/rnwgpu/api/descriptors/GPUVertexAttribute.h +80 -0
- package/cpp/rnwgpu/api/descriptors/GPUVertexBufferLayout.h +73 -0
- package/cpp/rnwgpu/api/descriptors/GPUVertexState.h +77 -0
- package/cpp/rnwgpu/api/descriptors/Unions.h +1645 -0
- package/cpp/webgpu/webgpu.h +33 -0
- package/cpp/webgpu/webgpu_cpp.h +33 -0
- package/cpp/webgpu/webgpu_cpp_chained_struct.h +55 -0
- package/cpp/webgpu/webgpu_enum_class_bitmasks.h +161 -0
- package/ios/RNFAppleLogger.mm +22 -0
- package/ios/Utils.h +5 -0
- package/ios/Utils.m +26 -0
- package/ios/WebGPUModule.h +18 -0
- package/ios/WebGPUModule.mm +77 -0
- package/ios/WebGPUView.h +15 -0
- package/ios/WebGPUView.mm +58 -0
- package/ios/WebGPUViewManager.mm +21 -0
- package/lib/commonjs/WebGPUNativeModule.js +10 -0
- package/lib/commonjs/WebGPUNativeModule.js.map +1 -0
- package/lib/commonjs/WebGPUViewNativeComponent.js +11 -0
- package/lib/commonjs/WebGPUViewNativeComponent.js.map +1 -0
- package/lib/commonjs/index.js +45 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/module/WebGPUNativeModule.js +4 -0
- package/lib/module/WebGPUNativeModule.js.map +1 -0
- package/lib/module/WebGPUViewNativeComponent.js +4 -0
- package/lib/module/WebGPUViewNativeComponent.js.map +1 -0
- package/lib/module/index.js +9 -0
- package/lib/module/index.js.map +1 -0
- package/lib/typescript/babel.config.d.ts +2 -0
- package/lib/typescript/babel.config.d.ts.map +1 -0
- package/lib/typescript/jest.config.d.ts +5 -0
- package/lib/typescript/jest.config.d.ts.map +1 -0
- package/lib/typescript/lib/commonjs/WebGPUNativeModule.d.ts +5 -0
- package/lib/typescript/lib/commonjs/WebGPUNativeModule.d.ts.map +1 -0
- package/lib/typescript/lib/commonjs/WebGPUViewNativeComponent.d.ts +4 -0
- package/lib/typescript/lib/commonjs/WebGPUViewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/lib/commonjs/index.d.ts +5 -0
- package/lib/typescript/lib/commonjs/index.d.ts.map +1 -0
- package/lib/typescript/lib/module/WebGPUNativeModule.d.ts +3 -0
- package/lib/typescript/lib/module/WebGPUNativeModule.d.ts.map +1 -0
- package/lib/typescript/lib/module/WebGPUViewNativeComponent.d.ts +4 -0
- package/lib/typescript/lib/module/WebGPUViewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/lib/module/index.d.ts +5 -0
- package/lib/typescript/lib/module/index.d.ts.map +1 -0
- package/lib/typescript/scripts/build/copy-artifacts.d.ts +2 -0
- package/lib/typescript/scripts/build/copy-artifacts.d.ts.map +1 -0
- package/lib/typescript/scripts/build/dawn.d.ts +2 -0
- package/lib/typescript/scripts/build/dawn.d.ts.map +1 -0
- package/lib/typescript/scripts/build/util.d.ts +13 -0
- package/lib/typescript/scripts/build/util.d.ts.map +1 -0
- package/lib/typescript/scripts/codegen/codegen.d.ts +2 -0
- package/lib/typescript/scripts/codegen/codegen.d.ts.map +1 -0
- package/lib/typescript/scripts/codegen/model/dawn.d.ts +2 -0
- package/lib/typescript/scripts/codegen/model/dawn.d.ts.map +1 -0
- package/lib/typescript/scripts/codegen/model/model.d.ts +8 -0
- package/lib/typescript/scripts/codegen/model/model.d.ts.map +1 -0
- package/lib/typescript/scripts/codegen/templates/Descriptor.d.ts +4 -0
- package/lib/typescript/scripts/codegen/templates/Descriptor.d.ts.map +1 -0
- package/lib/typescript/scripts/codegen/templates/Enum.d.ts +3 -0
- package/lib/typescript/scripts/codegen/templates/Enum.d.ts.map +1 -0
- package/lib/typescript/scripts/codegen/templates/HybridObject.d.ts +3 -0
- package/lib/typescript/scripts/codegen/templates/HybridObject.d.ts.map +1 -0
- package/lib/typescript/scripts/codegen/templates/Unions.d.ts +6 -0
- package/lib/typescript/scripts/codegen/templates/Unions.d.ts.map +1 -0
- package/lib/typescript/scripts/codegen/templates/common.d.ts +9 -0
- package/lib/typescript/scripts/codegen/templates/common.d.ts.map +1 -0
- package/lib/typescript/scripts/codegen/util.d.ts +2 -0
- package/lib/typescript/scripts/codegen/util.d.ts.map +1 -0
- package/lib/typescript/src/WebGPUNativeModule.d.ts +7 -0
- package/lib/typescript/src/WebGPUNativeModule.d.ts.map +1 -0
- package/lib/typescript/src/WebGPUViewNativeComponent.d.ts +8 -0
- package/lib/typescript/src/WebGPUViewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +9 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/package.json +120 -0
- package/react-native-webgpu.podspec +56 -0
- package/src/WebGPUNativeModule.ts +9 -0
- package/src/WebGPUViewNativeComponent.ts +9 -0
- package/src/index.tsx +13 -0
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
|
|
3
|
+
#include <memory>
|
|
4
|
+
#include <string>
|
|
5
|
+
|
|
6
|
+
#include "webgpu/webgpu_cpp.h"
|
|
7
|
+
|
|
8
|
+
#include "Logger.h"
|
|
9
|
+
#include "RNFJSIConverter.h"
|
|
10
|
+
#include <RNFHybridObject.h>
|
|
11
|
+
|
|
12
|
+
namespace jsi = facebook::jsi;
|
|
13
|
+
|
|
14
|
+
namespace rnwgpu {
|
|
15
|
+
|
|
16
|
+
class GPUShaderModuleDescriptor {
|
|
17
|
+
public:
|
|
18
|
+
wgpu::ShaderModuleDescriptor *getInstance() { return &_instance; }
|
|
19
|
+
|
|
20
|
+
wgpu::ShaderModuleDescriptor _instance;
|
|
21
|
+
|
|
22
|
+
std::string label;
|
|
23
|
+
};
|
|
24
|
+
} // namespace rnwgpu
|
|
25
|
+
|
|
26
|
+
namespace margelo {
|
|
27
|
+
|
|
28
|
+
template <>
|
|
29
|
+
struct JSIConverter<std::shared_ptr<rnwgpu::GPUShaderModuleDescriptor>> {
|
|
30
|
+
static std::shared_ptr<rnwgpu::GPUShaderModuleDescriptor>
|
|
31
|
+
fromJSI(jsi::Runtime &runtime, const jsi::Value &arg, bool outOfBounds) {
|
|
32
|
+
auto result = std::make_unique<rnwgpu::GPUShaderModuleDescriptor>();
|
|
33
|
+
if (!outOfBounds && arg.isObject()) {
|
|
34
|
+
auto value = arg.getObject(runtime);
|
|
35
|
+
if (value.hasProperty(runtime, "code")) {
|
|
36
|
+
auto code = value.getProperty(runtime, "code");
|
|
37
|
+
|
|
38
|
+
if (code.isUndefined()) {
|
|
39
|
+
throw std::runtime_error(
|
|
40
|
+
"Property GPUShaderModuleDescriptor::code is required");
|
|
41
|
+
}
|
|
42
|
+
} else {
|
|
43
|
+
throw std::runtime_error(
|
|
44
|
+
"Property GPUShaderModuleDescriptor::code is not defined");
|
|
45
|
+
}
|
|
46
|
+
if (value.hasProperty(runtime, "sourceMap")) {
|
|
47
|
+
auto sourceMap = value.getProperty(runtime, "sourceMap");
|
|
48
|
+
|
|
49
|
+
if (sourceMap.isUndefined()) {
|
|
50
|
+
throw std::runtime_error(
|
|
51
|
+
"Property GPUShaderModuleDescriptor::sourceMap is required");
|
|
52
|
+
}
|
|
53
|
+
} else {
|
|
54
|
+
throw std::runtime_error(
|
|
55
|
+
"Property GPUShaderModuleDescriptor::sourceMap is not defined");
|
|
56
|
+
}
|
|
57
|
+
if (value.hasProperty(runtime, "compilationHints")) {
|
|
58
|
+
auto compilationHints = value.getProperty(runtime, "compilationHints");
|
|
59
|
+
}
|
|
60
|
+
if (value.hasProperty(runtime, "label")) {
|
|
61
|
+
auto label = value.getProperty(runtime, "label");
|
|
62
|
+
|
|
63
|
+
if (label.isString()) {
|
|
64
|
+
auto str = label.asString(runtime).utf8(runtime);
|
|
65
|
+
result->label = str;
|
|
66
|
+
result->_instance.label = result->label.c_str();
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
rnwgpu::Logger::logToConsole("GPUShaderModuleDescriptor::code = %f",
|
|
71
|
+
result->_instance.code);
|
|
72
|
+
rnwgpu::Logger::logToConsole("GPUShaderModuleDescriptor::sourceMap = %f",
|
|
73
|
+
result->_instance.sourceMap);
|
|
74
|
+
rnwgpu::Logger::logToConsole(
|
|
75
|
+
"GPUShaderModuleDescriptor::compilationHints = %f",
|
|
76
|
+
result->_instance.compilationHints);
|
|
77
|
+
rnwgpu::Logger::logToConsole("GPUShaderModuleDescriptor::label = %f",
|
|
78
|
+
result->_instance.label);
|
|
79
|
+
return result;
|
|
80
|
+
}
|
|
81
|
+
static jsi::Value
|
|
82
|
+
toJSI(jsi::Runtime &runtime,
|
|
83
|
+
std::shared_ptr<rnwgpu::GPUShaderModuleDescriptor> arg) {
|
|
84
|
+
// No conversions here
|
|
85
|
+
return jsi::Value::null();
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
} // namespace margelo
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
#include <string>
|
|
3
|
+
|
|
4
|
+
#include <RNFHybridObject.h>
|
|
5
|
+
|
|
6
|
+
#include "webgpu/webgpu_cpp.h"
|
|
7
|
+
|
|
8
|
+
namespace rnwgpu {
|
|
9
|
+
|
|
10
|
+
namespace m = margelo;
|
|
11
|
+
|
|
12
|
+
class GPUShaderStage : public m::HybridObject {
|
|
13
|
+
public:
|
|
14
|
+
GPUShaderStage() : HybridObject("GPUShaderStage") {}
|
|
15
|
+
|
|
16
|
+
public:
|
|
17
|
+
double Vertex() { return static_cast<double>(wgpu::ShaderStage::Vertex); }
|
|
18
|
+
double Fragment() { return static_cast<double>(wgpu::ShaderStage::Fragment); }
|
|
19
|
+
double Compute() { return static_cast<double>(wgpu::ShaderStage::Compute); }
|
|
20
|
+
|
|
21
|
+
void loadHybridMethods() override {
|
|
22
|
+
registerHybridGetter("VERTEX", &GPUShaderStage::Vertex, this);
|
|
23
|
+
registerHybridGetter("FRAGMENT", &GPUShaderStage::Fragment, this);
|
|
24
|
+
registerHybridGetter("COMPUTE", &GPUShaderStage::Compute, this);
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
} // namespace rnwgpu
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
|
|
3
|
+
#include <memory>
|
|
4
|
+
#include <string>
|
|
5
|
+
|
|
6
|
+
#include "webgpu/webgpu_cpp.h"
|
|
7
|
+
|
|
8
|
+
#include "Logger.h"
|
|
9
|
+
#include "RNFJSIConverter.h"
|
|
10
|
+
#include <RNFHybridObject.h>
|
|
11
|
+
|
|
12
|
+
namespace jsi = facebook::jsi;
|
|
13
|
+
|
|
14
|
+
namespace rnwgpu {
|
|
15
|
+
|
|
16
|
+
class GPUStencilFaceState {
|
|
17
|
+
public:
|
|
18
|
+
wgpu::StencilFaceState *getInstance() { return &_instance; }
|
|
19
|
+
|
|
20
|
+
wgpu::StencilFaceState _instance;
|
|
21
|
+
};
|
|
22
|
+
} // namespace rnwgpu
|
|
23
|
+
|
|
24
|
+
namespace margelo {
|
|
25
|
+
|
|
26
|
+
template <> struct JSIConverter<std::shared_ptr<rnwgpu::GPUStencilFaceState>> {
|
|
27
|
+
static std::shared_ptr<rnwgpu::GPUStencilFaceState>
|
|
28
|
+
fromJSI(jsi::Runtime &runtime, const jsi::Value &arg, bool outOfBounds) {
|
|
29
|
+
auto result = std::make_unique<rnwgpu::GPUStencilFaceState>();
|
|
30
|
+
if (!outOfBounds && arg.isObject()) {
|
|
31
|
+
auto value = arg.getObject(runtime);
|
|
32
|
+
if (value.hasProperty(runtime, "compare")) {
|
|
33
|
+
auto compare = value.getProperty(runtime, "compare");
|
|
34
|
+
}
|
|
35
|
+
if (value.hasProperty(runtime, "failOp")) {
|
|
36
|
+
auto failOp = value.getProperty(runtime, "failOp");
|
|
37
|
+
}
|
|
38
|
+
if (value.hasProperty(runtime, "depthFailOp")) {
|
|
39
|
+
auto depthFailOp = value.getProperty(runtime, "depthFailOp");
|
|
40
|
+
}
|
|
41
|
+
if (value.hasProperty(runtime, "passOp")) {
|
|
42
|
+
auto passOp = value.getProperty(runtime, "passOp");
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
rnwgpu::Logger::logToConsole("GPUStencilFaceState::compare = %f",
|
|
46
|
+
result->_instance.compare);
|
|
47
|
+
rnwgpu::Logger::logToConsole("GPUStencilFaceState::failOp = %f",
|
|
48
|
+
result->_instance.failOp);
|
|
49
|
+
rnwgpu::Logger::logToConsole("GPUStencilFaceState::depthFailOp = %f",
|
|
50
|
+
result->_instance.depthFailOp);
|
|
51
|
+
rnwgpu::Logger::logToConsole("GPUStencilFaceState::passOp = %f",
|
|
52
|
+
result->_instance.passOp);
|
|
53
|
+
return result;
|
|
54
|
+
}
|
|
55
|
+
static jsi::Value toJSI(jsi::Runtime &runtime,
|
|
56
|
+
std::shared_ptr<rnwgpu::GPUStencilFaceState> arg) {
|
|
57
|
+
// No conversions here
|
|
58
|
+
return jsi::Value::null();
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
} // namespace margelo
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
|
|
3
|
+
#include <memory>
|
|
4
|
+
#include <string>
|
|
5
|
+
|
|
6
|
+
#include "webgpu/webgpu_cpp.h"
|
|
7
|
+
|
|
8
|
+
#include "Logger.h"
|
|
9
|
+
#include "RNFJSIConverter.h"
|
|
10
|
+
#include <RNFHybridObject.h>
|
|
11
|
+
|
|
12
|
+
namespace jsi = facebook::jsi;
|
|
13
|
+
|
|
14
|
+
namespace rnwgpu {
|
|
15
|
+
|
|
16
|
+
class GPUStorageTextureBindingLayout {
|
|
17
|
+
public:
|
|
18
|
+
wgpu::StorageTextureBindingLayout *getInstance() { return &_instance; }
|
|
19
|
+
|
|
20
|
+
wgpu::StorageTextureBindingLayout _instance;
|
|
21
|
+
};
|
|
22
|
+
} // namespace rnwgpu
|
|
23
|
+
|
|
24
|
+
namespace margelo {
|
|
25
|
+
|
|
26
|
+
template <>
|
|
27
|
+
struct JSIConverter<std::shared_ptr<rnwgpu::GPUStorageTextureBindingLayout>> {
|
|
28
|
+
static std::shared_ptr<rnwgpu::GPUStorageTextureBindingLayout>
|
|
29
|
+
fromJSI(jsi::Runtime &runtime, const jsi::Value &arg, bool outOfBounds) {
|
|
30
|
+
auto result = std::make_unique<rnwgpu::GPUStorageTextureBindingLayout>();
|
|
31
|
+
if (!outOfBounds && arg.isObject()) {
|
|
32
|
+
auto value = arg.getObject(runtime);
|
|
33
|
+
if (value.hasProperty(runtime, "access")) {
|
|
34
|
+
auto access = value.getProperty(runtime, "access");
|
|
35
|
+
}
|
|
36
|
+
if (value.hasProperty(runtime, "format")) {
|
|
37
|
+
auto format = value.getProperty(runtime, "format");
|
|
38
|
+
|
|
39
|
+
if (format.isUndefined()) {
|
|
40
|
+
throw std::runtime_error(
|
|
41
|
+
"Property GPUStorageTextureBindingLayout::format is required");
|
|
42
|
+
}
|
|
43
|
+
} else {
|
|
44
|
+
throw std::runtime_error(
|
|
45
|
+
"Property GPUStorageTextureBindingLayout::format is not defined");
|
|
46
|
+
}
|
|
47
|
+
if (value.hasProperty(runtime, "viewDimension")) {
|
|
48
|
+
auto viewDimension = value.getProperty(runtime, "viewDimension");
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
rnwgpu::Logger::logToConsole("GPUStorageTextureBindingLayout::access = %f",
|
|
52
|
+
result->_instance.access);
|
|
53
|
+
rnwgpu::Logger::logToConsole("GPUStorageTextureBindingLayout::format = %f",
|
|
54
|
+
result->_instance.format);
|
|
55
|
+
rnwgpu::Logger::logToConsole(
|
|
56
|
+
"GPUStorageTextureBindingLayout::viewDimension = %f",
|
|
57
|
+
result->_instance.viewDimension);
|
|
58
|
+
return result;
|
|
59
|
+
}
|
|
60
|
+
static jsi::Value
|
|
61
|
+
toJSI(jsi::Runtime &runtime,
|
|
62
|
+
std::shared_ptr<rnwgpu::GPUStorageTextureBindingLayout> arg) {
|
|
63
|
+
// No conversions here
|
|
64
|
+
return jsi::Value::null();
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
} // namespace margelo
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
|
|
3
|
+
#include <memory>
|
|
4
|
+
#include <string>
|
|
5
|
+
|
|
6
|
+
#include "webgpu/webgpu_cpp.h"
|
|
7
|
+
|
|
8
|
+
#include "Logger.h"
|
|
9
|
+
#include "RNFJSIConverter.h"
|
|
10
|
+
#include <RNFHybridObject.h>
|
|
11
|
+
|
|
12
|
+
namespace jsi = facebook::jsi;
|
|
13
|
+
|
|
14
|
+
namespace rnwgpu {
|
|
15
|
+
|
|
16
|
+
class GPUTextureBindingLayout {
|
|
17
|
+
public:
|
|
18
|
+
wgpu::TextureBindingLayout *getInstance() { return &_instance; }
|
|
19
|
+
|
|
20
|
+
wgpu::TextureBindingLayout _instance;
|
|
21
|
+
};
|
|
22
|
+
} // namespace rnwgpu
|
|
23
|
+
|
|
24
|
+
namespace margelo {
|
|
25
|
+
|
|
26
|
+
template <>
|
|
27
|
+
struct JSIConverter<std::shared_ptr<rnwgpu::GPUTextureBindingLayout>> {
|
|
28
|
+
static std::shared_ptr<rnwgpu::GPUTextureBindingLayout>
|
|
29
|
+
fromJSI(jsi::Runtime &runtime, const jsi::Value &arg, bool outOfBounds) {
|
|
30
|
+
auto result = std::make_unique<rnwgpu::GPUTextureBindingLayout>();
|
|
31
|
+
if (!outOfBounds && arg.isObject()) {
|
|
32
|
+
auto value = arg.getObject(runtime);
|
|
33
|
+
if (value.hasProperty(runtime, "sampleType")) {
|
|
34
|
+
auto sampleType = value.getProperty(runtime, "sampleType");
|
|
35
|
+
}
|
|
36
|
+
if (value.hasProperty(runtime, "viewDimension")) {
|
|
37
|
+
auto viewDimension = value.getProperty(runtime, "viewDimension");
|
|
38
|
+
}
|
|
39
|
+
if (value.hasProperty(runtime, "multisampled")) {
|
|
40
|
+
auto multisampled = value.getProperty(runtime, "multisampled");
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
rnwgpu::Logger::logToConsole("GPUTextureBindingLayout::sampleType = %f",
|
|
44
|
+
result->_instance.sampleType);
|
|
45
|
+
rnwgpu::Logger::logToConsole("GPUTextureBindingLayout::viewDimension = %f",
|
|
46
|
+
result->_instance.viewDimension);
|
|
47
|
+
rnwgpu::Logger::logToConsole("GPUTextureBindingLayout::multisampled = %f",
|
|
48
|
+
result->_instance.multisampled);
|
|
49
|
+
return result;
|
|
50
|
+
}
|
|
51
|
+
static jsi::Value
|
|
52
|
+
toJSI(jsi::Runtime &runtime,
|
|
53
|
+
std::shared_ptr<rnwgpu::GPUTextureBindingLayout> arg) {
|
|
54
|
+
// No conversions here
|
|
55
|
+
return jsi::Value::null();
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
} // namespace margelo
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
|
|
3
|
+
#include <memory>
|
|
4
|
+
#include <string>
|
|
5
|
+
|
|
6
|
+
#include "webgpu/webgpu_cpp.h"
|
|
7
|
+
|
|
8
|
+
#include "Logger.h"
|
|
9
|
+
#include "RNFJSIConverter.h"
|
|
10
|
+
#include <RNFHybridObject.h>
|
|
11
|
+
|
|
12
|
+
namespace jsi = facebook::jsi;
|
|
13
|
+
|
|
14
|
+
namespace rnwgpu {
|
|
15
|
+
|
|
16
|
+
class GPUTextureDescriptor {
|
|
17
|
+
public:
|
|
18
|
+
wgpu::TextureDescriptor *getInstance() { return &_instance; }
|
|
19
|
+
|
|
20
|
+
wgpu::TextureDescriptor _instance;
|
|
21
|
+
|
|
22
|
+
std::string label;
|
|
23
|
+
};
|
|
24
|
+
} // namespace rnwgpu
|
|
25
|
+
|
|
26
|
+
namespace margelo {
|
|
27
|
+
|
|
28
|
+
template <> struct JSIConverter<std::shared_ptr<rnwgpu::GPUTextureDescriptor>> {
|
|
29
|
+
static std::shared_ptr<rnwgpu::GPUTextureDescriptor>
|
|
30
|
+
fromJSI(jsi::Runtime &runtime, const jsi::Value &arg, bool outOfBounds) {
|
|
31
|
+
auto result = std::make_unique<rnwgpu::GPUTextureDescriptor>();
|
|
32
|
+
if (!outOfBounds && arg.isObject()) {
|
|
33
|
+
auto value = arg.getObject(runtime);
|
|
34
|
+
if (value.hasProperty(runtime, "size")) {
|
|
35
|
+
auto size = value.getProperty(runtime, "size");
|
|
36
|
+
|
|
37
|
+
if (size.isUndefined()) {
|
|
38
|
+
throw std::runtime_error(
|
|
39
|
+
"Property GPUTextureDescriptor::size is required");
|
|
40
|
+
}
|
|
41
|
+
} else {
|
|
42
|
+
throw std::runtime_error(
|
|
43
|
+
"Property GPUTextureDescriptor::size is not defined");
|
|
44
|
+
}
|
|
45
|
+
if (value.hasProperty(runtime, "mipLevelCount")) {
|
|
46
|
+
auto mipLevelCount = value.getProperty(runtime, "mipLevelCount");
|
|
47
|
+
|
|
48
|
+
if (mipLevelCount.isNumber()) {
|
|
49
|
+
result->_instance.mipLevelCount =
|
|
50
|
+
static_cast<wgpu::IntegerCoordinate>(mipLevelCount.getNumber());
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
if (value.hasProperty(runtime, "sampleCount")) {
|
|
54
|
+
auto sampleCount = value.getProperty(runtime, "sampleCount");
|
|
55
|
+
|
|
56
|
+
if (sampleCount.isNumber()) {
|
|
57
|
+
result->_instance.sampleCount =
|
|
58
|
+
static_cast<wgpu::Size32>(sampleCount.getNumber());
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
if (value.hasProperty(runtime, "dimension")) {
|
|
62
|
+
auto dimension = value.getProperty(runtime, "dimension");
|
|
63
|
+
}
|
|
64
|
+
if (value.hasProperty(runtime, "format")) {
|
|
65
|
+
auto format = value.getProperty(runtime, "format");
|
|
66
|
+
|
|
67
|
+
if (format.isUndefined()) {
|
|
68
|
+
throw std::runtime_error(
|
|
69
|
+
"Property GPUTextureDescriptor::format is required");
|
|
70
|
+
}
|
|
71
|
+
} else {
|
|
72
|
+
throw std::runtime_error(
|
|
73
|
+
"Property GPUTextureDescriptor::format is not defined");
|
|
74
|
+
}
|
|
75
|
+
if (value.hasProperty(runtime, "usage")) {
|
|
76
|
+
auto usage = value.getProperty(runtime, "usage");
|
|
77
|
+
|
|
78
|
+
if (usage.isUndefined()) {
|
|
79
|
+
throw std::runtime_error(
|
|
80
|
+
"Property GPUTextureDescriptor::usage is required");
|
|
81
|
+
}
|
|
82
|
+
} else {
|
|
83
|
+
throw std::runtime_error(
|
|
84
|
+
"Property GPUTextureDescriptor::usage is not defined");
|
|
85
|
+
}
|
|
86
|
+
if (value.hasProperty(runtime, "viewFormats")) {
|
|
87
|
+
auto viewFormats = value.getProperty(runtime, "viewFormats");
|
|
88
|
+
}
|
|
89
|
+
if (value.hasProperty(runtime, "label")) {
|
|
90
|
+
auto label = value.getProperty(runtime, "label");
|
|
91
|
+
|
|
92
|
+
if (label.isString()) {
|
|
93
|
+
auto str = label.asString(runtime).utf8(runtime);
|
|
94
|
+
result->label = str;
|
|
95
|
+
result->_instance.label = result->label.c_str();
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
rnwgpu::Logger::logToConsole("GPUTextureDescriptor::size = %f",
|
|
100
|
+
result->_instance.size);
|
|
101
|
+
rnwgpu::Logger::logToConsole("GPUTextureDescriptor::mipLevelCount = %f",
|
|
102
|
+
result->_instance.mipLevelCount);
|
|
103
|
+
rnwgpu::Logger::logToConsole("GPUTextureDescriptor::sampleCount = %f",
|
|
104
|
+
result->_instance.sampleCount);
|
|
105
|
+
rnwgpu::Logger::logToConsole("GPUTextureDescriptor::dimension = %f",
|
|
106
|
+
result->_instance.dimension);
|
|
107
|
+
rnwgpu::Logger::logToConsole("GPUTextureDescriptor::format = %f",
|
|
108
|
+
result->_instance.format);
|
|
109
|
+
rnwgpu::Logger::logToConsole("GPUTextureDescriptor::usage = %f",
|
|
110
|
+
result->_instance.usage);
|
|
111
|
+
rnwgpu::Logger::logToConsole("GPUTextureDescriptor::viewFormats = %f",
|
|
112
|
+
result->_instance.viewFormats);
|
|
113
|
+
rnwgpu::Logger::logToConsole("GPUTextureDescriptor::label = %f",
|
|
114
|
+
result->_instance.label);
|
|
115
|
+
return result;
|
|
116
|
+
}
|
|
117
|
+
static jsi::Value toJSI(jsi::Runtime &runtime,
|
|
118
|
+
std::shared_ptr<rnwgpu::GPUTextureDescriptor> arg) {
|
|
119
|
+
// No conversions here
|
|
120
|
+
return jsi::Value::null();
|
|
121
|
+
}
|
|
122
|
+
};
|
|
123
|
+
} // namespace margelo
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
#include <string>
|
|
3
|
+
|
|
4
|
+
#include <RNFHybridObject.h>
|
|
5
|
+
|
|
6
|
+
#include "webgpu/webgpu_cpp.h"
|
|
7
|
+
|
|
8
|
+
namespace rnwgpu {
|
|
9
|
+
|
|
10
|
+
namespace m = margelo;
|
|
11
|
+
|
|
12
|
+
class GPUTextureUsage : public m::HybridObject {
|
|
13
|
+
public:
|
|
14
|
+
GPUTextureUsage() : HybridObject("GPUTextureUsage") {}
|
|
15
|
+
|
|
16
|
+
public:
|
|
17
|
+
double CopySrc() { return static_cast<double>(wgpu::TextureUsage::CopySrc); }
|
|
18
|
+
double CopyDst() { return static_cast<double>(wgpu::TextureUsage::CopyDst); }
|
|
19
|
+
double TextureBinding() {
|
|
20
|
+
return static_cast<double>(wgpu::TextureUsage::TextureBinding);
|
|
21
|
+
}
|
|
22
|
+
double StorageBinding() {
|
|
23
|
+
return static_cast<double>(wgpu::TextureUsage::StorageBinding);
|
|
24
|
+
}
|
|
25
|
+
double RenderAttachment() {
|
|
26
|
+
return static_cast<double>(wgpu::TextureUsage::RenderAttachment);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
void loadHybridMethods() override {
|
|
30
|
+
registerHybridGetter("COPY_SRC", &GPUTextureUsage::CopySrc, this);
|
|
31
|
+
registerHybridGetter("COPY_DST", &GPUTextureUsage::CopyDst, this);
|
|
32
|
+
registerHybridGetter("TEXTURE_BINDING", &GPUTextureUsage::TextureBinding,
|
|
33
|
+
this);
|
|
34
|
+
registerHybridGetter("STORAGE_BINDING", &GPUTextureUsage::StorageBinding,
|
|
35
|
+
this);
|
|
36
|
+
registerHybridGetter("RENDER_ATTACHMENT",
|
|
37
|
+
&GPUTextureUsage::RenderAttachment, this);
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
} // namespace rnwgpu
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
|
|
3
|
+
#include <memory>
|
|
4
|
+
#include <string>
|
|
5
|
+
|
|
6
|
+
#include "webgpu/webgpu_cpp.h"
|
|
7
|
+
|
|
8
|
+
#include "Logger.h"
|
|
9
|
+
#include "RNFJSIConverter.h"
|
|
10
|
+
#include <RNFHybridObject.h>
|
|
11
|
+
|
|
12
|
+
namespace jsi = facebook::jsi;
|
|
13
|
+
|
|
14
|
+
namespace rnwgpu {
|
|
15
|
+
|
|
16
|
+
class GPUTextureViewDescriptor {
|
|
17
|
+
public:
|
|
18
|
+
wgpu::TextureViewDescriptor *getInstance() { return &_instance; }
|
|
19
|
+
|
|
20
|
+
wgpu::TextureViewDescriptor _instance;
|
|
21
|
+
|
|
22
|
+
std::string label;
|
|
23
|
+
};
|
|
24
|
+
} // namespace rnwgpu
|
|
25
|
+
|
|
26
|
+
namespace margelo {
|
|
27
|
+
|
|
28
|
+
template <>
|
|
29
|
+
struct JSIConverter<std::shared_ptr<rnwgpu::GPUTextureViewDescriptor>> {
|
|
30
|
+
static std::shared_ptr<rnwgpu::GPUTextureViewDescriptor>
|
|
31
|
+
fromJSI(jsi::Runtime &runtime, const jsi::Value &arg, bool outOfBounds) {
|
|
32
|
+
auto result = std::make_unique<rnwgpu::GPUTextureViewDescriptor>();
|
|
33
|
+
if (!outOfBounds && arg.isObject()) {
|
|
34
|
+
auto value = arg.getObject(runtime);
|
|
35
|
+
if (value.hasProperty(runtime, "format")) {
|
|
36
|
+
auto format = value.getProperty(runtime, "format");
|
|
37
|
+
}
|
|
38
|
+
if (value.hasProperty(runtime, "dimension")) {
|
|
39
|
+
auto dimension = value.getProperty(runtime, "dimension");
|
|
40
|
+
}
|
|
41
|
+
if (value.hasProperty(runtime, "aspect")) {
|
|
42
|
+
auto aspect = value.getProperty(runtime, "aspect");
|
|
43
|
+
}
|
|
44
|
+
if (value.hasProperty(runtime, "baseMipLevel")) {
|
|
45
|
+
auto baseMipLevel = value.getProperty(runtime, "baseMipLevel");
|
|
46
|
+
|
|
47
|
+
if (baseMipLevel.isNumber()) {
|
|
48
|
+
result->_instance.baseMipLevel =
|
|
49
|
+
static_cast<wgpu::IntegerCoordinate>(baseMipLevel.getNumber());
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
if (value.hasProperty(runtime, "mipLevelCount")) {
|
|
53
|
+
auto mipLevelCount = value.getProperty(runtime, "mipLevelCount");
|
|
54
|
+
|
|
55
|
+
if (mipLevelCount.isNumber()) {
|
|
56
|
+
result->_instance.mipLevelCount =
|
|
57
|
+
static_cast<wgpu::IntegerCoordinate>(mipLevelCount.getNumber());
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
if (value.hasProperty(runtime, "baseArrayLayer")) {
|
|
61
|
+
auto baseArrayLayer = value.getProperty(runtime, "baseArrayLayer");
|
|
62
|
+
|
|
63
|
+
if (baseArrayLayer.isNumber()) {
|
|
64
|
+
result->_instance.baseArrayLayer =
|
|
65
|
+
static_cast<wgpu::IntegerCoordinate>(baseArrayLayer.getNumber());
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
if (value.hasProperty(runtime, "arrayLayerCount")) {
|
|
69
|
+
auto arrayLayerCount = value.getProperty(runtime, "arrayLayerCount");
|
|
70
|
+
|
|
71
|
+
if (arrayLayerCount.isNumber()) {
|
|
72
|
+
result->_instance.arrayLayerCount =
|
|
73
|
+
static_cast<wgpu::IntegerCoordinate>(arrayLayerCount.getNumber());
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
if (value.hasProperty(runtime, "label")) {
|
|
77
|
+
auto label = value.getProperty(runtime, "label");
|
|
78
|
+
|
|
79
|
+
if (label.isString()) {
|
|
80
|
+
auto str = label.asString(runtime).utf8(runtime);
|
|
81
|
+
result->label = str;
|
|
82
|
+
result->_instance.label = result->label.c_str();
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
rnwgpu::Logger::logToConsole("GPUTextureViewDescriptor::format = %f",
|
|
87
|
+
result->_instance.format);
|
|
88
|
+
rnwgpu::Logger::logToConsole("GPUTextureViewDescriptor::dimension = %f",
|
|
89
|
+
result->_instance.dimension);
|
|
90
|
+
rnwgpu::Logger::logToConsole("GPUTextureViewDescriptor::aspect = %f",
|
|
91
|
+
result->_instance.aspect);
|
|
92
|
+
rnwgpu::Logger::logToConsole("GPUTextureViewDescriptor::baseMipLevel = %f",
|
|
93
|
+
result->_instance.baseMipLevel);
|
|
94
|
+
rnwgpu::Logger::logToConsole("GPUTextureViewDescriptor::mipLevelCount = %f",
|
|
95
|
+
result->_instance.mipLevelCount);
|
|
96
|
+
rnwgpu::Logger::logToConsole(
|
|
97
|
+
"GPUTextureViewDescriptor::baseArrayLayer = %f",
|
|
98
|
+
result->_instance.baseArrayLayer);
|
|
99
|
+
rnwgpu::Logger::logToConsole(
|
|
100
|
+
"GPUTextureViewDescriptor::arrayLayerCount = %f",
|
|
101
|
+
result->_instance.arrayLayerCount);
|
|
102
|
+
rnwgpu::Logger::logToConsole("GPUTextureViewDescriptor::label = %f",
|
|
103
|
+
result->_instance.label);
|
|
104
|
+
return result;
|
|
105
|
+
}
|
|
106
|
+
static jsi::Value
|
|
107
|
+
toJSI(jsi::Runtime &runtime,
|
|
108
|
+
std::shared_ptr<rnwgpu::GPUTextureViewDescriptor> arg) {
|
|
109
|
+
// No conversions here
|
|
110
|
+
return jsi::Value::null();
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
} // namespace margelo
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
|
|
3
|
+
#include <memory>
|
|
4
|
+
#include <string>
|
|
5
|
+
|
|
6
|
+
#include "webgpu/webgpu_cpp.h"
|
|
7
|
+
|
|
8
|
+
#include "Logger.h"
|
|
9
|
+
#include "RNFJSIConverter.h"
|
|
10
|
+
#include <RNFHybridObject.h>
|
|
11
|
+
|
|
12
|
+
namespace jsi = facebook::jsi;
|
|
13
|
+
|
|
14
|
+
namespace rnwgpu {
|
|
15
|
+
|
|
16
|
+
class GPUUncapturedErrorEventInit {
|
|
17
|
+
public:
|
|
18
|
+
wgpu::UncapturedErrorEventInit *getInstance() { return &_instance; }
|
|
19
|
+
|
|
20
|
+
wgpu::UncapturedErrorEventInit _instance;
|
|
21
|
+
};
|
|
22
|
+
} // namespace rnwgpu
|
|
23
|
+
|
|
24
|
+
namespace margelo {
|
|
25
|
+
|
|
26
|
+
template <>
|
|
27
|
+
struct JSIConverter<std::shared_ptr<rnwgpu::GPUUncapturedErrorEventInit>> {
|
|
28
|
+
static std::shared_ptr<rnwgpu::GPUUncapturedErrorEventInit>
|
|
29
|
+
fromJSI(jsi::Runtime &runtime, const jsi::Value &arg, bool outOfBounds) {
|
|
30
|
+
auto result = std::make_unique<rnwgpu::GPUUncapturedErrorEventInit>();
|
|
31
|
+
if (!outOfBounds && arg.isObject()) {
|
|
32
|
+
auto value = arg.getObject(runtime);
|
|
33
|
+
if (value.hasProperty(runtime, "error")) {
|
|
34
|
+
auto error = value.getProperty(runtime, "error");
|
|
35
|
+
|
|
36
|
+
if (error.isUndefined()) {
|
|
37
|
+
throw std::runtime_error(
|
|
38
|
+
"Property GPUUncapturedErrorEventInit::error is required");
|
|
39
|
+
}
|
|
40
|
+
} else {
|
|
41
|
+
throw std::runtime_error(
|
|
42
|
+
"Property GPUUncapturedErrorEventInit::error is not defined");
|
|
43
|
+
}
|
|
44
|
+
if (value.hasProperty(runtime, "bubbles")) {
|
|
45
|
+
auto bubbles = value.getProperty(runtime, "bubbles");
|
|
46
|
+
}
|
|
47
|
+
if (value.hasProperty(runtime, "cancelable")) {
|
|
48
|
+
auto cancelable = value.getProperty(runtime, "cancelable");
|
|
49
|
+
}
|
|
50
|
+
if (value.hasProperty(runtime, "composed")) {
|
|
51
|
+
auto composed = value.getProperty(runtime, "composed");
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
rnwgpu::Logger::logToConsole("GPUUncapturedErrorEventInit::error = %f",
|
|
55
|
+
result->_instance.error);
|
|
56
|
+
rnwgpu::Logger::logToConsole("GPUUncapturedErrorEventInit::bubbles = %f",
|
|
57
|
+
result->_instance.bubbles);
|
|
58
|
+
rnwgpu::Logger::logToConsole("GPUUncapturedErrorEventInit::cancelable = %f",
|
|
59
|
+
result->_instance.cancelable);
|
|
60
|
+
rnwgpu::Logger::logToConsole("GPUUncapturedErrorEventInit::composed = %f",
|
|
61
|
+
result->_instance.composed);
|
|
62
|
+
return result;
|
|
63
|
+
}
|
|
64
|
+
static jsi::Value
|
|
65
|
+
toJSI(jsi::Runtime &runtime,
|
|
66
|
+
std::shared_ptr<rnwgpu::GPUUncapturedErrorEventInit> arg) {
|
|
67
|
+
// No conversions here
|
|
68
|
+
return jsi::Value::null();
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
} // namespace margelo
|