Merge vk-gl-cts/vulkan-cts-1.2.1 into vk-gl-cts/vulkan-cts-1.2.2

Change-Id: I4e83df12355f93f835da9812a28665f434459a5d
diff --git a/external/vulkancts/modules/vulkan/spirv_assembly/vktSpvAsmInstructionTests.cpp b/external/vulkancts/modules/vulkan/spirv_assembly/vktSpvAsmInstructionTests.cpp
index fc08fbb..ad486ca 100644
--- a/external/vulkancts/modules/vulkan/spirv_assembly/vktSpvAsmInstructionTests.cpp
+++ b/external/vulkancts/modules/vulkan/spirv_assembly/vktSpvAsmInstructionTests.cpp
@@ -10933,6 +10933,61 @@
 	return fragments;
 }
 
+const map<string, string> getConvertCaseFragmentsNoStorage(string instruction, const ConvertCase& convertCase)
+{
+	map<string, string> params = convertCase.m_asmTypes;
+	map<string, string> fragments;
+
+	params["instruction"] = instruction;
+	params["inDecorator"] = getByteWidthStr(convertCase.m_fromType);
+
+	const StringTemplate decoration(
+		"      OpDecorate %SSBOi DescriptorSet 0\n"
+		"      OpDecorate %SSBOo DescriptorSet 0\n"
+		"      OpDecorate %SSBOi Binding 0\n"
+		"      OpDecorate %SSBOo Binding 1\n"
+		"      OpDecorate %s_SSBOi Block\n"
+		"      OpDecorate %s_SSBOo Block\n"
+		"OpMemberDecorate %s_SSBOi 0 Offset 0\n"
+		"OpMemberDecorate %s_SSBOo 0 Offset 0\n");
+
+	const StringTemplate pre_main(
+		"${datatype_additional_decl:opt}"
+		"    %ptr_in = OpTypePointer StorageBuffer %${inStorageType}\n"
+		"   %ptr_out = OpTypePointer StorageBuffer %${outStorageType}\n"
+		"   %s_SSBOi = OpTypeStruct %${inStorageType}\n"
+		"   %s_SSBOo = OpTypeStruct %${outStorageType}\n"
+		" %ptr_SSBOi = OpTypePointer StorageBuffer %s_SSBOi\n"
+		" %ptr_SSBOo = OpTypePointer StorageBuffer %s_SSBOo\n"
+		"     %SSBOi = OpVariable %ptr_SSBOi StorageBuffer\n"
+		"     %SSBOo = OpVariable %ptr_SSBOo StorageBuffer\n");
+
+	const StringTemplate testfun(
+		"%test_code = OpFunction %v4f32 None %v4f32_v4f32_function\n"
+		"%param     = OpFunctionParameter %v4f32\n"
+		"%label     = OpLabel\n"
+		"%iLoc      = OpAccessChain %ptr_in %SSBOi %c_u32_0\n"
+		"%oLoc      = OpAccessChain %ptr_out %SSBOo %c_u32_0\n"
+		"%inval      = OpLoad %${inStorageType} %iLoc\n"
+		"%in_cast    = ${inCast} %${inputType} %inval\n"
+		"%conv       = ${instruction} %${outputType} %in_cast\n"
+		"%out_cast   = ${outCast} %${outStorageType} %conv\n"
+		"              OpStore %oLoc %out_cast\n"
+		"              OpReturnValue %param\n"
+		"              OpFunctionEnd\n");
+
+	params["datatype_extensions"] =
+		params["datatype_extensions"] +
+		"OpExtension \"SPV_KHR_storage_buffer_storage_class\"\n";
+
+	fragments["capability"] = params["datatype_capabilities"];
+	fragments["extension"] = params["datatype_extensions"];
+	fragments["decoration"] = decoration.specialize(params);
+	fragments["pre_main"] = pre_main.specialize(params);
+	fragments["testfun"] = testfun.specialize(params);
+	return fragments;
+}
+
 // Test for OpSConvert, OpUConvert, OpFConvert and OpConvert* in compute shaders
 tcu::TestCaseGroup* createConvertComputeTests (tcu::TestContext& testCtx, const string& instruction, const string& name)
 {
@@ -10964,7 +11019,7 @@
 
 	for (vector<ConvertCase>::const_iterator test = testCases.begin(); test != testCases.end(); ++test)
 	{
-		map<string, string>	fragments		= getConvertCaseFragments(instruction, *test);
+		map<string, string>	fragments		= (test->m_useStorageExt) ? getConvertCaseFragments(instruction, *test) : getConvertCaseFragmentsNoStorage(instruction,*test);
 		VulkanFeatures		vulkanFeatures;
 		GraphicsResources	resources;
 		vector<string>		extensions;
diff --git a/external/vulkancts/modules/vulkan/synchronization/vktSynchronizationOperationMultiQueueTests.cpp b/external/vulkancts/modules/vulkan/synchronization/vktSynchronizationOperationMultiQueueTests.cpp
index c149a35..5046ec8 100644
--- a/external/vulkancts/modules/vulkan/synchronization/vktSynchronizationOperationMultiQueueTests.cpp
+++ b/external/vulkancts/modules/vulkan/synchronization/vktSynchronizationOperationMultiQueueTests.cpp
@@ -642,8 +642,19 @@
 			const Data	expected	= m_ops.front()->getData();
 			const Data	actual		= m_ops.back()->getData();
 
-			if (0 != deMemCmp(expected.data, actual.data, expected.size))
-				return tcu::TestStatus::fail("Memory contents don't match");
+			if (isIndirectBuffer(m_resourceDesc.type))
+			{
+				const deUint32 expectedValue = reinterpret_cast<const deUint32*>(expected.data)[0];
+				const deUint32 actualValue   = reinterpret_cast<const deUint32*>(actual.data)[0];
+
+				if (actualValue < expectedValue)
+					return tcu::TestStatus::fail("Counter value is smaller than expected");
+			}
+			else
+			{
+				if (0 != deMemCmp(expected.data, actual.data, expected.size))
+					return tcu::TestStatus::fail("Memory contents don't match");
+			}
 		}
 
 		// Make the validation layers happy.
diff --git a/external/vulkancts/modules/vulkan/synchronization/vktSynchronizationOperationSingleQueueTests.cpp b/external/vulkancts/modules/vulkan/synchronization/vktSynchronizationOperationSingleQueueTests.cpp
index f21b98c..f2df751 100644
--- a/external/vulkancts/modules/vulkan/synchronization/vktSynchronizationOperationSingleQueueTests.cpp
+++ b/external/vulkancts/modules/vulkan/synchronization/vktSynchronizationOperationSingleQueueTests.cpp
@@ -435,8 +435,19 @@
 			const Data	expected = m_ops.front()->getData();
 			const Data	actual	 = m_ops.back()->getData();
 
-			if (0 != deMemCmp(expected.data, actual.data, expected.size))
-				return tcu::TestStatus::fail("Memory contents don't match");
+			if (isIndirectBuffer(m_resources[0]->getType()))
+			{
+				const deUint32 expectedValue = reinterpret_cast<const deUint32*>(expected.data)[0];
+				const deUint32 actualValue   = reinterpret_cast<const deUint32*>(actual.data)[0];
+
+				if (actualValue < expectedValue)
+					return tcu::TestStatus::fail("Counter value is smaller than expected");
+			}
+			else
+			{
+				if (0 != deMemCmp(expected.data, actual.data, expected.size))
+					return tcu::TestStatus::fail("Memory contents don't match");
+			}
 		}
 
 		return tcu::TestStatus::pass("OK");