Enable validation for all custom devices

This commit changes some tests that use custom devices so they rely on
the custom device helper functions to create these custom devices with
the validation layers enabled if requested from the command line.

In addition, some "createDevice" functions are renamed so a simple
search for "createDevice" only reports uses of the createDevice instance
interface method and RefUtil helper function.

The affected tests should only behave differently with validation
enabled. Running these tests without validation should not result in any
changes.

Affected tests:
dEQP-VK.api.buffer_marker.*
dEQP-VK.api.info.vulkan1p2.feature_bits_influence
dEQP-VK.draw.concurrent.compute_and_triangle_list
dEQP-VK.ray_tracing_pipeline.capture_replay.*
dEQP-VK.synchronization*.signal_order.*
dEQP-VK.synchronization.timeline_semaphore.*
dEQP-VK.synchronization2.timeline_semaphore.*

Components: Vulkan
VK-GL-CTS issue: 2835

Change-Id: I6e8028428faa69d92ab9a8a0e8ba25540d04810f
diff --git a/external/vulkancts/modules/vulkan/api/vktApiBufferMarkerTests.cpp b/external/vulkancts/modules/vulkan/api/vktApiBufferMarkerTests.cpp
index 69d6466..7ffd2fa 100644
--- a/external/vulkancts/modules/vulkan/api/vktApiBufferMarkerTests.cpp
+++ b/external/vulkancts/modules/vulkan/api/vktApiBufferMarkerTests.cpp
@@ -27,6 +27,7 @@
 #include "vktTestCaseUtil.hpp"
 #include "vktTestGroupUtil.hpp"
 #include "vktExternalMemoryUtil.hpp"
+#include "vktCustomInstancesDevices.hpp"
 #include "vkPlatform.hpp"
 #include "vkCmdUtil.hpp"
 #include "vkObjUtil.hpp"
@@ -34,6 +35,7 @@
 #include "vkQueryUtil.hpp"
 #include "vkRefUtil.hpp"
 #include "vkBuilderUtil.hpp"
+#include "tcuCommandLine.hpp"
 #include "deUniquePtr.hpp"
 #include "deSharedPtr.hpp"
 #include "deRandom.hpp"
@@ -106,6 +108,7 @@
 	const VkInstance			instance		= context.getInstance();
 	const InstanceInterface&	instanceDriver	= context.getInstanceInterface();
 	const VkPhysicalDevice		physicalDevice	= context.getPhysicalDevice();
+	const auto					useValidation	= context.getTestContext().getCommandLine().isValidationEnabled();
 
 	// Create a device with extension enabled and a queue with a family which supports the buffer marker extension
 	const std::vector<VkQueueFamilyProperties>	queueFamilyProperties	= getPhysicalDeviceQueueFamilyProperties(instanceDriver, physicalDevice);
@@ -154,7 +157,7 @@
 		&context.getDeviceFeatures(),						// const VkPhysicalDeviceFeatures*	pEnabledFeatures;
 	};
 
-	wd.logicalDevice	= createDevice(vkp, instance, instanceDriver, physicalDevice, &deviceInfo);
+	wd.logicalDevice	= createCustomDevice(useValidation, vkp, instance, instanceDriver, physicalDevice, &deviceInfo);
 	wd.deviceDriver		= MovePtr<DeviceDriver>(new DeviceDriver(vkp, instance, *wd.logicalDevice));
 	wd.allocator		= MovePtr<Allocator>(new SimpleAllocator(*wd.deviceDriver, *wd.logicalDevice, getPhysicalDeviceMemoryProperties(instanceDriver, physicalDevice)));
 	wd.queueFamilyIdx	= queueCreateInfo.queueFamilyIndex;
diff --git a/external/vulkancts/modules/vulkan/api/vktApiFeatureInfo.cpp b/external/vulkancts/modules/vulkan/api/vktApiFeatureInfo.cpp
index 717aa14..e7b109c 100644
--- a/external/vulkancts/modules/vulkan/api/vktApiFeatureInfo.cpp
+++ b/external/vulkancts/modules/vulkan/api/vktApiFeatureInfo.cpp
@@ -1510,9 +1510,10 @@
 		TCU_THROW(NotSupportedError, "At least Vulkan 1.2 required to run test");
 }
 
