Merge vk-gl-cts/vulkan-cts-1.3.1 into vk-gl-cts/vulkan-cts-1.3.2

Change-Id: Ie9da086ce3cfaa7b9aa768fdf700905f0512f446
diff --git a/external/vulkancts/modules/vulkan/fragment_ops/vktFragmentOperationsTransientAttachmentTests.cpp b/external/vulkancts/modules/vulkan/fragment_ops/vktFragmentOperationsTransientAttachmentTests.cpp
index 5fa0be2..76c0726 100644
--- a/external/vulkancts/modules/vulkan/fragment_ops/vktFragmentOperationsTransientAttachmentTests.cpp
+++ b/external/vulkancts/modules/vulkan/fragment_ops/vktFragmentOperationsTransientAttachmentTests.cpp
@@ -34,6 +34,7 @@
 #include "vkObjUtil.hpp"
 #include "vkQueryUtil.hpp"
 #include "vkTypeUtil.hpp"
+#include "vkBarrierUtil.hpp"
 
 #include "tcuImageCompare.hpp"
 #include "tcuTestLog.hpp"
@@ -450,12 +451,8 @@
 		updater.update(vk, device);
 	}
 
-	const tcu::TextureFormat			tcuFormat					= mapVkFormat(m_testFormat);
-	VkImageLayout						inputLayout					= tcuFormat.order == tcu::TextureFormat::DS
-																	? VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL
-																	: tcuFormat.order == tcu::TextureFormat::D
-																	? VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL
-																	: tcuFormat.order == tcu::TextureFormat::S
+	const bool							isDepthStencil				= isDepthStencilFormat(m_testFormat);
+	VkImageLayout						inputLayout					= isDepthStencil
 																	? VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL
 																	: VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL;
 
@@ -513,6 +510,16 @@
 		beginRenderPass(vk, *cmdBuffer, *renderPassOne, *framebufferOne, renderArea, clearValue);
 		endRenderPass(vk, *cmdBuffer);
 
+		// Synchronize clear and read operations.
+		{
+			const auto srcAccess	= isDepthStencil ? VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT : VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT;
+			const auto dstAccess	= VK_ACCESS_INPUT_ATTACHMENT_READ_BIT;
+			const auto srcStage		= isDepthStencil ? (VK_PIPELINE_STAGE_EARLY_FRAGMENT_TESTS_BIT | VK_PIPELINE_STAGE_LATE_FRAGMENT_TESTS_BIT) : VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT;
+			const auto dstStage		= VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT;
+			const auto clearToLoad	= makeMemoryBarrier(srcAccess, dstAccess);
+			cmdPipelineMemoryBarrier(vk, *cmdBuffer, srcStage, dstStage, &clearToLoad);
+		}
+
 		// Draw with input attachment
 		beginRenderPass(vk, *cmdBuffer, *renderPassTwo, *framebufferTwo, renderArea);
 		vk.cmdBindPipeline(*cmdBuffer, VK_PIPELINE_BIND_POINT_GRAPHICS, *pipeline);
diff --git a/external/vulkancts/modules/vulkan/modifiers/vktModifiersTests.cpp b/external/vulkancts/modules/vulkan/modifiers/vktModifiersTests.cpp
index 8738f11..86bd9ed 100644
--- a/external/vulkancts/modules/vulkan/modifiers/vktModifiersTests.cpp
+++ b/external/vulkancts/modules/vulkan/modifiers/vktModifiersTests.cpp
@@ -748,6 +748,8 @@
 	tcu::ConstPixelBufferAccess	result	(referenceTextureFormat, imageSize.x(), imageSize.y(), 1, outputBuffer->getAllocation().getHostPtr());
 	const tcu::UVec4 threshold (0u);
 
+	invalidateAlloc(vkd, device, outputBuffer->getAllocation());
+
 	return tcu::intThresholdCompare(context.getTestContext().getLog(), "Compare", "Result comparison", referenceImage, result, threshold, tcu::COMPARE_LOG_RESULT);
 }
 
diff --git a/external/vulkancts/modules/vulkan/ray_tracing/vktRayTracingAccelerationStructuresTests.cpp b/external/vulkancts/modules/vulkan/ray_tracing/vktRayTracingAccelerationStructuresTests.cpp
index 99ee4bf..37d6f85 100644
--- a/external/vulkancts/modules/vulkan/ray_tracing/vktRayTracingAccelerationStructuresTests.cpp
+++ b/external/vulkancts/modules/vulkan/ray_tracing/vktRayTracingAccelerationStructuresTests.cpp
@@ -1773,6 +1773,9 @@
 			topLevelRayTracedPtr = topLevelAccelerationStructureCopy.get();
 		}
 
+		const VkMemoryBarrier preTraceMemoryBarrier = makeMemoryBarrier(VK_ACCESS_TRANSFER_WRITE_BIT, VK_ACCESS_SHADER_READ_BIT | VK_ACCESS_SHADER_WRITE_BIT);
+		cmdPipelineMemoryBarrier(vkd, *cmdBuffer, VK_PIPELINE_STAGE_TRANSFER_BIT, VK_PIPELINE_STAGE_RAY_TRACING_SHADER_BIT_KHR, &preTraceMemoryBarrier);
+
 		VkWriteDescriptorSetAccelerationStructureKHR	accelerationStructureWriteDescriptorSet	=
 		{
 			VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET_ACCELERATION_STRUCTURE_KHR,	//  VkStructureType						sType;
diff --git a/external/vulkancts/modules/vulkan/subgroups/vktSubgroupsSizeControlTests.cpp b/external/vulkancts/modules/vulkan/subgroups/vktSubgroupsSizeControlTests.cpp
index c7652e2..6706f8a 100755
--- a/external/vulkancts/modules/vulkan/subgroups/vktSubgroupsSizeControlTests.cpp
+++ b/external/vulkancts/modules/vulkan/subgroups/vktSubgroupsSizeControlTests.cpp
@@ -741,7 +741,8 @@
 		};
 
 		deUint32 localSizesToTestCount = 5;
-		if (caseDef.pipelineShaderStageCreateFlags & VK_PIPELINE_SHADER_STAGE_CREATE_REQUIRE_FULL_SUBGROUPS_BIT_EXT)
+		if (caseDef.pipelineShaderStageCreateFlags & VK_PIPELINE_SHADER_STAGE_CREATE_REQUIRE_FULL_SUBGROUPS_BIT_EXT
+			|| caseDef.spirvVersion >= SPIRV_VERSION_1_6)
 			localSizesToTestCount = 3;
 
 		struct internalDataStruct internalData =
@@ -754,8 +755,8 @@
 		// Depending on the flag and SPIR-V version we need to run one verification function or another.
 		subgroups::CheckResultCompute							checkResult									= checkCompute;
 
-		if (caseDef.pipelineShaderStageCreateFlags == VK_PIPELINE_SHADER_STAGE_CREATE_REQUIRE_FULL_SUBGROUPS_BIT_EXT
-			|| caseDef.spirvVersion == SPIRV_VERSION_1_6)
+		if (caseDef.pipelineShaderStageCreateFlags & VK_PIPELINE_SHADER_STAGE_CREATE_REQUIRE_FULL_SUBGROUPS_BIT_EXT
+			|| caseDef.spirvVersion >= SPIRV_VERSION_1_6)
 			checkResult = checkComputeRequireFull;
 
 		return subgroups::makeComputeTestRequiredSubgroupSize(context,