| // Copyright 2016 The Fuchsia Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| |
| #include "tcuFunctionLibrary.hpp" |
| #include "tcuPlatform.hpp" |
| #include "vkPlatform.hpp" |
| |
| class FuchsiaVkLibrary : public vk::Library { |
| public: |
| FuchsiaVkLibrary() |
| : library_("libvulkan.so"), driver_(library_) {} |
| |
| const vk::PlatformInterface& getPlatformInterface() const { |
| return driver_; |
| } |
| const tcu::FunctionLibrary& getFunctionLibrary (void) const |
| { |
| return library_; |
| } |
| |
| private: |
| const tcu::DynamicFunctionLibrary library_; |
| const vk::PlatformDriver driver_; |
| }; |
| |
| class FuchsiaVkPlatform : public vk::Platform { |
| public: |
| vk::Library* createLibrary() const { return new FuchsiaVkLibrary(); } |
| |
| void describePlatform (std::ostream& dst) const |
| { |
| dst << "OS: Fuchsia\n"; |
| const char* cpu = "Unknown"; |
| #if defined(__x86_64__) |
| cpu = "x86_64"; |
| #elif defined(__aarch64__) |
| cpu = "aarch64"; |
| #endif |
| dst << "CPU: " << cpu << "\n"; |
| } |
| |
| void getMemoryLimits(vk::PlatformMemoryLimits& limits) const { |
| // Copied from tcuX11VulkanPlatform.cpp |
| limits.totalSystemMemory = 256 * 1024 * 1024; |
| limits.totalDeviceLocalMemory = 0; // unified memory |
| limits.deviceMemoryAllocationGranularity = 64 * 1024; |
| limits.devicePageSize = 4096; |
| limits.devicePageTableEntrySize = 8; |
| limits.devicePageTableHierarchyLevels = 3; |
| } |
| }; |
| |
| class FuchsiaPlatform : public tcu::Platform { |
| public: |
| ~FuchsiaPlatform() {} |
| |
| const vk::Platform& getVulkanPlatform() const { return vk_platform_; } |
| |
| private: |
| FuchsiaVkPlatform vk_platform_; |
| }; |
| |
| tcu::Platform* createPlatform() { |
| return new FuchsiaPlatform(); |
| } |