1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2025-01-19 05:52:11 +01:00

[d3d11] Fix hasing of geometry shaders with stream output

The xfb struct contains pointers, but we should hash the
strings instead, otherwise the hash changes between runs.
This commit is contained in:
Philip Rebohle 2019-04-15 03:09:31 +02:00
parent ca717eeb62
commit f9e56c97cf
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99

View File

@ -676,11 +676,22 @@ namespace dxvk {
// Compute hash from both the xfb info and the source
// code, because both influence the generated code
std::array<Sha1Data, 2> chunks = {{
{ pShaderBytecode, BytecodeLength },
{ &xfb, sizeof(xfb) },
DxbcXfbInfo hashXfb = xfb;
std::vector<Sha1Data> chunks = {{
{ pShaderBytecode, BytecodeLength },
{ &hashXfb, sizeof(hashXfb) },
}};
for (uint32_t i = 0; i < hashXfb.entryCount; i++) {
const char* semantic = hashXfb.entries[i].semanticName;
if (semantic) {
chunks.push_back({ semantic, std::strlen(semantic) });
hashXfb.entries[i].semanticName = nullptr;
}
}
Sha1Hash hash = Sha1Hash::compute(chunks.size(), chunks.data());
// Create the actual shader module