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

Change-Id: I860e6b43aca52008fecc755bd0a377dca99e8927
diff --git a/external/vulkancts/data/vulkan/amber/graphicsfuzz/control-flow-switch.amber b/external/vulkancts/data/vulkan/amber/graphicsfuzz/control-flow-switch.amber
index 6f9dbaa..3393d1b 100644
--- a/external/vulkancts/data/vulkan/amber/graphicsfuzz/control-flow-switch.amber
+++ b/external/vulkancts/data/vulkan/amber/graphicsfuzz/control-flow-switch.amber
@@ -89,7 +89,7 @@
 ; SPIR-V
 ; Version: 1.0
 ; Generator: Khronos SPIR-V Tools Assembler; 0
-; Bound: 72
+; Bound: 73
 ; Schema: 0
                OpCapability Shader
           %1 = OpExtInstImport "GLSL.std.450"
@@ -153,20 +153,22 @@
                OpLoopMerge %40 %41 None
                OpBranch %42
          %42 = OpLabel
-         %43 = OpPhi %8 %28 %39 %44 %45
-         %46 = OpPhi %11 %12 %39 %47 %45
+         %43 = OpPhi %8 %28 %39 %44 %72
+         %46 = OpPhi %11 %12 %39 %47 %72
          %48 = OpSLessThan %8 %46 %13
-               OpLoopMerge %49 %45 None
+               OpLoopMerge %49 %72 None
                OpBranchConditional %48 %50 %49
          %50 = OpLabel
          %51 = OpConvertFToS %11 %35
                OpSelectionMerge %52 None
                OpSwitch %51 %45 9 %53 42 %54
          %52 = OpLabel
-               OpBranch %45
+               OpBranch %72
          %45 = OpLabel
-         %44 = OpPhi %8 %43 %50 %55 %56 %27 %52
+         %44 = OpPhi %8 %43 %50 %55 %56
          %47 = OpIAdd %11 %46 %13
+               OpBranch %72
+         %72 = OpLabel
                OpBranch %42
          %53 = OpLabel
                OpBranch %54
diff --git a/external/vulkancts/data/vulkan/amber/graphicsfuzz/cov-dead-branch-func-return-arg.amber b/external/vulkancts/data/vulkan/amber/graphicsfuzz/cov-dead-branch-func-return-arg.amber
index 3c2f4f0..66fc691 100644
--- a/external/vulkancts/data/vulkan/amber/graphicsfuzz/cov-dead-branch-func-return-arg.amber
+++ b/external/vulkancts/data/vulkan/amber/graphicsfuzz/cov-dead-branch-func-return-arg.amber
@@ -93,7 +93,7 @@
 ; SPIR-V
 ; Version: 1.0
 ; Generator: Khronos Glslang Reference Front End; 8
-; Bound: 126
+; Bound: 127
 ; Schema: 0
                OpCapability Shader
           %1 = OpExtInstImport "GLSL.std.450"
@@ -150,7 +150,7 @@
          %42 = OpLoad %6 %36
                OpStore %41 %42
                OpStore %74 %68
-               OpLoopMerge %39 %37 None
+               OpLoopMerge %39 %126 None
                OpBranch %78
          %78 = OpLabel
          %79 = OpLoad %6 %41
@@ -244,7 +244,9 @@
          %47 = OpFAdd %6 %46 %125
                OpStore %36 %47
          %50 = OpFOrdLessThan %20 %47 %49
-               OpBranchConditional %50 %37 %39
+               OpBranchConditional %50 %126 %39
+        %126 = OpLabel
+               OpBranch %37
          %39 = OpLabel
          %51 = OpLoad %6 %35
          %53 = OpFOrdEqual %20 %51 %52
