Remove direct access to DXBC container blob

This commit is contained in:
baldurk
2021-07-12 17:39:44 +01:00
parent ee73091d54
commit f5db9fd19d
4 changed files with 12 additions and 12 deletions
+2 -2
View File
@@ -290,7 +290,7 @@ void D3D11Replay::InitPostVSBuffers(uint32_t eventId)
}
HRESULT hr = m_pDevice->CreateGeometryShaderWithStreamOutput(
(void *)&dxbcVS->m_ShaderBlob[0], dxbcVS->m_ShaderBlob.size(), &sodecls[0],
(void *)dxbcVS->GetShaderBlob().data(), dxbcVS->GetShaderBlob().size(), &sodecls[0],
(UINT)sodecls.size(), &stride, 1, D3D11_SO_NO_RASTERIZED_STREAM, NULL, &streamoutGS);
if(FAILED(hr))
@@ -688,7 +688,7 @@ void D3D11Replay::InitPostVSBuffers(uint32_t eventId)
streamoutGS = NULL;
HRESULT hr = m_pDevice->CreateGeometryShaderWithStreamOutput(
(void *)&lastShader->m_ShaderBlob[0], lastShader->m_ShaderBlob.size(), &sodecls[0],
(void *)lastShader->GetShaderBlob().data(), lastShader->GetShaderBlob().size(), &sodecls[0],
(UINT)sodecls.size(), &stride, 1, D3D11_SO_NO_RASTERIZED_STREAM, NULL, &streamoutGS);
if(FAILED(hr))
@@ -1145,15 +1145,15 @@ void DXBCContainer::TryFetchSeparateDebugInfo(bytebuf &byteCode, const rdcstr &d
}
}
DXBCContainer::DXBCContainer(bytebuf &ByteCode, const rdcstr &debugInfoPath, GraphicsAPI api,
DXBCContainer::DXBCContainer(const bytebuf &ByteCode, const rdcstr &debugInfoPath, GraphicsAPI api,
uint32_t shaderExtReg, uint32_t shaderExtSpace)
{
RDCEraseEl(m_ShaderStats);
TryFetchSeparateDebugInfo(ByteCode, debugInfoPath);
m_ShaderBlob = ByteCode;
TryFetchSeparateDebugInfo(m_ShaderBlob, debugInfoPath);
// just for convenience
char *data = (char *)m_ShaderBlob.data();
char *debugData = (char *)m_DebugShaderBlob.data();
@@ -1164,7 +1164,7 @@ DXBCContainer::DXBCContainer(bytebuf &ByteCode, const rdcstr &debugInfoPath, Gra
if(header->fourcc != FOURCC_DXBC)
return;
if(header->fileLength != (uint32_t)ByteCode.size())
if(header->fileLength != (uint32_t)m_ShaderBlob.size())
return;
if(debugHeader && debugHeader->fourcc != FOURCC_DXBC)
@@ -1370,7 +1370,7 @@ DXBCContainer::DXBCContainer(bytebuf &ByteCode, const rdcstr &debugInfoPath, Gra
RDEFCBufferVariable *var =
(RDEFCBufferVariable *)(chunkContents + cbuf->variables.offset + varStride);
if(var->nameOffset > ByteCode.size())
if(var->nameOffset > m_ShaderBlob.size())
{
varStride += extraData;
}
@@ -1382,7 +1382,7 @@ DXBCContainer::DXBCContainer(bytebuf &ByteCode, const rdcstr &debugInfoPath, Gra
RDEFCBufferVariable *var =
(RDEFCBufferVariable *)(chunkContents + cbuf->variables.offset + vi * varStride);
RDCASSERT(var->nameOffset < ByteCode.size());
RDCASSERT(var->nameOffset < m_ShaderBlob.size());
CBufferVariable v;
@@ -143,7 +143,7 @@ ShaderCompileFlags EncodeFlags(const uint32_t flags, const rdcstr &profile);
class DXBCContainer
{
public:
DXBCContainer(bytebuf &ByteCode, const rdcstr &debugInfoPath, GraphicsAPI api,
DXBCContainer(const bytebuf &ByteCode, const rdcstr &debugInfoPath, GraphicsAPI api,
uint32_t shaderExtReg, uint32_t shaderExtSpace);
~DXBCContainer();
DXBCContainer(const DXBCContainer &o) = delete;
@@ -156,8 +156,7 @@ public:
uint32_t Major = 0, Minor = 0;
} m_Version;
bytebuf m_ShaderBlob;
const bytebuf &GetShaderBlob() const { return m_ShaderBlob; }
const IDebugInfo *GetDebugInfo() const { return m_DebugInfo; }
const Reflection *GetReflection() const { return m_Reflection; }
D3D_PRIMITIVE_TOPOLOGY GetOutputTopology();
@@ -187,6 +186,7 @@ private:
void TryFetchSeparateDebugInfo(bytebuf &byteCode, const rdcstr &debugInfoPath);
bytebuf m_DebugShaderBlob;
bytebuf m_ShaderBlob;
rdcstr m_Disassembly;
@@ -299,7 +299,7 @@ void MakeShaderReflection(DXBC::DXBCContainer *dxbc, ShaderReflection *refl,
}
refl->encoding = ShaderEncoding::DXBC;
refl->rawBytes = dxbc->m_ShaderBlob;
refl->rawBytes = dxbc->GetShaderBlob();
refl->dispatchThreadsDimension[0] = dxbc->GetReflection()->DispatchThreadsDimension[0];
refl->dispatchThreadsDimension[1] = dxbc->GetReflection()->DispatchThreadsDimension[1];