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.
This commit is contained in:
baldurk
2014-07-05 12:49:14 +01:00
parent 344d927c03
commit 6cb65e8569
+12 -5
View File
@@ -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,