Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qvkkhrdisplayvulkaninstance.h
Go to the documentation of this file.
1// Copyright (C) 2021 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QVKKHRDISPLAYVULKANINSTANCE_H
5#define QVKKHRDISPLAYVULKANINSTANCE_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include <QtGui/private/qbasicvulkanplatforminstance_p.h>
19#include <QtCore/qsize.h>
20
21#include <climits> // For UINT_MAX
22
23QT_BEGIN_NAMESPACE
24
25class QVkKhrDisplayVulkanInstance : public QBasicPlatformVulkanInstance
26{
27public:
28 QVkKhrDisplayVulkanInstance(QVulkanInstance *instance);
29
30 void createOrAdoptInstance() override;
31 bool supportsPresent(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, QWindow *window) override;
32 void presentAboutToBeQueued(QWindow *window) override;
33
34 VkSurfaceKHR createSurface(QWindow *window);
35
36 QSize displaySize() const { return QSize(int(m_width), int(m_height)); }
37
38 using CreatedCallback = void (*)(QVkKhrDisplayVulkanInstance *, void *);
39 void setCreatedCallback(CreatedCallback callback, void *userData) {
40 m_createdCallback = callback;
41 m_createdCallbackUserData = userData;
42 }
43
44private:
45 bool chooseDisplay();
46
47 QVulkanInstance *m_instance;
48 VkPhysicalDevice m_physDev = VK_NULL_HANDLE;
49 PFN_vkEnumeratePhysicalDevices m_enumeratePhysicalDevices = nullptr;
50 PFN_vkGetPhysicalDeviceSurfaceSupportKHR m_getPhysicalDeviceSurfaceSupportKHR = nullptr;
51#if VK_KHR_display
52 PFN_vkGetPhysicalDeviceDisplayPropertiesKHR m_getPhysicalDeviceDisplayPropertiesKHR = nullptr;
53 PFN_vkGetDisplayModePropertiesKHR m_getDisplayModePropertiesKHR = nullptr;
54 PFN_vkGetPhysicalDeviceDisplayPlanePropertiesKHR m_getPhysicalDeviceDisplayPlanePropertiesKHR = nullptr;
55 PFN_vkGetDisplayPlaneSupportedDisplaysKHR m_getDisplayPlaneSupportedDisplaysKHR = nullptr;
56 PFN_vkGetDisplayPlaneCapabilitiesKHR m_getDisplayPlaneCapabilitiesKHR = nullptr;
57 PFN_vkCreateDisplayPlaneSurfaceKHR m_createDisplayPlaneSurfaceKHR = nullptr;
58#endif
59
60 CreatedCallback m_createdCallback = nullptr;
61 void *m_createdCallbackUserData = nullptr;
62 VkDisplayKHR m_display = VK_NULL_HANDLE;
63 VkDisplayModeKHR m_displayMode = VK_NULL_HANDLE;
64 uint32_t m_width = 0;
65 uint32_t m_height = 0;
66 uint32_t m_planeIndex = UINT_MAX;
67 uint32_t m_planeStackIndex = UINT_MAX;
68};
69
71
72#endif
void flush(QWindow *window, const QRegion &region, const QPoint &offset) override
Flushes the given region from the specified window.
QPaintDevice * paintDevice() override
Implement this function to return the appropriate paint device.
void resize(const QSize &size, const QRegion &staticContents) override
bool hasCapability(QPlatformIntegration::Capability cap) const override
QPlatformBackingStore * createPlatformBackingStore(QWindow *window) const override
Factory function for QPlatformBackingStore.
QPlatformTheme * createPlatformTheme(const QString &name) const override
QVkKhrDisplayIntegration(const QStringList &parameters)
QPlatformVulkanInstance * createPlatformVulkanInstance(QVulkanInstance *instance) const override
QPlatformServices * services() const override
QPlatformInputContext * inputContext() const override
Returns the platforms input context.
QPlatformNativeInterface * nativeInterface() const override
QPlatformFontDatabase * fontDatabase() const override
Accessor for the platform integration's fontdatabase.
QAbstractEventDispatcher * createEventDispatcher() const override
Factory function for the GUI event dispatcher.
void initialize() override
Performs initialization steps that depend on having an event dispatcher available.
void * nativeResourceForWindow(const QByteArray &resource, QWindow *window) override
QPlatformWindow * createPlatformWindow(QWindow *window) const override
Factory function for QPlatformWindow.
QRect geometry() const override
Reimplement in subclass to return the pixel geometry of the screen.
QImage::Format format() const override
Reimplement in subclass to return the image format which corresponds to the screen format.
void setVk(QVkKhrDisplayVulkanInstance *inst)
int depth() const override
Reimplement in subclass to return current depth of the screen.
void setGeometry(const QRect &r) override
This function is called by Qt whenever a window is moved or resized using the QWindow API.
static int resourceType(const QByteArray &key)