aboutsummaryrefslogtreecommitdiff
path: root/layers
diff options
context:
space:
mode:
authorMichael Lentine <mlentine@google.com>2016-02-18 10:07:26 -0600
committerJon Ashburn <jon@lunarg.com>2016-02-18 15:42:04 -0700
commiteeca80378f04f6b5d28508003091a4ebaff8ca67 (patch)
tree69ac7558816375995d41c3352c69311cc16c8573 /layers
parentdea1e9f07370e3ef0eb0031f6dd39a8876425c1d (diff)
downloadusermoji-eeca80378f04f6b5d28508003091a4ebaff8ca67.tar.xz
layers: Fix android build and update hash.
Update android build code to fix generated paramchecker. Fix draw_state custom hash algorithm for ImageSubresourcePair.
Diffstat (limited to 'layers')
-rwxr-xr-xlayers/draw_state.h21
1 files changed, 8 insertions, 13 deletions
diff --git a/layers/draw_state.h b/layers/draw_state.h
index 320668c7..c7435c4c 100755
--- a/layers/draw_state.h
+++ b/layers/draw_state.h
@@ -581,9 +581,8 @@ struct ImageSubresourcePair {
};
bool operator==(const ImageSubresourcePair &img1, const ImageSubresourcePair &img2) {
- return (img1.image == img2.image &&
- img1.hasSubresource == img2.hasSubresource &&
- img1.subresource.aspectMask == img2.subresource.aspectMask &&
+ if (img1.image != img2.image || img1.hasSubresource != img2.hasSubresource) return false;
+ return !img1.hasSubresource || (img1.subresource.aspectMask == img2.subresource.aspectMask &&
img1.subresource.mipLevel == img2.subresource.mipLevel &&
img1.subresource.arrayLayer == img2.subresource.arrayLayer);
}
@@ -593,16 +592,12 @@ template <> struct hash<ImageSubresourcePair> {
size_t operator()(ImageSubresourcePair img) const throw() {
size_t hashVal =
hash<uint64_t>()(reinterpret_cast<uint64_t &>(img.image));
- hashVal ^=
- hash<uint32_t>()(reinterpret_cast<uint32_t &>(img.hasSubresource)) +
- 0x9e3779b9 + (hashVal << 6) + (hashVal >> 2);
- hashVal ^= hash<uint32_t>()(reinterpret_cast<uint32_t &>(
- img.subresource.aspectMask)) +
- 0x9e3779b9 + (hashVal << 6) + (hashVal >> 2);
- hashVal ^= hash<uint32_t>()(img.subresource.mipLevel) + 0x9e3779b9 +
- (hashVal << 6) + (hashVal >> 2);
- hashVal ^= hash<uint32_t>()(img.subresource.arrayLayer) + 0x9e3779b9 +
- (hashVal << 6) + (hashVal >> 2);
+ hashVal ^= hash<bool>()(img.hasSubresource);
+ if (img.hasSubresource) {
+ hashVal ^= hash<uint32_t>()(reinterpret_cast<uint32_t &>(img.subresource.aspectMask));
+ hashVal ^= hash<uint32_t>()(img.subresource.mipLevel);
+ hashVal ^= hash<uint32_t>()(img.subresource.arrayLayer);
+ }
return hashVal;
}
};