Test updating set with an empty binding
authorPaavo Pessi <paavo.pessi@siru.fi>
Thu, 11 Jan 2018 09:52:45 +0000 (11:52 +0200)
committerAlexander Galazin <Alexander.Galazin@arm.com>
Wed, 7 Feb 2018 08:25:55 +0000 (03:25 -0500)
This test matches VkPositiveLayerTest.EmptyDescriptorUpdateTest and
updates the last descriptor in a set that includes an empty binding.
The test doesn't check any results and it passes as long as no crash
happens.

New tests:
dEQP-VK.binding_model.descriptor_update.empty_descriptor.uniform_buffer

Components: Vulkan

VK-GL-CTS issue: 831

Change-Id: I795e08fa516d42d980d7b3b8baba6a1ba4a29ec7

AndroidGen.mk
android/cts/master/vk-master.txt
external/vulkancts/modules/vulkan/binding_model/CMakeLists.txt
external/vulkancts/modules/vulkan/binding_model/vktBindingDescriptorUpdateTests.cpp [new file with mode: 0644]
external/vulkancts/modules/vulkan/binding_model/vktBindingDescriptorUpdateTests.hpp [new file with mode: 0644]
external/vulkancts/modules/vulkan/binding_model/vktBindingModelTests.cpp
external/vulkancts/mustpass/1.0.4/vk-default-no-waivers.txt
external/vulkancts/mustpass/1.0.4/vk-default.txt

index cb11c67..603223e 100644 (file)
@@ -71,6 +71,7 @@ LOCAL_SRC_FILES := \
        external/vulkancts/modules/vulkan/api/vktApiObjectManagementTests.cpp \
        external/vulkancts/modules/vulkan/api/vktApiSmokeTests.cpp \
        external/vulkancts/modules/vulkan/api/vktApiTests.cpp \
+       external/vulkancts/modules/vulkan/binding_model/vktBindingDescriptorUpdateTests.cpp \
        external/vulkancts/modules/vulkan/binding_model/vktBindingModelTests.cpp \
        external/vulkancts/modules/vulkan/binding_model/vktBindingShaderAccessTests.cpp \
        external/vulkancts/modules/vulkan/clipping/vktClippingTests.cpp \
index f5b7ea8..4fccd9f 100644 (file)
@@ -199685,6 +199685,7 @@ dEQP-VK.binding_model.shader_access.secondary_cmd_buf.with_push_template.storage
 dEQP-VK.binding_model.shader_access.secondary_cmd_buf.with_push_template.storage_buffer.vertex_fragment.multiple_arbitrary_descriptors.offset_view_nonzero
 dEQP-VK.binding_model.shader_access.secondary_cmd_buf.with_push_template.storage_buffer.vertex_fragment.descriptor_array.offset_view_zero
 dEQP-VK.binding_model.shader_access.secondary_cmd_buf.with_push_template.storage_buffer.vertex_fragment.descriptor_array.offset_view_nonzero
+dEQP-VK.binding_model.descriptor_update.empty_descriptor.uniform_buffer
 dEQP-VK.spirv_assembly.instruction.compute.localsize.literal_localsize
 dEQP-VK.spirv_assembly.instruction.compute.localsize.literal_and_specid_localsize
 dEQP-VK.spirv_assembly.instruction.compute.localsize.specid_localsize
