diff options
author | Laszlo Agocs <laszlo.agocs@qt.io> | 2023-03-22 16:26:16 +0100 |
---|---|---|
committer | Laszlo Agocs <laszlo.agocs@qt.io> | 2023-03-22 23:17:55 +0100 |
commit | 0e8d347c6a99c2729eb5d32cfc70f4fb2755f940 (patch) | |
tree | 047457c6f76124620ae853f0eaa4ecb17ea8c2c2 /examples/vulkan/hellovulkanwindow/hellovulkanwindow.cpp | |
parent | b5b954fac12414c315369344b1664bf220a59dad (diff) |
Remove hellovulkanwindow example
The idea being that hellovulkantriangle demonstrates the same things.
As a getting started tutorial hellovulkanwindow is the ideal example,
but then again QVulkanWindow is not something we want to promote much
in Qt 6.
Some of the docs are moved to hellovulkantriangle.
Pick-to: 6.5
Change-Id: Icbfff70b4a4c7e4c0863a937f3c16038c0b03fbe
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
Diffstat (limited to 'examples/vulkan/hellovulkanwindow/hellovulkanwindow.cpp')
-rw-r--r-- | examples/vulkan/hellovulkanwindow/hellovulkanwindow.cpp | 81 |
1 files changed, 0 insertions, 81 deletions
diff --git a/examples/vulkan/hellovulkanwindow/hellovulkanwindow.cpp b/examples/vulkan/hellovulkanwindow/hellovulkanwindow.cpp deleted file mode 100644 index fba3a47547..0000000000 --- a/examples/vulkan/hellovulkanwindow/hellovulkanwindow.cpp +++ /dev/null @@ -1,81 +0,0 @@ -// Copyright (C) 2017 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause - -#include "hellovulkanwindow.h" -#include <QVulkanFunctions> - -//! [0] -QVulkanWindowRenderer *VulkanWindow::createRenderer() -{ - return new VulkanRenderer(this); -} - -VulkanRenderer::VulkanRenderer(QVulkanWindow *w) - : m_window(w) -{ -} -//! [0] - -//! [1] -void VulkanRenderer::initResources() -{ - qDebug("initResources"); - - m_devFuncs = m_window->vulkanInstance()->deviceFunctions(m_window->device()); -} -//! [1] - -void VulkanRenderer::initSwapChainResources() -{ - qDebug("initSwapChainResources"); -} - -void VulkanRenderer::releaseSwapChainResources() -{ - qDebug("releaseSwapChainResources"); -} - -void VulkanRenderer::releaseResources() -{ - qDebug("releaseResources"); -} - -//! [2] -void VulkanRenderer::startNextFrame() -{ - m_green += 0.005f; - if (m_green > 1.0f) - m_green = 0.0f; - - VkClearColorValue clearColor = {{ 0.0f, m_green, 0.0f, 1.0f }}; - VkClearDepthStencilValue clearDS = { 1.0f, 0 }; - VkClearValue clearValues[2]; - memset(clearValues, 0, sizeof(clearValues)); - clearValues[0].color = clearColor; - clearValues[1].depthStencil = clearDS; - - VkRenderPassBeginInfo rpBeginInfo; - memset(&rpBeginInfo, 0, sizeof(rpBeginInfo)); - rpBeginInfo.sType = VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO; - rpBeginInfo.renderPass = m_window->defaultRenderPass(); - rpBeginInfo.framebuffer = m_window->currentFramebuffer(); - const QSize sz = m_window->swapChainImageSize(); - rpBeginInfo.renderArea.extent.width = sz.width(); - rpBeginInfo.renderArea.extent.height = sz.height(); - rpBeginInfo.clearValueCount = 2; - rpBeginInfo.pClearValues = clearValues; - VkCommandBuffer cmdBuf = m_window->currentCommandBuffer(); - m_devFuncs->vkCmdBeginRenderPass(cmdBuf, &rpBeginInfo, VK_SUBPASS_CONTENTS_INLINE); - - // Do nothing else. We will just clear to green, changing the component on - // every invocation. This also helps verifying the rate to which the thread - // is throttled to. (The elapsed time between startNextFrame calls should - // typically be around 16 ms. Note that rendering is 2 frames ahead of what - // is displayed.) - - m_devFuncs->vkCmdEndRenderPass(cmdBuf); - - m_window->frameReady(); - m_window->requestUpdate(); // render continuously, throttled by the presentation rate -} -//! [2] |