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