From fa9cdf70dc6decdf0f291609b8d8cedeba069bef Mon Sep 17 00:00:00 2001 From: Igor Ostrowski Date: Mon, 10 Feb 2020 11:28:52 +0100 Subject: [PATCH] Fix memory leak in pipeline.executable_properties tests Affects: dEQP-VK.pipeline.executable_properties.* Components: Vulkan VK-GL-CTS issue: 2220 Change-Id: I3f82e17be51a643cd64270e7f05fdf496e648f00 --- .../vktPipelineExecutablePropertiesTests.cpp | 27 +++++++++---------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/external/vulkancts/modules/vulkan/pipeline/vktPipelineExecutablePropertiesTests.cpp b/external/vulkancts/modules/vulkan/pipeline/vktPipelineExecutablePropertiesTests.cpp index 54e94563f..7f6e3f4b6 100644 --- a/external/vulkancts/modules/vulkan/pipeline/vktPipelineExecutablePropertiesTests.cpp +++ b/external/vulkancts/modules/vulkan/pipeline/vktPipelineExecutablePropertiesTests.cpp @@ -263,7 +263,7 @@ public: const char* sourceName, const char* entryName); void enableTessellationStage (deUint32 patchControlPoints); - VkPipeline buildPipeline (tcu::UVec2 renderSize, + Move buildPipeline (tcu::UVec2 renderSize, VkRenderPass renderPass, VkPipelineCache cache, VkPipelineLayout pipelineLayout, @@ -326,8 +326,8 @@ void SimpleGraphicsPipelineBuilder::bindShaderStage (VkShaderStageFlagBits stage m_shaderStageCount++; } -VkPipeline SimpleGraphicsPipelineBuilder::buildPipeline (tcu::UVec2 renderSize, VkRenderPass renderPass, VkPipelineCache cache, - VkPipelineLayout pipelineLayout, VkPipelineCreateFlags flags) +Move SimpleGraphicsPipelineBuilder::buildPipeline (tcu::UVec2 renderSize, VkRenderPass renderPass, VkPipelineCache cache, + VkPipelineLayout pipelineLayout, VkPipelineCreateFlags flags) { const DeviceInterface& vk = m_context.getDeviceInterface(); const VkDevice vkDevice = m_context.getDevice(); @@ -515,9 +515,8 @@ VkPipeline SimpleGraphicsPipelineBuilder::buildPipeline (tcu::UVec2 renderSize, DE_NULL, // VkPipeline basePipelineHandle; 0, // deInt32 basePipelineIndex; }; - VkPipeline pipeline; - vk.createGraphicsPipelines(vkDevice, cache, 1u, &graphicsPipelineParams, DE_NULL, &pipeline); - return pipeline; + + return createGraphicsPipeline(vk, vkDevice, cache, &graphicsPipelineParams, DE_NULL); } void SimpleGraphicsPipelineBuilder::enableTessellationStage (deUint32 patchControlPoints) @@ -568,7 +567,7 @@ protected: Move m_cache; deBool m_extensions; - VkPipeline m_pipeline[PIPELINE_CACHE_NDX_COUNT]; + Move m_pipeline[PIPELINE_CACHE_NDX_COUNT]; }; ExecutablePropertiesTestInstance::ExecutablePropertiesTestInstance (Context& context, @@ -645,7 +644,7 @@ tcu::TestStatus ExecutablePropertiesTestInstance::verifyStatistics (deUint32 exe { VK_STRUCTURE_TYPE_PIPELINE_EXECUTABLE_INFO_KHR, // VkStructureType sType; DE_NULL, // const void* pNext; - m_pipeline[ndx], // VkPipeline pipeline; + *m_pipeline[ndx], // VkPipeline pipeline; executableNdx, // uint32_t executableIndex; }; @@ -802,7 +801,7 @@ tcu::TestStatus ExecutablePropertiesTestInstance::verifyInternalRepresentations { VK_STRUCTURE_TYPE_PIPELINE_EXECUTABLE_INFO_KHR, // VkStructureType sType; DE_NULL, // const void* pNext; - m_pipeline[1], // VkPipeline pipeline; + *m_pipeline[1], // VkPipeline pipeline; executableNdx, // uint32_t executableIndex; }; @@ -931,7 +930,7 @@ tcu::TestStatus ExecutablePropertiesTestInstance::verifyTestResult (void) { VK_STRUCTURE_TYPE_PIPELINE_INFO_KHR, // VkStructureType sType; DE_NULL, // const void* pNext; - m_pipeline[ndx], // VkPipeline pipeline; + *m_pipeline[ndx], // VkPipeline pipeline; }; deUint32 executableCount = 0; @@ -1347,14 +1346,14 @@ protected: void buildPipeline (deUint32 ndx); protected: Move m_inputBuf; - de::MovePtr m_inputBufferAlloc; + de::MovePtr m_inputBufferAlloc; Move m_computeShaderModule[PIPELINE_CACHE_NDX_COUNT]; Move m_outputBuf[PIPELINE_CACHE_NDX_COUNT]; - de::MovePtr m_outputBufferAlloc[PIPELINE_CACHE_NDX_COUNT]; + de::MovePtr m_outputBufferAlloc[PIPELINE_CACHE_NDX_COUNT]; Move m_descriptorPool[PIPELINE_CACHE_NDX_COUNT]; - Move m_descriptorSetLayout[PIPELINE_CACHE_NDX_COUNT]; + Move m_descriptorSetLayout[PIPELINE_CACHE_NDX_COUNT]; Move m_descriptorSet[PIPELINE_CACHE_NDX_COUNT]; Move m_pipelineLayout[PIPELINE_CACHE_NDX_COUNT]; @@ -1470,7 +1469,7 @@ void ComputeExecutablePropertiesTestInstance::buildPipeline (deUint32 ndx) 0u, // deInt32 basePipelineIndex; }; - vk.createComputePipelines(vkDevice, *m_cache, 1u, &pipelineCreateInfo, DE_NULL, &m_pipeline[ndx]); + m_pipeline[ndx] = createComputePipeline(vk, vkDevice, *m_cache, &pipelineCreateInfo, DE_NULL); } ComputeExecutablePropertiesTestInstance::ComputeExecutablePropertiesTestInstance (Context& context, -- 2.34.1