aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/scenegraph/adaptations/d3d12/qsgd3d12texture_p.h
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@theqtcompany.com>2016-03-03 16:44:20 +0100
committerAndy Nichols <andy.nichols@theqtcompany.com>2016-03-07 16:13:06 +0000
commitc64d60e6946c57733fa03acf3d544f9adb5e05a9 (patch)
tree4d3a3ef3a0f0fada6643fec7bc0ce3c981d0005a /src/quick/scenegraph/adaptations/d3d12/qsgd3d12texture_p.h
parent9f764891c142ddf318fc3fef298686c922fd2cc6 (diff)
D3D12: Basic image support
For now there is no mipmapping, no atlases, and all image data is converted to RGBA8888. Regardless, this already makes it possible to use basic Image elements. Follow the same pattern as with rectangles: most of the code is shared via a material-less, abstract QSGDefaultNoMaterialImageNode, with the material-related bits provided by QSGDefaultImageNode for GL and QSGD3D12ImageNode for D3D. Also fixes the harmless but incorrect miscalculation of the VBV size for indexed draws. Image data is copied into an intermediate upload buffer when invoking the render context's createTexture(). The upload is triggered on a separate copy command queue. The main command queue is synchronized via a fence before executing the commands for the current frame. Root signatures are now cached more cleverly and include zero or more SRVs as parameter 1. This involves the engine having to manage a shader (GPU) visible CBV-SRV-UAV descriptor heap as well. Change-Id: I67c35577ff2677e1c7776dd8e5011860e2d78b00 Reviewed-by: Andy Nichols <andy.nichols@theqtcompany.com>
Diffstat (limited to 'src/quick/scenegraph/adaptations/d3d12/qsgd3d12texture_p.h')
-rw-r--r--src/quick/scenegraph/adaptations/d3d12/qsgd3d12texture_p.h88
1 files changed, 88 insertions, 0 deletions
diff --git a/src/quick/scenegraph/adaptations/d3d12/qsgd3d12texture_p.h b/src/quick/scenegraph/adaptations/d3d12/qsgd3d12texture_p.h
new file mode 100644
index 0000000000..045d003f4a
--- /dev/null
+++ b/src/quick/scenegraph/adaptations/d3d12/qsgd3d12texture_p.h
@@ -0,0 +1,88 @@
+/****************************************************************************
+**
+** 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 QSGD3D12TEXTURE_P_H
+#define QSGD3D12TEXTURE_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 <qsgtexture.h>
+
+QT_BEGIN_NAMESPACE
+
+class QSGD3D12Engine;
+
+class QSGD3D12Texture : public QSGTexture
+{
+public:
+ QSGD3D12Texture(QSGD3D12Engine *engine) : m_engine(engine) { }
+ ~QSGD3D12Texture();
+
+ void setImage(const QImage &image, uint flags);
+
+ int textureId() const override;
+ QSize textureSize() const override;
+ bool hasAlphaChannel() const override;
+ bool hasMipmaps() const override;
+ QRectF normalizedTextureSubRect() const override;
+ bool isAtlasTexture() const override;
+ QSGTexture *removedFromAtlas() const override;
+ void bind() override;
+
+ SIZE_T srv() const;
+
+private:
+ QSGD3D12Engine *m_engine;
+ uint m_id = 0;
+ bool m_alphaWanted = false;
+ QSize m_size;
+};
+
+QT_END_NAMESPACE
+
+#endif