• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /******************************************************************************
2  * The MIT License (MIT)
3  *
4  * Copyright (c) 2015-2018 Baldur Karlsson
5  *
6  * Permission is hereby granted, free of charge, to any person obtaining a copy
7  * of this software and associated documentation files (the "Software"), to deal
8  * in the Software without restriction, including without limitation the rights
9  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10  * copies of the Software, and to permit persons to whom the Software is
11  * furnished to do so, subject to the following conditions:
12  *
13  * The above copyright notice and this permission notice shall be included in
14  * all copies or substantial portions of the Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22  * THE SOFTWARE.
23  ******************************************************************************/
24 
25 #pragma once
26 
27 //////////////////////////////////////////////////////////////////////////////////////////////////
28 //
29 // Documentation for the API is available at https://renderdoc.org/docs/in_application_api.html
30 //
31 
32 #if !defined(RENDERDOC_NO_STDINT)
33 #    include <stdint.h>
34 #endif
35 
36 #if defined(WIN32)
37 #    define RENDERDOC_CC __cdecl
38 #elif defined(__linux__)
39 #    define RENDERDOC_CC
40 #elif defined(__APPLE__)
41 #    define RENDERDOC_CC
42 #else
43 #    error "Unknown platform"
44 #endif
45 
46 #ifdef __cplusplus
47 extern "C" {
48 #endif
49 
50 //////////////////////////////////////////////////////////////////////////////////////////////////
51 // Constants not used directly in below API
52 
53 // This is a GUID/magic value used for when applications pass a path where shader debug
54 // information can be found to match up with a stripped shader.
55 // the define can be used like so: const GUID RENDERDOC_ShaderDebugMagicValue =
56 // RENDERDOC_ShaderDebugMagicValue_value
57 #define RENDERDOC_ShaderDebugMagicValue_struct                                    \
58     {                                                                             \
59         0xeab25520, 0x6670, 0x4865, 0x84, 0x29, 0x6c, 0x8, 0x51, 0x54, 0x00, 0xff \
60     }
61 
62 // as an alternative when you want a byte array (assuming x86 endianness):
63 #define RENDERDOC_ShaderDebugMagicValue_bytearray                                                \
64     {                                                                                            \
65         0x20, 0x55, 0xb2, 0xea, 0x70, 0x66, 0x65, 0x48, 0x84, 0x29, 0x6c, 0x8, 0x51, 0x54, 0x00, \
66             0xff                                                                                 \
67     }
68 
69 // truncated version when only a uint64_t is available (e.g. Vulkan tags):
70 #define RENDERDOC_ShaderDebugMagicValue_truncated 0x48656670eab25520ULL
71 
72 //////////////////////////////////////////////////////////////////////////////////////////////////
73 // RenderDoc capture options
74 //
75 
76 typedef enum
77 {
78     // Allow the application to enable vsync
79     //
80     // Default - enabled
81     //
82     // 1 - The application can enable or disable vsync at will
83     // 0 - vsync is force disabled
84     eRENDERDOC_Option_AllowVSync = 0,
85 
86     // Allow the application to enable fullscreen
87     //
88     // Default - enabled
89     //
90     // 1 - The application can enable or disable fullscreen at will
91     // 0 - fullscreen is force disabled
92     eRENDERDOC_Option_AllowFullscreen = 1,
93 
94     // Record API debugging events and messages
95     //
96     // Default - disabled
97     //
98     // 1 - Enable built-in API debugging features and records the results into
99     //     the capture, which is matched up with events on replay
100     // 0 - no API debugging is forcibly enabled
101     eRENDERDOC_Option_APIValidation   = 2,
102     eRENDERDOC_Option_DebugDeviceMode = 2,  // deprecated name of this enum
103 
104     // Capture CPU callstacks for API events
105     //
106     // Default - disabled
107     //
108     // 1 - Enables capturing of callstacks
109     // 0 - no callstacks are captured
110     eRENDERDOC_Option_CaptureCallstacks = 3,
111 
112     // When capturing CPU callstacks, only capture them from drawcalls.
113     // This option does nothing without the above option being enabled
114     //
115     // Default - disabled
116     //
117     // 1 - Only captures callstacks for drawcall type API events.
118     //     Ignored if CaptureCallstacks is disabled
119     // 0 - Callstacks, if enabled, are captured for every event.
120     eRENDERDOC_Option_CaptureCallstacksOnlyDraws = 4,
121 
122     // Specify a delay in seconds to wait for a debugger to attach, after
123     // creating or injecting into a process, before continuing to allow it to run.
124     //
125     // 0 indicates no delay, and the process will run immediately after injection
126     //
127     // Default - 0 seconds
128     //
129     eRENDERDOC_Option_DelayForDebugger = 5,
130 
131     // Verify any writes to mapped buffers, by checking the memory after the
132     // bounds of the returned pointer to detect any modification.
133     //
134     // Default - disabled
135     //
136     // 1 - Verify any writes to mapped buffers
137     // 0 - No verification is performed, and overwriting bounds may cause
138     //     crashes or corruption in RenderDoc
139     eRENDERDOC_Option_VerifyMapWrites = 6,
140 
141     // Hooks any system API calls that create child processes, and injects
142     // RenderDoc into them recursively with the same options.
143     //
144     // Default - disabled
145     //
146     // 1 - Hooks into spawned child processes
147     // 0 - Child processes are not hooked by RenderDoc
148     eRENDERDOC_Option_HookIntoChildren = 7,
149 
150     // By default RenderDoc only includes resources in the final capture necessary
151     // for that frame, this allows you to override that behaviour.
152     //
153     // Default - disabled
154     //
155     // 1 - all live resources at the time of capture are included in the capture
156     //     and available for inspection
157     // 0 - only the resources referenced by the captured frame are included
158     eRENDERDOC_Option_RefAllResources = 8,
159 
160     // **NOTE**: As of RenderDoc v1.1 this option has been deprecated. Setting or
161     // getting it will be ignored, to allow compatibility with older versions.
162     // In v1.1 the option acts as if it's always enabled.
163     //
164     // By default RenderDoc skips saving initial states for resources where the
165     // previous contents don't appear to be used, assuming that writes before
166     // reads indicate previous contents aren't used.
167     //
168     // Default - disabled
169     //
170     // 1 - initial contents at the start of each captured frame are saved, even if
171     //     they are later overwritten or cleared before being used.
172     // 0 - unless a read is detected, initial contents will not be saved and will
173     //     appear as black or empty data.
174     eRENDERDOC_Option_SaveAllInitials = 9,
175 
176     // In APIs that allow for the recording of command lists to be replayed later,
177     // RenderDoc may choose to not capture command lists before a frame capture is
178     // triggered, to reduce overheads. This means any command lists recorded once
179     // and replayed many times will not be available and may cause a failure to
180     // capture.
181     //
182     // Note this is only true for APIs where multithreading is difficult or
183     // discouraged. Newer APIs like Vulkan and D3D12 will ignore this option
184     // and always capture all command lists since the API is heavily oriented
185     // around it and the overheads have been reduced by API design.
186     //
187     // 1 - All command lists are captured from the start of the application
188     // 0 - Command lists are only captured if their recording begins during
189     //     the period when a frame capture is in progress.
190     eRENDERDOC_Option_CaptureAllCmdLists = 10,
191 
192     // Mute API debugging output when the API validation mode option is enabled
193     //
194     // Default - enabled
195     //
196     // 1 - Mute any API debug messages from being displayed or passed through
197     // 0 - API debugging is displayed as normal
198     eRENDERDOC_Option_DebugOutputMute = 11,
199 
200 } RENDERDOC_CaptureOption;
201 
202 // Sets an option that controls how RenderDoc behaves on capture.
203 //
204 // Returns 1 if the option and value are valid
205 // Returns 0 if either is invalid and the option is unchanged
206 typedef int(RENDERDOC_CC *pRENDERDOC_SetCaptureOptionU32)(RENDERDOC_CaptureOption opt,
207                                                           uint32_t val);
208 typedef int(RENDERDOC_CC *pRENDERDOC_SetCaptureOptionF32)(RENDERDOC_CaptureOption opt, float val);
209 
210 // Gets the current value of an option as a uint32_t
211 //
212 // If the option is invalid, 0xffffffff is returned
213 typedef uint32_t(RENDERDOC_CC *pRENDERDOC_GetCaptureOptionU32)(RENDERDOC_CaptureOption opt);
214 
215 // Gets the current value of an option as a float
216 //
217 // If the option is invalid, -FLT_MAX is returned
218 typedef float(RENDERDOC_CC *pRENDERDOC_GetCaptureOptionF32)(RENDERDOC_CaptureOption opt);
219 
220 typedef enum
221 {
222     // '0' - '9' matches ASCII values
223     eRENDERDOC_Key_0 = 0x30,
224     eRENDERDOC_Key_1 = 0x31,
225     eRENDERDOC_Key_2 = 0x32,
226     eRENDERDOC_Key_3 = 0x33,
227     eRENDERDOC_Key_4 = 0x34,
228     eRENDERDOC_Key_5 = 0x35,
229     eRENDERDOC_Key_6 = 0x36,
230     eRENDERDOC_Key_7 = 0x37,
231     eRENDERDOC_Key_8 = 0x38,
232     eRENDERDOC_Key_9 = 0x39,
233 
234     // 'A' - 'Z' matches ASCII values
235     eRENDERDOC_Key_A = 0x41,
236     eRENDERDOC_Key_B = 0x42,
237     eRENDERDOC_Key_C = 0x43,
238     eRENDERDOC_Key_D = 0x44,
239     eRENDERDOC_Key_E = 0x45,
240     eRENDERDOC_Key_F = 0x46,
241     eRENDERDOC_Key_G = 0x47,
242     eRENDERDOC_Key_H = 0x48,
243     eRENDERDOC_Key_I = 0x49,
244     eRENDERDOC_Key_J = 0x4A,
245     eRENDERDOC_Key_K = 0x4B,
246     eRENDERDOC_Key_L = 0x4C,
247     eRENDERDOC_Key_M = 0x4D,
248     eRENDERDOC_Key_N = 0x4E,
249     eRENDERDOC_Key_O = 0x4F,
250     eRENDERDOC_Key_P = 0x50,
251     eRENDERDOC_Key_Q = 0x51,
252     eRENDERDOC_Key_R = 0x52,
253     eRENDERDOC_Key_S = 0x53,
254     eRENDERDOC_Key_T = 0x54,
255     eRENDERDOC_Key_U = 0x55,
256     eRENDERDOC_Key_V = 0x56,
257     eRENDERDOC_Key_W = 0x57,
258     eRENDERDOC_Key_X = 0x58,
259     eRENDERDOC_Key_Y = 0x59,
260     eRENDERDOC_Key_Z = 0x5A,
261 
262     // leave the rest of the ASCII range free
263     // in case we want to use it later
264     eRENDERDOC_Key_NonPrintable = 0x100,
265 
266     eRENDERDOC_Key_Divide,
267     eRENDERDOC_Key_Multiply,
268     eRENDERDOC_Key_Subtract,
269     eRENDERDOC_Key_Plus,
270 
271     eRENDERDOC_Key_F1,
272     eRENDERDOC_Key_F2,
273     eRENDERDOC_Key_F3,
274     eRENDERDOC_Key_F4,
275     eRENDERDOC_Key_F5,
276     eRENDERDOC_Key_F6,
277     eRENDERDOC_Key_F7,
278     eRENDERDOC_Key_F8,
279     eRENDERDOC_Key_F9,
280     eRENDERDOC_Key_F10,
281     eRENDERDOC_Key_F11,
282     eRENDERDOC_Key_F12,
283 
284     eRENDERDOC_Key_Home,
285     eRENDERDOC_Key_End,
286     eRENDERDOC_Key_Insert,
287     eRENDERDOC_Key_Delete,
288     eRENDERDOC_Key_PageUp,
289     eRENDERDOC_Key_PageDn,
290 
291     eRENDERDOC_Key_Backspace,
292     eRENDERDOC_Key_Tab,
293     eRENDERDOC_Key_PrtScrn,
294     eRENDERDOC_Key_Pause,
295 
296     eRENDERDOC_Key_Max,
297 } RENDERDOC_InputButton;
298 
299 // Sets which key or keys can be used to toggle focus between multiple windows
300 //
301 // If keys is NULL or num is 0, toggle keys will be disabled
302 typedef void(RENDERDOC_CC *pRENDERDOC_SetFocusToggleKeys)(RENDERDOC_InputButton *keys, int num);
303 
304 // Sets which key or keys can be used to capture the next frame
305 //
306 // If keys is NULL or num is 0, captures keys will be disabled
307 typedef void(RENDERDOC_CC *pRENDERDOC_SetCaptureKeys)(RENDERDOC_InputButton *keys, int num);
308 
309 typedef enum
310 {
311     // This single bit controls whether the overlay is enabled or disabled globally
312     eRENDERDOC_Overlay_Enabled = 0x1,
313 
314     // Show the average framerate over several seconds as well as min/max
315     eRENDERDOC_Overlay_FrameRate = 0x2,
316 
317     // Show the current frame number
318     eRENDERDOC_Overlay_FrameNumber = 0x4,
319 
320     // Show a list of recent captures, and how many captures have been made
321     eRENDERDOC_Overlay_CaptureList = 0x8,
322 
323     // Default values for the overlay mask
324     eRENDERDOC_Overlay_Default = (eRENDERDOC_Overlay_Enabled | eRENDERDOC_Overlay_FrameRate |
325                                   eRENDERDOC_Overlay_FrameNumber | eRENDERDOC_Overlay_CaptureList),
326 
327     // Enable all bits
328     eRENDERDOC_Overlay_All = ~0U,
329 
330     // Disable all bits
331     eRENDERDOC_Overlay_None = 0,
332 } RENDERDOC_OverlayBits;
333 
334 // returns the overlay bits that have been set
335 typedef uint32_t(RENDERDOC_CC *pRENDERDOC_GetOverlayBits)();
336 // sets the overlay bits with an and & or mask
337 typedef void(RENDERDOC_CC *pRENDERDOC_MaskOverlayBits)(uint32_t And, uint32_t Or);
338 
339 // this function will attempt to shut down RenderDoc.
340 //
341 // Note: that this will only work correctly if done immediately after
342 // the dll is loaded, before any API work happens. RenderDoc will remove its
343 // injected hooks and shut down. Behaviour is undefined if this is called
344 // after any API functions have been called.
345 typedef void(RENDERDOC_CC *pRENDERDOC_Shutdown)();
346 
347 // This function will unload RenderDoc's crash handler.
348 //
349 // If you use your own crash handler and don't want RenderDoc's handler to
350 // intercede, you can call this function to unload it and any unhandled
351 // exceptions will pass to the next handler.
352 typedef void(RENDERDOC_CC *pRENDERDOC_UnloadCrashHandler)();
353 
354 // Sets the capture file path template
355 //
356 // pathtemplate is a UTF-8 string that gives a template for how captures will be named
357 // and where they will be saved.
358 //
359 // Any extension is stripped off the path, and captures are saved in the directory
360 // specified, and named with the filename and the frame number appended. If the
361 // directory does not exist it will be created, including any parent directories.
362 //
363 // If pathtemplate is NULL, the template will remain unchanged
364 //
365 // Example:
366 //
367 // SetCaptureFilePathTemplate("my_captures/example");
368 //
369 // Capture #1 -> my_captures/example_frame123.rdc
370 // Capture #2 -> my_captures/example_frame456.rdc
371 typedef void(RENDERDOC_CC *pRENDERDOC_SetCaptureFilePathTemplate)(const char *pathtemplate);
372 
373 // returns the current capture path template, see SetCaptureFileTemplate above, as a UTF-8 string
374 typedef const char *(RENDERDOC_CC *pRENDERDOC_GetCaptureFilePathTemplate)();
375 
376 // DEPRECATED: compatibility for code compiled against pre-1.1.2 headers.
377 typedef void(RENDERDOC_CC *pRENDERDOC_SetLogFilePathTemplate)(const char *pathtemplate);
378 typedef const char *(RENDERDOC_CC *pRENDERDOC_GetLogFilePathTemplate)();
379 
380 // returns the number of captures that have been made
381 typedef uint32_t(RENDERDOC_CC *pRENDERDOC_GetNumCaptures)();
382 
383 // This function returns the details of a capture, by index. New captures are added
384 // to the end of the list.
385 //
386 // filename will be filled with the absolute path to the capture file, as a UTF-8 string
387 // pathlength will be written with the length in bytes of the filename string
388 // timestamp will be written with the time of the capture, in seconds since the Unix epoch
389 //
390 // Any of the parameters can be NULL and they'll be skipped.
391 //
392 // The function will return 1 if the capture index is valid, or 0 if the index is invalid
393 // If the index is invalid, the values will be unchanged
394 //
395 // Note: when captures are deleted in the UI they will remain in this list, so the
396 // capture path may not exist anymore.
397 typedef uint32_t(RENDERDOC_CC *pRENDERDOC_GetCapture)(uint32_t idx,
398                                                       char *filename,
399                                                       uint32_t *pathlength,
400                                                       uint64_t *timestamp);
401 
402 // returns 1 if the RenderDoc UI is connected to this application, 0 otherwise
403 typedef uint32_t(RENDERDOC_CC *pRENDERDOC_IsTargetControlConnected)();
404 
405 // DEPRECATED: compatibility for code compiled against pre-1.1.1 headers.
406 // This was renamed to IsTargetControlConnected in API 1.1.1, the old typedef is kept here for
407 // backwards compatibility with old code, it is castable either way since it's ABI compatible
408 // as the same function pointer type.
409 typedef uint32_t(RENDERDOC_CC *pRENDERDOC_IsRemoteAccessConnected)();
410 
411 // This function will launch the Replay UI associated with the RenderDoc library injected
412 // into the running application.
413 //
414 // if connectTargetControl is 1, the Replay UI will be launched with a command line parameter
415 // to connect to this application
416 // cmdline is the rest of the command line, as a UTF-8 string. E.g. a captures to open
417 // if cmdline is NULL, the command line will be empty.
418 //
419 // returns the PID of the replay UI if successful, 0 if not successful.
420 typedef uint32_t(RENDERDOC_CC *pRENDERDOC_LaunchReplayUI)(uint32_t connectTargetControl,
421                                                           const char *cmdline);
422 
423 // RenderDoc can return a higher version than requested if it's backwards compatible,
424 // this function returns the actual version returned. If a parameter is NULL, it will be
425 // ignored and the others will be filled out.
426 typedef void(RENDERDOC_CC *pRENDERDOC_GetAPIVersion)(int *major, int *minor, int *patch);
427 
428 //////////////////////////////////////////////////////////////////////////
429 // Capturing functions
430 //
431 
432 // A device pointer is a pointer to the API's root handle.
433 //
434 // This would be an ID3D11Device, HGLRC/GLXContext, ID3D12Device, etc
435 typedef void *RENDERDOC_DevicePointer;
436 
437 // A window handle is the OS's native window handle
438 //
439 // This would be an HWND, GLXDrawable, etc
440 typedef void *RENDERDOC_WindowHandle;
441 
442 // A helper macro for Vulkan, where the device handle cannot be used directly.
443 //
444 // Passing the VkInstance to this macro will return the RENDERDOC_DevicePointer to use.
445 //
446 // Specifically, the value needed is the dispatch table pointer, which sits as the first
447 // pointer-sized object in the memory pointed to by the VkInstance. Thus we cast to a void** and
448 // indirect once.
449 #define RENDERDOC_DEVICEPOINTER_FROM_VKINSTANCE(inst) (*((void **)(inst)))
450 
451 // This sets the RenderDoc in-app overlay in the API/window pair as 'active' and it will
452 // respond to keypresses. Neither parameter can be NULL
453 typedef void(RENDERDOC_CC *pRENDERDOC_SetActiveWindow)(RENDERDOC_DevicePointer device,
454                                                        RENDERDOC_WindowHandle wndHandle);
455 
456 // capture the next frame on whichever window and API is currently considered active
457 typedef void(RENDERDOC_CC *pRENDERDOC_TriggerCapture)();
458 
459 // capture the next N frames on whichever window and API is currently considered active
460 typedef void(RENDERDOC_CC *pRENDERDOC_TriggerMultiFrameCapture)(uint32_t numFrames);
461 
462 // When choosing either a device pointer or a window handle to capture, you can pass NULL.
463 // Passing NULL specifies a 'wildcard' match against anything. This allows you to specify
464 // any API rendering to a specific window, or a specific API instance rendering to any window,
465 // or in the simplest case of one window and one API, you can just pass NULL for both.
466 //
467 // In either case, if there are two or more possible matching (device,window) pairs it
468 // is undefined which one will be captured.
469 //
470 // Note: for headless rendering you can pass NULL for the window handle and either specify
471 // a device pointer or leave it NULL as above.
472 
473 // Immediately starts capturing API calls on the specified device pointer and window handle.
474 //
475 // If there is no matching thing to capture (e.g. no supported API has been initialised),
476 // this will do nothing.
477 //
478 // The results are undefined (including crashes) if two captures are started overlapping,
479 // even on separate devices and/oror windows.
480 typedef void(RENDERDOC_CC *pRENDERDOC_StartFrameCapture)(RENDERDOC_DevicePointer device,
481                                                          RENDERDOC_WindowHandle wndHandle);
482 
483 // Returns whether or not a frame capture is currently ongoing anywhere.
484 //
485 // This will return 1 if a capture is ongoing, and 0 if there is no capture running
486 typedef uint32_t(RENDERDOC_CC *pRENDERDOC_IsFrameCapturing)();
487 
488 // Ends capturing immediately.
489 //
490 // This will return 1 if the capture succeeded, and 0 if there was an error capturing.
491 typedef uint32_t(RENDERDOC_CC *pRENDERDOC_EndFrameCapture)(RENDERDOC_DevicePointer device,
492                                                            RENDERDOC_WindowHandle wndHandle);
493 
494 //////////////////////////////////////////////////////////////////////////////////////////////////
495 // RenderDoc API versions
496 //
497 
498 // RenderDoc uses semantic versioning (http://semver.org/).
499 //
500 // MAJOR version is incremented when incompatible API changes happen.
501 // MINOR version is incremented when functionality is added in a backwards-compatible manner.
502 // PATCH version is incremented when backwards-compatible bug fixes happen.
503 //
504 // Note that this means the API returned can be higher than the one you might have requested.
505 // e.g. if you are running against a newer RenderDoc that supports 1.0.1, it will be returned
506 // instead of 1.0.0. You can check this with the GetAPIVersion entry point
507 typedef enum
508 {
509     eRENDERDOC_API_Version_1_0_0 = 10000,  // RENDERDOC_API_1_0_0 = 1 00 00
510     eRENDERDOC_API_Version_1_0_1 = 10001,  // RENDERDOC_API_1_0_1 = 1 00 01
511     eRENDERDOC_API_Version_1_0_2 = 10002,  // RENDERDOC_API_1_0_2 = 1 00 02
512     eRENDERDOC_API_Version_1_1_0 = 10100,  // RENDERDOC_API_1_1_0 = 1 01 00
513     eRENDERDOC_API_Version_1_1_1 = 10101,  // RENDERDOC_API_1_1_1 = 1 01 01
514     eRENDERDOC_API_Version_1_1_2 = 10102,  // RENDERDOC_API_1_1_2 = 1 01 02
515 } RENDERDOC_Version;
516 
517 // API version changelog:
518 //
519 // 1.0.0 - initial release
520 // 1.0.1 - Bugfix: IsFrameCapturing() was returning false for captures that were triggered
521 //         by keypress or TriggerCapture, instead of Start/EndFrameCapture.
522 // 1.0.2 - Refactor: Renamed eRENDERDOC_Option_DebugDeviceMode to eRENDERDOC_Option_APIValidation
523 // 1.1.0 - Add feature: TriggerMultiFrameCapture(). Backwards compatible with 1.0.x since the new
524 //         function pointer is added to the end of the struct, the original layout is identical
525 // 1.1.1 - Refactor: Renamed remote access to target control (to better disambiguate from remote
526 //         replay/remote server concept in replay UI)
527 // 1.1.2 - Refactor: Renamed "log file" in function names to just capture, to clarify that these
528 //         are captures and not debug logging files. This is the first API version in the v1.0
529 //         branch.
530 
531 // eRENDERDOC_API_Version_1_1_0
532 typedef struct
533 {
534     pRENDERDOC_GetAPIVersion GetAPIVersion;
535 
536     pRENDERDOC_SetCaptureOptionU32 SetCaptureOptionU32;
537     pRENDERDOC_SetCaptureOptionF32 SetCaptureOptionF32;
538 
539     pRENDERDOC_GetCaptureOptionU32 GetCaptureOptionU32;
540     pRENDERDOC_GetCaptureOptionF32 GetCaptureOptionF32;
541 
542     pRENDERDOC_SetFocusToggleKeys SetFocusToggleKeys;
543     pRENDERDOC_SetCaptureKeys SetCaptureKeys;
544 
545     pRENDERDOC_GetOverlayBits GetOverlayBits;
546     pRENDERDOC_MaskOverlayBits MaskOverlayBits;
547 
548     pRENDERDOC_Shutdown Shutdown;
549     pRENDERDOC_UnloadCrashHandler UnloadCrashHandler;
550 
551     pRENDERDOC_SetLogFilePathTemplate SetLogFilePathTemplate;
552     pRENDERDOC_GetLogFilePathTemplate GetLogFilePathTemplate;
553 
554     pRENDERDOC_GetNumCaptures GetNumCaptures;
555     pRENDERDOC_GetCapture GetCapture;
556 
557     pRENDERDOC_TriggerCapture TriggerCapture;
558 
559     pRENDERDOC_IsRemoteAccessConnected IsRemoteAccessConnected;
560     pRENDERDOC_LaunchReplayUI LaunchReplayUI;
561 
562     pRENDERDOC_SetActiveWindow SetActiveWindow;
563 
564     pRENDERDOC_StartFrameCapture StartFrameCapture;
565     pRENDERDOC_IsFrameCapturing IsFrameCapturing;
566     pRENDERDOC_EndFrameCapture EndFrameCapture;
567 
568     pRENDERDOC_TriggerMultiFrameCapture TriggerMultiFrameCapture;
569 } RENDERDOC_API_1_1_0;
570 
571 typedef RENDERDOC_API_1_1_0 RENDERDOC_API_1_0_0;
572 typedef RENDERDOC_API_1_1_0 RENDERDOC_API_1_0_1;
573 typedef RENDERDOC_API_1_1_0 RENDERDOC_API_1_0_2;
574 
575 // although this structure is identical to RENDERDOC_API_1_1_0, the member
576 // IsRemoteAccessConnected was renamed to IsTargetControlConnected. So that
577 // old code can still compile with a new header, we must declare a new struct
578 // type. It can be casted back and forth though, so we will still return a
579 // pointer to this type for all previous API versions - the above struct is
580 // purely legacy for compilation compatibility
581 
582 // eRENDERDOC_API_Version_1_1_1
583 typedef struct
584 {
585     pRENDERDOC_GetAPIVersion GetAPIVersion;
586 
587     pRENDERDOC_SetCaptureOptionU32 SetCaptureOptionU32;
588     pRENDERDOC_SetCaptureOptionF32 SetCaptureOptionF32;
589 
590     pRENDERDOC_GetCaptureOptionU32 GetCaptureOptionU32;
591     pRENDERDOC_GetCaptureOptionF32 GetCaptureOptionF32;
592 
593     pRENDERDOC_SetFocusToggleKeys SetFocusToggleKeys;
594     pRENDERDOC_SetCaptureKeys SetCaptureKeys;
595 
596     pRENDERDOC_GetOverlayBits GetOverlayBits;
597     pRENDERDOC_MaskOverlayBits MaskOverlayBits;
598 
599     pRENDERDOC_Shutdown Shutdown;
600     pRENDERDOC_UnloadCrashHandler UnloadCrashHandler;
601 
602     pRENDERDOC_SetLogFilePathTemplate SetLogFilePathTemplate;
603     pRENDERDOC_GetLogFilePathTemplate GetLogFilePathTemplate;
604 
605     pRENDERDOC_GetNumCaptures GetNumCaptures;
606     pRENDERDOC_GetCapture GetCapture;
607 
608     pRENDERDOC_TriggerCapture TriggerCapture;
609 
610     pRENDERDOC_IsTargetControlConnected IsTargetControlConnected;
611     pRENDERDOC_LaunchReplayUI LaunchReplayUI;
612 
613     pRENDERDOC_SetActiveWindow SetActiveWindow;
614 
615     pRENDERDOC_StartFrameCapture StartFrameCapture;
616     pRENDERDOC_IsFrameCapturing IsFrameCapturing;
617     pRENDERDOC_EndFrameCapture EndFrameCapture;
618 
619     pRENDERDOC_TriggerMultiFrameCapture TriggerMultiFrameCapture;
620 } RENDERDOC_API_1_1_1;
621 
622 // similarly to above, we renamed Get/SetLogFilePathTemplate to Get/SetCaptureFilePathTemplate.
623 // We thus declare a new struct so that code that was referencing the RENDERDOC_API_1_1_1 struct
624 // can still compile without changes, but new code will use the new struct members
625 
626 // eRENDERDOC_API_Version_1_1_2
627 typedef struct
628 {
629     pRENDERDOC_GetAPIVersion GetAPIVersion;
630 
631     pRENDERDOC_SetCaptureOptionU32 SetCaptureOptionU32;
632     pRENDERDOC_SetCaptureOptionF32 SetCaptureOptionF32;
633 
634     pRENDERDOC_GetCaptureOptionU32 GetCaptureOptionU32;
635     pRENDERDOC_GetCaptureOptionF32 GetCaptureOptionF32;
636 
637     pRENDERDOC_SetFocusToggleKeys SetFocusToggleKeys;
638     pRENDERDOC_SetCaptureKeys SetCaptureKeys;
639 
640     pRENDERDOC_GetOverlayBits GetOverlayBits;
641     pRENDERDOC_MaskOverlayBits MaskOverlayBits;
642 
643     pRENDERDOC_Shutdown Shutdown;
644     pRENDERDOC_UnloadCrashHandler UnloadCrashHandler;
645 
646     pRENDERDOC_SetCaptureFilePathTemplate SetCaptureFilePathTemplate;
647     pRENDERDOC_GetCaptureFilePathTemplate GetCaptureFilePathTemplate;
648 
649     pRENDERDOC_GetNumCaptures GetNumCaptures;
650     pRENDERDOC_GetCapture GetCapture;
651 
652     pRENDERDOC_TriggerCapture TriggerCapture;
653 
654     pRENDERDOC_IsTargetControlConnected IsTargetControlConnected;
655     pRENDERDOC_LaunchReplayUI LaunchReplayUI;
656 
657     pRENDERDOC_SetActiveWindow SetActiveWindow;
658 
659     pRENDERDOC_StartFrameCapture StartFrameCapture;
660     pRENDERDOC_IsFrameCapturing IsFrameCapturing;
661     pRENDERDOC_EndFrameCapture EndFrameCapture;
662 
663     pRENDERDOC_TriggerMultiFrameCapture TriggerMultiFrameCapture;
664 } RENDERDOC_API_1_1_2;
665 
666 //////////////////////////////////////////////////////////////////////////////////////////////////
667 // RenderDoc API entry point
668 //
669 // This entry point can be obtained via GetProcAddress/dlsym if RenderDoc is available.
670 //
671 // The name is the same as the typedef - "RENDERDOC_GetAPI"
672 //
673 // This function is not thread safe, and should not be called on multiple threads at once.
674 // Ideally, call this once as early as possible in your application's startup, before doing
675 // any API work, since some configuration functionality etc has to be done also before
676 // initialising any APIs.
677 //
678 // Parameters:
679 //   version is a single value from the RENDERDOC_Version above.
680 //
681 //   outAPIPointers will be filled out with a pointer to the corresponding struct of function
682 //   pointers.
683 //
684 // Returns:
685 //   1 - if the outAPIPointers has been filled with a pointer to the API struct requested
686 //   0 - if the requested version is not supported or the arguments are invalid.
687 //
688 typedef int(RENDERDOC_CC *pRENDERDOC_GetAPI)(RENDERDOC_Version version, void **outAPIPointers);
689 
690 #ifdef __cplusplus
691 }  // extern "C"
692 #endif
693