mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-11-28 18:45:54 -05:00
Fixed RenderDoc crash when IntelGPA is present.
This commit is contained in:
parent
d35c14164b
commit
d705fbc9bd
2 changed files with 48 additions and 0 deletions
|
@ -77,6 +77,7 @@ function exampleProject(_name)
|
||||||
}
|
}
|
||||||
links { -- this is needed only for testing with GLES2/3 on Windows with VS2008
|
links { -- this is needed only for testing with GLES2/3 on Windows with VS2008
|
||||||
"DelayImp",
|
"DelayImp",
|
||||||
|
"psapi",
|
||||||
}
|
}
|
||||||
|
|
||||||
configuration { "vs201*" }
|
configuration { "vs201*" }
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
|
|
||||||
#if BGFX_CONFIG_RENDERER_DIRECT3D11
|
#if BGFX_CONFIG_RENDERER_DIRECT3D11
|
||||||
# include "renderer_d3d11.h"
|
# include "renderer_d3d11.h"
|
||||||
|
# include <psapi.h>
|
||||||
# include <renderdoc/renderdoc_app.h>
|
# include <renderdoc/renderdoc_app.h>
|
||||||
|
|
||||||
namespace bgfx
|
namespace bgfx
|
||||||
|
@ -423,8 +424,54 @@ RENDERDOC_IMPORT
|
||||||
|
|
||||||
pRENDERDOC_GetAPIVersion RENDERDOC_GetAPIVersion;
|
pRENDERDOC_GetAPIVersion RENDERDOC_GetAPIVersion;
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
void* loadRenderDoc()
|
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");
|
void* renderdocdll = bx::dlopen("renderdoc.dll");
|
||||||
|
|
||||||
if (NULL != renderdocdll)
|
if (NULL != renderdocdll)
|
||||||
|
|
Loading…
Reference in a new issue