File: RenderDocCapture.cpp

package info (click to toggle)
jazz2-native 3.5.0-1
  • links: PTS, VCS
  • area: contrib
  • in suites:
  • size: 16,836 kB
  • sloc: cpp: 172,557; xml: 113; python: 36; makefile: 5; sh: 2
file content (196 lines) | stat: -rw-r--r-- 4,983 bytes parent folder | download | duplicates (2)
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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
//#if !defined(_WIN32) && !defined(__APPLE__)
//	#include <dlfcn.h>
//	#include "renderdoc.h"
//#else
//	#include "common_windefines.h"
//	#include <libloaderapi.h>
//	#include "renderdoc_app.h"
//#endif
//
//#include "RenderDocCapture.h"
//
//namespace nCine {
//
/////////////////////////////////////////////////////////////
//// STATIC DEFINITIONS
/////////////////////////////////////////////////////////////
//
//namespace {
//	RENDERDOC_API_1_1_2 *rdocApi = nullptr;
//}
//
/////////////////////////////////////////////////////////////
//// PUBLIC FUNCTIONS
/////////////////////////////////////////////////////////////
//
//bool RenderDocCapture::isAvailable()
//{
//	return (rdocApi != nullptr);
//}
//
//bool RenderDocCapture::isTargetControlConnected()
//{
//	if (rdocApi)
//		return rdocApi->IsTargetControlConnected();
//	return false;
//}
//
//bool RenderDocCapture::isFrameCapturing()
//{
//	if (rdocApi)
//		return rdocApi->IsFrameCapturing();
//	return false;
//}
//
//void RenderDocCapture::apiVersion(int *major, int *minor, int *patch)
//{
//	if (rdocApi)
//		rdocApi->GetAPIVersion(major, minor, patch);
//}
//
//bool RenderDocCapture::isOverlayEnabled()
//{
//	unsigned int overlayBits = 0;
//	if (rdocApi)
//		overlayBits = rdocApi->GetOverlayBits();
//
//	return overlayBits & (1 << RENDERDOC_OverlayBits::eRENDERDOC_Overlay_Enabled);
//}
//
//void RenderDocCapture::enableOverlay(bool enabled)
//{
//	if (rdocApi)
//	{
//		if (enabled)
//		{
//			rdocApi->MaskOverlayBits(RENDERDOC_OverlayBits::eRENDERDOC_Overlay_All,
//			                         RENDERDOC_OverlayBits::eRENDERDOC_Overlay_Enabled);
//		}
//		else
//		{
//			rdocApi->MaskOverlayBits(RENDERDOC_OverlayBits::eRENDERDOC_Overlay_All &
//			                             ~RENDERDOC_OverlayBits::eRENDERDOC_Overlay_Enabled,
//			                         RENDERDOC_OverlayBits::eRENDERDOC_Overlay_None);
//		}
//	}
//}
//
//void RenderDocCapture::triggerCapture()
//{
//	if (rdocApi)
//		rdocApi->TriggerCapture();
//}
//
//void RenderDocCapture::triggerMultiFrameCapture(uint32_t numFrames)
//{
//	if (rdocApi)
//		rdocApi->TriggerMultiFrameCapture(numFrames);
//}
//
//bool RenderDocCapture::endFrameCapture()
//{
//	if (rdocApi)
//		return rdocApi->EndFrameCapture(nullptr, nullptr);
//	return false;
//}
//
//bool RenderDocCapture::discardFrameCapture()
//{
//	if (rdocApi)
//		return rdocApi->DiscardFrameCapture(nullptr, nullptr);
//	return false;
//}
//
//uint32_t RenderDocCapture::numCaptures()
//{
//	if (rdocApi)
//		return rdocApi->GetNumCaptures();
//	return 0;
//}
//
//uint32_t RenderDocCapture::captureInfo(uint32_t idx, char *filename, uint32_t *pathlength, uint64_t *timestamp)
//{
//	if (rdocApi)
//		return rdocApi->GetCapture(idx, filename, pathlength, timestamp);
//	return 0;
//}
//
//const char *RenderDocCapture::captureFilePathTemplate()
//{
//	if (rdocApi)
//		return rdocApi->GetCaptureFilePathTemplate();
//	return nullptr;
//}
//
//void RenderDocCapture::setCaptureFilePathTemplate(const char *pathTemplate)
//{
//	if (rdocApi)
//		rdocApi->SetCaptureFilePathTemplate(pathTemplate);
//}
//
//void RenderDocCapture::setCaptureFileComments(const char *filePath, const char *comments)
//{
//	if (rdocApi)
//		rdocApi->SetCaptureFileComments(filePath, comments);
//}
//
//uint32_t RenderDocCapture::launchReplayUI(uint32_t connectTargetControl, const char *cmdLine)
//{
//	if (rdocApi)
//		return rdocApi->LaunchReplayUI(connectTargetControl, cmdLine);
//	return 0;
//}
//
//void RenderDocCapture::unloadCrashHandler()
//{
//	if (rdocApi)
//		rdocApi->UnloadCrashHandler();
//}
//
/////////////////////////////////////////////////////////////
//// PRIVATE FUNCTIONS
/////////////////////////////////////////////////////////////
//
//void RenderDocCapture::init()
//{
//#if defined(_WIN32)
//	if (HMODULE mod = GetModuleHandleA("renderdoc.dll"))
//	{
//		pRENDERDOC_GetAPI RENDERDOC_GetAPI = reinterpret_cast<pRENDERDOC_GetAPI>(GetProcAddress(mod, "RENDERDOC_GetAPI"));
//		const int ret = RENDERDOC_GetAPI(eRENDERDOC_API_Version_1_1_2, reinterpret_cast<void **>(&rdocApi));
//		//ASSERT(ret == 1);
//	}
//#elif !defined(__APPLE__)
//	#if defined(__ANDROID__)
//	if (void *mod = dlopen("libVkLayer_GLES_RenderDoc.so", RTLD_NOW | RTLD_NOLOAD))
//	#else
//	if (void *mod = dlopen("librenderdoc.so", RTLD_NOW | RTLD_NOLOAD))
//	#endif
//	{
//		pRENDERDOC_GetAPI RENDERDOC_GetAPI = reinterpret_cast<pRENDERDOC_GetAPI>(dlsym(mod, "RENDERDOC_GetAPI"));
//		const int ret = RENDERDOC_GetAPI(eRENDERDOC_API_Version_1_1_2, reinterpret_cast<void **>(&rdocApi));
//		//ASSERT(ret == 1);
//	}
//#endif
//
//	if (rdocApi)
//	{
//		int major, minor, patch;
//		apiVersion(&major, &minor, &patch);
//		LOGI("RenderDoc API: {}.{}.{}", major, minor, patch);
//	}
//}
//
//void RenderDocCapture::removeHooks()
//{
//	if (rdocApi)
//		rdocApi->RemoveHooks();
//}
//
//void RenderDocCapture::startFrameCapture()
//{
//	if (rdocApi)
//		rdocApi->StartFrameCapture(nullptr, nullptr);
//}
//
//}