mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-08-14 02:31:12 +00:00
Don't enable counter libraries when running as a replay proxy
This commit is contained in:
@@ -175,60 +175,63 @@ void D3D11Replay::CreateResources(IDXGIFactory *factory)
|
||||
|
||||
m_pDevice->GetShaderCache()->SetCaching(false);
|
||||
|
||||
AMDCounters *countersAMD = NULL;
|
||||
NVCounters *countersNV = NULL;
|
||||
IntelCounters *countersIntel = NULL;
|
||||
if(!m_Proxy)
|
||||
{
|
||||
AMDCounters *countersAMD = NULL;
|
||||
NVCounters *countersNV = NULL;
|
||||
IntelCounters *countersIntel = NULL;
|
||||
|
||||
if(m_DriverInfo.vendor == GPUVendor::AMD)
|
||||
{
|
||||
RDCLOG("AMD GPU detected - trying to initialise AMD counters");
|
||||
countersAMD = new AMDCounters();
|
||||
}
|
||||
else if(m_DriverInfo.vendor == GPUVendor::nVidia)
|
||||
{
|
||||
RDCLOG("nVidia GPU detected - trying to initialise nVidia counters");
|
||||
countersNV = new NVCounters();
|
||||
}
|
||||
else if(m_DriverInfo.vendor == GPUVendor::Intel)
|
||||
{
|
||||
RDCLOG("Intel GPU detected - trying to initialize Intel counters");
|
||||
countersIntel = new IntelCounters();
|
||||
}
|
||||
else
|
||||
{
|
||||
RDCLOG("%s GPU detected - no counters available", ToStr(m_DriverInfo.vendor).c_str());
|
||||
}
|
||||
if(m_DriverInfo.vendor == GPUVendor::AMD)
|
||||
{
|
||||
RDCLOG("AMD GPU detected - trying to initialise AMD counters");
|
||||
countersAMD = new AMDCounters();
|
||||
}
|
||||
else if(m_DriverInfo.vendor == GPUVendor::nVidia)
|
||||
{
|
||||
RDCLOG("nVidia GPU detected - trying to initialise nVidia counters");
|
||||
countersNV = new NVCounters();
|
||||
}
|
||||
else if(m_DriverInfo.vendor == GPUVendor::Intel)
|
||||
{
|
||||
RDCLOG("Intel GPU detected - trying to initialize Intel counters");
|
||||
countersIntel = new IntelCounters();
|
||||
}
|
||||
else
|
||||
{
|
||||
RDCLOG("%s GPU detected - no counters available", ToStr(m_DriverInfo.vendor).c_str());
|
||||
}
|
||||
|
||||
ID3D11Device *d3dDevice = m_pDevice->GetReal();
|
||||
ID3D11Device *d3dDevice = m_pDevice->GetReal();
|
||||
|
||||
if(countersAMD && countersAMD->Init(AMDCounters::ApiType::Dx11, (void *)d3dDevice))
|
||||
{
|
||||
m_pAMDCounters = countersAMD;
|
||||
}
|
||||
else
|
||||
{
|
||||
delete countersAMD;
|
||||
m_pAMDCounters = NULL;
|
||||
}
|
||||
if(countersAMD && countersAMD->Init(AMDCounters::ApiType::Dx11, (void *)d3dDevice))
|
||||
{
|
||||
m_pAMDCounters = countersAMD;
|
||||
}
|
||||
else
|
||||
{
|
||||
delete countersAMD;
|
||||
m_pAMDCounters = NULL;
|
||||
}
|
||||
|
||||
if(countersNV && countersNV->Init(d3dDevice))
|
||||
{
|
||||
m_pNVCounters = countersNV;
|
||||
}
|
||||
else
|
||||
{
|
||||
delete countersNV;
|
||||
m_pNVCounters = NULL;
|
||||
}
|
||||
if(countersNV && countersNV->Init(d3dDevice))
|
||||
{
|
||||
m_pNVCounters = countersNV;
|
||||
}
|
||||
else
|
||||
{
|
||||
delete countersNV;
|
||||
m_pNVCounters = NULL;
|
||||
}
|
||||
|
||||
if(countersIntel && countersIntel->Init(d3dDevice))
|
||||
{
|
||||
m_pIntelCounters = countersIntel;
|
||||
}
|
||||
else
|
||||
{
|
||||
delete countersIntel;
|
||||
m_pIntelCounters = NULL;
|
||||
if(countersIntel && countersIntel->Init(d3dDevice))
|
||||
{
|
||||
m_pIntelCounters = countersIntel;
|
||||
}
|
||||
else
|
||||
{
|
||||
delete countersIntel;
|
||||
m_pIntelCounters = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
RenderDoc::Inst().SetProgress(LoadProgress::DebugManagerInit, 1.0f);
|
||||
|
||||
@@ -154,28 +154,31 @@ void D3D12Replay::CreateResources()
|
||||
m_PixelPick.Init(m_pDevice, m_DebugManager);
|
||||
m_Histogram.Init(m_pDevice, m_DebugManager);
|
||||
|
||||
AMDCounters *counters = NULL;
|
||||
if(!m_Proxy)
|
||||
{
|
||||
AMDCounters *counters = NULL;
|
||||
|
||||
if(m_DriverInfo.vendor == GPUVendor::AMD)
|
||||
{
|
||||
RDCLOG("AMD GPU detected - trying to initialise AMD counters");
|
||||
counters = new AMDCounters(m_pDevice->IsDebugLayerEnabled());
|
||||
}
|
||||
else
|
||||
{
|
||||
RDCLOG("%s GPU detected - no counters available", ToStr(m_DriverInfo.vendor).c_str());
|
||||
}
|
||||
if(m_DriverInfo.vendor == GPUVendor::AMD)
|
||||
{
|
||||
RDCLOG("AMD GPU detected - trying to initialise AMD counters");
|
||||
counters = new AMDCounters(m_pDevice->IsDebugLayerEnabled());
|
||||
}
|
||||
else
|
||||
{
|
||||
RDCLOG("%s GPU detected - no counters available", ToStr(m_DriverInfo.vendor).c_str());
|
||||
}
|
||||
|
||||
ID3D12Device *d3dDevice = m_pDevice->GetReal();
|
||||
ID3D12Device *d3dDevice = m_pDevice->GetReal();
|
||||
|
||||
if(counters && counters->Init(AMDCounters::ApiType::Dx12, (void *)d3dDevice))
|
||||
{
|
||||
m_pAMDCounters = counters;
|
||||
}
|
||||
else
|
||||
{
|
||||
delete counters;
|
||||
m_pAMDCounters = NULL;
|
||||
if(counters && counters->Init(AMDCounters::ApiType::Dx12, (void *)d3dDevice))
|
||||
{
|
||||
m_pAMDCounters = counters;
|
||||
}
|
||||
else
|
||||
{
|
||||
delete counters;
|
||||
m_pAMDCounters = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@@ -265,80 +265,83 @@ void GLReplay::SetReplayData(GLWindowingData data)
|
||||
if(!HasDebugContext())
|
||||
return;
|
||||
|
||||
AMDCounters *countersAMD = NULL;
|
||||
IntelGlCounters *countersIntel = NULL;
|
||||
|
||||
bool isMesa = false;
|
||||
|
||||
// try to identify mesa - don't enable any IHV counters when running mesa.
|
||||
if(!m_Proxy)
|
||||
{
|
||||
WrappedOpenGL &drv = *m_pDriver;
|
||||
AMDCounters *countersAMD = NULL;
|
||||
IntelGlCounters *countersIntel = NULL;
|
||||
|
||||
const char *version = (const char *)drv.glGetString(eGL_VERSION);
|
||||
const char *vendor = (const char *)drv.glGetString(eGL_VENDOR);
|
||||
const char *renderer = (const char *)drv.glGetString(eGL_RENDERER);
|
||||
bool isMesa = false;
|
||||
|
||||
for(std::string haystack : {strlower(version), strlower(vendor), strlower(renderer)})
|
||||
// try to identify mesa - don't enable any IHV counters when running mesa.
|
||||
{
|
||||
haystack = " " + haystack + " ";
|
||||
WrappedOpenGL &drv = *m_pDriver;
|
||||
|
||||
// the version should always contain 'mesa', but it's also commonly present in either vendor
|
||||
// or renderer - except for nouveau which we look for separately
|
||||
for(const char *needle : {" mesa ", "nouveau"})
|
||||
const char *version = (const char *)drv.glGetString(eGL_VERSION);
|
||||
const char *vendor = (const char *)drv.glGetString(eGL_VENDOR);
|
||||
const char *renderer = (const char *)drv.glGetString(eGL_RENDERER);
|
||||
|
||||
for(std::string haystack : {strlower(version), strlower(vendor), strlower(renderer)})
|
||||
{
|
||||
if(haystack.find(needle) != std::string::npos)
|
||||
haystack = " " + haystack + " ";
|
||||
|
||||
// the version should always contain 'mesa', but it's also commonly present in either vendor
|
||||
// or renderer - except for nouveau which we look for separately
|
||||
for(const char *needle : {" mesa ", "nouveau"})
|
||||
{
|
||||
isMesa = true;
|
||||
break;
|
||||
if(haystack.find(needle) != std::string::npos)
|
||||
{
|
||||
isMesa = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(isMesa)
|
||||
break;
|
||||
}
|
||||
|
||||
if(isMesa)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(isMesa)
|
||||
{
|
||||
if(m_DriverInfo.vendor == GPUVendor::Intel)
|
||||
if(isMesa)
|
||||
{
|
||||
RDCLOG("Intel GPU detected - trying to initialise Intel GL counters");
|
||||
countersIntel = new IntelGlCounters();
|
||||
}
|
||||
else
|
||||
RDCLOG("Non Intel Mesa driver detected - skipping IHV counter initialisation");
|
||||
}
|
||||
else
|
||||
{
|
||||
if(m_DriverInfo.vendor == GPUVendor::AMD)
|
||||
{
|
||||
RDCLOG("AMD GPU detected - trying to initialise AMD counters");
|
||||
countersAMD = new AMDCounters();
|
||||
if(m_DriverInfo.vendor == GPUVendor::Intel)
|
||||
{
|
||||
RDCLOG("Intel GPU detected - trying to initialise Intel GL counters");
|
||||
countersIntel = new IntelGlCounters();
|
||||
}
|
||||
else
|
||||
RDCLOG("Non Intel Mesa driver detected - skipping IHV counter initialisation");
|
||||
}
|
||||
else
|
||||
{
|
||||
RDCLOG("%s GPU detected - no counters available", ToStr(m_DriverInfo.vendor).c_str());
|
||||
if(m_DriverInfo.vendor == GPUVendor::AMD)
|
||||
{
|
||||
RDCLOG("AMD GPU detected - trying to initialise AMD counters");
|
||||
countersAMD = new AMDCounters();
|
||||
}
|
||||
else
|
||||
{
|
||||
RDCLOG("%s GPU detected - no counters available", ToStr(m_DriverInfo.vendor).c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(countersAMD && countersAMD->Init(AMDCounters::ApiType::Ogl, m_ReplayCtx.ctx))
|
||||
{
|
||||
m_pAMDCounters = countersAMD;
|
||||
}
|
||||
else
|
||||
{
|
||||
delete countersAMD;
|
||||
m_pAMDCounters = NULL;
|
||||
}
|
||||
if(countersAMD && countersAMD->Init(AMDCounters::ApiType::Ogl, m_ReplayCtx.ctx))
|
||||
{
|
||||
m_pAMDCounters = countersAMD;
|
||||
}
|
||||
else
|
||||
{
|
||||
delete countersAMD;
|
||||
m_pAMDCounters = NULL;
|
||||
}
|
||||
|
||||
if(countersIntel && countersIntel->Init())
|
||||
{
|
||||
m_pIntelCounters = countersIntel;
|
||||
}
|
||||
else
|
||||
{
|
||||
delete countersIntel;
|
||||
m_pIntelCounters = NULL;
|
||||
if(countersIntel && countersIntel->Init())
|
||||
{
|
||||
m_pIntelCounters = countersIntel;
|
||||
}
|
||||
else
|
||||
{
|
||||
delete countersIntel;
|
||||
m_pIntelCounters = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1675,28 +1675,31 @@ void VulkanReplay::CreateResources()
|
||||
GPA_vkContextOpenInfo context = {Unwrap(m_pDriver->GetInstance()),
|
||||
Unwrap(m_pDriver->GetPhysDev()), Unwrap(m_pDriver->GetDev())};
|
||||
|
||||
AMDCounters *counters = NULL;
|
||||
if(!m_pDriver->GetReplay()->IsRemoteProxy())
|
||||
{
|
||||
AMDCounters *counters = NULL;
|
||||
|
||||
GPUVendor vendor = m_pDriver->GetDriverInfo().Vendor();
|
||||
GPUVendor vendor = m_pDriver->GetDriverInfo().Vendor();
|
||||
|
||||
if(vendor == GPUVendor::AMD)
|
||||
{
|
||||
RDCLOG("AMD GPU detected - trying to initialise AMD counters");
|
||||
counters = new AMDCounters();
|
||||
}
|
||||
else
|
||||
{
|
||||
RDCLOG("%s GPU detected - no counters available", ToStr(vendor).c_str());
|
||||
}
|
||||
if(vendor == GPUVendor::AMD)
|
||||
{
|
||||
RDCLOG("AMD GPU detected - trying to initialise AMD counters");
|
||||
counters = new AMDCounters();
|
||||
}
|
||||
else
|
||||
{
|
||||
RDCLOG("%s GPU detected - no counters available", ToStr(vendor).c_str());
|
||||
}
|
||||
|
||||
if(counters && counters->Init(AMDCounters::ApiType::Vk, (void *)&context))
|
||||
{
|
||||
m_pAMDCounters = counters;
|
||||
}
|
||||
else
|
||||
{
|
||||
delete counters;
|
||||
m_pAMDCounters = NULL;
|
||||
if(counters && counters->Init(AMDCounters::ApiType::Vk, (void *)&context))
|
||||
{
|
||||
m_pAMDCounters = counters;
|
||||
}
|
||||
else
|
||||
{
|
||||
delete counters;
|
||||
m_pAMDCounters = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user