Expose which drivers support RGP, and add command to create RGP profile

This commit is contained in:
baldurk committed 2018-04-25 19:10:50 +01:00
1 parent ce83144723
commit 79637f6caa
13 files changed
+121

No files matched your search

+70
View File
@@ -28,6 +28,7 @@
#include <time.h>
#include "common/dds_readwrite.h"
#include "driver/ihv/amd/amd_isa.h"
#include "driver/ihv/amd/amd_rgp.h"
#include "jpeg-compressor/jpgd.h"
#include "jpeg-compressor/jpge.h"
#include "maths/formatpacking.h"
@@ -1398,6 +1399,75 @@ rdcarray<WindowingSystem> ReplayController::GetSupportedWindowSystems()
return m_pDevice->GetSupportedWindowSystems();
}
rdcstr ReplayController::CreateRGPProfile(WindowingData window)
{
AMDRGPControl *rgp = m_pDevice->GetRGPControl();
if(!rgp)
{
RDCERR("RGP Capture is not supported on this API implementation");
return "";
}
std::string path = FileIO::GetTempFolderFilename() + "/renderdoc_rgp_capture.rgp";
ReplayOutput *output = CreateOutput(window, ReplayOutputType::Texture);
TextureDisplay d = {};
output->SetTextureDisplay(d);
// prime the pump
for(int i = 0; i < 5; i++)
{
m_pDevice->ReplayLog(10000000, eReplay_Full);
output->Display();
}
bool captureTriggered = rgp->TriggerCapture(path);
if(!captureTriggered)
{
RDCERR("Failed to trigger an RGP Capture.");
return "";
}
// delay a while to make sure the profiling is ready to go
Threading::Sleep(5000);
// replay for capture. We do this a few times since doing it only once doesn't seem to pick up
// (6-7 runs needed)
for(int i = 0; i < 10; i++)
{
if(rgp->HasCapture())
{
RDCDEBUG("Got profile after %d runs", i);
break;
}
output->Display();
m_pDevice->ReplayLog(10000000, eReplay_Full);
}
output->Display();
// restore back to where we were
m_pDevice->ReplayLog(m_EventID, eReplay_Full);
ShutdownOutput(output);
// wait for 5 seconds for the capture to become ready
for(int i = 0; i < 50; i++)
{
if(rgp->HasCapture())
return path;
Threading::Sleep(100);
}
RDCERR("Didn't get capture after 5 seconds");
return "";
}
void ReplayController::ReplayLoop(WindowingData window, ResourceId texid)
{
ReplayOutput *output = CreateOutput(window, ReplayOutputType::Texture);