Make sure shader info search paths are always available. Refs #572

* Previously they were only set when replaying a recorded SetPrivateData
  which meant any blob paths specified in the private blob part didn't
  have the search paths configured for locating relative paths.
This commit is contained in:
baldurk
2017-04-17 12:28:13 +01:00
parent 8983e67dc2
commit 1be2e1086a
4 changed files with 11 additions and 13 deletions
+1 -1
View File
@@ -3445,7 +3445,7 @@ bool WrappedID3D11Device::Serialise_SetShaderDebugPath(ID3D11DeviceChild *res, c
auto it = WrappedShader::m_ShaderList.find(GetResourceManager()->GetLiveID(resource));
if(it != WrappedShader::m_ShaderList.end())
it->second->SetDebugInfoPath(&m_ShaderSearchPaths, debugPath);
it->second->SetDebugInfoPath(debugPath);
}
return true;
+1
View File
@@ -450,6 +450,7 @@ public:
return m_LayoutDescs[layout];
}
vector<string> *GetShaderDebugInfoSearchPaths() { return &m_ShaderSearchPaths; }
void Serialise_CaptureScope(uint64_t offset);
void StartFrameCapture(void *dev, void *wnd);
+2 -1
View File
@@ -1100,7 +1100,8 @@ bool WrappedID3D11Device::Serialise_CreateInputLayout(
m_LayoutDescs[ret] = descvec;
if(BytecodeLen > 0 && ShaderBytecode)
m_LayoutShaders[ret] = new WrappedShader(GetIDForResource(ret), ShaderBytecode, BytecodeLen);
m_LayoutShaders[ret] =
new WrappedShader(this, GetIDForResource(ret), ShaderBytecode, BytecodeLen);
SAFE_DELETE_ARRAY(ShaderBytecode);
}
+7 -11
View File
@@ -896,10 +896,10 @@ public:
{
public:
ShaderEntry() : m_DebugInfoSearchPaths(NULL), m_DXBCFile(NULL), m_Details(NULL) {}
ShaderEntry(const byte *code, size_t codeLen)
ShaderEntry(WrappedID3D11Device *device, const byte *code, size_t codeLen)
{
m_Bytecode.assign(code, code + codeLen);
m_DebugInfoSearchPaths = NULL;
m_DebugInfoSearchPaths = device->GetShaderDebugInfoSearchPaths();
m_DXBCFile = NULL;
m_Details = NULL;
}
@@ -910,12 +910,7 @@ public:
SAFE_DELETE(m_Details);
}
void SetDebugInfoPath(vector<std::string> *searchPaths, const std::string &path)
{
m_DebugInfoSearchPaths = searchPaths;
m_DebugInfoPath = path;
}
void SetDebugInfoPath(const std::string &path) { m_DebugInfoPath = path; }
DXBC::DXBCFile *GetDXBC()
{
if(m_DXBCFile == NULL && !m_Bytecode.empty())
@@ -949,12 +944,13 @@ public:
static map<ResourceId, ShaderEntry *> m_ShaderList;
static Threading::CriticalSection m_ShaderListLock;
WrappedShader(ResourceId id, const byte *code, size_t codeLen) : m_ID(id)
WrappedShader(WrappedID3D11Device *device, ResourceId id, const byte *code, size_t codeLen)
: m_ID(id)
{
SCOPED_LOCK(m_ShaderListLock);
RDCASSERT(m_ShaderList.find(m_ID) == m_ShaderList.end());
m_ShaderList[m_ID] = new ShaderEntry(code, codeLen);
m_ShaderList[m_ID] = new ShaderEntry(device, code, codeLen);
}
virtual ~WrappedShader()
{
@@ -995,7 +991,7 @@ public:
WrappedID3D11Shader(RealShaderType *real, const byte *code, size_t codeLen,
WrappedID3D11Device *device)
: WrappedDeviceChild11<RealShaderType>(real, device),
WrappedShader(GetResourceID(), code, codeLen)
WrappedShader(device, GetResourceID(), code, codeLen)
{
}
virtual ~WrappedID3D11Shader() { Shutdown(); }