Add coverage for pipeline cache hit of active pipeline

This CL adds coverage to the dEQP-VK.pipeline.creation_feedback.*
tests for the case where the newly created pipeline has
a cache hit of another pipeline that was created previously,
and that other pipeline is still open and active.

Previously the test only had coverage for pipeline cache
hit of previous pipelines that were destroyed. This adds
coverage for both scenarios.

Affects:

dEQP-VK.pipeline.creation_feedback.*

Components: Vulkan

VK-GL-CTS issue: 2032

Change-Id: I7320d0bf075ea430eafbcf6c3b2518b985c024b8
diff --git a/android/cts/master/vk-master.txt b/android/cts/master/vk-master.txt
index 6d94df9..f241551 100644
--- a/android/cts/master/vk-master.txt
+++ b/android/cts/master/vk-master.txt
Binary files differ
diff --git a/external/vulkancts/modules/vulkan/pipeline/vktPipelineCreationFeedbackTests.cpp b/external/vulkancts/modules/vulkan/pipeline/vktPipelineCreationFeedbackTests.cpp
index 4e95648..e59314b 100644
--- a/external/vulkancts/modules/vulkan/pipeline/vktPipelineCreationFeedbackTests.cpp
+++ b/external/vulkancts/modules/vulkan/pipeline/vktPipelineCreationFeedbackTests.cpp
@@ -140,27 +140,31 @@
 public:
 								CacheTestParam				(const VkShaderStageFlagBits*	shaders,
 															 deUint32						count,
-															 deBool							noCache);
+															 deBool							noCache,
+															 deBool							delayedDestroy);
 	virtual					~CacheTestParam					(void);
 	virtual const std::string	generateTestName			(void)			const;
 	virtual const std::string	generateTestDescription		(void)			const;
 	VkShaderStageFlagBits		getShaderFlag				(deUint32 ndx)	const	{ return m_shaders[ndx]; }
 	deUint32					getShaderCount				(void)			const	{ return (deUint32)m_shaderCount; }
 	deBool						isCacheDisabled				(void)			const	{ return m_noCache; }
+	deBool						isDelayedDestroy			(void)			const	{ return m_delayedDestroy; }
 
 protected:
 	VkShaderStageFlagBits		m_shaders[VK_MAX_SHADER_STAGES];
 	size_t						m_shaderCount;
 	bool						m_noCache;
+	bool						m_delayedDestroy;
 };
 
-CacheTestParam::CacheTestParam (const VkShaderStageFlagBits* shaders, deUint32 count, deBool noCache)
+CacheTestParam::CacheTestParam (const VkShaderStageFlagBits* shaders, deUint32 count, deBool noCache, deBool delayedDestroy)
 {
 	DE_ASSERT(count <= VK_MAX_SHADER_STAGES);
 	for (deUint32 ndx = 0; ndx < count; ndx++)
 		m_shaders[ndx] = shaders[ndx];
-	m_shaderCount	= count;
-	m_noCache		= noCache;
+	m_shaderCount		= count;
+	m_noCache			= noCache;
+	m_delayedDestroy	= delayedDestroy;
 }
 
 CacheTestParam::~CacheTestParam (void)
@@ -171,12 +175,13 @@
 {
 	std::string result(getShaderFlagStr(m_shaders[0], false));
 	std::string cacheString [] = { "", "_no_cache" };
+	std::string delayedDestroyString [] = { "", "_delayed_destroy" };
 
 	for(deUint32 ndx = 1; ndx < m_shaderCount; ndx++)
-		result += '_' + getShaderFlagStr(m_shaders[ndx], false) + cacheString[m_noCache ? 1 : 0];
+		result += '_' + getShaderFlagStr(m_shaders[ndx], false) + cacheString[m_noCache ? 1 : 0] + delayedDestroyString[m_delayedDestroy ? 1 : 0];
 
 	if (m_shaderCount == 1)
-		result += cacheString[m_noCache ? 1 : 0];
+		result += cacheString[m_noCache ? 1 : 0] + delayedDestroyString[m_delayedDestroy ? 1 : 0];
 
 	return result;
 }
@@ -186,6 +191,8 @@
 	std::string result("Get pipeline creation feedback with " + getShaderFlagStr(m_shaders[0], true));
 	if (m_noCache)
 		result += " with no cache";
