From 8ba4abe5459a44dd55f15a9c0a2fd07f9d846ced Mon Sep 17 00:00:00 2001 From: Paavo Pessi Date: Mon, 22 Jan 2018 14:23:53 +0200 Subject: [PATCH] Add descriptor set layout lifetime tests Test was added to verify that implementation honors descriptor set layout lifetime. Descriptor set layout is destroyed immediately after creating the pipeline layout, prior to creating the pipeline. New tests: dEQP-VK.api.descriptor_set.descriptor_set_layout_lifetime.graphics dEQP-VK.api.descriptor_set.descriptor_set_layout_lifetime.compute Components: Vulkan VK-GL-CTS issue: 856 Change-Id: I978675ddea30e3b312db4bc65da77c26149cc2df --- AndroidGen.mk | 1 + android/cts/master/vk-master.txt | 2 + .../vulkancts/modules/vulkan/api/CMakeLists.txt | 2 + .../vulkan/api/vktApiDescriptorSetTests.cpp | 263 +++++++++++++++++++++ .../vulkan/api/vktApiDescriptorSetTests.hpp | 40 ++++ .../vulkancts/modules/vulkan/api/vktApiTests.cpp | 2 + .../mustpass/1.0.4/vk-default-no-waivers.txt | 2 + external/vulkancts/mustpass/1.0.4/vk-default.txt | 2 + 8 files changed, 314 insertions(+) create mode 100644 external/vulkancts/modules/vulkan/api/vktApiDescriptorSetTests.cpp create mode 100644 external/vulkancts/modules/vulkan/api/vktApiDescriptorSetTests.hpp diff --git a/AndroidGen.mk b/AndroidGen.mk index 603223e..3137375 100644 --- a/AndroidGen.mk +++ b/AndroidGen.mk @@ -60,6 +60,7 @@ LOCAL_SRC_FILES := \ external/vulkancts/modules/vulkan/api/vktApiComputeInstanceResultBuffer.cpp \ external/vulkancts/modules/vulkan/api/vktApiCopiesAndBlittingTests.cpp \ external/vulkancts/modules/vulkan/api/vktApiDescriptorPoolTests.cpp \ + external/vulkancts/modules/vulkan/api/vktApiDescriptorSetTests.cpp \ external/vulkancts/modules/vulkan/api/vktApiDeviceInitializationTests.cpp \ external/vulkancts/modules/vulkan/api/vktApiExternalMemoryTests.cpp \ external/vulkancts/modules/vulkan/api/vktApiFeatureInfo.cpp \ diff --git a/android/cts/master/vk-master.txt b/android/cts/master/vk-master.txt index 3ab7bf7..400dca7 100644 --- a/android/cts/master/vk-master.txt +++ b/android/cts/master/vk-master.txt @@ -71417,6 +71417,8 @@ dEQP-VK.api.external.fence.opaque_win32_kmt.transference_permanent dEQP-VK.api.external.fence.opaque_win32_kmt.signal_wait_import_permanent dEQP-VK.api.external.fence.opaque_win32_kmt.export_signal_import_wait_permanent dEQP-VK.api.external.fence.opaque_win32_kmt.export_import_signal_wait_permanent +dEQP-VK.api.descriptor_set.descriptor_set_layout_lifetime.graphics +dEQP-VK.api.descriptor_set.descriptor_set_layout_lifetime.compute dEQP-VK.memory.allocation.basic.size_64.forward.count_1 dEQP-VK.memory.allocation.basic.size_64.forward.count_10 dEQP-VK.memory.allocation.basic.size_64.forward.count_100 diff --git a/external/vulkancts/modules/vulkan/api/CMakeLists.txt b/external/vulkancts/modules/vulkan/api/CMakeLists.txt index 5c94ee7..555b068 100644 --- a/external/vulkancts/modules/vulkan/api/CMakeLists.txt +++ b/external/vulkancts/modules/vulkan/api/CMakeLists.txt @@ -43,6 +43,8 @@ set(DEQP_VK_API_SRCS vktApiExternalMemoryTests.hpp vktApiBufferAndImageAllocationUtil.hpp vktApiBufferAndImageAllocationUtil.cpp + vktApiDescriptorSetTests.hpp + vktApiDescriptorSetTests.cpp ) set(DEQP_VK_API_LIBS diff --git a/external/vulkancts/modules/vulkan/api/vktApiDescriptorSetTests.cpp b/external/vulkancts/modules/vulkan/api/vktApiDescriptorSetTests.cpp new file mode 100644 index 0000000..6080564 --- /dev/null +++ b/external/vulkancts/modules/vulkan/api/vktApiDescriptorSetTests.cpp @@ -0,0 +1,263 @@ +/*------------------------------------------------------------------------- + * 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 Descriptor set tests + *//*--------------------------------------------------------------------*/ + +#include "vktApiDescriptorSetTests.hpp" +#include "vktTestCaseUtil.hpp" + +#include "vkRefUtil.hpp" +#include "vkPrograms.hpp" + +namespace vkt +{ +namespace api +{ + +namespace +{ + +using namespace std; +using namespace vk; + +// Descriptor set layout used to create a pipeline layout is destroyed prior to creating a pipeline +Move createPipelineLayoutDestroyDescriptorSetLayout (const DeviceInterface& vk, const VkDevice& device) +{ + const VkDescriptorSetLayoutCreateInfo descriptorSetLayoutInfo = + { + VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO, // VkStructureType sType; + DE_NULL, // const void* pNext; + (VkDescriptorSetLayoutCreateFlags)0, // VkDescriptorSetLayoutCreateFlags flags; + 0u, // deUint32 bindingCount; + DE_NULL, // const VkDescriptorSetLayoutBinding* pBindings; + }; + + Unique descriptorSetLayout (createDescriptorSetLayout(vk, device, &descriptorSetLayoutInfo)); + + const VkPipelineLayoutCreateInfo pipelineLayoutCreateInfo = + { + VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO, // VkStructureType sType; + DE_NULL, // const void* pNext; + (VkPipelineLayoutCreateFlags)0, // VkPipelineLayoutCreateFlags flags; + 1u, // deUint32 setLayoutCount; + &descriptorSetLayout.get(), // const VkDescriptorSetLayout* pSetLayouts; + 0u, // deUint32 pushConstantRangeCount; + DE_NULL // const VkPushConstantRange* pPushConstantRanges; + }; + + return createPipelineLayout(vk, device, &pipelineLayoutCreateInfo); +} + +tcu::TestStatus descriptorSetLayoutLifetimeGraphicsTest (Context& context) +{ + const DeviceInterface& vk = context.getDeviceInterface(); + const VkDevice device = context.getDevice(); + + Unique pipelineLayout (createPipelineLayoutDestroyDescriptorSetLayout(vk, device)); + + const Unique vertexShaderModule (createShaderModule(vk, device, context.getBinaryCollection().get("vertex"), 0)); + + const VkPipelineShaderStageCreateInfo shaderStageCreateInfo = + { + VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO, // VkStructureType sType; + DE_NULL, // const void* pNext; + (VkPipelineShaderStageCreateFlags)0, // VkPipelineShaderStageCreateFlags flags; + VK_SHADER_STAGE_VERTEX_BIT, // VkShaderStageFlagBits stage; + vertexShaderModule.get(), // VkShaderModule shader; + "main", // const char* pName; + DE_NULL, // const VkSpecializationInfo* pSpecializationInfo; + }; + + const VkPipelineVertexInputStateCreateInfo vertexInputStateCreateInfo = + { + VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO, // VkStructureType sType; + DE_NULL, // const void* pNext; + (VkPipelineVertexInputStateCreateFlags)0, // VkPipelineVertexInputStateCreateFlags flags; + 0u, // deUint32 vertexBindingDescriptionCount; + DE_NULL, // const VkVertexInputBindingDescription* pVertexBindingDescriptions; + 0u, // deUint32 vertexAttributeDescriptionCount; + DE_NULL // const VkVertexInputAttributeDescription* pVertexAttributeDescriptions; + }; + + const VkPipelineInputAssemblyStateCreateInfo inputAssemblyStateCreateInfo = + { + VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO, // VkStructureType sType; + DE_NULL, // const void* pNext; + (VkPipelineInputAssemblyStateCreateFlags)0, // VkPipelineInputAssemblyStateCreateFlags flags; + VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP, // VkPrimitiveTopology topology; + VK_FALSE // VkBool32 primitiveRestartEnable; + }; + + const VkPipelineRasterizationStateCreateInfo rasterizationStateCreateInfo = + { + VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_INFO, // VkStructureType sType; + DE_NULL, // const void* pNext; + (VkPipelineRasterizationStateCreateFlags)0, // VkPipelineRasterizationStateCreateFlags flags; + VK_FALSE, // VkBool32 depthClampEnable; + VK_TRUE, // VkBool32 rasterizerDiscardEnable; + VK_POLYGON_MODE_FILL, // VkPolygonMode polygonMode; + VK_CULL_MODE_NONE, // VkCullModeFlags cullMode; + VK_FRONT_FACE_CLOCKWISE, // VkFrontFace frontFace; + VK_FALSE, // VkBool32 depthBiasEnable; + 0.0f, // float depthBiasConstantFactor; + 0.0f, // float depthBiasClamp; + 0.0f, // float depthBiasSlopeFactor; + 1.0f // float lineWidth; + }; + + const VkSubpassDescription subpassDescription = + { + (VkSubpassDescriptionFlags)0, // VkSubpassDescriptionFlags flags; + VK_PIPELINE_BIND_POINT_GRAPHICS, // VkPipelineBindPoint pipelineBindPoint + 0u, // deUint32 inputAttachmentCount + DE_NULL, // const VkAttachmentReference* pInputAttachments + 0u, // deUint32 colorAttachmentCount + DE_NULL, // const VkAttachmentReference* pColorAttachments + DE_NULL, // const VkAttachmentReference* pResolveAttachments + DE_NULL, // const VkAttachmentReference* pDepthStencilAttachment + 0u, // deUint32 preserveAttachmentCount + DE_NULL // const deUint32* pPreserveAttachments + }; + + const VkRenderPassCreateInfo renderPassCreateInfo = + { + VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO, // VkStructureType sType; + DE_NULL, // const void* pNext; + (VkRenderPassCreateFlags)0, // VkRenderPassCreateFlags flags; + 0u, // deUint32 attachmentCount + DE_NULL, // const VkAttachmentDescription* pAttachments + 1u, // deUint32 subpassCount + &subpassDescription, // const VkSubpassDescription* pSubpasses + 0u, // deUint32 dependencyCount + DE_NULL // const VkSubpassDependency* pDependencies + }; + + Unique renderPass (createRenderPass(vk, device, &renderPassCreateInfo)); + + const VkGraphicsPipelineCreateInfo graphicsPipelineCreateInfo = + { + VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO, // VkStructureType sType; + DE_NULL, // const void* pNext; + (VkPipelineCreateFlags)0, // VkPipelineCreateFlags flags; + 1u, // deUint32 stageCount; + &shaderStageCreateInfo, // const VkPipelineShaderStageCreateInfo* pStages; + &vertexInputStateCreateInfo, // const VkPipelineVertexInputStateCreateInfo* pVertexInputState; + &inputAssemblyStateCreateInfo, // const VkPipelineInputAssemblyStateCreateInfo* pInputAssemblyState; + DE_NULL, // const VkPipelineTessellationStateCreateInfo* pTessellationState; + DE_NULL, // const VkPipelineViewportStateCreateInfo* pViewportState; + &rasterizationStateCreateInfo, // const VkPipelineRasterizationStateCreateInfo* pRasterizationState; + DE_NULL, // const VkPipelineMultisampleStateCreateInfo* pMultisampleState; + DE_NULL, // const VkPipelineDepthStencilStateCreateInfo* pDepthStencilState; + DE_NULL, // const VkPipelineColorBlendStateCreateInfo* pColorBlendState; + DE_NULL, // const VkPipelineDynamicStateCreateInfo* pDynamicState; + pipelineLayout.get(), // VkPipelineLayout layout; + renderPass.get(), // VkRenderPass renderPass; + 0u, // deUint32 subpass; + DE_NULL, // VkPipeline basePipelineHandle; + 0 // int basePipelineIndex; + }; + + Unique graphicsPipeline (createGraphicsPipeline(vk, device, DE_NULL, &graphicsPipelineCreateInfo)); + + // Test should always pass + return tcu::TestStatus::pass("Pass"); +} + +tcu::TestStatus descriptorSetLayoutLifetimeComputeTest (Context& context) +{ + const DeviceInterface& vk = context.getDeviceInterface(); + const VkDevice device = context.getDevice(); + + Unique pipelineLayout (createPipelineLayoutDestroyDescriptorSetLayout(vk, device)); + + const Unique computeShaderModule (createShaderModule(vk, device, context.getBinaryCollection().get("compute"), 0)); + + const VkPipelineShaderStageCreateInfo shaderStageCreateInfo = + { + VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO, // VkStructureType sType; + DE_NULL, // const void* pNext; + (VkPipelineShaderStageCreateFlags)0, // VkPipelineShaderStageCreateFlags flags; + VK_SHADER_STAGE_COMPUTE_BIT, // VkShaderStageFlagBits stage; + computeShaderModule.get(), // VkShaderModule shader; + "main", // const char* pName; + DE_NULL // const VkSpecializationInfo* pSpecializationInfo; + }; + + const VkComputePipelineCreateInfo computePipelineCreateInfo = + { + VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO, // VkStructureType sType + DE_NULL, // const void* pNext + (VkPipelineCreateFlags)0, // VkPipelineCreateFlags flags + shaderStageCreateInfo, // VkPipelineShaderStageCreateInfo stage + pipelineLayout.get(), // VkPipelineLayout layout + DE_NULL, // VkPipeline basePipelineHandle + 0 // int basePipelineIndex + }; + + Unique computePipeline (createComputePipeline(vk, device, DE_NULL, &computePipelineCreateInfo)); + + // Test should always pass + return tcu::TestStatus::pass("Pass"); +} + +} // anonymous + +void createDescriptorSetLayoutLifetimeGraphicsSource (SourceCollections& dst) +{ + dst.glslSources.add("vertex") << glu::VertexSource( + "#version 310 es\n" + "void main (void)\n" + "{\n" + " gl_Position = vec4(0.0, 0.0, 0.0, 1.0);\n" + "}\n"); +} + +void createDescriptorSetLayoutLifetimeComputeSource (SourceCollections& dst) +{ + dst.glslSources.add("compute") << glu::ComputeSource( + "#version 310 es\n" + "layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;\n" + "void main (void)\n" + "{\n" + "}\n"); +} + +tcu::TestCaseGroup* createDescriptorSetLayoutLifetimeTests (tcu::TestContext& testCtx) +{ + de::MovePtr descriptorSetLayoutLifetimeTests(new tcu::TestCaseGroup(testCtx, "descriptor_set_layout_lifetime", "Descriptor set layout lifetime tests")); + + addFunctionCaseWithPrograms(descriptorSetLayoutLifetimeTests.get(), "graphics", "Test descriptor set layout lifetime in graphics pipeline", createDescriptorSetLayoutLifetimeGraphicsSource, descriptorSetLayoutLifetimeGraphicsTest); + addFunctionCaseWithPrograms(descriptorSetLayoutLifetimeTests.get(), "compute", "Test descriptor set layout lifetime in compute pipeline", createDescriptorSetLayoutLifetimeComputeSource, descriptorSetLayoutLifetimeComputeTest); + + return descriptorSetLayoutLifetimeTests.release(); +} + +tcu::TestCaseGroup* createDescriptorSetTests (tcu::TestContext& testCtx) +{ + de::MovePtr descriptorSetTests(new tcu::TestCaseGroup(testCtx, "descriptor_set", "Descriptor set tests")); + + descriptorSetTests->addChild(createDescriptorSetLayoutLifetimeTests(testCtx)); + + return descriptorSetTests.release(); +} + +} // api +} // vkt diff --git a/external/vulkancts/modules/vulkan/api/vktApiDescriptorSetTests.hpp b/external/vulkancts/modules/vulkan/api/vktApiDescriptorSetTests.hpp new file mode 100644 index 0000000..0652b09 --- /dev/null +++ b/external/vulkancts/modules/vulkan/api/vktApiDescriptorSetTests.hpp @@ -0,0 +1,40 @@ +#ifndef _VKTAPIDESCRIPTORSETTESTS_HPP +#define _VKTAPIDESCRIPTORSETTESTS_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 Descriptor set tests + *//*--------------------------------------------------------------------*/ + +#include "tcuDefs.hpp" +#include "tcuTestCase.hpp" + +namespace vkt +{ +namespace api +{ + +tcu::TestCaseGroup* createDescriptorSetTests (tcu::TestContext& testCtx); + +} // api +} // vkt + +#endif // _VKTAPIDESCRIPTORSETTESTS_HPP diff --git a/external/vulkancts/modules/vulkan/api/vktApiTests.cpp b/external/vulkancts/modules/vulkan/api/vktApiTests.cpp index 800d05a..2b3464d 100644 --- a/external/vulkancts/modules/vulkan/api/vktApiTests.cpp +++ b/external/vulkancts/modules/vulkan/api/vktApiTests.cpp @@ -40,6 +40,7 @@ #include "vktApiGranularityTests.hpp" #include "vktApiGetMemoryCommitment.hpp" #include "vktApiExternalMemoryTests.hpp" +#include "vktApiDescriptorSetTests.hpp" namespace vkt { @@ -76,6 +77,7 @@ void createApiTests (tcu::TestCaseGroup* apiTests) apiTests->addChild(createGranularityQueryTests (testCtx)); apiTests->addChild(createMemoryCommitmentTests (testCtx)); apiTests->addChild(createExternalMemoryTests (testCtx)); + apiTests->addChild(createDescriptorSetTests (testCtx)); } } // anonymous 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 9cc7a1c..10f96e8 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 @@ -71414,6 +71414,8 @@ dEQP-VK.api.external.fence.opaque_win32_kmt.transference_permanent dEQP-VK.api.external.fence.opaque_win32_kmt.signal_wait_import_permanent dEQP-VK.api.external.fence.opaque_win32_kmt.export_signal_import_wait_permanent dEQP-VK.api.external.fence.opaque_win32_kmt.export_import_signal_wait_permanent +dEQP-VK.api.descriptor_set.descriptor_set_layout_lifetime.graphics +dEQP-VK.api.descriptor_set.descriptor_set_layout_lifetime.compute dEQP-VK.memory.allocation.basic.size_64.forward.count_1 dEQP-VK.memory.allocation.basic.size_64.forward.count_10 dEQP-VK.memory.allocation.basic.size_64.forward.count_100 diff --git a/external/vulkancts/mustpass/1.0.4/vk-default.txt b/external/vulkancts/mustpass/1.0.4/vk-default.txt index 820daf9..b3b95bc 100644 --- a/external/vulkancts/mustpass/1.0.4/vk-default.txt +++ b/external/vulkancts/mustpass/1.0.4/vk-default.txt @@ -71414,6 +71414,8 @@ dEQP-VK.api.external.fence.opaque_win32_kmt.transference_permanent dEQP-VK.api.external.fence.opaque_win32_kmt.signal_wait_import_permanent dEQP-VK.api.external.fence.opaque_win32_kmt.export_signal_import_wait_permanent dEQP-VK.api.external.fence.opaque_win32_kmt.export_import_signal_wait_permanent +dEQP-VK.api.descriptor_set.descriptor_set_layout_lifetime.graphics +dEQP-VK.api.descriptor_set.descriptor_set_layout_lifetime.compute dEQP-VK.memory.allocation.basic.size_64.forward.count_1 dEQP-VK.memory.allocation.basic.size_64.forward.count_10 dEQP-VK.memory.allocation.basic.size_64.forward.count_100 -- 2.7.4