aboutsummaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-rw-r--r--examples/quick/quickwidgets/quickwidget/fbitem.cpp6
-rw-r--r--examples/quick/scenegraph/fboitem/fboinsgrenderer.cpp2
-rw-r--r--examples/quick/scenegraph/openglunderqml/squircle.cpp4
-rw-r--r--examples/quick/scenegraph/openglunderqml/squircle.h4
-rw-r--r--examples/quick/scenegraph/rendernode/customrenderitem.cpp11
-rw-r--r--examples/quick/scenegraph/rendernode/d3d12renderer.cpp309
-rw-r--r--examples/quick/scenegraph/rendernode/d3d12renderer.h95
-rw-r--r--examples/quick/scenegraph/rendernode/main.qml1
-rw-r--r--examples/quick/scenegraph/rendernode/rendernode.pro6
-rw-r--r--examples/quick/scenegraph/rendernode/rendernode.qrc2
-rw-r--r--examples/quick/scenegraph/rendernode/shader_frag.csobin908 -> 0 bytes
-rw-r--r--examples/quick/scenegraph/rendernode/shader_vert.csobin1720 -> 0 bytes
-rw-r--r--examples/quick/scenegraph/shared/logorenderer.h4
-rw-r--r--examples/quick/scenegraph/textureinthread/threadrenderer.cpp4
-rw-r--r--examples/quick/scenegraph/twotextureproviders/xorblender.cpp4
-rw-r--r--examples/quick/shadereffects/content/shaders/+hlsl/blur.frag18
-rw-r--r--examples/quick/shadereffects/content/shaders/+hlsl/colorize.frag17
-rw-r--r--examples/quick/shadereffects/content/shaders/+hlsl/genie.vert31
-rw-r--r--examples/quick/shadereffects/content/shaders/+hlsl/outline.frag21
-rw-r--r--examples/quick/shadereffects/content/shaders/+hlsl/shadow.frag20
-rw-r--r--examples/quick/shadereffects/content/shaders/+hlsl/wobble.frag17
-rw-r--r--examples/quick/shadereffects/doc/src/shadereffects.qdoc15
-rw-r--r--examples/quick/shadereffects/shadereffects.qrc6
-rw-r--r--examples/quick/shared/SimpleLauncherDelegate.qml3
-rw-r--r--examples/quick/text/doc/src/text.qdoc3
-rw-r--r--examples/quick/text/fonts/fonts.qml7
26 files changed, 19 insertions, 591 deletions
diff --git a/examples/quick/quickwidgets/quickwidget/fbitem.cpp b/examples/quick/quickwidgets/quickwidget/fbitem.cpp
index 95ff2da2e0..3e98168dcf 100644
--- a/examples/quick/quickwidgets/quickwidget/fbitem.cpp
+++ b/examples/quick/quickwidgets/quickwidget/fbitem.cpp
@@ -49,9 +49,9 @@
****************************************************************************/
#include "fbitem.h"
-#include <QtGui/QOpenGLFramebufferObject>
-#include <QtGui/QOpenGLContext>
-#include <QtGui/QOpenGLFunctions>
+#include <QOpenGLFramebufferObject>
+#include <QOpenGLContext>
+#include <QOpenGLFunctions>
#include <QtCore/QDebug>
#if QT_CONFIG(opengl)
diff --git a/examples/quick/scenegraph/fboitem/fboinsgrenderer.cpp b/examples/quick/scenegraph/fboitem/fboinsgrenderer.cpp
index 8ba5bddb2a..1c7be258be 100644
--- a/examples/quick/scenegraph/fboitem/fboinsgrenderer.cpp
+++ b/examples/quick/scenegraph/fboitem/fboinsgrenderer.cpp
@@ -51,7 +51,7 @@
#include "fboinsgrenderer.h"
#include "logorenderer.h"
-#include <QtGui/QOpenGLFramebufferObject>
+#include <QOpenGLFramebufferObject>
#include <QtQuick/QQuickWindow>
#include <qsgsimpletexturenode.h>
diff --git a/examples/quick/scenegraph/openglunderqml/squircle.cpp b/examples/quick/scenegraph/openglunderqml/squircle.cpp
index 828857fe24..1c4563baa5 100644
--- a/examples/quick/scenegraph/openglunderqml/squircle.cpp
+++ b/examples/quick/scenegraph/openglunderqml/squircle.cpp
@@ -51,8 +51,8 @@
#include "squircle.h"
#include <QtQuick/qquickwindow.h>
-#include <QtGui/QOpenGLShaderProgram>
-#include <QtGui/QOpenGLContext>
+#include <QOpenGLShaderProgram>
+#include <QOpenGLContext>
#include <QtCore/QRunnable>
//! [7]
diff --git a/examples/quick/scenegraph/openglunderqml/squircle.h b/examples/quick/scenegraph/openglunderqml/squircle.h
index c24fdd50c2..ecd92161fc 100644
--- a/examples/quick/scenegraph/openglunderqml/squircle.h
+++ b/examples/quick/scenegraph/openglunderqml/squircle.h
@@ -52,8 +52,8 @@
#define SQUIRCLE_H
#include <QtQuick/QQuickItem>
-#include <QtGui/QOpenGLShaderProgram>
-#include <QtGui/QOpenGLFunctions>
+#include <QOpenGLShaderProgram>
+#include <QOpenGLFunctions>
diff --git a/examples/quick/scenegraph/rendernode/customrenderitem.cpp b/examples/quick/scenegraph/rendernode/customrenderitem.cpp
index 5f51522c47..aae91120a7 100644
--- a/examples/quick/scenegraph/rendernode/customrenderitem.cpp
+++ b/examples/quick/scenegraph/rendernode/customrenderitem.cpp
@@ -56,9 +56,6 @@
#ifdef Q_OS_MACOS
#include "metalrenderer.h"
#endif
-#if QT_CONFIG(d3d12)
-#include "d3d12renderer.h"
-#endif
#include "softwarerenderer.h"
//! [1]
@@ -105,14 +102,6 @@ QSGNode *CustomRenderItem::updatePaintNode(QSGNode *node, UpdatePaintNodeData *)
#endif
break;
- case QSGRendererInterface::Direct3D12: // ### Qt 6: remove
-#if QT_CONFIG(d3d12)
- if (!n)
- n = new D3D12RenderNode;
- static_cast<D3D12RenderNode *>(n)->sync(this);
-#endif
- break;
-
case QSGRendererInterface::Software:
if (!n)
n = new SoftwareRenderNode;
diff --git a/examples/quick/scenegraph/rendernode/d3d12renderer.cpp b/examples/quick/scenegraph/rendernode/d3d12renderer.cpp
deleted file mode 100644
index e85811c089..0000000000
--- a/examples/quick/scenegraph/rendernode/d3d12renderer.cpp
+++ /dev/null
@@ -1,309 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "d3d12renderer.h"
-#include <QQuickItem>
-#include <QQuickWindow>
-#include <QSGRendererInterface>
-#include <QFile>
-
-// ### Qt 6: remove
-
-#if QT_CONFIG(d3d12)
-
-D3D12RenderNode::~D3D12RenderNode()
-{
- releaseResources();
-}
-
-void D3D12RenderNode::releaseResources()
-{
- if (vbPtr) {
- vertexBuffer->Unmap(0, nullptr);
- vbPtr = nullptr;
- }
- if (cbPtr) {
- constantBuffer->Unmap(0, nullptr);
- cbPtr = nullptr;
- }
- constantBuffer = nullptr;
- vertexBuffer = nullptr;
- rootSignature = nullptr;
- pipelineState = nullptr;
- m_device = nullptr;
-}
-
-void D3D12RenderNode::init()
-{
- QSGRendererInterface *rif = m_window->rendererInterface();
- m_device = static_cast<ID3D12Device *>(rif->getResource(m_window, QSGRendererInterface::DeviceResource));
- Q_ASSERT(m_device);
-
- D3D12_ROOT_PARAMETER rootParameter;
- rootParameter.ParameterType = D3D12_ROOT_PARAMETER_TYPE_CBV;
- rootParameter.ShaderVisibility = D3D12_SHADER_VISIBILITY_ALL;
- rootParameter.Descriptor.ShaderRegister = 0; // b0
- rootParameter.Descriptor.RegisterSpace = 0;
-
- D3D12_ROOT_SIGNATURE_DESC desc;
- desc.NumParameters = 1;
- desc.pParameters = &rootParameter;
- desc.NumStaticSamplers = 0;
- desc.pStaticSamplers = nullptr;
- desc.Flags = D3D12_ROOT_SIGNATURE_FLAG_ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT;
-
- ComPtr<ID3DBlob> signature;
- ComPtr<ID3DBlob> error;
- if (FAILED(D3D12SerializeRootSignature(&desc, D3D_ROOT_SIGNATURE_VERSION_1, &signature, &error))) {
- qWarning("Failed to serialize root signature");
- return;
- }
- if (FAILED(m_device->CreateRootSignature(0, signature->GetBufferPointer(), signature->GetBufferSize(),
- IID_PPV_ARGS(&rootSignature)))) {
- qWarning("Failed to create root signature");
- return;
- }
-
- D3D12_INPUT_ELEMENT_DESC inputElementDescs[] = {
- { "POSITION", 0, DXGI_FORMAT_R32G32_FLOAT, 0, 0, D3D12_INPUT_CLASSIFICATION_PER_VERTEX_DATA, 0 },
- { "COLOR", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 8, D3D12_INPUT_CLASSIFICATION_PER_VERTEX_DATA, 0 }
- };
-
- QFile f(QStringLiteral(":/scenegraph/rendernode/shader_vert.cso"));
- if (!f.open(QIODevice::ReadOnly)) {
- qWarning("Failed to open file with vertex shader bytecode");
- return;
- }
- QByteArray vshader_cso = f.readAll();
- f.close();
- f.setFileName(QStringLiteral(":/scenegraph/rendernode/shader_frag.cso"));
- if (!f.open(QIODevice::ReadOnly)) {
- qWarning("Failed to open file with fragment shader bytecode");
- return;
- }
- QByteArray fshader_cso = f.readAll();
- D3D12_SHADER_BYTECODE vshader;
- vshader.pShaderBytecode = vshader_cso.constData();
- vshader.BytecodeLength = vshader_cso.size();
- D3D12_SHADER_BYTECODE pshader;
- pshader.pShaderBytecode = fshader_cso.constData();
- pshader.BytecodeLength = fshader_cso.size();
-
- D3D12_RASTERIZER_DESC rastDesc = {};
- rastDesc.FillMode = D3D12_FILL_MODE_SOLID;
- rastDesc.CullMode = D3D12_CULL_MODE_BACK;
- rastDesc.FrontCounterClockwise = TRUE; // Vertices are given CCW
-
- // Enable color write and blending (premultiplied alpha). The latter is
- // needed because the example changes the item's opacity and we pass
- // inheritedOpacity() into the pixel shader. If that wasn't the case,
- // blending could have stayed disabled.
- const D3D12_RENDER_TARGET_BLEND_DESC premulBlendDesc = {
- TRUE, FALSE,
- D3D12_BLEND_ONE, D3D12_BLEND_INV_SRC_ALPHA, D3D12_BLEND_OP_ADD,
- D3D12_BLEND_ONE, D3D12_BLEND_INV_SRC_ALPHA, D3D12_BLEND_OP_ADD,
- D3D12_LOGIC_OP_NOOP,
- D3D12_COLOR_WRITE_ENABLE_ALL
- };
- D3D12_BLEND_DESC blendDesc = {};
- blendDesc.RenderTarget[0] = premulBlendDesc;
-
- D3D12_GRAPHICS_PIPELINE_STATE_DESC psoDesc = {};
- psoDesc.InputLayout = { inputElementDescs, _countof(inputElementDescs) };
- psoDesc.pRootSignature = rootSignature.Get();
- psoDesc.VS = vshader;
- psoDesc.PS = pshader;
- psoDesc.RasterizerState = rastDesc;
- psoDesc.BlendState = blendDesc;
- // No depth. The correct stacking of the item is ensured by the projection matrix.
- // Note that this does not support clipping.
- // If clipping is desired, render() needs to set a different PSO
- // with stencil enabled whenever the RenderState indicates so.
- psoDesc.SampleMask = UINT_MAX;
- psoDesc.PrimitiveTopologyType = D3D12_PRIMITIVE_TOPOLOGY_TYPE_TRIANGLE;
- psoDesc.NumRenderTargets = 1;
- psoDesc.RTVFormats[0] = DXGI_FORMAT_R8G8B8A8_UNORM;
- psoDesc.DSVFormat = DXGI_FORMAT_D24_UNORM_S8_UINT; // not in use due to !DepthEnable, but this would be the correct format otherwise
- // We are rendering on the default render target so if the QuickWindow/View
- // has requested samples > 0 then we have to follow suit.
- const uint samples = qMax(1, m_window->format().samples());
- psoDesc.SampleDesc.Count = samples;
- if (samples > 1) {
- D3D12_FEATURE_DATA_MULTISAMPLE_QUALITY_LEVELS msaaInfo = {};
- msaaInfo.Format = psoDesc.RTVFormats[0];
- msaaInfo.SampleCount = samples;
- if (SUCCEEDED(m_device->CheckFeatureSupport(D3D12_FEATURE_MULTISAMPLE_QUALITY_LEVELS, &msaaInfo, sizeof(msaaInfo)))) {
- if (msaaInfo.NumQualityLevels > 0)
- psoDesc.SampleDesc.Quality = msaaInfo.NumQualityLevels - 1;
- }
- }
-
- if (FAILED(m_device->CreateGraphicsPipelineState(&psoDesc, IID_PPV_ARGS(&pipelineState)))) {
- qWarning("Failed to create graphics pipeline state");
- return;
- }
-
- const UINT vertexBufferSize = (2 + 3) * 3 * sizeof(float);
-
- D3D12_HEAP_PROPERTIES heapProp = {};
- heapProp.Type = D3D12_HEAP_TYPE_UPLOAD;
-
- D3D12_RESOURCE_DESC bufDesc;
- bufDesc.Dimension = D3D12_RESOURCE_DIMENSION_BUFFER;
- bufDesc.Alignment = 0;
- bufDesc.Width = vertexBufferSize;
- bufDesc.Height = 1;
- bufDesc.DepthOrArraySize = 1;
- bufDesc.MipLevels = 1;
- bufDesc.Format = DXGI_FORMAT_UNKNOWN;
- bufDesc.SampleDesc.Count = 1;
- bufDesc.SampleDesc.Quality = 0;
- bufDesc.Layout = D3D12_TEXTURE_LAYOUT_ROW_MAJOR;
- bufDesc.Flags = D3D12_RESOURCE_FLAG_NONE;
-
- if (FAILED(m_device->CreateCommittedResource(&heapProp, D3D12_HEAP_FLAG_NONE, &bufDesc,
- D3D12_RESOURCE_STATE_GENERIC_READ, nullptr,
- IID_PPV_ARGS(&vertexBuffer)))) {
- qWarning("Failed to create committed resource (vertex buffer)");
- return;
- }
-
- vertexBufferView.BufferLocation = vertexBuffer->GetGPUVirtualAddress();
- vertexBufferView.StrideInBytes = vertexBufferSize / 3;
- vertexBufferView.SizeInBytes = vertexBufferSize;
-
- bufDesc.Width = 256;
- if (FAILED(m_device->CreateCommittedResource(&heapProp, D3D12_HEAP_FLAG_NONE, &bufDesc,
- D3D12_RESOURCE_STATE_GENERIC_READ, nullptr,
- IID_PPV_ARGS(&constantBuffer)))) {
- qWarning("Failed to create committed resource (constant buffer)");
- return;
- }
-
- const D3D12_RANGE readRange = { 0, 0 };
- if (FAILED(vertexBuffer->Map(0, &readRange, reinterpret_cast<void **>(&vbPtr)))) {
- qWarning("Map failed");
- return;
- }
-
- if (FAILED(constantBuffer->Map(0, &readRange, reinterpret_cast<void **>(&cbPtr)))) {
- qWarning("Map failed (constant buffer)");
- return;
- }
-
- float *vp = reinterpret_cast<float *>(vbPtr);
- vp += 2;
- *vp++ = 1.0f; *vp++ = 0.0f; *vp++ = 0.0f;
- vp += 2;
- *vp++ = 0.0f; *vp++ = 1.0f; *vp++ = 0.0f;
- vp += 2;
- *vp++ = 0.0f; *vp++ = 0.0f; *vp++ = 1.0f;
-}
-
-void D3D12RenderNode::render(const RenderState *state)
-{
- if (!m_device)
- init();
-
- QSGRendererInterface *rif = m_window->rendererInterface();
- ID3D12GraphicsCommandList *commandList = static_cast<ID3D12GraphicsCommandList *>(
- rif->getResource(m_window, QSGRendererInterface::CommandListResource));
- Q_ASSERT(commandList);
-
- const int msize = 16 * sizeof(float);
- memcpy(cbPtr, matrix()->constData(), msize);
- memcpy(cbPtr + msize, state->projectionMatrix()->constData(), msize);
- const float opacity = inheritedOpacity();
- memcpy(cbPtr + 2 * msize, &opacity, sizeof(float));
-
- const QPointF p0(m_width - 1, m_height - 1);
- const QPointF p1(0, 0);
- const QPointF p2(0, m_height - 1);
-
- float *vp = reinterpret_cast<float *>(vbPtr);
- *vp++ = p0.x();
- *vp++ = p0.y();
- vp += 3;
- *vp++ = p1.x();
- *vp++ = p1.y();
- vp += 3;
- *vp++ = p2.x();
- *vp++ = p2.y();
-
- commandList->SetPipelineState(pipelineState.Get());
- commandList->SetGraphicsRootSignature(rootSignature.Get());
- commandList->SetGraphicsRootConstantBufferView(0, constantBuffer->GetGPUVirtualAddress());
- commandList->IASetPrimitiveTopology(D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
- commandList->IASetVertexBuffers(0, 1, &vertexBufferView);
-
- commandList->DrawInstanced(3, 1, 0, 0);
-}
-
-// No need to reimplement changedStates() because no relevant commands are
-// added to the command list in render().
-
-QSGRenderNode::RenderingFlags D3D12RenderNode::flags() const
-{
- return BoundedRectRendering | DepthAwareRendering;
-}
-
-QRectF D3D12RenderNode::rect() const
-{
- return QRect(0, 0, m_width, m_height);
-}
-
-void D3D12RenderNode::sync(QQuickItem *item)
-{
- m_window = item->window();
- m_width = item->width();
- m_height = item->height();
-}
-
-#endif // d3d12
diff --git a/examples/quick/scenegraph/rendernode/d3d12renderer.h b/examples/quick/scenegraph/rendernode/d3d12renderer.h
deleted file mode 100644
index 7186b72c04..0000000000
--- a/examples/quick/scenegraph/rendernode/d3d12renderer.h
+++ /dev/null
@@ -1,95 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef D3D12RENDERER_H
-#define D3D12RENDERER_H
-
-#include <qsgrendernode.h>
-#include <QQuickItem>
-
-#if QT_CONFIG(d3d12)
-
-#include <d3d12.h>
-#include <wrl/client.h>
-
-using namespace Microsoft::WRL;
-
-class D3D12RenderNode : public QSGRenderNode
-{
-public:
- ~D3D12RenderNode();
-
- void render(const RenderState *state) override;
- void releaseResources() override;
- RenderingFlags flags() const override;
- QRectF rect() const override;
-
- void sync(QQuickItem *item);
-
-private:
- void init();
-
- QQuickWindow *m_window = nullptr;
- int m_width = 0;
- int m_height = 0;
-
- ID3D12Device *m_device = nullptr;
- ComPtr<ID3D12PipelineState> pipelineState;
- ComPtr<ID3D12RootSignature> rootSignature;
- ComPtr<ID3D12Resource> vertexBuffer;
- ComPtr<ID3D12Resource> constantBuffer;
- D3D12_VERTEX_BUFFER_VIEW vertexBufferView;
- quint8 *vbPtr = nullptr;
- quint8 *cbPtr = nullptr;
-};
-
-#endif // d3d12
-
-#endif
diff --git a/examples/quick/scenegraph/rendernode/main.qml b/examples/quick/scenegraph/rendernode/main.qml
index 5631df317c..a02fa128d5 100644
--- a/examples/quick/scenegraph/rendernode/main.qml
+++ b/examples/quick/scenegraph/rendernode/main.qml
@@ -143,7 +143,6 @@ Item {
var apiStr;
switch (api) {
case GraphicsInfo.OpenGL: apiStr = "OpenGL (direct)"; break;
- case GraphicsInfo.Direct3D12: apiStr = "Direct3D 12 (direct)"; break;
case GraphicsInfo.Software: apiStr = "Software (QPainter)"; break;
case GraphicsInfo.OpenGLRhi: apiStr = "OpenGL (RHI)"; break;
case GraphicsInfo.MetalRhi: apiStr = "Metal (RHI)"; break;
diff --git a/examples/quick/scenegraph/rendernode/rendernode.pro b/examples/quick/scenegraph/rendernode/rendernode.pro
index cfec905764..4ae46de2a4 100644
--- a/examples/quick/scenegraph/rendernode/rendernode.pro
+++ b/examples/quick/scenegraph/rendernode/rendernode.pro
@@ -21,12 +21,6 @@ INSTALLS += target
OTHER_FILES += \
main.qml
-qtConfig(d3d12) {
- HEADERS += d3d12renderer.h
- SOURCES += d3d12renderer.cpp
- LIBS += -ld3d12
-}
-
macos {
HEADERS += metalrenderer.h
SOURCES += metalrenderer.mm
diff --git a/examples/quick/scenegraph/rendernode/rendernode.qrc b/examples/quick/scenegraph/rendernode/rendernode.qrc
index 5907eab62c..a93fd0270f 100644
--- a/examples/quick/scenegraph/rendernode/rendernode.qrc
+++ b/examples/quick/scenegraph/rendernode/rendernode.qrc
@@ -1,8 +1,6 @@
<RCC>
<qresource prefix="/scenegraph/rendernode">
<file>main.qml</file>
- <file>shader_vert.cso</file>
- <file>shader_frag.cso</file>
<file>metalshader.vert</file>
<file>metalshader.frag</file>
</qresource>
diff --git a/examples/quick/scenegraph/rendernode/shader_frag.cso b/examples/quick/scenegraph/rendernode/shader_frag.cso
deleted file mode 100644
index 686c6af3fc..0000000000
--- a/examples/quick/scenegraph/rendernode/shader_frag.cso
+++ /dev/null
Binary files differ
diff --git a/examples/quick/scenegraph/rendernode/shader_vert.cso b/examples/quick/scenegraph/rendernode/shader_vert.cso
deleted file mode 100644
index fa13be5160..0000000000
--- a/examples/quick/scenegraph/rendernode/shader_vert.cso
+++ /dev/null
Binary files differ
diff --git a/examples/quick/scenegraph/shared/logorenderer.h b/examples/quick/scenegraph/shared/logorenderer.h
index 6e7c4b897f..03821919a9 100644
--- a/examples/quick/scenegraph/shared/logorenderer.h
+++ b/examples/quick/scenegraph/shared/logorenderer.h
@@ -53,8 +53,8 @@
#include <QtGui/qvector3d.h>
#include <QtGui/qmatrix4x4.h>
-#include <QtGui/qopenglshaderprogram.h>
-#include <QtGui/qopenglfunctions.h>
+#include <qopenglshaderprogram.h>
+#include <qopenglfunctions.h>
#include <QTime>
#include <QVector>
diff --git a/examples/quick/scenegraph/textureinthread/threadrenderer.cpp b/examples/quick/scenegraph/textureinthread/threadrenderer.cpp
index c364d0b7dd..5fd8037193 100644
--- a/examples/quick/scenegraph/textureinthread/threadrenderer.cpp
+++ b/examples/quick/scenegraph/textureinthread/threadrenderer.cpp
@@ -54,8 +54,8 @@
#include <QtCore/QMutex>
#include <QtCore/QThread>
-#include <QtGui/QOpenGLContext>
-#include <QtGui/QOpenGLFramebufferObject>
+#include <QOpenGLContext>
+#include <QOpenGLFramebufferObject>
#include <QtGui/QGuiApplication>
#include <QtGui/QOffscreenSurface>
diff --git a/examples/quick/scenegraph/twotextureproviders/xorblender.cpp b/examples/quick/scenegraph/twotextureproviders/xorblender.cpp
index d5881b9adc..667b0bf8c7 100644
--- a/examples/quick/scenegraph/twotextureproviders/xorblender.cpp
+++ b/examples/quick/scenegraph/twotextureproviders/xorblender.cpp
@@ -52,8 +52,8 @@
#include <QtCore/QPointer>
-#include <QtGui/QOpenGLContext>
-#include <QtGui/QOpenGLFunctions>
+#include <QOpenGLContext>
+#include <QOpenGLFunctions>
#include <QtQuick/QSGMaterial>
#include <QtQuick/QSGTexture>
diff --git a/examples/quick/shadereffects/content/shaders/+hlsl/blur.frag b/examples/quick/shadereffects/content/shaders/+hlsl/blur.frag
deleted file mode 100644
index 481a238d2a..0000000000
--- a/examples/quick/shadereffects/content/shaders/+hlsl/blur.frag
+++ /dev/null
@@ -1,18 +0,0 @@
-cbuffer ConstantBuffer : register(b0)
-{
- float4x4 qt_Matrix;
- float qt_Opacity;
- float2 delta;
-};
-
-Texture2D source : register(t0);
-SamplerState sourceSampler : register(s0);
-
-float4 main(float4 position : SV_POSITION, float2 coord : TEXCOORD0) : SV_TARGET
-{
- return (0.0538 * source.Sample(sourceSampler, coord - 3.182 * delta)
- + 0.3229 * source.Sample(sourceSampler, coord - 1.364 * delta)
- + 0.2466 * source.Sample(sourceSampler, coord)
- + 0.3229 * source.Sample(sourceSampler, coord + 1.364 * delta)
- + 0.0538 * source.Sample(sourceSampler, coord + 3.182 * delta)) * qt_Opacity;
-}
diff --git a/examples/quick/shadereffects/content/shaders/+hlsl/colorize.frag b/examples/quick/shadereffects/content/shaders/+hlsl/colorize.frag
deleted file mode 100644
index d6e65b6b10..0000000000
--- a/examples/quick/shadereffects/content/shaders/+hlsl/colorize.frag
+++ /dev/null
@@ -1,17 +0,0 @@
-cbuffer ConstantBuffer : register(b0)
-{
- float4x4 qt_Matrix;
- float qt_Opacity;
- float4 tint;
-};
-
-Texture2D source : register(t0);
-SamplerState sourceSampler : register(s0);
-
-float4 main(float4 position : SV_POSITION, float2 coord : TEXCOORD0) : SV_TARGET
-{
- float4 c = source.Sample(sourceSampler, coord);
- float lo = min(min(c.x, c.y), c.z);
- float hi = max(max(c.x, c.y), c.z);
- return float4(lerp(float3(lo, lo, lo), float3(hi, hi, hi), tint.xyz), c.w) * qt_Opacity;
-}
diff --git a/examples/quick/shadereffects/content/shaders/+hlsl/genie.vert b/examples/quick/shadereffects/content/shaders/+hlsl/genie.vert
deleted file mode 100644
index 40876e7996..0000000000
--- a/examples/quick/shadereffects/content/shaders/+hlsl/genie.vert
+++ /dev/null
@@ -1,31 +0,0 @@
-cbuffer ConstantBuffer : register(b0)
-{
- float4x4 qt_Matrix;
- float qt_Opacity;
- float bend;
- float minimize;
- float side;
- float width;
- float height;
-};
-
-struct PSInput
-{
- float4 position : SV_POSITION;
- float2 coord : TEXCOORD0;
-};
-
-PSInput main(float4 position : POSITION, float2 coord : TEXCOORD0)
-{
- PSInput result;
- result.coord = coord;
-
- float4 pos = position;
- pos.y = lerp(position.y, height, minimize);
- float t = pos.y / height;
- t = (3.0 - 2.0 * t) * t * t;
- pos.x = lerp(position.x, side * width, t * bend);
- result.position = mul(qt_Matrix, pos);
-
- return result;
-}
diff --git a/examples/quick/shadereffects/content/shaders/+hlsl/outline.frag b/examples/quick/shadereffects/content/shaders/+hlsl/outline.frag
deleted file mode 100644
index b6e7e51f35..0000000000
--- a/examples/quick/shadereffects/content/shaders/+hlsl/outline.frag
+++ /dev/null
@@ -1,21 +0,0 @@
-cbuffer ConstantBuffer : register(b0)
-{
- float4x4 qt_Matrix;
- float qt_Opacity;
- float2 delta;
-};
-
-Texture2D source : register(t0);
-SamplerState sourceSampler : register(s0);
-
-float4 main(float4 position : SV_POSITION, float2 coord : TEXCOORD0) : SV_TARGET
-{
- float4 tl = source.Sample(sourceSampler, coord - delta);
- float4 tr = source.Sample(sourceSampler, coord + float2(delta.x, -delta.y));
- float4 bl = source.Sample(sourceSampler, coord - float2(delta.x, -delta.y));
- float4 br = source.Sample(sourceSampler, coord + delta);
- float4 gx = (tl + bl) - (tr + br);
- float4 gy = (tl + tr) - (bl + br);
- return float4(0.0, 0.0, 0.0,
- clamp(dot(sqrt(gx * gx + gy * gy), float4(1.0, 1.0, 1.0, 1.0)), 0.0, 1.0) * qt_Opacity);
-}
diff --git a/examples/quick/shadereffects/content/shaders/+hlsl/shadow.frag b/examples/quick/shadereffects/content/shaders/+hlsl/shadow.frag
deleted file mode 100644
index a86a25e007..0000000000
--- a/examples/quick/shadereffects/content/shaders/+hlsl/shadow.frag
+++ /dev/null
@@ -1,20 +0,0 @@
-cbuffer ConstantBuffer : register(b0)
-{
- float4x4 qt_Matrix;
- float qt_Opacity;
- float2 offset;
- float2 delta;
- float darkness;
-};
-
-Texture2D source : register(t0);
-SamplerState sourceSampler : register(s0);
-Texture2D shadow : register(t1);
-SamplerState shadowSampler : register(s1);
-
-float4 main(float4 position : SV_POSITION, float2 coord : TEXCOORD0) : SV_TARGET
-{
- float4 fg = source.Sample(sourceSampler, coord);
- float4 bg = shadow.Sample(shadowSampler, coord + delta);
- return (fg + float4(0.0, 0.0, 0.0, darkness * bg.a) * (1.0 - fg.a)) * qt_Opacity;
-}
diff --git a/examples/quick/shadereffects/content/shaders/+hlsl/wobble.frag b/examples/quick/shadereffects/content/shaders/+hlsl/wobble.frag
deleted file mode 100644
index c28612a2fd..0000000000
--- a/examples/quick/shadereffects/content/shaders/+hlsl/wobble.frag
+++ /dev/null
@@ -1,17 +0,0 @@
-cbuffer ConstantBuffer : register(b0)
-{
- float4x4 qt_Matrix;
- float qt_Opacity;
- float amplitude;
- float frequency;
- float time;
-};
-
-Texture2D source : register(t0);
-SamplerState sourceSampler : register(s0);
-
-float4 main(float4 position : SV_POSITION, float2 coord : TEXCOORD0) : SV_TARGET
-{
- float2 p = sin(time + frequency * coord);
- return source.Sample(sourceSampler, coord + amplitude * float2(p.y, -p.x)) * qt_Opacity;
-}
diff --git a/examples/quick/shadereffects/doc/src/shadereffects.qdoc b/examples/quick/shadereffects/doc/src/shadereffects.qdoc
index d35989c262..d217c956ad 100644
--- a/examples/quick/shadereffects/doc/src/shadereffects.qdoc
+++ b/examples/quick/shadereffects/doc/src/shadereffects.qdoc
@@ -59,21 +59,6 @@
Direct 3D, or OpenGL. Qt automatically selects the file under the \c qsb
selector, for example \c{shaders/+qsb/wobble.frag}, when present.
- On the traditional code path, which can mean using OpenGL or Direct3D 12,
- file selectors are used to select the correct variant at runtime. Based on
- the Qt Quick backend in use, Qt will automatically select either
- \c{shaders/wobble.frag} with the GLSL source code or
- \c{shaders/+hlsl/wobble.frag} with the HLSL source code.
-
- \note For simplicity shader source code is used in all variants of the
- files. However, with the Direct3D backend of Qt Quick pre-compiled shaders
- are also supported. For example, try the following commands in the
- \c{content/shaders/+hlsl} directory: \c{move wobble.frag wobble.frag.src}
- followed by \c{fxc /E main /T ps_5_0 /Fo wobble.frag wobble.frag.src}. Now
- \c wobble.frag contains Direct3D bytecode and that is what gets shipped
- with the application instead of the shader source. Further changes are not
- necessary, the application will function like before.
-
You can use any custom property on the ShaderEffect in your shader. This
makes animated shader code very easy:
\snippet shadereffects/shadereffects.qml properties
diff --git a/examples/quick/shadereffects/shadereffects.qrc b/examples/quick/shadereffects/shadereffects.qrc
index 762ad0d037..72ad2d9054 100644
--- a/examples/quick/shadereffects/shadereffects.qrc
+++ b/examples/quick/shadereffects/shadereffects.qrc
@@ -5,22 +5,16 @@
<file>content/qt-logo.png</file>
<file>content/Slider.qml</file>
<file>content/shaders/wobble.frag</file>
- <file>content/shaders/+hlsl/wobble.frag</file>
<file>content/shaders/+qsb/wobble.frag</file>
<file>content/shaders/blur.frag</file>
- <file>content/shaders/+hlsl/blur.frag</file>
<file>content/shaders/+qsb/blur.frag</file>
<file>content/shaders/shadow.frag</file>
- <file>content/shaders/+hlsl/shadow.frag</file>
<file>content/shaders/+qsb/shadow.frag</file>
<file>content/shaders/outline.frag</file>
- <file>content/shaders/+hlsl/outline.frag</file>
<file>content/shaders/+qsb/outline.frag</file>
<file>content/shaders/colorize.frag</file>
- <file>content/shaders/+hlsl/colorize.frag</file>
<file>content/shaders/+qsb/colorize.frag</file>
<file>content/shaders/genie.vert</file>
- <file>content/shaders/+hlsl/genie.vert</file>
<file>content/shaders/+qsb/genie.vert</file>
</qresource>
</RCC>
diff --git a/examples/quick/shared/SimpleLauncherDelegate.qml b/examples/quick/shared/SimpleLauncherDelegate.qml
index dd29b8b821..11d34a187e 100644
--- a/examples/quick/shared/SimpleLauncherDelegate.qml
+++ b/examples/quick/shared/SimpleLauncherDelegate.qml
@@ -51,6 +51,9 @@ import QtQuick 2.12
Rectangle {
id: container
+ required property string name
+ required property string description
+
property Item exampleItem
width: ListView.view.width
height: button.implicitHeight + 22
diff --git a/examples/quick/text/doc/src/text.qdoc b/examples/quick/text/doc/src/text.qdoc
index d8bd8d349a..6378e3efe6 100644
--- a/examples/quick/text/doc/src/text.qdoc
+++ b/examples/quick/text/doc/src/text.qdoc
@@ -49,9 +49,6 @@
Simply by name, using the font.family property directly:
\snippet text/fonts/fonts.qml name
- or using a \l FontLoader type:
- \snippet text/fonts/fonts.qml fontloader
-
or using a FontLoader and specifying a local font file:
\snippet text/fonts/fonts.qml fontloaderlocal
diff --git a/examples/quick/text/fonts/fonts.qml b/examples/quick/text/fonts/fonts.qml
index 4478db0135..aeb17c48e2 100644
--- a/examples/quick/text/fonts/fonts.qml
+++ b/examples/quick/text/fonts/fonts.qml
@@ -57,9 +57,6 @@ Rectangle {
width: 320; height: 480
color: "steelblue"
-//! [fontloader]
- FontLoader { id: fixedFont; name: "Courier" }
-//! [fontloader]
//! [fontloaderlocal]
FontLoader { id: localFont; source: "content/fonts/tarzeau_ocr_a.ttf" }
//! [fontloaderlocal]
@@ -95,14 +92,14 @@ Rectangle {
width: parent.width
horizontalAlignment: Text.AlignRight
wrapMode: Text.WordWrap
- font { family: fixedFont.name; pixelSize: 20; weight: Font.Bold; capitalization: Font.AllLowercase }
+ font { family: "Courier"; pixelSize: 20; weight: Font.Bold; capitalization: Font.AllLowercase }
}
Text {
text: root.myText
color: "lightsteelblue"
width: parent.width
wrapMode: Text.WordWrap
- font { family: fixedFont.name; pixelSize: 20; italic: true; capitalization: Font.SmallCaps }
+ font { family: "Courier"; pixelSize: 20; italic: true; capitalization: Font.SmallCaps }
}
Text {
text: root.myText