mirror of
https://git.eden-emu.dev/eden-emu/eden
synced 2026-04-11 03:08:56 +02:00
Compilation and CMake fixes for both Windows on ARM and clang-cl, meaning Windows can now be built on both MSVC and clang on both amd64 and aarch64. Compiling on clang is *dramatically* faster so this should be useful for CI. Co-authored-by: crueter <crueter@eden-emu.dev> Co-authored-by: crueter <crueter@crueter.xyz> Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/348 Reviewed-by: CamilleLaVey <camillelavey99@gmail.com> Reviewed-by: crueter <crueter@eden-emu.dev> Co-authored-by: lizzie <lizzie@eden-emu.dev> Co-committed-by: lizzie <lizzie@eden-emu.dev>
60 lines
1.7 KiB
C++
60 lines
1.7 KiB
C++
// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
#include <renderdoc_app.h>
|
|
|
|
#include "common/assert.h"
|
|
#include "common/dynamic_library.h"
|
|
#include "core/tools/renderdoc.h"
|
|
|
|
#ifdef _WIN32
|
|
#include <windows.h>
|
|
#else
|
|
#include <dlfcn.h>
|
|
#endif
|
|
|
|
namespace Tools {
|
|
|
|
RenderdocAPI::RenderdocAPI() {
|
|
#ifdef WIN32
|
|
if (HMODULE mod = GetModuleHandleA("renderdoc.dll")) {
|
|
void* proc = reinterpret_cast<void*>(GetProcAddress(mod, "RENDERDOC_GetAPI"));
|
|
if (proc) {
|
|
const auto RENDERDOC_GetAPI = reinterpret_cast<pRENDERDOC_GetAPI>(proc);
|
|
const s32 ret = RENDERDOC_GetAPI(eRENDERDOC_API_Version_1_6_0, (void**)&rdoc_api);
|
|
ASSERT(ret == 1);
|
|
}
|
|
}
|
|
#else
|
|
#ifdef ANDROID
|
|
static constexpr const char RENDERDOC_LIB[] = "libVkLayer_GLES_RenderDoc.so";
|
|
#else
|
|
static constexpr const char RENDERDOC_LIB[] = "librenderdoc.so";
|
|
#endif
|
|
if (void* mod = dlopen(RENDERDOC_LIB, RTLD_NOW | RTLD_NOLOAD)) {
|
|
const auto RENDERDOC_GetAPI =
|
|
reinterpret_cast<pRENDERDOC_GetAPI>(dlsym(mod, "RENDERDOC_GetAPI"));
|
|
const s32 ret = RENDERDOC_GetAPI(eRENDERDOC_API_Version_1_6_0, (void**)&rdoc_api);
|
|
ASSERT(ret == 1);
|
|
}
|
|
#endif
|
|
}
|
|
|
|
RenderdocAPI::~RenderdocAPI() = default;
|
|
|
|
void RenderdocAPI::ToggleCapture() {
|
|
if (!rdoc_api) [[unlikely]] {
|
|
return;
|
|
}
|
|
if (!is_capturing) {
|
|
rdoc_api->StartFrameCapture(NULL, NULL);
|
|
} else {
|
|
rdoc_api->EndFrameCapture(NULL, NULL);
|
|
}
|
|
is_capturing = !is_capturing;
|
|
}
|
|
|
|
} // namespace Tools
|