diff --git a/base/vulkanexamplebase.cpp b/base/vulkanexamplebase.cpp index 0fa01246..8c43dbc3 100644 --- a/base/vulkanexamplebase.cpp +++ b/base/vulkanexamplebase.cpp @@ -523,7 +523,11 @@ void VulkanExampleBase::updateTextOverlay() ss << std::fixed << std::setprecision(3) << (frameTimer * 1000.0f) << "ms (" << lastFPS << " fps)"; textOverlay->addText(ss.str(), 5.0f, 25.0f, VulkanTextOverlay::alignLeft); - textOverlay->addText(deviceProperties.deviceName, 5.0f, 45.0f, VulkanTextOverlay::alignLeft); + std::string deviceName(deviceProperties.deviceName); +#if defined(__ANDROID__) + deviceName += " (" + androidProduct + ")"; +#endif + textOverlay->addText(deviceName, 5.0f, 45.0f, VulkanTextOverlay::alignLeft); getOverlayText(textOverlay); @@ -864,6 +868,21 @@ void VulkanExampleBase::initVulkan() submitInfo.pWaitSemaphores = &semaphores.presentComplete; submitInfo.signalSemaphoreCount = 1; submitInfo.pSignalSemaphores = &semaphores.renderComplete; + +#if defined(__ANDROID__) + // Get Android device name and manufacturer (to display along GPU name) + androidProduct = ""; + char prop[PROP_VALUE_MAX+1]; + int len = __system_property_get("ro.product.manufacturer", prop); + if (len > 0) { + androidProduct += std::string(prop) + " "; + }; + len = __system_property_get("ro.product.model", prop); + if (len > 0) { + androidProduct += std::string(prop); + }; + LOGD("androidProduct = %s", androidProduct.c_str()); +#endif } #if defined(_WIN32) diff --git a/base/vulkanexamplebase.h b/base/vulkanexamplebase.h index 6ebd5d5e..55a2a6de 100644 --- a/base/vulkanexamplebase.h +++ b/base/vulkanexamplebase.h @@ -17,6 +17,7 @@ #include #include #include +#include #include "vulkanandroid.h" #elif defined(VK_USE_PLATFORM_WAYLAND_KHR) #include @@ -201,6 +202,8 @@ public: int32_t x; int32_t y; } touchPos; + /** @brief Product model and manufacturer of the Android device (via android.Product*) */ + std::string androidProduct; #elif defined(VK_USE_PLATFORM_WAYLAND_KHR) wl_display *display = nullptr; wl_registry *registry = nullptr;