aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/scenegraph/d3d12
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/scenegraph/d3d12')
-rw-r--r--src/plugins/scenegraph/d3d12/d3d12.pro14
-rw-r--r--src/plugins/scenegraph/d3d12/qsgd3d12builtinmaterials.cpp11
-rw-r--r--src/plugins/scenegraph/d3d12/qsgd3d12builtinmaterials_p.h3
-rw-r--r--src/plugins/scenegraph/d3d12/qsgd3d12context.cpp33
-rw-r--r--src/plugins/scenegraph/d3d12/qsgd3d12context_p.h8
-rw-r--r--src/plugins/scenegraph/d3d12/qsgd3d12internalimagenode.cpp (renamed from src/plugins/scenegraph/d3d12/qsgd3d12imagenode.cpp)22
-rw-r--r--src/plugins/scenegraph/d3d12/qsgd3d12internalimagenode_p.h (renamed from src/plugins/scenegraph/d3d12/qsgd3d12imagenode_p.h)12
-rw-r--r--src/plugins/scenegraph/d3d12/qsgd3d12internalrectanglenode.cpp (renamed from src/plugins/scenegraph/d3d12/qsgd3d12rectanglenode.cpp)8
-rw-r--r--src/plugins/scenegraph/d3d12/qsgd3d12internalrectanglenode_p.h (renamed from src/plugins/scenegraph/d3d12/qsgd3d12rectanglenode_p.h)12
-rw-r--r--src/plugins/scenegraph/d3d12/qsgd3d12painternode.cpp3
-rw-r--r--src/plugins/scenegraph/d3d12/qsgd3d12painternode_p.h1
-rw-r--r--src/plugins/scenegraph/d3d12/qsgd3d12publicnodes.cpp240
-rw-r--r--src/plugins/scenegraph/d3d12/qsgd3d12publicnodes_p.h133
13 files changed, 450 insertions, 50 deletions
diff --git a/src/plugins/scenegraph/d3d12/d3d12.pro b/src/plugins/scenegraph/d3d12/d3d12.pro
index 6ba18acf22..c814c11de0 100644
--- a/src/plugins/scenegraph/d3d12/d3d12.pro
+++ b/src/plugins/scenegraph/d3d12/d3d12.pro
@@ -15,16 +15,17 @@ SOURCES += \
$$PWD/qsgd3d12renderer.cpp \
$$PWD/qsgd3d12context.cpp \
$$PWD/qsgd3d12rendercontext.cpp \
- $$PWD/qsgd3d12rectanglenode.cpp \
+ $$PWD/qsgd3d12internalrectanglenode.cpp \
$$PWD/qsgd3d12material.cpp \
$$PWD/qsgd3d12builtinmaterials.cpp \
$$PWD/qsgd3d12texture.cpp \
- $$PWD/qsgd3d12imagenode.cpp \
+ $$PWD/qsgd3d12internalimagenode.cpp \
$$PWD/qsgd3d12glyphnode.cpp \
$$PWD/qsgd3d12glyphcache.cpp \
$$PWD/qsgd3d12layer.cpp \
$$PWD/qsgd3d12shadereffectnode.cpp \
- $$PWD/qsgd3d12painternode.cpp
+ $$PWD/qsgd3d12painternode.cpp \
+ $$PWD/qsgd3d12publicnodes.cpp
NO_PCH_SOURCES += \
$$PWD/qsgd3d12engine.cpp
@@ -37,16 +38,17 @@ HEADERS += \
$$PWD/qsgd3d12rendercontext_p.h \
$$PWD/qsgd3d12engine_p.h \
$$PWD/qsgd3d12engine_p_p.h \
- $$PWD/qsgd3d12rectanglenode_p.h \
+ $$PWD/qsgd3d12internalrectanglenode_p.h \
$$PWD/qsgd3d12material_p.h \
$$PWD/qsgd3d12builtinmaterials_p.h \
$$PWD/qsgd3d12texture_p.h \
- $$PWD/qsgd3d12imagenode_p.h \
+ $$PWD/qsgd3d12internalimagenode_p.h \
$$PWD/qsgd3d12glyphnode_p.h \
$$PWD/qsgd3d12glyphcache_p.h \
$$PWD/qsgd3d12layer_p.h \
$$PWD/qsgd3d12shadereffectnode_p.h \
- $$PWD/qsgd3d12painternode_p.h
+ $$PWD/qsgd3d12painternode_p.h \
+ $$PWD/qsgd3d12publicnodes_p.h
LIBS += -ldxgi -ld3d12 -ld3dcompiler
diff --git a/src/plugins/scenegraph/d3d12/qsgd3d12builtinmaterials.cpp b/src/plugins/scenegraph/d3d12/qsgd3d12builtinmaterials.cpp
index ca92062120..3ff8ce6e53 100644
--- a/src/plugins/scenegraph/d3d12/qsgd3d12builtinmaterials.cpp
+++ b/src/plugins/scenegraph/d3d12/qsgd3d12builtinmaterials.cpp
@@ -148,6 +148,11 @@ QSGD3D12Material::UpdateResults QSGD3D12VertexColorMaterial::updatePipeline(cons
return r;
}
+QSGD3D12FlatColorMaterial::QSGD3D12FlatColorMaterial()
+ : m_color(QColor(255, 255, 255))
+{
+}
+
QSGMaterialType QSGD3D12FlatColorMaterial::mtype;
QSGMaterialType *QSGD3D12FlatColorMaterial::type() const
@@ -353,6 +358,12 @@ QSGD3D12Material::UpdateResults QSGD3D12TextureMaterial::updatePipeline(const QS
return r;
}
+void QSGD3D12TextureMaterial::setTexture(QSGTexture *texture)
+{
+ m_texture = texture;
+ setFlag(Blending, m_texture ? m_texture->hasAlphaChannel() : false);
+}
+
QSGD3D12SmoothTextureMaterial::QSGD3D12SmoothTextureMaterial()
{
setFlag(RequiresFullMatrixExceptTranslate, true);
diff --git a/src/plugins/scenegraph/d3d12/qsgd3d12builtinmaterials_p.h b/src/plugins/scenegraph/d3d12/qsgd3d12builtinmaterials_p.h
index 34ae73d2d6..8e488f8cd1 100644
--- a/src/plugins/scenegraph/d3d12/qsgd3d12builtinmaterials_p.h
+++ b/src/plugins/scenegraph/d3d12/qsgd3d12builtinmaterials_p.h
@@ -80,6 +80,7 @@ private:
class QSGD3D12FlatColorMaterial : public QSGD3D12Material
{
public:
+ QSGD3D12FlatColorMaterial();
QSGMaterialType *type() const override;
int compare(const QSGMaterial *other) const override;
@@ -129,7 +130,7 @@ public:
ExtraState *extraState,
quint8 *constantBuffer) override;
- void setTexture(QSGTexture *texture) { m_texture = texture; }
+ void setTexture(QSGTexture *texture);
QSGTexture *texture() const { return m_texture; }
void setMipmapFiltering(QSGTexture::Filtering filter) { m_mipmap_filtering = filter; }
diff --git a/src/plugins/scenegraph/d3d12/qsgd3d12context.cpp b/src/plugins/scenegraph/d3d12/qsgd3d12context.cpp
index ce44bc7a38..07c9287f80 100644
--- a/src/plugins/scenegraph/d3d12/qsgd3d12context.cpp
+++ b/src/plugins/scenegraph/d3d12/qsgd3d12context.cpp
@@ -39,12 +39,13 @@
#include "qsgd3d12context_p.h"
#include "qsgd3d12rendercontext_p.h"
-#include "qsgd3d12rectanglenode_p.h"
-#include "qsgd3d12imagenode_p.h"
+#include "qsgd3d12internalrectanglenode_p.h"
+#include "qsgd3d12internalimagenode_p.h"
#include "qsgd3d12glyphnode_p.h"
#include "qsgd3d12layer_p.h"
#include "qsgd3d12shadereffectnode_p.h"
#include "qsgd3d12painternode_p.h"
+#include "qsgd3d12publicnodes_p.h"
QT_BEGIN_NAMESPACE
@@ -53,14 +54,14 @@ QSGRenderContext *QSGD3D12Context::createRenderContext()
return new QSGD3D12RenderContext(this);
}
-QSGRectangleNode *QSGD3D12Context::createRectangleNode()
+QSGInternalRectangleNode *QSGD3D12Context::createInternalRectangleNode()
{
- return new QSGD3D12RectangleNode;
+ return new QSGD3D12InternalRectangleNode;
}
-QSGImageNode *QSGD3D12Context::createImageNode()
+QSGInternalImageNode *QSGD3D12Context::createInternalImageNode()
{
- return new QSGD3D12ImageNode;
+ return new QSGD3D12InternalImageNode;
}
QSGPainterNode *QSGD3D12Context::createPainterNode(QQuickPaintedItem *item)
@@ -77,11 +78,6 @@ QSGGlyphNode *QSGD3D12Context::createGlyphNode(QSGRenderContext *renderContext,
return new QSGD3D12GlyphNode(rc);
}
-QSGNinePatchNode *QSGD3D12Context::createNinePatchNode()
-{
- return nullptr;
-}
-
QSGLayer *QSGD3D12Context::createLayer(QSGRenderContext *renderContext)
{
QSGD3D12RenderContext *rc = static_cast<QSGD3D12RenderContext *>(renderContext);
@@ -121,4 +117,19 @@ QSGRendererInterface *QSGD3D12Context::rendererInterface(QSGRenderContext *rende
return rc->engine();
}
+QSGRectangleNode *QSGD3D12Context::createRectangleNode()
+{
+ return new QSGD3D12RectangleNode;
+}
+
+QSGImageNode *QSGD3D12Context::createImageNode()
+{
+ return new QSGD3D12ImageNode;
+}
+
+QSGNinePatchNode *QSGD3D12Context::createNinePatchNode()
+{
+ return new QSGD3D12NinePatchNode;
+}
+
QT_END_NAMESPACE
diff --git a/src/plugins/scenegraph/d3d12/qsgd3d12context_p.h b/src/plugins/scenegraph/d3d12/qsgd3d12context_p.h
index 0564c4edac..f4d9429c7b 100644
--- a/src/plugins/scenegraph/d3d12/qsgd3d12context_p.h
+++ b/src/plugins/scenegraph/d3d12/qsgd3d12context_p.h
@@ -61,11 +61,10 @@ public:
QSGD3D12Context(QObject *parent = 0) : QSGContext(parent) { }
QSGRenderContext *createRenderContext() override;
- QSGRectangleNode *createRectangleNode() override;
- QSGImageNode *createImageNode() override;
+ QSGInternalRectangleNode *createInternalRectangleNode() override;
+ QSGInternalImageNode *createInternalImageNode() override;
QSGPainterNode *createPainterNode(QQuickPaintedItem *item) override;
QSGGlyphNode *createGlyphNode(QSGRenderContext *renderContext, bool preferNativeGlyphNode) override;
- QSGNinePatchNode *createNinePatchNode() override;
QSGLayer *createLayer(QSGRenderContext *renderContext) override;
QSGGuiThreadShaderEffectManager *createGuiThreadShaderEffectManager() override;
QSGShaderEffectNode *createShaderEffectNode(QSGRenderContext *renderContext,
@@ -73,6 +72,9 @@ public:
QSize minimumFBOSize() const override;
QSurfaceFormat defaultSurfaceFormat() const override;
QSGRendererInterface *rendererInterface(QSGRenderContext *renderContext) override;
+ QSGRectangleNode *createRectangleNode() override;
+ QSGImageNode *createImageNode() override;
+ QSGNinePatchNode *createNinePatchNode() override;
};
QT_END_NAMESPACE
diff --git a/src/plugins/scenegraph/d3d12/qsgd3d12imagenode.cpp b/src/plugins/scenegraph/d3d12/qsgd3d12internalimagenode.cpp
index 9bb360bc5e..aa163cacbf 100644
--- a/src/plugins/scenegraph/d3d12/qsgd3d12imagenode.cpp
+++ b/src/plugins/scenegraph/d3d12/qsgd3d12internalimagenode.cpp
@@ -37,16 +37,16 @@
**
****************************************************************************/
-#include "qsgd3d12imagenode_p.h"
+#include "qsgd3d12internalimagenode_p.h"
QT_BEGIN_NAMESPACE
-QSGD3D12ImageNode::QSGD3D12ImageNode()
+QSGD3D12InternalImageNode::QSGD3D12InternalImageNode()
{
setMaterial(&m_material);
}
-void QSGD3D12ImageNode::setFiltering(QSGTexture::Filtering filtering)
+void QSGD3D12InternalImageNode::setFiltering(QSGTexture::Filtering filtering)
{
if (m_material.filtering() == filtering)
return;
@@ -56,7 +56,7 @@ void QSGD3D12ImageNode::setFiltering(QSGTexture::Filtering filtering)
markDirty(DirtyMaterial);
}
-void QSGD3D12ImageNode::setMipmapFiltering(QSGTexture::Filtering filtering)
+void QSGD3D12InternalImageNode::setMipmapFiltering(QSGTexture::Filtering filtering)
{
if (m_material.mipmapFiltering() == filtering)
return;
@@ -66,7 +66,7 @@ void QSGD3D12ImageNode::setMipmapFiltering(QSGTexture::Filtering filtering)
markDirty(DirtyMaterial);
}
-void QSGD3D12ImageNode::setVerticalWrapMode(QSGTexture::WrapMode wrapMode)
+void QSGD3D12InternalImageNode::setVerticalWrapMode(QSGTexture::WrapMode wrapMode)
{
if (m_material.verticalWrapMode() == wrapMode)
return;
@@ -76,7 +76,7 @@ void QSGD3D12ImageNode::setVerticalWrapMode(QSGTexture::WrapMode wrapMode)
markDirty(DirtyMaterial);
}
-void QSGD3D12ImageNode::setHorizontalWrapMode(QSGTexture::WrapMode wrapMode)
+void QSGD3D12InternalImageNode::setHorizontalWrapMode(QSGTexture::WrapMode wrapMode)
{
if (m_material.horizontalWrapMode() == wrapMode)
return;
@@ -86,7 +86,7 @@ void QSGD3D12ImageNode::setHorizontalWrapMode(QSGTexture::WrapMode wrapMode)
markDirty(DirtyMaterial);
}
-void QSGD3D12ImageNode::updateMaterialAntialiasing()
+void QSGD3D12InternalImageNode::updateMaterialAntialiasing()
{
if (m_antialiasing)
setMaterial(&m_smoothMaterial);
@@ -94,18 +94,18 @@ void QSGD3D12ImageNode::updateMaterialAntialiasing()
setMaterial(&m_material);
}
-void QSGD3D12ImageNode::setMaterialTexture(QSGTexture *texture)
+void QSGD3D12InternalImageNode::setMaterialTexture(QSGTexture *texture)
{
m_material.setTexture(texture);
m_smoothMaterial.setTexture(texture);
}
-QSGTexture *QSGD3D12ImageNode::materialTexture() const
+QSGTexture *QSGD3D12InternalImageNode::materialTexture() const
{
return m_material.texture();
}
-bool QSGD3D12ImageNode::updateMaterialBlending()
+bool QSGD3D12InternalImageNode::updateMaterialBlending()
{
const bool alpha = m_material.flags() & QSGMaterial::Blending;
if (materialTexture() && alpha != materialTexture()->hasAlphaChannel()) {
@@ -115,7 +115,7 @@ bool QSGD3D12ImageNode::updateMaterialBlending()
return false;
}
-bool QSGD3D12ImageNode::supportsWrap(const QSize &) const
+bool QSGD3D12InternalImageNode::supportsWrap(const QSize &) const
{
return true;
}
diff --git a/src/plugins/scenegraph/d3d12/qsgd3d12imagenode_p.h b/src/plugins/scenegraph/d3d12/qsgd3d12internalimagenode_p.h
index ef4b38884a..26284740ee 100644
--- a/src/plugins/scenegraph/d3d12/qsgd3d12imagenode_p.h
+++ b/src/plugins/scenegraph/d3d12/qsgd3d12internalimagenode_p.h
@@ -37,8 +37,8 @@
**
****************************************************************************/
-#ifndef QSGD3D12IMAGENODE_P_H
-#define QSGD3D12IMAGENODE_P_H
+#ifndef QSGD3D12INTERNALIMAGENODE_P_H
+#define QSGD3D12INTERNALIMAGENODE_P_H
//
// W A R N I N G
@@ -51,15 +51,15 @@
// We mean it.
//
-#include <private/qsgbasicimagenode_p.h>
+#include <private/qsgbasicinternalimagenode_p.h>
#include "qsgd3d12builtinmaterials_p.h"
QT_BEGIN_NAMESPACE
-class QSGD3D12ImageNode : public QSGBasicImageNode
+class QSGD3D12InternalImageNode : public QSGBasicInternalImageNode
{
public:
- QSGD3D12ImageNode();
+ QSGD3D12InternalImageNode();
void setMipmapFiltering(QSGTexture::Filtering filtering) override;
void setFiltering(QSGTexture::Filtering filtering) override;
@@ -79,4 +79,4 @@ private:
QT_END_NAMESPACE
-#endif // QSGD3D12IMAGENODE_P_H
+#endif // QSGD3D12INTERNALIMAGENODE_P_H
diff --git a/src/plugins/scenegraph/d3d12/qsgd3d12rectanglenode.cpp b/src/plugins/scenegraph/d3d12/qsgd3d12internalrectanglenode.cpp
index 7548f5cbc0..2d9c5b55d1 100644
--- a/src/plugins/scenegraph/d3d12/qsgd3d12rectanglenode.cpp
+++ b/src/plugins/scenegraph/d3d12/qsgd3d12internalrectanglenode.cpp
@@ -37,16 +37,16 @@
**
****************************************************************************/
-#include "qsgd3d12rectanglenode_p.h"
+#include "qsgd3d12internalrectanglenode_p.h"
QT_BEGIN_NAMESPACE
-QSGD3D12RectangleNode::QSGD3D12RectangleNode()
+QSGD3D12InternalRectangleNode::QSGD3D12InternalRectangleNode()
{
setMaterial(&m_material);
}
-void QSGD3D12RectangleNode::updateMaterialAntialiasing()
+void QSGD3D12InternalRectangleNode::updateMaterialAntialiasing()
{
if (m_antialiasing)
setMaterial(&m_smoothMaterial);
@@ -54,7 +54,7 @@ void QSGD3D12RectangleNode::updateMaterialAntialiasing()
setMaterial(&m_material);
}
-void QSGD3D12RectangleNode::updateMaterialBlending(QSGNode::DirtyState *state)
+void QSGD3D12InternalRectangleNode::updateMaterialBlending(QSGNode::DirtyState *state)
{
// smoothed material is always blended, so no change in material state
if (material() == &m_material) {
diff --git a/src/plugins/scenegraph/d3d12/qsgd3d12rectanglenode_p.h b/src/plugins/scenegraph/d3d12/qsgd3d12internalrectanglenode_p.h
index 95f734bc4c..2fc3c69285 100644
--- a/src/plugins/scenegraph/d3d12/qsgd3d12rectanglenode_p.h
+++ b/src/plugins/scenegraph/d3d12/qsgd3d12internalrectanglenode_p.h
@@ -37,8 +37,8 @@
**
****************************************************************************/
-#ifndef QSGD3D12RECTANGLENODE_P_H
-#define QSGD3D12RECTANGLENODE_P_H
+#ifndef QSGD3D12INTERNALRECTANGLENODE_P_H
+#define QSGD3D12INTERNALRECTANGLENODE_P_H
//
// W A R N I N G
@@ -51,15 +51,15 @@
// We mean it.
//
-#include <private/qsgbasicrectanglenode_p.h>
+#include <private/qsgbasicinternalrectanglenode_p.h>
#include "qsgd3d12builtinmaterials_p.h"
QT_BEGIN_NAMESPACE
-class QSGD3D12RectangleNode : public QSGBasicRectangleNode
+class QSGD3D12InternalRectangleNode : public QSGBasicInternalRectangleNode
{
public:
- QSGD3D12RectangleNode();
+ QSGD3D12InternalRectangleNode();
private:
void updateMaterialAntialiasing() override;
@@ -71,4 +71,4 @@ private:
QT_END_NAMESPACE
-#endif // QSGD3D12RECTANGLENODE_P_H
+#endif // QSGD3D12INTERNALRECTANGLENODE_P_H
diff --git a/src/plugins/scenegraph/d3d12/qsgd3d12painternode.cpp b/src/plugins/scenegraph/d3d12/qsgd3d12painternode.cpp
index 7837c3a2d3..b22c42f2e5 100644
--- a/src/plugins/scenegraph/d3d12/qsgd3d12painternode.cpp
+++ b/src/plugins/scenegraph/d3d12/qsgd3d12painternode.cpp
@@ -84,10 +84,9 @@ QSGD3D12PainterNode::QSGD3D12PainterNode(QQuickPaintedItem *item)
m_dirtyGeometry(false),
m_dirtyContents(false)
{
- m_material.setFlag(QSGMaterial::Blending);
+ setGeometry(&m_geometry);
m_material.setTexture(m_texture);
setMaterial(&m_material);
- setGeometry(&m_geometry);
}
QSGD3D12PainterNode::~QSGD3D12PainterNode()
diff --git a/src/plugins/scenegraph/d3d12/qsgd3d12painternode_p.h b/src/plugins/scenegraph/d3d12/qsgd3d12painternode_p.h
index 67246cc3cd..7f4842b3a6 100644
--- a/src/plugins/scenegraph/d3d12/qsgd3d12painternode_p.h
+++ b/src/plugins/scenegraph/d3d12/qsgd3d12painternode_p.h
@@ -65,6 +65,7 @@ public:
QSGD3D12PainterTexture(QSGD3D12Engine *engine);
void bind() override;
+ bool hasAlphaChannel() const override { return true; }
QImage *image() { return &m_image; }
diff --git a/src/plugins/scenegraph/d3d12/qsgd3d12publicnodes.cpp b/src/plugins/scenegraph/d3d12/qsgd3d12publicnodes.cpp
new file mode 100644
index 0000000000..de9869aee8
--- /dev/null
+++ b/src/plugins/scenegraph/d3d12/qsgd3d12publicnodes.cpp
@@ -0,0 +1,240 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the QtQuick module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** 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.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qsgd3d12publicnodes_p.h"
+
+// for rebuildGeometry
+#include <private/qsgdefaultninepatchnode_p.h>
+#include <private/qsgdefaultimagenode_p.h>
+
+QT_BEGIN_NAMESPACE
+
+QSGD3D12RectangleNode::QSGD3D12RectangleNode()
+ : m_geometry(QSGGeometry::defaultAttributes_Point2D(), 4)
+{
+ QSGGeometry::updateRectGeometry(&m_geometry, QRectF());
+ setMaterial(&m_material);
+ setGeometry(&m_geometry);
+#ifdef QSG_RUNTIME_DESCRIPTION
+ qsgnode_set_description(this, QLatin1String("rectangle"));
+#endif
+}
+
+void QSGD3D12RectangleNode::setRect(const QRectF &rect)
+{
+ QSGGeometry::updateRectGeometry(&m_geometry, rect);
+ markDirty(QSGNode::DirtyGeometry);
+}
+
+QRectF QSGD3D12RectangleNode::rect() const
+{
+ const QSGGeometry::Point2D *pts = m_geometry.vertexDataAsPoint2D();
+ return QRectF(pts[0].x,
+ pts[0].y,
+ pts[3].x - pts[0].x,
+ pts[3].y - pts[0].y);
+}
+
+void QSGD3D12RectangleNode::setColor(const QColor &color)
+{
+ if (color != m_material.color()) {
+ m_material.setColor(color);
+ markDirty(QSGNode::DirtyMaterial);
+ }
+}
+
+QColor QSGD3D12RectangleNode::color() const
+{
+ return m_material.color();
+}
+
+QSGD3D12ImageNode::QSGD3D12ImageNode()
+ : m_geometry(QSGGeometry::defaultAttributes_TexturedPoint2D(), 4),
+ m_texCoordMode(QSGD3D12ImageNode::NoTransform),
+ m_isAtlasTexture(false),
+ m_ownsTexture(false)
+{
+ setGeometry(&m_geometry);
+ setMaterial(&m_material);
+ m_material.setMipmapFiltering(QSGTexture::None);
+#ifdef QSG_RUNTIME_DESCRIPTION
+ qsgnode_set_description(this, QLatin1String("image"));
+#endif
+}
+
+QSGD3D12ImageNode::~QSGD3D12ImageNode()
+{
+ if (m_ownsTexture)
+ delete m_material.texture();
+}
+
+void QSGD3D12ImageNode::setFiltering(QSGTexture::Filtering filtering)
+{
+ if (m_material.filtering() == filtering)
+ return;
+
+ m_material.setFiltering(filtering);
+ markDirty(DirtyMaterial);
+}
+
+QSGTexture::Filtering QSGD3D12ImageNode::filtering() const
+{
+ return m_material.filtering();
+}
+
+void QSGD3D12ImageNode::setRect(const QRectF &r)
+{
+ if (m_rect == r)
+ return;
+
+ m_rect = r;
+ QSGDefaultImageNode::rebuildGeometry(&m_geometry, texture(), m_rect, m_sourceRect, m_texCoordMode);
+ markDirty(DirtyGeometry);
+}
+
+QRectF QSGD3D12ImageNode::rect() const
+{
+ return m_rect;
+}
+
+void QSGD3D12ImageNode::setSourceRect(const QRectF &r)
+{
+ if (m_sourceRect == r)
+ return;
+
+ m_sourceRect = r;
+ QSGDefaultImageNode::rebuildGeometry(&m_geometry, texture(), m_rect, m_sourceRect, m_texCoordMode);
+ markDirty(DirtyGeometry);
+}
+
+QRectF QSGD3D12ImageNode::sourceRect() const
+{
+ return m_sourceRect;
+}
+
+void QSGD3D12ImageNode::setTexture(QSGTexture *texture)
+{
+ Q_ASSERT(texture);
+
+ if (m_ownsTexture)
+ delete m_material.texture();
+
+ m_material.setTexture(texture);
+ QSGDefaultImageNode::rebuildGeometry(&m_geometry, texture, m_rect, m_sourceRect, m_texCoordMode);
+
+ DirtyState dirty = DirtyMaterial;
+ const bool wasAtlas = m_isAtlasTexture;
+ m_isAtlasTexture = texture->isAtlasTexture();
+ if (wasAtlas || m_isAtlasTexture)
+ dirty |= DirtyGeometry;
+
+ markDirty(dirty);
+}
+
+QSGTexture *QSGD3D12ImageNode::texture() const
+{
+ return m_material.texture();
+}
+
+void QSGD3D12ImageNode::setTextureCoordinatesTransform(TextureCoordinatesTransformMode mode)
+{
+ if (m_texCoordMode == mode)
+ return;
+
+ m_texCoordMode = mode;
+ QSGDefaultImageNode::rebuildGeometry(&m_geometry, texture(), m_rect, m_sourceRect, m_texCoordMode);
+ markDirty(DirtyMaterial);
+}
+
+QSGD3D12ImageNode::TextureCoordinatesTransformMode QSGD3D12ImageNode::textureCoordinatesTransform() const
+{
+ return m_texCoordMode;
+}
+
+void QSGD3D12ImageNode::setOwnsTexture(bool owns)
+{
+ m_ownsTexture = owns;
+}
+
+bool QSGD3D12ImageNode::ownsTexture() const
+{
+ return m_ownsTexture;
+}
+
+QSGD3D12NinePatchNode::QSGD3D12NinePatchNode()
+ : m_geometry(QSGGeometry::defaultAttributes_TexturedPoint2D(), 4)
+{
+ m_geometry.setDrawingMode(QSGGeometry::DrawTriangleStrip);
+ setGeometry(&m_geometry);
+ setMaterial(&m_material);
+}
+
+QSGD3D12NinePatchNode::~QSGD3D12NinePatchNode()
+{
+ delete m_material.texture();
+}
+
+void QSGD3D12NinePatchNode::setTexture(QSGTexture *texture)
+{
+ delete m_material.texture();
+ m_material.setTexture(texture);
+}
+
+void QSGD3D12NinePatchNode::setBounds(const QRectF &bounds)
+{
+ m_bounds = bounds;
+}
+
+void QSGD3D12NinePatchNode::setDevicePixelRatio(qreal ratio)
+{
+ m_devicePixelRatio = ratio;
+}
+
+void QSGD3D12NinePatchNode::setPadding(qreal left, qreal top, qreal right, qreal bottom)
+{
+ m_padding = QVector4D(left, top, right, bottom);
+}
+
+void QSGD3D12NinePatchNode::update()
+{
+ QSGDefaultNinePatchNode::rebuildGeometry(m_material.texture(), &m_geometry, m_padding, m_bounds, m_devicePixelRatio);
+ markDirty(QSGNode::DirtyGeometry | QSGNode::DirtyMaterial);
+}
+
+QT_END_NAMESPACE
diff --git a/src/plugins/scenegraph/d3d12/qsgd3d12publicnodes_p.h b/src/plugins/scenegraph/d3d12/qsgd3d12publicnodes_p.h
new file mode 100644
index 0000000000..14e34bc0ac
--- /dev/null
+++ b/src/plugins/scenegraph/d3d12/qsgd3d12publicnodes_p.h
@@ -0,0 +1,133 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the QtQuick module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** 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.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QSGD3D12PUBLICNODES_P_H
+#define QSGD3D12PUBLICNODES_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtQuick/qsgrectanglenode.h>
+#include <QtQuick/qsgimagenode.h>
+#include <QtQuick/qsgninepatchnode.h>
+#include "qsgd3d12builtinmaterials_p.h"
+
+QT_BEGIN_NAMESPACE
+
+class QSGD3D12RectangleNode : public QSGRectangleNode
+{
+public:
+ QSGD3D12RectangleNode();
+
+ void setRect(const QRectF &rect) override;
+ QRectF rect() const override;
+
+ void setColor(const QColor &color) override;
+ QColor color() const override;
+
+private:
+ QSGGeometry m_geometry;
+ QSGD3D12FlatColorMaterial m_material;
+};
+
+class QSGD3D12ImageNode : public QSGImageNode
+{
+public:
+ QSGD3D12ImageNode();
+ ~QSGD3D12ImageNode();
+
+ void setRect(const QRectF &rect) override;
+ QRectF rect() const override;
+
+ void setSourceRect(const QRectF &r) override;
+ QRectF sourceRect() const override;
+
+ void setTexture(QSGTexture *texture) override;
+ QSGTexture *texture() const override;
+
+ void setFiltering(QSGTexture::Filtering filtering) override;
+ QSGTexture::Filtering filtering() const override;
+
+ void setTextureCoordinatesTransform(TextureCoordinatesTransformMode mode) override;
+ TextureCoordinatesTransformMode textureCoordinatesTransform() const override;
+
+ void setOwnsTexture(bool owns) override;
+ bool ownsTexture() const override;
+
+private:
+ QSGGeometry m_geometry;
+ QSGD3D12TextureMaterial m_material;
+ QRectF m_rect;
+ QRectF m_sourceRect;
+ TextureCoordinatesTransformMode m_texCoordMode;
+ uint m_isAtlasTexture : 1;
+ uint m_ownsTexture : 1;
+};
+
+class QSGD3D12NinePatchNode : public QSGNinePatchNode
+{
+public:
+ QSGD3D12NinePatchNode();
+ ~QSGD3D12NinePatchNode();
+
+ void setTexture(QSGTexture *texture) override;
+ void setBounds(const QRectF &bounds) override;
+ void setDevicePixelRatio(qreal ratio) override;
+ void setPadding(qreal left, qreal top, qreal right, qreal bottom) override;
+ void update() override;
+
+private:
+ QSGGeometry m_geometry;
+ QSGD3D12TextureMaterial m_material;
+ QRectF m_bounds;
+ qreal m_devicePixelRatio;
+ QVector4D m_padding;
+};
+
+QT_END_NAMESPACE
+
+#endif