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