-void createDevice (Context& context, void* pNext, const char* const* ppEnabledExtensionNames, deUint32 enabledExtensionCount)
+void createTestDevice (Context& context, void* pNext, const char* const* ppEnabledExtensionNames, deUint32 enabledExtensionCount)
 {
 	const PlatformInterface&				platformInterface		= context.getPlatformInterface();
+	const auto								validationEnabled		= context.getTestContext().getCommandLine().isValidationEnabled();
 	const Unique<VkInstance>				instance				(createDefaultInstance(platformInterface, context.getUsedApiVersion()));
 	const InstanceDriver					instanceDriver			(platformInterface, instance.get());
 	const VkPhysicalDevice					physicalDevice			= chooseDevice(instanceDriver, instance.get(), context.getTestContext().getCommandLine());
@@ -1543,7 +1544,7 @@
 		ppEnabledExtensionNames,					//  const char* const*				ppEnabledExtensionNames;
 		DE_NULL,									//  const VkPhysicalDeviceFeatures*	pEnabledFeatures;
 	};
-	const Unique<VkDevice>					device					(createDevice(platformInterface, *instance, instanceDriver, physicalDevice, &deviceCreateInfo));
+	const Unique<VkDevice>					device					(createCustomDevice(validationEnabled, platformInterface, *instance, instanceDriver, physicalDevice, &deviceCreateInfo));
 	const DeviceDriver						deviceDriver			(platformInterface, instance.get(), device.get());
 	const VkQueue							queue					= getDeviceQueue(deviceDriver, *device,  queueFamilyIndex, queueIndex);
 
@@ -1747,7 +1748,7 @@
 					if (featureDependencyTable[featureDependencyTableNdx].featurePtr == featurePtr)
 						featureDependencyTable[featureDependencyTableNdx].dependOnPtr[0] = DE_TRUE;
 
-				createDevice(context, &features2, DE_NULL, 0u);
+				createTestDevice(context, &features2, DE_NULL, 0u);
 			}
 		}
 
@@ -1782,7 +1783,7 @@
 						if (featureDependencyTable[featureDependencyTableNdx].featurePtr == featurePtr)
 							featureDependencyTable[featureDependencyTableNdx].dependOnPtr[0] = DE_TRUE;
 
-					createDevice(context, &features2, &extStringPtr, (extStringPtr == DE_NULL) ? 0u : 1u );
+					createTestDevice(context, &features2, &extStringPtr, (extStringPtr == DE_NULL) ? 0u : 1u );
 				}
 			}
 		}
diff --git a/external/vulkancts/modules/vulkan/draw/vktDrawConcurrentTests.cpp b/external/vulkancts/modules/vulkan/draw/vktDrawConcurrentTests.cpp
index 03679c3..b3a38c3 100644
--- a/external/vulkancts/modules/vulkan/draw/vktDrawConcurrentTests.cpp
+++ b/external/vulkancts/modules/vulkan/draw/vktDrawConcurrentTests.cpp
@@ -27,6 +27,7 @@
 
 #include "vktDrawConcurrentTests.hpp"
 
+#include "vktCustomInstancesDevices.hpp"
 #include "vktTestCaseUtil.hpp"
 #include "vktDrawTestCaseUtil.hpp"
 #include "../compute/vktComputeTestsUtil.hpp"
@@ -106,6 +107,7 @@
 	const deUint32							numValues		= 1024;
 	const InstanceInterface&				instance		= m_context.getInstanceInterface();
 	const VkPhysicalDevice					physicalDevice	= m_context.getPhysicalDevice();
+	const auto								validation		= m_context.getTestContext().getCommandLine().isValidationEnabled();
 	tcu::TestLog&							log				= m_context.getTestContext().getLog();
 	Move<VkDevice>							computeDevice;
 	std::vector<VkQueueFamilyProperties>	queueFamilyProperties;
@@ -156,7 +158,7 @@
 	deviceInfo.queueCreateInfoCount		= 1;
 	deviceInfo.pQueueCreateInfos		= &queueInfos;
 
-	computeDevice = createDevice(m_context.getPlatformInterface(), m_context.getInstance(), instance, physicalDevice, &deviceInfo);
+	computeDevice = createCustomDevice(validation, m_context.getPlatformInterface(), m_context.getInstance(), instance, physicalDevice, &deviceInfo);
 
 	vk.getDeviceQueue(*computeDevice, computeQueue.queueFamilyIndex, 0, &computeQueue.queue);
 
diff --git a/external/vulkancts/modules/vulkan/memory/vktMemoryAllocationTests.cpp b/external/vulkancts/modules/vulkan/memory/vktMemoryAllocationTests.cpp
index cca45b2..dad6902 100644
--- a/external/vulkancts/modules/vulkan/memory/vktMemoryAllocationTests.cpp
+++ b/external/vulkancts/modules/vulkan/memory/vktMemoryAllocationTests.cpp
@@ -120,7 +120,7 @@
 class BaseAllocateTestInstance : public TestInstance
 {
 public:
-						BaseAllocateTestInstance		(Context& context, bool useDeviceGroups)
+	BaseAllocateTestInstance		(Context& context, bool useDeviceGroups)
 		: TestInstance				(context)
 		, m_useDeviceGroups			(useDeviceGroups)
 		, m_subsetAllocationAllowed	(false)
@@ -130,7 +130,7 @@
 		if (m_useDeviceGroups)
 			createDeviceGroup();
 		else
-			createDevice();
+			createTestDevice();
 
 		m_allocFlagsInfo.sType		= VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_FLAGS_INFO_KHR;
 		m_allocFlagsInfo.pNext		= DE_NULL;
@@ -138,7 +138,7 @@
 		m_allocFlagsInfo.deviceMask	= 0;
 	}
 
-	void						createDevice		(void);
+	void						createTestDevice	(void);
 	void						createDeviceGroup	(void);
 	const vk::DeviceInterface&	getDeviceInterface	(void) { return m_useDeviceGroups ? *m_deviceDriver : m_context.getDeviceInterface(); }
 	vk::VkDevice				getDevice			(void) { return m_logicalDevice.get();}
@@ -156,7 +156,7 @@
 	de::MovePtr<vk::DeviceDriver>	m_deviceDriver;
 };
 
-void BaseAllocateTestInstance::createDevice (void)
+void BaseAllocateTestInstance::createTestDevice (void)
 {
 	VkInstance										instance				(m_context.getInstance());
 	InstanceDriver									instanceDriver			(m_context.getPlatformInterface(), instance);
diff --git a/external/vulkancts/modules/vulkan/ray_tracing/vktRayTracingCaptureReplayTests.cpp b/external/vulkancts/modules/vulkan/ray_tracing/vktRayTracingCaptureReplayTests.cpp
index fbda652..8992fed 100644
--- a/external/vulkancts/modules/vulkan/ray_tracing/vktRayTracingCaptureReplayTests.cpp
+++ b/external/vulkancts/modules/vulkan/ray_tracing/vktRayTracingCaptureReplayTests.cpp
@@ -28,6 +28,7 @@
 
 #include "vktTestCase.hpp"
 #include "vktTestGroupUtil.hpp"
+#include "vktCustomInstancesDevices.hpp"
 #include "vkCmdUtil.hpp"
 #include "vkObjUtil.hpp"
 #include "vkBuilderUtil.hpp"
@@ -38,6 +39,8 @@
 
 #include "vkRayTracingUtil.hpp"
 
+#include "tcuCommandLine.hpp"
+
 namespace vkt
 {
 namespace RayTracing
@@ -929,6 +932,7 @@
 	const InstanceInterface&				vki									= m_context.getInstanceInterface();
 	const VkInstance						instance							= m_context.getInstance();
 	const VkPhysicalDevice					physicalDevice						= m_context.getPhysicalDevice();
+	const auto								validationEnabled					= m_context.getTestContext().getCommandLine().isValidationEnabled();
 
 	VkQueue									queue								= DE_NULL;
 	deUint32								queueFamilyIndex					= NO_MATCH_FOUND;
@@ -997,7 +1001,7 @@
 	deviceInfo.pEnabledFeatures													= DE_NULL;
 	deviceInfo.queueCreateInfoCount												= 1;
 	deviceInfo.pQueueCreateInfos												= &queueInfo;
-	Move<VkDevice>							testDevice							= createDevice(vkp, m_context.getInstance(), vki, physicalDevice, &deviceInfo);
+	Move<VkDevice>							testDevice							= createCustomDevice(validationEnabled, vkp, m_context.getInstance(), vki, physicalDevice, &deviceInfo);
 	VkDevice								device								= *testDevice;
 	DeviceDriver							vkd									(vkp, instance, device);
 
diff --git a/external/vulkancts/modules/vulkan/synchronization/vktSynchronizationSignalOrderTests.cpp b/external/vulkancts/modules/vulkan/synchronization/vktSynchronizationSignalOrderTests.cpp
index d415c04..6e8b640 100644
--- a/external/vulkancts/modules/vulkan/synchronization/vktSynchronizationSignalOrderTests.cpp
+++ b/external/vulkancts/modules/vulkan/synchronization/vktSynchronizationSignalOrderTests.cpp
@@ -29,6 +29,7 @@
 #include "vktTestCaseUtil.hpp"
 #include "vktSynchronizationUtil.hpp"
 #include "vktExternalMemoryUtil.hpp"
+#include "vktCustomInstancesDevices.hpp"
 #include "vkBarrierUtil.hpp"
 
 #include "vkDefs.hpp"
@@ -40,6 +41,7 @@
 #include "vkTypeUtil.hpp"
 
 #include "tcuTestLog.hpp"
+#include "tcuCommandLine.hpp"
 
 #include "deRandom.hpp"
 #include "deThread.hpp"
@@ -93,7 +95,7 @@
 	VK_CHECK(vk.signalSemaphore(device, &ssi));
 }
 
-Move<VkDevice> createDevice (const Context& context)
+Move<VkDevice> createTestDevice (const Context& context)
 {
 	const float									priority				= 0.0f;
 	const std::vector<VkQueueFamilyProperties>	queueFamilyProperties	= getPhysicalDeviceQueueFamilyProperties(context.getInstanceInterface(), context.getPhysicalDevice());
@@ -170,7 +172,8 @@
 			0u
 		};
 
-		return createDevice(context.getPlatformInterface(), context.getInstance(), context.getInstanceInterface(), context.getPhysicalDevice(), &createInfo);
+		const auto validation = context.getTestContext().getCommandLine().isValidationEnabled();
+		return createCustomDevice(validation, context.getPlatformInterface(), context.getInstance(), context.getInstanceInterface(), context.getPhysicalDevice(), &createInfo);
 	}
 	catch (const vk::Error& error)
 	{
@@ -185,7 +188,7 @@
 class SingletonDevice
 {
 	SingletonDevice	(const Context& context)
-		: m_logicalDevice	(createDevice(context))
+		: m_logicalDevice	(createTestDevice(context))
 	{
 	}
 
diff --git a/external/vulkancts/modules/vulkan/synchronization/vktSynchronizationTimelineSemaphoreTests.cpp b/external/vulkancts/modules/vulkan/synchronization/vktSynchronizationTimelineSemaphoreTests.cpp
index 3f57987..8440274 100644
--- a/external/vulkancts/modules/vulkan/synchronization/vktSynchronizationTimelineSemaphoreTests.cpp
+++ b/external/vulkancts/modules/vulkan/synchronization/vktSynchronizationTimelineSemaphoreTests.cpp
@@ -29,6 +29,7 @@
 #include "vktTestCaseUtil.hpp"
 #include "vktSynchronizationUtil.hpp"
 #include "vktExternalMemoryUtil.hpp"
+#include "vktCustomInstancesDevices.hpp"
 #include "vkBarrierUtil.hpp"
 
 #include "vkDefs.hpp"
@@ -41,6 +42,7 @@
 #include "vkBufferWithMemory.hpp"
 
 #include "tcuTestLog.hpp"
+#include "tcuCommandLine.hpp"
 
 #include "deClock.h"
 #include "deRandom.hpp"
@@ -1277,7 +1279,7 @@
 	return infos;
 }
 
-Move<VkDevice> createDevice(const Context& context, SynchronizationType type)
+Move<VkDevice> createTestDevice(const Context& context, SynchronizationType type)
 {
 	const std::vector<VkQueueFamilyProperties>		queueFamilyProperties		= getPhysicalDeviceQueueFamilyProperties(context.getInstanceInterface(), context.getPhysicalDevice());
 	std::vector<VkDeviceQueueCreateInfo>			queueCreateInfos			= getQueueCreateInfo(queueFamilyProperties);
@@ -1323,8 +1325,10 @@
 		queueCreateInfo.pQueuePriorities = &(*queuePriorities.back().get())[0];
 	}
 
-	return createDevice(context.getPlatformInterface(), context.getInstance(),
-						context.getInstanceInterface(), context.getPhysicalDevice(), &deviceInfo);
+	const auto validation = context.getTestContext().getCommandLine().isValidationEnabled();
+
+	return createCustomDevice(validation, context.getPlatformInterface(), context.getInstance(),
+							  context.getInstanceInterface(), context.getPhysicalDevice(), &deviceInfo);
 }
 
 
@@ -1332,7 +1336,7 @@
 class SingletonDevice
 {
 	SingletonDevice	(const Context& context, SynchronizationType type)
-		: m_logicalDevice	(createDevice(context, type))
+		: m_logicalDevice	(createTestDevice(context, type))
 	{
 	}
 
diff --git a/external/vulkancts/modules/vulkan/wsi/vktWsiDisplayControlTests.cpp b/external/vulkancts/modules/vulkan/wsi/vktWsiDisplayControlTests.cpp
index 778a1a8..647695b 100644
--- a/external/vulkancts/modules/vulkan/wsi/vktWsiDisplayControlTests.cpp
+++ b/external/vulkancts/modules/vulkan/wsi/vktWsiDisplayControlTests.cpp
@@ -94,15 +94,15 @@
 	return 0;
 }
 
-Move<VkDevice> createDevice (const vk::Platform&		platform,
-							 const PlatformInterface&		vkp,
-							 const VkInstance				instance,
-							 const InstanceInterface&		vki,
-							 VkPhysicalDevice				physicalDevice,
-							 const Extensions&				supportedExtensions,
-							 const deUint32					queueFamilyIndex,
-							 bool							validationEnabled,
-							 const VkAllocationCallbacks*	pAllocator = DE_NULL)
+Move<VkDevice> createTestDevice (const vk::Platform&			platform,
+								 const PlatformInterface&		vkp,
+								 const VkInstance				instance,
+								 const InstanceInterface&		vki,
+								 VkPhysicalDevice				physicalDevice,
+								 const Extensions&				supportedExtensions,
+								 const deUint32					queueFamilyIndex,
+								 bool							validationEnabled,
+								 const VkAllocationCallbacks*	pAllocator = DE_NULL)
 {
 	const float queuePriorities[] = { 1.0f };
 	bool displayAvailable = true;
@@ -715,7 +715,7 @@
 
 	, m_queueFamilyIndex		(chooseQueueFamilyIndex(m_vki, m_physicalDevice, m_surface))
 	, m_deviceExtensions		(enumerateDeviceExtensionProperties(m_vki, m_physicalDevice, DE_NULL))
-	, m_device					(createDevice(context.getTestContext().getPlatform().getVulkanPlatform(), m_vkp, m_instance, m_vki, m_physicalDevice, m_deviceExtensions, m_queueFamilyIndex, context.getTestContext().getCommandLine().isValidationEnabled()))
+	, m_device					(createTestDevice(context.getTestContext().getPlatform().getVulkanPlatform(), m_vkp, m_instance, m_vki, m_physicalDevice, m_deviceExtensions, m_queueFamilyIndex, context.getTestContext().getCommandLine().isValidationEnabled()))
 	, m_vkd						(m_vkp, m_instance, *m_device)
 	, m_queue					(getDeviceQueue(m_vkd, *m_device, m_queueFamilyIndex, 0u))