Retrieve and display Android product model and manufacturer in text overlay [skip ci]
This commit is contained in:
parent
133cb9afe2
commit
143c1c3aac
2 changed files with 23 additions and 1 deletions
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@
|
|||
#include <android/native_activity.h>
|
||||
#include <android/asset_manager.h>
|
||||
#include <android_native_app_glue.h>
|
||||
#include <sys/system_properties.h>
|
||||
#include "vulkanandroid.h"
|
||||
#elif defined(VK_USE_PLATFORM_WAYLAND_KHR)
|
||||
#include <wayland-client.h>
|
||||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue