Add some needed ToStr implementations

This commit is contained in:
baldurk
2016-02-27 17:51:19 +01:00
parent ba36dec115
commit a347b54be4
7 changed files with 76 additions and 8 deletions
+10
View File
@@ -676,11 +676,21 @@ HRESULT WrappedID3D11Device::QueryInterface(REFIID riid, void **ppvObject)
const char *WrappedID3D11Device::GetChunkName(uint32_t idx)
{
if(idx == CREATE_PARAMS) return "Create Params";
if(idx == THUMBNAIL_DATA) return "Thumbnail Data";
if(idx == DRIVER_INIT_PARAMS) return "Driver Init Params";
if(idx == INITIAL_CONTENTS) return "Initial Contents";
if(idx < FIRST_CHUNK_ID || idx >= NUM_D3D11_CHUNKS)
return "<unknown>";
return D3D11ChunkNames[idx-FIRST_CHUNK_ID];
}
template<>
string ToStrHelper<false, D3D11ChunkType>::Get(const D3D11ChunkType &el)
{
return WrappedID3D11Device::GetChunkName(el);
}
void WrappedID3D11Device::LazyInit()
{
if(m_DebugManager == NULL)
+11 -1
View File
@@ -902,13 +902,23 @@ void WrappedOpenGL::Initialise(GLInitParams &params)
}
}
const char * WrappedOpenGL::GetChunkName(uint32_t idx)
const char *WrappedOpenGL::GetChunkName(uint32_t idx)
{
if(idx == CREATE_PARAMS) return "Create Params";
if(idx == THUMBNAIL_DATA) return "Thumbnail Data";
if(idx == DRIVER_INIT_PARAMS) return "Driver Init Params";
if(idx == INITIAL_CONTENTS) return "Initial Contents";
if(idx < FIRST_CHUNK_ID || idx >= NUM_OPENGL_CHUNKS)
return "<unknown>";
return GLChunkNames[idx-FIRST_CHUNK_ID];
}
template<>
string ToStrHelper<false, GLChunkType>::Get(const GLChunkType &el)
{
return WrappedOpenGL::GetChunkName(el);
}
WrappedOpenGL::~WrappedOpenGL()
{
if(m_FakeIdxBuf) m_Real.glDeleteBuffers(1, &m_FakeIdxBuf);
+2 -3
View File
@@ -192,8 +192,6 @@ class WrappedOpenGL : public IFrameCapturer
vector<FetchFrameRecord> m_FrameRecord;
vector<FetchDrawcall*> m_Drawcalls;
static const char *GetChunkName(uint32_t idx);
// replay
vector<FetchAPIEvent> m_CurEvents, m_Events;
@@ -463,7 +461,8 @@ class WrappedOpenGL : public IFrameCapturer
public:
WrappedOpenGL(const char *logfile, const GLHookSet &funcs);
virtual ~WrappedOpenGL();
static const char *GetChunkName(uint32_t idx);
GLResourceManager *GetResourceManager() { return m_ResourceManager; }
ResourceId GetDeviceResourceID() { return m_DeviceResourceID; }
+34
View File
@@ -2394,6 +2394,40 @@ string ToStrHelper<false, VkFormat>::Get(const VkFormat &el)
return StringFormat::Fmt("VkFormat<%d>", el);
}
template<>
string ToStrHelper<false, VkResult>::Get(const VkResult &el)
{
switch(el)
{
TOSTR_CASE_STRINGIZE(VK_SUCCESS)
TOSTR_CASE_STRINGIZE(VK_NOT_READY)
TOSTR_CASE_STRINGIZE(VK_TIMEOUT)
TOSTR_CASE_STRINGIZE(VK_EVENT_SET)
TOSTR_CASE_STRINGIZE(VK_EVENT_RESET)
TOSTR_CASE_STRINGIZE(VK_INCOMPLETE)
TOSTR_CASE_STRINGIZE(VK_ERROR_OUT_OF_HOST_MEMORY)
TOSTR_CASE_STRINGIZE(VK_ERROR_OUT_OF_DEVICE_MEMORY)
TOSTR_CASE_STRINGIZE(VK_ERROR_INITIALIZATION_FAILED)
TOSTR_CASE_STRINGIZE(VK_ERROR_DEVICE_LOST)
TOSTR_CASE_STRINGIZE(VK_ERROR_MEMORY_MAP_FAILED)
TOSTR_CASE_STRINGIZE(VK_ERROR_LAYER_NOT_PRESENT)
TOSTR_CASE_STRINGIZE(VK_ERROR_EXTENSION_NOT_PRESENT)
TOSTR_CASE_STRINGIZE(VK_ERROR_FEATURE_NOT_PRESENT)
TOSTR_CASE_STRINGIZE(VK_ERROR_INCOMPATIBLE_DRIVER)
TOSTR_CASE_STRINGIZE(VK_ERROR_TOO_MANY_OBJECTS)
TOSTR_CASE_STRINGIZE(VK_ERROR_FORMAT_NOT_SUPPORTED)
TOSTR_CASE_STRINGIZE(VK_ERROR_SURFACE_LOST_KHR)
TOSTR_CASE_STRINGIZE(VK_ERROR_NATIVE_WINDOW_IN_USE_KHR)
TOSTR_CASE_STRINGIZE(VK_SUBOPTIMAL_KHR)
TOSTR_CASE_STRINGIZE(VK_ERROR_OUT_OF_DATE_KHR)
TOSTR_CASE_STRINGIZE(VK_ERROR_INCOMPATIBLE_DISPLAY_KHR)
TOSTR_CASE_STRINGIZE(VK_ERROR_VALIDATION_FAILED_EXT)
default: break;
}
return StringFormat::Fmt("VkResult<%d>", el);
}
template<>
string ToStrHelper<false, VkMemoryType>::Get(const VkMemoryType &el)
{
+11 -1
View File
@@ -499,13 +499,23 @@ uint32_t WrappedVulkan::HandlePreDraw(VkCommandBuffer commandBuffer)
return eventID;
}
const char * WrappedVulkan::GetChunkName(uint32_t idx)
const char *WrappedVulkan::GetChunkName(uint32_t idx)
{
if(idx == CREATE_PARAMS) return "Create Params";
if(idx == THUMBNAIL_DATA) return "Thumbnail Data";
if(idx == DRIVER_INIT_PARAMS) return "Driver Init Params";
if(idx == INITIAL_CONTENTS) return "Initial Contents";
if(idx < FIRST_CHUNK_ID || idx >= NUM_VULKAN_CHUNKS)
return "<unknown>";
return VkChunkNames[idx-FIRST_CHUNK_ID];
}
template<>
string ToStrHelper<false, VulkanChunkType>::Get(const VulkanChunkType &el)
{
return WrappedVulkan::GetChunkName(el);
}
byte *WrappedVulkan::GetTempMemory(size_t s)
{
TempMem *mem = (TempMem *)Threading::GetTLSValue(tempMemoryTLSSlot);
+2 -3
View File
@@ -437,8 +437,6 @@ private:
VulkanCreationInfo m_CreationInfo;
map<ResourceId, vector<EventUsage> > m_ResourceUses;
static const char *GetChunkName(uint32_t idx);
// returns thread-local temporary memory
byte *GetTempMemory(size_t s);
@@ -531,7 +529,8 @@ public:
virtual ~WrappedVulkan();
ResourceId GetContextResourceID() { return m_FrameCaptureRecord->GetResourceID(); }
static const char *GetChunkName(uint32_t idx);
VulkanResourceManager *GetResourceManager() { return m_ResourceManager; }
VulkanDebugManager *GetDebugManager() { return m_DebugManager; }
+6
View File
@@ -1884,6 +1884,12 @@ string ToStrHelper<false, uint32_t>::Get(const uint32_t &el)
return tostrBuf;
}
template<>
string ToStrHelper<false, long>::Get(const long &el)
{
return ToStr::Get((uint64_t)el);
}
template<>
string ToStrHelper<false, char>::Get(const char &el)
{