Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qsgsoftwarecontext.cpp
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
5
12#include "qsgsoftwarelayer_p.h"
14#if QT_CONFIG(quick_sprite)
16#endif
17
18#include <QtCore/QCoreApplication>
19#include <QtCore/QElapsedTimer>
20
21#include <QtGui/QWindow>
22#include <QtQuick/private/qquickwindow_p.h>
23#include <QtQuick/private/qquickitem_p.h>
24
25// Used for very high-level info about the renderering and gl context
26// Includes GL_VERSION, type of render loop, atlas size, etc.
27Q_LOGGING_CATEGORY(QSG_RASTER_LOG_INFO, "qt.scenegraph.info")
28
29// Used to debug the renderloop logic. Primarily useful for platform integrators
30// and when investigating the render loop logic.
31Q_LOGGING_CATEGORY(QSG_RASTER_LOG_RENDERLOOP, "qt.scenegraph.renderloop")
32
33// GLSL shader compilation
34Q_LOGGING_CATEGORY(QSG_RASTER_LOG_TIME_COMPILATION, "qt.scenegraph.time.compilation")
35
36// polish, animations, sync, render and swap in the render loop
37Q_LOGGING_CATEGORY(QSG_RASTER_LOG_TIME_RENDERLOOP, "qt.scenegraph.time.renderloop")
38
39// Texture uploads and swizzling
40Q_LOGGING_CATEGORY(QSG_RASTER_LOG_TIME_TEXTURE, "qt.scenegraph.time.texture")
41
42// Glyph preparation (only for distance fields atm)
43Q_LOGGING_CATEGORY(QSG_RASTER_LOG_TIME_GLYPH, "qt.scenegraph.time.glyph")
44
45// Timing inside the renderer base class
46Q_LOGGING_CATEGORY(QSG_RASTER_LOG_TIME_RENDERER, "qt.scenegraph.time.renderer")
47
49
52 , m_initialized(false)
53 , m_activePainter(nullptr)
54{
55}
56
61
66
72
77
79{
80 Q_UNUSED(rc);
81 Q_UNUSED(renderType);
82 Q_UNUSED(renderTypeQuality);
83 return new QSGSoftwareGlyphNode();
84}
85
87{
88 return new QSGSoftwareLayer(renderContext);
89}
90
92{
95 format.setMajorVersion(0);
96 format.setMinorVersion(0);
97 return format;
98}
99
101{
102 if (m_initialized)
103 return;
104 m_initialized = true;
106}
107
124
129
134
135
140
142{
143 return 2048;
144}
145
147{
148 Q_UNUSED(renderContext);
149 return this;
150}
151
156
161
166
167#if QT_CONFIG(quick_sprite)
168QSGSpriteNode *QSGSoftwareContext::createSpriteNode()
169{
170 return new QSGSoftwareSpriteNode;
171}
172#endif
173
178
183
184QSGRendererInterface::ShaderCompilationTypes QSGSoftwareContext::shaderCompilationType() const
185{
186 return {};
187}
188
189QSGRendererInterface::ShaderSourceTypes QSGSoftwareContext::shaderSourceType() const
190{
191 return {};
192}
193
195{
196 if (!window)
197 return nullptr;
198
200
201 if (resource == PainterResource)
202 return window->isSceneGraphInitialized() ? static_cast<QSGSoftwareRenderContext *>(cd->context)->m_activePainter : nullptr;
203 else if (resource == RedirectPaintDevice)
204 return cd->redirect.rt.sw.paintDevice;
205
206 return nullptr;
207}
208
210
211#include "moc_qsgsoftwarecontext_p.cpp"
void clear() noexcept(std::is_nothrow_destructible< Node >::value)
Removes all items from the hash and frees up all memory used by it.
Definition qhash.h:951
bool isEmpty() const noexcept
Returns true if the hash contains no items; otherwise returns false.
Definition qhash.h:928
\inmodule QtGui
Definition qimage.h:37
\inmodule QtCore
Definition qobject.h:103
The QQuickPaintedItem class provides a way to use the QPainter API in the QML Scene Graph.
static QQuickWindowPrivate * get(QQuickWindow *c)
\qmltype Window \instantiates QQuickWindow \inqmlmodule QtQuick
The QSGContext holds the scene graph entry points for one QML engine.
virtual void renderContextInvalidated(QSGRenderContext *renderContext)
The QSGImageNode class is provided for convenience to easily draw textured content using the QML scen...
\inmodule QtQuick
The QSGRectangleNode class is a convenience class for drawing solid filled rectangles using scenegrap...
QHash< QObject *, QSGTexture * > m_textures
QHash< QFontEngine *, int > m_fontEnginesToClean
QPointer< QSGContext > m_sg
QHash< FontKey, QSGDistanceFieldGlyphCache * > m_glyphCaches
QSet< QSGTexture * > m_texturesToDelete
An interface providing access to some of the graphics API specific internals of the scenegraph.
RenderMode
\value RenderMode2D Normal 2D rendering \value RenderMode2DNoDepthBuffer Normal 2D rendering with dep...
Resource
\value DeviceResource The resource is a pointer to the graphics device, when applicable.
GraphicsApi
\value Unknown An unknown graphics API is in use \value Software The Qt Quick 2D Renderer is in use \...
ShaderType
\value UnknownShadingLanguage Not yet known due to no window and scenegraph associated \value GLSL GL...
The renderer class is the abstract baseclass used for rendering the QML scene graph.
QSurfaceFormat defaultSurfaceFormat() const override
QSGRectangleNode * createRectangleNode() override
QSGLayer * createLayer(QSGRenderContext *renderContext) override
QSGImageNode * createImageNode() override
QSGPainterNode * createPainterNode(QQuickPaintedItem *item) override
ShaderCompilationTypes shaderCompilationType() const override
ShaderSourceTypes shaderSourceType() const override
GraphicsApi graphicsApi() const override
Returns the graphics API that is in use by the Qt Quick scenegraph.
QSGRendererInterface * rendererInterface(QSGRenderContext *renderContext) override
Returns a pointer to the (presumably) global renderer interface.
QSGGlyphNode * createGlyphNode(QSGRenderContext *rc, QSGTextNode::RenderType renderType, int renderTypeQuality) override
QSGSoftwareContext(QObject *parent=nullptr)
QSGInternalImageNode * createInternalImageNode(QSGRenderContext *renderContext) override
ShaderType shaderType() const override
void * getResource(QQuickWindow *window, Resource resource) const override
Queries a graphics resource in window.
QSGNinePatchNode * createNinePatchNode() override
QSGInternalRectangleNode * createInternalRectangleNode() override
int maxTextureSize() const override
QSGTexture * createTexture(const QImage &image, uint flags=CreateTexture_Alpha) const override
QSGRenderer * createRenderer(QSGRendererInterface::RenderMode) override
void renderNextFrame(QSGRenderer *renderer) override
RenderType
This enum type describes type of glyph node used for rendering the text.
Definition qsgtextnode.h:29
\inmodule QtQuick
Definition qsgtexture.h:20
void clear()
Definition qset.h:61
The QSurfaceFormat class represents the format of a QSurface. \inmodule QtGui.
static QSurfaceFormat defaultFormat()
Returns the global default surface format.
EGLContext ctx
qDeleteAll(list.begin(), list.end())
Combined button and popup list for selecting options.
Definition image.cpp:4
#define Q_LOGGING_CATEGORY(name,...)
GLbitfield flags
GLenum GLuint texture
GLint GLsizei GLsizei GLenum format
#define Q_ASSERT(cond)
Definition qrandom.cpp:47
#define emit
#define Q_UNUSED(x)
unsigned int uint
Definition qtypes.h:34
QGraphicsItem * item
aWidget window() -> setWindowTitle("New Window Title")
[2]
QSvgRenderer * renderer
[0]