forked from wcandillon/react-native-webgpu
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRNWebGPUManager.h
More file actions
50 lines (40 loc) · 1.22 KB
/
RNWebGPUManager.h
File metadata and controls
50 lines (40 loc) · 1.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#pragma once
#include <memory>
#include <string>
#include <vector>
#include "GPU.h"
#include "PlatformContext.h"
#include "SurfaceRegistry.h"
namespace facebook {
namespace jsi {
class Runtime;
} // namespace jsi
namespace react {
class CallInvoker;
}
} // namespace facebook
namespace rnwgpu {
namespace jsi = facebook::jsi;
namespace react = facebook::react;
class RNWebGPUManager {
public:
RNWebGPUManager(jsi::Runtime *jsRuntime,
std::shared_ptr<facebook::react::CallInvoker> jsCallInvoker,
std::shared_ptr<PlatformContext> platformContext,
std::vector<std::string> enableToggles = {},
std::vector<std::string> disableToggles = {});
~RNWebGPUManager();
/**
* Install global helper functions for Worklets serialization.
* This installs __webgpuIsWebGPUObject and __webgpuBox on the global object.
* Can be called on any runtime (main JS, UI, or custom worklet runtimes).
*/
static void installWebGPUWorkletHelpers(jsi::Runtime &runtime);
private:
jsi::Runtime *_jsRuntime;
std::shared_ptr<facebook::react::CallInvoker> _jsCallInvoker;
public:
wgpu::Instance _gpu;
std::shared_ptr<PlatformContext> _platformContext;
};
} // namespace rnwgpu