matdbg: Fix material collision (#8322)
Fix 3 bugs wrt matdbg: 1. The numbering scheme for materials with same name was buggy 2. The shared depth variants of the default material should also show up as active material variants. 3. When two instantiation of FMaterial point to the exact same bits, we still need to treat them as two materials. (Otherwise we wouldn't be able to modify one of them in matdbg).
This commit is contained in:
@@ -193,8 +193,12 @@ DebugServer::addMaterial(const CString& name, const void* data, size_t size, voi
|
||||
return {};
|
||||
}
|
||||
|
||||
const uint32_t seed = 42;
|
||||
const MaterialKey key = utils::hash::murmurSlow((const uint8_t*) data, size, seed);
|
||||
// Note that it's possible to have two materials with the exact same content (however wasteful),
|
||||
// but they refer to different instantiation of FMaterial. Hence we hash on userdata and the
|
||||
// material data.
|
||||
constexpr uint32_t seed = 42;
|
||||
uint64_t dataSpace[2] = {(uint64_t) data, (uint64_t) userdata};
|
||||
uint32_t const key = utils::hash::murmur3((const uint32_t*) dataSpace, sizeof(dataSpace), seed);
|
||||
|
||||
// Retain a copy of the package to permit queries after the client application has
|
||||
// freed up the original material package.
|
||||
|
||||
Reference in New Issue
Block a user