+	if (m_delayedDestroy)
+		result += " with delayed destroy";
 
 	for(deUint32 ndx = 1; ndx < m_shaderCount; ndx++)
 		result += ' ' + getShaderFlagStr(m_shaders[ndx], true);
@@ -802,9 +809,10 @@
 				break;
 			};
 		}
-		if (ndx == PIPELINE_CACHE_NDX_CACHED)
+		if (ndx == PIPELINE_CACHE_NDX_CACHED && !param->isDelayedDestroy())
 		{
-			// Destroy the NO_CACHE pipeline to check that the cached one really hits cache
+			// Destroy the NO_CACHE pipeline to check that the cached one really hits cache,
+			// except for the case where we're testing cache hit of a pipeline still active.
 			vk.destroyPipeline(vkDevice, m_pipeline[PIPELINE_CACHE_NDX_NO_CACHE], DE_NULL);
 		}
 
@@ -819,7 +827,13 @@
 			// Destroy the pipeline as soon as it is created, except the NO_CACHE because
 			// it is needed as a base pipeline for the derivative case.
 			vk.destroyPipeline(vkDevice, m_pipeline[ndx], DE_NULL);
-		}
+
+			if (ndx == PIPELINE_CACHE_NDX_CACHED && param->isDelayedDestroy())
+			{
+				// Destroy the pipeline we didn't destroy earlier for the isDelayedDestroy case.
+				vk.destroyPipeline(vkDevice, m_pipeline[PIPELINE_CACHE_NDX_NO_CACHE], DE_NULL);
+			}
+	}
 	}
 }
 
@@ -959,9 +973,9 @@
 	virtual					~ComputeCacheTestInstance	(void);
 protected:
 	virtual tcu::TestStatus verifyTestResult				(void);
-			void			buildDescriptorSets			(deUint32 ndx);
-			void			buildShader					(deUint32 ndx);
-			void			buildPipeline					(deUint32 ndx);
+			void			buildDescriptorSets				(deUint32 ndx);
+			void			buildShader						(deUint32 ndx);
+			void			buildPipeline					(const CacheTestParam*	param, deUint32 ndx);
 protected:
 	Move<VkBuffer>					m_inputBuf;
 	de::MovePtr<Allocation>		m_inputBufferAlloc;
@@ -1056,7 +1070,7 @@
 	m_computeShaderModule[ndx] = createShaderModule(vk, vkDevice, &shaderModuleCreateInfo);
 }
 
-void ComputeCacheTestInstance::buildPipeline (deUint32 ndx)
+void ComputeCacheTestInstance::buildPipeline (const CacheTestParam*	param, deUint32 ndx)
 {
 	const DeviceInterface&	vk				 = m_context.getDeviceInterface();
 	const VkDevice			vkDevice		 = m_context.getDevice();
@@ -1121,9 +1135,10 @@
 		pipelineCreateInfo.basePipelineIndex = -1;
 	}
 
-	if (ndx == PIPELINE_CACHE_NDX_CACHED)
+	if (ndx == PIPELINE_CACHE_NDX_CACHED && !param->isDelayedDestroy())
 	{
-		// Destroy the NO_CACHE pipeline to check that the cached one really hits cache
+		// Destroy the NO_CACHE pipeline to check that the cached one really hits cache,
+		// except for the case where we're testing cache hit of a pipeline still active.
 		vk.destroyPipeline(vkDevice, m_pipeline[PIPELINE_CACHE_NDX_NO_CACHE], DE_NULL);
 	}
 
@@ -1134,6 +1149,12 @@
 		// Destroy the pipeline as soon as it is created, except the NO_CACHE because
 		// it is needed as a base pipeline for the derivative case.
 		vk.destroyPipeline(vkDevice, m_pipeline[ndx], DE_NULL);
+
+		if (ndx == PIPELINE_CACHE_NDX_CACHED && param->isDelayedDestroy())
+		{
+			// Destroy the pipeline we didn't destroy earlier for the isDelayedDestroy case.
+			vk.destroyPipeline(vkDevice, m_pipeline[PIPELINE_CACHE_NDX_NO_CACHE], DE_NULL);
+		}
 	}
 }
 
