aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobin Ehlis <tobine@google.com>2016-10-25 07:58:24 -0600
committerTobin Ehlis <tobine@google.com>2016-10-25 21:02:52 -0600
commit4a6ce204855593f93471d85e5ced9ad41afa000d (patch)
treeceb56c30e60c92785ddf5ca9689636cd7161b4da
parent0c347fc6b08172b778c259e1a1219a2403495d48 (diff)
downloadvulkan-validation-layers-4a6ce204855593f93471d85e5ced9ad41afa000d.tar.gz
tests:Add DuplicateDescriptorBinding test
Test case where descriptor set layout had two bindings with the same value.
-rw-r--r--layers/vk_validation_error_database.txt2
-rw-r--r--tests/layer_validation_tests.cpp35
2 files changed, 36 insertions, 1 deletions
diff --git a/layers/vk_validation_error_database.txt b/layers/vk_validation_error_database.txt
index e7a7d983d..e37c66ec6 100644
--- a/layers/vk_validation_error_database.txt
+++ b/layers/vk_validation_error_database.txt
@@ -2290,5 +2290,5 @@ VALIDATION_ERROR_02341~^~U~^~Unknown~^~vkCreateSwapchainKHR~^~For more informati
VALIDATION_ERROR_02342~^~U~^~Unknown~^~vkQueuePresentKHR~^~For more information refer to Vulkan Spec Section '29.6. WSI Swapchain' which states 'If more than one member of pSwapchains was created from a display surface, all display surfaces referenced that refer to the same display must use the same display mode' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#vkQueuePresentKHR)~^~
VALIDATION_ERROR_02343~^~U~^~Unknown~^~vkCmdDebugMarkerEndEXT~^~For more information refer to Vulkan Spec Section '32.1.2. Command Buffer Markers' which states 'If the matching vkCmdDebugMarkerBeginEXT command was in a secondary command buffer, the vkCmdDebugMarkerEndEXT must be in the same commandBuffer' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#vkCmdDebugMarkerEndEXT)~^~
VALIDATION_ERROR_02344~^~U~^~Unknown~^~vkCreateImage~^~For more information refer to Vulkan Spec Section '11.3. Images' which states 'If imageType is VK_IMAGE_TYPE_3D, arrayLayers must be 1.' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#VkImageCreateInfo)~^~
-VALIDATION_ERROR_02345~^~Y~^~None~^~vkCreateDescriptorSetLayout~^~For more information refer to Vulkan Spec Section '13.2.1. Descriptor Set Layout' which states 'The VkDescriptorSetLayoutBinding::binding members of the elements of the pBindings array must each have different values.' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#VkDescriptorSetLayoutCreateInfo)~^~
+VALIDATION_ERROR_02345~^~Y~^~DuplicateDescriptorBinding~^~vkCreateDescriptorSetLayout~^~For more information refer to Vulkan Spec Section '13.2.1. Descriptor Set Layout' which states 'The VkDescriptorSetLayoutBinding::binding members of the elements of the pBindings array must each have different values.' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#VkDescriptorSetLayoutCreateInfo)~^~
diff --git a/tests/layer_validation_tests.cpp b/tests/layer_validation_tests.cpp
index b2dafbfa4..1ee895730 100644
--- a/tests/layer_validation_tests.cpp
+++ b/tests/layer_validation_tests.cpp
@@ -15574,6 +15574,41 @@ TEST_F(VkPositiveLayerTest, IgnoreUnrelatedDescriptor) {
}
}
+TEST_F(VkLayerTest, DuplicateDescriptorBinding) {
+ TEST_DESCRIPTION("Create a descriptor set layout with a duplicate binding number.");
+
+ ASSERT_NO_FATAL_FAILURE(InitState());
+ // Create layout where two binding #s are "1"
+ static const uint32_t NUM_BINDINGS = 3;
+ VkDescriptorSetLayoutBinding dsl_binding[NUM_BINDINGS] = {};
+ dsl_binding[0].binding = 1;
+ dsl_binding[0].descriptorType = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER;
+ dsl_binding[0].descriptorCount = 1;
+ dsl_binding[0].stageFlags = VK_SHADER_STAGE_FRAGMENT_BIT;
+ dsl_binding[0].pImmutableSamplers = NULL;
+ dsl_binding[1].binding = 0;
+ dsl_binding[1].descriptorCount = 1;
+ dsl_binding[1].descriptorType = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER;
+ dsl_binding[1].descriptorCount = 1;
+ dsl_binding[1].stageFlags = VK_SHADER_STAGE_FRAGMENT_BIT;
+ dsl_binding[1].pImmutableSamplers = NULL;
+ dsl_binding[2].binding = 1; // Duplicate binding should cause error
+ dsl_binding[2].descriptorType = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER;
+ dsl_binding[2].descriptorCount = 1;
+ dsl_binding[2].stageFlags = VK_SHADER_STAGE_FRAGMENT_BIT;
+ dsl_binding[2].pImmutableSamplers = NULL;
+
+ VkDescriptorSetLayoutCreateInfo ds_layout_ci = {};
+ ds_layout_ci.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO;
+ ds_layout_ci.pNext = NULL;
+ ds_layout_ci.bindingCount = NUM_BINDINGS;
+ ds_layout_ci.pBindings = dsl_binding;
+ VkDescriptorSetLayout ds_layout;
+ m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT, VALIDATION_ERROR_02345);
+ vkCreateDescriptorSetLayout(m_device->device(), &ds_layout_ci, NULL, &ds_layout);
+ m_errorMonitor->VerifyFound();
+}
+
// This is a positive test. No failures are expected.
TEST_F(VkPositiveLayerTest, EmptyDescriptorUpdateTest) {
TEST_DESCRIPTION("Update last descriptor in a set that includes an empty binding");