Load libvulkan.so on X11 platform.
authorJarkko Pöyry <jpoyry@google.com>
Fri, 24 Jul 2015 22:06:08 +0000 (15:06 -0700)
committerJarkko Pöyry <jpoyry@google.com>
Tue, 28 Jul 2015 16:52:33 +0000 (09:52 -0700)
Change-Id: Ia8900b6f61acd5349d2c4b13a5e07e44e310f9a7

framework/platform/X11/tcuX11Platform.cpp

index e3f9257..e10db47 100644 (file)
@@ -25,7 +25,9 @@
 
 #include "deUniquePtr.hpp"
 #include "gluPlatform.hpp"
+#include "vkPlatform.hpp"
 #include "tcuX11.hpp"
+#include "tcuFunctionLibrary.hpp"
 
 #if defined (DEQP_SUPPORT_GLX)
 #      include "tcuX11GlxPlatform.hpp"
@@ -49,23 +51,54 @@ public:
        }
 };
 
+class VulkanLibrary : public vk::Library
+{
+public:
+       VulkanLibrary (void)
+               : m_library     ("libvulkan.so")
+               , m_driver      (m_library)
+       {
+       }
+
+       const vk::PlatformInterface& getPlatformInterface (void) const
+       {
+               return m_driver;
+       }
+
+private:
+       const tcu::DynamicFunctionLibrary       m_library;
+       const vk::PlatformDriver                        m_driver;
+};
+
+class X11VulkanPlatform : public vk::Platform
+{
+public:
+       vk::Library* createLibrary (void) const
+       {
+               return new VulkanLibrary();
+       }
+};
+
 class X11Platform : public tcu::Platform
 {
 public:
-                                                       X11Platform             (void);
-       bool                                    processEvents   (void) { return !m_eventState.getQuitFlag(); }
-       const glu::Platform&    getGLPlatform   (void) const { return m_glPlatform; }
+                                                       X11Platform                     (void);
+       bool                                    processEvents           (void) { return !m_eventState.getQuitFlag(); }
+       const glu::Platform&    getGLPlatform           (void) const { return m_glPlatform; }
 
 #if defined (DEQP_SUPPORT_EGL)
-       const eglu::Platform&   getEGLPlatform  (void) const { return m_eglPlatform; }
+       const eglu::Platform&   getEGLPlatform          (void) const { return m_eglPlatform; }
 #endif // DEQP_SUPPORT_EGL
 
+       const vk::Platform&             getVulkanPlatform       (void) const { return m_vkPlatform; }
+
 private:
        EventState                              m_eventState;
 #if defined (DEQP_SUPPORT_EGL)
        x11::egl::Platform              m_eglPlatform;
 #endif // DEQP_SPPORT_EGL
        X11GLPlatform                   m_glPlatform;
+       X11VulkanPlatform               m_vkPlatform;
 };
 
 X11Platform::X11Platform (void)