diff --git a/external/vulkancts/data/vulkan/amber/graphicsfuzz/nested-for-loops-with-return.amber b/external/vulkancts/data/vulkan/amber/graphicsfuzz/nested-for-loops-with-return.amber
index ab0ad54..97f8be1 100644
--- a/external/vulkancts/data/vulkan/amber/graphicsfuzz/nested-for-loops-with-return.amber
+++ b/external/vulkancts/data/vulkan/amber/graphicsfuzz/nested-for-loops-with-return.amber
@@ -87,7 +87,7 @@
 ; SPIR-V
 ; Version: 1.0
 ; Generator: Khronos Glslang Reference Front End; 7
-; Bound: 65
+; Bound: 66
 ; Schema: 0
                OpCapability Shader
           %1 = OpExtInstImport "GLSL.std.450"
@@ -164,8 +164,10 @@
                OpBranch %32
          %32 = OpLabel
          %39 = OpSLessThan %14 %22 %38
-               OpLoopMerge %34 %35 None
+               OpLoopMerge %65 %35 None
                OpBranch %33
+         %65 = OpLabel
+               OpBranch %34
          %33 = OpLabel
                OpReturnValue %12
          %35 = OpLabel
diff --git a/external/vulkancts/modules/vulkan/api/vktApiImageClearingTests.cpp b/external/vulkancts/modules/vulkan/api/vktApiImageClearingTests.cpp
index b97ba82..6a78792 100644
--- a/external/vulkancts/modules/vulkan/api/vktApiImageClearingTests.cpp
+++ b/external/vulkancts/modules/vulkan/api/vktApiImageClearingTests.cpp
@@ -498,7 +498,7 @@
 	void								submitCommandBuffer				(void) const;
 	void								beginRenderPass					(VkSubpassContents content, VkClearValue clearValue) const;
 	void								preClearImage					(const deUint32 imageMipLevels, VkExtent3D imageExtent, deUint32 imageLayerCount, Unique<VkCommandBuffer>& commandBuffer) const;
-	Move<VkBuffer>						createImageClearingBuffer		(const DeviceInterface& vkd, const VkDevice device, Unique<VkImage>& image);
+	Move<VkBuffer>						createImageClearingBuffer		(const DeviceInterface& vkd, const VkDevice device);
 
 	void								pipelineImageBarrier			(VkPipelineStageFlags srcStageMask, VkPipelineStageFlags dstStageMask, VkAccessFlags srcAccessMask, VkAccessFlags dstAccessMask, VkImageLayout oldLayout, VkImageLayout newLayout, VkImageAspectFlags aspectMask = 0u) const;
 	de::MovePtr<TextureLevelPyramid>	readImage						(VkImageAspectFlags aspectMask, deUint32 baseLayer) const;
@@ -578,7 +578,7 @@
 											 params.imageLayerCount,
 											 m_imageUsageFlags))
 
-	, m_stagingBuffer			(createImageClearingBuffer(m_vkd, m_device,  m_image))
+	, m_stagingBuffer			(createImageClearingBuffer(m_vkd, m_device))
 	, m_stagingBufferMemory		(allocateAndBindBufferMemory(*m_stagingBuffer))
 
 	, m_imageMemory				(allocateAndBindImageMemory(*m_image))
@@ -1311,11 +1311,12 @@
 	return TestStatus::pass(successMessage);
 }
 
-Move<VkBuffer> ImageClearingTestInstance::createImageClearingBuffer(const DeviceInterface& vkd, const VkDevice device, Unique<VkImage>& image)
+Move<VkBuffer> ImageClearingTestInstance::createImageClearingBuffer(const DeviceInterface& vkd, const VkDevice device)
 {
 	Move<VkBuffer>							stagingBuffer;
 	de::MovePtr<Allocation>					stagingBufferAlloc;
-	const VkDeviceSize stagingBufferSize	= getImageMemoryRequirements(vkd, device, *image).size;
+	const VkDeviceSize stagingBufferSize	= m_params.imageExtent.width * m_params.imageExtent.height * m_params.imageExtent.depth
+											  * getPixelSize(mapVkFormat(m_params.imageFormat)) * m_params.imageLayerCount;
 	// Create image clearing buffer
 	{
 		const VkBufferCreateInfo   bufferParams   =
diff --git a/external/vulkancts/modules/vulkan/binding_model/vktBindingDescriptorUpdateASTests.cpp b/external/vulkancts/modules/vulkan/binding_model/vktBindingDescriptorUpdateASTests.cpp
index 032e9ce..ea74b00 100644
--- a/external/vulkancts/modules/vulkan/binding_model/vktBindingDescriptorUpdateASTests.cpp
+++ b/external/vulkancts/modules/vulkan/binding_model/vktBindingDescriptorUpdateASTests.cpp
@@ -1891,6 +1891,9 @@
 
 	if (rayTracingPipelineFeaturesKHR.rayTracingPipeline == DE_FALSE)
 		TCU_THROW(NotSupportedError, "Requires VkPhysicalDeviceRayTracingPipelineFeaturesKHR.rayTracingPipeline");
+	const VkPhysicalDeviceRayTracingPipelinePropertiesKHR&	rayTracingPipelinePropertiesKHR = context.getRayTracingPipelineProperties();
+	if (rayTracingPipelinePropertiesKHR.maxRayRecursionDepth < 2 && testParams.testType == TEST_TYPE_USING_RAY_TRACING && (testParams.stage == VK_SHADER_STAGE_CLOSEST_HIT_BIT_KHR || testParams.stage == VK_SHADER_STAGE_MISS_BIT_KHR))
+		TCU_THROW(NotSupportedError, "rayTracingPipelinePropertiesKHR.maxRayRecursionDepth is smaller than required");
 }
 
 void BindingAcceleratioStructureRayTracingRayTracingTestInstance::initPrograms (SourceCollections&	programCollection,
diff --git a/external/vulkancts/modules/vulkan/pipeline/vktPipelineBindPointTests.cpp b/external/vulkancts/modules/vulkan/pipeline/vktPipelineBindPointTests.cpp
index ae95208..152934e 100644
--- a/external/vulkancts/modules/vulkan/pipeline/vktPipelineBindPointTests.cpp
+++ b/external/vulkancts/modules/vulkan/pipeline/vktPipelineBindPointTests.cpp
@@ -180,12 +180,18 @@
 
 void BindPointTest::checkSupport (Context& context) const
 {
-	if (m_params.graphicsSetUpdateType != SetUpdateType::WRITE || m_params.computeSetUpdateType != SetUpdateType::WRITE)
+	if ((m_params.hasGraphics() && m_params.graphicsSetUpdateType != SetUpdateType::WRITE) ||
+		(m_params.hasCompute() && m_params.computeSetUpdateType != SetUpdateType::WRITE) ||
+		(m_params.hasRayTracing() && m_params.rayTracingSetUpdateType != SetUpdateType::WRITE))
 	{
 		context.requireDeviceFunctionality("VK_KHR_push_descriptor");
 
-		if (m_params.graphicsSetUpdateType == SetUpdateType::PUSH_WITH_TEMPLATE || m_params.computeSetUpdateType == SetUpdateType::PUSH_WITH_TEMPLATE)
+		if ((m_params.hasGraphics() && m_params.graphicsSetUpdateType == SetUpdateType::PUSH_WITH_TEMPLATE) ||
+			(m_params.hasCompute() && m_params.computeSetUpdateType == SetUpdateType::PUSH_WITH_TEMPLATE) ||
+			(m_params.hasRayTracing() && m_params.rayTracingSetUpdateType == SetUpdateType::PUSH_WITH_TEMPLATE))
+		{
 			context.requireDeviceFunctionality("VK_KHR_descriptor_update_template");
+		}
 	}
 
 	if (m_params.hasRayTracing())
diff --git a/external/vulkancts/modules/vulkan/ray_tracing/vktRayTracingAccelerationStructuresTests.cpp b/external/vulkancts/modules/vulkan/ray_tracing/vktRayTracingAccelerationStructuresTests.cpp
index 2e957be..db49077 100644
--- a/external/vulkancts/modules/vulkan/ray_tracing/vktRayTracingAccelerationStructuresTests.cpp
+++ b/external/vulkancts/modules/vulkan/ray_tracing/vktRayTracingAccelerationStructuresTests.cpp
@@ -2797,6 +2797,7 @@
 
 	// deserialize all from the previous step to a new top-level AS
 	// bottom-level structure addresses should be updated when deep data is deserialized
+	vkd.resetCommandBuffer(*cmdBuffer, 0);
 	beginCommandBuffer(vkd, *cmdBuffer, 0);
 	dst->createAndDeserializeFrom(vkd, device, *cmdBuffer, allocator, &deepStorage);
 	endCommandBuffer(vkd, *cmdBuffer);
@@ -2805,6 +2806,7 @@
 	SerialStorage										shallowStorage	(vkd, device, allocator, m_params->buildType, inSizes[0]);
 
 	// make shallow serialization - only top-level AS without bottom-level structures
+	vkd.resetCommandBuffer(*cmdBuffer, 0);
 	beginCommandBuffer(vkd, *cmdBuffer, 0);
 	dst->serialize(vkd, device, *cmdBuffer, &shallowStorage);
 	endCommandBuffer(vkd, *cmdBuffer);
diff --git a/external/vulkancts/modules/vulkan/ycbcr/vktYCbCrViewTests.cpp b/external/vulkancts/modules/vulkan/ycbcr/vktYCbCrViewTests.cpp
index fd4ed13..1734b5f 100644
--- a/external/vulkancts/modules/vulkan/ycbcr/vktYCbCrViewTests.cpp
+++ b/external/vulkancts/modules/vulkan/ycbcr/vktYCbCrViewTests.cpp
@@ -392,32 +392,21 @@
 	}
 }
 
-void checkImageUsageSupport (Context&			context,
-							 VkFormat			format,
-							 VkImageUsageFlags	usage)
+void checkImageFeatureSupport (Context& context, VkFormat format, VkFormatFeatureFlags req)
 {
-	const VkFormatProperties	formatProperties	= getPhysicalDeviceFormatProperties(context.getInstanceInterface(),
-																						context.getPhysicalDevice(),
-																						format);
-	const VkFormatFeatureFlags	featureFlags		= formatProperties.optimalTilingFeatures;
+	const VkFormatProperties formatProperties = getPhysicalDeviceFormatProperties(	context.getInstanceInterface(),
+																					context.getPhysicalDevice(),
+																					format);
 
-	if ((usage & VK_IMAGE_USAGE_SAMPLED_BIT) != 0
-		&& (featureFlags & VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT) == 0)
-	{
-		TCU_THROW(NotSupportedError, "Format doesn't support sampling");
-	}
-
-	// Other image usages are not handled currently
-	DE_ASSERT((usage & ~(VK_IMAGE_USAGE_TRANSFER_SRC_BIT|VK_IMAGE_USAGE_TRANSFER_DST_BIT|VK_IMAGE_USAGE_SAMPLED_BIT)) == 0);
+	if (req & ~formatProperties.optimalTilingFeatures)
+		TCU_THROW(NotSupportedError, "Format doesn't support required features");
 }
 
 void checkSupport(Context& context, TestParameters params)
 {
-	const VkImageUsageFlags usage = VK_IMAGE_USAGE_SAMPLED_BIT | VK_IMAGE_USAGE_TRANSFER_DST_BIT;
-
 	checkImageSupport(context, params.format, params.createFlags);
-	checkImageUsageSupport(context, params.format, usage);
-	checkImageUsageSupport(context, params.planeCompatibleFormat, usage);
+	checkImageFeatureSupport(context, params.format,				VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT | VK_FORMAT_FEATURE_TRANSFER_DST_BIT | VK_FORMAT_FEATURE_MIDPOINT_CHROMA_SAMPLES_BIT);
+	checkImageFeatureSupport(context, params.planeCompatibleFormat,	VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT | VK_FORMAT_FEATURE_TRANSFER_DST_BIT);
 }
 
 tcu::TestStatus testPlaneView (Context& context, TestParameters params)