Store DXBCs in WrappedShader for input layouts. Refs #136

* This will allow lazy shader interpretation to just happen in one place
This commit is contained in:
baldurk
2015-09-12 14:41:13 +02:00
parent 1ca3685668
commit 4f67e825cf
4 changed files with 12 additions and 17 deletions
+5 -5
View File
@@ -449,6 +449,11 @@ WrappedID3D11Device::~WrappedID3D11Device()
m_DeviceRecord->Delete(GetResourceManager());
}
for(auto it = m_LayoutShaders.begin(); it != m_LayoutShaders.end(); ++it)
SAFE_DELETE(it->second);
m_LayoutShaders.clear();
m_LayoutDescs.clear();
m_ResourceManager->Shutdown();
SAFE_DELETE(m_ResourceManager);
@@ -459,11 +464,6 @@ WrappedID3D11Device::~WrappedID3D11Device()
SAFE_DELETE(m_pSerialiser);
SAFE_DELETE(m_pDebugSerialiser);
for(auto it=m_LayoutDXBC.begin(); it != m_LayoutDXBC.end(); ++it)
SAFE_DELETE(it->second);
m_LayoutDXBC.clear();
m_LayoutDescs.clear();
if(RenderDoc::Inst().GetCrashHandler())
RenderDoc::Inst().GetCrashHandler()->UnregisterMemoryRegion(this);
+2 -2
View File
@@ -76,6 +76,7 @@ struct D3D11InitParams : public RDCInitParams
};
class WrappedID3D11Device;
class WrappedShader;
// We can pass through all calls to ID3D11Debug without intercepting, this
// struct isonly here so that we can intercept QueryInterface calls to return
@@ -245,7 +246,7 @@ private:
set<WrappedID3D11DeviceContext *> m_DeferredContexts;
map<ID3D11InputLayout *, vector<D3D11_INPUT_ELEMENT_DESC> > m_LayoutDescs;
map<ID3D11InputLayout *, ShaderReflection *> m_LayoutDXBC;
map<ID3D11InputLayout *, WrappedShader*> m_LayoutShaders;
ResourceId m_ReplayDefCtx;
uint32_t m_FirstDefEv;
@@ -308,7 +309,6 @@ public:
void AddDebugMessage(DebugMessage msg) { if(m_State < WRITING) m_DebugMessages.push_back(msg); }
void AddDebugMessage(DebugMessageCategory c, DebugMessageSeverity sv, DebugMessageSource src, std::string d);
const vector<D3D11_INPUT_ELEMENT_DESC> &GetLayoutDesc(ID3D11InputLayout *layout) { return m_LayoutDescs[layout]; }
ShaderReflection *GetLayoutDXBC(ID3D11InputLayout *layout) { return m_LayoutDXBC[layout]; }
void ReleaseSwapchainResources(IDXGISwapChain *swap);
+1 -8
View File
@@ -1127,15 +1127,8 @@ bool WrappedID3D11Device::Serialise_CreateInputLayout(
vector<D3D11_INPUT_ELEMENT_DESC> descvec(layouts, layouts+NumElems);
m_LayoutDescs[ret] = descvec;
m_LayoutDXBC[ret] = NULL;
if(BytecodeLen > 0 && ShaderBytecode)
{
DXBC::DXBCFile *dxbc = new DXBC::DXBCFile(ShaderBytecode, BytecodeLen);
m_LayoutDXBC[ret] = MakeShaderReflection(dxbc);
delete dxbc;
}
m_LayoutShaders[ret] = new WrappedShader(GetIDForResource(ret), new DXBC::DXBCFile(ShaderBytecode, BytecodeLen));
SAFE_DELETE_ARRAY(ShaderBytecode);
}
+4 -2
View File
@@ -447,8 +447,10 @@ D3D11PipelineState D3D11Replay::MakePipelineState()
{
const vector<D3D11_INPUT_ELEMENT_DESC> &vec = m_pDevice->GetLayoutDesc(rs->IA.Layout);
ret.m_IA.layout = rm->GetOriginalID(GetIDForResource(rs->IA.Layout));
ret.m_IA.Bytecode = m_pDevice->GetLayoutDXBC(rs->IA.Layout);
ResourceId layoutId = GetIDForResource(rs->IA.Layout);
ret.m_IA.layout = rm->GetOriginalID(layoutId);
ret.m_IA.Bytecode = GetShader(layoutId);
create_array_uninit(ret.m_IA.layouts, vec.size());