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,54 @@
|
|
|
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 GPUPipelineErrorInit {
|
|
17
|
+
public:
|
|
18
|
+
wgpu::PipelineErrorInit *getInstance() { return &_instance; }
|
|
19
|
+
|
|
20
|
+
wgpu::PipelineErrorInit _instance;
|
|
21
|
+
};
|
|
22
|
+
} // namespace rnwgpu
|
|
23
|
+
|
|
24
|
+
namespace margelo {
|
|
25
|
+
|
|
26
|
+
template <> struct JSIConverter<std::shared_ptr<rnwgpu::GPUPipelineErrorInit>> {
|
|
27
|
+
static std::shared_ptr<rnwgpu::GPUPipelineErrorInit>
|
|
28
|
+
fromJSI(jsi::Runtime &runtime, const jsi::Value &arg, bool outOfBounds) {
|
|
29
|
+
auto result = std::make_unique<rnwgpu::GPUPipelineErrorInit>();
|
|
30
|
+
if (!outOfBounds && arg.isObject()) {
|
|
31
|
+
auto value = arg.getObject(runtime);
|
|
32
|
+
if (value.hasProperty(runtime, "reason")) {
|
|
33
|
+
auto reason = value.getProperty(runtime, "reason");
|
|
34
|
+
|
|
35
|
+
if (reason.isUndefined()) {
|
|
36
|
+
throw std::runtime_error(
|
|
37
|
+
"Property GPUPipelineErrorInit::reason is required");
|
|
38
|
+
}
|
|
39
|
+
} else {
|
|
40
|
+
throw std::runtime_error(
|
|
41
|
+
"Property GPUPipelineErrorInit::reason is not defined");
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
rnwgpu::Logger::logToConsole("GPUPipelineErrorInit::reason = %f",
|
|
45
|
+
result->_instance.reason);
|
|
46
|
+
return result;
|
|
47
|
+
}
|
|
48
|
+
static jsi::Value toJSI(jsi::Runtime &runtime,
|
|
49
|
+
std::shared_ptr<rnwgpu::GPUPipelineErrorInit> arg) {
|
|
50
|
+
// No conversions here
|
|
51
|
+
return jsi::Value::null();
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
} // namespace margelo
|
|
@@ -0,0 +1,72 @@
|
|
|
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 GPUPipelineLayoutDescriptor {
|
|
17
|
+
public:
|
|
18
|
+
wgpu::PipelineLayoutDescriptor *getInstance() { return &_instance; }
|
|
19
|
+
|
|
20
|
+
wgpu::PipelineLayoutDescriptor _instance;
|
|
21
|
+
|
|
22
|
+
std::string label;
|
|
23
|
+
};
|
|
24
|
+
} // namespace rnwgpu
|
|
25
|
+
|
|
26
|
+
namespace margelo {
|
|
27
|
+
|
|
28
|
+
template <>
|
|
29
|
+
struct JSIConverter<std::shared_ptr<rnwgpu::GPUPipelineLayoutDescriptor>> {
|
|
30
|
+
static std::shared_ptr<rnwgpu::GPUPipelineLayoutDescriptor>
|
|
31
|
+
fromJSI(jsi::Runtime &runtime, const jsi::Value &arg, bool outOfBounds) {
|
|
32
|
+
auto result = std::make_unique<rnwgpu::GPUPipelineLayoutDescriptor>();
|
|
33
|
+
if (!outOfBounds && arg.isObject()) {
|
|
34
|
+
auto value = arg.getObject(runtime);
|
|
35
|
+
if (value.hasProperty(runtime, "bindGroupLayouts")) {
|
|
36
|
+
auto bindGroupLayouts = value.getProperty(runtime, "bindGroupLayouts");
|
|
37
|
+
|
|
38
|
+
if (bindGroupLayouts.isUndefined()) {
|
|
39
|
+
throw std::runtime_error(
|
|
40
|
+
"Property GPUPipelineLayoutDescriptor::bindGroupLayouts is "
|
|
41
|
+
"required");
|
|
42
|
+
}
|
|
43
|
+
} else {
|
|
44
|
+
throw std::runtime_error(
|
|
45
|
+
"Property GPUPipelineLayoutDescriptor::bindGroupLayouts is not "
|
|
46
|
+
"defined");
|
|
47
|
+
}
|
|
48
|
+
if (value.hasProperty(runtime, "label")) {
|
|
49
|
+
auto label = value.getProperty(runtime, "label");
|
|
50
|
+
|
|
51
|
+
if (label.isString()) {
|
|
52
|
+
auto str = label.asString(runtime).utf8(runtime);
|
|
53
|
+
result->label = str;
|
|
54
|
+
result->_instance.label = result->label.c_str();
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
rnwgpu::Logger::logToConsole(
|
|
59
|
+
"GPUPipelineLayoutDescriptor::bindGroupLayouts = %f",
|
|
60
|
+
result->_instance.bindGroupLayouts);
|
|
61
|
+
rnwgpu::Logger::logToConsole("GPUPipelineLayoutDescriptor::label = %f",
|
|
62
|
+
result->_instance.label);
|
|
63
|
+
return result;
|
|
64
|
+
}
|
|
65
|
+
static jsi::Value
|
|
66
|
+
toJSI(jsi::Runtime &runtime,
|
|
67
|
+
std::shared_ptr<rnwgpu::GPUPipelineLayoutDescriptor> arg) {
|
|
68
|
+
// No conversions here
|
|
69
|
+
return jsi::Value::null();
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
} // namespace margelo
|
|
@@ -0,0 +1,66 @@
|
|
|
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 GPUPrimitiveState {
|
|
17
|
+
public:
|
|
18
|
+
wgpu::PrimitiveState *getInstance() { return &_instance; }
|
|
19
|
+
|
|
20
|
+
wgpu::PrimitiveState _instance;
|
|
21
|
+
};
|
|
22
|
+
} // namespace rnwgpu
|
|
23
|
+
|
|
24
|
+
namespace margelo {
|
|
25
|
+
|
|
26
|
+
template <> struct JSIConverter<std::shared_ptr<rnwgpu::GPUPrimitiveState>> {
|
|
27
|
+
static std::shared_ptr<rnwgpu::GPUPrimitiveState>
|
|
28
|
+
fromJSI(jsi::Runtime &runtime, const jsi::Value &arg, bool outOfBounds) {
|
|
29
|
+
auto result = std::make_unique<rnwgpu::GPUPrimitiveState>();
|
|
30
|
+
if (!outOfBounds && arg.isObject()) {
|
|
31
|
+
auto value = arg.getObject(runtime);
|
|
32
|
+
if (value.hasProperty(runtime, "topology")) {
|
|
33
|
+
auto topology = value.getProperty(runtime, "topology");
|
|
34
|
+
}
|
|
35
|
+
if (value.hasProperty(runtime, "stripIndexFormat")) {
|
|
36
|
+
auto stripIndexFormat = value.getProperty(runtime, "stripIndexFormat");
|
|
37
|
+
}
|
|
38
|
+
if (value.hasProperty(runtime, "frontFace")) {
|
|
39
|
+
auto frontFace = value.getProperty(runtime, "frontFace");
|
|
40
|
+
}
|
|
41
|
+
if (value.hasProperty(runtime, "cullMode")) {
|
|
42
|
+
auto cullMode = value.getProperty(runtime, "cullMode");
|
|
43
|
+
}
|
|
44
|
+
if (value.hasProperty(runtime, "unclippedDepth")) {
|
|
45
|
+
auto unclippedDepth = value.getProperty(runtime, "unclippedDepth");
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
rnwgpu::Logger::logToConsole("GPUPrimitiveState::topology = %f",
|
|
49
|
+
result->_instance.topology);
|
|
50
|
+
rnwgpu::Logger::logToConsole("GPUPrimitiveState::stripIndexFormat = %f",
|
|
51
|
+
result->_instance.stripIndexFormat);
|
|
52
|
+
rnwgpu::Logger::logToConsole("GPUPrimitiveState::frontFace = %f",
|
|
53
|
+
result->_instance.frontFace);
|
|
54
|
+
rnwgpu::Logger::logToConsole("GPUPrimitiveState::cullMode = %f",
|
|
55
|
+
result->_instance.cullMode);
|
|
56
|
+
rnwgpu::Logger::logToConsole("GPUPrimitiveState::unclippedDepth = %f",
|
|
57
|
+
result->_instance.unclippedDepth);
|
|
58
|
+
return result;
|
|
59
|
+
}
|
|
60
|
+
static jsi::Value toJSI(jsi::Runtime &runtime,
|
|
61
|
+
std::shared_ptr<rnwgpu::GPUPrimitiveState> arg) {
|
|
62
|
+
// No conversions here
|
|
63
|
+
return jsi::Value::null();
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
} // namespace margelo
|
|
@@ -0,0 +1,72 @@
|
|
|
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 GPUProgrammableStage {
|
|
17
|
+
public:
|
|
18
|
+
wgpu::ProgrammableStage *getInstance() { return &_instance; }
|
|
19
|
+
|
|
20
|
+
wgpu::ProgrammableStage _instance;
|
|
21
|
+
|
|
22
|
+
std::string entryPoint;
|
|
23
|
+
};
|
|
24
|
+
} // namespace rnwgpu
|
|
25
|
+
|
|
26
|
+
namespace margelo {
|
|
27
|
+
|
|
28
|
+
template <> struct JSIConverter<std::shared_ptr<rnwgpu::GPUProgrammableStage>> {
|
|
29
|
+
static std::shared_ptr<rnwgpu::GPUProgrammableStage>
|
|
30
|
+
fromJSI(jsi::Runtime &runtime, const jsi::Value &arg, bool outOfBounds) {
|
|
31
|
+
auto result = std::make_unique<rnwgpu::GPUProgrammableStage>();
|
|
32
|
+
if (!outOfBounds && arg.isObject()) {
|
|
33
|
+
auto value = arg.getObject(runtime);
|
|
34
|
+
if (value.hasProperty(runtime, "module")) {
|
|
35
|
+
auto module = value.getProperty(runtime, "module");
|
|
36
|
+
|
|
37
|
+
if (module.isUndefined()) {
|
|
38
|
+
throw std::runtime_error(
|
|
39
|
+
"Property GPUProgrammableStage::module is required");
|
|
40
|
+
}
|
|
41
|
+
} else {
|
|
42
|
+
throw std::runtime_error(
|
|
43
|
+
"Property GPUProgrammableStage::module is not defined");
|
|
44
|
+
}
|
|
45
|
+
if (value.hasProperty(runtime, "entryPoint")) {
|
|
46
|
+
auto entryPoint = value.getProperty(runtime, "entryPoint");
|
|
47
|
+
|
|
48
|
+
if (entryPoint.isString()) {
|
|
49
|
+
auto str = entryPoint.asString(runtime).utf8(runtime);
|
|
50
|
+
result->entryPoint = str;
|
|
51
|
+
result->_instance.entryPoint = result->entryPoint.c_str();
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
if (value.hasProperty(runtime, "constants")) {
|
|
55
|
+
auto constants = value.getProperty(runtime, "constants");
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
rnwgpu::Logger::logToConsole("GPUProgrammableStage::module = %f",
|
|
59
|
+
result->_instance.module);
|
|
60
|
+
rnwgpu::Logger::logToConsole("GPUProgrammableStage::entryPoint = %f",
|
|
61
|
+
result->_instance.entryPoint);
|
|
62
|
+
rnwgpu::Logger::logToConsole("GPUProgrammableStage::constants = %f",
|
|
63
|
+
result->_instance.constants);
|
|
64
|
+
return result;
|
|
65
|
+
}
|
|
66
|
+
static jsi::Value toJSI(jsi::Runtime &runtime,
|
|
67
|
+
std::shared_ptr<rnwgpu::GPUProgrammableStage> arg) {
|
|
68
|
+
// No conversions here
|
|
69
|
+
return jsi::Value::null();
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
} // namespace margelo
|
|
@@ -0,0 +1,81 @@
|
|
|
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 GPUQuerySetDescriptor {
|
|
17
|
+
public:
|
|
18
|
+
wgpu::QuerySetDescriptor *getInstance() { return &_instance; }
|
|
19
|
+
|
|
20
|
+
wgpu::QuerySetDescriptor _instance;
|
|
21
|
+
|
|
22
|
+
std::string label;
|
|
23
|
+
};
|
|
24
|
+
} // namespace rnwgpu
|
|
25
|
+
|
|
26
|
+
namespace margelo {
|
|
27
|
+
|
|
28
|
+
template <>
|
|
29
|
+
struct JSIConverter<std::shared_ptr<rnwgpu::GPUQuerySetDescriptor>> {
|
|
30
|
+
static std::shared_ptr<rnwgpu::GPUQuerySetDescriptor>
|
|
31
|
+
fromJSI(jsi::Runtime &runtime, const jsi::Value &arg, bool outOfBounds) {
|
|
32
|
+
auto result = std::make_unique<rnwgpu::GPUQuerySetDescriptor>();
|
|
33
|
+
if (!outOfBounds && arg.isObject()) {
|
|
34
|
+
auto value = arg.getObject(runtime);
|
|
35
|
+
if (value.hasProperty(runtime, "type")) {
|
|
36
|
+
auto type = value.getProperty(runtime, "type");
|
|
37
|
+
|
|
38
|
+
if (type.isUndefined()) {
|
|
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");
|
|
45
|
+
}
|
|
46
|
+
if (value.hasProperty(runtime, "count")) {
|
|
47
|
+
auto count = value.getProperty(runtime, "count");
|
|
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");
|
|
56
|
+
}
|
|
57
|
+
if (value.hasProperty(runtime, "label")) {
|
|
58
|
+
auto label = value.getProperty(runtime, "label");
|
|
59
|
+
|
|
60
|
+
if (label.isString()) {
|
|
61
|
+
auto str = label.asString(runtime).utf8(runtime);
|
|
62
|
+
result->label = str;
|
|
63
|
+
result->_instance.label = result->label.c_str();
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
rnwgpu::Logger::logToConsole("GPUQuerySetDescriptor::type = %f",
|
|
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);
|
|
73
|
+
return result;
|
|
74
|
+
}
|
|
75
|
+
static jsi::Value toJSI(jsi::Runtime &runtime,
|
|
76
|
+
std::shared_ptr<rnwgpu::GPUQuerySetDescriptor> arg) {
|
|
77
|
+
// No conversions here
|
|
78
|
+
return jsi::Value::null();
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
} // namespace margelo
|
|
@@ -0,0 +1,102 @@
|
|
|
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 GPURenderBundleEncoderDescriptor {
|
|
17
|
+
public:
|
|
18
|
+
wgpu::RenderBundleEncoderDescriptor *getInstance() { return &_instance; }
|
|
19
|
+
|
|
20
|
+
wgpu::RenderBundleEncoderDescriptor _instance;
|
|
21
|
+
|
|
22
|
+
std::string label;
|
|
23
|
+
};
|
|
24
|
+
} // namespace rnwgpu
|
|
25
|
+
|
|
26
|
+
namespace margelo {
|
|
27
|
+
|
|
28
|
+
template <>
|
|
29
|
+
struct JSIConverter<std::shared_ptr<rnwgpu::GPURenderBundleEncoderDescriptor>> {
|
|
30
|
+
static std::shared_ptr<rnwgpu::GPURenderBundleEncoderDescriptor>
|
|
31
|
+
fromJSI(jsi::Runtime &runtime, const jsi::Value &arg, bool outOfBounds) {
|
|
32
|
+
auto result = std::make_unique<rnwgpu::GPURenderBundleEncoderDescriptor>();
|
|
33
|
+
if (!outOfBounds && arg.isObject()) {
|
|
34
|
+
auto value = arg.getObject(runtime);
|
|
35
|
+
if (value.hasProperty(runtime, "depthReadOnly")) {
|
|
36
|
+
auto depthReadOnly = value.getProperty(runtime, "depthReadOnly");
|
|
37
|
+
}
|
|
38
|
+
if (value.hasProperty(runtime, "stencilReadOnly")) {
|
|
39
|
+
auto stencilReadOnly = value.getProperty(runtime, "stencilReadOnly");
|
|
40
|
+
}
|
|
41
|
+
if (value.hasProperty(runtime, "colorFormats")) {
|
|
42
|
+
auto colorFormats = value.getProperty(runtime, "colorFormats");
|
|
43
|
+
|
|
44
|
+
if (colorFormats.isUndefined()) {
|
|
45
|
+
throw std::runtime_error(
|
|
46
|
+
"Property GPURenderBundleEncoderDescriptor::colorFormats is "
|
|
47
|
+
"required");
|
|
48
|
+
}
|
|
49
|
+
} else {
|
|
50
|
+
throw std::runtime_error(
|
|
51
|
+
"Property GPURenderBundleEncoderDescriptor::colorFormats is not "
|
|
52
|
+
"defined");
|
|
53
|
+
}
|
|
54
|
+
if (value.hasProperty(runtime, "depthStencilFormat")) {
|
|
55
|
+
auto depthStencilFormat =
|
|
56
|
+
value.getProperty(runtime, "depthStencilFormat");
|
|
57
|
+
}
|
|
58
|
+
if (value.hasProperty(runtime, "sampleCount")) {
|
|
59
|
+
auto sampleCount = value.getProperty(runtime, "sampleCount");
|
|
60
|
+
|
|
61
|
+
if (sampleCount.isNumber()) {
|
|
62
|
+
result->_instance.sampleCount =
|
|
63
|
+
static_cast<wgpu::Size32>(sampleCount.getNumber());
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
if (value.hasProperty(runtime, "label")) {
|
|
67
|
+
auto label = value.getProperty(runtime, "label");
|
|
68
|
+
|
|
69
|
+
if (label.isString()) {
|
|
70
|
+
auto str = label.asString(runtime).utf8(runtime);
|
|
71
|
+
result->label = str;
|
|
72
|
+
result->_instance.label = result->label.c_str();
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
rnwgpu::Logger::logToConsole(
|
|
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);
|
|
93
|
+
return result;
|
|
94
|
+
}
|
|
95
|
+
static jsi::Value
|
|
96
|
+
toJSI(jsi::Runtime &runtime,
|
|
97
|
+
std::shared_ptr<rnwgpu::GPURenderBundleEncoderDescriptor> arg) {
|
|
98
|
+
// No conversions here
|
|
99
|
+
return jsi::Value::null();
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
} // namespace margelo
|
|
@@ -0,0 +1,105 @@
|
|
|
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 GPURenderPassColorAttachment {
|
|
17
|
+
public:
|
|
18
|
+
wgpu::RenderPassColorAttachment *getInstance() { return &_instance; }
|
|
19
|
+
|
|
20
|
+
wgpu::RenderPassColorAttachment _instance;
|
|
21
|
+
};
|
|
22
|
+
} // namespace rnwgpu
|
|
23
|
+
|
|
24
|
+
namespace margelo {
|
|
25
|
+
|
|
26
|
+
template <>
|
|
27
|
+
struct JSIConverter<std::shared_ptr<rnwgpu::GPURenderPassColorAttachment>> {
|
|
28
|
+
static std::shared_ptr<rnwgpu::GPURenderPassColorAttachment>
|
|
29
|
+
fromJSI(jsi::Runtime &runtime, const jsi::Value &arg, bool outOfBounds) {
|
|
30
|
+
auto result = std::make_unique<rnwgpu::GPURenderPassColorAttachment>();
|
|
31
|
+
if (!outOfBounds && arg.isObject()) {
|
|
32
|
+
auto value = arg.getObject(runtime);
|
|
33
|
+
if (value.hasProperty(runtime, "view")) {
|
|
34
|
+
auto view = value.getProperty(runtime, "view");
|
|
35
|
+
|
|
36
|
+
if (view.isUndefined()) {
|
|
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
|
+
}
|
|
44
|
+
if (value.hasProperty(runtime, "depthSlice")) {
|
|
45
|
+
auto depthSlice = value.getProperty(runtime, "depthSlice");
|
|
46
|
+
|
|
47
|
+
if (depthSlice.isNumber()) {
|
|
48
|
+
result->_instance.depthSlice =
|
|
49
|
+
static_cast<wgpu::IntegerCoordinate>(depthSlice.getNumber());
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
if (value.hasProperty(runtime, "resolveTarget")) {
|
|
53
|
+
auto resolveTarget = value.getProperty(runtime, "resolveTarget");
|
|
54
|
+
}
|
|
55
|
+
if (value.hasProperty(runtime, "clearValue")) {
|
|
56
|
+
auto clearValue = value.getProperty(runtime, "clearValue");
|
|
57
|
+
}
|
|
58
|
+
if (value.hasProperty(runtime, "loadOp")) {
|
|
59
|
+
auto loadOp = value.getProperty(runtime, "loadOp");
|
|
60
|
+
|
|
61
|
+
if (loadOp.isUndefined()) {
|
|
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");
|
|
68
|
+
}
|
|
69
|
+
if (value.hasProperty(runtime, "storeOp")) {
|
|
70
|
+
auto storeOp = value.getProperty(runtime, "storeOp");
|
|
71
|
+
|
|
72
|
+
if (storeOp.isUndefined()) {
|
|
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");
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
rnwgpu::Logger::logToConsole("GPURenderPassColorAttachment::view = %f",
|
|
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);
|
|
96
|
+
return result;
|
|
97
|
+
}
|
|
98
|
+
static jsi::Value
|
|
99
|
+
toJSI(jsi::Runtime &runtime,
|
|
100
|
+
std::shared_ptr<rnwgpu::GPURenderPassColorAttachment> arg) {
|
|
101
|
+
// No conversions here
|
|
102
|
+
return jsi::Value::null();
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
} // namespace margelo
|
|
@@ -0,0 +1,118 @@
|
|
|
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 GPURenderPassDepthStencilAttachment {
|
|
17
|
+
public:
|
|
18
|
+
wgpu::RenderPassDepthStencilAttachment *getInstance() { return &_instance; }
|
|
19
|
+
|
|
20
|
+
wgpu::RenderPassDepthStencilAttachment _instance;
|
|
21
|
+
};
|
|
22
|
+
} // namespace rnwgpu
|
|
23
|
+
|
|
24
|
+
namespace margelo {
|
|
25
|
+
|
|
26
|
+
template <>
|
|
27
|
+
struct JSIConverter<
|
|
28
|
+
std::shared_ptr<rnwgpu::GPURenderPassDepthStencilAttachment>> {
|
|
29
|
+
static std::shared_ptr<rnwgpu::GPURenderPassDepthStencilAttachment>
|
|
30
|
+
fromJSI(jsi::Runtime &runtime, const jsi::Value &arg, bool outOfBounds) {
|
|
31
|
+
auto result =
|
|
32
|
+
std::make_unique<rnwgpu::GPURenderPassDepthStencilAttachment>();
|
|
33
|
+
if (!outOfBounds && arg.isObject()) {
|
|
34
|
+
auto value = arg.getObject(runtime);
|
|
35
|
+
if (value.hasProperty(runtime, "view")) {
|
|
36
|
+
auto view = value.getProperty(runtime, "view");
|
|
37
|
+
|
|
38
|
+
if (view.isUndefined()) {
|
|
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
|
+
}
|
|
47
|
+
if (value.hasProperty(runtime, "depthClearValue")) {
|
|
48
|
+
auto depthClearValue = value.getProperty(runtime, "depthClearValue");
|
|
49
|
+
|
|
50
|
+
if (depthClearValue.isNumber()) {
|
|
51
|
+
result->_instance.depthClearValue = depthClearValue.getNumber();
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
if (value.hasProperty(runtime, "depthLoadOp")) {
|
|
55
|
+
auto depthLoadOp = value.getProperty(runtime, "depthLoadOp");
|
|
56
|
+
}
|
|
57
|
+
if (value.hasProperty(runtime, "depthStoreOp")) {
|
|
58
|
+
auto depthStoreOp = value.getProperty(runtime, "depthStoreOp");
|
|
59
|
+
}
|
|
60
|
+
if (value.hasProperty(runtime, "depthReadOnly")) {
|
|
61
|
+
auto depthReadOnly = value.getProperty(runtime, "depthReadOnly");
|
|
62
|
+
}
|
|
63
|
+
if (value.hasProperty(runtime, "stencilClearValue")) {
|
|
64
|
+
auto stencilClearValue =
|
|
65
|
+
value.getProperty(runtime, "stencilClearValue");
|
|
66
|
+
|
|
67
|
+
if (stencilClearValue.isNumber()) {
|
|
68
|
+
result->_instance.stencilClearValue =
|
|
69
|
+
static_cast<wgpu::StencilValue>(stencilClearValue.getNumber());
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
if (value.hasProperty(runtime, "stencilLoadOp")) {
|
|
73
|
+
auto stencilLoadOp = value.getProperty(runtime, "stencilLoadOp");
|
|
74
|
+
}
|
|
75
|
+
if (value.hasProperty(runtime, "stencilStoreOp")) {
|
|
76
|
+
auto stencilStoreOp = value.getProperty(runtime, "stencilStoreOp");
|
|
77
|
+
}
|
|
78
|
+
if (value.hasProperty(runtime, "stencilReadOnly")) {
|
|
79
|
+
auto stencilReadOnly = value.getProperty(runtime, "stencilReadOnly");
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
rnwgpu::Logger::logToConsole(
|
|
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);
|
|
109
|
+
return result;
|
|
110
|
+
}
|
|
111
|
+
static jsi::Value
|
|
112
|
+
toJSI(jsi::Runtime &runtime,
|
|
113
|
+
std::shared_ptr<rnwgpu::GPURenderPassDepthStencilAttachment> arg) {
|
|
114
|
+
// No conversions here
|
|
115
|
+
return jsi::Value::null();
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
} // namespace margelo
|