Commit 67f5ce42 by Geoff Lang Committed by Commit Bot

Fix the texture completeness cache.

Two silly mistakes were landed in 9aded1: * The cache was not updating the sampler state it was using to compare against new ones. * The SamplerCompletenessCache entry was being copied and not updated. BUG=709980 Change-Id: I1914ed30e24b9e48c4504da164f013a637a0b6c2 Reviewed-on: https://chromium-review.googlesource.com/475752Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarCorentin Wallez <cwallez@chromium.org> Commit-Queue: Geoff Lang <geofflang@chromium.org>
parent 1e5499db
...@@ -200,6 +200,7 @@ bool TextureState::isCubeComplete() const ...@@ -200,6 +200,7 @@ bool TextureState::isCubeComplete() const
bool TextureState::isSamplerComplete(const SamplerState &samplerState, bool TextureState::isSamplerComplete(const SamplerState &samplerState,
const ContextState &data) const const ContextState &data) const
{ {
bool newEntry = false;
auto cacheIter = mCompletenessCache.find(data.getContextID()); auto cacheIter = mCompletenessCache.find(data.getContextID());
if (cacheIter == mCompletenessCache.end()) if (cacheIter == mCompletenessCache.end())
{ {
...@@ -207,16 +208,17 @@ bool TextureState::isSamplerComplete(const SamplerState &samplerState, ...@@ -207,16 +208,17 @@ bool TextureState::isSamplerComplete(const SamplerState &samplerState,
cacheIter = mCompletenessCache cacheIter = mCompletenessCache
.insert(std::make_pair(data.getContextID(), SamplerCompletenessCache())) .insert(std::make_pair(data.getContextID(), SamplerCompletenessCache()))
.first; .first;
newEntry = true;
} }
auto cacheEntry = cacheIter->second; SamplerCompletenessCache *cacheEntry = &cacheIter->second;
if (!cacheEntry.cacheValid || cacheEntry.samplerState != samplerState) if (newEntry || cacheEntry->samplerState != samplerState)
{ {
cacheEntry.cacheValid = true; cacheEntry->samplerState = samplerState;
cacheEntry.samplerComplete = computeSamplerCompleteness(samplerState, data); cacheEntry->samplerComplete = computeSamplerCompleteness(samplerState, data);
} }
return cacheEntry.samplerComplete; return cacheEntry->samplerComplete;
} }
void TextureState::invalidateCompletenessCache() void TextureState::invalidateCompletenessCache()
...@@ -507,9 +509,7 @@ void TextureState::clearImageDescs() ...@@ -507,9 +509,7 @@ void TextureState::clearImageDescs()
} }
TextureState::SamplerCompletenessCache::SamplerCompletenessCache() TextureState::SamplerCompletenessCache::SamplerCompletenessCache()
: cacheValid(false), : samplerState(), samplerComplete(false)
samplerState(),
samplerComplete(false)
{ {
} }
......
...@@ -159,8 +159,6 @@ struct TextureState final : public angle::NonCopyable ...@@ -159,8 +159,6 @@ struct TextureState final : public angle::NonCopyable
{ {
SamplerCompletenessCache(); SamplerCompletenessCache();
bool cacheValid;
// All values that affect sampler completeness that are not stored within // All values that affect sampler completeness that are not stored within
// the texture itself // the texture itself
SamplerState samplerState; SamplerState samplerState;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment