Save machine ident in captures and compare to machine ident on open

* If the machine idents differ in significant ways that we'd consider
  it to be a different platform (currently just OS), and if so mark it
  as supported but suggested to be replayed remotely.
This commit is contained in:
baldurk
2016-08-19 17:26:36 +02:00
parent 52a754d4c1
commit d2faf76356
19 changed files with 155 additions and 28 deletions
+18
View File
@@ -1450,6 +1450,24 @@ void Serialiser::FlushToDisk()
SAFE_DELETE_ARRAY(symbolDB);
}
// write the machine identifier as an ASCII section
{
const char sectionName[] = "renderdoc/internal/machineid";
uint64_t machineID = OSUtility::GetMachineIdent();
BinarySectionHeader section = {0};
section.isASCII = 0; // redundant but explicit
section.sectionNameLength = sizeof(sectionName); // includes null terminator
section.sectionType = eSectionType_MachineID;
section.sectionFlags = eSectionFlag_None;
section.sectionLength = sizeof(machineID);
FileIO::fwrite(&section, 1, offsetof(BinarySectionHeader, name), binFile);
FileIO::fwrite(sectionName, 1, sizeof(sectionName), binFile);
FileIO::fwrite(&machineID, 1, sizeof(machineID), binFile);
}
FileIO::fclose(binFile);
}
}
+17
View File
@@ -180,6 +180,7 @@ public:
eSectionType_Unknown = 0,
eSectionType_FrameCapture, // renderdoc/internal/framecapture
eSectionType_ResolveDatabase, // renderdoc/internal/resolvedb
eSectionType_MachineID, // renderdoc/internal/machineid
eSectionType_FrameBookmarks, // renderdoc/ui/bookmarks
eSectionType_Notes, // renderdoc/ui/notes
eSectionType_Num,
@@ -281,6 +282,22 @@ public:
Callstack::StackResolver *GetCallstackResolver() { return m_pResolver; }
void SetCallstack(uint64_t *levels, size_t numLevels);
uint64_t GetSavedMachineIdent()
{
Section *id = m_KnownSections[eSectionType_MachineID];
// section might not be present on older captures (or if it was stripped out
// by someone over-eager to remove information)
if(id != NULL && id->data.size() >= sizeof(uint64_t))
{
uint64_t ident = 0;
memcpy(&ident, &id->data[0], sizeof(ident));
return ident;
}
return 0;
}
// get the callstack associated with the last scope
Callstack::Stackwalk *GetLastCallstack()
{