From d1a29f27d532ea5a6dc34212591db944d132de9c Mon Sep 17 00:00:00 2001 From: Paavo Pessi Date: Thu, 11 Jan 2018 11:52:45 +0200 Subject: [PATCH] Test updating set with an empty binding 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 | 1 + android/cts/master/vk-master.txt | 1 + .../modules/vulkan/binding_model/CMakeLists.txt | 2 + .../vktBindingDescriptorUpdateTests.cpp | 142 +++++++++++++++++++++ .../vktBindingDescriptorUpdateTests.hpp | 39 ++++++ .../vulkan/binding_model/vktBindingModelTests.cpp | 2 + .../mustpass/1.0.4/vk-default-no-waivers.txt | 1 + external/vulkancts/mustpass/1.0.4/vk-default.txt | 1 + 8 files changed, 189 insertions(+) create mode 100644 external/vulkancts/modules/vulkan/binding_model/vktBindingDescriptorUpdateTests.cpp create mode 100644 external/vulkancts/modules/vulkan/binding_model/vktBindingDescriptorUpdateTests.hpp diff --git a/AndroidGen.mk b/AndroidGen.mk index cb11c67..603223e 100644 --- a/AndroidGen.mk +++ b/AndroidGen.mk @@ -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 \ diff --git a/android/cts/master/vk-master.txt b/android/cts/master/vk-master.txt index f5b7ea8..4fccd9f 100644 --- a/android/cts/master/vk-master.txt +++ b/android/cts/master/vk-master.txt @@ -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 diff --git a/external/vulkancts/modules/vulkan/binding_model/CMakeLists.txt b/external/vulkancts/modules/vulkan/binding_model/CMakeLists.txt index fe3e727..d92d451 100644 --- a/external/vulkancts/modules/vulkan/binding_model/CMakeLists.txt +++ b/external/vulkancts/modules/vulkan/binding_model/CMakeLists.txt @@ -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 index 0000000..67dfa04 --- /dev/null +++ b/external/vulkancts/modules/vulkan/binding_model/vktBindingDescriptorUpdateTests.cpp @@ -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 layout (builder.build(vki, device, (vk::VkDescriptorSetLayoutCreateFlags)0)); + + // Create descriptor pool + vk::Unique 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 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 buffer (createBuffer(vki, device, &bufferCreateInfo)); + const vk::VkMemoryRequirements requirements = vk::getBufferMemoryRequirements(vki, device, *buffer); + de::MovePtr 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 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 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 index 0000000..bc2c086 --- /dev/null +++ b/external/vulkancts/modules/vulkan/binding_model/vktBindingDescriptorUpdateTests.hpp @@ -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 diff --git a/external/vulkancts/modules/vulkan/binding_model/vktBindingModelTests.cpp b/external/vulkancts/modules/vulkan/binding_model/vktBindingModelTests.cpp index 792e7c6..dc610f3 100644 --- a/external/vulkancts/modules/vulkan/binding_model/vktBindingModelTests.cpp +++ b/external/vulkancts/modules/vulkan/binding_model/vktBindingModelTests.cpp @@ -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 diff --git a/external/vulkancts/mustpass/1.0.4/vk-default-no-waivers.txt b/external/vulkancts/mustpass/1.0.4/vk-default-no-waivers.txt index 43e35c5..959be2c 100644 --- a/external/vulkancts/mustpass/1.0.4/vk-default-no-waivers.txt +++ b/external/vulkancts/mustpass/1.0.4/vk-default-no-waivers.txt @@ -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 diff --git a/external/vulkancts/mustpass/1.0.4/vk-default.txt b/external/vulkancts/mustpass/1.0.4/vk-default.txt index d851592..af98a97 100644 --- a/external/vulkancts/mustpass/1.0.4/vk-default.txt +++ b/external/vulkancts/mustpass/1.0.4/vk-default.txt @@ -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 -- 2.7.4