| 15 | static void* s_renderDocDll = NULL; |
| 16 | |
| 17 | void* loadRenderDoc() |
| 18 | { |
| 19 | return NULL; |
| 20 | |
| 21 | if (NULL != s_renderDoc) |
| 22 | { |
| 23 | return s_renderDocDll; |
| 24 | } |
| 25 | |
| 26 | // Skip loading RenderDoc when IntelGPA is present to avoid RenderDoc crash. |
| 27 | if (findModule(BX_ARCH_32BIT ? "shimloader32.dll" : "shimloader64.dll") ) |
| 28 | { |
| 29 | BX_TRACE("IntelGPA is present, not loading RenderDoc."); |
| 30 | return NULL; |
| 31 | } |
| 32 | |
| 33 | if (bgfx::NativeWindowHandleType::Wayland == g_platformData.type) |
| 34 | { |
| 35 | BX_TRACE("RenderDoc is not available on Wayland. https://github.com/baldurk/renderdoc/issues/853"); |
| 36 | return NULL; |
| 37 | } |
| 38 | |
| 39 | const char* renderDocDllName = |
| 40 | #if BX_PLATFORM_WINDOWS |
| 41 | "renderdoc.dll" |
| 42 | #else |
| 43 | "librenderdoc.so" |
| 44 | #endif // BX_PLATFORM_WINDOWS |
| 45 | ; |
| 46 | |
| 47 | // If RenderDoc is already injected in the process then use the already present DLL |
| 48 | void* renderDocDll = findModule(renderDocDllName); |
| 49 | |
| 50 | if (NULL == renderDocDll) |
| 51 | { |
| 52 | BX_TRACE("Loading RenderDoc..."); |
| 53 | renderDocDll = bx::dlopen(renderDocDllName); |
| 54 | } |
| 55 | else |
| 56 | { |
| 57 | BX_TRACE("RenderDoc is already loaded."); |
| 58 | } |
| 59 | |
| 60 | if (NULL != renderDocDll) |
| 61 | { |
| 62 | RENDERDOC_GetAPI = (pRENDERDOC_GetAPI)bx::dlsym(renderDocDll, "RENDERDOC_GetAPI"); |
| 63 | |
| 64 | if (NULL != RENDERDOC_GetAPI |
| 65 | && 1 == RENDERDOC_GetAPI(eRENDERDOC_API_Version_1_6_0, (void**)&s_renderDoc) ) |
| 66 | { |
| 67 | s_renderDoc->SetCaptureFilePathTemplate(BGFX_CONFIG_RENDERDOC_LOG_FILEPATH); |
| 68 | |
| 69 | s_renderDoc->SetFocusToggleKeys(NULL, 0); |
| 70 | |
| 71 | RENDERDOC_InputButton captureKeys[] = BGFX_CONFIG_RENDERDOC_CAPTURE_KEYS; |
| 72 | s_renderDoc->SetCaptureKeys(captureKeys, BX_COUNTOF(captureKeys) ); |
| 73 | |
| 74 | s_renderDoc->SetCaptureOptionU32(eRENDERDOC_Option_AllowVSync, 1); |