10#include <QSurfaceFormat>
11#include <qpa/qplatformscreen.h>
12#include <qpa/qwindowsysteminterface.h>
14#include <android/native_window.h>
15#include <android/native_window_jni.h>
31 destroyAndClearSurface();
48 && availableGeometry.
width() > 0
49 && availableGeometry.
height() > 0) {
58 destroyAndClearSurface();
64 return window()->requestedFormat();
67void QAndroidPlatformVulkanWindow::clearSurface()
69 if (m_vkSurface && m_destroyVkSurface) {
70 m_destroyVkSurface(
window()->vulkanInstance()->vkInstance(), m_vkSurface,
nullptr);
75 ANativeWindow_release(m_nativeWindow);
76 m_nativeWindow =
nullptr;
80void QAndroidPlatformVulkanWindow::destroyAndClearSurface()
93 bool needsExpose =
false;
100 if (!protector.acquire())
112 VkAndroidSurfaceCreateInfoKHR surfaceInfo;
113 memset(&surfaceInfo, 0,
sizeof(surfaceInfo));
114 surfaceInfo.sType = VK_STRUCTURE_TYPE_ANDROID_SURFACE_CREATE_INFO_KHR;
115 surfaceInfo.window = m_nativeWindow;
118 qWarning(
"Attempted to create Vulkan surface without an instance; was QWindow::setVulkanInstance() called?");
121 if (!m_createVkSurface) {
122 m_createVkSurface =
reinterpret_cast<PFN_vkCreateAndroidSurfaceKHR
>(
123 inst->getInstanceProcAddr(
"vkCreateAndroidSurfaceKHR"));
125 if (!m_destroyVkSurface) {
126 m_destroyVkSurface =
reinterpret_cast<PFN_vkDestroySurfaceKHR
>(
127 inst->getInstanceProcAddr(
"vkDestroySurfaceKHR"));
129 VkResult err = m_createVkSurface(inst->vkInstance(), &surfaceInfo,
nullptr, &m_vkSurface);
130 if (err != VK_SUCCESS)
131 qWarning(
"Failed to create Android VkSurface: %d", err);
\inmodule QtCore\reentrant
\inmodule QtCore\reentrant
constexpr int height() const noexcept
Returns the height of the rectangle.
constexpr int width() const noexcept
Returns the width of the rectangle.
The QVulkanInstance class represents a native Vulkan instance, enabling Vulkan rendering onto a QSurf...
bool wait(QMutex *, QDeadlineTimer=QDeadlineTimer(QDeadlineTimer::Forever))
static bool handleExposeEvent(QWindow *window, const QRegion ®ion)
Combined button and popup list for selecting options.