aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/scenegraph/d3d12/qsgd3d12shadereffectnode_p.h
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@theqtcompany.com>2016-04-20 12:36:15 +0200
committerLaszlo Agocs <laszlo.agocs@theqtcompany.com>2016-04-29 09:36:33 +0000
commite88e2940598086b57e6c844afa2eca4153d0f528 (patch)
tree54dc790adf9b8b384cb7067cce848c32dd58057f /src/plugins/scenegraph/d3d12/qsgd3d12shadereffectnode_p.h
parente4d56b01b30ad6c8482dab3dab6600676a9d6632 (diff)
Adaptable shader effect enablers
The D3D12 node implementation is mostly missing. The rest of the enablers should be in place now however. Importing QtQuick 2.8 provides new properties for ShaderEffect: - shaderType can be used to decide which language should be used - shaderCompilationType tells if compilation is runtime or offline - shaderSourceType tells if the vertex/fragmentShader properties refer to source strings or source files or pre-compiled bytecode files The last two are bitmasks. In practice however we will support only one approach per backend for now (runtime + source string for OpenGL, offline + bytecode for D3D12). In addition to QSGShaderEffectNode, introduce the QSGGuiThreadShaderEffectManager interface. This provides the gui thread bits for the above and performs shader reflection. Backends that use the new ShaderEffect system must provide both. For each ShaderEffect item there will be a manager (on the gui thread) and a node (on the render thread). Reflection is expected to be done via standard helper libs (d3d12shader + D3DReflect from d3dcompiler for the D3D12 backend), or via manually inspecting SPIR-V, or parsing the source (like the GL path does now), or by using some 3rd party library (not recommended). In any case we require that reflection is doable on the gui thread without dependencies to the actual graphics API. The ShaderEffect documentation is greatly extended, covering HLSL and the new properties. The test app uses manually compiled shaders on its HLSL path for now. This is because there is no story yet for build system integration for public use (the internal HLSL -> bytecode in C header rule is only suitable for the d3d12 plugin itself, apps need something different). Change-Id: Id112104906fbcb26b9902a35f19d8d509b340d1b Reviewed-by: Andy Nichols <andy.nichols@qt.io>
Diffstat (limited to 'src/plugins/scenegraph/d3d12/qsgd3d12shadereffectnode_p.h')
-rw-r--r--src/plugins/scenegraph/d3d12/qsgd3d12shadereffectnode_p.h92
1 files changed, 92 insertions, 0 deletions
diff --git a/src/plugins/scenegraph/d3d12/qsgd3d12shadereffectnode_p.h b/src/plugins/scenegraph/d3d12/qsgd3d12shadereffectnode_p.h
new file mode 100644
index 0000000000..f88e028b35
--- /dev/null
+++ b/src/plugins/scenegraph/d3d12/qsgd3d12shadereffectnode_p.h
@@ -0,0 +1,92 @@
+/****************************************************************************
+**
+** 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 QSGD3D12SHADEREFFECTNODE_P_H
+#define QSGD3D12SHADEREFFECTNODE_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 <private/qsgadaptationlayer_p.h>
+#include "qsgd3d12builtinmaterials_p.h"
+
+QT_BEGIN_NAMESPACE
+
+class QSGD3D12RenderContext;
+class QSGD3D12GuiThreadShaderEffectManager;
+
+class QSGD3D12ShaderEffectNode : public QSGShaderEffectNode
+{
+public:
+ QSGD3D12ShaderEffectNode(QSGD3D12RenderContext *rc, QSGD3D12GuiThreadShaderEffectManager *mgr);
+
+ QRectF normalizedTextureSubRect() const override;
+ void sync(SyncData *syncData) override;
+
+private:
+ QSGD3D12RenderContext *m_rc;
+ QSGD3D12GuiThreadShaderEffectManager *m_mgr;
+};
+
+class QSGD3D12GuiThreadShaderEffectManager : public QSGGuiThreadShaderEffectManager
+{
+public:
+ ShaderType shaderType() const override;
+ int shaderCompilationType() const override;
+ int shaderSourceType() const override;
+
+ bool hasSeparateSamplerAndTextureObjects() const override;
+
+ QString log() const override;
+ Status status() const override;
+
+ bool reflect(const QByteArray &src, ShaderInfo *result) override;
+};
+
+QT_END_NAMESPACE
+
+#endif // QSGD3D12SHADEREFFECTNODE_P_H