react-native-wgpu 0.5.10 → 0.5.13
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 +84 -0
- package/android/CMakeLists.txt +2 -0
- package/android/cpp/AndroidPlatformContext.h +127 -5
- package/apple/ApplePlatformContext.h +17 -4
- package/apple/ApplePlatformContext.mm +161 -16
- package/apple/AppleVideoPlayer.h +31 -0
- package/apple/AppleVideoPlayer.mm +314 -0
- package/apple/WebGPUModule.h +2 -1
- package/apple/WebGPUModule.mm +4 -2
- package/cpp/rnwgpu/ArrayBuffer.h +51 -7
- package/cpp/rnwgpu/PlatformContext.h +91 -8
- package/cpp/rnwgpu/RNWebGPUManager.cpp +12 -0
- package/cpp/rnwgpu/api/Convertors.h +33 -11
- package/cpp/rnwgpu/api/GPU.cpp +27 -0
- package/cpp/rnwgpu/api/GPUAdapter.cpp +109 -33
- package/cpp/rnwgpu/api/GPUDevice.cpp +58 -5
- package/cpp/rnwgpu/api/GPUDevice.h +6 -0
- package/cpp/rnwgpu/api/GPUExternalTexture.cpp +335 -0
- package/cpp/rnwgpu/api/GPUExternalTexture.h +47 -2
- package/cpp/rnwgpu/api/GPUFeatures.h +7 -13
- package/cpp/rnwgpu/api/GPUShaderModule.cpp +2 -3
- package/cpp/rnwgpu/api/GPUSharedTextureMemory.cpp +80 -0
- package/cpp/rnwgpu/api/GPUSharedTextureMemory.h +71 -0
- package/cpp/rnwgpu/api/ImageBitmap.h +8 -0
- package/cpp/rnwgpu/api/RNWebGPU.h +70 -32
- package/cpp/rnwgpu/api/RnFeatures.h +53 -0
- package/cpp/rnwgpu/api/VideoFrame.h +76 -0
- package/cpp/rnwgpu/api/VideoPlayer.h +69 -0
- package/cpp/rnwgpu/api/descriptors/GPUBindGroupEntry.h +4 -1
- package/cpp/rnwgpu/api/descriptors/GPUDawnTogglesDescriptor.h +57 -0
- package/cpp/rnwgpu/api/descriptors/GPUDeviceDescriptor.h +18 -3
- package/cpp/rnwgpu/api/descriptors/GPUExternalTextureDescriptor.h +35 -33
- package/cpp/rnwgpu/api/descriptors/GPUSharedTextureMemoryDescriptor.h +62 -0
- package/cpp/rnwgpu/api/descriptors/Unions.h +10 -15
- package/cpp/webgpu/webgpu.h +312 -188
- package/cpp/webgpu/webgpu_cpp.h +1611 -1720
- package/cpp/webgpu/webgpu_cpp_print.h +190 -61
- package/lib/commonjs/Canvas.js.map +1 -1
- package/lib/commonjs/index.js.map +1 -1
- package/lib/module/Canvas.js.map +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/src/Canvas.d.ts +0 -10
- package/lib/typescript/src/Canvas.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +20 -1
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/types.d.ts +32 -1
- package/lib/typescript/src/types.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/apple/libwebgpu_dawn.xcframework/Info.plist +8 -8
- package/libs/apple/libwebgpu_dawn.xcframework/ios-arm64/libwebgpu_dawn.a +0 -0
- package/libs/apple/libwebgpu_dawn.xcframework/ios-arm64_x86_64-simulator/libwebgpu_dawn.a +0 -0
- package/libs/apple/libwebgpu_dawn.xcframework/macos-arm64_x86_64/libwebgpu_dawn.a +0 -0
- package/package.json +5 -5
- package/src/Canvas.tsx +0 -15
- package/src/index.tsx +62 -2
- package/src/types.ts +83 -1
- package/libs/dawn.json +0 -4693
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
|
|
3
|
+
#include <memory>
|
|
4
|
+
#include <string>
|
|
5
|
+
#include <utility>
|
|
6
|
+
#include <variant>
|
|
7
|
+
|
|
8
|
+
#include "NativeObject.h"
|
|
9
|
+
#include "PlatformContext.h"
|
|
10
|
+
#include "VideoFrame.h"
|
|
11
|
+
|
|
12
|
+
namespace rnwgpu {
|
|
13
|
+
|
|
14
|
+
namespace jsi = facebook::jsi;
|
|
15
|
+
|
|
16
|
+
// JSI wrapper around a platform-specific IVideoPlayer. Hands out fresh
|
|
17
|
+
// VideoFrame handles each time the underlying decoder produces a new frame.
|
|
18
|
+
class VideoPlayer : public NativeObject<VideoPlayer> {
|
|
19
|
+
public:
|
|
20
|
+
static constexpr const char *CLASS_NAME = "VideoPlayer";
|
|
21
|
+
|
|
22
|
+
explicit VideoPlayer(std::unique_ptr<IVideoPlayer> impl)
|
|
23
|
+
: NativeObject(CLASS_NAME), _impl(std::move(impl)) {}
|
|
24
|
+
|
|
25
|
+
std::string getBrand() { return CLASS_NAME; }
|
|
26
|
+
|
|
27
|
+
// Returns the latest decoded frame, or null if no new frame is ready yet.
|
|
28
|
+
// Callers should poll this from their render loop and skip rendering (or
|
|
29
|
+
// reuse the last frame's texture) when null.
|
|
30
|
+
std::variant<std::nullptr_t, std::shared_ptr<VideoFrame>>
|
|
31
|
+
copyLatestFrame() {
|
|
32
|
+
if (!_impl) {
|
|
33
|
+
return nullptr;
|
|
34
|
+
}
|
|
35
|
+
auto handle = _impl->copyLatestFrame();
|
|
36
|
+
if (handle.handle == nullptr) {
|
|
37
|
+
return nullptr;
|
|
38
|
+
}
|
|
39
|
+
return std::make_shared<VideoFrame>(std::move(handle));
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
void play() {
|
|
43
|
+
if (_impl) {
|
|
44
|
+
_impl->play();
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
void pause() {
|
|
49
|
+
if (_impl) {
|
|
50
|
+
_impl->pause();
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
void release() { _impl.reset(); }
|
|
55
|
+
|
|
56
|
+
static void definePrototype(jsi::Runtime &runtime, jsi::Object &prototype) {
|
|
57
|
+
installGetter(runtime, prototype, "__brand", &VideoPlayer::getBrand);
|
|
58
|
+
installMethod(runtime, prototype, "copyLatestFrame",
|
|
59
|
+
&VideoPlayer::copyLatestFrame);
|
|
60
|
+
installMethod(runtime, prototype, "play", &VideoPlayer::play);
|
|
61
|
+
installMethod(runtime, prototype, "pause", &VideoPlayer::pause);
|
|
62
|
+
installMethod(runtime, prototype, "release", &VideoPlayer::release);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
private:
|
|
66
|
+
std::unique_ptr<IVideoPlayer> _impl;
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
} // namespace rnwgpu
|
|
@@ -21,7 +21,7 @@ struct GPUBindGroupEntry {
|
|
|
21
21
|
std::shared_ptr<GPUSampler> sampler = nullptr;
|
|
22
22
|
std::shared_ptr<GPUTextureView> textureView = nullptr;
|
|
23
23
|
std::shared_ptr<GPUBufferBinding> buffer = nullptr;
|
|
24
|
-
|
|
24
|
+
std::shared_ptr<GPUExternalTexture> externalTexture = nullptr;
|
|
25
25
|
};
|
|
26
26
|
|
|
27
27
|
} // namespace rnwgpu
|
|
@@ -46,6 +46,9 @@ template <> struct JSIConverter<std::shared_ptr<rnwgpu::GPUBindGroupEntry>> {
|
|
|
46
46
|
} else if (obj.hasNativeState<rnwgpu::GPUTextureView>(runtime)) {
|
|
47
47
|
result->textureView =
|
|
48
48
|
obj.getNativeState<rnwgpu::GPUTextureView>(runtime);
|
|
49
|
+
} else if (obj.hasNativeState<rnwgpu::GPUExternalTexture>(runtime)) {
|
|
50
|
+
result->externalTexture =
|
|
51
|
+
obj.getNativeState<rnwgpu::GPUExternalTexture>(runtime);
|
|
49
52
|
} else if (obj.hasNativeState<rnwgpu::GPUBuffer>(runtime)) {
|
|
50
53
|
// Support passing GPUBuffer directly as resource (auto-wrap in
|
|
51
54
|
// GPUBufferBinding)
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
|
|
3
|
+
#include <memory>
|
|
4
|
+
#include <string>
|
|
5
|
+
#include <vector>
|
|
6
|
+
|
|
7
|
+
#include "webgpu/webgpu_cpp.h"
|
|
8
|
+
|
|
9
|
+
#include "JSIConverter.h"
|
|
10
|
+
#include "WGPULogger.h"
|
|
11
|
+
|
|
12
|
+
namespace jsi = facebook::jsi;
|
|
13
|
+
|
|
14
|
+
namespace rnwgpu {
|
|
15
|
+
|
|
16
|
+
// Non-standard, Dawn-only. Mirrors wgpu::DawnTogglesDescriptor field-for-field
|
|
17
|
+
// so the mapping to the native chained struct is 1:1. Chained onto the
|
|
18
|
+
// wgpu::DeviceDescriptor in GPUAdapter::requestDevice.
|
|
19
|
+
struct GPUDawnTogglesDescriptor {
|
|
20
|
+
std::optional<std::vector<std::string>> enabledToggles; // Iterable<string>
|
|
21
|
+
std::optional<std::vector<std::string>> disabledToggles; // Iterable<string>
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
} // namespace rnwgpu
|
|
25
|
+
|
|
26
|
+
namespace rnwgpu {
|
|
27
|
+
|
|
28
|
+
template <>
|
|
29
|
+
struct JSIConverter<std::shared_ptr<rnwgpu::GPUDawnTogglesDescriptor>> {
|
|
30
|
+
static std::shared_ptr<rnwgpu::GPUDawnTogglesDescriptor>
|
|
31
|
+
fromJSI(jsi::Runtime &runtime, const jsi::Value &arg, bool outOfBounds) {
|
|
32
|
+
auto result = std::make_unique<rnwgpu::GPUDawnTogglesDescriptor>();
|
|
33
|
+
if (!outOfBounds && arg.isObject()) {
|
|
34
|
+
auto value = arg.getObject(runtime);
|
|
35
|
+
if (value.hasProperty(runtime, "enabledToggles")) {
|
|
36
|
+
auto prop = value.getProperty(runtime, "enabledToggles");
|
|
37
|
+
result->enabledToggles =
|
|
38
|
+
JSIConverter<std::optional<std::vector<std::string>>>::fromJSI(
|
|
39
|
+
runtime, prop, false);
|
|
40
|
+
}
|
|
41
|
+
if (value.hasProperty(runtime, "disabledToggles")) {
|
|
42
|
+
auto prop = value.getProperty(runtime, "disabledToggles");
|
|
43
|
+
result->disabledToggles =
|
|
44
|
+
JSIConverter<std::optional<std::vector<std::string>>>::fromJSI(
|
|
45
|
+
runtime, prop, false);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
return result;
|
|
49
|
+
}
|
|
50
|
+
static jsi::Value
|
|
51
|
+
toJSI(jsi::Runtime &runtime,
|
|
52
|
+
std::shared_ptr<rnwgpu::GPUDawnTogglesDescriptor> arg) {
|
|
53
|
+
throw std::runtime_error("Invalid GPUDawnTogglesDescriptor::toJSI()");
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
} // namespace rnwgpu
|
|
@@ -8,8 +8,10 @@
|
|
|
8
8
|
#include "webgpu/webgpu_cpp.h"
|
|
9
9
|
|
|
10
10
|
#include "JSIConverter.h"
|
|
11
|
+
#include "RnFeatures.h"
|
|
11
12
|
#include "WGPULogger.h"
|
|
12
13
|
|
|
14
|
+
#include "GPUDawnTogglesDescriptor.h"
|
|
13
15
|
#include "GPUQueueDescriptor.h"
|
|
14
16
|
|
|
15
17
|
namespace jsi = facebook::jsi;
|
|
@@ -24,6 +26,9 @@ struct GPUDeviceDescriptor {
|
|
|
24
26
|
std::optional<std::shared_ptr<GPUQueueDescriptor>>
|
|
25
27
|
defaultQueue; // GPUQueueDescriptor
|
|
26
28
|
std::optional<std::string> label; // string
|
|
29
|
+
// Non-standard Dawn-only device toggles, chained onto the wgpu::Device
|
|
30
|
+
// descriptor in GPUAdapter::requestDevice.
|
|
31
|
+
std::optional<std::shared_ptr<GPUDawnTogglesDescriptor>> dawnToggles;
|
|
27
32
|
};
|
|
28
33
|
|
|
29
34
|
} // namespace rnwgpu
|
|
@@ -43,10 +48,20 @@ template <> struct JSIConverter<std::vector<wgpu::FeatureName>> {
|
|
|
43
48
|
vector.reserve(length);
|
|
44
49
|
for (size_t i = 0; i < length; ++i) {
|
|
45
50
|
jsi::Value elementValue = array.getValueAtIndex(runtime, i);
|
|
46
|
-
if (elementValue.isString()) {
|
|
47
|
-
|
|
48
|
-
runtime, elementValue, outOfBounds));
|
|
51
|
+
if (!elementValue.isString()) {
|
|
52
|
+
continue;
|
|
49
53
|
}
|
|
54
|
+
auto str = elementValue.asString(runtime).utf8(runtime);
|
|
55
|
+
// Expand react-native-wgpu's umbrella feature into the platform's
|
|
56
|
+
// backing Dawn features before they reach RequestDevice.
|
|
57
|
+
if (str == kRnNativeTextureFeature) {
|
|
58
|
+
for (auto f : rnNativeTextureBackingFeatures()) {
|
|
59
|
+
vector.emplace_back(f);
|
|
60
|
+
}
|
|
61
|
+
continue;
|
|
62
|
+
}
|
|
63
|
+
vector.emplace_back(JSIConverter<wgpu::FeatureName>::fromJSI(
|
|
64
|
+
runtime, elementValue, outOfBounds));
|
|
50
65
|
}
|
|
51
66
|
return vector;
|
|
52
67
|
}
|
|
@@ -3,35 +3,34 @@
|
|
|
3
3
|
#include <memory>
|
|
4
4
|
#include <optional>
|
|
5
5
|
#include <string>
|
|
6
|
-
#include <variant>
|
|
7
6
|
|
|
8
7
|
#include "webgpu/webgpu_cpp.h"
|
|
9
8
|
|
|
10
|
-
#include "Convertors.h"
|
|
11
|
-
|
|
12
9
|
#include "JSIConverter.h"
|
|
13
|
-
#include "
|
|
10
|
+
#include "VideoFrame.h"
|
|
14
11
|
|
|
15
12
|
namespace jsi = facebook::jsi;
|
|
16
13
|
|
|
17
14
|
namespace rnwgpu {
|
|
18
15
|
|
|
16
|
+
// Mirror of GPUExternalTextureDescriptor from the WebGPU spec, but with our
|
|
17
|
+
// VideoFrame as the (only) supported source. We don't expose colorSpace yet;
|
|
18
|
+
// the C++ side picks dst-sRGB and identity gamut, which is the right default
|
|
19
|
+
// for "render this video frame to a regular sRGB framebuffer".
|
|
20
|
+
//
|
|
21
|
+
// `rotation` / `mirrored` are a non-spec extension: camera frames (e.g. from
|
|
22
|
+
// VisionCamera) arrive in the sensor's native orientation, which differs
|
|
23
|
+
// between iOS (CVPixelBuffer) and Android (AHardwareBuffer). Dawn's
|
|
24
|
+
// ExternalTextureDescriptor can bake a rotation + horizontal mirror into the
|
|
25
|
+
// sampling transform, so the shader sees an upright frame without any extra
|
|
26
|
+
// passes. `rotation` is in degrees and must be one of 0 / 90 / 180 / 270.
|
|
19
27
|
struct GPUExternalTextureDescriptor {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
std::optional<std::string> label; // string
|
|
28
|
+
std::shared_ptr<VideoFrame> source;
|
|
29
|
+
std::optional<std::string> label;
|
|
30
|
+
std::optional<double> rotation;
|
|
31
|
+
std::optional<bool> mirrored;
|
|
25
32
|
};
|
|
26
33
|
|
|
27
|
-
static bool conv(wgpu::ExternalTextureDescriptor &out,
|
|
28
|
-
const std::shared_ptr<GPUExternalTextureDescriptor> &in) {
|
|
29
|
-
// TODO: implement
|
|
30
|
-
// return conv(out.source, in->source) && conv(out.colorSpace, in->colorSpace)
|
|
31
|
-
// &&
|
|
32
|
-
// return conv(out.label, in->label);
|
|
33
|
-
return false;
|
|
34
|
-
}
|
|
35
34
|
} // namespace rnwgpu
|
|
36
35
|
|
|
37
36
|
namespace rnwgpu {
|
|
@@ -40,23 +39,15 @@ template <>
|
|
|
40
39
|
struct JSIConverter<std::shared_ptr<rnwgpu::GPUExternalTextureDescriptor>> {
|
|
41
40
|
static std::shared_ptr<rnwgpu::GPUExternalTextureDescriptor>
|
|
42
41
|
fromJSI(jsi::Runtime &runtime, const jsi::Value &arg, bool outOfBounds) {
|
|
43
|
-
auto result = std::
|
|
42
|
+
auto result = std::make_shared<rnwgpu::GPUExternalTextureDescriptor>();
|
|
44
43
|
if (!outOfBounds && arg.isObject()) {
|
|
45
44
|
auto value = arg.getObject(runtime);
|
|
46
45
|
if (value.hasProperty(runtime, "source")) {
|
|
47
46
|
auto prop = value.getProperty(runtime, "source");
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
// false);
|
|
53
|
-
}
|
|
54
|
-
if (value.hasProperty(runtime, "colorSpace")) {
|
|
55
|
-
auto prop = value.getProperty(runtime, "colorSpace");
|
|
56
|
-
if (!prop.isUndefined()) {
|
|
57
|
-
// result->colorSpace =
|
|
58
|
-
// JSIConverter<std::optional<wgpu::definedColorSpace>>::fromJSI(
|
|
59
|
-
// runtime, prop, false);
|
|
47
|
+
if (!prop.isUndefined() && !prop.isNull()) {
|
|
48
|
+
result->source =
|
|
49
|
+
JSIConverter<std::shared_ptr<rnwgpu::VideoFrame>>::fromJSI(
|
|
50
|
+
runtime, prop, false);
|
|
60
51
|
}
|
|
61
52
|
}
|
|
62
53
|
if (value.hasProperty(runtime, "label")) {
|
|
@@ -66,13 +57,24 @@ struct JSIConverter<std::shared_ptr<rnwgpu::GPUExternalTextureDescriptor>> {
|
|
|
66
57
|
runtime, prop, false);
|
|
67
58
|
}
|
|
68
59
|
}
|
|
60
|
+
if (value.hasProperty(runtime, "rotation")) {
|
|
61
|
+
auto prop = value.getProperty(runtime, "rotation");
|
|
62
|
+
if (prop.isNumber()) {
|
|
63
|
+
result->rotation = prop.asNumber();
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
if (value.hasProperty(runtime, "mirrored")) {
|
|
67
|
+
auto prop = value.getProperty(runtime, "mirrored");
|
|
68
|
+
if (prop.isBool()) {
|
|
69
|
+
result->mirrored = prop.getBool();
|
|
70
|
+
}
|
|
71
|
+
}
|
|
69
72
|
}
|
|
70
|
-
|
|
71
73
|
return result;
|
|
72
74
|
}
|
|
73
75
|
static jsi::Value
|
|
74
|
-
toJSI(jsi::Runtime &runtime
|
|
75
|
-
std::shared_ptr<rnwgpu::GPUExternalTextureDescriptor> arg) {
|
|
76
|
+
toJSI(jsi::Runtime & /*runtime*/,
|
|
77
|
+
std::shared_ptr<rnwgpu::GPUExternalTextureDescriptor> /*arg*/) {
|
|
76
78
|
throw std::runtime_error("Invalid GPUExternalTextureDescriptor::toJSI()");
|
|
77
79
|
}
|
|
78
80
|
};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
|
|
3
|
+
#include <memory>
|
|
4
|
+
#include <optional>
|
|
5
|
+
#include <string>
|
|
6
|
+
|
|
7
|
+
#include "webgpu/webgpu_cpp.h"
|
|
8
|
+
|
|
9
|
+
#include "JSIConverter.h"
|
|
10
|
+
|
|
11
|
+
namespace jsi = facebook::jsi;
|
|
12
|
+
|
|
13
|
+
namespace rnwgpu {
|
|
14
|
+
|
|
15
|
+
// Descriptor for GPUDevice.importSharedTextureMemory.
|
|
16
|
+
//
|
|
17
|
+
// `handle` is the raw native handle as a uintptr_t (passed as BigInt from JS):
|
|
18
|
+
// - Apple platforms: IOSurfaceRef
|
|
19
|
+
// - Android: AHardwareBuffer*
|
|
20
|
+
//
|
|
21
|
+
// Lifetime: the caller is responsible for keeping the underlying object alive
|
|
22
|
+
// for as long as this shared memory is in use. The VideoFrame helper handles
|
|
23
|
+
// this automatically when the handle came from PlatformContext.loadVideoFrame.
|
|
24
|
+
struct GPUSharedTextureMemoryDescriptor {
|
|
25
|
+
void *handle = nullptr;
|
|
26
|
+
std::optional<std::string> label;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
} // namespace rnwgpu
|
|
30
|
+
|
|
31
|
+
namespace rnwgpu {
|
|
32
|
+
|
|
33
|
+
template <>
|
|
34
|
+
struct JSIConverter<std::shared_ptr<rnwgpu::GPUSharedTextureMemoryDescriptor>> {
|
|
35
|
+
static std::shared_ptr<rnwgpu::GPUSharedTextureMemoryDescriptor>
|
|
36
|
+
fromJSI(jsi::Runtime &runtime, const jsi::Value &arg, bool outOfBounds) {
|
|
37
|
+
auto result =
|
|
38
|
+
std::make_shared<rnwgpu::GPUSharedTextureMemoryDescriptor>();
|
|
39
|
+
if (!outOfBounds && arg.isObject()) {
|
|
40
|
+
auto value = arg.getObject(runtime);
|
|
41
|
+
if (value.hasProperty(runtime, "handle")) {
|
|
42
|
+
auto prop = value.getProperty(runtime, "handle");
|
|
43
|
+
result->handle =
|
|
44
|
+
JSIConverter<void *>::fromJSI(runtime, prop, false);
|
|
45
|
+
}
|
|
46
|
+
if (value.hasProperty(runtime, "label")) {
|
|
47
|
+
auto prop = value.getProperty(runtime, "label");
|
|
48
|
+
result->label = JSIConverter<std::optional<std::string>>::fromJSI(
|
|
49
|
+
runtime, prop, false);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
return result;
|
|
53
|
+
}
|
|
54
|
+
static jsi::Value
|
|
55
|
+
toJSI(jsi::Runtime & /*runtime*/,
|
|
56
|
+
std::shared_ptr<rnwgpu::GPUSharedTextureMemoryDescriptor> /*arg*/) {
|
|
57
|
+
throw std::runtime_error(
|
|
58
|
+
"Invalid GPUSharedTextureMemoryDescriptor::toJSI()");
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
} // namespace rnwgpu
|
|
@@ -463,8 +463,6 @@ inline void convertJSUnionToEnum(const std::string &inUnion,
|
|
|
463
463
|
*outEnum = wgpu::FeatureName::PixelLocalStorageNonCoherent;
|
|
464
464
|
} else if (inUnion == "unorm16-texture-formats") {
|
|
465
465
|
*outEnum = wgpu::FeatureName::Unorm16TextureFormats;
|
|
466
|
-
} else if (inUnion == "snorm16-texture-formats") {
|
|
467
|
-
*outEnum = wgpu::FeatureName::Snorm16TextureFormats;
|
|
468
466
|
} else if (inUnion == "multi-planar-format-extended-usages") {
|
|
469
467
|
*outEnum = wgpu::FeatureName::MultiPlanarFormatExtendedUsages;
|
|
470
468
|
} else if (inUnion == "multi-planar-format-p010") {
|
|
@@ -485,12 +483,8 @@ inline void convertJSUnionToEnum(const std::string &inUnion,
|
|
|
485
483
|
*outEnum = wgpu::FeatureName::AdapterPropertiesD3D;
|
|
486
484
|
} else if (inUnion == "adapter-properties-vk") {
|
|
487
485
|
*outEnum = wgpu::FeatureName::AdapterPropertiesVk;
|
|
488
|
-
} else if (inUnion == "r8unorm-storage") {
|
|
489
|
-
*outEnum = wgpu::FeatureName::R8UnormStorage;
|
|
490
486
|
} else if (inUnion == "format-capabilities") {
|
|
491
487
|
*outEnum = wgpu::FeatureName::DawnFormatCapabilities;
|
|
492
|
-
} else if (inUnion == "norm16-texture-formats") {
|
|
493
|
-
*outEnum = wgpu::FeatureName::Norm16TextureFormats;
|
|
494
488
|
} else if (inUnion == "multi-planar-format-nv16") {
|
|
495
489
|
*outEnum = wgpu::FeatureName::MultiPlanarFormatNv16;
|
|
496
490
|
} else if (inUnion == "multi-planar-format-nv24") {
|
|
@@ -519,6 +513,8 @@ inline void convertJSUnionToEnum(const std::string &inUnion,
|
|
|
519
513
|
*outEnum = wgpu::FeatureName::SharedTextureMemoryEGLImage;
|
|
520
514
|
} else if (inUnion == "shared-fence-vk-semaphore-opaque-fd") {
|
|
521
515
|
*outEnum = wgpu::FeatureName::SharedFenceVkSemaphoreOpaqueFD;
|
|
516
|
+
} else if (inUnion == "shared-fence-sync-fd") {
|
|
517
|
+
*outEnum = wgpu::FeatureName::SharedFenceSyncFD;
|
|
522
518
|
} else if (inUnion == "shared-fence-vk-semaphore-zircon-handle") {
|
|
523
519
|
*outEnum = wgpu::FeatureName::SharedFenceVkSemaphoreZirconHandle;
|
|
524
520
|
} else if (inUnion == "shared-fence-dxgi-shared-handle") {
|
|
@@ -531,6 +527,8 @@ inline void convertJSUnionToEnum(const std::string &inUnion,
|
|
|
531
527
|
*outEnum = wgpu::FeatureName::StaticSamplers;
|
|
532
528
|
} else if (inUnion == "ycbcr-vulkan-samplers") {
|
|
533
529
|
*outEnum = wgpu::FeatureName::YCbCrVulkanSamplers;
|
|
530
|
+
} else if (inUnion == "opaque-ycbcr-android-for-external-texture") {
|
|
531
|
+
*outEnum = wgpu::FeatureName::OpaqueYCbCrAndroidForExternalTexture;
|
|
534
532
|
} else if (inUnion == "shader-module-compilation-options") {
|
|
535
533
|
*outEnum = wgpu::FeatureName::ShaderModuleCompilationOptions;
|
|
536
534
|
} else if (inUnion == "dawn-load-resolve-texture") {
|
|
@@ -629,9 +627,6 @@ inline void convertEnumToJSUnion(wgpu::FeatureName inEnum,
|
|
|
629
627
|
case wgpu::FeatureName::Unorm16TextureFormats:
|
|
630
628
|
*outUnion = "unorm16-texture-formats";
|
|
631
629
|
break;
|
|
632
|
-
case wgpu::FeatureName::Snorm16TextureFormats:
|
|
633
|
-
*outUnion = "snorm16-texture-formats";
|
|
634
|
-
break;
|
|
635
630
|
case wgpu::FeatureName::MultiPlanarFormatExtendedUsages:
|
|
636
631
|
*outUnion = "multi-planar-format-extended-usages";
|
|
637
632
|
break;
|
|
@@ -662,12 +657,6 @@ inline void convertEnumToJSUnion(wgpu::FeatureName inEnum,
|
|
|
662
657
|
case wgpu::FeatureName::AdapterPropertiesVk:
|
|
663
658
|
*outUnion = "adapter-properties-vk";
|
|
664
659
|
break;
|
|
665
|
-
case wgpu::FeatureName::R8UnormStorage:
|
|
666
|
-
*outUnion = "r8unorm-storage";
|
|
667
|
-
break;
|
|
668
|
-
case wgpu::FeatureName::Norm16TextureFormats:
|
|
669
|
-
*outUnion = "norm16-texture-formats";
|
|
670
|
-
break;
|
|
671
660
|
case wgpu::FeatureName::MultiPlanarFormatNv16:
|
|
672
661
|
*outUnion = "multi-planar-format-nv16";
|
|
673
662
|
break;
|
|
@@ -710,6 +699,9 @@ inline void convertEnumToJSUnion(wgpu::FeatureName inEnum,
|
|
|
710
699
|
case wgpu::FeatureName::SharedFenceVkSemaphoreOpaqueFD:
|
|
711
700
|
*outUnion = "shared-fence-vk-semaphore-opaque-fd";
|
|
712
701
|
break;
|
|
702
|
+
case wgpu::FeatureName::SharedFenceSyncFD:
|
|
703
|
+
*outUnion = "shared-fence-sync-fd";
|
|
704
|
+
break;
|
|
713
705
|
case wgpu::FeatureName::SharedFenceVkSemaphoreZirconHandle:
|
|
714
706
|
*outUnion = "shared-fence-vk-semaphore-zircon-handle";
|
|
715
707
|
break;
|
|
@@ -728,6 +720,9 @@ inline void convertEnumToJSUnion(wgpu::FeatureName inEnum,
|
|
|
728
720
|
case wgpu::FeatureName::YCbCrVulkanSamplers:
|
|
729
721
|
*outUnion = "ycbcr-vulkan-samplers";
|
|
730
722
|
break;
|
|
723
|
+
case wgpu::FeatureName::OpaqueYCbCrAndroidForExternalTexture:
|
|
724
|
+
*outUnion = "opaque-ycbcr-android-for-external-texture";
|
|
725
|
+
break;
|
|
731
726
|
case wgpu::FeatureName::ShaderModuleCompilationOptions:
|
|
732
727
|
*outUnion = "shader-module-compilation-options";
|
|
733
728
|
break;
|