aboutsummaryrefslogtreecommitdiff
path: root/demo/DemoApp/appGraphCtxLoaderGenerated.h
blob: 7983c294097f2808927ecbcc7e99fd1f004bb455 (plain) (blame)
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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
/*
* 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.
*/

typedef AppGraphCtx*  (*AppGraphCtxCreate_ptr_t)(int  deviceID);
typedef bool  (*AppGraphCtxUpdateSize_ptr_t)(AppGraphCtx*  context, SDL_Window*  window, bool  fullscreen);
typedef void  (*AppGraphCtxReleaseRenderTarget_ptr_t)(AppGraphCtx*  context);
typedef void  (*AppGraphCtxRelease_ptr_t)(AppGraphCtx*  context);
typedef void  (*AppGraphCtxFrameStart_ptr_t)(AppGraphCtx*  context, AppGraphColor  clearColor);
typedef void  (*AppGraphCtxFramePresent_ptr_t)(AppGraphCtx*  context, bool  fullsync);
typedef void  (*AppGraphCtxWaitForFrames_ptr_t)(AppGraphCtx*  context, unsigned int  maxFramesInFlight);
typedef void  (*AppGraphCtxProfileEnable_ptr_t)(AppGraphCtx*  context, bool  enabled);
typedef void  (*AppGraphCtxProfileBegin_ptr_t)(AppGraphCtx*  context, const char*  label);
typedef void  (*AppGraphCtxProfileEnd_ptr_t)(AppGraphCtx*  context, const char*  label);
typedef bool  (*AppGraphCtxProfileGet_ptr_t)(AppGraphCtx*  context, const char**  plabel, float*  cpuTime, float*  gpuTime, int  index);
typedef size_t  (*AppGraphCtxDedicatedVideoMemory_ptr_t)(AppGraphCtx*  context);

struct AppGraphCtxLoader 
{ 
	void* module = nullptr; 
	const char* suffix = ""; 
	char buf[1024u]; 

	AppGraphCtxCreate_ptr_t AppGraphCtxCreate_ptr;
	AppGraphCtxUpdateSize_ptr_t AppGraphCtxUpdateSize_ptr;
	AppGraphCtxReleaseRenderTarget_ptr_t AppGraphCtxReleaseRenderTarget_ptr;
	AppGraphCtxRelease_ptr_t AppGraphCtxRelease_ptr;
	AppGraphCtxFrameStart_ptr_t AppGraphCtxFrameStart_ptr;
	AppGraphCtxFramePresent_ptr_t AppGraphCtxFramePresent_ptr;
	AppGraphCtxWaitForFrames_ptr_t AppGraphCtxWaitForFrames_ptr;
	AppGraphCtxProfileEnable_ptr_t AppGraphCtxProfileEnable_ptr;
	AppGraphCtxProfileBegin_ptr_t AppGraphCtxProfileBegin_ptr;
	AppGraphCtxProfileEnd_ptr_t AppGraphCtxProfileEnd_ptr;
	AppGraphCtxProfileGet_ptr_t AppGraphCtxProfileGet_ptr;
	AppGraphCtxDedicatedVideoMemory_ptr_t AppGraphCtxDedicatedVideoMemory_ptr;

}gAppGraphCtxLoader; 

AppGraphCtx*  AppGraphCtxCreate(int  deviceID)
{
	return gAppGraphCtxLoader.AppGraphCtxCreate_ptr(deviceID);
}

bool  AppGraphCtxUpdateSize(AppGraphCtx*  context, SDL_Window*  window, bool  fullscreen)
{
	return gAppGraphCtxLoader.AppGraphCtxUpdateSize_ptr(context, window, fullscreen);
}

void  AppGraphCtxReleaseRenderTarget(AppGraphCtx*  context)
{
	return gAppGraphCtxLoader.AppGraphCtxReleaseRenderTarget_ptr(context);
}

void  AppGraphCtxRelease(AppGraphCtx*  context)
{
	return gAppGraphCtxLoader.AppGraphCtxRelease_ptr(context);
}

void  AppGraphCtxFrameStart(AppGraphCtx*  context, AppGraphColor  clearColor)
{
	return gAppGraphCtxLoader.AppGraphCtxFrameStart_ptr(context, clearColor);
}

void  AppGraphCtxFramePresent(AppGraphCtx*  context, bool  fullsync)
{
	return gAppGraphCtxLoader.AppGraphCtxFramePresent_ptr(context, fullsync);
}

void  AppGraphCtxWaitForFrames(AppGraphCtx*  context, unsigned int  maxFramesInFlight)
{
	return gAppGraphCtxLoader.AppGraphCtxWaitForFrames_ptr(context, maxFramesInFlight);
}

void  AppGraphCtxProfileEnable(AppGraphCtx*  context, bool  enabled)
{
	return gAppGraphCtxLoader.AppGraphCtxProfileEnable_ptr(context, enabled);
}

void  AppGraphCtxProfileBegin(AppGraphCtx*  context, const char*  label)
{
	return gAppGraphCtxLoader.AppGraphCtxProfileBegin_ptr(context, label);
}

void  AppGraphCtxProfileEnd(AppGraphCtx*  context, const char*  label)
{
	return gAppGraphCtxLoader.AppGraphCtxProfileEnd_ptr(context, label);
}

