From 6cb65e8569c7158cd5a709826d293ec79a2af625 Mon Sep 17 00:00:00 2001 From: baldurk Date: Sat, 5 Jul 2014 12:49:14 +0100 Subject: [PATCH] Handle SemanticName being NULL in D3D11_SO_DECLARATION_ENTRY * NULL specifies that a gap should be made/skipped in the output data. * This would crash before but now serialises NULL as "" since that's an invalid SemanticName (must be NULL or name a semantic). This will still read old logs fine but old programs will not do the right thing on new logs. --- renderdoc/driver/d3d11/d3d11_common.cpp | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/renderdoc/driver/d3d11/d3d11_common.cpp b/renderdoc/driver/d3d11/d3d11_common.cpp index 251e5840c..a57167909 100644 --- a/renderdoc/driver/d3d11/d3d11_common.cpp +++ b/renderdoc/driver/d3d11/d3d11_common.cpp @@ -1259,17 +1259,24 @@ template<> void Serialiser::Serialise(const char *name, D3D11_SO_DECLARATION_ENT { ScopedContext scope(this, this, name, "D3D11_SO_DECLARATION_ENTRY", 0, true); - string s; - if(m_Mode >= WRITING) + string s = ""; + if(m_Mode >= WRITING && el.SemanticName != NULL) s = el.SemanticName; Serialise("SemanticName", s); if(m_Mode == READING) { - string str = (char *)m_BufferHead-s.length(); - m_StringDB.insert(str); - el.SemanticName = m_StringDB.find(str)->c_str(); + if(s == "") + { + el.SemanticName = NULL; + } + else + { + string str = (char *)m_BufferHead-s.length(); + m_StringDB.insert(str); + el.SemanticName = m_StringDB.find(str)->c_str(); + } } // so we can just take a char* into the buffer above for the semantic name,