@@ -1145,7 +1166,7 @@
 	{
 		buildDescriptorSets(ndx);
 		buildShader(ndx);
-		buildPipeline(ndx);
+		buildPipeline(param, ndx);
 	}
 }
 
@@ -1298,12 +1319,15 @@
 		};
 		const CacheTestParam testParams[] =
 		{
-			CacheTestParam(testParamShaders0, DE_LENGTH_OF_ARRAY(testParamShaders0), DE_FALSE),
-			CacheTestParam(testParamShaders1, DE_LENGTH_OF_ARRAY(testParamShaders1), DE_FALSE),
-			CacheTestParam(testParamShaders2, DE_LENGTH_OF_ARRAY(testParamShaders2), DE_FALSE),
-			CacheTestParam(testParamShaders0, DE_LENGTH_OF_ARRAY(testParamShaders0), DE_TRUE),
-			CacheTestParam(testParamShaders1, DE_LENGTH_OF_ARRAY(testParamShaders1), DE_TRUE),
-			CacheTestParam(testParamShaders2, DE_LENGTH_OF_ARRAY(testParamShaders2), DE_TRUE),
+			CacheTestParam(testParamShaders0, DE_LENGTH_OF_ARRAY(testParamShaders0), DE_FALSE, DE_FALSE),
+			CacheTestParam(testParamShaders1, DE_LENGTH_OF_ARRAY(testParamShaders1), DE_FALSE, DE_FALSE),
+			CacheTestParam(testParamShaders2, DE_LENGTH_OF_ARRAY(testParamShaders2), DE_FALSE, DE_FALSE),
+			CacheTestParam(testParamShaders0, DE_LENGTH_OF_ARRAY(testParamShaders0), DE_TRUE, DE_FALSE),
+			CacheTestParam(testParamShaders1, DE_LENGTH_OF_ARRAY(testParamShaders1), DE_TRUE, DE_FALSE),
+			CacheTestParam(testParamShaders2, DE_LENGTH_OF_ARRAY(testParamShaders2), DE_TRUE, DE_FALSE),
+			CacheTestParam(testParamShaders0, DE_LENGTH_OF_ARRAY(testParamShaders0), DE_FALSE, DE_TRUE),
+			CacheTestParam(testParamShaders1, DE_LENGTH_OF_ARRAY(testParamShaders1), DE_FALSE, DE_TRUE),
+			CacheTestParam(testParamShaders2, DE_LENGTH_OF_ARRAY(testParamShaders2), DE_FALSE, DE_TRUE),
 		};
 
 		for (deUint32 i = 0; i < DE_LENGTH_OF_ARRAY(testParams); i++)
@@ -1322,8 +1346,9 @@
 		};
 		const CacheTestParam testParams[] =
 		{
-			CacheTestParam(testParamShaders0, DE_LENGTH_OF_ARRAY(testParamShaders0), DE_FALSE),
-			CacheTestParam(testParamShaders0, DE_LENGTH_OF_ARRAY(testParamShaders0), DE_TRUE),
+			CacheTestParam(testParamShaders0, DE_LENGTH_OF_ARRAY(testParamShaders0), DE_FALSE, DE_FALSE),
+			CacheTestParam(testParamShaders0, DE_LENGTH_OF_ARRAY(testParamShaders0), DE_TRUE, DE_FALSE),
+			CacheTestParam(testParamShaders0, DE_LENGTH_OF_ARRAY(testParamShaders0), DE_FALSE, DE_TRUE),
 		};
 
 		for (deUint32 i = 0; i < DE_LENGTH_OF_ARRAY(testParams); i++)
diff --git a/external/vulkancts/mustpass/master/vk-default-no-waivers.txt b/external/vulkancts/mustpass/master/vk-default-no-waivers.txt
index 4dd440e..1aee6df 100644
--- a/external/vulkancts/mustpass/master/vk-default-no-waivers.txt
+++ b/external/vulkancts/mustpass/master/vk-default-no-waivers.txt
Binary files differ
diff --git a/external/vulkancts/mustpass/master/vk-default.txt b/external/vulkancts/mustpass/master/vk-default.txt
index bcd4693..6821229 100644
--- a/external/vulkancts/mustpass/master/vk-default.txt
+++ b/external/vulkancts/mustpass/master/vk-default.txt
Binary files differ