diff --git a/renderdoc/driver/d3d11/d3d11_device.cpp b/renderdoc/driver/d3d11/d3d11_device.cpp index 65cdc2da9..e2d81e8db 100644 --- a/renderdoc/driver/d3d11/d3d11_device.cpp +++ b/renderdoc/driver/d3d11/d3d11_device.cpp @@ -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; diff --git a/renderdoc/driver/d3d11/d3d11_device.h b/renderdoc/driver/d3d11/d3d11_device.h index 8d47e3e73..3ce2af1f8 100644 --- a/renderdoc/driver/d3d11/d3d11_device.h +++ b/renderdoc/driver/d3d11/d3d11_device.h @@ -450,6 +450,7 @@ public: return m_LayoutDescs[layout]; } + vector *GetShaderDebugInfoSearchPaths() { return &m_ShaderSearchPaths; } void Serialise_CaptureScope(uint64_t offset); void StartFrameCapture(void *dev, void *wnd); diff --git a/renderdoc/driver/d3d11/d3d11_device_wrap.cpp b/renderdoc/driver/d3d11/d3d11_device_wrap.cpp index 081e121b4..ea487730b 100644 --- a/renderdoc/driver/d3d11/d3d11_device_wrap.cpp +++ b/renderdoc/driver/d3d11/d3d11_device_wrap.cpp @@ -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); } diff --git a/renderdoc/driver/d3d11/d3d11_resources.h b/renderdoc/driver/d3d11/d3d11_resources.h index 7f57d8086..7e44d2e29 100644 --- a/renderdoc/driver/d3d11/d3d11_resources.h +++ b/renderdoc/driver/d3d11/d3d11_resources.h @@ -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 *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 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(real, device), - WrappedShader(GetResourceID(), code, codeLen) + WrappedShader(device, GetResourceID(), code, codeLen) { } virtual ~WrappedID3D11Shader() { Shutdown(); }