Re-hash container after modifying program

This commit is contained in:
baldurk
2021-07-13 17:04:21 +01:00
parent 3101334b85
commit 48fa6034ce
2 changed files with 4 additions and 4 deletions
@@ -652,7 +652,7 @@ void DXBCContainer::FillStateInstructionInfo(ShaderDebugState &state) const
}
}
void DXBCContainer::ReplaceProgram(bytebuf &ByteCode, DXBCBytecode::Program *program)
void DXBCContainer::ReplaceDXBCBytecode(bytebuf &ByteCode, const rdcarray<uint32_t> &replacement)
{
FileHeader *header = (FileHeader *)ByteCode.data();
@@ -665,8 +665,6 @@ void DXBCContainer::ReplaceProgram(bytebuf &ByteCode, DXBCBytecode::Program *pro
uint32_t *chunkOffsets =
(uint32_t *)(ByteCode.data() + sizeof(FileHeader)); // right after the header
rdcarray<uint32_t> replacement = program->EncodeProgram();
for(uint32_t chunkIdx = 0; chunkIdx < header->numChunks; chunkIdx++)
{
uint32_t offs = chunkOffsets[chunkIdx];
@@ -710,6 +708,8 @@ void DXBCContainer::ReplaceProgram(bytebuf &ByteCode, DXBCBytecode::Program *pro
break;
}
}
HashContainer(ByteCode.data(), ByteCode.size());
}
void DXBCContainer::GetHash(uint32_t hash[4], const void *ByteCode, size_t BytecodeLength)
@@ -163,7 +163,7 @@ public:
void FillTraceLineInfo(ShaderDebugTrace &trace) const;
void FillStateInstructionInfo(ShaderDebugState &state) const;
static void ReplaceProgram(bytebuf &ByteCode, DXBCBytecode::Program *program);
static void ReplaceDXBCBytecode(bytebuf &ByteCode, const rdcarray<uint32_t> &replacement);
const DXBCBytecode::Program *GetDXBCByteCode() const { return m_DXBCByteCode; }
DXBCBytecode::Program *GetDXBCByteCode() { return m_DXBCByteCode; }