forked from eclipse-efx/efxclipse-drift
-
Notifications
You must be signed in to change notification settings - Fork 0
/
driftcpp.h
89 lines (62 loc) · 1.99 KB
/
driftcpp.h
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#ifndef _DRIFTCPP_H_
#define _DRIFTCPP_H_
#include <string>
#include <iostream>
#include <jni.h>
#ifndef GLuint
typedef unsigned int GLuint;
#endif
// PUBLIC API
namespace driftfx {
struct Vec2i {
int x;
int y;
};
class TransferType {
public:
virtual ::std::string getId() = 0;
virtual bool isAvailable() = 0;
};
class RenderTarget {
};
struct SwapchainConfig {
Vec2i size;
int imageCount;
TransferType* transferType;
};
class Swapchain {
public:
virtual SwapchainConfig getConfig() = 0;
virtual RenderTarget* acquire() = 0;
virtual RenderTarget* tryAcquire() = 0;
virtual void present(RenderTarget* image) = 0;
virtual ~Swapchain() = 0;
};
class Renderer {
public:
virtual Swapchain* createSwapchain(SwapchainConfig config) = 0;
virtual Vec2i getSize() = 0;
virtual ~Renderer() = 0;
};
class GLRenderer {
public:
static GLuint getGLTextureId(RenderTarget* renderTarget);
};
// api entry point
Renderer* initializeRenderer(JNIEnv* env, jobject javaRenderer);
TransferType* getTransferType(JNIEnv* env, jobject javaTransferType);
class StandardTransferTypes {
public:
static TransferType* MainMemory;
static TransferType* IOSurface;
static TransferType* NVDXInterop;
};
// initializes drift cpp
// must be called before any other method
// must be called from a thread which is attached to the jvm with its jni environment
// the classLoader is used to lookup classes. in a non-osgi environment it may be the system class loader, but in osgi environment it must have access to the org.eclipse.fx.drift package
void initialize(JNIEnv* env, jobject classLoader);
// releases drift cpp resources
void dispose(JNIEnv* env);
}
#endif // _DRIFTCPP_H_