mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-12 21:10:42 +00:00
Expose the total number of sections via ICaptureAccess
* This lets external code iterate over all sections.
This commit is contained in:
@@ -1103,6 +1103,13 @@ and construction of files.
|
||||
)");
|
||||
struct ICaptureAccess
|
||||
{
|
||||
DOCUMENT(R"(Retrieve the total number of available sections.
|
||||
|
||||
:return: The number of sections in the capture
|
||||
:rtype: ``int``.
|
||||
)");
|
||||
virtual int GetSectionCount() = 0;
|
||||
|
||||
DOCUMENT(R"(Locate the index of a section by its name. Returns ``-1`` if the section is not found.
|
||||
|
||||
This index should not be cached, as writing sections could re-order the indices.
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
#include "strings/string_utils.h"
|
||||
#include "replay_proxy.h"
|
||||
|
||||
static const uint32_t RemoteServerProtocolVersion = 2;
|
||||
static const uint32_t RemoteServerProtocolVersion = 3;
|
||||
|
||||
enum RemoteServerPacket
|
||||
{
|
||||
@@ -61,6 +61,7 @@ enum RemoteServerPacket
|
||||
eRemoteServer_ListDir,
|
||||
eRemoteServer_ExecuteAndInject,
|
||||
eRemoteServer_ShutdownServer,
|
||||
eRemoteServer_GetSectionCount,
|
||||
eRemoteServer_FindSectionByName,
|
||||
eRemoteServer_FindSectionByType,
|
||||
eRemoteServer_GetSectionProperties,
|
||||
@@ -559,6 +560,18 @@ static void ActiveRemoteClientThread(ClientThread *threadData)
|
||||
SERIALISE_ELEMENT(StackFrames);
|
||||
}
|
||||
}
|
||||
else if(type == eRemoteServer_GetSectionCount)
|
||||
{
|
||||
reader.EndChunk();
|
||||
|
||||
int count = rdc ? rdc->NumSections() : 0;
|
||||
|
||||
{
|
||||
WRITE_DATA_SCOPE();
|
||||
SCOPED_SERIALISE_CHUNK(eRemoteServer_GetSectionCount);
|
||||
SERIALISE_ELEMENT(count);
|
||||
}
|
||||
}
|
||||
else if(type == eRemoteServer_FindSectionByName)
|
||||
{
|
||||
std::string name;
|
||||
@@ -1408,6 +1421,37 @@ public:
|
||||
rend->Shutdown();
|
||||
}
|
||||
|
||||
int GetSectionCount()
|
||||
{
|
||||
if(!Connected())
|
||||
return 0;
|
||||
|
||||
{
|
||||
WRITE_DATA_SCOPE();
|
||||
SCOPED_SERIALISE_CHUNK(eRemoteServer_GetSectionCount);
|
||||
}
|
||||
|
||||
int count = 0;
|
||||
|
||||
{
|
||||
READ_DATA_SCOPE();
|
||||
RemoteServerPacket type = ser.ReadChunk<RemoteServerPacket>();
|
||||
|
||||
if(type == eRemoteServer_GetSectionCount)
|
||||
{
|
||||
SERIALISE_ELEMENT(count);
|
||||
}
|
||||
else
|
||||
{
|
||||
RDCERR("Unexpected response to GetSectionCount");
|
||||
}
|
||||
|
||||
ser.EndChunk();
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
int FindSectionByName(const char *name)
|
||||
{
|
||||
if(!Connected())
|
||||
|
||||
@@ -165,6 +165,7 @@ public:
|
||||
|
||||
// ICaptureAccess
|
||||
|
||||
int GetSectionCount();
|
||||
int FindSectionByName(const char *name);
|
||||
int FindSectionByType(SectionType type);
|
||||
SectionProperties GetSectionProperties(int index);
|
||||
@@ -603,6 +604,14 @@ Thumbnail CaptureFile::GetThumbnail(FileType type, uint32_t maxsize)
|
||||
return ret;
|
||||
}
|
||||
|
||||
int CaptureFile::GetSectionCount()
|
||||
{
|
||||
if(!m_RDC)
|
||||
return 0;
|
||||
|
||||
return m_RDC->NumSections();
|
||||
}
|
||||
|
||||
int CaptureFile::FindSectionByName(const char *name)
|
||||
{
|
||||
if(!m_RDC)
|
||||
|
||||
Reference in New Issue
Block a user