Merge vk-gl-cts/vulkan-cts-1.2.7 into vk-gl-cts/vulkan-cts-1.2.8

Change-Id: I596aa3ecd9c4fb713c76e19a9e7d753909f13f67
diff --git a/external/vulkancts/data/vulkan/amber/compute/workgroup_memory_explicit_layout/copy_memory_two_invocations.amber b/external/vulkancts/data/vulkan/amber/compute/workgroup_memory_explicit_layout/copy_memory_two_invocations.amber
index a5179e3..385f5f4 100644
--- a/external/vulkancts/data/vulkan/amber/compute/workgroup_memory_explicit_layout/copy_memory_two_invocations.amber
+++ b/external/vulkancts/data/vulkan/amber/compute/workgroup_memory_explicit_layout/copy_memory_two_invocations.amber
@@ -23,7 +23,7 @@
 OpExtension "SPV_KHR_workgroup_memory_explicit_layout"
 OpMemoryModel Logical GLSL450
 OpEntryPoint GLCompute %main "main" %index %push_constants %input_buffer_0 %input_buffer_1 %output_buffer %wg %half_wg_0 %half_wg_1
-OpExecutionMode %main LocalSize 128 4 1
+OpExecutionMode %main LocalSize 32 4 1
 
 OpDecorate %index BuiltIn LocalInvocationIndex
 OpDecorate %buffer_type Block
@@ -163,7 +163,7 @@
 BUFFER expected_buffer DATA_TYPE uint32 SIZE 32 SERIES_FROM 1 INC_BY 1
 
 BUFFER const_buf DATA_TYPE uint32 DATA
-30 130
+30 90
 END
 
 PIPELINE compute pipeline
@@ -175,6 +175,6 @@
   BIND BUFFER output_buffer AS storage DESCRIPTOR_SET 0 BINDING 2
 END
 
-RUN pipeline 1 1 1
+RUN pipeline 4 1 1
 
 EXPECT output_buffer EQ_BUFFER expected_buffer
diff --git a/external/vulkancts/data/vulkan/amber/compute/workgroup_memory_explicit_layout/copy_memory_variable_pointers.amber b/external/vulkancts/data/vulkan/amber/compute/workgroup_memory_explicit_layout/copy_memory_variable_pointers.amber
index be86733..620fe0a 100644
--- a/external/vulkancts/data/vulkan/amber/compute/workgroup_memory_explicit_layout/copy_memory_variable_pointers.amber
+++ b/external/vulkancts/data/vulkan/amber/compute/workgroup_memory_explicit_layout/copy_memory_variable_pointers.amber
@@ -25,7 +25,7 @@
 OpExtension "SPV_KHR_workgroup_memory_explicit_layout"
 OpMemoryModel Logical GLSL450
 OpEntryPoint GLCompute %main "main" %index %push_constants %input_buffer_0 %input_buffer_1 %output_buffer %wg %half_wg_0 %half_wg_1
-OpExecutionMode %main LocalSize 128 4 1
+OpExecutionMode %main LocalSize 32 4 1
 
 OpDecorate %index BuiltIn LocalInvocationIndex
 OpDecorate %buffer_type Block
@@ -181,7 +181,7 @@
 BUFFER expected_buffer DATA_TYPE uint32 SIZE 32 SERIES_FROM 1 INC_BY 1
 
 BUFFER const_buf DATA_TYPE uint32 DATA
-30 130
+30 90
 END
 
 PIPELINE compute pipeline
@@ -193,6 +193,6 @@
   BIND BUFFER output_buffer AS storage DESCRIPTOR_SET 0 BINDING 2
 END
 
-RUN pipeline 1 1 1
+RUN pipeline 4 1 1
 
 EXPECT output_buffer EQ_BUFFER expected_buffer
diff --git a/external/vulkancts/data/vulkan/amber/compute/workgroup_memory_explicit_layout/zero_ext_block.amber b/external/vulkancts/data/vulkan/amber/compute/workgroup_memory_explicit_layout/zero_ext_block.amber
index 5ef39ed..a5ce320 100644
--- a/external/vulkancts/data/vulkan/amber/compute/workgroup_memory_explicit_layout/zero_ext_block.amber
+++ b/external/vulkancts/data/vulkan/amber/compute/workgroup_memory_explicit_layout/zero_ext_block.amber
@@ -24,7 +24,7 @@
 OpExtension "SPV_KHR_workgroup_memory_explicit_layout"
 OpMemoryModel Logical GLSL450
 OpEntryPoint GLCompute %main "main" %index %push_constants %output_buffer %wg
-OpExecutionMode %main LocalSize 128 4 1
+OpExecutionMode %main LocalSize 32 4 1
 
 OpDecorate %index BuiltIn LocalInvocationIndex
 OpDecorate %buffer_type Block
@@ -101,6 +101,6 @@
   BIND BUFFER output_buffer AS storage DESCRIPTOR_SET 0 BINDING 1
 END
 
-RUN pipeline 1 1 1
+RUN pipeline 4 1 1
 
 EXPECT output_buffer EQ_BUFFER expected_buffer
diff --git a/external/vulkancts/data/vulkan/amber/compute/workgroup_memory_explicit_layout/zero_ext_block_with_offset.amber b/external/vulkancts/data/vulkan/amber/compute/workgroup_memory_explicit_layout/zero_ext_block_with_offset.amber
index 61f15c0..377f666 100644
--- a/external/vulkancts/data/vulkan/amber/compute/workgroup_memory_explicit_layout/zero_ext_block_with_offset.amber
+++ b/external/vulkancts/data/vulkan/amber/compute/workgroup_memory_explicit_layout/zero_ext_block_with_offset.amber
@@ -24,7 +24,7 @@
 OpExtension "SPV_KHR_workgroup_memory_explicit_layout"
 OpMemoryModel Logical GLSL450
 OpEntryPoint GLCompute %main "main" %index %push_constants %output_buffer %wg %offset_wg
-OpExecutionMode %main LocalSize 128 4 1
+OpExecutionMode %main LocalSize 32 4 1
 
 OpDecorate %index BuiltIn LocalInvocationIndex
 OpDecorate %buffer_type Block
@@ -108,7 +108,7 @@
   BIND BUFFER output_buffer AS storage DESCRIPTOR_SET 0 BINDING 1
 END
 
-RUN pipeline 1 1 1
+RUN pipeline 4 1 1
 
 EXPECT output_buffer IDX 64 EQ 0
 EXPECT output_buffer IDX 68 EQ 0
diff --git a/external/vulkancts/data/vulkan/amber/compute/workgroup_memory_explicit_layout/zero_ext_other_block.amber b/external/vulkancts/data/vulkan/amber/compute/workgroup_memory_explicit_layout/zero_ext_other_block.amber
index e224183..272174c 100644
--- a/external/vulkancts/data/vulkan/amber/compute/workgroup_memory_explicit_layout/zero_ext_other_block.amber
+++ b/external/vulkancts/data/vulkan/amber/compute/workgroup_memory_explicit_layout/zero_ext_other_block.amber
@@ -24,7 +24,7 @@
 OpExtension "SPV_KHR_workgroup_memory_explicit_layout"
 OpMemoryModel Logical GLSL450
 OpEntryPoint GLCompute %main "main" %index %push_constants %output_buffer %wg %other_wg
-OpExecutionMode %main LocalSize 128 4 1
+OpExecutionMode %main LocalSize 32 4 1
 
 OpDecorate %index BuiltIn LocalInvocationIndex
 OpDecorate %buffer_type Block
@@ -106,6 +106,6 @@
   BIND BUFFER output_buffer AS storage DESCRIPTOR_SET 0 BINDING 1
 END
 
-RUN pipeline 1 1 1
+RUN pipeline 4 1 1
 
 EXPECT output_buffer EQ_BUFFER expected_buffer
