diff options
author | Henri Beauchamp <sldev@free.fr> | 2023-11-30 13:23:57 +0100 |
---|---|---|
committer | Andrey Lihatskiy <alihatskiy@productengine.com> | 2023-12-06 03:42:09 +0200 |
commit | 8eb2d17c7715dbe72d4719d7ed3dd05f8cb4b65e (patch) | |
tree | 44d730cbd2a3721fc796c9fb307585edd23d9cf0 /indra/llcorehttp/_httpopsetpriority.cpp | |
parent | 683bf84bb38adc88d4a4b7fedaed89b41fcac45e (diff) |
Fix LLGLTFMaterial hashing
This PR fixes the non-working material hashing for LLGLTFMaterial instances.
There are several issues in the current code, stemming to the fact that the hashing is performed on the block of the member variables:
1.- There are padding bytes between member variables, even after rearranging them to avoid most of the padding; in particular, the std::array's size is not a multiple of 4 bytes (64 bits), and most compilers will pad them to the next 4-byte aligment as a result. Note that C++ standards do not impose the zeroing of padding bytes on construction of a class instance, with only a couple exceptions (such as explicit zero-initialization). Those bytes MUST therefore be zeroed by us on construction.
2.- The TextureTransform strutcure getPacked() method did not touch some of the packed bytes, and as a result could *potentially* cause an issue for hashing when applied to a transform of another material instance.
3.- With the recent addition of the local textures tracking map, the said map cannot be hashed as a block of memory (map pairs will typically be allocated on the heap or on the stack, not in the memory block used by member variables).
This PR solves all these issues and offers proper hashing of LLGLTFMaterial instances.
Diffstat (limited to 'indra/llcorehttp/_httpopsetpriority.cpp')
0 files changed, 0 insertions, 0 deletions