aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Forbes <chrisforbes@google.com>2016-08-10 10:41:27 +1200
committerChris Forbes <chrisforbes@google.com>2016-08-11 08:13:56 +1200
commit80730868afdc2b0ba88f99c92f1c4612d349fc7f (patch)
tree74941f3496fea347225f6d7dc264c953c3d56024
parentb32372021aa03371dd54c75147ef6a3fe717e02b (diff)
downloadusermoji-80730868afdc2b0ba88f99c92f1c4612d349fc7f.tar.xz
layers: Adjust color/input attachment layout checks style
For consistency with depth Signed-off-by: Chris Forbes <chrisforbes@google.com>
-rw-r--r--layers/core_validation.cpp72
1 files changed, 46 insertions, 26 deletions
diff --git a/layers/core_validation.cpp b/layers/core_validation.cpp
index 1702721a..c04ec9fa 100644
--- a/layers/core_validation.cpp
+++ b/layers/core_validation.cpp
@@ -9045,26 +9045,36 @@ static bool ValidateLayouts(const layer_data *my_data, VkDevice device, const Vk
if (attach_index == VK_ATTACHMENT_UNUSED)
continue;
- if (subpass.pColorAttachments[j].layout != VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL) {
- if (subpass.pColorAttachments[j].layout == VK_IMAGE_LAYOUT_GENERAL) {
- // TODO: Verify Valid Use in spec. I believe this is allowed (valid) but may not be optimal performance
- skip |= log_msg(my_data->report_data, VK_DEBUG_REPORT_PERFORMANCE_WARNING_BIT_EXT,
- (VkDebugReportObjectTypeEXT)0, 0, __LINE__, DRAWSTATE_INVALID_IMAGE_LAYOUT, "DS",
- "Layout for color attachment is GENERAL but should be COLOR_ATTACHMENT_OPTIMAL.");
- } else {
- skip |= log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__,
- DRAWSTATE_INVALID_IMAGE_LAYOUT, "DS",
- "Layout for color attachment is %s but can only be COLOR_ATTACHMENT_OPTIMAL or GENERAL.",
- string_VkImageLayout(subpass.pColorAttachments[j].layout));
- }
+ switch (subpass.pColorAttachments[j].layout) {
+ case VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL:
+ /* This is ideal. */
+ break;
+
+ case VK_IMAGE_LAYOUT_GENERAL:
+ /* May not be optimal; TODO: reconsider this warning based on
+ * other constraints?
+ */
+ skip |= log_msg(my_data->report_data, VK_DEBUG_REPORT_PERFORMANCE_WARNING_BIT_EXT,
+ VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__,
+ DRAWSTATE_INVALID_IMAGE_LAYOUT, "DS",
+ "Layout for color attachment is GENERAL but should be COLOR_ATTACHMENT_OPTIMAL.");
+ break;
+
+ default:
+ skip |= log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT,
+ VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__,
+ DRAWSTATE_INVALID_IMAGE_LAYOUT, "DS",
+ "Layout for color attachment is %s but can only be COLOR_ATTACHMENT_OPTIMAL or GENERAL.",
+ string_VkImageLayout(subpass.pColorAttachments[j].layout));
}
+
if (attach_first_use[attach_index]) {
skip |= ValidateLayoutVsAttachmentDescription(my_data->report_data, subpass.pColorAttachments[j].layout,
attach_index, pCreateInfo->pAttachments[attach_index]);
}
attach_first_use[attach_index] = false;
}
- if ((subpass.pDepthStencilAttachment != NULL) && (subpass.pDepthStencilAttachment->attachment != VK_ATTACHMENT_UNUSED)) {
+ if (subpass.pDepthStencilAttachment && subpass.pDepthStencilAttachment->attachment != VK_ATTACHMENT_UNUSED) {
switch (subpass.pDepthStencilAttachment->layout) {
case VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL:
case VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL:
@@ -9104,20 +9114,30 @@ static bool ValidateLayouts(const layer_data *my_data, VkDevice device, const Vk
if (attach_index == VK_ATTACHMENT_UNUSED)
continue;
- if (subpass.pInputAttachments[j].layout != VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL &&
- subpass.pInputAttachments[j].layout != VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL) {
- if (subpass.pInputAttachments[j].layout == VK_IMAGE_LAYOUT_GENERAL) {
- // TODO: Verify Valid Use in spec. I believe this is allowed (valid) but may not be optimal performance
- skip |= log_msg(my_data->report_data, VK_DEBUG_REPORT_PERFORMANCE_WARNING_BIT_EXT,
- (VkDebugReportObjectTypeEXT)0, 0, __LINE__, DRAWSTATE_INVALID_IMAGE_LAYOUT, "DS",
- "Layout for input attachment is GENERAL but should be READ_ONLY_OPTIMAL.");
- } else {
- skip |= log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__,
- DRAWSTATE_INVALID_IMAGE_LAYOUT, "DS",
- "Layout for input attachment is %s but can only be READ_ONLY_OPTIMAL or GENERAL.",
- string_VkImageLayout(subpass.pInputAttachments[j].layout));
- }
+ switch (subpass.pInputAttachments[j].layout) {
+ case VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL:
+ case VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL:
+ /* These are ideal. */
+ break;
+
+ case VK_IMAGE_LAYOUT_GENERAL:
+ /* May not be optimal. TODO: reconsider this warning based on
+ * other constraints.
+ */
+ skip |= log_msg(my_data->report_data, VK_DEBUG_REPORT_PERFORMANCE_WARNING_BIT_EXT,
+ VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__,
+ DRAWSTATE_INVALID_IMAGE_LAYOUT, "DS",
+ "Layout for input attachment is GENERAL but should be READ_ONLY_OPTIMAL.");
+ break;
+
+ default:
+ /* No other layouts are acceptable */
+ skip |= log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__,
+ DRAWSTATE_INVALID_IMAGE_LAYOUT, "DS",
+ "Layout for input attachment is %s but can only be READ_ONLY_OPTIMAL or GENERAL.",
+ string_VkImageLayout(subpass.pInputAttachments[j].layout));
}
+
if (attach_first_use[attach_index]) {
skip |= ValidateLayoutVsAttachmentDescription(my_data->report_data, subpass.pInputAttachments[j].layout,
attach_index, pCreateInfo->pAttachments[attach_index]);