bool  AppGraphCtxProfileGet(AppGraphCtx*  context, const char**  plabel, float*  cpuTime, float*  gpuTime, int  index)
{
	return gAppGraphCtxLoader.AppGraphCtxProfileGet_ptr(context, plabel, cpuTime, gpuTime, index);
}

size_t  AppGraphCtxDedicatedVideoMemory(AppGraphCtx*  context)
{
	return gAppGraphCtxLoader.AppGraphCtxDedicatedVideoMemory_ptr(context);
}

void* appGraphCtxLoaderLoadFunction(AppGraphCtxLoader* inst, const char* name)
{
	snprintf(inst->buf, 1024u, "%s%s", name, inst->suffix);

	return SDL_LoadFunction(inst->module, inst->buf);
}

void loadAppGraphCtx(AppGraphCtxType type)
{
	const char* moduleName = demoAppDLLName(type);

	gAppGraphCtxLoader.suffix = demoAppBackendSuffix(type);

	gAppGraphCtxLoader.module = SDL_LoadObject(moduleName);

	gAppGraphCtxLoader.AppGraphCtxCreate_ptr = (AppGraphCtxCreate_ptr_t)(appGraphCtxLoaderLoadFunction(&gAppGraphCtxLoader, "AppGraphCtxCreate"));
	gAppGraphCtxLoader.AppGraphCtxUpdateSize_ptr = (AppGraphCtxUpdateSize_ptr_t)(appGraphCtxLoaderLoadFunction(&gAppGraphCtxLoader, "AppGraphCtxUpdateSize"));
	gAppGraphCtxLoader.AppGraphCtxReleaseRenderTarget_ptr = (AppGraphCtxReleaseRenderTarget_ptr_t)(appGraphCtxLoaderLoadFunction(&gAppGraphCtxLoader, "AppGraphCtxReleaseRenderTarget"));
	gAppGraphCtxLoader.AppGraphCtxRelease_ptr = (AppGraphCtxRelease_ptr_t)(appGraphCtxLoaderLoadFunction(&gAppGraphCtxLoader, "AppGraphCtxRelease"));
	gAppGraphCtxLoader.AppGraphCtxFrameStart_ptr = (AppGraphCtxFrameStart_ptr_t)(appGraphCtxLoaderLoadFunction(&gAppGraphCtxLoader, "AppGraphCtxFrameStart"));
	gAppGraphCtxLoader.AppGraphCtxFramePresent_ptr = (AppGraphCtxFramePresent_ptr_t)(appGraphCtxLoaderLoadFunction(&gAppGraphCtxLoader, "AppGraphCtxFramePresent"));
	gAppGraphCtxLoader.AppGraphCtxWaitForFrames_ptr = (AppGraphCtxWaitForFrames_ptr_t)(appGraphCtxLoaderLoadFunction(&gAppGraphCtxLoader, "AppGraphCtxWaitForFrames"));
	gAppGraphCtxLoader.AppGraphCtxProfileEnable_ptr = (AppGraphCtxProfileEnable_ptr_t)(appGraphCtxLoaderLoadFunction(&gAppGraphCtxLoader, "AppGraphCtxProfileEnable"));
	gAppGraphCtxLoader.AppGraphCtxProfileBegin_ptr = (AppGraphCtxProfileBegin_ptr_t)(appGraphCtxLoaderLoadFunction(&gAppGraphCtxLoader, "AppGraphCtxProfileBegin"));
	gAppGraphCtxLoader.AppGraphCtxProfileEnd_ptr = (AppGraphCtxProfileEnd_ptr_t)(appGraphCtxLoaderLoadFunction(&gAppGraphCtxLoader, "AppGraphCtxProfileEnd"));
	gAppGraphCtxLoader.AppGraphCtxProfileGet_ptr = (AppGraphCtxProfileGet_ptr_t)(appGraphCtxLoaderLoadFunction(&gAppGraphCtxLoader, "AppGraphCtxProfileGet"));
	gAppGraphCtxLoader.AppGraphCtxDedicatedVideoMemory_ptr = (AppGraphCtxDedicatedVideoMemory_ptr_t)(appGraphCtxLoaderLoadFunction(&gAppGraphCtxLoader, "AppGraphCtxDedicatedVideoMemory"));
}

void unloadAppGraphCtx()
{
	gAppGraphCtxLoader.AppGraphCtxCreate_ptr = nullptr;
	gAppGraphCtxLoader.AppGraphCtxUpdateSize_ptr = nullptr;
	gAppGraphCtxLoader.AppGraphCtxReleaseRenderTarget_ptr = nullptr;
	gAppGraphCtxLoader.AppGraphCtxRelease_ptr = nullptr;
	gAppGraphCtxLoader.AppGraphCtxFrameStart_ptr = nullptr;
	gAppGraphCtxLoader.AppGraphCtxFramePresent_ptr = nullptr;
	gAppGraphCtxLoader.AppGraphCtxWaitForFrames_ptr = nullptr;
	gAppGraphCtxLoader.AppGraphCtxProfileEnable_ptr = nullptr;
	gAppGraphCtxLoader.AppGraphCtxProfileBegin_ptr = nullptr;
	gAppGraphCtxLoader.AppGraphCtxProfileEnd_ptr = nullptr;
	gAppGraphCtxLoader.AppGraphCtxProfileGet_ptr = nullptr;
	gAppGraphCtxLoader.AppGraphCtxDedicatedVideoMemory_ptr = nullptr;

	SDL_UnloadObject(gAppGraphCtxLoader.module);
}