index fe3e727..d92d451 100644 (file)
@@ -7,6 +7,8 @@ set(DEQP_VK_BINDING_MODEL_SRCS
        vktBindingModelTests.hpp
        vktBindingShaderAccessTests.cpp
        vktBindingShaderAccessTests.hpp
+       vktBindingDescriptorUpdateTests.cpp
+       vktBindingDescriptorUpdateTests.hpp
        )
 
 set(DEQP_VK_BINDING_MODEL_LIBS
diff --git a/external/vulkancts/modules/vulkan/binding_model/vktBindingDescriptorUpdateTests.cpp b/external/vulkancts/modules/vulkan/binding_model/vktBindingDescriptorUpdateTests.cpp
new file mode 100644 (file)
index 0000000..67dfa04
--- /dev/null
@@ -0,0 +1,142 @@
+/*-------------------------------------------------------------------------
+ * Vulkan Conformance Tests
+ * ------------------------
+ *
+ * Copyright (c) 2018 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ *//*!
+ * \file
+ * \brief Tests for descriptor updates.
+ *//*--------------------------------------------------------------------*/
+
+#include "vktBindingDescriptorUpdateTests.hpp"
+
+#include "vktTestCase.hpp"
+#include "vktTestCaseUtil.hpp"
+
+#include "vkRefUtil.hpp"
+#include "vkMemUtil.hpp"
+#include "vkBuilderUtil.hpp"
+#include "vkQueryUtil.hpp"
+
+namespace vkt
+{
+namespace BindingModel
+{
+namespace
+{
+
+// Test matches VkPositiveLayerTest.EmptyDescriptorUpdateTest
+tcu::TestStatus EmptyDescriptorUpdateCase (Context& context)
+{
+       const vk::DeviceInterface&                              vki                                     = context.getDeviceInterface();
+       const vk::VkDevice                                              device                          = context.getDevice();
+       vk::Allocator&                                                  allocator                       = context.getDefaultAllocator();
+
+       // Create layout with two uniform buffer descriptors w/ empty binding between them
+       vk::DescriptorSetLayoutBuilder                  builder;
+
+       builder.addSingleBinding(vk::VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, vk::VK_SHADER_STAGE_ALL);
+       builder.addBinding(vk::VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 0, (vk::VkShaderStageFlags)0, DE_NULL);
+       builder.addSingleBinding(vk::VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, vk::VK_SHADER_STAGE_ALL);
+
+       vk::Unique<vk::VkDescriptorSetLayout>   layout                          (builder.build(vki, device, (vk::VkDescriptorSetLayoutCreateFlags)0));
+
+       // Create descriptor pool
+       vk::Unique<vk::VkDescriptorPool>                descriptorPool          (vk::DescriptorPoolBuilder().addType(vk::VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 2).build(vki, device, vk::VK_DESCRIPTOR_POOL_CREATE_FREE_DESCRIPTOR_SET_BIT, 1));
+
+       // Create descriptor set
+       const vk::VkDescriptorSetAllocateInfo   setAllocateInfo         =
+       {
+               vk::VK_STRUCTURE_TYPE_DESCRIPTOR_SET_ALLOCATE_INFO,     // VkStructureType                              sType
+               DE_NULL,                                                                                        // const void*                                  pNext
+               *descriptorPool,                                                                        // VkDescriptorPool                             descriptorPool
+               1,                                                                                                      // deUint32                                             descriptorSetCount
+               &layout.get()                                                                           // const VkDescriptorSetLayout* pSetLayouts
+       };
+
+       vk::Unique<vk::VkDescriptorSet>                 descriptorSet           (allocateDescriptorSet(vki, device, &setAllocateInfo));
+
+       // Create a buffer to be used for update
+       const vk::VkBufferCreateInfo                    bufferCreateInfo        =
+       {
+               vk::VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO,       // VkStructureType              sType
+               DE_NULL,                                                                        // const void*                  pNext
+               (vk::VkBufferCreateFlags)DE_NULL,                       // VkBufferCreateFlags  flags
+               256,                                                                            // VkDeviceSize                 size
+               vk::VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT,         // VkBufferUsageFlags   usage
+               vk::VK_SHARING_MODE_EXCLUSIVE,                          // VkSharingMode                sharingMode
+               0,                                                                                      // deUint32                             queueFamilyIndexCount
+               DE_NULL                                                                         // const deUint32*              pQueueFamilyIndices
+       };
+
+       vk::Unique<vk::VkBuffer>                                buffer                          (createBuffer(vki, device, &bufferCreateInfo));
+       const vk::VkMemoryRequirements                  requirements            = vk::getBufferMemoryRequirements(vki, device, *buffer);
+       de::MovePtr<vk::Allocation>                             allocation                      = allocator.allocate(requirements, vk::MemoryRequirement::Any);
+
+       VK_CHECK(vki.bindBufferMemory(device, *buffer, allocation->getMemory(), allocation->getOffset()));
+
+       // Only update the descriptor at binding 2
+       const vk::VkDescriptorBufferInfo                descriptorInfo          =
+       {
+               *buffer,                // VkBuffer             buffer
+               0,                              // VkDeviceSize offset
+               VK_WHOLE_SIZE   // VkDeviceSize range
+       };
+
+       const vk::VkWriteDescriptorSet                  descriptorWrite         =
+       {
+               vk::VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET,     // VkStructureTypes                                     Type
+               DE_NULL,                                                                        // const void*                                          pNext
+               *descriptorSet,                                                         // VkDescriptorSet                                      dstSet
+               2,                                                                                      // deUint32                                                     dstBinding
+               0,                                                                                      // deUint32                                                     dstArrayElement
+               1,                                                                                      // deUint32                                                     descriptorCount
+               vk::VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER,          // VkDescriptorType                                     descriptorType
+               DE_NULL,                                                                        // const VkDescriptorImageInfo*         pImageInfo
+               &descriptorInfo,                                                        // const VkDescriptorBufferInfo*        pBufferInfo
+               DE_NULL                                                                         // const VkBufferView*                          pTexelBufferView
+       };
+
+       vki.updateDescriptorSets(device, 1, &descriptorWrite, 0, DE_NULL);
+
+       // Test should always pass
+       return tcu::TestStatus::pass("Pass");
+}
+
+
+tcu::TestCaseGroup* createEmptyDescriptorUpdateTests (tcu::TestContext& testCtx)
+{
+       de::MovePtr<tcu::TestCaseGroup> group(new tcu::TestCaseGroup(testCtx, "empty_descriptor", "Update last descriptor in a set that includes an empty binding"));
+
+       addFunctionCase(group.get(), "uniform_buffer", "", EmptyDescriptorUpdateCase);
+
+       return group.release();
+}
+
+} // anonymous
+
+
+tcu::TestCaseGroup* createDescriptorUpdateTests (tcu::TestContext& testCtx)
+{
+       de::MovePtr<tcu::TestCaseGroup> group(new tcu::TestCaseGroup(testCtx, "descriptor_update", "Update descriptor sets"));
+
+       group->addChild(createEmptyDescriptorUpdateTests(testCtx));
+
+       return group.release();
+}
+
+} // BindingModel
+} // vkt
diff --git a/external/vulkancts/modules/vulkan/binding_model/vktBindingDescriptorUpdateTests.hpp b/external/vulkancts/modules/vulkan/binding_model/vktBindingDescriptorUpdateTests.hpp
new file mode 100644 (file)
index 0000000..bc2c086
--- /dev/null
@@ -0,0 +1,39 @@
+#ifndef _VKTBINDINGDESCRIPTORUPDATETESTS_HPP
+#define _VKTBINDINGDESCRIPTORUPDATETESTS_HPP
+/*-------------------------------------------------------------------------
+ * Vulkan Conformance Tests
+ * ------------------------
+ *
+ * Copyright (c) 2018 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ *//*!
+ * \file
+ * \brief Tests for descriptor updates.
+ *//*--------------------------------------------------------------------*/
+
+#include "tcuDefs.hpp"
+#include "tcuTestCase.hpp"
+
+namespace vkt
+{
+namespace BindingModel
+{
+
+tcu::TestCaseGroup* createDescriptorUpdateTests(tcu::TestContext& testCtx);
+
+} // BindingModel
+} // vkt
+
+#endif // _VKTBINDINGDESCRIPTORUPDATETESTS_HPP
index 792e7c6..dc610f3 100644 (file)
@@ -24,6 +24,7 @@
 #include "vktBindingModelTests.hpp"
 
 #include "vktBindingShaderAccessTests.hpp"
+#include "vktBindingDescriptorUpdateTests.hpp"
 #include "vktTestGroupUtil.hpp"
 
 namespace vkt
@@ -39,6 +40,7 @@ void createChildren (tcu::TestCaseGroup* group)
        tcu::TestContext&       testCtx         = group->getTestContext();
 
        group->addChild(createShaderAccessTests(testCtx));
+       group->addChild(createDescriptorUpdateTests(testCtx));
 
        // \todo [2015-07-30 jarkko] .change_binding.{between_renderpasses, within_pass}
        // \todo [2015-07-30 jarkko] .descriptor_set_chain
index 43e35c5..959be2c 100644 (file)
@@ -199690,6 +199690,7 @@ dEQP-VK.binding_model.shader_access.secondary_cmd_buf.with_push_template.storage
 dEQP-VK.binding_model.shader_access.secondary_cmd_buf.with_push_template.storage_buffer.vertex_fragment.multiple_arbitrary_descriptors.offset_view_nonzero
 dEQP-VK.binding_model.shader_access.secondary_cmd_buf.with_push_template.storage_buffer.vertex_fragment.descriptor_array.offset_view_zero
 dEQP-VK.binding_model.shader_access.secondary_cmd_buf.with_push_template.storage_buffer.vertex_fragment.descriptor_array.offset_view_nonzero
+dEQP-VK.binding_model.descriptor_update.empty_descriptor.uniform_buffer
 dEQP-VK.spirv_assembly.instruction.compute.localsize.literal_localsize
 dEQP-VK.spirv_assembly.instruction.compute.localsize.literal_and_specid_localsize
 dEQP-VK.spirv_assembly.instruction.compute.localsize.specid_localsize
index d851592..af98a97 100644 (file)
@@ -199690,6 +199690,7 @@ dEQP-VK.binding_model.shader_access.secondary_cmd_buf.with_push_template.storage
 dEQP-VK.binding_model.shader_access.secondary_cmd_buf.with_push_template.storage_buffer.vertex_fragment.multiple_arbitrary_descriptors.offset_view_nonzero
 dEQP-VK.binding_model.shader_access.secondary_cmd_buf.with_push_template.storage_buffer.vertex_fragment.descriptor_array.offset_view_zero
 dEQP-VK.binding_model.shader_access.secondary_cmd_buf.with_push_template.storage_buffer.vertex_fragment.descriptor_array.offset_view_nonzero
+dEQP-VK.binding_model.descriptor_update.empty_descriptor.uniform_buffer
 dEQP-VK.spirv_assembly.instruction.compute.localsize.literal_localsize
 dEQP-VK.spirv_assembly.instruction.compute.localsize.literal_and_specid_localsize
 dEQP-VK.spirv_assembly.instruction.compute.localsize.specid_localsize