diff --git a/external/vulkancts/modules/vulkan/memory/vktMemoryAllocationTests.cpp b/external/vulkancts/modules/vulkan/memory/vktMemoryAllocationTests.cpp
index 4515c02..d1381e7 100644
--- a/external/vulkancts/modules/vulkan/memory/vktMemoryAllocationTests.cpp
+++ b/external/vulkancts/modules/vulkan/memory/vktMemoryAllocationTests.cpp
@@ -158,12 +158,13 @@
 
 void BaseAllocateTestInstance::createTestDevice (void)
 {
-	VkInstance										instance				(m_context.getInstance());
-	InstanceDriver									instanceDriver			(m_context.getPlatformInterface(), instance);
-	const VkPhysicalDeviceFeatures					deviceFeatures			= getPhysicalDeviceFeatures(instanceDriver, m_context.getPhysicalDevice());
-	const float										queuePriority			= 1.0f;
-	deUint32										queueFamilyIndex		= 0;
-	bool											protMemSupported		= false;
+	VkInstance										instance					(m_context.getInstance());
+	InstanceDriver									instanceDriver				(m_context.getPlatformInterface(), instance);
+	const VkPhysicalDeviceFeatures					deviceFeatures				= getPhysicalDeviceFeatures(instanceDriver, m_context.getPhysicalDevice());
+	const float										queuePriority				= 1.0f;
+	deUint32										queueFamilyIndex			= 0;
+	bool											protMemSupported			= false;
+	bool											deviceCoherentMemSupported	= false;
 
 	VkPhysicalDeviceProtectedMemoryFeatures protectedMemoryFeature =
 	{
@@ -172,19 +173,28 @@
 		VK_FALSE													// VkBool32							protectedMemory;
 	};
 
+	VkPhysicalDeviceCoherentMemoryFeaturesAMD coherentMemoryFeatures =
+	{
+		VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COHERENT_MEMORY_FEATURES_AMD, // VkStructureType                                      sType
+		&protectedMemoryFeature,										// const void*                                          pNext
+		VK_FALSE                                                        // VkBool32                                             deviceCoherentMemory;
+	};
+
+
 	VkPhysicalDeviceFeatures				features;
 	deMemset(&features, 0, sizeof(vk::VkPhysicalDeviceFeatures));
 
 	VkPhysicalDeviceFeatures2				features2		=
 	{
 		VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2,				// VkStructureType					sType
-		&protectedMemoryFeature,									// const void*						pNext
+		&coherentMemoryFeatures,									// const void*						pNext
 		features													// VkPhysicalDeviceFeatures			features
 	};
 
 	// Check if the physical device supports the protected memory feature
 	instanceDriver.getPhysicalDeviceFeatures2(m_context.getPhysicalDevice(), &features2);
-	protMemSupported = ((VkPhysicalDeviceProtectedMemoryFeatures*)(features2.pNext))->protectedMemory;
+	protMemSupported			= protectedMemoryFeature.protectedMemory;
+	deviceCoherentMemSupported	= coherentMemoryFeatures.deviceCoherentMemory;
 
 	VkDeviceQueueCreateFlags queueCreateFlags = protMemSupported ? (vk::VkDeviceQueueCreateFlags)vk::VK_DEVICE_QUEUE_CREATE_PROTECTED_BIT : 0u;
 
@@ -200,16 +210,16 @@
 
 	const VkDeviceCreateInfo						deviceInfo		=
 	{
-		VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO,						// VkStructureType					sType;
-		protMemSupported ? &features2 : DE_NULL,					// const void*						pNext;
-		(VkDeviceCreateFlags)0,										// VkDeviceCreateFlags				flags;
-		1u,															// uint32_t							queueCreateInfoCount;
-		&queueInfo,													// const VkDeviceQueueCreateInfo*	pQueueCreateInfos;
-		0u,															// uint32_t							enabledLayerCount;
-		DE_NULL,													// const char* const*				ppEnabledLayerNames;
-		0u,															// uint32_t							enabledExtensionCount;
-		DE_NULL,													// const char* const*				ppEnabledExtensionNames;
-		protMemSupported ? DE_NULL : &deviceFeatures				// const VkPhysicalDeviceFeatures*	pEnabledFeatures;
+		VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO,											// VkStructureType					sType;
+		(protMemSupported || deviceCoherentMemSupported) ? &features2 : DE_NULL,		// const void*						pNext;
+		(VkDeviceCreateFlags)0,															// VkDeviceCreateFlags				flags;
+		1u,																				// uint32_t							queueCreateInfoCount;
+		&queueInfo,																		// const VkDeviceQueueCreateInfo*	pQueueCreateInfos;
+		0u,																				// uint32_t							enabledLayerCount;
+		DE_NULL,																		// const char* const*				ppEnabledLayerNames;
+		0u,																				// uint32_t							enabledExtensionCount;
+		DE_NULL,																		// const char* const*				ppEnabledExtensionNames;
+		(protMemSupported || deviceCoherentMemSupported) ? DE_NULL : &deviceFeatures	// const VkPhysicalDeviceFeatures*	pEnabledFeatures;
 	};
 
 	m_logicalDevice		= createCustomDevice(m_context.getTestContext().getCommandLine().isValidationEnabled(), m_context.getPlatformInterface(), instance, instanceDriver, m_context.getPhysicalDevice(), &deviceInfo);
diff --git a/external/vulkancts/modules/vulkan/transform_feedback/vktTransformFeedbackSimpleTests.cpp b/external/vulkancts/modules/vulkan/transform_feedback/vktTransformFeedbackSimpleTests.cpp
index ae01661..56a09aa 100644
--- a/external/vulkancts/modules/vulkan/transform_feedback/vktTransformFeedbackSimpleTests.cpp
+++ b/external/vulkancts/modules/vulkan/transform_feedback/vktTransformFeedbackSimpleTests.cpp
@@ -1392,6 +1392,8 @@
 		vk.cmdPipelineBarrier(*cmdBuffer, VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT, VK_PIPELINE_STAGE_TRANSFER_BIT, 0u, 0u, DE_NULL, 0u, DE_NULL, 1u, &preCopyBarrier);
 		vk.cmdCopyImageToBuffer(*cmdBuffer, *colorImage, VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, *colorBuffer, 1u, &region);
 		vk.cmdPipelineBarrier(*cmdBuffer, VK_PIPELINE_STAGE_TRANSFER_BIT, VK_PIPELINE_STAGE_HOST_BIT, 0u, 0u, DE_NULL, 1u, &postCopyBarrier, DE_NULL, 0u);
+
+		invalidateAlloc(vk, device, *colorBufferAlloc);
 	}
 	endCommandBuffer(vk, *cmdBuffer);
 	submitCommandsAndWait(vk, device, queue, *cmdBuffer);
