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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
|
/*
* Copyright (c) 2014-2017, NVIDIA CORPORATION. All rights reserved.
*
* NVIDIA CORPORATION and its licensors retain all intellectual property
* and proprietary rights in and to this software, related documentation
* and any modifications thereto. Any use, reproduction, disclosure or
* distribution of this software and related documentation without an express
* license agreement from NVIDIA CORPORATION is strictly prohibited.
*/
#include <SDL.h>
#include "loader.h"
#include "imguiGraph.h"
#include "imguiInterop.h"
namespace
{
ModuleLoader<24u, SDL_LoadObject, SDL_UnloadObject, SDL_LoadFunction> g_loader;
}
void loadImgui(AppGraphCtxType type)
{
const char* moduleName = demoAppDLLName(type);
g_loader.loadModule(moduleName);
}
void unloadImgui()
{
g_loader.unloadModule();
}
// Below are the functions that must be implemented per graphics API
void imguiGraphContextInit(const ImguiGraphDesc* desc)
{
return g_loader.function<0>(imguiGraphContextInit, "imguiGraphContextInit", desc);
}
void imguiGraphContextUpdate(const ImguiGraphDesc* desc)
{
return g_loader.function<1>(imguiGraphContextUpdate, "imguiGraphContextUpdate", desc);
}
void imguiGraphContextDestroy()
{
return g_loader.function<2>(imguiGraphContextDestroy, "imguiGraphContextDestroy");
}
void imguiGraphRecordBegin()
{
return g_loader.function<3>(imguiGraphRecordBegin, "imguiGraphRecordBegin");
}
void imguiGraphRecordEnd()
{
return g_loader.function<4>(imguiGraphRecordEnd, "imguiGraphRecordEnd");
}
void imguiGraphVertex2f(float x, float y)
{
return g_loader.function<5>(imguiGraphVertex2f, "imguiGraphVertex2f", x, y);
}
void imguiGraphVertex2fv(const float* v)
{
return g_loader.function<6>(imguiGraphVertex2fv, "imguiGraphVertex2fv", v);
}
void imguiGraphTexCoord2f(float u, float v)
{
return g_loader.function<7>(imguiGraphTexCoord2f, "imguiGraphTexCoord2f", u, v);
}
void imguiGraphColor4ub(uint8_t red, uint8_t green, uint8_t blue, uint8_t alpha)
{
return g_loader.function<8>(imguiGraphColor4ub, "imguiGraphColor4ub", red, green, blue, alpha);
}
void imguiGraphColor4ubv(const uint8_t* v)
{
return g_loader.function<9>(imguiGraphColor4ubv, "imguiGraphColor4ubv", v);
}
void imguiGraphFontTextureEnable()
{
return g_loader.function<10>(imguiGraphFontTextureEnable, "imguiGraphFontTextureEnable");
}
void imguiGraphFontTextureDisable()
{
return g_loader.function<11>(imguiGraphFontTextureDisable, "imguiGraphFontTextureDisable");
}
void imguiGraphEnableScissor(int x, int y, int width, int height)
{
return g_loader.function<12>(imguiGraphEnableScissor, "imguiGraphEnableScissor", x, y, width, height);
}
void imguiGraphDisableScissor()
{
return g_loader.function<13>(imguiGraphDisableScissor, "imguiGraphDisableScissor");
}
void imguiGraphFontTextureInit(unsigned char* data)
{
return g_loader.function<14>(imguiGraphFontTextureInit, "imguiGraphFontTextureInit",data);
}
void imguiGraphFontTextureRelease()
{
return g_loader.function<15>(imguiGraphFontTextureRelease, "imguiGraphFontTextureRelease");
}
bool imguiInteropGraphInit(imguiGraphInit_t func, const char* fontpath, AppGraphCtx* appctx)
{
return g_loader.function<16>(imguiInteropGraphInit, "imguiInteropGraphInit", func, fontpath, appctx);
}
void imguiInteropGraphUpdate(imguiGraphUpdate_t func, AppGraphCtx* appctx)
{
return g_loader.function<17>(imguiInteropGraphUpdate, "imguiInteropGraphUpdate", func, appctx);
}
|