diff options
| author | 2023-09-16 11:39:50 -0400 | |
|---|---|---|
| committer | 2023-09-16 11:39:50 -0400 | |
| commit | 821037e18fd1e2989a259040cdd0a87ac8ccd6fe (patch) | |
| tree | 9976dc0e0b7ffa826f88c0e0864853190a366139 | |
| parent | Merge pull request #11508 from t895/audio-mute (diff) | |
| parent | debug: Add renderdoc capture hotkey (diff) | |
| download | yuzu-821037e18fd1e2989a259040cdd0a87ac8ccd6fe.tar.gz yuzu-821037e18fd1e2989a259040cdd0a87ac8ccd6fe.tar.xz yuzu-821037e18fd1e2989a259040cdd0a87ac8ccd6fe.zip | |
Merge pull request #11475 from GPUCode/renderdoc-hotkey
debug: Add renderdoc capture hotkey
Diffstat (limited to '')
| -rw-r--r-- | externals/CMakeLists.txt | 3 | ||||
| -rw-r--r-- | externals/renderdoc/renderdoc_app.h | 744 | ||||
| -rw-r--r-- | src/common/settings.h | 2 | ||||
| -rw-r--r-- | src/core/CMakeLists.txt | 5 | ||||
| -rw-r--r-- | src/core/core.cpp | 11 | ||||
| -rw-r--r-- | src/core/core.h | 6 | ||||
| -rw-r--r-- | src/core/tools/renderdoc.cpp | 55 | ||||
| -rw-r--r-- | src/core/tools/renderdoc.h | 22 | ||||
| -rw-r--r-- | src/yuzu/configuration/configure_debug.cpp | 3 | ||||
| -rw-r--r-- | src/yuzu/configuration/configure_debug.ui | 99 | ||||
| -rw-r--r-- | src/yuzu/hotkeys.h | 4 | ||||
| -rw-r--r-- | src/yuzu/main.cpp | 6 |
12 files changed, 912 insertions, 48 deletions
diff --git a/externals/CMakeLists.txt b/externals/CMakeLists.txt index 82a6da9fd..a4c2ffc10 100644 --- a/externals/CMakeLists.txt +++ b/externals/CMakeLists.txt | |||
| @@ -174,6 +174,9 @@ target_include_directories(stb PUBLIC ./stb) | |||
| 174 | add_library(bc_decoder bc_decoder/bc_decoder.cpp) | 174 | add_library(bc_decoder bc_decoder/bc_decoder.cpp) |
| 175 | target_include_directories(bc_decoder PUBLIC ./bc_decoder) | 175 | target_include_directories(bc_decoder PUBLIC ./bc_decoder) |
| 176 | 176 | ||
| 177 | add_library(renderdoc INTERFACE) | ||
| 178 | target_include_directories(renderdoc SYSTEM INTERFACE ./renderdoc) | ||
| 179 | |||
| 177 | if (ANDROID) | 180 | if (ANDROID) |
| 178 | if (ARCHITECTURE_arm64) | 181 | if (ARCHITECTURE_arm64) |
| 179 | add_subdirectory(libadrenotools) | 182 | add_subdirectory(libadrenotools) |
diff --git a/externals/renderdoc/renderdoc_app.h b/externals/renderdoc/renderdoc_app.h new file mode 100644 index 000000000..0f4a1f98b --- /dev/null +++ b/externals/renderdoc/renderdoc_app.h | |||
| @@ -0,0 +1,744 @@ | |||
| 1 | // SPDX-FileCopyrightText: Baldur Karlsson | ||
| 2 | // SPDX-License-Identifier: MIT | ||
| 3 | |||
| 4 | /****************************************************************************** | ||
| 5 | * The MIT License (MIT) | ||
| 6 | * | ||
| 7 | * Copyright (c) 2019-2023 Baldur Karlsson | ||
| 8 | * | ||
| 9 | * Permission is hereby granted, free of charge, to any person obtaining a copy | ||
| 10 | * of this software and associated documentation files (the "Software"), to deal | ||
| 11 | * in the Software without restriction, including without limitation the rights | ||
| 12 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
| 13 | * copies of the Software, and to permit persons to whom the Software is | ||
| 14 | * furnished to do so, subject to the following conditions: | ||
| 15 | * | ||
| 16 | * The above copyright notice and this permission notice shall be included in | ||
| 17 | * all copies or substantial portions of the Software. | ||
| 18 | * | ||
| 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
| 22 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
| 23 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
| 24 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
| 25 | * THE SOFTWARE. | ||
| 26 | ******************************************************************************/ | ||
| 27 | |||
| 28 | #pragma once | ||
| 29 | |||
| 30 | ////////////////////////////////////////////////////////////////////////////////////////////////// | ||
| 31 | // | ||
| 32 | // Documentation for the API is available at https://renderdoc.org/docs/in_application_api.html | ||
| 33 | // | ||
| 34 | |||
| 35 | #if !defined(RENDERDOC_NO_STDINT) | ||
| 36 | #include <stdint.h> | ||
| 37 | #endif | ||
| 38 | |||
| 39 | #if defined(WIN32) || defined(__WIN32__) || defined(_WIN32) || defined(_MSC_VER) | ||
| 40 | #define RENDERDOC_CC __cdecl | ||
| 41 | #elif defined(__linux__) | ||
| 42 | #define RENDERDOC_CC | ||
| 43 | #elif defined(__APPLE__) | ||
| 44 | #define RENDERDOC_CC | ||
| 45 | #else | ||
| 46 | #error "Unknown platform" | ||
| 47 | #endif | ||
| 48 | |||
| 49 | #ifdef __cplusplus | ||
| 50 | extern "C" { | ||
| 51 | #endif | ||
| 52 | |||
| 53 | ////////////////////////////////////////////////////////////////////////////////////////////////// | ||
| 54 | // Constants not used directly in below API | ||
| 55 | |||
| 56 | // This is a GUID/magic value used for when applications pass a path where shader debug | ||
| 57 | // information can be found to match up with a stripped shader. | ||
| 58 | // the define can be used like so: const GUID RENDERDOC_ShaderDebugMagicValue = | ||
| 59 | // RENDERDOC_ShaderDebugMagicValue_value | ||
| 60 | #define RENDERDOC_ShaderDebugMagicValue_struct \ | ||
| 61 | { \ | ||
| 62 | 0xeab25520, 0x6670, 0x4865, 0x84, 0x29, 0x6c, 0x8, 0x51, 0x54, 0x00, 0xff \ | ||
| 63 | } | ||
| 64 | |||
| 65 | // as an alternative when you want a byte array (assuming x86 endianness): | ||
| 66 | #define RENDERDOC_ShaderDebugMagicValue_bytearray \ | ||
| 67 | { \ | ||
| 68 | 0x20, 0x55, 0xb2, 0xea, 0x70, 0x66, 0x65, 0x48, 0x84, 0x29, 0x6c, 0x8, 0x51, 0x54, 0x00, 0xff \ | ||
| 69 | } | ||
| 70 | |||
| 71 | // truncated version when only a uint64_t is available (e.g. Vulkan tags): | ||
| 72 | #define RENDERDOC_ShaderDebugMagicValue_truncated 0x48656670eab25520ULL | ||
| 73 | |||
| 74 | ////////////////////////////////////////////////////////////////////////////////////////////////// | ||
| 75 | // RenderDoc capture options | ||
| 76 | // | ||
| 77 | |||
| 78 | typedef enum RENDERDOC_CaptureOption | ||
| 79 | { | ||
| 80 | // Allow the application to enable vsync | ||
| 81 | // | ||
| 82 | // Default - enabled | ||
| 83 | // | ||
| 84 | // 1 - The application can enable or disable vsync at will | ||
| 85 | // 0 - vsync is force disabled | ||
| 86 | eRENDERDOC_Option_AllowVSync = 0, | ||
| 87 | |||
| 88 | // Allow the application to enable fullscreen | ||
| 89 | // | ||
| 90 | // Default - enabled | ||
| 91 | // | ||
| 92 | // 1 - The application can enable or disable fullscreen at will | ||
| 93 | // 0 - fullscreen is force disabled | ||
| 94 | eRENDERDOC_Option_AllowFullscreen = 1, | ||
| 95 | |||
| 96 | // Record API debugging events and messages | ||
| 97 | // | ||
| 98 | // Default - disabled | ||
| 99 | // | ||
| 100 | // 1 - Enable built-in API debugging features and records the results into | ||
| 101 | // the capture, which is matched up with events on replay | ||
| 102 | // 0 - no API debugging is forcibly enabled | ||
| 103 | eRENDERDOC_Option_APIValidation = 2, | ||
| 104 | eRENDERDOC_Option_DebugDeviceMode = 2, // deprecated name of this enum | ||
| 105 | |||
| 106 | // Capture CPU callstacks for API events | ||
| 107 | // | ||
| 108 | // Default - disabled | ||
| 109 | // | ||
| 110 | // 1 - Enables capturing of callstacks | ||
| 111 | // 0 - no callstacks are captured | ||
| 112 | eRENDERDOC_Option_CaptureCallstacks = 3, | ||
| 113 | |||
| 114 | // When capturing CPU callstacks, only capture them from actions. | ||
| 115 | // This option does nothing without the above option being enabled | ||
| 116 | // | ||
| 117 | // Default - disabled | ||
| 118 | // | ||
| 119 | // 1 - Only captures callstacks for actions. | ||
| 120 | // Ignored if CaptureCallstacks is disabled | ||
| 121 | // 0 - Callstacks, if enabled, are captured for every event. | ||
| 122 | eRENDERDOC_Option_CaptureCallstacksOnlyDraws = 4, | ||
| 123 | eRENDERDOC_Option_CaptureCallstacksOnlyActions = 4, | ||
| 124 | |||
| 125 | // Specify a delay in seconds to wait for a debugger to attach, after | ||
| 126 | // creating or injecting into a process, before continuing to allow it to run. | ||
| 127 | // | ||
| 128 | // 0 indicates no delay, and the process will run immediately after injection | ||
| 129 | // | ||
| 130 | // Default - 0 seconds | ||
| 131 | // | ||
| 132 | eRENDERDOC_Option_DelayForDebugger = 5, | ||
| 133 | |||
| 134 | // Verify buffer access. This includes checking the memory returned by a Map() call to | ||
| 135 | // detect any out-of-bounds modification, as well as initialising buffers with undefined contents | ||
| 136 | // to a marker value to catch use of uninitialised memory. | ||
| 137 | // | ||
| 138 | // NOTE: This option is only valid for OpenGL and D3D11. Explicit APIs such as D3D12 and Vulkan do | ||
| 139 | // not do the same kind of interception & checking and undefined contents are really undefined. | ||
| 140 | // | ||
| 141 | // Default - disabled | ||
| 142 | // | ||
| 143 | // 1 - Verify buffer access | ||
| 144 | // 0 - No verification is performed, and overwriting bounds may cause crashes or corruption in | ||
| 145 | // RenderDoc. | ||
| 146 | eRENDERDOC_Option_VerifyBufferAccess = 6, | ||
| 147 | |||
| 148 | // The old name for eRENDERDOC_Option_VerifyBufferAccess was eRENDERDOC_Option_VerifyMapWrites. | ||
| 149 | // This option now controls the filling of uninitialised buffers with 0xdddddddd which was | ||
| 150 | // previously always enabled | ||
| 151 | eRENDERDOC_Option_VerifyMapWrites = eRENDERDOC_Option_VerifyBufferAccess, | ||
| 152 | |||
| 153 | // Hooks any system API calls that create child processes, and injects | ||
| 154 | // RenderDoc into them recursively with the same options. | ||
| 155 | // | ||
| 156 | // Default - disabled | ||
| 157 | // | ||
| 158 | // 1 - Hooks into spawned child processes | ||
| 159 | // 0 - Child processes are not hooked by RenderDoc | ||
| 160 | eRENDERDOC_Option_HookIntoChildren = 7, | ||
| 161 | |||
| 162 | // By default RenderDoc only includes resources in the final capture necessary | ||
| 163 | // for that frame, this allows you to override that behaviour. | ||
| 164 | // | ||
| 165 | // Default - disabled | ||
| 166 | // | ||
| 167 | // 1 - all live resources at the time of capture are included in the capture | ||
| 168 | // and available for inspection | ||
| 169 | // 0 - only the resources referenced by the captured frame are included | ||
| 170 | eRENDERDOC_Option_RefAllResources = 8, | ||
| 171 | |||
| 172 | // **NOTE**: As of RenderDoc v1.1 this option has been deprecated. Setting or | ||
| 173 | // getting it will be ignored, to allow compatibility with older versions. | ||
| 174 | // In v1.1 the option acts as if it's always enabled. | ||
| 175 | // | ||
| 176 | // By default RenderDoc skips saving initial states for resources where the | ||
| 177 | // previous contents don't appear to be used, assuming that writes before | ||
| 178 | // reads indicate previous contents aren't used. | ||
| 179 | // | ||
| 180 | // Default - disabled | ||
| 181 | // | ||
| 182 | // 1 - initial contents at the start of each captured frame are saved, even if | ||
| 183 | // they are later overwritten or cleared before being used. | ||
| 184 | // 0 - unless a read is detected, initial contents will not be saved and will | ||
| 185 | // appear as black or empty data. | ||
| 186 | eRENDERDOC_Option_SaveAllInitials = 9, | ||
| 187 | |||
| 188 | // In APIs that allow for the recording of command lists to be replayed later, | ||
| 189 | // RenderDoc may choose to not capture command lists before a frame capture is | ||
| 190 | // triggered, to reduce overheads. This means any command lists recorded once | ||
| 191 | // and replayed many times will not be available and may cause a failure to | ||
| 192 | // capture. | ||
| 193 | // | ||
| 194 | // NOTE: This is only true for APIs where multithreading is difficult or | ||
| 195 | // discouraged. Newer APIs like Vulkan and D3D12 will ignore this option | ||
| 196 | // and always capture all command lists since the API is heavily oriented | ||
| 197 | // around it and the overheads have been reduced by API design. | ||
| 198 | // | ||
| 199 | // 1 - All command lists are captured from the start of the application | ||
| 200 | // 0 - Command lists are only captured if their recording begins during | ||
| 201 | // the period when a frame capture is in progress. | ||
| 202 | eRENDERDOC_Option_CaptureAllCmdLists = 10, | ||
| 203 | |||
| 204 | // Mute API debugging output when the API validation mode option is enabled | ||
| 205 | // | ||
| 206 | // Default - enabled | ||
| 207 | // | ||
| 208 | // 1 - Mute any API debug messages from being displayed or passed through | ||
| 209 | // 0 - API debugging is displayed as normal | ||
| 210 | eRENDERDOC_Option_DebugOutputMute = 11, | ||
| 211 | |||
| 212 | // Option to allow vendor extensions to be used even when they may be | ||
| 213 | // incompatible with RenderDoc and cause corrupted replays or crashes. | ||
| 214 | // | ||
| 215 | // Default - inactive | ||
| 216 | // | ||
| 217 | // No values are documented, this option should only be used when absolutely | ||
| 218 | // necessary as directed by a RenderDoc developer. | ||
| 219 | eRENDERDOC_Option_AllowUnsupportedVendorExtensions = 12, | ||
| 220 | |||
| 221 | // Define a soft memory limit which some APIs may aim to keep overhead under where | ||
| 222 | // possible. Anything above this limit will where possible be saved directly to disk during | ||
| 223 | // capture. | ||
| 224 | // This will cause increased disk space use (which may cause a capture to fail if disk space is | ||
| 225 | // exhausted) as well as slower capture times. | ||
| 226 | // | ||
| 227 | // Not all memory allocations may be deferred like this so it is not a guarantee of a memory | ||
| 228 | // limit. | ||
| 229 | // | ||
| 230 | // Units are in MBs, suggested values would range from 200MB to 1000MB. | ||
| 231 | // | ||
| 232 | // Default - 0 Megabytes | ||
| 233 | eRENDERDOC_Option_SoftMemoryLimit = 13, | ||
| 234 | } RENDERDOC_CaptureOption; | ||
| 235 | |||
| 236 | // Sets an option that controls how RenderDoc behaves on capture. | ||
| 237 | // | ||
| 238 | // Returns 1 if the option and value are valid | ||
| 239 | // Returns 0 if either is invalid and the option is unchanged | ||
| 240 | typedef int(RENDERDOC_CC *pRENDERDOC_SetCaptureOptionU32)(RENDERDOC_CaptureOption opt, uint32_t val); | ||
| 241 | typedef int(RENDERDOC_CC *pRENDERDOC_SetCaptureOptionF32)(RENDERDOC_CaptureOption opt, float val); | ||
| 242 | |||
| 243 | // Gets the current value of an option as a uint32_t | ||
| 244 | // | ||
| 245 | // If the option is invalid, 0xffffffff is returned | ||
| 246 | typedef uint32_t(RENDERDOC_CC *pRENDERDOC_GetCaptureOptionU32)(RENDERDOC_CaptureOption opt); | ||
| 247 | |||
| 248 | // Gets the current value of an option as a float | ||
| 249 | // | ||
| 250 | // If the option is invalid, -FLT_MAX is returned | ||
| 251 | typedef float(RENDERDOC_CC *pRENDERDOC_GetCaptureOptionF32)(RENDERDOC_CaptureOption opt); | ||
| 252 | |||
| 253 | typedef enum RENDERDOC_InputButton | ||
| 254 | { | ||
| 255 | // '0' - '9' matches ASCII values | ||
| 256 | eRENDERDOC_Key_0 = 0x30, | ||
| 257 | eRENDERDOC_Key_1 = 0x31, | ||
| 258 | eRENDERDOC_Key_2 = 0x32, | ||
| 259 | eRENDERDOC_Key_3 = 0x33, | ||
| 260 | eRENDERDOC_Key_4 = 0x34, | ||
| 261 | eRENDERDOC_Key_5 = 0x35, | ||
| 262 | eRENDERDOC_Key_6 = 0x36, | ||
| 263 | eRENDERDOC_Key_7 = 0x37, | ||
| 264 | eRENDERDOC_Key_8 = 0x38, | ||
| 265 | eRENDERDOC_Key_9 = 0x39, | ||
| 266 | |||
| 267 | // 'A' - 'Z' matches ASCII values | ||
| 268 | eRENDERDOC_Key_A = 0x41, | ||
| 269 | eRENDERDOC_Key_B = 0x42, | ||
| 270 | eRENDERDOC_Key_C = 0x43, | ||
| 271 | eRENDERDOC_Key_D = 0x44, | ||
| 272 | eRENDERDOC_Key_E = 0x45, | ||
| 273 | eRENDERDOC_Key_F = 0x46, | ||
| 274 | eRENDERDOC_Key_G = 0x47, | ||
| 275 | eRENDERDOC_Key_H = 0x48, | ||
| 276 | eRENDERDOC_Key_I = 0x49, | ||
| 277 | eRENDERDOC_Key_J = 0x4A, | ||
| 278 | eRENDERDOC_Key_K = 0x4B, | ||
| 279 | eRENDERDOC_Key_L = 0x4C, | ||
| 280 | eRENDERDOC_Key_M = 0x4D, | ||
| 281 | eRENDERDOC_Key_N = 0x4E, | ||
| 282 | eRENDERDOC_Key_O = 0x4F, | ||
| 283 | eRENDERDOC_Key_P = 0x50, | ||
| 284 | eRENDERDOC_Key_Q = 0x51, | ||
| 285 | eRENDERDOC_Key_R = 0x52, | ||
| 286 | eRENDERDOC_Key_S = 0x53, | ||
| 287 | eRENDERDOC_Key_T = 0x54, | ||
| 288 | eRENDERDOC_Key_U = 0x55, | ||
| 289 | eRENDERDOC_Key_V = 0x56, | ||
| 290 | eRENDERDOC_Key_W = 0x57, | ||
| 291 | eRENDERDOC_Key_X = 0x58, | ||
| 292 | eRENDERDOC_Key_Y = 0x59, | ||
| 293 | eRENDERDOC_Key_Z = 0x5A, | ||
| 294 | |||
| 295 | // leave the rest of the ASCII range free | ||
| 296 | // in case we want to use it later | ||
| 297 | eRENDERDOC_Key_NonPrintable = 0x100, | ||
| 298 | |||
| 299 | eRENDERDOC_Key_Divide, | ||
| 300 | eRENDERDOC_Key_Multiply, | ||
| 301 | eRENDERDOC_Key_Subtract, | ||
| 302 | eRENDERDOC_Key_Plus, | ||
| 303 | |||
| 304 | eRENDERDOC_Key_F1, | ||
| 305 | eRENDERDOC_Key_F2, | ||
| 306 | eRENDERDOC_Key_F3, | ||
| 307 | eRENDERDOC_Key_F4, | ||
| 308 | eRENDERDOC_Key_F5, | ||
| 309 | eRENDERDOC_Key_F6, | ||
| 310 | eRENDERDOC_Key_F7, | ||
| 311 | eRENDERDOC_Key_F8, | ||
| 312 | eRENDERDOC_Key_F9, | ||
| 313 | eRENDERDOC_Key_F10, | ||
| 314 | eRENDERDOC_Key_F11, | ||
| 315 | eRENDERDOC_Key_F12, | ||
| 316 | |||
| 317 | eRENDERDOC_Key_Home, | ||
| 318 | eRENDERDOC_Key_End, | ||
| 319 | eRENDERDOC_Key_Insert, | ||
| 320 | eRENDERDOC_Key_Delete, | ||
| 321 | eRENDERDOC_Key_PageUp, | ||
| 322 | eRENDERDOC_Key_PageDn, | ||
| 323 | |||
| 324 | eRENDERDOC_Key_Backspace, | ||
| 325 | eRENDERDOC_Key_Tab, | ||
| 326 | eRENDERDOC_Key_PrtScrn, | ||
| 327 | eRENDERDOC_Key_Pause, | ||
| 328 | |||
| 329 | eRENDERDOC_Key_Max, | ||
| 330 | } RENDERDOC_InputButton; | ||
| 331 | |||
| 332 | // Sets which key or keys can be used to toggle focus between multiple windows | ||
| 333 | // | ||
| 334 | // If keys is NULL or num is 0, toggle keys will be disabled | ||
| 335 | typedef void(RENDERDOC_CC *pRENDERDOC_SetFocusToggleKeys)(RENDERDOC_InputButton *keys, int num); | ||
| 336 | |||
| 337 | // Sets which key or keys can be used to capture the next frame | ||
| 338 | // | ||
| 339 | // If keys is NULL or num is 0, captures keys will be disabled | ||
| 340 | typedef void(RENDERDOC_CC *pRENDERDOC_SetCaptureKeys)(RENDERDOC_InputButton *keys, int num); | ||
| 341 | |||
| 342 | typedef enum RENDERDOC_OverlayBits | ||
| 343 | { | ||
| 344 | // This single bit controls whether the overlay is enabled or disabled globally | ||
| 345 | eRENDERDOC_Overlay_Enabled = 0x1, | ||
| 346 | |||
| 347 | // Show the average framerate over several seconds as well as min/max | ||
| 348 | eRENDERDOC_Overlay_FrameRate = 0x2, | ||
| 349 | |||
| 350 | // Show the current frame number | ||
| 351 | eRENDERDOC_Overlay_FrameNumber = 0x4, | ||
| 352 | |||
| 353 | // Show a list of recent captures, and how many captures have been made | ||
| 354 | eRENDERDOC_Overlay_CaptureList = 0x8, | ||
| 355 | |||
| 356 | // Default values for the overlay mask | ||
| 357 | eRENDERDOC_Overlay_Default = (eRENDERDOC_Overlay_Enabled | eRENDERDOC_Overlay_FrameRate | | ||
| 358 | eRENDERDOC_Overlay_FrameNumber | eRENDERDOC_Overlay_CaptureList), | ||
| 359 | |||
| 360 | // Enable all bits | ||
| 361 | eRENDERDOC_Overlay_All = ~0U, | ||
| 362 | |||
| 363 | // Disable all bits | ||
| 364 | eRENDERDOC_Overlay_None = 0, | ||
| 365 | } RENDERDOC_OverlayBits; | ||
| 366 | |||
| 367 | // returns the overlay bits that have been set | ||
| 368 | typedef uint32_t(RENDERDOC_CC *pRENDERDOC_GetOverlayBits)(); | ||
| 369 | // sets the overlay bits with an and & or mask | ||
| 370 | typedef void(RENDERDOC_CC *pRENDERDOC_MaskOverlayBits)(uint32_t And, uint32_t Or); | ||
| 371 | |||
| 372 | // this function will attempt to remove RenderDoc's hooks in the application. | ||
| 373 | // | ||
| 374 | // Note: that this can only work correctly if done immediately after | ||
| 375 | // the module is loaded, before any API work happens. RenderDoc will remove its | ||
| 376 | // injected hooks and shut down. Behaviour is undefined if this is called | ||
| 377 | // after any API functions have been called, and there is still no guarantee of | ||
| 378 | // success. | ||
| 379 | typedef void(RENDERDOC_CC *pRENDERDOC_RemoveHooks)(); | ||
| 380 | |||
| 381 | // DEPRECATED: compatibility for code compiled against pre-1.4.1 headers. | ||
| 382 | typedef pRENDERDOC_RemoveHooks pRENDERDOC_Shutdown; | ||
| 383 | |||
| 384 | // This function will unload RenderDoc's crash handler. | ||
| 385 | // | ||
| 386 | // If you use your own crash handler and don't want RenderDoc's handler to | ||
| 387 | // intercede, you can call this function to unload it and any unhandled | ||
| 388 | // exceptions will pass to the next handler. | ||
| 389 | typedef void(RENDERDOC_CC *pRENDERDOC_UnloadCrashHandler)(); | ||
| 390 | |||
| 391 | // Sets the capture file path template | ||
| 392 | // | ||
| 393 | // pathtemplate is a UTF-8 string that gives a template for how captures will be named | ||
| 394 | // and where they will be saved. | ||
| 395 | // | ||
| 396 | // Any extension is stripped off the path, and captures are saved in the directory | ||
| 397 | // specified, and named with the filename and the frame number appended. If the | ||
| 398 | // directory does not exist it will be created, including any parent directories. | ||
| 399 | // | ||
| 400 | // If pathtemplate is NULL, the template will remain unchanged | ||
| 401 | // | ||
| 402 | // Example: | ||
| 403 | // | ||
| 404 | // SetCaptureFilePathTemplate("my_captures/example"); | ||
| 405 | // | ||
| 406 | // Capture #1 -> my_captures/example_frame123.rdc | ||
| 407 | // Capture #2 -> my_captures/example_frame456.rdc | ||
| 408 | typedef void(RENDERDOC_CC *pRENDERDOC_SetCaptureFilePathTemplate)(const char *pathtemplate); | ||
| 409 | |||
| 410 | // returns the current capture path template, see SetCaptureFileTemplate above, as a UTF-8 string | ||
| 411 | typedef const char *(RENDERDOC_CC *pRENDERDOC_GetCaptureFilePathTemplate)(); | ||
| 412 | |||
| 413 | // DEPRECATED: compatibility for code compiled against pre-1.1.2 headers. | ||
| 414 | typedef pRENDERDOC_SetCaptureFilePathTemplate pRENDERDOC_SetLogFilePathTemplate; | ||
| 415 | typedef pRENDERDOC_GetCaptureFilePathTemplate pRENDERDOC_GetLogFilePathTemplate; | ||
| 416 | |||
| 417 | // returns the number of captures that have been made | ||
| 418 | typedef uint32_t(RENDERDOC_CC *pRENDERDOC_GetNumCaptures)(); | ||
| 419 | |||
| 420 | // This function returns the details of a capture, by index. New captures are added | ||
| 421 | // to the end of the list. | ||
| 422 | // | ||
| 423 | // filename will be filled with the absolute path to the capture file, as a UTF-8 string | ||
| 424 | // pathlength will be written with the length in bytes of the filename string | ||
| 425 | // timestamp will be written with the time of the capture, in seconds since the Unix epoch | ||
| 426 | // | ||
| 427 | // Any of the parameters can be NULL and they'll be skipped. | ||
| 428 | // | ||
| 429 | // The function will return 1 if the capture index is valid, or 0 if the index is invalid | ||
| 430 | // If the index is invalid, the values will be unchanged | ||
| 431 | // | ||
| 432 | // Note: when captures are deleted in the UI they will remain in this list, so the | ||
| 433 | // capture path may not exist anymore. | ||
| 434 | typedef uint32_t(RENDERDOC_CC *pRENDERDOC_GetCapture)(uint32_t idx, char *filename, | ||
| 435 | uint32_t *pathlength, uint64_t *timestamp); | ||
| 436 | |||
| 437 | // Sets the comments associated with a capture file. These comments are displayed in the | ||
| 438 | // UI program when opening. | ||
| 439 | // | ||
| 440 | // filePath should be a path to the capture file to add comments to. If set to NULL or "" | ||
| 441 | // the most recent capture file created made will be used instead. | ||
| 442 | // comments should be a NULL-terminated UTF-8 string to add as comments. | ||
| 443 | // | ||
| 444 | // Any existing comments will be overwritten. | ||
| 445 | typedef void(RENDERDOC_CC *pRENDERDOC_SetCaptureFileComments)(const char *filePath, | ||
| 446 | const char *comments); | ||
| 447 | |||
| 448 | // returns 1 if the RenderDoc UI is connected to this application, 0 otherwise | ||
| 449 | typedef uint32_t(RENDERDOC_CC *pRENDERDOC_IsTargetControlConnected)(); | ||
| 450 | |||
| 451 | // DEPRECATED: compatibility for code compiled against pre-1.1.1 headers. | ||
| 452 | // This was renamed to IsTargetControlConnected in API 1.1.1, the old typedef is kept here for | ||
| 453 | // backwards compatibility with old code, it is castable either way since it's ABI compatible | ||
| 454 | // as the same function pointer type. | ||
| 455 | typedef pRENDERDOC_IsTargetControlConnected pRENDERDOC_IsRemoteAccessConnected; | ||
| 456 | |||
| 457 | // This function will launch the Replay UI associated with the RenderDoc library injected | ||
| 458 | // into the running application. | ||
| 459 | // | ||
| 460 | // if connectTargetControl is 1, the Replay UI will be launched with a command line parameter | ||
| 461 | // to connect to this application | ||
| 462 | // cmdline is the rest of the command line, as a UTF-8 string. E.g. a captures to open | ||
| 463 | // if cmdline is NULL, the command line will be empty. | ||
| 464 | // | ||
| 465 | // returns the PID of the replay UI if successful, 0 if not successful. | ||
| 466 | typedef uint32_t(RENDERDOC_CC *pRENDERDOC_LaunchReplayUI)(uint32_t connectTargetControl, | ||
| 467 | const char *cmdline); | ||
| 468 | |||
| 469 | // RenderDoc can return a higher version than requested if it's backwards compatible, | ||
| 470 | // this function returns the actual version returned. If a parameter is NULL, it will be | ||
| 471 | // ignored and the others will be filled out. | ||
| 472 | typedef void(RENDERDOC_CC *pRENDERDOC_GetAPIVersion)(int *major, int *minor, int *patch); | ||
| 473 | |||
| 474 | // Requests that the replay UI show itself (if hidden or not the current top window). This can be | ||
| 475 | // used in conjunction with IsTargetControlConnected and LaunchReplayUI to intelligently handle | ||
| 476 | // showing the UI after making a capture. | ||
| 477 | // | ||
| 478 | // This will return 1 if the request was successfully passed on, though it's not guaranteed that | ||
| 479 | // the UI will be on top in all cases depending on OS rules. It will return 0 if there is no current | ||
| 480 | // target control connection to make such a request, or if there was another error | ||
| 481 | typedef uint32_t(RENDERDOC_CC *pRENDERDOC_ShowReplayUI)(); | ||
| 482 | |||
| 483 | ////////////////////////////////////////////////////////////////////////// | ||
| 484 | // Capturing functions | ||
| 485 | // | ||
| 486 | |||
| 487 | // A device pointer is a pointer to the API's root handle. | ||
| 488 | // | ||
| 489 | // This would be an ID3D11Device, HGLRC/GLXContext, ID3D12Device, etc | ||
| 490 | typedef void *RENDERDOC_DevicePointer; | ||
| 491 | |||
| 492 | // A window handle is the OS's native window handle | ||
| 493 | // | ||
| 494 | // This would be an HWND, GLXDrawable, etc | ||
| 495 | typedef void *RENDERDOC_WindowHandle; | ||
| 496 | |||
| 497 | // A helper macro for Vulkan, where the device handle cannot be used directly. | ||
| 498 | // | ||
| 499 | // Passing the VkInstance to this macro will return the RENDERDOC_DevicePointer to use. | ||
| 500 | // | ||
| 501 | // Specifically, the value needed is the dispatch table pointer, which sits as the first | ||
| 502 | // pointer-sized object in the memory pointed to by the VkInstance. Thus we cast to a void** and | ||
| 503 | // indirect once. | ||
| 504 | #define RENDERDOC_DEVICEPOINTER_FROM_VKINSTANCE(inst) (*((void **)(inst))) | ||
| 505 | |||
| 506 | // This sets the RenderDoc in-app overlay in the API/window pair as 'active' and it will | ||
| 507 | // respond to keypresses. Neither parameter can be NULL | ||
| 508 | typedef void(RENDERDOC_CC *pRENDERDOC_SetActiveWindow)(RENDERDOC_DevicePointer device, | ||
| 509 | RENDERDOC_WindowHandle wndHandle); | ||
| 510 | |||
| 511 | // capture the next frame on whichever window and API is currently considered active | ||
| 512 | typedef void(RENDERDOC_CC *pRENDERDOC_TriggerCapture)(); | ||
| 513 | |||
| 514 | // capture the next N frames on whichever window and API is currently considered active | ||
| 515 | typedef void(RENDERDOC_CC *pRENDERDOC_TriggerMultiFrameCapture)(uint32_t numFrames); | ||
| 516 | |||
| 517 | // When choosing either a device pointer or a window handle to capture, you can pass NULL. | ||
| 518 | // Passing NULL specifies a 'wildcard' match against anything. This allows you to specify | ||
| 519 | // any API rendering to a specific window, or a specific API instance rendering to any window, | ||
| 520 | // or in the simplest case of one window and one API, you can just pass NULL for both. | ||
| 521 | // | ||
| 522 | // In either case, if there are two or more possible matching (device,window) pairs it | ||
| 523 | // is undefined which one will be captured. | ||
| 524 | // | ||
| 525 | // Note: for headless rendering you can pass NULL for the window handle and either specify | ||
| 526 | // a device pointer or leave it NULL as above. | ||
| 527 | |||
| 528 | // Immediately starts capturing API calls on the specified device pointer and window handle. | ||
| 529 | // | ||
| 530 | // If there is no matching thing to capture (e.g. no supported API has been initialised), | ||
| 531 | // this will do nothing. | ||
| 532 | // | ||
| 533 | // The results are undefined (including crashes) if two captures are started overlapping, | ||
| 534 | // even on separate devices and/oror windows. | ||
| 535 | typedef void(RENDERDOC_CC *pRENDERDOC_StartFrameCapture)(RENDERDOC_DevicePointer device, | ||
| 536 | RENDERDOC_WindowHandle wndHandle); | ||
| 537 | |||
| 538 | // Returns whether or not a frame capture is currently ongoing anywhere. | ||
| 539 | // | ||
| 540 | // This will return 1 if a capture is ongoing, and 0 if there is no capture running | ||
| 541 | typedef uint32_t(RENDERDOC_CC *pRENDERDOC_IsFrameCapturing)(); | ||
| 542 | |||
| 543 | // Ends capturing immediately. | ||
| 544 | // | ||
| 545 | // This will return 1 if the capture succeeded, and 0 if there was an error capturing. | ||
| 546 | typedef uint32_t(RENDERDOC_CC *pRENDERDOC_EndFrameCapture)(RENDERDOC_DevicePointer device, | ||
| 547 | RENDERDOC_WindowHandle wndHandle); | ||
| 548 | |||
| 549 | // Ends capturing immediately and discard any data stored without saving to disk. | ||
| 550 | // | ||
| 551 | // This will return 1 if the capture was discarded, and 0 if there was an error or no capture | ||
| 552 | // was in progress | ||
| 553 | typedef uint32_t(RENDERDOC_CC *pRENDERDOC_DiscardFrameCapture)(RENDERDOC_DevicePointer device, | ||
| 554 | RENDERDOC_WindowHandle wndHandle); | ||
| 555 | |||
| 556 | // Only valid to be called between a call to StartFrameCapture and EndFrameCapture. Gives a custom | ||
| 557 | // title to the capture produced which will be displayed in the UI. | ||
| 558 | // | ||
| 559 | // If multiple captures are ongoing, this title will be applied to the first capture to end after | ||
| 560 | // this call. The second capture to end will have no title, unless this function is called again. | ||
| 561 | // | ||
| 562 | // Calling this function has no effect if no capture is currently running, and if it is called | ||
| 563 | // multiple times only the last title will be used. | ||
| 564 | typedef void(RENDERDOC_CC *pRENDERDOC_SetCaptureTitle)(const char *title); | ||
| 565 | |||
| 566 | ////////////////////////////////////////////////////////////////////////////////////////////////// | ||
| 567 | // RenderDoc API versions | ||
| 568 | // | ||
| 569 | |||
| 570 | // RenderDoc uses semantic versioning (http://semver.org/). | ||
| 571 | // | ||
| 572 | // MAJOR version is incremented when incompatible API changes happen. | ||
| 573 | // MINOR version is incremented when functionality is added in a backwards-compatible manner. | ||
| 574 | // PATCH version is incremented when backwards-compatible bug fixes happen. | ||
| 575 | // | ||
| 576 | // Note that this means the API returned can be higher than the one you might have requested. | ||
| 577 | // e.g. if you are running against a newer RenderDoc that supports 1.0.1, it will be returned | ||
| 578 | // instead of 1.0.0. You can check this with the GetAPIVersion entry point | ||
| 579 | typedef enum RENDERDOC_Version | ||
| 580 | { | ||
| 581 | eRENDERDOC_API_Version_1_0_0 = 10000, // RENDERDOC_API_1_0_0 = 1 00 00 | ||
| 582 | eRENDERDOC_API_Version_1_0_1 = 10001, // RENDERDOC_API_1_0_1 = 1 00 01 | ||
| 583 | eRENDERDOC_API_Version_1_0_2 = 10002, // RENDERDOC_API_1_0_2 = 1 00 02 | ||
| 584 | eRENDERDOC_API_Version_1_1_0 = 10100, // RENDERDOC_API_1_1_0 = 1 01 00 | ||
| 585 | eRENDERDOC_API_Version_1_1_1 = 10101, // RENDERDOC_API_1_1_1 = 1 01 01 | ||
| 586 | eRENDERDOC_API_Version_1_1_2 = 10102, // RENDERDOC_API_1_1_2 = 1 01 02 | ||
| 587 | eRENDERDOC_API_Version_1_2_0 = 10200, // RENDERDOC_API_1_2_0 = 1 02 00 | ||
| 588 | eRENDERDOC_API_Version_1_3_0 = 10300, // RENDERDOC_API_1_3_0 = 1 03 00 | ||
| 589 | eRENDERDOC_API_Version_1_4_0 = 10400, // RENDERDOC_API_1_4_0 = 1 04 00 | ||
| 590 | eRENDERDOC_API_Version_1_4_1 = 10401, // RENDERDOC_API_1_4_1 = 1 04 01 | ||
| 591 | eRENDERDOC_API_Version_1_4_2 = 10402, // RENDERDOC_API_1_4_2 = 1 04 02 | ||
| 592 | eRENDERDOC_API_Version_1_5_0 = 10500, // RENDERDOC_API_1_5_0 = 1 05 00 | ||
| 593 | eRENDERDOC_API_Version_1_6_0 = 10600, // RENDERDOC_API_1_6_0 = 1 06 00 | ||
| 594 | } RENDERDOC_Version; | ||
| 595 | |||
| 596 | // API version changelog: | ||
| 597 | // | ||
| 598 | // 1.0.0 - initial release | ||
| 599 | // 1.0.1 - Bugfix: IsFrameCapturing() was returning false for captures that were triggered | ||
| 600 | // by keypress or TriggerCapture, instead of Start/EndFrameCapture. | ||
| 601 | // 1.0.2 - Refactor: Renamed eRENDERDOC_Option_DebugDeviceMode to eRENDERDOC_Option_APIValidation | ||
| 602 | // 1.1.0 - Add feature: TriggerMultiFrameCapture(). Backwards compatible with 1.0.x since the new | ||
| 603 | // function pointer is added to the end of the struct, the original layout is identical | ||
| 604 | // 1.1.1 - Refactor: Renamed remote access to target control (to better disambiguate from remote | ||
| 605 | // replay/remote server concept in replay UI) | ||
| 606 | // 1.1.2 - Refactor: Renamed "log file" in function names to just capture, to clarify that these | ||
| 607 | // are captures and not debug logging files. This is the first API version in the v1.0 | ||
| 608 | // branch. | ||
| 609 | // 1.2.0 - Added feature: SetCaptureFileComments() to add comments to a capture file that will be | ||
| 610 | // displayed in the UI program on load. | ||
| 611 | // 1.3.0 - Added feature: New capture option eRENDERDOC_Option_AllowUnsupportedVendorExtensions | ||
| 612 | // which allows users to opt-in to allowing unsupported vendor extensions to function. | ||
| 613 | // Should be used at the user's own risk. | ||
| 614 | // Refactor: Renamed eRENDERDOC_Option_VerifyMapWrites to | ||
| 615 | // eRENDERDOC_Option_VerifyBufferAccess, which now also controls initialisation to | ||
| 616 | // 0xdddddddd of uninitialised buffer contents. | ||
| 617 | // 1.4.0 - Added feature: DiscardFrameCapture() to discard a frame capture in progress and stop | ||
| 618 | // capturing without saving anything to disk. | ||
| 619 | // 1.4.1 - Refactor: Renamed Shutdown to RemoveHooks to better clarify what is happening | ||
| 620 | // 1.4.2 - Refactor: Renamed 'draws' to 'actions' in callstack capture option. | ||
| 621 | // 1.5.0 - Added feature: ShowReplayUI() to request that the replay UI show itself if connected | ||
| 622 | // 1.6.0 - Added feature: SetCaptureTitle() which can be used to set a title for a | ||
| 623 | // capture made with StartFrameCapture() or EndFrameCapture() | ||
| 624 | |||
| 625 | typedef struct RENDERDOC_API_1_6_0 | ||
| 626 | { | ||
| 627 | pRENDERDOC_GetAPIVersion GetAPIVersion; | ||
| 628 | |||
| 629 | pRENDERDOC_SetCaptureOptionU32 SetCaptureOptionU32; | ||
| 630 | pRENDERDOC_SetCaptureOptionF32 SetCaptureOptionF32; | ||
| 631 | |||
| 632 | pRENDERDOC_GetCaptureOptionU32 GetCaptureOptionU32; | ||
| 633 | pRENDERDOC_GetCaptureOptionF32 GetCaptureOptionF32; | ||
| 634 | |||
| 635 | pRENDERDOC_SetFocusToggleKeys SetFocusToggleKeys; | ||
| 636 | pRENDERDOC_SetCaptureKeys SetCaptureKeys; | ||
| 637 | |||
| 638 | pRENDERDOC_GetOverlayBits GetOverlayBits; | ||
| 639 | pRENDERDOC_MaskOverlayBits MaskOverlayBits; | ||
| 640 | |||
| 641 | // Shutdown was renamed to RemoveHooks in 1.4.1. | ||
| 642 | // These unions allow old code to continue compiling without changes | ||
| 643 | union | ||
| 644 | { | ||
| 645 | pRENDERDOC_Shutdown Shutdown; | ||
| 646 | pRENDERDOC_RemoveHooks RemoveHooks; | ||
| 647 | }; | ||
| 648 | pRENDERDOC_UnloadCrashHandler UnloadCrashHandler; | ||
| 649 | |||
| 650 | // Get/SetLogFilePathTemplate was renamed to Get/SetCaptureFilePathTemplate in 1.1.2. | ||
| 651 | // These unions allow old code to continue compiling without changes | ||
| 652 | union | ||
| 653 | { | ||
| 654 | // deprecated name | ||
| 655 | pRENDERDOC_SetLogFilePathTemplate SetLogFilePathTemplate; | ||
| 656 | // current name | ||
| 657 | pRENDERDOC_SetCaptureFilePathTemplate SetCaptureFilePathTemplate; | ||
| 658 | }; | ||
| 659 | union | ||
| 660 | { | ||
| 661 | // deprecated name | ||
| 662 | pRENDERDOC_GetLogFilePathTemplate GetLogFilePathTemplate; | ||
| 663 | // current name | ||
| 664 | pRENDERDOC_GetCaptureFilePathTemplate GetCaptureFilePathTemplate; | ||
| 665 | }; | ||
| 666 | |||
| 667 | pRENDERDOC_GetNumCaptures GetNumCaptures; | ||
| 668 | pRENDERDOC_GetCapture GetCapture; | ||
| 669 | |||
| 670 | pRENDERDOC_TriggerCapture TriggerCapture; | ||
| 671 | |||
| 672 | // IsRemoteAccessConnected was renamed to IsTargetControlConnected in 1.1.1. | ||
| 673 | // This union allows old code to continue compiling without changes | ||
| 674 | union | ||
| 675 | { | ||
| 676 | // deprecated name | ||
| 677 | pRENDERDOC_IsRemoteAccessConnected IsRemoteAccessConnected; | ||
| 678 | // current name | ||
| 679 | pRENDERDOC_IsTargetControlConnected IsTargetControlConnected; | ||
| 680 | }; | ||
| 681 | pRENDERDOC_LaunchReplayUI LaunchReplayUI; | ||
| 682 | |||
| 683 | pRENDERDOC_SetActiveWindow SetActiveWindow; | ||
| 684 | |||
| 685 | pRENDERDOC_StartFrameCapture StartFrameCapture; | ||
| 686 | pRENDERDOC_IsFrameCapturing IsFrameCapturing; | ||
| 687 | pRENDERDOC_EndFrameCapture EndFrameCapture; | ||
| 688 | |||
| 689 | // new function in 1.1.0 | ||
| 690 | pRENDERDOC_TriggerMultiFrameCapture TriggerMultiFrameCapture; | ||
| 691 | |||
| 692 | // new function in 1.2.0 | ||
| 693 | pRENDERDOC_SetCaptureFileComments SetCaptureFileComments; | ||
| 694 | |||
| 695 | // new function in 1.4.0 | ||
| 696 | pRENDERDOC_DiscardFrameCapture DiscardFrameCapture; | ||
| 697 | |||
| 698 | // new function in 1.5.0 | ||
| 699 | pRENDERDOC_ShowReplayUI ShowReplayUI; | ||
| 700 | |||
| 701 | // new function in 1.6.0 | ||
| 702 | pRENDERDOC_SetCaptureTitle SetCaptureTitle; | ||
| 703 | } RENDERDOC_API_1_6_0; | ||
| 704 | |||
| 705 | typedef RENDERDOC_API_1_6_0 RENDERDOC_API_1_0_0; | ||
| 706 | typedef RENDERDOC_API_1_6_0 RENDERDOC_API_1_0_1; | ||
| 707 | typedef RENDERDOC_API_1_6_0 RENDERDOC_API_1_0_2; | ||
| 708 | typedef RENDERDOC_API_1_6_0 RENDERDOC_API_1_1_0; | ||
| 709 | typedef RENDERDOC_API_1_6_0 RENDERDOC_API_1_1_1; | ||
| 710 | typedef RENDERDOC_API_1_6_0 RENDERDOC_API_1_1_2; | ||
| 711 | typedef RENDERDOC_API_1_6_0 RENDERDOC_API_1_2_0; | ||
| 712 | typedef RENDERDOC_API_1_6_0 RENDERDOC_API_1_3_0; | ||
| 713 | typedef RENDERDOC_API_1_6_0 RENDERDOC_API_1_4_0; | ||
| 714 | typedef RENDERDOC_API_1_6_0 RENDERDOC_API_1_4_1; | ||
| 715 | typedef RENDERDOC_API_1_6_0 RENDERDOC_API_1_4_2; | ||
| 716 | typedef RENDERDOC_API_1_6_0 RENDERDOC_API_1_5_0; | ||
| 717 | |||
| 718 | ////////////////////////////////////////////////////////////////////////////////////////////////// | ||
| 719 | // RenderDoc API entry point | ||
| 720 | // | ||
| 721 | // This entry point can be obtained via GetProcAddress/dlsym if RenderDoc is available. | ||
| 722 | // | ||
| 723 | // The name is the same as the typedef - "RENDERDOC_GetAPI" | ||
| 724 | // | ||
| 725 | // This function is not thread safe, and should not be called on multiple threads at once. | ||
| 726 | // Ideally, call this once as early as possible in your application's startup, before doing | ||
| 727 | // any API work, since some configuration functionality etc has to be done also before | ||
| 728 | // initialising any APIs. | ||
| 729 | // | ||
| 730 | // Parameters: | ||
| 731 | // version is a single value from the RENDERDOC_Version above. | ||
| 732 | // | ||
| 733 | // outAPIPointers will be filled out with a pointer to the corresponding struct of function | ||
| 734 | // pointers. | ||
| 735 | // | ||
| 736 | // Returns: | ||
| 737 | // 1 - if the outAPIPointers has been filled with a pointer to the API struct requested | ||
| 738 | // 0 - if the requested version is not supported or the arguments are invalid. | ||
| 739 | // | ||
| 740 | typedef int(RENDERDOC_CC *pRENDERDOC_GetAPI)(RENDERDOC_Version version, void **outAPIPointers); | ||
| 741 | |||
| 742 | #ifdef __cplusplus | ||
| 743 | } // extern "C" | ||
| 744 | #endif | ||
diff --git a/src/common/settings.h b/src/common/settings.h index b15213bd7..82ec9077e 100644 --- a/src/common/settings.h +++ b/src/common/settings.h | |||
| @@ -348,6 +348,8 @@ struct Values { | |||
| 348 | Category::RendererDebug}; | 348 | Category::RendererDebug}; |
| 349 | Setting<bool> disable_shader_loop_safety_checks{ | 349 | Setting<bool> disable_shader_loop_safety_checks{ |
| 350 | linkage, false, "disable_shader_loop_safety_checks", Category::RendererDebug}; | 350 | linkage, false, "disable_shader_loop_safety_checks", Category::RendererDebug}; |
| 351 | Setting<bool> enable_renderdoc_hotkey{linkage, false, "renderdoc_hotkey", | ||
| 352 | Category::RendererDebug}; | ||
| 351 | 353 | ||
| 352 | // System | 354 | // System |
| 353 | SwitchableSetting<Language, true> language_index{linkage, | 355 | SwitchableSetting<Language, true> language_index{linkage, |
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index 6cd1a28f2..30d2f7df6 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt | |||
| @@ -864,6 +864,8 @@ add_library(core STATIC | |||
| 864 | telemetry_session.h | 864 | telemetry_session.h |
| 865 | tools/freezer.cpp | 865 | tools/freezer.cpp |
| 866 | tools/freezer.h | 866 | tools/freezer.h |
| 867 | tools/renderdoc.cpp | ||
| 868 | tools/renderdoc.h | ||
| 867 | ) | 869 | ) |
| 868 | 870 | ||
| 869 | if (MSVC) | 871 | if (MSVC) |
| @@ -879,6 +881,7 @@ else() | |||
| 879 | -Werror=conversion | 881 | -Werror=conversion |
| 880 | 882 | ||
| 881 | -Wno-sign-conversion | 883 | -Wno-sign-conversion |
| 884 | -Wno-cast-function-type | ||
| 882 | 885 | ||
| 883 | $<$<CXX_COMPILER_ID:Clang>:-fsized-deallocation> | 886 | $<$<CXX_COMPILER_ID:Clang>:-fsized-deallocation> |
| 884 | ) | 887 | ) |
| @@ -887,7 +890,7 @@ endif() | |||
| 887 | create_target_directory_groups(core) | 890 | create_target_directory_groups(core) |
| 888 | 891 | ||
| 889 | target_link_libraries(core PUBLIC common PRIVATE audio_core network video_core nx_tzdb) | 892 | target_link_libraries(core PUBLIC common PRIVATE audio_core network video_core nx_tzdb) |
| 890 | target_link_libraries(core PUBLIC Boost::headers PRIVATE fmt::fmt nlohmann_json::nlohmann_json mbedtls Opus::opus) | 893 | target_link_libraries(core PUBLIC Boost::headers PRIVATE fmt::fmt nlohmann_json::nlohmann_json mbedtls Opus::opus renderdoc) |
| 891 | if (MINGW) | 894 | if (MINGW) |
| 892 | target_link_libraries(core PRIVATE ${MSWSOCK_LIBRARY}) | 895 | target_link_libraries(core PRIVATE ${MSWSOCK_LIBRARY}) |
| 893 | endif() | 896 | endif() |
diff --git a/src/core/core.cpp b/src/core/core.cpp index 2d6e61398..e8300cd05 100644 --- a/src/core/core.cpp +++ b/src/core/core.cpp | |||
| @@ -51,6 +51,7 @@ | |||
| 51 | #include "core/reporter.h" | 51 | #include "core/reporter.h" |
| 52 | #include "core/telemetry_session.h" | 52 | #include "core/telemetry_session.h" |
| 53 | #include "core/tools/freezer.h" | 53 | #include "core/tools/freezer.h" |
| 54 | #include "core/tools/renderdoc.h" | ||
| 54 | #include "network/network.h" | 55 | #include "network/network.h" |
| 55 | #include "video_core/host1x/host1x.h" | 56 | #include "video_core/host1x/host1x.h" |
| 56 | #include "video_core/renderer_base.h" | 57 | #include "video_core/renderer_base.h" |
| @@ -281,6 +282,10 @@ struct System::Impl { | |||
| 281 | microprofile_cpu[2] = MICROPROFILE_TOKEN(ARM_CPU2); | 282 | microprofile_cpu[2] = MICROPROFILE_TOKEN(ARM_CPU2); |
| 282 | microprofile_cpu[3] = MICROPROFILE_TOKEN(ARM_CPU3); | 283 | microprofile_cpu[3] = MICROPROFILE_TOKEN(ARM_CPU3); |
| 283 | 284 | ||
| 285 | if (Settings::values.enable_renderdoc_hotkey) { | ||
| 286 | renderdoc_api = std::make_unique<Tools::RenderdocAPI>(); | ||
| 287 | } | ||
| 288 | |||
| 284 | LOG_DEBUG(Core, "Initialized OK"); | 289 | LOG_DEBUG(Core, "Initialized OK"); |
| 285 | 290 | ||
| 286 | return SystemResultStatus::Success; | 291 | return SystemResultStatus::Success; |
| @@ -521,6 +526,8 @@ struct System::Impl { | |||
| 521 | std::unique_ptr<Tools::Freezer> memory_freezer; | 526 | std::unique_ptr<Tools::Freezer> memory_freezer; |
| 522 | std::array<u8, 0x20> build_id{}; | 527 | std::array<u8, 0x20> build_id{}; |
| 523 | 528 | ||
| 529 | std::unique_ptr<Tools::RenderdocAPI> renderdoc_api; | ||
| 530 | |||
| 524 | /// Frontend applets | 531 | /// Frontend applets |
| 525 | Service::AM::Applets::AppletManager applet_manager; | 532 | Service::AM::Applets::AppletManager applet_manager; |
| 526 | 533 | ||
| @@ -1024,6 +1031,10 @@ const Network::RoomNetwork& System::GetRoomNetwork() const { | |||
| 1024 | return impl->room_network; | 1031 | return impl->room_network; |
| 1025 | } | 1032 | } |
| 1026 | 1033 | ||
| 1034 | Tools::RenderdocAPI& System::GetRenderdocAPI() { | ||
| 1035 | return *impl->renderdoc_api; | ||
| 1036 | } | ||
| 1037 | |||
| 1027 | void System::RunServer(std::unique_ptr<Service::ServerManager>&& server_manager) { | 1038 | void System::RunServer(std::unique_ptr<Service::ServerManager>&& server_manager) { |
| 1028 | return impl->kernel.RunServer(std::move(server_manager)); | 1039 | return impl->kernel.RunServer(std::move(server_manager)); |
| 1029 | } | 1040 | } |
diff --git a/src/core/core.h b/src/core/core.h index fba312125..df20f26f3 100644 --- a/src/core/core.h +++ b/src/core/core.h | |||
| @@ -102,6 +102,10 @@ namespace Network { | |||
| 102 | class RoomNetwork; | 102 | class RoomNetwork; |
| 103 | } | 103 | } |
| 104 | 104 | ||
| 105 | namespace Tools { | ||
| 106 | class RenderdocAPI; | ||
| 107 | } | ||
| 108 | |||
| 105 | namespace Core { | 109 | namespace Core { |
| 106 | 110 | ||
| 107 | class ARM_Interface; | 111 | class ARM_Interface; |
| @@ -413,6 +417,8 @@ public: | |||
| 413 | /// Gets an immutable reference to the Room Network. | 417 | /// Gets an immutable reference to the Room Network. |
| 414 | [[nodiscard]] const Network::RoomNetwork& GetRoomNetwork() const; | 418 | [[nodiscard]] const Network::RoomNetwork& GetRoomNetwork() const; |
| 415 | 419 | ||
| 420 | [[nodiscard]] Tools::RenderdocAPI& GetRenderdocAPI(); | ||
| 421 | |||
| 416 | void SetExitLocked(bool locked); | 422 | void SetExitLocked(bool locked); |
| 417 | bool GetExitLocked() const; | 423 | bool GetExitLocked() const; |
| 418 | 424 | ||
diff --git a/src/core/tools/renderdoc.cpp b/src/core/tools/renderdoc.cpp new file mode 100644 index 000000000..44d24822a --- /dev/null +++ b/src/core/tools/renderdoc.cpp | |||
| @@ -0,0 +1,55 @@ | |||
| 1 | // SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project | ||
| 2 | // SPDX-License-Identifier: GPL-2.0-or-later | ||
| 3 | |||
| 4 | #include <renderdoc_app.h> | ||
| 5 | |||
| 6 | #include "common/assert.h" | ||
| 7 | #include "common/dynamic_library.h" | ||
| 8 | #include "core/tools/renderdoc.h" | ||
| 9 | |||
| 10 | #ifdef WIN32 | ||
| 11 | #include <windows.h> | ||
| 12 | #else | ||
| 13 | #include <dlfcn.h> | ||
| 14 | #endif | ||
| 15 | |||
| 16 | namespace Tools { | ||
| 17 | |||
| 18 | RenderdocAPI::RenderdocAPI() { | ||
| 19 | #ifdef WIN32 | ||
| 20 | if (HMODULE mod = GetModuleHandleA("renderdoc.dll")) { | ||
| 21 | const auto RENDERDOC_GetAPI = | ||
| 22 | reinterpret_cast<pRENDERDOC_GetAPI>(GetProcAddress(mod, "RENDERDOC_GetAPI")); | ||
| 23 | const s32 ret = RENDERDOC_GetAPI(eRENDERDOC_API_Version_1_6_0, (void**)&rdoc_api); | ||
| 24 | ASSERT(ret == 1); | ||
| 25 | } | ||
| 26 | #else | ||
| 27 | #ifdef ANDROID | ||
| 28 | static constexpr const char RENDERDOC_LIB[] = "libVkLayer_GLES_RenderDoc.so"; | ||
| 29 | #else | ||
| 30 | static constexpr const char RENDERDOC_LIB[] = "librenderdoc.so"; | ||
| 31 | #endif | ||
| 32 | if (void* mod = dlopen(RENDERDOC_LIB, RTLD_NOW | RTLD_NOLOAD)) { | ||
| 33 | const auto RENDERDOC_GetAPI = | ||
| 34 | reinterpret_cast<pRENDERDOC_GetAPI>(dlsym(mod, "RENDERDOC_GetAPI")); | ||
| 35 | const s32 ret = RENDERDOC_GetAPI(eRENDERDOC_API_Version_1_6_0, (void**)&rdoc_api); | ||
| 36 | ASSERT(ret == 1); | ||
| 37 | } | ||
| 38 | #endif | ||
| 39 | } | ||
| 40 | |||
| 41 | RenderdocAPI::~RenderdocAPI() = default; | ||
| 42 | |||
| 43 | void RenderdocAPI::ToggleCapture() { | ||
| 44 | if (!rdoc_api) [[unlikely]] { | ||
| 45 | return; | ||
| 46 | } | ||
| 47 | if (!is_capturing) { | ||
| 48 | rdoc_api->StartFrameCapture(NULL, NULL); | ||
| 49 | } else { | ||
| 50 | rdoc_api->EndFrameCapture(NULL, NULL); | ||
| 51 | } | ||
| 52 | is_capturing = !is_capturing; | ||
| 53 | } | ||
| 54 | |||
| 55 | } // namespace Tools | ||
diff --git a/src/core/tools/renderdoc.h b/src/core/tools/renderdoc.h new file mode 100644 index 000000000..0e5e43da5 --- /dev/null +++ b/src/core/tools/renderdoc.h | |||
| @@ -0,0 +1,22 @@ | |||
| 1 | // SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project | ||
| 2 | // SPDX-License-Identifier: GPL-2.0-or-later | ||
| 3 | |||
| 4 | #pragma once | ||
| 5 | |||
| 6 | struct RENDERDOC_API_1_6_0; | ||
| 7 | |||
| 8 | namespace Tools { | ||
| 9 | |||
| 10 | class RenderdocAPI { | ||
| 11 | public: | ||
| 12 | explicit RenderdocAPI(); | ||
| 13 | ~RenderdocAPI(); | ||
| 14 | |||
| 15 | void ToggleCapture(); | ||
| 16 | |||
| 17 | private: | ||
| 18 | RENDERDOC_API_1_6_0* rdoc_api{}; | ||
| 19 | bool is_capturing{false}; | ||
| 20 | }; | ||
| 21 | |||
| 22 | } // namespace Tools | ||
diff --git a/src/yuzu/configuration/configure_debug.cpp b/src/yuzu/configuration/configure_debug.cpp index cbeb8f168..b22fda746 100644 --- a/src/yuzu/configuration/configure_debug.cpp +++ b/src/yuzu/configuration/configure_debug.cpp | |||
| @@ -59,6 +59,8 @@ void ConfigureDebug::SetConfiguration() { | |||
| 59 | ui->use_debug_asserts->setChecked(Settings::values.use_debug_asserts.GetValue()); | 59 | ui->use_debug_asserts->setChecked(Settings::values.use_debug_asserts.GetValue()); |
| 60 | ui->use_auto_stub->setChecked(Settings::values.use_auto_stub.GetValue()); | 60 | ui->use_auto_stub->setChecked(Settings::values.use_auto_stub.GetValue()); |
| 61 | ui->enable_all_controllers->setChecked(Settings::values.enable_all_controllers.GetValue()); | 61 | ui->enable_all_controllers->setChecked(Settings::values.enable_all_controllers.GetValue()); |
| 62 | ui->enable_renderdoc_hotkey->setEnabled(runtime_lock); | ||
| 63 | ui->enable_renderdoc_hotkey->setChecked(Settings::values.enable_renderdoc_hotkey.GetValue()); | ||
| 62 | ui->enable_graphics_debugging->setEnabled(runtime_lock); | 64 | ui->enable_graphics_debugging->setEnabled(runtime_lock); |
| 63 | ui->enable_graphics_debugging->setChecked(Settings::values.renderer_debug.GetValue()); | 65 | ui->enable_graphics_debugging->setChecked(Settings::values.renderer_debug.GetValue()); |
| 64 | ui->enable_shader_feedback->setEnabled(runtime_lock); | 66 | ui->enable_shader_feedback->setEnabled(runtime_lock); |
| @@ -111,6 +113,7 @@ void ConfigureDebug::ApplyConfiguration() { | |||
| 111 | Settings::values.use_auto_stub = ui->use_auto_stub->isChecked(); | 113 | Settings::values.use_auto_stub = ui->use_auto_stub->isChecked(); |
| 112 | Settings::values.enable_all_controllers = ui->enable_all_controllers->isChecked(); | 114 | Settings::values.enable_all_controllers = ui->enable_all_controllers->isChecked(); |
| 113 | Settings::values.renderer_debug = ui->enable_graphics_debugging->isChecked(); | 115 | Settings::values.renderer_debug = ui->enable_graphics_debugging->isChecked(); |
| 116 | Settings::values.enable_renderdoc_hotkey = ui->enable_renderdoc_hotkey->isChecked(); | ||
| 114 | Settings::values.renderer_shader_feedback = ui->enable_shader_feedback->isChecked(); | 117 | Settings::values.renderer_shader_feedback = ui->enable_shader_feedback->isChecked(); |
| 115 | Settings::values.cpu_debug_mode = ui->enable_cpu_debugging->isChecked(); | 118 | Settings::values.cpu_debug_mode = ui->enable_cpu_debugging->isChecked(); |
| 116 | Settings::values.enable_nsight_aftermath = ui->enable_nsight_aftermath->isChecked(); | 119 | Settings::values.enable_nsight_aftermath = ui->enable_nsight_aftermath->isChecked(); |
diff --git a/src/yuzu/configuration/configure_debug.ui b/src/yuzu/configuration/configure_debug.ui index 97c7d9022..66b8b7459 100644 --- a/src/yuzu/configuration/configure_debug.ui +++ b/src/yuzu/configuration/configure_debug.ui | |||
| @@ -18,8 +18,8 @@ | |||
| 18 | <rect> | 18 | <rect> |
| 19 | <x>0</x> | 19 | <x>0</x> |
| 20 | <y>0</y> | 20 | <y>0</y> |
| 21 | <width>829</width> | 21 | <width>842</width> |
| 22 | <height>758</height> | 22 | <height>741</height> |
| 23 | </rect> | 23 | </rect> |
| 24 | </property> | 24 | </property> |
| 25 | <layout class="QVBoxLayout" name="verticalLayout_1"> | 25 | <layout class="QVBoxLayout" name="verticalLayout_1"> |
| @@ -260,7 +260,7 @@ | |||
| 260 | <string>Graphics</string> | 260 | <string>Graphics</string> |
| 261 | </property> | 261 | </property> |
| 262 | <layout class="QGridLayout" name="gridLayout_2"> | 262 | <layout class="QGridLayout" name="gridLayout_2"> |
| 263 | <item row="3" column="0"> | 263 | <item row="4" column="0"> |
| 264 | <widget class="QCheckBox" name="disable_loop_safety_checks"> | 264 | <widget class="QCheckBox" name="disable_loop_safety_checks"> |
| 265 | <property name="toolTip"> | 265 | <property name="toolTip"> |
| 266 | <string>When checked, it executes shaders without loop logic changes</string> | 266 | <string>When checked, it executes shaders without loop logic changes</string> |
| @@ -270,33 +270,53 @@ | |||
| 270 | </property> | 270 | </property> |
| 271 | </widget> | 271 | </widget> |
| 272 | </item> | 272 | </item> |
| 273 | <item row="4" column="0"> | 273 | <item row="8" column="0"> |
| 274 | <widget class="QCheckBox" name="dump_shaders"> | 274 | <widget class="QCheckBox" name="disable_macro_hle"> |
| 275 | <property name="enabled"> | 275 | <property name="enabled"> |
| 276 | <bool>true</bool> | 276 | <bool>true</bool> |
| 277 | </property> | 277 | </property> |
| 278 | <property name="toolTip"> | 278 | <property name="toolTip"> |
| 279 | <string>When checked, it will dump all the original assembler shaders from the disk shader cache or game as found</string> | 279 | <string>When checked, it disables the macro HLE functions. Enabling this makes games run slower</string> |
| 280 | </property> | 280 | </property> |
| 281 | <property name="text"> | 281 | <property name="text"> |
| 282 | <string>Dump Game Shaders</string> | 282 | <string>Disable Macro HLE</string> |
| 283 | </property> | 283 | </property> |
| 284 | </widget> | 284 | </widget> |
| 285 | </item> | 285 | </item> |
| 286 | <item row="7" column="0"> | 286 | <item row="7" column="0"> |
| 287 | <widget class="QCheckBox" name="disable_macro_hle"> | 287 | <widget class="QCheckBox" name="dump_macros"> |
| 288 | <property name="enabled"> | 288 | <property name="enabled"> |
| 289 | <bool>true</bool> | 289 | <bool>true</bool> |
| 290 | </property> | 290 | </property> |
| 291 | <property name="toolTip"> | 291 | <property name="toolTip"> |
| 292 | <string>When checked, it disables the macro HLE functions. Enabling this makes games run slower</string> | 292 | <string>When checked, it will dump all the macro programs of the GPU</string> |
| 293 | </property> | 293 | </property> |
| 294 | <property name="text"> | 294 | <property name="text"> |
| 295 | <string>Disable Macro HLE</string> | 295 | <string>Dump Maxwell Macros</string> |
| 296 | </property> | 296 | </property> |
| 297 | </widget> | 297 | </widget> |
| 298 | </item> | 298 | </item> |
| 299 | <item row="5" column="0"> | 299 | <item row="3" column="0"> |
| 300 | <widget class="QCheckBox" name="enable_nsight_aftermath"> | ||
| 301 | <property name="toolTip"> | ||
| 302 | <string>When checked, it enables Nsight Aftermath crash dumps</string> | ||
| 303 | </property> | ||
| 304 | <property name="text"> | ||
| 305 | <string>Enable Nsight Aftermath</string> | ||
| 306 | </property> | ||
| 307 | </widget> | ||
| 308 | </item> | ||
| 309 | <item row="2" column="0"> | ||
| 310 | <widget class="QCheckBox" name="enable_shader_feedback"> | ||
| 311 | <property name="toolTip"> | ||
| 312 | <string>When checked, yuzu will log statistics about the compiled pipeline cache</string> | ||
| 313 | </property> | ||
| 314 | <property name="text"> | ||
| 315 | <string>Enable Shader Feedback</string> | ||
| 316 | </property> | ||
| 317 | </widget> | ||
| 318 | </item> | ||
| 319 | <item row="6" column="0"> | ||
| 300 | <widget class="QCheckBox" name="disable_macro_jit"> | 320 | <widget class="QCheckBox" name="disable_macro_jit"> |
| 301 | <property name="enabled"> | 321 | <property name="enabled"> |
| 302 | <bool>true</bool> | 322 | <bool>true</bool> |
| @@ -309,6 +329,22 @@ | |||
| 309 | </property> | 329 | </property> |
| 310 | </widget> | 330 | </widget> |
| 311 | </item> | 331 | </item> |
| 332 | <item row="9" column="0"> | ||
| 333 | <spacer name="verticalSpacer_5"> | ||
| 334 | <property name="orientation"> | ||
| 335 | <enum>Qt::Vertical</enum> | ||
| 336 | </property> | ||
| 337 | <property name="sizeType"> | ||
| 338 | <enum>QSizePolicy::Preferred</enum> | ||
| 339 | </property> | ||
| 340 | <property name="sizeHint" stdset="0"> | ||
| 341 | <size> | ||
| 342 | <width>20</width> | ||
| 343 | <height>0</height> | ||
| 344 | </size> | ||
| 345 | </property> | ||
| 346 | </spacer> | ||
| 347 | </item> | ||
| 312 | <item row="0" column="0"> | 348 | <item row="0" column="0"> |
| 313 | <widget class="QCheckBox" name="enable_graphics_debugging"> | 349 | <widget class="QCheckBox" name="enable_graphics_debugging"> |
| 314 | <property name="enabled"> | 350 | <property name="enabled"> |
| @@ -322,55 +358,26 @@ | |||
| 322 | </property> | 358 | </property> |
| 323 | </widget> | 359 | </widget> |
| 324 | </item> | 360 | </item> |
| 325 | <item row="6" column="0"> | 361 | <item row="5" column="0"> |
| 326 | <widget class="QCheckBox" name="dump_macros"> | 362 | <widget class="QCheckBox" name="dump_shaders"> |
| 327 | <property name="enabled"> | 363 | <property name="enabled"> |
| 328 | <bool>true</bool> | 364 | <bool>true</bool> |
| 329 | </property> | 365 | </property> |
| 330 | <property name="toolTip"> | 366 | <property name="toolTip"> |
| 331 | <string>When checked, it will dump all the macro programs of the GPU</string> | 367 | <string>When checked, it will dump all the original assembler shaders from the disk shader cache or game as found</string> |
| 332 | </property> | 368 | </property> |
| 333 | <property name="text"> | 369 | <property name="text"> |
| 334 | <string>Dump Maxwell Macros</string> | 370 | <string>Dump Game Shaders</string> |
| 335 | </property> | 371 | </property> |
| 336 | </widget> | 372 | </widget> |
| 337 | </item> | 373 | </item> |
| 338 | <item row="1" column="0"> | 374 | <item row="1" column="0"> |
| 339 | <widget class="QCheckBox" name="enable_shader_feedback"> | 375 | <widget class="QCheckBox" name="enable_renderdoc_hotkey"> |
| 340 | <property name="toolTip"> | ||
| 341 | <string>When checked, yuzu will log statistics about the compiled pipeline cache</string> | ||
| 342 | </property> | ||
| 343 | <property name="text"> | ||
| 344 | <string>Enable Shader Feedback</string> | ||
| 345 | </property> | ||
| 346 | </widget> | ||
| 347 | </item> | ||
| 348 | <item row="2" column="0"> | ||
| 349 | <widget class="QCheckBox" name="enable_nsight_aftermath"> | ||
| 350 | <property name="toolTip"> | ||
| 351 | <string>When checked, it enables Nsight Aftermath crash dumps</string> | ||
| 352 | </property> | ||
| 353 | <property name="text"> | 376 | <property name="text"> |
| 354 | <string>Enable Nsight Aftermath</string> | 377 | <string>Enable Renderdoc Hotkey</string> |
| 355 | </property> | 378 | </property> |
| 356 | </widget> | 379 | </widget> |
| 357 | </item> | 380 | </item> |
| 358 | <item row="8" column="0"> | ||
| 359 | <spacer name="verticalSpacer_5"> | ||
| 360 | <property name="orientation"> | ||
| 361 | <enum>Qt::Vertical</enum> | ||
| 362 | </property> | ||
| 363 | <property name="sizeType"> | ||
| 364 | <enum>QSizePolicy::Preferred</enum> | ||
| 365 | </property> | ||
| 366 | <property name="sizeHint" stdset="0"> | ||
| 367 | <size> | ||
| 368 | <width>20</width> | ||
| 369 | <height>0</height> | ||
| 370 | </size> | ||
| 371 | </property> | ||
| 372 | </spacer> | ||
| 373 | </item> | ||
| 374 | </layout> | 381 | </layout> |
| 375 | </widget> | 382 | </widget> |
| 376 | </item> | 383 | </item> |
diff --git a/src/yuzu/hotkeys.h b/src/yuzu/hotkeys.h index 848239c35..56eee8d82 100644 --- a/src/yuzu/hotkeys.h +++ b/src/yuzu/hotkeys.h | |||
| @@ -4,10 +4,12 @@ | |||
| 4 | #pragma once | 4 | #pragma once |
| 5 | 5 | ||
| 6 | #include <map> | 6 | #include <map> |
| 7 | #include <QKeySequence> | ||
| 8 | #include <QString> | ||
| 9 | #include <QWidget> | ||
| 7 | #include "core/hid/hid_types.h" | 10 | #include "core/hid/hid_types.h" |
| 8 | 11 | ||
| 9 | class QDialog; | 12 | class QDialog; |
| 10 | class QKeySequence; | ||
| 11 | class QSettings; | 13 | class QSettings; |
| 12 | class QShortcut; | 14 | class QShortcut; |
| 13 | class ControllerShortcut; | 15 | class ControllerShortcut; |
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index 97d216638..d32aa9615 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp | |||
| @@ -9,6 +9,7 @@ | |||
| 9 | #include <memory> | 9 | #include <memory> |
| 10 | #include <thread> | 10 | #include <thread> |
| 11 | #include "core/loader/nca.h" | 11 | #include "core/loader/nca.h" |
| 12 | #include "core/tools/renderdoc.h" | ||
| 12 | #ifdef __APPLE__ | 13 | #ifdef __APPLE__ |
| 13 | #include <unistd.h> // for chdir | 14 | #include <unistd.h> // for chdir |
| 14 | #endif | 15 | #endif |
| @@ -1348,6 +1349,11 @@ void GMainWindow::InitializeHotkeys() { | |||
| 1348 | connect_shortcut(QStringLiteral("Toggle Framerate Limit"), [] { | 1349 | connect_shortcut(QStringLiteral("Toggle Framerate Limit"), [] { |
| 1349 | Settings::values.use_speed_limit.SetValue(!Settings::values.use_speed_limit.GetValue()); | 1350 | Settings::values.use_speed_limit.SetValue(!Settings::values.use_speed_limit.GetValue()); |
| 1350 | }); | 1351 | }); |
| 1352 | connect_shortcut(QStringLiteral("Toggle Renderdoc Capture"), [this] { | ||
| 1353 | if (Settings::values.enable_renderdoc_hotkey) { | ||
| 1354 | system->GetRenderdocAPI().ToggleCapture(); | ||
| 1355 | } | ||
| 1356 | }); | ||
| 1351 | connect_shortcut(QStringLiteral("Toggle Mouse Panning"), [&] { | 1357 | connect_shortcut(QStringLiteral("Toggle Mouse Panning"), [&] { |
| 1352 | if (Settings::values.mouse_enabled) { | 1358 | if (Settings::values.mouse_enabled) { |
| 1353 | Settings::values.mouse_panning = false; | 1359 | Settings::values.mouse_panning = false; |