mirror of
https://github.com/crystalidea/qt6windows7.git
synced 2025-07-03 07:45:30 +08:00
qt 6.5.1 original
This commit is contained in:
BIN
examples/vulkan/doc/images/hellovulkancubes.png
Normal file
BIN
examples/vulkan/doc/images/hellovulkancubes.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 96 KiB |
BIN
examples/vulkan/doc/images/hellovulkantriangle.png
Normal file
BIN
examples/vulkan/doc/images/hellovulkantriangle.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 30 KiB |
BIN
examples/vulkan/doc/images/hellovulkanwidget.png
Normal file
BIN
examples/vulkan/doc/images/hellovulkanwidget.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 25 KiB |
35
examples/vulkan/doc/src/hellovulkancubes.qdoc
Normal file
35
examples/vulkan/doc/src/hellovulkancubes.qdoc
Normal file
@ -0,0 +1,35 @@
|
||||
// Copyright (C) 2017 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
|
||||
|
||||
/*!
|
||||
\example hellovulkancubes
|
||||
\meta installpath vulkan
|
||||
\title Hello Vulkan Cubes Example
|
||||
\ingroup examples-vulkan
|
||||
\brief Shows the basics of using QVulkanWindow.
|
||||
|
||||
The \e{Hello Vulkan Cubes Example} shows more advanced usage of QVulkanWindow.
|
||||
|
||||
\image hellovulkancubes.png
|
||||
|
||||
In this example there is a mesh loaded from a file and two different
|
||||
materials and corresponding graphics pipelines. The rounded cubes are drawn
|
||||
using instancing and feature a Phong lighting model with a single
|
||||
directional light.
|
||||
|
||||
Unlike hellovulkantexture and hellovulkantriangle, the uniform buffer
|
||||
handling takes an alternative approach here: dynamic uniform buffers are
|
||||
used instead of multiple descriptor sets.
|
||||
|
||||
The example requires QtConcurrent since it demonstrates simple usage of
|
||||
QtConcurrent::run(), QFuture, and QFutureWatcher in combination of
|
||||
QVulkanWindow. Mesh and shader data loading, the potentially expensive
|
||||
graphics pipeline construction, and the building of the frame command buffer
|
||||
are all done in separate worker threads.
|
||||
|
||||
The scene is embedded into a widget-based user interface. The QVulkanWindow
|
||||
subclass handles mouse and keyboard input as well since it provides a
|
||||
first-person style camera in order to allow moving around in the scene.
|
||||
|
||||
\include examples-run.qdocinc
|
||||
*/
|
68
examples/vulkan/doc/src/hellovulkantriangle.qdoc
Normal file
68
examples/vulkan/doc/src/hellovulkantriangle.qdoc
Normal file
@ -0,0 +1,68 @@
|
||||
// Copyright (C) 2017 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
|
||||
|
||||
/*!
|
||||
\example hellovulkantriangle
|
||||
\meta installpath vulkan
|
||||
\ingroup examples-vulkan
|
||||
\title Hello Vulkan Triangle Example
|
||||
\brief Shows the basics of rendering with QVulkanWindow and the Vulkan API.
|
||||
|
||||
The \e{Hello Vulkan Triangle Example} creates a full graphics pipeline,
|
||||
including a vertex and fragment shader, to render a triangle.
|
||||
|
||||
\image hellovulkantriangle.png
|
||||
|
||||
\section1 Startup
|
||||
|
||||
Each Qt application using Vulkan will have to have a \c{Vulkan instance}
|
||||
which encapsulates application-level state and initializes a Vulkan library.
|
||||
|
||||
A QVulkanWindow must always be associated with a QVulkanInstance and hence
|
||||
the example performs instance creation before the window. The
|
||||
QVulkanInstance object must also outlive the window.
|
||||
|
||||
\snippet hellovulkantriangle/main.cpp 0
|
||||
|
||||
The example enables validation layers, when supported. When the requested
|
||||
layers are not present, the request will be ignored. Additional layers and
|
||||
extensions can be enabled in a similar manner.
|
||||
|
||||
\snippet hellovulkantriangle/main.cpp 1
|
||||
|
||||
Once the instance is ready, it is time to create a window. Note that \c w
|
||||
lives on the stack and is declared after \c inst.
|
||||
|
||||
\section1 The QVulkanWindow Subclass
|
||||
|
||||
To add custom functionality to a QVulkanWindow, subclassing is used. This
|
||||
follows the existing patterns from QOpenGLWindow and QOpenGLWidget.
|
||||
However, QVulkanWindow utilizes a separate QVulkanWindowRenderer object.
|
||||
|
||||
The QVulkanWindow subclass reimplements the factory function
|
||||
QVulkanWindow::createRenderer(). This simply returns a new instance of the
|
||||
QVulkanWindowRenderer subclass. In order to be able to access various
|
||||
Vulkan resources via the window object, a pointer to the window is passed
|
||||
and stored via the constructor.
|
||||
|
||||
\snippet hellovulkantriangle/main.cpp 2
|
||||
|
||||
\section1 The Actual Rendering
|
||||
|
||||
QVulkanWindow subclasses queue their draw calls in their reimplementation
|
||||
of QVulkanWindowRenderer::startNextFrame(). Once done, they are required to
|
||||
call back QVulkanWindow::frameReady(). The example has no asynchronous
|
||||
command generation, so the frameReady() call is made directly from
|
||||
startNextFrame(). To get continuous updates, the example simply invokes
|
||||
QWindow::requestUpdate() in order to schedule a repaint.
|
||||
|
||||
The example also demonstrates multisample antialiasing. Based on the
|
||||
supported sample counts reported by QVulkanWindow::supportedSampleCounts()
|
||||
the example chooses between 8x, 4x, or no multisampling. Once configured
|
||||
via QVulkanWindow::setSamples(), QVulkanWindow takes care of the rest: the
|
||||
additional multisample color buffers are created automatically, and
|
||||
resolving into the swapchain buffers is performed at the end of the default
|
||||
render pass for each frame.
|
||||
|
||||
\include examples-run.qdocinc
|
||||
*/
|
26
examples/vulkan/doc/src/hellovulkanwidget.qdoc
Normal file
26
examples/vulkan/doc/src/hellovulkanwidget.qdoc
Normal file
@ -0,0 +1,26 @@
|
||||
// Copyright (C) 2017 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
|
||||
|
||||
/*!
|
||||
\example hellovulkanwidget
|
||||
\meta installpath vulkan
|
||||
\ingroup examples-vulkan
|
||||
\title Hello Vulkan Widget Example
|
||||
\brief Shows the usage of QVulkanWindow in QWidget applications.
|
||||
|
||||
The \e{Hello Vulkan Widget Example} is a variant of \l hellovulkantriangle
|
||||
that embeds the QVulkanWindow into a QWidget-based user interface using
|
||||
QWidget::createWindowContainer().
|
||||
|
||||
\image hellovulkanwidget.png
|
||||
|
||||
The code to set up the Vulkan pipeline and render the triangle is the same
|
||||
as in \l hellovulkantriangle. In addition, this example demonstrates
|
||||
another feature of QVulkanWindow: reading the image content back from the
|
||||
color buffer into a QImage. By clicking the Grab button, the example
|
||||
renders the next frame and follows it up with a transfer operation in order
|
||||
to get the swapchain color buffer content copied into host accessible
|
||||
memory. The image is then saved to disk via QImage::save().
|
||||
|
||||
\include examples-run.qdocinc
|
||||
*/
|
Reference in New Issue
Block a user