diff options
| author | Tobin Ehlis <tobine@google.com> | 2016-06-15 13:03:58 -0600 |
|---|---|---|
| committer | Tobin Ehlis <tobine@google.com> | 2016-06-20 14:36:35 -0600 |
| commit | 371f0b105779366a74008b2da43bf1286c0752f0 (patch) | |
| tree | eb79a0dd39d0392d61f0df2adc699bd25e13faf9 /layers/descriptor_sets.cpp | |
| parent | 50ab22f7fdc6aaf5db23c6594a7e4d25bdd73bd4 (diff) | |
| download | usermoji-371f0b105779366a74008b2da43bf1286c0752f0.tar.xz | |
layers: GH644 Validate DS image aspect bit restriction
If a DS image is used in a descriptor, regardless of the underlying
image layout, we need to validate that BOTH DEPTH and STENCIL aspect
bits are NOT set. Only one of the two bits is allowed.
Diffstat (limited to 'layers/descriptor_sets.cpp')
| -rw-r--r-- | layers/descriptor_sets.cpp | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/layers/descriptor_sets.cpp b/layers/descriptor_sets.cpp index f8bd9cc8..9f3b239d 100644 --- a/layers/descriptor_sets.cpp +++ b/layers/descriptor_sets.cpp @@ -665,7 +665,23 @@ bool cvdescriptorset::ValidateImageUpdate(VkImageView image_view, VkImageLayout } break; default: - // anything to check for other layouts? + // For other layouts if the source is ds image, both aspect bits must not be set + if (ds) { + if (aspect_mask & VK_IMAGE_ASPECT_DEPTH_BIT) { + if (aspect_mask & VK_IMAGE_ASPECT_STENCIL_BIT) { + // both must NOT be set + std::stringstream error_str; + error_str << "ImageView (" << image_view << ") has layout " << string_VkImageLayout(image_layout) + << " and is using depth/stencil image of format " << string_VkFormat(format) + << " but it has both STENCIL and DEPTH aspects set, which is illegal. When using a depth/stencil " + "image in a descriptor set, please only set either VK_IMAGE_ASPECT_DEPTH_BIT or " + "VK_IMAGE_ASPECT_STENCIL_BIT depending on whether it will be used for depth reads or stencil " + "reads respectively."; + *error = error_str.str(); + return false; + } + } + } break; } // Now validate that usage flags are correctly set for given type of update |
