aboutsummaryrefslogtreecommitdiff
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
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.
-rwxr-xr-xbuildAndroid/android-generate.sh2
-rwxr-xr-xlayers/draw_state.h21
2 files changed, 9 insertions, 14 deletions
diff --git a/buildAndroid/android-generate.sh b/buildAndroid/android-generate.sh
index 496e349f..5f980681 100755
--- a/buildAndroid/android-generate.sh
+++ b/buildAndroid/android-generate.sh
@@ -25,5 +25,5 @@ python ../vk_helper.py --gen_struct_wrappers ../include/vulkan/vulkan.h --abs_ou
python ../vk-layer-generate.py object_tracker ../include/vulkan/vulkan.h > generated/object_tracker.cpp
python ../vk-layer-generate.py unique_objects ../include/vulkan/vulkan.h > generated/unique_objects.cpp
( cd generated; python ../../genvk.py threading -registry ../../vk.xml thread_check.h )
-( cd generated; python ../../genvk.py ParamCheck -registry ../../vk.xml param_check.h )
+( cd generated; python ../../genvk.py paramchecker -registry ../../vk.xml param_check.h )
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;
}
};