aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu
diff options
context:
space:
mode:
authorGravatar mtklein <mtklein@chromium.org>2015-11-12 15:44:09 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2015-11-12 15:44:09 -0800
commit1d024a3c909ae5cefa5e8b339e2b52dc73ee85ac (patch)
tree8ae77daf61c105dc68e53a4aa18b2984be2aeb2e /src/gpu
parentc94cd7cc01b655b7f4289537962c36a4ee8dd63e (diff)
Switch uses of SkChecksum::Compute to Murmur3.
SkChecksum::Compute is a very, very poorly distributed hash function. This replaces all remaining uses with Murmur3. The only interesting stuff is in src/gpu. BUG=skia: Review URL: https://codereview.chromium.org/1436973003
Diffstat (limited to 'src/gpu')
-rw-r--r--src/gpu/GrProgramDesc.h3
-rw-r--r--src/gpu/GrResourceCache.cpp8
2 files changed, 5 insertions, 6 deletions
diff --git a/src/gpu/GrProgramDesc.h b/src/gpu/GrProgramDesc.h
index 05b52cc7cd..9641195354 100644
--- a/src/gpu/GrProgramDesc.h
+++ b/src/gpu/GrProgramDesc.h
@@ -107,8 +107,7 @@ protected:
*(this->atOffset<uint32_t, GrProgramDesc::kLengthOffset>()) = SkToU32(keyLength);
uint32_t* checksum = this->atOffset<uint32_t, GrProgramDesc::kChecksumOffset>();
- *checksum = 0;
- *checksum = SkChecksum::Compute(reinterpret_cast<uint32_t*>(fKey.begin()), keyLength);
+ *checksum = SkChecksum::Murmur3(fKey.begin(), keyLength);
}
// The key, stored in fKey, is composed of four parts:
diff --git a/src/gpu/GrResourceCache.cpp b/src/gpu/GrResourceCache.cpp
index cb6bcf75fd..4a0c9b2b36 100644
--- a/src/gpu/GrResourceCache.cpp
+++ b/src/gpu/GrResourceCache.cpp
@@ -42,7 +42,7 @@ GrUniqueKey::Domain GrUniqueKey::GenerateDomain() {
}
uint32_t GrResourceKeyHash(const uint32_t* data, size_t size) {
- return SkChecksum::Compute(data, size);
+ return SkChecksum::Murmur3(data, size);
}
//////////////////////////////////////////////////////////////////////////////
@@ -564,7 +564,7 @@ uint32_t GrResourceCache::getNextTimestamp() {
int currP = 0;
int currNP = 0;
while (currP < sortedPurgeableResources.count() &&
- currNP < fNonpurgeableResources.count()) {
+ currNP < fNonpurgeableResources.count()) {
uint32_t tsP = sortedPurgeableResources[currP]->cacheAccess().timestamp();
uint32_t tsNP = fNonpurgeableResources[currNP]->cacheAccess().timestamp();
SkASSERT(tsP != tsNP);
@@ -596,10 +596,10 @@ uint32_t GrResourceCache::getNextTimestamp() {
// count should be the next timestamp we return.
SkASSERT(fTimestamp == SkToU32(count));
-
+
// The historical timestamps of flushes are now invalid.
this->resetFlushTimestamps();
- }
+ }
}
return fTimestamp++;
}