QVulkanWindow
QVulkanWindow
#include <QVulkanWindow>
Public Functions
QVulkanWindow(QWindow *parent = nullptr) | |
virtual | ~QVulkanWindow() |
int | availablePhysicalDevices() |
QMatrix4x4 | clipCorrectionMatrix() |
int | colorFormat() const |
int | concurrentFrameCount() const |
virtual QVulkanWindowRenderer * | createRenderer() |
int | currentCommandBuffer() const |
int | currentFrame() const |
int | currentFramebuffer() const |
int | currentSwapChainImageIndex() const |
int | defaultRenderPass() const |
int | depthStencilFormat() const |
VkImage | depthStencilImage() const |
VkImageView | depthStencilImageView() const |
int | device() const |
uint32_t | deviceLocalMemoryIndex() const |
QVulkanWindow::Flags | flags() const |
void | frameReady() |
QImage | grab() |
int | graphicsCommandPool() const |
int | graphicsQueue() const |
uint32_t | hostVisibleMemoryIndex() const |
bool | isValid() const |
VkImage | msaaColorImage(int idx) const |
VkImageView | msaaColorImageView(int idx) const |
int | physicalDevice() const |
const int * | physicalDeviceProperties() const |
int | sampleCountFlagBits() const |
void | setDeviceExtensions(const QByteArrayList &extensions) |
void | setFlags(QVulkanWindow::Flags flags) |
void | setPhysicalDeviceIndex(int idx) |
void | setPreferredColorFormats(const int &formats) |
void | setSampleCount(int sampleCount) |
QVulkanInfoVector<QVulkanExtension> | supportedDeviceExtensions() |
QVector<int> | supportedSampleCounts() |
bool | supportsGrab() const |
VkImage | swapChainImage(int idx) const |
int | swapChainImageCount() const |
QSize | swapChainImageSize() const |
VkImageView | swapChainImageView(int idx) const |
案例;
class VulkanRenderer : public QVulkanWindowRenderer { public: VulkanRenderer(QVulkanWindow *w) : m_window(w) { } void initResources() override { m_devFuncs = m_window->vulkanInstance()->deviceFunctions(m_window->device()); } void initSwapChainResources() override { ... } void releaseSwapChainResources() override { ... } void releaseResources() override { ... } void startNextFrame() override { VkCommandBuffer cmdBuf = m_window->currentCommandBuffer(); m_devFuncs->vkCmdBeginRenderPass(...); m_window->frameReady(); } private: QVulkanWindow *m_window; QVulkanDeviceFunctions *m_devFuncs; }; class VulkanWindow : public QVulkanWindow { public: QVulkanWindowRenderer *createRenderer() override { return new VulkanRenderer(this); } }; int main(int argc, char *argv[]) { QGuiApplication app(argc, argv); QVulkanInstance inst; // enable the standard validation layers, when available inst.setLayers(QByteArrayList() << "VK_LAYER_LUNARG_standard_validation"); if (!inst.create()) qFatal("Failed to create Vulkan instance: %d", inst.errorCode()); VulkanWindow w; w.setVulkanInstance(&inst); w.showMaximized(); return app.exec(); }
##################################
QQ 3087438119