Skip to content

Commit f7eccf0

Browse files
committed
Implement DXBC ReplaceChunk adding a new chunk if it's not present
1 parent a232dc9 commit f7eccf0

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

renderdoc/driver/shaders/dxbc/dxbc_container.cpp

+14
Original file line numberDiff line numberDiff line change
@@ -743,6 +743,20 @@ void DXBCContainer::ReplaceChunk(bytebuf &ByteCode, uint32_t fourcc, const byte
743743
return;
744744
}
745745
}
746+
747+
uint32_t newOffs = uint32_t(ByteCode.size() + sizeof(uint32_t));
748+
ByteCode.insert(sizeof(FileHeader) + header->numChunks * sizeof(uint32_t), (byte *)&newOffs,
749+
sizeof(newOffs));
750+
751+
for(uint32_t chunkIdx = 0; chunkIdx < header->numChunks; chunkIdx++)
752+
chunkOffsets[chunkIdx] += sizeof(uint32_t);
753+
754+
ByteCode.append(replacement, size);
755+
756+
header->numChunks++;
757+
header->fileLength = (uint32_t)ByteCode.size();
758+
759+
HashContainer(ByteCode.data(), ByteCode.size());
746760
}
747761

748762
const byte *DXBCContainer::FindChunk(const bytebuf &ByteCode, uint32_t fourcc, size_t &size)

0 commit comments

Comments
 (0)