mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-11-07 14:35:48 +00:00
Move capture-file handling functions into a single interface
* This allows us to return complex types like byte arrays or pairs of status & render handle. * Also in future more introspection of the capture file will be possible and this provides an easy extension to that without adding new entry points.
This commit is contained in:
1 parent
dd1e090040
commit
a7ab0d9300
13 files changed
+492
-249
No files matched your search
@@ -252,10 +252,19 @@ struct ThumbCommand : public Command
|
||||
}
|
||||
|
||||
rdctype::array<byte> buf;
|
||||
bool32 ret =
|
||||
RENDERDOC_GetThumbnail(filename.c_str(), type, parser.get<uint32_t>("max-size"), &buf);
|
||||
|
||||
if(!ret)
|
||||
ICaptureFile *file = RENDERDOC_OpenCaptureFile(filename.c_str());
|
||||
if(file->OpenStatus() == ReplayStatus::Succeeded)
|
||||
{
|
||||
buf = file->GetThumbnail(FileType::JPG, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cerr << "Couldn't open '" << filename << "'" << std::endl;
|
||||
}
|
||||
file->Shutdown();
|
||||
|
||||
if(buf.empty())
|
||||
{
|
||||
std::cerr << "Couldn't fetch the thumbnail in '" << filename << "'" << std::endl;
|
||||
}
|
||||
@@ -522,9 +531,19 @@ struct ReplayCommand : public Command
|
||||
{
|
||||
std::cout << "Replaying '" << filename << "' locally.." << std::endl;
|
||||
|
||||
float progress = 0.0f;
|
||||
ICaptureFile *file = RENDERDOC_OpenCaptureFile(filename.c_str());
|
||||
|
||||
if(file->OpenStatus() != ReplayStatus::Succeeded)
|
||||
{
|
||||
std::cerr << "Couldn't load '" << filename << "'." << std::endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
IReplayRenderer *renderer = NULL;
|
||||
ReplayStatus status = RENDERDOC_CreateReplayRenderer(filename.c_str(), &progress, &renderer);
|
||||
ReplayStatus status = ReplayStatus::InternalError;
|
||||
std::tie(status, renderer) = file->OpenCapture(NULL);
|
||||
|
||||
file->Shutdown();
|
||||
|
||||
if(status == ReplayStatus::Succeeded)
|
||||
{
|
||||
@@ -536,6 +555,7 @@ struct ReplayCommand : public Command
|
||||
else
|
||||
{
|
||||
std::cerr << "Couldn't load and replay '" << filename << "'." << std::endl;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
||||
Reference in new issue
Block a user