react-native-webgpu 0.10.0 → 0.10.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Package.swift +57 -102
- package/cpp/rnwgpu/api/GPUExternalTexture.cpp +2 -4
- package/cpp/rnwgpu/api/GPUExternalTexture.h +40 -3
- package/lib/typescript/react-native.config.d.ts +4 -0
- package/lib/typescript/react-native.config.d.ts.map +1 -0
- package/lib/typescript/src/types.d.ts.map +1 -1
- package/package.json +3 -2
- package/react-native-webgpu.podspec +8 -9
- package/react-native.config.js +6 -0
- package/src/types.ts +1 -3
package/Package.swift
CHANGED
|
@@ -1,54 +1,27 @@
|
|
|
1
|
-
// swift-tools-version:
|
|
1
|
+
// swift-tools-version: 6.0
|
|
2
2
|
// Generated by scripts/generate-package-swift.ts — do not edit by hand.
|
|
3
3
|
// Re-run that script after a new Dawn release to update the URL/checksum below.
|
|
4
|
-
import Foundation
|
|
5
|
-
import PackageDescription
|
|
6
|
-
|
|
7
|
-
// Integration model: a local Swift package next to a CocoaPods install.
|
|
8
4
|
//
|
|
9
|
-
//
|
|
10
|
-
//
|
|
11
|
-
// inside the consuming app's CocoaPods install. Add this package as a local
|
|
12
|
-
// Swift Package dependency in place of the react-native-webgpu pod (export
|
|
13
|
-
// RNWGPU_USE_SPM=1 for `pod install`) and keep running `pod install` for
|
|
14
|
-
// everything else. The header search paths below point into that Pods
|
|
15
|
-
// directory. They can only be expressed as `unsafeFlags`, and SwiftPM rejects
|
|
16
|
-
// unsafeFlags in anything but a path dependency, so this package can only be
|
|
17
|
-
// consumed locally, never by URL and version.
|
|
5
|
+
// SwiftPM manifest for react-native-webgpu. iOS only.
|
|
6
|
+
// Additive: the CocoaPods podspec remains the supported default.
|
|
18
7
|
//
|
|
19
|
-
// React Native 0.87
|
|
20
|
-
//
|
|
21
|
-
//
|
|
22
|
-
//
|
|
23
|
-
//
|
|
24
|
-
// manifest does not implement that model yet: on a 0.87+ app that has opted
|
|
25
|
-
// into SwiftPM autolinking it is picked up as self-managed but cannot find
|
|
26
|
-
// React Native's headers. Keep CocoaPods for React Native on those apps.
|
|
8
|
+
// React Native 0.87+ references a library that ships its own Package.swift
|
|
9
|
+
// through a symlink at <app>/ios/build/generated/autolinking/libs/<name>, and
|
|
10
|
+
// resolves the relative paths below against that symlink. They are the same
|
|
11
|
+
// for every standard app, because the symlink location is. Earlier React
|
|
12
|
+
// Native releases have no SwiftPM autolinking: keep CocoaPods there.
|
|
27
13
|
|
|
28
|
-
|
|
29
|
-
|
|
14
|
+
import Foundation
|
|
15
|
+
import PackageDescription
|
|
16
|
+
|
|
17
|
+
// Absolute location of this package. Xcode passes the autolinking symlink as
|
|
18
|
+
// the package directory, so resolve it before deriving sibling paths.
|
|
30
19
|
let packageRoot = URL(fileURLWithPath: Context.packageDirectory)
|
|
31
20
|
.resolvingSymlinksInPath().path
|
|
32
21
|
let sibling = { (relative: String) -> String in
|
|
33
22
|
URL(fileURLWithPath: "\(packageRoot)/\(relative)").standardized.path
|
|
34
23
|
}
|
|
35
24
|
|
|
36
|
-
// Where the consuming app's Pods live. PODS_ROOT is exported by Xcode.app for
|
|
37
|
-
// a real build, but never by plain `xcodebuild`, and never while Xcode indexes
|
|
38
|
-
// the manifest before a first build. SwiftPM also caches manifest evaluations,
|
|
39
|
-
// so an evaluation that ran without it would otherwise be cached with an empty
|
|
40
|
-
// include list and surface later as header-not-found errors. Fall back to
|
|
41
|
-
// where Pods sit relative to this package for every standard app layout, so
|
|
42
|
-
// the result is the same with or without the environment variable.
|
|
43
|
-
let podsRootCandidates = [
|
|
44
|
-
sibling("../../ios/Pods"), // consumer: <app>/node_modules/react-native-webgpu
|
|
45
|
-
sibling("../../apps/spm-example/ios/Pods"), // this monorepo
|
|
46
|
-
]
|
|
47
|
-
let podsRoot =
|
|
48
|
-
ProcessInfo.processInfo.environment["PODS_ROOT"]
|
|
49
|
-
?? podsRootCandidates.first { FileManager.default.fileExists(atPath: $0) }
|
|
50
|
-
?? podsRootCandidates[0]
|
|
51
|
-
|
|
52
25
|
// Skia Graphite and WebGPU must link the exact same Dawn, or the pair links
|
|
53
26
|
// fine and crashes at runtime. react-native-skia's podspec enforces this at
|
|
54
27
|
// `pod install` time by comparing its libs/.dawn-version against this
|
|
@@ -79,57 +52,6 @@ for skia in skiaCandidates {
|
|
|
79
52
|
break
|
|
80
53
|
}
|
|
81
54
|
|
|
82
|
-
// Static-library Pods layout. With `use_frameworks!` CocoaPods keeps headers
|
|
83
|
-
// inside each framework instead and none of these paths exist; the podspec
|
|
84
|
-
// refuses RNWGPU_USE_SPM in that mode.
|
|
85
|
-
let publicHeaders = "\(podsRoot)/Headers/Public"
|
|
86
|
-
let privateHeaders = "\(podsRoot)/Headers/Private"
|
|
87
|
-
let headerSearchPaths = [
|
|
88
|
-
publicHeaders,
|
|
89
|
-
// Yoga's headers are CocoaPods-private (apps aren't meant to use Yoga's
|
|
90
|
-
// C++ API directly), but React-Fabric's view props headers include them
|
|
91
|
-
// transitively.
|
|
92
|
-
"\(privateHeaders)/Yoga",
|
|
93
|
-
"\(publicHeaders)/React-Core",
|
|
94
|
-
"\(publicHeaders)/React-jsi",
|
|
95
|
-
"\(publicHeaders)/React-callinvoker",
|
|
96
|
-
"\(publicHeaders)/React-NativeModulesApple",
|
|
97
|
-
"\(publicHeaders)/React-RCTFabric",
|
|
98
|
-
"\(publicHeaders)/ReactCodegen",
|
|
99
|
-
"\(publicHeaders)/RCT-Folly",
|
|
100
|
-
"\(publicHeaders)/RCTRequired",
|
|
101
|
-
"\(publicHeaders)/RCTTypeSafety",
|
|
102
|
-
"\(publicHeaders)/FBLazyVector",
|
|
103
|
-
"\(publicHeaders)/ReactCommon",
|
|
104
|
-
"\(publicHeaders)/React-Fabric",
|
|
105
|
-
"\(publicHeaders)/React-graphics",
|
|
106
|
-
"\(publicHeaders)/React-utils",
|
|
107
|
-
"\(publicHeaders)/React-featureflags",
|
|
108
|
-
"\(publicHeaders)/React-rendererdebug",
|
|
109
|
-
"\(publicHeaders)/React-debug",
|
|
110
|
-
"\(publicHeaders)/React-timing",
|
|
111
|
-
"\(publicHeaders)/React-runtimescheduler",
|
|
112
|
-
"\(publicHeaders)/React-rendererconsistency",
|
|
113
|
-
"\(publicHeaders)/React-performancetimeline",
|
|
114
|
-
"\(publicHeaders)/React-runtimeexecutor",
|
|
115
|
-
"\(publicHeaders)/React-cxxreact",
|
|
116
|
-
"\(publicHeaders)/hermes-engine",
|
|
117
|
-
"\(publicHeaders)/glog",
|
|
118
|
-
"\(publicHeaders)/DoubleConversion",
|
|
119
|
-
"\(publicHeaders)/fmt",
|
|
120
|
-
"\(publicHeaders)/fast_float",
|
|
121
|
-
]
|
|
122
|
-
// The only unsafe flags left: .headerSearchPath cannot escape the target
|
|
123
|
-
// path, and these live in the app's Pods directory.
|
|
124
|
-
let cFamilyIncludeFlags = headerSearchPaths.map { "-I\($0)" }
|
|
125
|
-
let follyDefines: [(name: String, value: String?)] = [
|
|
126
|
-
("FOLLY_NO_CONFIG", nil),
|
|
127
|
-
("FOLLY_MOBILE", "1"),
|
|
128
|
-
("FOLLY_USE_LIBCPP", "1"),
|
|
129
|
-
("FOLLY_CFG_NO_COROUTINES", "1"),
|
|
130
|
-
("FOLLY_HAVE_CLOCK_GETTIME", "1"),
|
|
131
|
-
]
|
|
132
|
-
|
|
133
55
|
// Unlike a native Xcode target, SwiftPM doesn't generate an implicit
|
|
134
56
|
// per-target header map, so quoted includes only resolve within the
|
|
135
57
|
// including file's own directory. The sources use bare cross-directory
|
|
@@ -153,10 +75,19 @@ let internalHeaderDirs = [
|
|
|
153
75
|
]
|
|
154
76
|
|
|
155
77
|
let package = Package(
|
|
156
|
-
name: "
|
|
157
|
-
|
|
78
|
+
name: "ReactNativeWebGPU",
|
|
79
|
+
// SwiftPM refuses to link a product whose floor is above the depending
|
|
80
|
+
// target's. React Native's generated Autolinked aggregate hardcodes iOS 15.0
|
|
81
|
+
// (react-native#58379 derives it from the app instead), so this must not
|
|
82
|
+
// exceed 15.0; a lower floor is always accepted.
|
|
83
|
+
platforms: [.iOS(.v15)],
|
|
158
84
|
products: [
|
|
159
|
-
|
|
85
|
+
// Autolinking looks this name up verbatim; react-native.config.js pins it.
|
|
86
|
+
.library(name: "ReactNativeWebGPU", targets: ["ReactNativeWebGPU"])
|
|
87
|
+
],
|
|
88
|
+
dependencies: [
|
|
89
|
+
.package(name: "React-GeneratedCode", path: "../../../ios"),
|
|
90
|
+
.package(name: "ReactNative", path: "../../../../xcframeworks"),
|
|
160
91
|
],
|
|
161
92
|
targets: [
|
|
162
93
|
// Dawn's compiled WebGPU implementation. The xcframework embeds the
|
|
@@ -168,18 +99,41 @@ let package = Package(
|
|
|
168
99
|
checksum: "896575ffbc99610198a83d061f8c5a2789139b7f16c669fbf3a9f7a7ac9be123"
|
|
169
100
|
),
|
|
170
101
|
.target(
|
|
171
|
-
name: "
|
|
172
|
-
dependencies: [
|
|
102
|
+
name: "ReactNativeWebGPU",
|
|
103
|
+
dependencies: [
|
|
104
|
+
.product(name: "ReactHeaders", package: "ReactNative"),
|
|
105
|
+
.product(name: "ReactNativeHeaders", package: "ReactNative"),
|
|
106
|
+
.product(name: "ReactNativeDependenciesHeaders", package: "ReactNative"),
|
|
107
|
+
// RNWgpuViewSpec, generated by the app's codegen run.
|
|
108
|
+
.product(name: "ReactAppHeaders", package: "React-GeneratedCode"),
|
|
109
|
+
"WebGPUDawn",
|
|
110
|
+
],
|
|
111
|
+
// apple/ and cpp/ have no common ancestor below the package root, and
|
|
112
|
+
// .headerSearchPath cannot escape the target path.
|
|
173
113
|
path: ".",
|
|
114
|
+
// Explicit, so SwiftPM never walks node_modules, lib, android, or the
|
|
115
|
+
// headers-only cpp/webgpu and cpp/dawn trees.
|
|
174
116
|
sources: ["apple", "cpp/jsi", "cpp/rnwgpu"],
|
|
117
|
+
// SwiftPM requires a public headers directory inside the target and
|
|
118
|
+
// defaults to "include", which this package does not have.
|
|
175
119
|
publicHeadersPath: "apple",
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
120
|
+
cxxSettings: internalHeaderDirs.map { CXXSetting.headerSearchPath($0) } + [
|
|
121
|
+
// CocoaPods forces both project-wide; the SwiftPM path defines neither.
|
|
122
|
+
// React Native's headers gate on them, and the prebuilt React.framework
|
|
123
|
+
// was built with both, so the module must see the same declarations.
|
|
124
|
+
.define("RCT_NEW_ARCH_ENABLED", to: "1"),
|
|
125
|
+
.define("RCT_REMOVE_LEGACY_ARCH", to: "1"),
|
|
126
|
+
|
|
127
|
+
// React's prebuilt C++ ABI is NDEBUG-gated (DebugStringConvertible's
|
|
128
|
+
// vtable and ShadowNode layout diverge). Omitting either breaks the
|
|
129
|
+
// Release link.
|
|
130
|
+
.define("DEBUG", .when(configuration: .debug)),
|
|
131
|
+
.define("NDEBUG", .when(configuration: .release)),
|
|
132
|
+
],
|
|
182
133
|
linkerSettings: [
|
|
134
|
+
// VideoPlayer uses AVFoundation / CoreMedia, shared-texture surfaces
|
|
135
|
+
// use CoreVideo (CVPixelBuffer), and ImageIO provides CGImageSource,
|
|
136
|
+
// the image decoder behind createImageBitmap.
|
|
183
137
|
.linkedFramework("AVFoundation"),
|
|
184
138
|
.linkedFramework("CoreMedia"),
|
|
185
139
|
.linkedFramework("CoreVideo"),
|
|
@@ -187,5 +141,6 @@ let package = Package(
|
|
|
187
141
|
]
|
|
188
142
|
),
|
|
189
143
|
],
|
|
144
|
+
// React Native's headers need C++20.
|
|
190
145
|
cxxLanguageStandard: .cxx20
|
|
191
146
|
)
|
|
@@ -240,8 +240,7 @@ std::shared_ptr<GPUExternalTexture> GPUExternalTexture::Create(
|
|
|
240
240
|
|
|
241
241
|
auto external = device.CreateExternalTexture(&extDesc);
|
|
242
242
|
if (external == nullptr) {
|
|
243
|
-
|
|
244
|
-
(void)memory.EndAccess(texture, &state);
|
|
243
|
+
endAccess(memory, texture);
|
|
245
244
|
throw std::runtime_error(
|
|
246
245
|
"GPUExternalTexture::Create(): CreateExternalTexture returned "
|
|
247
246
|
"null");
|
|
@@ -345,8 +344,7 @@ std::shared_ptr<GPUExternalTexture> GPUExternalTexture::Create(
|
|
|
345
344
|
|
|
346
345
|
auto external = device.CreateExternalTexture(&extDesc);
|
|
347
346
|
if (external == nullptr) {
|
|
348
|
-
|
|
349
|
-
(void)memory.EndAccess(texture, &state);
|
|
347
|
+
endAccess(memory, texture);
|
|
350
348
|
throw std::runtime_error(
|
|
351
349
|
"GPUExternalTexture::Create(): CreateExternalTexture returned "
|
|
352
350
|
"null");
|
|
@@ -58,19 +58,39 @@ public:
|
|
|
58
58
|
// destroy() the producer's surface (e.g. an AVPlayer IOSurface) stays claimed
|
|
59
59
|
// until GC runs. EndAccess is the designed post-submit call: Dawn keeps the
|
|
60
60
|
// texture alive for in-flight GPU work via the fences it returns.
|
|
61
|
+
// Destroying the texture and the external texture is what actually frees
|
|
62
|
+
// the import: the ExternalTexture's views keep the imported VkImage /
|
|
63
|
+
// IOSurface texture alive until the object itself is destroyed, which
|
|
64
|
+
// otherwise only happens once the JS wrapper (and any bind group that
|
|
65
|
+
// sampled it) is garbage-collected.
|
|
61
66
|
void destroy() {
|
|
62
67
|
if (_memory && _texture) {
|
|
63
|
-
|
|
64
|
-
|
|
68
|
+
endAccess(_memory, _texture);
|
|
69
|
+
}
|
|
70
|
+
if (_texture) {
|
|
71
|
+
_texture.Destroy();
|
|
72
|
+
}
|
|
73
|
+
if (_instance) {
|
|
74
|
+
_instance.Destroy();
|
|
75
|
+
}
|
|
76
|
+
if (_texture) {
|
|
77
|
+
_texture.Destroy();
|
|
78
|
+
}
|
|
79
|
+
if (_instance) {
|
|
80
|
+
_instance.Destroy();
|
|
65
81
|
}
|
|
66
82
|
_texture = nullptr;
|
|
67
83
|
_memory = nullptr;
|
|
84
|
+
_instance = nullptr;
|
|
85
|
+
_source = nullptr;
|
|
68
86
|
}
|
|
69
87
|
|
|
70
88
|
std::string getLabel() { return _label; }
|
|
71
89
|
void setLabel(const std::string &label) {
|
|
72
90
|
_label = label;
|
|
73
|
-
_instance
|
|
91
|
+
if (_instance) {
|
|
92
|
+
_instance.SetLabel(_label.c_str());
|
|
93
|
+
}
|
|
74
94
|
}
|
|
75
95
|
|
|
76
96
|
// Non-spec extension. A 3x4 row-major matrix mapping the *sampled* texel
|
|
@@ -97,6 +117,23 @@ public:
|
|
|
97
117
|
|
|
98
118
|
inline const wgpu::ExternalTexture get() { return _instance; }
|
|
99
119
|
|
|
120
|
+
// End the shared-memory access window on `texture`. Shared by destroy() and
|
|
121
|
+
// the Create() error paths so every EndAccess carries the same chain: Dawn's
|
|
122
|
+
// Vulkan backend rejects the call unless a
|
|
123
|
+
// SharedTextureMemoryVkImageLayoutEndState is chained (it writes the
|
|
124
|
+
// released VkImage layouts there), while the Metal backend only accepts its
|
|
125
|
+
// own optional end state. The returned fences are dropped: Dawn keeps the
|
|
126
|
+
// texture alive for in-flight GPU work on its own.
|
|
127
|
+
static void endAccess(const wgpu::SharedTextureMemory &memory,
|
|
128
|
+
const wgpu::Texture &texture) {
|
|
129
|
+
wgpu::SharedTextureMemoryEndAccessState state{};
|
|
130
|
+
#if defined(__ANDROID__)
|
|
131
|
+
wgpu::SharedTextureMemoryVkImageLayoutEndState vkLayout{};
|
|
132
|
+
state.nextInChain = &vkLayout;
|
|
133
|
+
#endif
|
|
134
|
+
(void)memory.EndAccess(texture, &state);
|
|
135
|
+
}
|
|
136
|
+
|
|
100
137
|
private:
|
|
101
138
|
wgpu::ExternalTexture _instance;
|
|
102
139
|
wgpu::SharedTextureMemory _memory;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"react-native.config.d.ts","sourceRoot":"","sources":["../../react-native.config.js"],"names":[],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/types.ts"],"names":[],"mappings":"AAAA,KAAK,cAAc,GAAG,MAAM,CAAC;AAE7B,MAAM,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;IAC1B,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;CAC5B;AAMD,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,OAAO,EAAE,wBAAwB,CAAC;IAC3C,KAAK,EAAE,MAAM,CAAC;IACd,aAAa,CAAC,UAAU,CAAC,EAAE,oBAAoB,GAAG,UAAU,CAAC;IAM7D,WAAW,CACT,OAAO,EAAE,UAAU,EACnB,WAAW,EAAE,OAAO,EACpB,MAAM,CAAC,EAAE,mBAAmB,EAAE,GAC7B,IAAI,CAAC;IAGR,SAAS,CAAC,OAAO,EAAE,UAAU,GAAG,oCAAoC,CAAC;CACtE"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-webgpu",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.2",
|
|
4
4
|
"description": "React Native WebGPU",
|
|
5
5
|
"main": "lib/commonjs/index",
|
|
6
6
|
"module": "lib/module/index",
|
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
"libs/**",
|
|
22
22
|
"*.podspec",
|
|
23
23
|
"Package.swift",
|
|
24
|
+
"react-native.config.js",
|
|
24
25
|
"app.plugin.js",
|
|
25
26
|
"plugin/build/**"
|
|
26
27
|
],
|
|
@@ -86,7 +87,7 @@
|
|
|
86
87
|
"clang-format": "^1.8.0",
|
|
87
88
|
"del-cli": "^5.1.0",
|
|
88
89
|
"eslint": "9.35.0",
|
|
89
|
-
"eslint-config-react-native-wcandillon": "
|
|
90
|
+
"eslint-config-react-native-wcandillon": "5.0.0",
|
|
90
91
|
"eslint-plugin-import": "2.32.0",
|
|
91
92
|
"eslint-plugin-jest": "^28.8.2",
|
|
92
93
|
"eslint-plugin-prettier": "^5.2.1",
|
|
@@ -14,15 +14,14 @@ Pod::Spec.new do |s|
|
|
|
14
14
|
s.platforms = { :ios => min_ios_version_supported, :osx => "10.15", :visionos => "1.0" }
|
|
15
15
|
s.source = { :git => "https://github.com/wcandillon/react-native-webgpu.git", :tag => "#{s.version}" }
|
|
16
16
|
|
|
17
|
-
#
|
|
18
|
-
#
|
|
19
|
-
#
|
|
20
|
-
#
|
|
21
|
-
# Swift
|
|
22
|
-
#
|
|
23
|
-
#
|
|
24
|
-
#
|
|
25
|
-
# `pod install` for that case.
|
|
17
|
+
# CocoaPods is the supported default. Package.swift (React Native 0.87+
|
|
18
|
+
# SwiftPM autolinking) is additive: SwiftPM ignores this podspec, and
|
|
19
|
+
# CocoaPods ignores Package.swift. An app links through one or the other,
|
|
20
|
+
# never both, so set RNWGPU_USE_SPM=1 before `pod install` when linking
|
|
21
|
+
# through the Swift package instead: RN's autolinking and codegen both key
|
|
22
|
+
# off this podspec being present, so it still needs to exist, but it must
|
|
23
|
+
# not compile or vendor anything itself or the app gets the native module
|
|
24
|
+
# twice.
|
|
26
25
|
if ENV['RNWGPU_USE_SPM']
|
|
27
26
|
# The Swift package resolves React Native's headers from the
|
|
28
27
|
# static-library Pods layout (Pods/Headers/Public). With `use_frameworks!`
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
// Pins the SwiftPM target name. Without it the name is derived: today from the
|
|
2
|
+
// npm name (ReactNativeWebgpu), but an in-flight React Native change derives it
|
|
3
|
+
// from the podspec instead. The name is also the header import prefix, so it
|
|
4
|
+
// must not move. Package.swift declares the same name for its package, product
|
|
5
|
+
// and target; scripts/package-swift-template.ts carries it as SWIFT_PACKAGE_NAME.
|
|
6
|
+
module.exports = { spm: { name: "ReactNativeWebGPU" } };
|
package/src/types.ts
CHANGED
|
@@ -96,9 +96,7 @@ export interface GPUSharedTextureMemoryDescriptor {
|
|
|
96
96
|
// targets (iOS/Metal and Android/Vulkan); importSharedFence accepts these and
|
|
97
97
|
// export() reports them.
|
|
98
98
|
export type GPUSharedFenceType =
|
|
99
|
-
|
|
100
|
-
| "sync-fd"
|
|
101
|
-
| "vk-semaphore-opaque-fd";
|
|
99
|
+
"mtl-shared-event" | "sync-fd" | "vk-semaphore-opaque-fd";
|
|
102
100
|
|
|
103
101
|
export interface GPUSharedFenceDescriptor {
|
|
104
102
|
// The fence kind to import. Must match a shared-fence-* feature enabled on
|