mirror of
https://github.com/bkaradzic/bgfx.git
synced 2026-02-21 14:23:02 +01:00
Updated RenderDoc to nightly 20141211. Added support for capturing OpenGL.
This commit is contained in:
@@ -8,11 +8,6 @@
|
||||
#if BGFX_CONFIG_RENDERER_DIRECT3D11
|
||||
# include "renderer_d3d11.h"
|
||||
|
||||
# if BGFX_CONFIG_DEBUG_PIX
|
||||
# include <psapi.h>
|
||||
# include <renderdoc/renderdoc_app.h>
|
||||
# endif // BGFX_CONFIG_DEBUG_PIX
|
||||
|
||||
namespace bgfx
|
||||
{
|
||||
static wchar_t s_viewNameW[BGFX_CONFIG_MAX_VIEWS][BGFX_CONFIG_MAX_VIEW_NAME];
|
||||
@@ -396,135 +391,6 @@ namespace bgfx
|
||||
return false;
|
||||
};
|
||||
|
||||
#if BGFX_CONFIG_DEBUG_PIX && BX_PLATFORM_WINDOWS
|
||||
bool findModule(const char* _name)
|
||||
{
|
||||
HANDLE process = GetCurrentProcess();
|
||||
DWORD size;
|
||||
BOOL result = EnumProcessModules(process
|
||||
, NULL
|
||||
, 0
|
||||
, &size
|
||||
);
|
||||
if (0 != result)
|
||||
{
|
||||
HMODULE* modules = (HMODULE*)alloca(size);
|
||||
result = EnumProcessModules(process
|
||||
, modules
|
||||
, size
|
||||
, &size
|
||||
);
|
||||
|
||||
if (0 != result)
|
||||
{
|
||||
char moduleName[MAX_PATH];
|
||||
for (uint32_t ii = 0, num = uint32_t(size/sizeof(HMODULE) ); ii < num; ++ii)
|
||||
{
|
||||
result = GetModuleBaseNameA(process
|
||||
, modules[ii]
|
||||
, moduleName
|
||||
, BX_COUNTOF(moduleName)
|
||||
);
|
||||
if (0 != result
|
||||
&& 0 == bx::stricmp(_name, moduleName) )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
#define RENDERDOC_IMPORT \
|
||||
RENDERDOC_IMPORT_FUNC(RENDERDOC_SetLogFile); \
|
||||
RENDERDOC_IMPORT_FUNC(RENDERDOC_GetCapture); \
|
||||
RENDERDOC_IMPORT_FUNC(RENDERDOC_SetCaptureOptions); \
|
||||
RENDERDOC_IMPORT_FUNC(RENDERDOC_SetActiveWindow); \
|
||||
RENDERDOC_IMPORT_FUNC(RENDERDOC_TriggerCapture); \
|
||||
RENDERDOC_IMPORT_FUNC(RENDERDOC_StartFrameCapture); \
|
||||
RENDERDOC_IMPORT_FUNC(RENDERDOC_EndFrameCapture); \
|
||||
RENDERDOC_IMPORT_FUNC(RENDERDOC_GetOverlayBits); \
|
||||
RENDERDOC_IMPORT_FUNC(RENDERDOC_MaskOverlayBits); \
|
||||
RENDERDOC_IMPORT_FUNC(RENDERDOC_SetFocusToggleKeys); \
|
||||
RENDERDOC_IMPORT_FUNC(RENDERDOC_SetCaptureKeys); \
|
||||
RENDERDOC_IMPORT_FUNC(RENDERDOC_InitRemoteAccess);
|
||||
|
||||
#define RENDERDOC_IMPORT_FUNC(_func) p##_func _func
|
||||
RENDERDOC_IMPORT
|
||||
#undef RENDERDOC_IMPORT_FUNC
|
||||
|
||||
pRENDERDOC_GetAPIVersion RENDERDOC_GetAPIVersion;
|
||||
|
||||
void* loadRenderDoc()
|
||||
{
|
||||
// Skip loading RenderDoc when IntelGPA is present to avoid RenderDoc crash.
|
||||
if (findModule(BX_ARCH_32BIT ? "shimloader32.dll" : "shimloader64.dll") )
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void* renderdocdll = bx::dlopen("renderdoc.dll");
|
||||
|
||||
if (NULL != renderdocdll)
|
||||
{
|
||||
RENDERDOC_GetAPIVersion = (pRENDERDOC_GetAPIVersion)bx::dlsym(renderdocdll, "RENDERDOC_GetAPIVersion");
|
||||
if (NULL != RENDERDOC_GetAPIVersion
|
||||
&& RENDERDOC_API_VERSION == RENDERDOC_GetAPIVersion() )
|
||||
{
|
||||
#define RENDERDOC_IMPORT_FUNC(_func) \
|
||||
_func = (p##_func)bx::dlsym(renderdocdll, #_func); \
|
||||
BX_TRACE("%p " #_func, _func);
|
||||
RENDERDOC_IMPORT
|
||||
#undef RENDERDOC_IMPORT_FUNC
|
||||
|
||||
RENDERDOC_SetLogFile(L"temp/bgfx");
|
||||
|
||||
RENDERDOC_SetFocusToggleKeys(NULL, 0);
|
||||
|
||||
KeyButton captureKey = eKey_F11;
|
||||
RENDERDOC_SetCaptureKeys(&captureKey, 1);
|
||||
|
||||
CaptureOptions opt;
|
||||
memset(&opt, 0, sizeof(opt) );
|
||||
opt.AllowVSync = 1;
|
||||
opt.SaveAllInitials = 1;
|
||||
RENDERDOC_SetCaptureOptions(&opt);
|
||||
|
||||
uint32_t ident = 0;
|
||||
RENDERDOC_InitRemoteAccess(&ident);
|
||||
|
||||
RENDERDOC_MaskOverlayBits(eOverlay_None, eOverlay_None);
|
||||
}
|
||||
else
|
||||
{
|
||||
bx::dlclose(renderdocdll);
|
||||
renderdocdll = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
return renderdocdll;
|
||||
}
|
||||
|
||||
void unloadRenderDoc(void* _renderdocdll)
|
||||
{
|
||||
if (NULL != _renderdocdll)
|
||||
{
|
||||
bx::dlclose(_renderdocdll);
|
||||
}
|
||||
}
|
||||
#else
|
||||
void* loadRenderDoc()
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void unloadRenderDoc(void*)
|
||||
{
|
||||
}
|
||||
#endif // BGFX_CONFIG_DEBUG_PIX
|
||||
|
||||
#if USE_D3D11_DYNAMIC_LIB
|
||||
static PFN_D3D11_CREATE_DEVICE D3D11CreateDevice;
|
||||
static PFN_CREATE_DXGI_FACTORY CreateDXGIFactory;
|
||||
|
||||
Reference in New Issue
Block a user