Support validation layers in push descriptor tests
authorRicardo Garcia <rgarcia@igalia.com>
Tue, 11 Jun 2019 10:08:36 +0000 (12:08 +0200)
committerAlexander Galazin <Alexander.Galazin@arm.com>
Wed, 19 Jun 2019 08:08:42 +0000 (04:08 -0400)
Push descriptor tests created custom instances and devices without
taking into account the --deqp-validation command line option.

This commit exposes a couple of getValidationLayers() functions from
vktTestCase that were previously internal and allow easily obtaining the
list of validation layers from any point in the application.

Affected tests:
dEQP-VK.pipeline.push_descriptor.*

Components: Vulkan
VK-GL-CTS issue: 1825

Change-Id: Ie35ffcbbc368e90755ff72c0579145aecadb036b

external/vulkancts/modules/vulkan/device_group/vktDeviceGroupRendering.cpp
external/vulkancts/modules/vulkan/pipeline/vktPipelinePushDescriptorTests.cpp
external/vulkancts/modules/vulkan/protected_memory/vktProtectedMemUtils.cpp
external/vulkancts/modules/vulkan/vktTestCase.cpp
external/vulkancts/modules/vulkan/vktTestCase.hpp

index 95c5507..4bb43cb 100644 (file)
@@ -214,31 +214,7 @@ void DeviceGroupTestInstance::getDeviceLayers (vector<string>& enabledLayers)
        const tcu::CommandLine& cmdLine = m_context.getTestContext().getCommandLine();
        if (cmdLine.isValidationEnabled())
        {
-               const vector<VkLayerProperties> layerProperties = enumerateDeviceLayerProperties(m_context.getInstanceInterface(), m_context.getPhysicalDevice());
-
-               static const char*      s_magicLayer = "VK_LAYER_LUNARG_standard_validation";
-               static const char*      s_defaultLayers[] =
-               {
-                       "VK_LAYER_GOOGLE_threading",
-                       "VK_LAYER_LUNARG_parameter_validation",
-                       "VK_LAYER_LUNARG_device_limits",
-                       "VK_LAYER_LUNARG_object_tracker",
-                       "VK_LAYER_LUNARG_image",
-                       "VK_LAYER_LUNARG_core_validation",
-                       "VK_LAYER_LUNARG_swapchain",
-                       "VK_LAYER_GOOGLE_unique_objects",
-               };
-
-               if (isLayerSupported(layerProperties, RequiredLayer(s_magicLayer)))
-                       enabledLayers.push_back(s_magicLayer);
-               else
-               {
-                       for (deUint32 ndx = 0; ndx < DE_LENGTH_OF_ARRAY(s_defaultLayers); ++ndx)
-                       {
-                               if (isLayerSupported(layerProperties, RequiredLayer(s_defaultLayers[ndx])))
-                                       enabledLayers.push_back(s_defaultLayers[ndx]);
-                       }
-               }
+               enabledLayers = vkt::getValidationLayers(m_context.getInstanceInterface(), m_context.getPhysicalDevice());
                if (enabledLayers.empty())
                        TCU_THROW(NotSupportedError, "No device validation layers found");
        }
index 9e1abac..bba7a52 100644 (file)
@@ -43,6 +43,7 @@
 #include "deMemory.h"
 #include "deUniquePtr.hpp"
 #include "tcuTestLog.hpp"
+#include "tcuCommandLine.hpp"
 #include <vector>
 
 namespace vkt
@@ -74,28 +75,36 @@ struct TestParams
 
 void checkAllSupported (const Extensions& supportedExtensions, const vector<string>& requiredExtensions)
 {
-       for (vector<string>::const_iterator requiredExtName = requiredExtensions.begin(); requiredExtName != requiredExtensions.end(); ++requiredExtName)
+       for (auto& requiredExtName : requiredExtensions)
        {
-               if (!isExtensionSupported(supportedExtensions, RequiredExtension(*requiredExtName)))
-                       TCU_THROW(NotSupportedError, (*requiredExtName + " is not supported").c_str());
+               if (!isExtensionSupported(supportedExtensions, RequiredExtension(requiredExtName)))
+                       TCU_THROW(NotSupportedError, (requiredExtName + " is not supported").c_str());
        }
 }
 
-Move<VkInstance> createInstanceWithGetPhysicalDeviceProperties2 (const PlatformInterface&      vkp,
-                                                                                                                                deUint32                                       version,
+Move<VkInstance> createInstanceWithGetPhysicalDeviceProperties2 (const Context&                                context,
+                                                                                                                                const PlatformInterface&       vkp,
                                                                                                                                 const Extensions&                      supportedExtensions)
 {
-       vector<string> extensions;
+       vector<string> requiredExtensions = { "VK_KHR_get_physical_device_properties2" };
+       checkAllSupported(supportedExtensions, requiredExtensions);
 
-       if (!isCoreInstanceExtension(version, "VK_KHR_get_physical_device_properties2"))
-               extensions.push_back("VK_KHR_get_physical_device_properties2");
+       vector<string> enabledLayers;
+       if (context.getTestContext().getCommandLine().isValidationEnabled())
+       {
+               enabledLayers = vkt::getValidationLayers(vkp);
+       }
 
-       checkAllSupported(supportedExtensions, extensions);
+       return createDefaultInstance(vkp, context.getUsedApiVersion(), enabledLayers, requiredExtensions);
+}
 
-       return createDefaultInstance(vkp, version, vector<string>(), extensions);
+const char *innerCString(const string &str)
+{
+       return str.c_str();
 }
 
-Move<VkDevice> createDeviceWithPushDescriptor (const PlatformInterface&                vkp,
+Move<VkDevice> createDeviceWithPushDescriptor (const Context&                          context,
+                                                                                          const PlatformInterface&             vkp,
                                                                                           VkInstance                                   instance,
                                                                                           const InstanceInterface&             vki,
                                                                                           VkPhysicalDevice                             physicalDevice,
@@ -103,8 +112,8 @@ Move<VkDevice> createDeviceWithPushDescriptor (const PlatformInterface&             vkp,
                                                                                           const deUint32                               queueFamilyIndex)
 {
 
-       const float                                             queuePriority   = 1.0f;
-       const VkDeviceQueueCreateInfo   queueInfo               =
+       const float                                             queuePriority                   = 1.0f;
+       const VkDeviceQueueCreateInfo   queueInfo                               =
        {
                VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO,
                DE_NULL,
@@ -117,10 +126,21 @@ Move<VkDevice> createDeviceWithPushDescriptor (const PlatformInterface&           vkp,
        VkPhysicalDeviceFeatures                features;
        deMemset(&features, 0, sizeof(features));
 
-       const char* const                               extensions[]    =
+       vector<string>                                  requiredExtensionsStr   = { "VK_KHR_push_descriptor" };
+       vector<const char *>                    requiredExtensions;
+       checkAllSupported(supportedExtensions, requiredExtensionsStr);
+       // We need the contents of requiredExtensionsStr as a vector<const char*> in VkDeviceCreateInfo.
+       transform(begin(requiredExtensionsStr), end(requiredExtensionsStr), back_inserter(requiredExtensions), innerCString);
+
+       // Enable validation layers on this device if validation has been requested from the command line.
+       vector<string>                                  enabledLayersStr;
+       vector<const char*>                             enabledLayers;
+       if (context.getTestContext().getCommandLine().isValidationEnabled())
        {
-               "VK_KHR_push_descriptor"
-       };
+               // We need the contents of enabledLayersStr as a vector<const char*> in VkDeviceCreateInfo.
+               enabledLayersStr = vkt::getValidationLayers(vki, physicalDevice);
+               transform(begin(enabledLayersStr), end(enabledLayersStr), back_inserter(enabledLayers), innerCString);
+       }
 
        const VkDeviceCreateInfo                deviceParams    =
        {
@@ -129,16 +149,13 @@ Move<VkDevice> createDeviceWithPushDescriptor (const PlatformInterface&           vkp,
                (VkDeviceCreateFlags)0,
                1u,
                &queueInfo,
-               0u,
-               DE_NULL,
-               1u,
-               extensions,
+               static_cast<deUint32>(enabledLayers.size()),
+               (enabledLayers.empty() ? DE_NULL : enabledLayers.data()),
+               static_cast<deUint32>(requiredExtensions.size()),
+               (requiredExtensions.empty() ? DE_NULL : requiredExtensions.data()),
                &features
        };
 
-       if (!isExtensionSupported(supportedExtensions, RequiredExtension(extensions[0])))
-               TCU_THROW(NotSupportedError, (string(extensions[0]) + " is not supported").c_str());
-
        return createDevice(vkp, instance, vki, physicalDevice, &deviceParams, DE_NULL);
 }
 
@@ -257,12 +274,12 @@ PushDescriptorBufferGraphicsTestInstance::PushDescriptorBufferGraphicsTestInstan
        , m_params                              (params)
        , m_vkp                                 (context.getPlatformInterface())
        , m_instanceExtensions  (enumerateInstanceExtensionProperties(m_vkp, DE_NULL))
-       , m_instance                    (createInstanceWithGetPhysicalDeviceProperties2(m_vkp, context.getUsedApiVersion(), m_instanceExtensions))
+       , m_instance                    (createInstanceWithGetPhysicalDeviceProperties2(context, m_vkp, m_instanceExtensions))
        , m_vki                                 (m_vkp, *m_instance)
        , m_physicalDevice              (chooseDevice(m_vki, *m_instance, context.getTestContext().getCommandLine()))
        , m_queueFamilyIndex    (findQueueFamilyIndexWithCaps(m_vki, m_physicalDevice, VK_QUEUE_GRAPHICS_BIT))
        , m_deviceExtensions    (enumerateDeviceExtensionProperties(m_vki, m_physicalDevice, DE_NULL))
-       , m_device                              (createDeviceWithPushDescriptor(m_vkp, *m_instance, m_vki, m_physicalDevice, m_deviceExtensions, m_queueFamilyIndex))
+       , m_device                              (createDeviceWithPushDescriptor(context, m_vkp, *m_instance, m_vki, m_physicalDevice, m_deviceExtensions, m_queueFamilyIndex))
        , m_vkd                                 (m_vkp, *m_instance, *m_device)
        , m_queue                               (getDeviceQueue(m_vkd, *m_device, m_queueFamilyIndex, 0u))
        , m_allocator                   (m_vkd, *m_device, getPhysicalDeviceMemoryProperties(m_vki, m_physicalDevice))
@@ -710,12 +727,12 @@ PushDescriptorBufferComputeTestInstance::PushDescriptorBufferComputeTestInstance
        , m_params                              (params)
        , m_vkp                                 (context.getPlatformInterface())
        , m_instanceExtensions  (enumerateInstanceExtensionProperties(m_vkp, DE_NULL))
-       , m_instance                    (createInstanceWithGetPhysicalDeviceProperties2(m_vkp, context.getUsedApiVersion(), m_instanceExtensions))
+       , m_instance                    (createInstanceWithGetPhysicalDeviceProperties2(context, m_vkp, m_instanceExtensions))
        , m_vki                                 (m_vkp, *m_instance)
        , m_physicalDevice              (chooseDevice(m_vki, *m_instance, context.getTestContext().getCommandLine()))
        , m_queueFamilyIndex    (findQueueFamilyIndexWithCaps(m_vki, m_physicalDevice, VK_QUEUE_COMPUTE_BIT))
        , m_deviceExtensions    (enumerateDeviceExtensionProperties(m_vki, m_physicalDevice, DE_NULL))
-       , m_device                              (createDeviceWithPushDescriptor(m_vkp, *m_instance, m_vki, m_physicalDevice, m_deviceExtensions, m_queueFamilyIndex))
+       , m_device                              (createDeviceWithPushDescriptor(context, m_vkp, *m_instance, m_vki, m_physicalDevice, m_deviceExtensions, m_queueFamilyIndex))
        , m_vkd                                 (m_vkp, *m_instance, *m_device)
        , m_queue                               (getDeviceQueue(m_vkd, *m_device, m_queueFamilyIndex, 0u))
        , m_allocator                   (m_vkd, *m_device, getPhysicalDeviceMemoryProperties(m_vki, m_physicalDevice))
@@ -1061,12 +1078,12 @@ PushDescriptorImageGraphicsTestInstance::PushDescriptorImageGraphicsTestInstance
        , m_params                              (params)
        , m_vkp                                 (context.getPlatformInterface())
        , m_instanceExtensions  (enumerateInstanceExtensionProperties(m_vkp, DE_NULL))
-       , m_instance                    (createInstanceWithGetPhysicalDeviceProperties2(m_vkp, context.getUsedApiVersion(), m_instanceExtensions))
+       , m_instance                    (createInstanceWithGetPhysicalDeviceProperties2(context, m_vkp, m_instanceExtensions))
        , m_vki                                 (m_vkp, *m_instance)
        , m_physicalDevice              (chooseDevice(m_vki, *m_instance, context.getTestContext().getCommandLine()))
        , m_queueFamilyIndex    (findQueueFamilyIndexWithCaps(m_vki, m_physicalDevice, VK_QUEUE_GRAPHICS_BIT))
        , m_deviceExtensions    (enumerateDeviceExtensionProperties(m_vki, m_physicalDevice, DE_NULL))
-       , m_device                              (createDeviceWithPushDescriptor(m_vkp, *m_instance, m_vki, m_physicalDevice, m_deviceExtensions, m_queueFamilyIndex))
+       , m_device                              (createDeviceWithPushDescriptor(context, m_vkp, *m_instance, m_vki, m_physicalDevice, m_deviceExtensions, m_queueFamilyIndex))
        , m_vkd                                 (m_vkp, *m_instance, *m_device)
        , m_queue                               (getDeviceQueue(m_vkd, *m_device, m_queueFamilyIndex, 0u))
        , m_allocator                   (m_vkd, *m_device, getPhysicalDeviceMemoryProperties(m_vki, m_physicalDevice))
@@ -1906,12 +1923,12 @@ PushDescriptorImageComputeTestInstance::PushDescriptorImageComputeTestInstance (
        , m_params                              (params)
        , m_vkp                                 (context.getPlatformInterface())
        , m_instanceExtensions  (enumerateInstanceExtensionProperties(m_vkp, DE_NULL))
-       , m_instance                    (createInstanceWithGetPhysicalDeviceProperties2(m_vkp, context.getUsedApiVersion(), m_instanceExtensions))
+       , m_instance                    (createInstanceWithGetPhysicalDeviceProperties2(context, m_vkp, m_instanceExtensions))
        , m_vki                                 (m_vkp, *m_instance)
        , m_physicalDevice              (chooseDevice(m_vki, *m_instance, context.getTestContext().getCommandLine()))
        , m_queueFamilyIndex    (findQueueFamilyIndexWithCaps(m_vki, m_physicalDevice, VK_QUEUE_COMPUTE_BIT | VK_QUEUE_GRAPHICS_BIT))
        , m_deviceExtensions    (enumerateDeviceExtensionProperties(m_vki, m_physicalDevice, DE_NULL))
-       , m_device                              (createDeviceWithPushDescriptor(m_vkp, *m_instance, m_vki, m_physicalDevice, m_deviceExtensions, m_queueFamilyIndex))
+       , m_device                              (createDeviceWithPushDescriptor(context, m_vkp, *m_instance, m_vki, m_physicalDevice, m_deviceExtensions, m_queueFamilyIndex))
        , m_vkd                                 (m_vkp, *m_instance, *m_device)
        , m_queue                               (getDeviceQueue(m_vkd, *m_device, m_queueFamilyIndex, 0u))
        , m_allocator                   (m_vkd, *m_device, getPhysicalDeviceMemoryProperties(m_vki, m_physicalDevice))
@@ -2672,12 +2689,12 @@ PushDescriptorTexelBufferGraphicsTestInstance::PushDescriptorTexelBufferGraphics
        , m_params                              (params)
        , m_vkp                                 (context.getPlatformInterface())
        , m_instanceExtensions  (enumerateInstanceExtensionProperties(m_vkp, DE_NULL))
-       , m_instance                    (createInstanceWithGetPhysicalDeviceProperties2(m_vkp, context.getUsedApiVersion(), m_instanceExtensions))
+       , m_instance                    (createInstanceWithGetPhysicalDeviceProperties2(context, m_vkp, m_instanceExtensions))
        , m_vki                                 (m_vkp, *m_instance)
        , m_physicalDevice              (chooseDevice(m_vki, *m_instance, context.getTestContext().getCommandLine()))
        , m_queueFamilyIndex    (findQueueFamilyIndexWithCaps(m_vki, m_physicalDevice, VK_QUEUE_GRAPHICS_BIT))
        , m_deviceExtensions    (enumerateDeviceExtensionProperties(m_vki, m_physicalDevice, DE_NULL))
-       , m_device                              (createDeviceWithPushDescriptor(m_vkp, *m_instance, m_vki, m_physicalDevice, m_deviceExtensions, m_queueFamilyIndex))
+       , m_device                              (createDeviceWithPushDescriptor(context, m_vkp, *m_instance, m_vki, m_physicalDevice, m_deviceExtensions, m_queueFamilyIndex))
        , m_vkd                                 (m_vkp, *m_instance, *m_device)
        , m_queue                               (getDeviceQueue(m_vkd, *m_device, m_queueFamilyIndex, 0u))
        , m_allocator                   (m_vkd, *m_device, getPhysicalDeviceMemoryProperties(m_vki, m_physicalDevice))
@@ -3149,12 +3166,12 @@ PushDescriptorTexelBufferComputeTestInstance::PushDescriptorTexelBufferComputeTe
        , m_params                              (params)
        , m_vkp                                 (context.getPlatformInterface())
        , m_instanceExtensions  (enumerateInstanceExtensionProperties(m_vkp, DE_NULL))
-       , m_instance                    (createInstanceWithGetPhysicalDeviceProperties2(m_vkp, context.getUsedApiVersion(), m_instanceExtensions))
+       , m_instance                    (createInstanceWithGetPhysicalDeviceProperties2(context, m_vkp, m_instanceExtensions))
        , m_vki                                 (m_vkp, *m_instance)
        , m_physicalDevice              (chooseDevice(m_vki, *m_instance, context.getTestContext().getCommandLine()))
        , m_queueFamilyIndex    (findQueueFamilyIndexWithCaps(m_vki, m_physicalDevice, VK_QUEUE_COMPUTE_BIT))
        , m_deviceExtensions    (enumerateDeviceExtensionProperties(m_vki, m_physicalDevice, DE_NULL))
-       , m_device                              (createDeviceWithPushDescriptor(m_vkp, *m_instance, m_vki, m_physicalDevice, m_deviceExtensions, m_queueFamilyIndex))
+       , m_device                              (createDeviceWithPushDescriptor(context, m_vkp, *m_instance, m_vki, m_physicalDevice, m_deviceExtensions, m_queueFamilyIndex))
        , m_vkd                                 (m_vkp, *m_instance, *m_device)
        , m_queue                               (getDeviceQueue(m_vkd, *m_device, m_queueFamilyIndex, 0u))
        , m_allocator                   (m_vkd, *m_device, getPhysicalDeviceMemoryProperties(m_vki, m_physicalDevice))
@@ -3522,12 +3539,12 @@ PushDescriptorInputAttachmentGraphicsTestInstance::PushDescriptorInputAttachment
        , m_params                              (params)
        , m_vkp                                 (context.getPlatformInterface())
        , m_instanceExtensions  (enumerateInstanceExtensionProperties(m_vkp, DE_NULL))
-       , m_instance                    (createInstanceWithGetPhysicalDeviceProperties2(m_vkp, context.getUsedApiVersion(), m_instanceExtensions))
+       , m_instance                    (createInstanceWithGetPhysicalDeviceProperties2(context, m_vkp, m_instanceExtensions))
        , m_vki                                 (m_vkp, *m_instance)
        , m_physicalDevice              (chooseDevice(m_vki, *m_instance, context.getTestContext().getCommandLine()))
        , m_queueFamilyIndex    (findQueueFamilyIndexWithCaps(m_vki, m_physicalDevice, VK_QUEUE_GRAPHICS_BIT))
        , m_deviceExtensions    (enumerateDeviceExtensionProperties(m_vki, m_physicalDevice, DE_NULL))
-       , m_device                              (createDeviceWithPushDescriptor(m_vkp, *m_instance, m_vki, m_physicalDevice, m_deviceExtensions, m_queueFamilyIndex))
+       , m_device                              (createDeviceWithPushDescriptor(context, m_vkp, *m_instance, m_vki, m_physicalDevice, m_deviceExtensions, m_queueFamilyIndex))
        , m_vkd                                 (m_vkp, *m_instance, *m_device)
        , m_queue                               (getDeviceQueue(m_vkd, *m_device, m_queueFamilyIndex, 0u))
        , m_allocator                   (m_vkd, *m_device, getPhysicalDeviceMemoryProperties(m_vki, m_physicalDevice))
index 4288cc4..ba9525e 100644 (file)
@@ -49,37 +49,6 @@ namespace ProtectedMem
 
 typedef std::vector<vk::VkExtensionProperties> Extensions;
 
-std::vector<std::string> getValidationLayers (const vk::PlatformInterface& vkp)
-{
-       static const char*      s_magicLayer            = "VK_LAYER_LUNARG_standard_validation";
-       static const char*      s_defaultLayers[]       =
-       {
-               "VK_LAYER_GOOGLE_threading",
-               "VK_LAYER_LUNARG_parameter_validation",
-               "VK_LAYER_LUNARG_device_limits",
-               "VK_LAYER_LUNARG_object_tracker",
-               "VK_LAYER_LUNARG_image",
-               "VK_LAYER_LUNARG_core_validation",
-               "VK_LAYER_LUNARG_swapchain",
-               "VK_LAYER_GOOGLE_unique_objects"
-       };
-       const std::vector<vk::VkLayerProperties>        supportedLayers (enumerateInstanceLayerProperties(vkp));
-       std::vector<std::string>                                        enabledLayers;
-
-       if (isLayerSupported(supportedLayers, vk::RequiredLayer(s_magicLayer)))
-               enabledLayers.push_back(s_magicLayer);
-       else
-       {
-               for (int ndx = 0; ndx < DE_LENGTH_OF_ARRAY(s_defaultLayers); ++ndx)
-               {
-                       if (isLayerSupported(supportedLayers, vk::RequiredLayer(s_defaultLayers[ndx])))
-                               enabledLayers.push_back(s_defaultLayers[ndx]);
-               }
-       }
-
-       return enabledLayers;
-}
-
 vk::Move<vk::VkInstance> makeProtectedMemInstance (const vk::PlatformInterface& vkp, const vkt::Context& context, const std::vector<std::string>& extraExtensions)
 {
        const Extensions                        supportedExtensions(vk::enumerateInstanceExtensionProperties(vkp, DE_NULL));
@@ -92,7 +61,7 @@ vk::Move<vk::VkInstance> makeProtectedMemInstance (const vk::PlatformInterface&
                if (!vk::isDebugReportSupported(vkp))
                        TCU_THROW(NotSupportedError, "VK_EXT_debug_report is not supported");
 
-               enabledLayers = getValidationLayers(vkp);
+               enabledLayers = vkt::getValidationLayers(vkp);
                if (enabledLayers.empty())
                        TCU_THROW(NotSupportedError, "No validation layers found");
        }
index 9f3d624..8a1f5c1 100644 (file)
@@ -84,16 +84,6 @@ vector<string> getValidationLayers (const vector<VkLayerProperties>& supportedLa
        return enabledLayers;
 }
 
-vector<string> getValidationLayers (const PlatformInterface& vkp)
-{
-       return getValidationLayers(enumerateInstanceLayerProperties(vkp));
-}
-
-vector<string> getValidationLayers (const InstanceInterface& vki, VkPhysicalDevice physicalDevice)
-{
-       return getValidationLayers(enumerateDeviceLayerProperties(vki, physicalDevice));
-}
-
 vector<string> filterExtensions (const vector<VkExtensionProperties>& extensions)
 {
        vector<string>  enabledExtensions;
@@ -205,7 +195,7 @@ Move<VkInstance> createInstance (const PlatformInterface& vkp, deUint32 apiVersi
                if (!isDebugReportSupported(vkp))
                        TCU_THROW(NotSupportedError, "VK_EXT_debug_report is not supported");
 
-               enabledLayers = getValidationLayers(vkp);
+               enabledLayers = vkt::getValidationLayers(vkp);
                if (enabledLayers.empty())
                        TCU_THROW(NotSupportedError, "No validation layers found");
        }
@@ -250,7 +240,7 @@ Move<VkDevice> createDefaultDevice (const PlatformInterface&                        vkp,
 
        if (cmdLine.isValidationEnabled())
        {
-               enabledLayers = getValidationLayers(vki, physicalDevice);
+               enabledLayers = vkt::getValidationLayers(vki, physicalDevice);
                if (enabledLayers.empty())
                        TCU_THROW(NotSupportedError, "No validation layers found");
        }
@@ -304,6 +294,16 @@ Move<VkDevice> createDefaultDevice (const PlatformInterface&                       vkp,
 
 } // anonymous
 
+vector<string> getValidationLayers (const PlatformInterface& vkp)
+{
+       return getValidationLayers(enumerateInstanceLayerProperties(vkp));
+}
+
+vector<string> getValidationLayers (const InstanceInterface& vki, VkPhysicalDevice physicalDevice)
+{
+       return getValidationLayers(enumerateDeviceLayerProperties(vki, physicalDevice));
+}
+
 class DefaultDevice
 {
 public:
index a887777..c4d8783 100644 (file)
@@ -30,6 +30,8 @@
 #include "vkPrograms.hpp"
 #include "vkApiVersion.hpp"
 #include "vktTestCaseDefs.hpp"
+#include <vector>
+#include <string>
 
 namespace glu
 {
@@ -46,6 +48,10 @@ struct SourceCollections;
 namespace vkt
 {
 
+std::vector<std::string> getValidationLayers (const vk::PlatformInterface& vkp);
+
+std::vector<std::string> getValidationLayers (const vk::InstanceInterface& vki, vk::VkPhysicalDevice physicalDevice);
+
 class DefaultDevice;
 
 class Context