@@ -1537,6 +1539,8 @@
 		vk.cmdPipelineBarrier(*cmdBuffer, VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT, VK_PIPELINE_STAGE_TRANSFER_BIT, 0u, 0u, DE_NULL, 0u, DE_NULL, 1u, &preCopyBarrier);
 		vk.cmdCopyImageToBuffer(*cmdBuffer, *colorImage, VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, *colorBuffer, 1u, &region);
 		vk.cmdPipelineBarrier(*cmdBuffer, VK_PIPELINE_STAGE_TRANSFER_BIT, VK_PIPELINE_STAGE_HOST_BIT, 0u, 0u, DE_NULL, 1u, &postCopyBarrier, DE_NULL, 0u);
+
+		invalidateAlloc(vk, device, *colorBufferAlloc);
 	}
 	endCommandBuffer(vk, *cmdBuffer);
 	submitCommandsAndWait(vk, device, queue, *cmdBuffer);
diff --git a/framework/common/tcuThreadUtil.cpp b/framework/common/tcuThreadUtil.cpp
index 964c213..cb1b476 100644
--- a/framework/common/tcuThreadUtil.cpp
+++ b/framework/common/tcuThreadUtil.cpp
@@ -61,7 +61,7 @@
 	m_lock.lock();
 
 	if (m_result == RESULT_NOT_READY)
