layers: Fix GH 1639.
authorJeremy Hayes <jeremy@lunarg.com>
Tue, 4 Apr 2017 21:05:52 +0000 (15:05 -0600)
committerMark Lobodzinski <mark@lunarg.com>
Wed, 5 Apr 2017 20:58:41 +0000 (14:58 -0600)
Check base+count instead of just base. Fix FramebufferCreateErrors test
to use the correct number of mip levels. Also, add a test for count,
fix a few function names, and apply some soothing const cream.

Change-Id: Ib2deb8bc27e76138f83b3dd32529583a30085cda

layers/buffer_validation.cpp

index f020768..dbe7255 100644 (file)
@@ -2450,7 +2450,8 @@ bool PreCallValidateCreateImageView(layer_data *device_data, const VkImageViewCr
         // If this isn't a sparse image, it needs to have memory backing it at CreateImageView time
         skip |= ValidateMemoryIsBoundToImage(device_data, image_state, "vkCreateImageView()", VALIDATION_ERROR_02524);
         // Checks imported from image layer
-        if (create_info->subresourceRange.baseMipLevel >= image_state->createInfo.mipLevels) {
+        if ((create_info->subresourceRange.baseMipLevel + create_info->subresourceRange.levelCount) >
+            image_state->createInfo.mipLevels) {
             std::stringstream ss;
             ss << "vkCreateImageView called with baseMipLevel " << create_info->subresourceRange.baseMipLevel << " for image "
                << create_info->image << " that only has " << image_state->createInfo.mipLevels << " mip levels.";