9#include "renderdoc_app.h"
10#include "../utility/utility.hpp"
11#include "../char_maps/char_maps.hpp"
12#include "../telemetry/telemetry.hpp"
13#include "../macros.hpp"
17hi_export_module(hikogui.GFX.render_doc);
19hi_export
namespace hi {
inline namespace v1 {
21inline void *render_doc_api =
nullptr;
23inline void render_doc_set_overlay(
bool frameRate,
bool frameNumber,
bool captureList)
noexcept
25 if (not render_doc_api) {
29 uint32_t or_mask = eRENDERDOC_Overlay_None;
30 uint32_t and_mask = eRENDERDOC_Overlay_None;
32 if (frameRate || frameNumber || captureList) {
33 or_mask |= eRENDERDOC_Overlay_Enabled;
35 and_mask |= eRENDERDOC_Overlay_Enabled;
39 or_mask |= eRENDERDOC_Overlay_FrameRate;
41 and_mask |= eRENDERDOC_Overlay_FrameRate;
45 or_mask |= eRENDERDOC_Overlay_FrameNumber;
47 and_mask |= eRENDERDOC_Overlay_FrameNumber;
51 or_mask |= eRENDERDOC_Overlay_CaptureList;
53 and_mask |= eRENDERDOC_Overlay_CaptureList;
59 api_.MaskOverlayBits(and_mask, or_mask);
62inline void start_render_doc() noexcept
65#if HI_OPERATING_SYSTEM == HI_OS_WINDOWS
67 std::filesystem::path{
"renderdoc.dll"},
68 std::filesystem::path{
"C:/Program Files/RenderDoc/renderdoc.dll"},
69 std::filesystem::path{
"C:/Program Files (x86)/RenderDoc/renderdoc.dll"}};
71 auto mod = [&]() -> HMODULE {
72 for (
auto const& dll_url : dll_urls) {
73 hi_log_debug(
"Trying to load: {}", dll_url.string());
75 if (
auto mod = LoadLibraryW(dll_url.native().c_str())) {
83 hi_log_warning(
"Could not load renderdoc.dll");
87 auto RENDERDOC_GetAPI = (pRENDERDOC_GetAPI)GetProcAddress(mod,
"RENDERDOC_GetAPI");
88 if (RENDERDOC_GetAPI ==
nullptr) {
89 hi_log_error(
"Could not find RENDERDOC_GetAPI in renderdoc.dll");
93 int ret = RENDERDOC_GetAPI(eRENDERDOC_API_Version_1_4_1, &render_doc_api);
95 hi_log_error(
"RENDERDOC_GetAPI returns invalid value {}", ret);
96 render_doc_api =
nullptr;
108 render_doc_set_overlay(
false,
false,
false);
Rules for working with win32 headers.
The HikoGUI namespace.
Definition array_generic.hpp:20
DOXYGEN BUG.
Definition algorithm_misc.hpp:20
Definition renderdoc_app.h:579