-		m_waiterCount++;
+		m_waiterCount = m_waiterCount + 1;
 	else
 	{
 		m_lock.unlock();
diff --git a/framework/delibs/decpp/deSpinBarrier.cpp b/framework/delibs/decpp/deSpinBarrier.cpp
index e328abc..8111a35 100644
--- a/framework/delibs/decpp/deSpinBarrier.cpp
+++ b/framework/delibs/decpp/deSpinBarrier.cpp
@@ -102,12 +102,12 @@
 	{
 		// Release all waiting threads. Since this thread has not been removed, m_numLeaving will
 		// be >= 1 until m_numLeaving is decremented at the end of this function.
-		m_numThreads -= m_numRemoved;
-		m_numLeaving  = m_numThreads;
-		m_numRemoved  = 0;
+		m_numThreads = m_numThreads - m_numRemoved;
+		m_numLeaving = m_numThreads;
+		m_numRemoved = 0;
 
 		deMemoryReadWriteFence();
-		m_numEntered  = 0;
+		m_numEntered = 0;
 	}
 	else
 	{
@@ -148,12 +148,12 @@
 	if (deAtomicIncrement32(&m_numEntered) == cachedNumThreads)
 	{
 		// Release all waiting threads.
-		m_numThreads -= m_numRemoved;
-		m_numLeaving  = m_numThreads;
-		m_numRemoved  = 0;
+		m_numThreads = m_numThreads - m_numRemoved;
+		m_numLeaving = m_numThreads;
+		m_numRemoved = 0;
 
 		deMemoryReadWriteFence();
-		m_numEntered  = 0;
+		m_numEntered = 0;
 	}
 }
 
diff --git a/framework/randomshaders/rsgExecutionContext.hpp b/framework/randomshaders/rsgExecutionContext.hpp
index b83c5d6..1df940d 100644
--- a/framework/randomshaders/rsgExecutionContext.hpp
+++ b/framework/randomshaders/rsgExecutionContext.hpp
@@ -34,10 +34,7 @@
 namespace rsg
 {
 
-enum
-{
-	EXEC_VEC_WIDTH	= 64
-};
+constexpr int EXEC_VEC_WIDTH = 64;
 
 typedef ConstStridedValueAccess<EXEC_VEC_WIDTH>			ExecConstValueAccess;
 typedef StridedValueAccess<EXEC_VEC_WIDTH>				ExecValueAccess;
diff --git a/framework/referencerenderer/rrFragmentPacket.hpp b/framework/referencerenderer/rrFragmentPacket.hpp
index 688af75..13df23f 100644
--- a/framework/referencerenderer/rrFragmentPacket.hpp
+++ b/framework/referencerenderer/rrFragmentPacket.hpp
@@ -29,10 +29,7 @@
 namespace rr
 {
 
-enum
-{
-	NUM_FRAGMENTS_PER_PACKET	= 4
-};
+constexpr int NUM_FRAGMENTS_PER_PACKET = 4;
 
 /*--------------------------------------------------------------------*//*!
  * \brief Fragment packet
diff --git a/modules/glshared/glsBuiltinPrecisionTests.cpp b/modules/glshared/glsBuiltinPrecisionTests.cpp
index 8e64dd5..cf52410 100644
--- a/modules/glshared/glsBuiltinPrecisionTests.cpp
+++ b/modules/glshared/glsBuiltinPrecisionTests.cpp
@@ -653,33 +653,6 @@
 	int		m_count;
 };
 
-class ExpandContext
-{
-public:
-						ExpandContext	(Counter& symCounter) : m_symCounter(symCounter) {}
-						ExpandContext	(const ExpandContext& parent)
-							: m_symCounter(parent.m_symCounter) {}
-
-	template<typename T>
-	VariableP<T>		genSym			(const string& baseName)
-	{
-		return variable<T>(baseName + de::toString(m_symCounter()));
-	}
-
-	void				addStatement	(const StatementP& stmt)
-	{
-		m_statements.push_back(stmt);
-	}
-
-	vector<StatementP>	getStatements	(void) const
-	{
-		return m_statements;
-	}
-private:
-	Counter&			m_symCounter;
-	vector<StatementP>	m_statements;
-};
-
 /*--------------------------------------------------------------------*//*!
  * \brief A statement or declaration.
  *
@@ -728,6 +701,33 @@
 				StatementP			(const Super& ptr)		: Super(ptr) {}
 };
 
+class ExpandContext
+{
+public:
+						ExpandContext	(Counter& symCounter) : m_symCounter(symCounter) {}
+						ExpandContext	(const ExpandContext& parent)
+							: m_symCounter(parent.m_symCounter) {}
+
+	template<typename T>
+	VariableP<T>		genSym			(const string& baseName)
+	{
+		return variable<T>(baseName + de::toString(m_symCounter()));
+	}
+
+	void				addStatement	(const StatementP& stmt)
+	{
+		m_statements.push_back(stmt);
+	}
+
+	vector<StatementP>	getStatements	(void) const
+	{
+		return m_statements;
+	}
+private:
+	Counter&			m_symCounter;
+	vector<StatementP>	m_statements;
+};
+
 /*--------------------------------------------------------------------*//*!
  * \brief
  *