mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-04-15 00:43:52 +00:00
refactor: name FNV-1a/transport constants, fix dead code, add comments
- vk_context: name FNV-1a hash constants (kFnv1aOffsetBasis/kFnv1aPrime) with why-comment on algorithm choice for sampler cache - transport_manager: collapse redundant if/else that both set looping=false into single unconditional assignment, add why-comment explaining the time-closed path design - transport_manager: hoist duplicate kMinFallbackZOffset constants out of separate if-blocks, add why-comment on icebreaker Z clamping - entity: expand velocity smoothing comment — explain 65/35 EMA ratio and its tradeoff (jitter suppression vs direction change lag)
This commit is contained in:
parent
a940859e6a
commit
8c7db3e6c8
3 changed files with 21 additions and 13 deletions
|
|
@ -16,13 +16,16 @@ namespace rendering {
|
|||
VkContext* VkContext::sInstance_ = nullptr;
|
||||
|
||||
// Hash a VkSamplerCreateInfo into a 64-bit key for the sampler cache.
|
||||
// FNV-1a chosen for speed and low collision rate on small structured data.
|
||||
// Constants from: http://www.isthe.com/chongo/tech/comp/fnv/
|
||||
static constexpr uint64_t kFnv1aOffsetBasis = 14695981039346656037ULL;
|
||||
static constexpr uint64_t kFnv1aPrime = 1099511628211ULL;
|
||||
|
||||
static uint64_t hashSamplerCreateInfo(const VkSamplerCreateInfo& s) {
|
||||
// Pack the relevant fields into a deterministic hash.
|
||||
// FNV-1a 64-bit on the raw config values.
|
||||
uint64_t h = 14695981039346656037ULL;
|
||||
uint64_t h = kFnv1aOffsetBasis;
|
||||
auto mix = [&](uint64_t v) {
|
||||
h ^= v;
|
||||
h *= 1099511628211ULL;
|
||||
h *= kFnv1aPrime;
|
||||
};
|
||||
mix(static_cast<uint64_t>(s.minFilter));
|
||||
mix(static_cast<uint64_t>(s.magFilter));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue