Add collection of basic utilities for Vulkan
authorPyry Haulos <phaulos@google.com>
Thu, 28 May 2015 22:29:09 +0000 (15:29 -0700)
committerPyry Haulos <phaulos@google.com>
Thu, 11 Jun 2015 18:19:24 +0000 (11:19 -0700)
Utilities are not complete yet, but represent a set of useful patterns
and abstractions test cases should use to be future-proof.

 * DeviceUtil: creating default instance, selecting device

 * MemUtil: device memory management

 * QueryUtil: convenience wrappers for API queries

Change-Id: I7a60f74fa5cba0f49a359efd35f749f8dac56eaf

framework/vulkan/CMakeLists.txt
framework/vulkan/vkDeviceUtil.cpp [new file with mode: 0644]
framework/vulkan/vkDeviceUtil.hpp [new file with mode: 0644]
framework/vulkan/vkMemUtil.cpp [new file with mode: 0644]
framework/vulkan/vkMemUtil.hpp [new file with mode: 0644]
framework/vulkan/vkQueryUtil.cpp [new file with mode: 0644]
framework/vulkan/vkQueryUtil.hpp [new file with mode: 0644]
modules/vulkan/vktInfo.cpp
modules/vulkan/vktTestCaseUtil.hpp

index d7d08b5..369e82e 100644 (file)
@@ -11,6 +11,12 @@ set(VKUTIL_SRCS
        vkPrograms.hpp
        vkStrUtil.cpp
        vkStrUtil.hpp
+       vkQueryUtil.cpp
+       vkQueryUtil.hpp
+       vkMemUtil.cpp
+       vkMemUtil.hpp
+       vkDeviceUtil.cpp
+       vkDeviceUtil.hpp
        )
 
 set(VKUTIL_LIBS
diff --git a/framework/vulkan/vkDeviceUtil.cpp b/framework/vulkan/vkDeviceUtil.cpp
new file mode 100644 (file)
index 0000000..be56082
--- /dev/null
@@ -0,0 +1,82 @@
+/*-------------------------------------------------------------------------
+ * drawElements Quality Program Vulkan Utilities
+ * -----------------------------------------------
+ *
+ * Copyright 2015 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ *//*!
+ * \file
+ * \brief Instance and device initialization utilities.
+ *//*--------------------------------------------------------------------*/
+
+#include "vkDeviceUtil.hpp"
+
+#include "qpInfo.h"
+
+#include <vector>
+
+namespace vk
+{
+
+using std::vector;
+
+Move<VkInstanceT> createDefaultInstance (const PlatformInterface& vkPlatform)
+{
+       const struct VkApplicationInfo          appInfo                 =
+       {
+               VK_STRUCTURE_TYPE_APPLICATION_INFO,             //      VkStructureType sType;
+               DE_NULL,                                                                //      const void*             pNext;
+               "deqp",                                                                 //      const char*             pAppName;
+               qpGetReleaseId(),                                               //      deUint32                appVersion;
+               "deqp",                                                                 //      const char*             pEngineName;
+               qpGetReleaseId(),                                               //      deUint32                engineVersion;
+               VK_API_VERSION                                                  //      deUint32                apiVersion;
+       };
+       const struct VkInstanceCreateInfo       instanceInfo    =
+       {
+               VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO, // VkStructureType                              sType;
+               DE_NULL,                                                                //      const void*                                     pNext;
+               &appInfo,                                                               //      const VkApplicationInfo*        pAppInfo;
+               DE_NULL,                                                                //      const VkAllocCallbacks*         pAllocCb;
+               0u,                                                                             //      deUint32                                        extensionCount;
+               DE_NULL                                                                 //      const char*const*                       ppEnabledExtensionNames;
+       };
+
+       return createInstance(vkPlatform, &instanceInfo);
+}
+
+VkPhysicalDevice chooseDevice (const PlatformInterface& vkPlatform, VkInstance instance, const tcu::CommandLine&)
+{
+       vector<VkPhysicalDevice>        devices;
+       deUint32                                        numDevices      = 0;
+
+       VK_CHECK(vkPlatform.enumeratePhysicalDevices(instance, &numDevices, DE_NULL));
+
+       if (numDevices > 0)
+       {
+               devices.resize(numDevices);
+               VK_CHECK(vkPlatform.enumeratePhysicalDevices(instance, &numDevices, &devices[0]));
+
+               if (numDevices != devices.size())
+                       TCU_FAIL("Number of devices changed between queries");
+
+               // \todo [2015-05-28 pyry] Add --deqp-vk-device=N command line option
+               return devices[0];
+       }
+       else
+               TCU_THROW(NotSupportedError, "No Vulkan devices available");
+}
+
+} // vk
diff --git a/framework/vulkan/vkDeviceUtil.hpp b/framework/vulkan/vkDeviceUtil.hpp
new file mode 100644 (file)
index 0000000..4bed3d3
--- /dev/null
@@ -0,0 +1,42 @@
+#ifndef _VKDEVICEUTIL_HPP
+#define _VKDEVICEUTIL_HPP
+/*-------------------------------------------------------------------------
+ * drawElements Quality Program Vulkan Utilities
+ * -----------------------------------------------
+ *
+ * Copyright 2015 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ *//*!
+ * \file
+ * \brief Instance and device initialization utilities.
+ *//*--------------------------------------------------------------------*/
+
+#include "vkDefs.hpp"
+#include "vkRef.hpp"
+
+namespace tcu
+{
+class CommandLine;
+}
+
+namespace vk
+{
+
+Move<VkInstanceT>      createDefaultInstance   (const PlatformInterface& vkPlatform);
+VkPhysicalDevice       chooseDevice                    (const PlatformInterface& vkPlatform, VkInstance instance, const tcu::CommandLine& cmdLine);
+
+} // vk
+
+#endif // _VKDEVICEUTIL_HPP
diff --git a/framework/vulkan/vkMemUtil.cpp b/framework/vulkan/vkMemUtil.cpp
new file mode 100644 (file)
index 0000000..a9ae606
--- /dev/null
@@ -0,0 +1,125 @@
+/*-------------------------------------------------------------------------
+ * drawElements Quality Program Vulkan Utilities
+ * -----------------------------------------------
+ *
+ * Copyright 2015 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ *//*!
+ * \file
+ * \brief Memory management utilities.
+ *//*--------------------------------------------------------------------*/
+
+#include "vkMemUtil.hpp"
+#include "vkStrUtil.hpp"
+
+#include <sstream>
+
+namespace vk
+{
+
+using de::MovePtr;
+
+// Allocation
+
+Allocation::Allocation (VkDeviceMemory memory, VkDeviceSize offset)
+       : m_memory      (memory)
+       , m_offset      (offset)
+{
+}
+
+Allocation::~Allocation (void)
+{
+}
+
+// SimpleAllocator
+
+class SimpleAllocation : public Allocation
+{
+public:
+                                                       SimpleAllocation        (const DeviceInterface& vk, VkDevice device, VkDeviceMemory memory);
+       virtual                                 ~SimpleAllocation       (void);
+
+private:
+       const DeviceInterface&  m_vk;
+       const VkDevice                  m_device;
+};
+
+SimpleAllocation::SimpleAllocation (const DeviceInterface& vk, VkDevice device, VkDeviceMemory memory)
+       : Allocation(memory, (VkDeviceSize)0)
+       , m_vk          (vk)
+       , m_device      (device)
+{
+}
+
+SimpleAllocation::~SimpleAllocation (void)
+{
+       m_vk.freeMemory(m_device, getMemory());
+}
+
+SimpleAllocator::SimpleAllocator (const DeviceInterface& vk, VkDevice device)
+       : m_vk          (vk)
+       , m_device      (device)
+{
+}
+
+MovePtr<Allocation> SimpleAllocator::allocate (const VkMemoryAllocInfo* allocInfo, VkDeviceSize alignment)
+{
+       VkDeviceMemory  mem     = DE_NULL;
+
+       VK_CHECK(m_vk.allocMemory(m_device, allocInfo, &mem));
+       TCU_CHECK(mem);
+
+       DE_UNREF(alignment);
+
+       try
+       {
+               return MovePtr<Allocation>(new SimpleAllocation(m_vk, m_device, mem));
+       }
+       catch (...)
+       {
+               m_vk.freeMemory(m_device, mem);
+               throw;
+       }
+}
+
+// Utils
+
+MovePtr<Allocation> allocate (Allocator& allocator, VkDeviceSize allocationSize, VkMemoryPropertyFlags memProps, VkDeviceSize alignment, VkMemoryPriority memPriority)
+{
+       const VkMemoryAllocInfo allocInfo       =
+       {
+               VK_STRUCTURE_TYPE_MEMORY_ALLOC_INFO,    //      VkStructureType                 sType;
+               DE_NULL,                                                                //      const void*                             pNext;
+               allocationSize,                                                 //      VkDeviceSize                    allocationSize;
+               memProps,                                                               //      VkMemoryPropertyFlags   memProps;
+               memPriority,                                                    //      VkMemoryPriority                memPriority;
+       };
+
+       return allocator.allocate(&allocInfo, alignment);
+}
+
+MovePtr<Allocation> allocate (Allocator& allocator, const VkMemoryRequirements& requirements, VkMemoryPropertyFlags memProps, VkMemoryPriority priority)
+{
+       if ((requirements.memPropsAllowed & memProps) != memProps)
+       {
+               std::ostringstream      msg;
+               msg << getMemoryPropertyFlagsStr(memProps & ~requirements.memPropsAllowed) << " not supported by object type";
+               TCU_THROW(NotSupportedError, msg.str().c_str());
+       }
+
+       return allocate(allocator, requirements.size, memProps | requirements.memPropsRequired, requirements.alignment, priority);
+}
+
+} // vk
diff --git a/framework/vulkan/vkMemUtil.hpp b/framework/vulkan/vkMemUtil.hpp
new file mode 100644 (file)
index 0000000..3b0cebe
--- /dev/null
@@ -0,0 +1,87 @@
+#ifndef _VKMEMUTIL_HPP
+#define _VKMEMUTIL_HPP
+/*-------------------------------------------------------------------------
+ * drawElements Quality Program Vulkan Utilities
+ * -----------------------------------------------
+ *
+ * Copyright 2015 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ *//*!
+ * \file
+ * \brief Memory management utilities.
+ *//*--------------------------------------------------------------------*/
+
+#include "vkDefs.hpp"
+#include "deUniquePtr.hpp"
+
+namespace vk
+{
+
+//! Memory allocation interface
+class Allocation
+{
+public:
+       virtual                                 ~Allocation     (void);
+
+       VkDeviceMemory                  getMemory       (void) const { return m_memory; }
+       VkDeviceSize                    getOffset       (void) const { return m_offset; }
+
+protected:
+                                                       Allocation      (VkDeviceMemory memory, VkDeviceSize offset);
+
+private:
+       const VkDeviceMemory    m_memory;
+       const VkDeviceSize              m_offset;
+};
+
+//! Memory allocator interface
+class Allocator
+{
+public:
+                                                                       Allocator       (void) {}
+       virtual                                                 ~Allocator      (void) {}
+
+       virtual de::MovePtr<Allocation> allocate        (const VkMemoryAllocInfo* allocInfo, VkDeviceSize alignment) = 0;
+};
+
+//! Allocator that backs every allocation with its own VkDeviceMemory
+class SimpleAllocator : public Allocator
+{
+public:
+                                                               SimpleAllocator (const DeviceInterface& vk, VkDevice device);
+
+       de::MovePtr<Allocation>         allocate                (const VkMemoryAllocInfo* allocInfo, VkDeviceSize alignment);
+
+private:
+       const DeviceInterface&          m_vk;
+       VkDevice                                        m_device;
+};
+
+// Utilities
+
+de::MovePtr<Allocation>                allocate        (Allocator&                                             allocator,
+                                                                                VkDeviceSize                                   allocationSize,
+                                                                                VkMemoryPropertyFlags                  memProps,
+                                                                                VkDeviceSize                                   alignment,
+                                                                                VkMemoryPriority                               memPriority = VK_MEMORY_PRIORITY_UNUSED);
+
+de::MovePtr<Allocation>                allocate        (Allocator&                                             allocator,
+                                                                                const VkMemoryRequirements&    requirements,
+                                                                                VkMemoryPropertyFlags                  memProps = 0u,
+                                                                                VkMemoryPriority                               priority = VK_MEMORY_PRIORITY_UNUSED);
+
+} // vk
+
+#endif // _VKMEMUTIL_HPP
diff --git a/framework/vulkan/vkQueryUtil.cpp b/framework/vulkan/vkQueryUtil.cpp
new file mode 100644 (file)
index 0000000..e64d561
--- /dev/null
@@ -0,0 +1,26 @@
+/*-------------------------------------------------------------------------
+ * drawElements Quality Program Vulkan Utilities
+ * -----------------------------------------------
+ *
+ * Copyright 2015 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ *//*!
+ * \file
+ * \brief Vulkan query utilities.
+ *//*--------------------------------------------------------------------*/
+
+#include "vkQueryUtil.hpp"
+
+DE_EMPTY_CPP_FILE
diff --git a/framework/vulkan/vkQueryUtil.hpp b/framework/vulkan/vkQueryUtil.hpp
new file mode 100644 (file)
index 0000000..20e4219
--- /dev/null
@@ -0,0 +1,144 @@
+#ifndef _VKQUERYUTIL_HPP
+#define _VKQUERYUTIL_HPP
+/*-------------------------------------------------------------------------
+ * drawElements Quality Program Vulkan Utilities
+ * -----------------------------------------------
+ *
+ * Copyright 2015 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ *//*!
+ * \file
+ * \brief Vulkan query utilities.
+ *//*--------------------------------------------------------------------*/
+
+#include "vkDefs.hpp"
+#include "vkRef.hpp"
+#include "deMeta.hpp"
+
+#include <vector>
+
+namespace vk
+{
+namespace querydetails
+{
+
+enum QueryResultCount
+{
+       QUERY_RESULT_COUNT_SINGLE       = 0,
+       QUERY_RESULT_COUNT_MULTIPLE     = 1
+};
+
+template<VkPhysicalDeviceInfoType InfoType>
+struct PhysicalDeviceInfoTraits;
+
+#define VK_DECLARE_QUERY_TRAITS(QUERY_CLASS, QUERY_PARAM, RESULT_TYPE, RESULT_COUNT)   \
+template<>     \
+struct QUERY_CLASS##Traits<QUERY_PARAM>        \
+{      \
+       typedef RESULT_TYPE     Type;   \
+       enum { QUERY_RESULT_COUNT = QUERY_RESULT_COUNT_##RESULT_COUNT };        \
+}
+
+VK_DECLARE_QUERY_TRAITS(PhysicalDeviceInfo, VK_PHYSICAL_DEVICE_INFO_TYPE_PROPERTIES,           VkPhysicalDeviceProperties,                     SINGLE);
+VK_DECLARE_QUERY_TRAITS(PhysicalDeviceInfo,    VK_PHYSICAL_DEVICE_INFO_TYPE_QUEUE_PROPERTIES,  VkPhysicalDeviceQueueProperties,        MULTIPLE);
+
+template<VkPhysicalDeviceInfoType InfoType>
+std::vector<typename PhysicalDeviceInfoTraits<InfoType>::Type> getPhysicalDeviceInfoImpl (const DeviceInterface& vk, VkPhysicalDevice physicalDevice)
+{
+       std::vector<typename PhysicalDeviceInfoTraits<InfoType>::Type>  values;
+       deUintptr                                                                                                               infoSize        = 0;
+
+       VK_CHECK(vk.getPhysicalDeviceInfo(physicalDevice, InfoType, &infoSize, DE_NULL));
+
+       if (infoSize % sizeof(typename PhysicalDeviceInfoTraits<InfoType>::Type) != 0)
+               TCU_FAIL("Returned info size is not divisible by structure size");
+
+       if (infoSize > 0)
+       {
+               values.resize(infoSize / sizeof(typename PhysicalDeviceInfoTraits<InfoType>::Type));
+               VK_CHECK(vk.getPhysicalDeviceInfo(physicalDevice, InfoType, &infoSize, &values[0]));
+
+               if (infoSize != values.size()*sizeof(typename PhysicalDeviceInfoTraits<InfoType>::Type))
+                       TCU_FAIL("Returned info size changed between queries");
+       }
+
+       return values;
+}
+
+template<VkPhysicalDeviceInfoType InfoType>
+std::vector<typename PhysicalDeviceInfoTraits<InfoType>::Type> getPhysicalDeviceInfo (typename de::meta::EnableIf<const DeviceInterface&, PhysicalDeviceInfoTraits<InfoType>::QUERY_RESULT_COUNT == QUERY_RESULT_COUNT_MULTIPLE>::Type vk, VkPhysicalDevice physicalDevice)
+{
+       return getPhysicalDeviceInfoImpl<InfoType>(vk, physicalDevice);
+}
+
+template<VkPhysicalDeviceInfoType InfoType>
+typename PhysicalDeviceInfoTraits<InfoType>::Type getPhysicalDeviceInfo (typename de::meta::EnableIf<const DeviceInterface&, PhysicalDeviceInfoTraits<InfoType>::QUERY_RESULT_COUNT == QUERY_RESULT_COUNT_SINGLE>::Type vk, VkPhysicalDevice physicalDevice)
+{
+       const std::vector<typename PhysicalDeviceInfoTraits<InfoType>::Type>    values  = getPhysicalDeviceInfoImpl<InfoType>(vk, physicalDevice);
+
+       if (values.size() != 1)
+               TCU_FAIL("Expected only single value");
+
+       return values[0];
+}
+
+template<VkObjectInfoType InfoType>
+struct ObjectInfoTraits;
+
+VK_DECLARE_QUERY_TRAITS(ObjectInfo,    VK_OBJECT_INFO_TYPE_MEMORY_REQUIREMENTS,        VkMemoryRequirements,   MULTIPLE);
+
+template<VkObjectInfoType InfoType>
+std::vector<typename ObjectInfoTraits<InfoType>::Type> getObjectInfoImpl (const DeviceInterface& vk, VkDevice device, VkObjectType objectType, VkObject object)
+{
+       std::vector<typename ObjectInfoTraits<InfoType>::Type>  values;
+       deUintptr                                                                                               infoSize        = 0;
+
+       VK_CHECK(vk.getObjectInfo(device, objectType, object, InfoType, &infoSize, DE_NULL));
+
+       if (infoSize % sizeof(typename ObjectInfoTraits<InfoType>::Type) != 0)
+               TCU_FAIL("Returned info size is not divisible by structure size");
+
+       if (infoSize > 0)
+       {
+               values.resize(infoSize / sizeof(typename ObjectInfoTraits<InfoType>::Type));
+               VK_CHECK(vk.getObjectInfo(device, objectType, object, InfoType, &infoSize, &values[0]));
+
+               if (infoSize != values.size()*sizeof(typename ObjectInfoTraits<InfoType>::Type))
+                       TCU_FAIL("Returned info size changed between queries");
+       }
+
+       return values;
+}
+
+template<VkObjectInfoType InfoType>
+std::vector<typename ObjectInfoTraits<InfoType>::Type> getObjectInfo (typename de::meta::EnableIf<const DeviceInterface&, ObjectInfoTraits<InfoType>::QUERY_RESULT_COUNT == QUERY_RESULT_COUNT_MULTIPLE>::Type vk, VkDevice device, VkObjectType objectType, VkObject object)
+{
+       return getObjectInfoImpl<InfoType>(vk, device, objectType, object);
+}
+
+template<VkObjectInfoType InfoType, typename T>
+std::vector<typename ObjectInfoTraits<InfoType>::Type> getObjectInfo (typename de::meta::EnableIf<const DeviceInterface&, ObjectInfoTraits<InfoType>::QUERY_RESULT_COUNT == QUERY_RESULT_COUNT_MULTIPLE>::Type vk, VkDevice device, const Unique<T>& object)
+{
+       return getObjectInfo<InfoType>(vk, device, getObjectType<T>(), object.get());
+}
+
+} // querydetails
+
+using querydetails::getPhysicalDeviceInfo;
+using querydetails::getObjectInfo;
+
+} // vk
+
+#endif // _VKQUERYUTIL_HPP
index 5892d48..044ba89 100644 (file)
@@ -28,6 +28,8 @@
 #include "vkPlatform.hpp"
 #include "vkStrUtil.hpp"
 #include "vkRef.hpp"
+#include "vkDeviceUtil.hpp"
+#include "vkQueryUtil.hpp"
 
 #include "tcuTestLog.hpp"
 #include "tcuFormatUtil.hpp"
@@ -35,8 +37,6 @@
 #include "deUniquePtr.hpp"
 #include "deStringUtil.hpp"
 
-#include "qpInfo.h"
-
 namespace vkt
 {
 
@@ -47,29 +47,9 @@ using tcu::TestLog;
 
 tcu::TestStatus enumeratePhysicalDevices (Context& context)
 {
-       const struct VkApplicationInfo          appInfo                 =
-       {
-               VK_STRUCTURE_TYPE_APPLICATION_INFO,             //      VkStructureType sType;
-               DE_NULL,                                                                //      const void*             pNext;
-               "deqp",                                                                 //      const char*             pAppName;
-               qpGetReleaseId(),                                               //      deUint32                appVersion;
-               "deqp",                                                                 //      const char*             pEngineName;
-               qpGetReleaseId(),                                               //      deUint32                engineVersion;
-               VK_API_VERSION                                                  //      deUint32                apiVersion;
-       };
-       const struct VkInstanceCreateInfo       instanceInfo    =
-       {
-               VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO, // VkStructureType                              sType;
-               DE_NULL,                                                                //      const void*                                     pNext;
-               &appInfo,                                                               //      const VkApplicationInfo*        pAppInfo;
-               DE_NULL,                                                                //      const VkAllocCallbacks*         pAllocCb;
-               0u,                                                                             //      deUint32                                        extensionCount;
-               DE_NULL                                                                 //      const char*const*                       ppEnabledExtensionNames;
-       };
-
        const PlatformInterface&        vkPlatform      = context.getPlatformInterface();
        TestLog&                                        log                     = context.getTestContext().getLog();
-       const Unique<VkInstanceT>       instance        (createInstance(vkPlatform, &instanceInfo));
+       const Unique<VkInstanceT>       instance        (createDefaultInstance(vkPlatform));
        vector<VkPhysicalDevice>        devices;
        deUint32                                        numDevices      = 0;
 
@@ -91,29 +71,9 @@ tcu::TestStatus enumeratePhysicalDevices (Context& context)
 
 tcu::TestStatus deviceProperties (Context& context)
 {
-       const struct VkApplicationInfo          appInfo                 =
-       {
-               VK_STRUCTURE_TYPE_APPLICATION_INFO,             //      VkStructureType sType;
-               DE_NULL,                                                                //      const void*             pNext;
-               "deqp",                                                                 //      const char*             pAppName;
-               qpGetReleaseId(),                                               //      deUint32                appVersion;
-               "deqp",                                                                 //      const char*             pEngineName;
-               qpGetReleaseId(),                                               //      deUint32                engineVersion;
-               VK_API_VERSION                                                  //      deUint32                apiVersion;
-       };
-       const struct VkInstanceCreateInfo       instanceInfo    =
-       {
-               VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO, // VkStructureType                              sType;
-               DE_NULL,                                                                //      const void*                                     pNext;
-               &appInfo,                                                               //      const VkApplicationInfo*        pAppInfo;
-               DE_NULL,                                                                //      const VkAllocCallbacks*         pAllocCb;
-               0u,                                                                             //      deUint32                                        extensionCount;
-               DE_NULL                                                                 //      const char*const*                       ppEnabledExtensionNames;
-       };
-
        const PlatformInterface&        vkPlatform      = context.getPlatformInterface();
        TestLog&                                        log                     = context.getTestContext().getLog();
-       const Unique<VkInstanceT>       instance        (createInstance(vkPlatform, &instanceInfo));
+       const Unique<VkInstanceT>       instance        (createDefaultInstance(vkPlatform));
        vector<VkPhysicalDevice>        devices;
        deUint32                                        numDevices      = 0;
 
@@ -126,13 +86,10 @@ tcu::TestStatus deviceProperties (Context& context)
 
                for (deUint32 ndx = 0; ndx < numDevices; ndx++)
                {
-                       const VkPhysicalDevice          physicalDevice          = devices[ndx];
-                       const tcu::ScopedLogSection     section                         (log, string("Device") + de::toString(ndx), string("Device ") + de::toString(ndx) + " (" + de::toString(tcu::toHex(physicalDevice)) + ")");
-                       const vk::DeviceDriver          vkDevice                        (vkPlatform, physicalDevice);
-                       VkPhysicalDeviceProperties      properties;
-                       deUintptr                                       propertiesSize          = sizeof(properties);
-
-                       VK_CHECK(vkDevice.getPhysicalDeviceInfo(physicalDevice, VK_PHYSICAL_DEVICE_INFO_TYPE_PROPERTIES, &propertiesSize, &properties));
+                       const VkPhysicalDevice                          physicalDevice  = devices[ndx];
+                       const tcu::ScopedLogSection                     section                 (log, string("Device") + de::toString(ndx), string("Device ") + de::toString(ndx) + " (" + de::toString(tcu::toHex(physicalDevice)) + ")");
+                       const vk::DeviceDriver                          vkDevice                (vkPlatform, physicalDevice);
+                       const VkPhysicalDeviceProperties        properties              = getPhysicalDeviceInfo<VK_PHYSICAL_DEVICE_INFO_TYPE_PROPERTIES>(vkDevice, physicalDevice);
 
                        log << TestLog::Message << "apiVersion = " << unpackVersion(properties.apiVersion) << "\n"
                                                                        << "driverVersion = " << tcu::toHex(properties.driverVersion) << "\n"
index 289f403..190b065 100644 (file)
@@ -122,7 +122,7 @@ inline TestCase* createFunctionCase (tcu::TestContext&                              testCtx,
                                                                         const std::string&                             desc,
                                                                         FunctionInstance0::Function    testFunction)
 {
-       return new InstanceFactory1<FunctionInstance0, typename FunctionInstance0::Function>(testCtx, type, name, desc, testFunction);
+       return new InstanceFactory1<FunctionInstance0, FunctionInstance0::Function>(testCtx, type, name, desc, testFunction);
 }
 
 template<typename Arg0>