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
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
//! Entry point loading and API versioning.
use ;
use Path;
use DynamicLibrary;
use ;
lazy_static!
/// Provides the major, minor, and patch version numbers of the RenderDoc API
/// given to the application.
///
/// Note that RenderDoc will usually provide a higher API version than the one
/// requested by the user if it's backwards compatible. If a parameter is
/// `std::ptr::null_mut()`, it will be ignored while the others will be filled
/// out.
pub type GetApiVersionFn = unsafe extern "C" fn;
/// Sets the specified `CaptureOption` to the given `u32` value.
///
/// Returns `1` if the option and the value are valid. Otherwise, returns `0`
/// and leaves the option unchanged.
pub type SetCaptureOptionU32Fn = unsafe extern "C" fn ;
/// Sets the specified `CaptureOption` to the given `f32` value.
///
/// Returns `1` if the option and the value are valid. Otherwise, returns `0`
/// and leaves the option unchanged.
pub type SetCaptureOptionF32Fn = unsafe extern "C" fn ;
/// Returns the current value of the given `CaptureOption` as a `u32` value.
///
/// If the option is invalid, then `std::u32::MAX` is returned instead.
pub type GetCaptureOptionU32Fn = unsafe extern "C" fn ;
/// Returns the current value of the given `CaptureOption` as a `u32` value.
///
/// If the option is invalid, then `std::f32::MAX * -1f32` is returned instead.
pub type GetCaptureOptionF32Fn = unsafe extern "C" fn ;
/// Sets which key(s) can be used to toggle focus between multiple windows.
///
/// If `keys` is `std::ptr::null()`, then window toggling will be disabled.
pub type SetFocusToggleKeysFn = unsafe extern "C" fn;
/// Sets which key(s) can be used to capture the next frame.
///
/// If `keys` is `std::ptr::null()`, then frame capture functionality will
/// be disabled.
pub type SetCaptureKeysFn = unsafe extern "C" fn;
/// Returns the `OverlayBits` that have been set.
pub type GetOverlayBitsFn = unsafe extern "C" fn ;
/// Sets the given `OverlayBits` with an AND and OR mask.
pub type MaskOverlayBitsFn = unsafe extern "C" fn;
/// Attempts to shut down RenderDoc.
///
/// Note that this will work correctly if done _immediately_ after the dynamic
/// library is loaded, before any API work happens. At that point, RenderDoc
/// will remove its injected hooks and shut down. Behavior is undefined if this
/// is called after any API functions have been called.
pub type ShutdownFn = unsafe extern "C" fn;
/// Unloads the RenderDoc crash handler from your application.
///
/// If you use your own crash handler and don't want RenderDoc's handler to
/// intercede, you may call this function to unload it and any unhandled
/// exceptions will pass to the next handler instead.
pub type UnloadCrashHandlerFn = unsafe extern "C" fn;
/// Sets the naming prefix to be used when saving frame capture files.
///
/// `path_template` is a UTF-8 string that gives a template for how captures can
/// be named and where they will be saved. Any extension is stripped off the
/// path and the captures are saved in the directory specified with the file
/// name and frame number appended. If the requested directory or directory
/// structure does not exist, it will be created recursively for you.
///
/// If `path_template` is `std::ptr::null()`, then the template will be left
/// unchanged.
///
/// # Example
///
/// ```c
/// SetLogPathTemplateFn("my_captures/example");
///
/// // This function call will result in the following captures:
/// //
/// // Capture #1 -> my_captures/example_frame123.rdc
/// // Capture #2 -> my_captures/example_frame456.rdc.
/// ```
pub type SetLogFilePathTemplateFn = unsafe extern "C" fn;
/// Returns the current frame capture file template as a raw UTF-8 string.
///
/// See the `SetLogFilePathTemplateFn` description for details.
pub type GetLogFilePathTemplateFn = unsafe extern "C" fn ;
/// Returns the number of frame captures that have been made so far.
pub type GetNumCapturesFn = unsafe extern "C" fn ;
/// Retrieves the details of a frame capture with the given index `idx`.
///
/// If `idx` is a valid frame capture number, then `log_file` will be filled
/// with the absolute UTF-8 formatted path to the capture file; `path_len` will
/// be the length in bytes of the `log_file` string; and `timestamp` will be the
/// time of capture, measured in seconds passed since the UNIX epoch.
///
/// If a parameter is set to `std::ptr::null_mut()`, it will be skipped and the
/// rest will be filled out.
///
/// Returns `1` if the capture index is valid. Otherwise, returns `0` and leaves
/// the values of `log_file`, `path_len`, and `timestamp` all unchanged.
pub type GetCaptureFn = unsafe extern "C" fn
;
/// Captures the next frame from the currently active window and API device.
///
/// Data is saved to a capture log file at the location specified via the
/// `SetLogFilePathTemplateFn` function call.
///
/// If no supported APIs have been initialized, this function will do nothing.
pub type TriggerCaptureFn = unsafe extern "C" fn;
/// Returns whether the external RenderDoc UI is connected to this application.
///
/// # Compatibility
///
/// The older name of this function, `IsRemoteAccessConnected`, has been
/// deprecated since RenderDoc version 1.1.1. However, since its function
/// signature is binary compatible with this one, there is no need for us to add
/// another type definition.
pub type IsTargetControlConnectedFn = unsafe extern "C" fn ;
/// Launches the replay UI from within the injected application.
///
/// If `connect_target_control` is `1`, the replay UI will launch with a
/// command line parameter specified by `cmd_line`, a UTF-8 string. If
/// `cmd_line` is `std::ptr::null()`, then the command line will be empty.
///
/// Returns the PID of the replay UI if successful, otherwise returns `0`.
pub type LaunchReplayUiFn = unsafe extern "C" fn
;
/// Activates the RenderDoc in-app overlay inside the given window handle
/// `wnd_handle` and API device pointer `device`.
///
/// Neither parameter can be `std::ptr::null_mut()`.
pub type SetActiveWindowFn = unsafe extern "C" fn;
/// Immediately starts capturing API calls from the specified device pointer
/// and window handle.
///
/// If `device` is `std::ptr::null_mut()`, then all API calls outputting to
/// `wnd_handle` will be captured, regardless of API device(s). This is useful
/// if the API device being used isn't necessarily known at runtime.
///
/// If `wnd_handle` is `std::ptr::null_mut()`, then all API calls to `device`
/// will be captured, regardless of its output window(s). This is useful for
/// headless rendering.
///
/// If both `device` and `wnd_handle` are set to `std::ptr::null_mut()`, then
/// _all_ API calls in this application will be captured, regardless of output
/// window(s) and/or API device(s).
///
/// If no supported APIs have been initialized, this function will do nothing.
///
/// If two or more started captures overlap each other, then this will result
/// in undefined behavior (including crashes).
pub type StartFrameCaptureFn = unsafe extern "C" fn;
/// Returns whether or not a frame capture is currently ongoing anywhere.
pub type IsFrameCapturingFn = unsafe extern "C" fn ;
/// Ends the ongoing capture on the given device pointer and window handle.
///
/// Data is saved to a capture log file at the location specified via the
/// `SetLogFilePathTemplateFn` function call. Returns `1` if the capture
/// succeeded, otherwise returns `0`.
pub type EndFrameCaptureFn = unsafe extern "C" fn
;
/// Captures the next _n_ frames from the currently active window and API device.
///
/// Data is saved to a capture log file at the location specified via the
/// `SetLogFilePathTemplateFn` function call.
///
/// If no supported APIs have been initialized, this function will do nothing.
pub type TriggerMultiFrameCaptureFn = unsafe extern "C" fn;
/// Entry point for RenderDoc API version 1.0.
/// Entry point for RenderDoc API version 1.1.