nv2a: Add RenderDoc support for Windows builds

This commit is contained in:
Mike Davis
2022-06-14 14:03:26 -07:00
committed by GitHub
parent 30829497d2
commit c16db47bab
3 changed files with 728 additions and 11 deletions
+17 -3
View File
@@ -28,8 +28,12 @@
#include <assert.h>
#ifdef CONFIG_RENDERDOC
#include <renderdoc_app.h>
#include "thirdparty/renderdoc_app.h"
#ifdef _WIN32
#include <libloaderapi.h>
#else
#include <dlfcn.h>
#endif
static RENDERDOC_API_1_1_2 *rdoc_api = NULL;
static int32_t renderdoc_capture_frames = 0;
@@ -43,7 +47,6 @@ static int32_t renderdoc_capture_frames = 0;
} \
} while(0)
static bool has_GL_GREMEDY_frame_terminator = false;
static bool has_GL_KHR_debug = false;
@@ -72,15 +75,26 @@ void gl_debug_initialize(void)
#ifdef CONFIG_RENDERDOC
const char *renderdoc_lib;
void* renderdoc;
#ifdef __APPLE__
renderdoc_lib = "librenderdoc.dylib";
#elif _WIN32
renderdoc_lib = "renderdoc.dll";
#else
renderdoc_lib = "librenderdoc.so";
#endif
void* renderdoc = dlopen(renderdoc_lib, RTLD_NOW | RTLD_NOLOAD);
#ifdef _WIN32
renderdoc = GetModuleHandleA(renderdoc_lib);
if (renderdoc) {
pRENDERDOC_GetAPI RENDERDOC_GetAPI = (pRENDERDOC_GetAPI)GetProcAddress(
renderdoc, "RENDERDOC_GetAPI");
#else
renderdoc = dlopen(renderdoc_lib, RTLD_NOW | RTLD_NOLOAD);
if (renderdoc) {
pRENDERDOC_GetAPI RENDERDOC_GetAPI = (pRENDERDOC_GetAPI)dlsym(
renderdoc, "RENDERDOC_GetAPI");
#endif
int ret = RENDERDOC_GetAPI(eRENDERDOC_API_Version_1_1_2,
(void **)&rdoc_api);
assert(ret == 1 && "Failed to retrieve RenderDoc API.");
+4 -8
View File
@@ -471,7 +471,7 @@ rt = cc.find_library('rt', required: false)
libdl = not_found
if 'CONFIG_PLUGIN' in config_host or get_option('renderdoc').enabled()
libdl = cc.find_library('dl', required: false)
if not cc.has_function('dlopen', dependencies: libdl)
if targetos != 'windows' and not cc.has_function('dlopen', dependencies: libdl)
error('dlopen not found')
endif
endif
@@ -1234,14 +1234,10 @@ have_host_block_device = (targetos != 'darwin' or
have_renderdoc = false
if have_system and get_option('renderdoc').enabled()
if not cc.has_header('renderdoc_app.h')
error('renderdoc required, but renderdoc_app.h was not found')
if targetos == 'linux' and not libdl.found()
error('renderdoc required, but libdl was not found')
else
if targetos == 'linux' and not libdl.found()
error('renderdoc required, but libdl was not found')
else
have_renderdoc = true
endif
have_renderdoc = true
endif
endif
+707
View File
File diff suppressed because it is too large Load Diff