mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-21 10:49:14 +00:00
Pipeline caching: refactor object hashing
Dawn's object-based cache creates keys from memory addresses. These keys cannot be used in a persistent cache. This change modifies the keys to only use hashes so they can be re-used for caching pipelines. BUG=dawn:549 Change-Id: Ica64d58ae6a3c6266435cfc3f776c820190f7895 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/30740 Reviewed-by: Austin Eng <enga@chromium.org> Commit-Queue: Bryan Bernhart <bryan.bernhart@intel.com>
This commit is contained in:
committed by
Commit Bot service account
parent
fe129405cf
commit
24bf7a4fbb
@@ -14,8 +14,8 @@
|
||||
|
||||
#include "dawn_native/Sampler.h"
|
||||
|
||||
#include "common/HashUtils.h"
|
||||
#include "dawn_native/Device.h"
|
||||
#include "dawn_native/ObjectContentHasher.h"
|
||||
#include "dawn_native/ValidationUtils_autogen.h"
|
||||
|
||||
#include <cmath>
|
||||
@@ -84,20 +84,11 @@ namespace dawn_native {
|
||||
return mCompareFunction != wgpu::CompareFunction::Undefined;
|
||||
}
|
||||
|
||||
size_t SamplerBase::HashFunc::operator()(const SamplerBase* module) const {
|
||||
size_t hash = 0;
|
||||
|
||||
HashCombine(&hash, module->mAddressModeU);
|
||||
HashCombine(&hash, module->mAddressModeV);
|
||||
HashCombine(&hash, module->mAddressModeW);
|
||||
HashCombine(&hash, module->mMagFilter);
|
||||
HashCombine(&hash, module->mMinFilter);
|
||||
HashCombine(&hash, module->mMipmapFilter);
|
||||
HashCombine(&hash, module->mLodMinClamp);
|
||||
HashCombine(&hash, module->mLodMaxClamp);
|
||||
HashCombine(&hash, module->mCompareFunction);
|
||||
|
||||
return hash;
|
||||
size_t SamplerBase::ComputeContentHash() {
|
||||
ObjectContentHasher recorder;
|
||||
recorder.Record(mAddressModeU, mAddressModeV, mAddressModeW, mMagFilter, mMinFilter,
|
||||
mMipmapFilter, mLodMinClamp, mLodMaxClamp, mCompareFunction);
|
||||
return recorder.GetContentHash();
|
||||
}
|
||||
|
||||
bool SamplerBase::EqualityFunc::operator()(const SamplerBase* a, const SamplerBase* b) const {
|
||||
|
||||
Reference in New Issue
Block a user