set(TCUTIL_PLATFORM_SRCS
osx/tcuOSXPlatform.cpp
osx/tcuOSXPlatform.hpp
+ osx/tcuOSXVulkanPlatform.cpp
+ osx/tcuOSXVulkanPlatform.hpp
)
else ()
*//*--------------------------------------------------------------------*/
#include "tcuOSXPlatform.hpp"
+#include "tcuRenderTarget.hpp"
+
+#include "tcuOSXVulkanPlatform.hpp"
+
+#include "gluDefs.hpp"
+#include "gluPlatform.hpp"
#include "gluRenderContext.hpp"
#include "gluRenderConfig.hpp"
-#include "tcuRenderTarget.hpp"
#include "glwFunctions.hpp"
#include "glwInitFunctions.hpp"
#include "deDynamicLibrary.hpp"
#include "glwEnums.hpp"
-#include "gluDefs.hpp"
#include <string>
namespace tcu
{
+class CGLRenderContext : public glu::RenderContext
+{
+public:
+ CGLRenderContext (const glu::RenderConfig& config);
+ ~CGLRenderContext (void);
+
+ glu::ContextType getType (void) const { return m_type; }
+ const glw::Functions& getFunctions (void) const { return m_functions; }
+ const tcu::RenderTarget& getRenderTarget (void) const { return m_renderTarget; }
+ void postIterate (void) {}
+
+private:
+ const glu::ContextType m_type;
+ CGLContextObj m_context;
+ glw::Functions m_functions;
+ RenderTarget m_renderTarget;
+};
+
+class CGLContextFactory : public glu::ContextFactory
+{
+public:
+ CGLContextFactory (void)
+ : glu::ContextFactory("cgl", "CGL Context (surfaceless, use fbo)")
+ {
+ }
+
+ glu::RenderContext* createContext (const glu::RenderConfig& config, const tcu::CommandLine&, const glu::RenderContext*) const
+ {
+ return new CGLRenderContext(config);
+ }
+};
+
+class OSXGLPlatform : public glu::Platform
+{
+public:
+ OSXGLPlatform(void)
+ {
+ m_contextFactoryRegistry.registerFactory(new CGLContextFactory());
+ }
+
+ ~OSXGLPlatform(void) {}
+};
+
+class OSXPlatform : public tcu::Platform
+{
+public:
+ OSXPlatform(void)
+ : m_gluPlatform(), m_vkPlatform()
+ {
+ }
+
+ ~OSXPlatform(void)
+ {
+ }
+
+ const glu::Platform& getGLPlatform (void) const { return m_gluPlatform; }
+ const vk::Platform& getVulkanPlatform (void) const { return m_vkPlatform; }
+
+private:
+ OSXGLPlatform m_gluPlatform;
+ osx::VulkanPlatform m_vkPlatform;
+};
+
namespace
{
} // anonymous
-class CGLRenderContext : public glu::RenderContext
-{
-public:
- CGLRenderContext (const glu::RenderConfig& config);
- ~CGLRenderContext (void);
-
- glu::ContextType getType (void) const { return m_type; }
- const glw::Functions& getFunctions (void) const { return m_functions; }
- const tcu::RenderTarget& getRenderTarget (void) const { return m_renderTarget; }
- void postIterate (void) {}
-
-private:
- const glu::ContextType m_type;
- CGLContextObj m_context;
- glw::Functions m_functions;
- RenderTarget m_renderTarget;
-};
-
static CGLOpenGLProfile getCGLProfile (glu::ContextType type)
{
if (type.getAPI().getProfile() != glu::PROFILE_CORE)
CGLDestroyContext(m_context);
}
-class CGLContextFactory : public glu::ContextFactory
-{
-public:
- CGLContextFactory (void)
- : glu::ContextFactory("cgl", "CGL Context (surfaceless, use fbo)")
- {
- }
-
- glu::RenderContext* createContext (const glu::RenderConfig& config, const tcu::CommandLine&) const
- {
- return new CGLRenderContext(config);
- }
-};
-
-OSXPlatform::OSXPlatform (void)
-{
- m_contextFactoryRegistry.registerFactory(new CGLContextFactory());
-}
-
-OSXPlatform::~OSXPlatform (void)
-{
-}
-
} // tcu
tcu::Platform* createPlatform (void)
* \brief OS X platform.
*//*--------------------------------------------------------------------*/
-#include "tcuDefs.hpp"
#include "tcuPlatform.hpp"
-#include "gluPlatform.hpp"
-namespace tcu
-{
-
-class OSXPlatform : public tcu::Platform, private glu::Platform
-{
-public:
- OSXPlatform (void);
- ~OSXPlatform (void);
-
- const glu::Platform& getGLPlatform (void) const { return static_cast<const glu::Platform&>(*this); }
-};
-
-} // tcu
+tcu::Platform* createPlatform (void);
#endif // _TCUOSXPLATFORM_HPP
--- /dev/null
+/*-------------------------------------------------------------------------
+ * drawElements Quality Program Tester Core
+ * ----------------------------------------
+ *
+ * Copyright (c) 2018 The Khronos Group Inc.
+ *
+ * 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 OSX Vulkan Platform.
+ *//*--------------------------------------------------------------------*/
+
+#include "tcuOSXVulkanPlatform.hpp"
+#include "tcuOSXPlatform.hpp"
+#include "vkWsiPlatform.hpp"
+#include "gluPlatform.hpp"
+#include "tcuFunctionLibrary.hpp"
+#include "deUniquePtr.hpp"
+#include "deMemory.h"
+
+#include <sys/utsname.h>
+
+using de::MovePtr;
+using de::UniquePtr;
+
+namespace tcu
+{
+namespace osx
+{
+
+class VulkanLibrary : public vk::Library
+{
+public:
+ VulkanLibrary (void)
+ : m_library ("libvulkan.dylib")
+ , m_driver (m_library)
+ {
+ }
+
+ const vk::PlatformInterface& getPlatformInterface (void) const
+ {
+ return m_driver;
+ }
+
+private:
+ const DynamicFunctionLibrary m_library;
+ const vk::PlatformDriver m_driver;
+};
+
+VulkanPlatform::VulkanPlatform ()
+{
+}
+
+vk::wsi::Display* VulkanPlatform::createWsiDisplay (vk::wsi::Type wsiType) const
+{
+ switch(wsiType)
+ {
+ //TODO: Core Graphics WSI
+ default:
+ TCU_THROW(NotSupportedError, "WSI type not supported");
+
+ };
+}
+
+vk::Library* VulkanPlatform::createLibrary (void) const
+{
+ return new VulkanLibrary();
+}
+
+void VulkanPlatform::describePlatform (std::ostream& dst) const
+{
+ utsname sysInfo;
+ deMemset(&sysInfo, 0, sizeof(sysInfo));
+
+ if (uname(&sysInfo) != 0)
+ throw std::runtime_error("uname() failed");
+
+ dst << "OS: " << sysInfo.sysname << " " << sysInfo.release << " " << sysInfo.version << "\n";
+ dst << "CPU: " << sysInfo.machine << "\n";
+}
+
+void VulkanPlatform::getMemoryLimits (vk::PlatformMemoryLimits& limits) const
+{
+ limits.totalSystemMemory = 256*1024*1024;
+ limits.totalDeviceLocalMemory = 128*1024*1024;
+ limits.deviceMemoryAllocationGranularity = 64*1024;
+ limits.devicePageSize = 4096;
+ limits.devicePageTableEntrySize = 8;
+ limits.devicePageTableHierarchyLevels = 3;
+}
+
+} // osx
+} // tcu
+
--- /dev/null
+#ifndef _TCUOSXVULKANPLATFORM_HPP
+#define _TCUOSXVULKANPLATFORM_HPP
+/*-------------------------------------------------------------------------
+ * drawElements Quality Program Tester Core
+ * ----------------------------------------
+ *
+ * Copyright (c) 2018 The Khronos Group Inc.
+ *
+ * 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 OSX Vulkan Platform.
+ *//*--------------------------------------------------------------------*/
+
+#include "vkWsiPlatform.hpp"
+#include "vkPlatform.hpp"
+
+namespace tcu
+{
+namespace osx
+
+{
+
+class VulkanPlatform : public vk::Platform
+{
+public:
+ VulkanPlatform ();
+ vk::wsi::Display* createWsiDisplay (vk::wsi::Type wsiType) const;
+ vk::Library* createLibrary (void) const;
+ void describePlatform (std::ostream& dst) const;
+ void getMemoryLimits (vk::PlatformMemoryLimits& limits) const;
+};
+
+
+} // osx
+} // tcu
+
+#endif // _TCUOSXVULKANPLATFORM_HPP