renderdoc_app.h 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234
  1. /******************************************************************************
  2. * The MIT License (MIT)
  3. *
  4. * Copyright (c) 2014 Crytek
  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. #pragma once
  25. #include <stdint.h>
  26. #ifdef WIN32
  27. #ifdef RENDERDOC_EXPORTS
  28. #define RENDERDOC_API __declspec(dllexport)
  29. #else
  30. #define RENDERDOC_API __declspec(dllimport)
  31. #endif
  32. #define RENDERDOC_CC __cdecl
  33. #elif defined(__linux__)
  34. #ifdef RENDERDOC_EXPORTS
  35. #define RENDERDOC_API __attribute__ ((visibility ("default")))
  36. #else
  37. #define RENDERDOC_API
  38. #endif
  39. #define RENDERDOC_CC
  40. #else
  41. #error "Unknown platform"
  42. #endif
  43. struct CaptureOptions
  44. {
  45. CaptureOptions()
  46. : AllowVSync(true),
  47. AllowFullscreen(true),
  48. DebugDeviceMode(false),
  49. CaptureCallstacks(false),
  50. CaptureCallstacksOnlyDraws(false),
  51. DelayForDebugger(0),
  52. VerifyMapWrites(false),
  53. HookIntoChildren(false),
  54. RefAllResources(false),
  55. SaveAllInitials(false),
  56. CaptureAllCmdLists(false)
  57. {}
  58. // Whether or not to allow the application to enable vsync
  59. //
  60. // Enabled - allows the application to enable or disable vsync at will
  61. // Disabled - vsync is force disabled
  62. uint32_t AllowVSync;
  63. // Whether or not to allow the application to enable fullscreen
  64. //
  65. // Enabled - allows the application to enable or disable fullscreen at will
  66. // Disabled - fullscreen is force disabled
  67. uint32_t AllowFullscreen;
  68. // Enables in-built API debugging features and records the results into the
  69. // capture logfile, which is matched up with events on replay
  70. uint32_t DebugDeviceMode;
  71. // Captures callstacks for every API event during capture
  72. uint32_t CaptureCallstacks;
  73. // Only captures callstacks for drawcall type API events.
  74. // Ignored if CaptureCallstacks is disabled
  75. uint32_t CaptureCallstacksOnlyDraws;
  76. // Specify a delay in seconds to wait for a debugger to attach after
  77. // creating or injecting into a process, before continuing to allow it to run.
  78. uint32_t DelayForDebugger;
  79. // Verify any writes to mapped buffers, to check that they don't overwrite the
  80. // bounds of the pointer returned.
  81. uint32_t VerifyMapWrites;
  82. // Hooks any system API events that create child processes, and injects
  83. // renderdoc into them recursively with the same options.
  84. uint32_t HookIntoChildren;
  85. // By default renderdoc only includes resources in the final logfile necessary
  86. // for that frame, this allows you to override that behaviour
  87. //
  88. // Enabled - all live resources at the time of capture are included in the log
  89. // and available for inspection
  90. // Disabled - only the resources referenced by the captured frame are included
  91. uint32_t RefAllResources;
  92. // By default renderdoc skips saving initial states for
  93. uint32_t SaveAllInitials;
  94. // In APIs that allow for the recording of command lists to be replayed later,
  95. // renderdoc may choose to not capture command lists before a frame capture is
  96. // triggered, to reduce overheads. This means any command lists recorded once
  97. // and replayed many times will not be available and may cause a failure to
  98. // capture.
  99. //
  100. // Enabled - All command lists are captured from the start of the application
  101. // Disabled - Command lists are only captured if their recording begins during
  102. // the period when a frame capture is in progress.
  103. uint32_t CaptureAllCmdLists;
  104. };
  105. enum KeyButton
  106. {
  107. eKey_0 = 0x30, // '0'
  108. // ...
  109. eKey_9 = 0x39, // '9'
  110. eKey_A = 0x41, // 'A'
  111. // ...
  112. eKey_Z = 0x5A, // 'Z'
  113. eKey_Divide,
  114. eKey_Multiply,
  115. eKey_Subtract,
  116. eKey_Plus,
  117. eKey_F1,
  118. eKey_F2,
  119. eKey_F3,
  120. eKey_F4,
  121. eKey_F5,
  122. eKey_F6,
  123. eKey_F7,
  124. eKey_F8,
  125. eKey_F9,
  126. eKey_F10,
  127. eKey_F11,
  128. eKey_F12,
  129. eKey_Home,
  130. eKey_End,
  131. eKey_Insert,
  132. eKey_Delete,
  133. eKey_PageUp,
  134. eKey_PageDn,
  135. eKey_Backspace,
  136. eKey_Tab,
  137. eKey_PrtScrn,
  138. eKey_Pause,
  139. eKey_Max,
  140. };
  141. enum InAppOverlay
  142. {
  143. eOverlay_Enabled = 0x1,
  144. eOverlay_FrameRate = 0x2,
  145. eOverlay_FrameNumber = 0x4,
  146. eOverlay_CaptureList = 0x8,
  147. eOverlay_Default = (eOverlay_Enabled|eOverlay_FrameRate|eOverlay_FrameNumber|eOverlay_CaptureList),
  148. eOverlay_All = INT32_MAX,
  149. eOverlay_None = 0,
  150. };
  151. // API breaking change history:
  152. // Version 1 -> 2 - strings changed from wchar_t* to char* (UTF-8)
  153. #define RENDERDOC_API_VERSION 2
  154. //////////////////////////////////////////////////////////////////////////
  155. // In-program functions
  156. //////////////////////////////////////////////////////////////////////////
  157. extern "C" RENDERDOC_API int RENDERDOC_CC RENDERDOC_GetAPIVersion();
  158. typedef int (RENDERDOC_CC *pRENDERDOC_GetAPIVersion)();
  159. extern "C" RENDERDOC_API void RENDERDOC_CC RENDERDOC_SetLogFile(const char *logfile);
  160. typedef void (RENDERDOC_CC *pRENDERDOC_SetLogFile)(const char *logfile);
  161. extern "C" RENDERDOC_API const char* RENDERDOC_CC RENDERDOC_GetLogFile();
  162. typedef const char* (RENDERDOC_CC *pRENDERDOC_GetLogFile)();
  163. extern "C" RENDERDOC_API uint32_t RENDERDOC_CC RENDERDOC_GetCapture(uint32_t idx, char *logfile, uint32_t *pathlength, uint64_t *timestamp);
  164. typedef uint32_t (RENDERDOC_CC *pRENDERDOC_GetCapture)(uint32_t idx, char *logfile, uint32_t *pathlength, uint64_t *timestamp);
  165. extern "C" RENDERDOC_API void RENDERDOC_CC RENDERDOC_SetCaptureOptions(const CaptureOptions *opts);
  166. typedef void (RENDERDOC_CC *pRENDERDOC_SetCaptureOptions)(const CaptureOptions *opts);
  167. extern "C" RENDERDOC_API void RENDERDOC_CC RENDERDOC_SetActiveWindow(void *wndHandle);
  168. typedef void (RENDERDOC_CC *pRENDERDOC_SetActiveWindow)(void *wndHandle);
  169. extern "C" RENDERDOC_API void RENDERDOC_CC RENDERDOC_TriggerCapture();
  170. typedef void (RENDERDOC_CC *pRENDERDOC_TriggerCapture)();
  171. extern "C" RENDERDOC_API void RENDERDOC_CC RENDERDOC_StartFrameCapture(void *wndHandle);
  172. typedef void (RENDERDOC_CC *pRENDERDOC_StartFrameCapture)(void *wndHandle);
  173. extern "C" RENDERDOC_API uint32_t RENDERDOC_CC RENDERDOC_EndFrameCapture(void *wndHandle);
  174. typedef uint32_t (RENDERDOC_CC *pRENDERDOC_EndFrameCapture)(void *wndHandle);
  175. extern "C" RENDERDOC_API uint32_t RENDERDOC_CC RENDERDOC_GetOverlayBits();
  176. typedef uint32_t (RENDERDOC_CC *pRENDERDOC_GetOverlayBits)();
  177. extern "C" RENDERDOC_API void RENDERDOC_CC RENDERDOC_MaskOverlayBits(uint32_t And, uint32_t Or);
  178. typedef void (RENDERDOC_CC *pRENDERDOC_MaskOverlayBits)(uint32_t And, uint32_t Or);
  179. extern "C" RENDERDOC_API void RENDERDOC_CC RENDERDOC_SetFocusToggleKeys(KeyButton *keys, int num);
  180. typedef void (RENDERDOC_CC *pRENDERDOC_SetFocusToggleKeys)(KeyButton *keys, int num);
  181. extern "C" RENDERDOC_API void RENDERDOC_CC RENDERDOC_SetCaptureKeys(KeyButton *keys, int num);
  182. typedef void (RENDERDOC_CC *pRENDERDOC_SetCaptureKeys)(KeyButton *keys, int num);
  183. extern "C" RENDERDOC_API void RENDERDOC_CC RENDERDOC_InitRemoteAccess(uint32_t *ident);
  184. typedef void (RENDERDOC_CC *pRENDERDOC_InitRemoteAccess)(uint32_t *ident);
  185. extern "C" RENDERDOC_API void RENDERDOC_CC RENDERDOC_UnloadCrashHandler();
  186. typedef void (RENDERDOC_CC *pRENDERDOC_UnloadCrashHandler)();