-
Notifications
You must be signed in to change notification settings - Fork 7
/
renderdoc_app.h
240 lines (193 loc) · 7.41 KB
/
renderdoc_app.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
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
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
/******************************************************************************
* The MIT License (MIT)
*
* Copyright (c) 2014 Crytek
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
******************************************************************************/
#pragma once
#include <stdint.h>
typedef uint8_t byte;
typedef uint32_t bool32;
#ifdef WIN32
#ifdef RENDERDOC_EXPORTS
#define RENDERDOC_API __declspec(dllexport)
#else
#define RENDERDOC_API __declspec(dllimport)
#endif
#define RENDERDOC_CC __cdecl
#elif defined(LINUX)
#ifdef RENDERDOC_EXPORTS
#define RENDERDOC_API __attribute__ ((visibility ("default")))
#else
#define RENDERDOC_API
#endif
#define RENDERDOC_CC
#else
#error "Unknown platform"
#endif
#include <string>
#include <sstream> // istringstream/ostringstream used to avoid other dependencies
struct CaptureOptions
{
CaptureOptions()
: AllowVSync(true),
AllowFullscreen(true),
DebugDeviceMode(false),
CaptureCallstacks(false),
CaptureCallstacksOnlyDraws(false),
DelayForDebugger(0),
CacheStateObjects(true),
HookIntoChildren(false),
RefAllResources(false),
SaveAllInitials(false),
CaptureAllCmdLists(false)
{}
bool32 AllowVSync;
bool32 AllowFullscreen;
bool32 DebugDeviceMode;
bool32 CaptureCallstacks;
bool32 CaptureCallstacksOnlyDraws;
uint32_t DelayForDebugger;
bool32 CacheStateObjects;
bool32 HookIntoChildren;
bool32 RefAllResources;
bool32 SaveAllInitials;
bool32 CaptureAllCmdLists;
#ifdef __cplusplus
void FromString(std::string str)
{
std::istringstream iss(str);
iss >> AllowFullscreen
>> AllowVSync
>> DebugDeviceMode
>> CaptureCallstacks
>> CaptureCallstacksOnlyDraws
>> DelayForDebugger
>> CacheStateObjects
>> HookIntoChildren
>> RefAllResources
>> SaveAllInitials
>> CaptureAllCmdLists;
}
std::string ToString() const
{
std::ostringstream oss;
oss << AllowFullscreen << " "
<< AllowVSync << " "
<< DebugDeviceMode << " "
<< CaptureCallstacks << " "
<< CaptureCallstacksOnlyDraws << " "
<< DelayForDebugger << " "
<< CacheStateObjects << " "
<< HookIntoChildren << " "
<< RefAllResources << " "
<< SaveAllInitials << " "
<< CaptureAllCmdLists << " ";
return oss.str();
}
#endif
};
enum KeyButton
{
eKey_0 = 0x30, // '0'
// ...
eKey_9 = 0x39, // '9'
eKey_A = 0x41, // 'A'
// ...
eKey_Z = 0x5A, // 'Z'
eKey_Divide,
eKey_Multiply,
eKey_Subtract,
eKey_Plus,
eKey_F1,
eKey_F2,
eKey_F3,
eKey_F4,
eKey_F5,
eKey_F6,
eKey_F7,
eKey_F8,
eKey_F9,
eKey_F10,
eKey_F11,
eKey_F12,
eKey_Home,
eKey_End,
eKey_Insert,
eKey_Delete,
eKey_PageUp,
eKey_PageDn,
eKey_Backspace,
eKey_Tab,
eKey_PrtScrn,
eKey_Pause,
eKey_Max,
};
enum InAppOverlay
{
eOverlay_Enabled = 0x1,
eOverlay_FrameRate = 0x2,
eOverlay_FrameNumber = 0x4,
eOverlay_CaptureList = 0x8,
eOverlay_Default = (eOverlay_Enabled|eOverlay_FrameRate|eOverlay_FrameNumber|eOverlay_CaptureList),
eOverlay_All = ~0U,
eOverlay_None = 0,
};
#define RENDERDOC_API_VERSION 1
//////////////////////////////////////////////////////////////////////////
// In-program functions
//////////////////////////////////////////////////////////////////////////
extern "C" RENDERDOC_API int RENDERDOC_CC RENDERDOC_GetAPIVersion();
typedef int (RENDERDOC_CC *pRENDERDOC_GetAPIVersion)();
extern "C" RENDERDOC_API void RENDERDOC_CC RENDERDOC_SetLogFile(const wchar_t *logfile);
typedef void (RENDERDOC_CC *pRENDERDOC_SetLogFile)(const wchar_t *logfile);
extern "C" RENDERDOC_API const wchar_t* RENDERDOC_CC RENDERDOC_GetLogFile();
typedef const wchar_t* (RENDERDOC_CC *pRENDERDOC_GetLogFile)();
extern "C" RENDERDOC_API bool RENDERDOC_CC RENDERDOC_GetCapture(uint32_t idx, wchar_t *logfile, uint32_t *pathlength, uint64_t *timestamp);
typedef bool (RENDERDOC_CC *pRENDERDOC_GetCapture)(uint32_t idx, wchar_t *logfile, uint32_t *pathlength, uint64_t *timestamp);
extern "C" RENDERDOC_API void RENDERDOC_CC RENDERDOC_SetCaptureOptions(const CaptureOptions *opts);
typedef void (RENDERDOC_CC *pRENDERDOC_SetCaptureOptions)(const CaptureOptions *opts);
extern "C" RENDERDOC_API void RENDERDOC_CC RENDERDOC_SetActiveWindow(void *wndHandle);
typedef void (RENDERDOC_CC *pRENDERDOC_SetActiveWindow)(void *wndHandle);
extern "C" RENDERDOC_API void RENDERDOC_CC RENDERDOC_TriggerCapture();
typedef void (RENDERDOC_CC *pRENDERDOC_TriggerCapture)();
extern "C" RENDERDOC_API void RENDERDOC_CC RENDERDOC_StartFrameCapture(void *wndHandle);
typedef void (RENDERDOC_CC *pRENDERDOC_StartFrameCapture)(void *wndHandle);
extern "C" RENDERDOC_API bool RENDERDOC_CC RENDERDOC_EndFrameCapture(void *wndHandle);
typedef bool (RENDERDOC_CC *pRENDERDOC_EndFrameCapture)(void *wndHandle);
extern "C" RENDERDOC_API uint32_t RENDERDOC_CC RENDERDOC_GetOverlayBits();
typedef uint32_t (RENDERDOC_CC *pRENDERDOC_GetOverlayBits)();
extern "C" RENDERDOC_API void RENDERDOC_CC RENDERDOC_MaskOverlayBits(uint32_t And, uint32_t Or);
typedef void (RENDERDOC_CC *pRENDERDOC_MaskOverlayBits)(uint32_t And, uint32_t Or);
extern "C" RENDERDOC_API void RENDERDOC_CC RENDERDOC_SetFocusToggleKeys(KeyButton *keys, int num);
typedef void (RENDERDOC_CC *pRENDERDOC_SetFocusToggleKeys)(KeyButton *keys, int num);
extern "C" RENDERDOC_API void RENDERDOC_CC RENDERDOC_SetCaptureKeys(KeyButton *keys, int num);
typedef void (RENDERDOC_CC *pRENDERDOC_SetCaptureKeys)(KeyButton *keys, int num);
//////////////////////////////////////////////////////////////////////////
// Injection/execution capture functions.
//////////////////////////////////////////////////////////////////////////
extern "C" RENDERDOC_API uint32_t RENDERDOC_CC RENDERDOC_ExecuteAndInject(const wchar_t *app, const wchar_t *workingDir, const wchar_t *cmdLine,
const wchar_t *logfile, const CaptureOptions *opts, bool waitForExit);
typedef uint32_t (RENDERDOC_CC *pRENDERDOC_ExecuteAndInject)(const wchar_t *app, const wchar_t *workingDir, const wchar_t *cmdLine,
const wchar_t *logfile, const CaptureOptions *opts, bool waitForExit);
extern "C" RENDERDOC_API uint32_t RENDERDOC_CC RENDERDOC_InjectIntoProcess(uint32_t pid, const wchar_t *logfile, const CaptureOptions *opts, bool waitForExit);
typedef uint32_t (RENDERDOC_CC *pRENDERDOC_InjectIntoProcess)(uint32_t pid, const wchar_t *logfile, const CaptureOptions *opts, bool waitForExit);
extern "C" RENDERDOC_API void RENDERDOC_CC RENDERDOC_InitRemoteAccess(uint32_t *ident);
typedef void (RENDERDOC_CC *pRENDERDOC_InitRemoteAccess)(uint32_t *ident);