Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/quick/scenegraph/coreapi/qsgrendererinterface.cpp |
Source code | Switch to Preprocessed file |
Line | Source | Count |
---|---|---|
1 | /**************************************************************************** | - |
2 | ** | - |
3 | ** Copyright (C) 2016 The Qt Company Ltd. | - |
4 | ** Contact: https://www.qt.io/licensing/ | - |
5 | ** | - |
6 | ** This file is part of the QtQuick module of the Qt Toolkit. | - |
7 | ** | - |
8 | ** $QT_BEGIN_LICENSE:LGPL$ | - |
9 | ** Commercial License Usage | - |
10 | ** Licensees holding valid commercial Qt licenses may use this file in | - |
11 | ** accordance with the commercial license agreement provided with the | - |
12 | ** Software or, alternatively, in accordance with the terms contained in | - |
13 | ** a written agreement between you and The Qt Company. For licensing terms | - |
14 | ** and conditions see https://www.qt.io/terms-conditions. For further | - |
15 | ** information use the contact form at https://www.qt.io/contact-us. | - |
16 | ** | - |
17 | ** GNU Lesser General Public License Usage | - |
18 | ** Alternatively, this file may be used under the terms of the GNU Lesser | - |
19 | ** General Public License version 3 as published by the Free Software | - |
20 | ** Foundation and appearing in the file LICENSE.LGPL3 included in the | - |
21 | ** packaging of this file. Please review the following information to | - |
22 | ** ensure the GNU Lesser General Public License version 3 requirements | - |
23 | ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. | - |
24 | ** | - |
25 | ** GNU General Public License Usage | - |
26 | ** Alternatively, this file may be used under the terms of the GNU | - |
27 | ** General Public License version 2.0 or (at your option) the GNU General | - |
28 | ** Public license version 3 or any later version approved by the KDE Free | - |
29 | ** Qt Foundation. The licenses are as published by the Free Software | - |
30 | ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 | - |
31 | ** included in the packaging of this file. Please review the following | - |
32 | ** information to ensure the GNU General Public License requirements will | - |
33 | ** be met: https://www.gnu.org/licenses/gpl-2.0.html and | - |
34 | ** https://www.gnu.org/licenses/gpl-3.0.html. | - |
35 | ** | - |
36 | ** $QT_END_LICENSE$ | - |
37 | ** | - |
38 | ****************************************************************************/ | - |
39 | - | |
40 | #include "qsgrendererinterface.h" | - |
41 | - | |
42 | QT_BEGIN_NAMESPACE | - |
43 | - | |
44 | /*! | - |
45 | \class QSGRendererInterface | - |
46 | \brief An interface providing access to some of the graphics API specific internals | - |
47 | of the scenegraph. | - |
48 | \inmodule QtQuick | - |
49 | \since 5.8 | - |
50 | - | |
51 | Renderer interfaces allow accessing graphics API specific functionality in | - |
52 | the scenegraph. Such internals are not typically exposed. However, when | - |
53 | integrating custom rendering via QSGRenderNode for example, it may become | - |
54 | necessary to query certain values, for instance the graphics device (e.g. | - |
55 | the Direct3D or Vulkan device) that is used by the scenegraph. | - |
56 | - | |
57 | QSGRendererInterface's functions have varying availability. API and | - |
58 | language queries, like graphicsApi() or shaderType() are always available, | - |
59 | meaning it is sufficient to construct a QQuickWindow or QQuickView, and the | - |
60 | graphics API or shading language in use can be queried right after via | - |
61 | QQuickWindow::rendererInterface(). This guarantees that utilities like the | - |
62 | GraphicsInfo QML type are able to report the correct values as early as | - |
63 | possible, without having conditional property values - depending on for | - |
64 | instance shaderType() - evaluate to unexpected values. | - |
65 | - | |
66 | Engine-specific accessors, like getResource(), are however available only | - |
67 | after the scenegraph is initialized. Additionally, there may be | - |
68 | backend-specific limitations on when such functions can be called. The only | - |
69 | way that is guaranteed to succeed is calling them when the rendering of a | - |
70 | node (i.e. the preparation of the command list for the next frame) is | - |
71 | active. In practice this typically means QSGRenderNode::render(). | - |
72 | */ | - |
73 | - | |
74 | /*! | - |
75 | \enum QSGRendererInterface::GraphicsApi | - |
76 | \value Unknown An unknown graphics API is in use | - |
77 | \value Software The Qt Quick 2D Renderer is in use | - |
78 | \value OpenGL OpenGL ES 2.0 or higher | - |
79 | \value Direct3D12 Direct3D 12 | - |
80 | \value OpenVG OpenVG via EGL | - |
81 | */ | - |
82 | - | |
83 | /*! | - |
84 | \enum QSGRendererInterface::Resource | - |
85 | \value DeviceResource The graphics device, when applicable. | - |
86 | \value CommandQueueResource The graphics command queue used by the scenegraph, when applicable. | - |
87 | \value CommandListResource The command list or buffer used by the scenegraph, when applicable. | - |
88 | \value PainterResource The active QPainter used by the scenegraph, when running with the software backend. | - |
89 | */ | - |
90 | - | |
91 | /*! | - |
92 | \enum QSGRendererInterface::ShaderType | - |
93 | \value UnknownShadingLanguage Not yet known due to no window and scenegraph associated | - |
94 | \value GLSL GLSL or GLSL ES | - |
95 | \value HLSL HLSL | - |
96 | */ | - |
97 | - | |
98 | /*! | - |
99 | \enum QSGRendererInterface::ShaderCompilationType | - |
100 | \value RuntimeCompilation Runtime compilation of shader source code is supported | - |
101 | \value OfflineCompilation Pre-compiled bytecode supported | - |
102 | */ | - |
103 | - | |
104 | /*! | - |
105 | \enum QSGRendererInterface::ShaderSourceType | - |
106 | - | |
107 | \value ShaderSourceString Shader source can be provided as a string in | - |
108 | the corresponding properties of ShaderEffect | - |
109 | - | |
110 | \value ShaderSourceFile Local or resource files containing shader source | - |
111 | code are supported | - |
112 | - | |
113 | \value ShaderByteCode Local or resource files containing shader bytecode are | - |
114 | supported | - |
115 | */ | - |
116 | - | |
117 | QSGRendererInterface::~QSGRendererInterface() | - |
118 | { | - |
119 | } | - |
120 | - | |
121 | /*! | - |
122 | \fn QSGRendererInterface::GraphicsApi QSGRendererInterface::graphicsApi() const | - |
123 | - | |
124 | Returns the graphics API that is in use by the Qt Quick scenegraph. | - |
125 | - | |
126 | \note This function can be called on any thread. | - |
127 | */ | - |
128 | - | |
129 | /*! | - |
130 | Queries a graphics \a resource in \a window. Returns null when the resource in question is | - |
131 | not supported or not available. | - |
132 | - | |
133 | When successful, the returned pointer is either a direct pointer to an | - |
134 | interface (and can be cast, for example, to \c{ID3D12Device *}) or a | - |
135 | pointer to an opaque handle that needs to be dereferenced first (for | - |
136 | example, \c{VkDevice dev = *static_cast<VkDevice *>(result)}). The latter | - |
137 | is necessary since such handles may have sizes different from a pointer. | - |
138 | - | |
139 | \note The ownership of the returned pointer is never transferred to the caller. | - |
140 | - | |
141 | \note This function must only be called on the render thread. | - |
142 | */ | - |
143 | void *QSGRendererInterface::getResource(QQuickWindow *window, Resource resource) const | - |
144 | { | - |
145 | Q_UNUSED(window); | - |
146 | Q_UNUSED(resource); | - |
147 | return nullptr; never executed: return nullptr; | 0 |
148 | } | - |
149 | - | |
150 | /*! | - |
151 | Queries a graphics resource. \a resource is a backend-specific key. This | - |
152 | allows supporting any future resources that are not listed in the | - |
153 | Resource enum. | - |
154 | - | |
155 | \note The ownership of the returned pointer is never transferred to the caller. | - |
156 | - | |
157 | \note This function must only be called on the render thread. | - |
158 | */ | - |
159 | void *QSGRendererInterface::getResource(QQuickWindow *window, const char *resource) const | - |
160 | { | - |
161 | Q_UNUSED(window); | - |
162 | Q_UNUSED(resource); | - |
163 | return nullptr; never executed: return nullptr; | 0 |
164 | } | - |
165 | - | |
166 | /*! | - |
167 | \fn QSGRendererInterface::ShaderType QSGRendererInterface::shaderType() const | - |
168 | - | |
169 | \return the shading language supported by the Qt Quick backend the | - |
170 | application is using. | - |
171 | - | |
172 | \note This function can be called on any thread. | - |
173 | - | |
174 | \sa QtQuick::GraphicsInfo | - |
175 | */ | - |
176 | - | |
177 | /*! | - |
178 | \fn QSGRendererInterface::ShaderCompilationTypes QSGRendererInterface::shaderCompilationType() const | - |
179 | - | |
180 | \return a bitmask of the shader compilation approaches supported by the Qt | - |
181 | Quick backend the application is using. | - |
182 | - | |
183 | \note This function can be called on any thread. | - |
184 | - | |
185 | \sa QtQuick::GraphicsInfo | - |
186 | */ | - |
187 | - | |
188 | /*! | - |
189 | \fn QSGRendererInterface::ShaderSourceTypes QSGRendererInterface::shaderSourceType() const | - |
190 | - | |
191 | \return a bitmask of the supported ways of providing shader sources in ShaderEffect items. | - |
192 | - | |
193 | \note This function can be called on any thread. | - |
194 | - | |
195 | \sa QtQuick::GraphicsInfo | - |
196 | */ | - |
197 | - | |
198 | QT_END_NAMESPACE | - |
Source code | Switch to Preprocessed file |