From eeca80378f04f6b5d28508003091a4ebaff8ca67 Mon Sep 17 00:00:00 2001 From: Michael Lentine Date: Thu, 18 Feb 2016 10:07:26 -0600 Subject: layers: Fix android build and update hash. Update android build code to fix generated paramchecker. Fix draw_state custom hash algorithm for ImageSubresourcePair. --- layers/draw_state.h | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) (limited to 'layers') 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 { size_t operator()(ImageSubresourcePair img) const throw() { size_t hashVal = hash()(reinterpret_cast(img.image)); - hashVal ^= - hash()(reinterpret_cast(img.hasSubresource)) + - 0x9e3779b9 + (hashVal << 6) + (hashVal >> 2); - hashVal ^= hash()(reinterpret_cast( - img.subresource.aspectMask)) + - 0x9e3779b9 + (hashVal << 6) + (hashVal >> 2); - hashVal ^= hash()(img.subresource.mipLevel) + 0x9e3779b9 + - (hashVal << 6) + (hashVal >> 2); - hashVal ^= hash()(img.subresource.arrayLayer) + 0x9e3779b9 + - (hashVal << 6) + (hashVal >> 2); + hashVal ^= hash()(img.hasSubresource); + if (img.hasSubresource) { + hashVal ^= hash()(reinterpret_cast(img.subresource.aspectMask)); + hashVal ^= hash()(img.subresource.mipLevel); + hashVal ^= hash()(img.subresource.arrayLayer); + } return hashVal; } }; -- cgit v1.2.3