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