├── scenegraph-raster.pro ├── .tag ├── .qmake.conf ├── src ├── plugins │ ├── plugins.pro │ └── scenegraph │ │ ├── scenegraph.pro │ │ └── softwarecontext │ │ ├── softwarecontext.json │ │ ├── softwarecontext.pro │ │ ├── pixmaprenderer.h │ │ ├── pixmaptexture.h │ │ ├── pluginmain.h │ │ ├── ninepatchnode.h │ │ ├── pluginmain.cpp │ │ ├── pixmaptexture.cpp │ │ ├── glyphnode.h │ │ ├── renderer.h │ │ ├── rectanglenode.h │ │ ├── renderloop.h │ │ ├── renderlistbuilder.h │ │ ├── abstractsoftwarerenderer.h │ │ ├── context.h │ │ ├── ninepatchnode.cpp │ │ ├── softwarelayer.h │ │ ├── pixmaprenderer.cpp │ │ ├── glyphnode.cpp │ │ ├── renderablenode.h │ │ ├── painternode.h │ │ ├── renderlistbuilder.cpp │ │ ├── renderablenodeupdater.h │ │ ├── imagenode.h │ │ ├── context.cpp │ │ ├── renderer.cpp │ │ ├── painternode.cpp │ │ ├── renderloop.cpp │ │ ├── softwarelayer.cpp │ │ ├── renderablenodeupdater.cpp │ │ ├── renderablenode.cpp │ │ └── abstractsoftwarerenderer.cpp ├── src.pro └── doc │ ├── doc.pro │ ├── config │ └── qtquick2drenderer.qdocconf │ └── src │ ├── qtquick2drenderer-index.qdoc │ ├── qtquick2drenderer-limitations.qdoc │ ├── qtquick2drenderer-performance.qdoc │ └── qtquick2drenderer-installation-guide.qdoc ├── tests ├── auto │ ├── auto.pro │ └── cmake │ │ ├── cmake.pro │ │ └── CMakeLists.txt └── tests.pro ├── tools └── opengldummy │ ├── src │ ├── build-gcc.sh │ ├── egl.cpp │ └── gles2.cpp │ ├── 3rdparty │ └── include │ │ ├── GLES2 │ │ └── gl2platform.h │ │ ├── GLES3 │ │ └── gl3platform.h │ │ ├── EGL │ │ ├── eglplatform.h │ │ └── egl.h │ │ └── KHR │ │ └── khrplatform.h │ └── README └── sync.profile /scenegraph-raster.pro: -------------------------------------------------------------------------------- 1 | load(qt_parts) 2 | -------------------------------------------------------------------------------- /.tag: -------------------------------------------------------------------------------- 1 | d26f29afb5a9a563da74767a348422ca04da945e 2 | -------------------------------------------------------------------------------- /.qmake.conf: -------------------------------------------------------------------------------- 1 | load(qt_build_config) 2 | 3 | MODULE_VERSION = 5.7.0 4 | -------------------------------------------------------------------------------- /src/plugins/plugins.pro: -------------------------------------------------------------------------------- 1 | TEMPLATE = subdirs 2 | SUBDIRS += scenegraph 3 | -------------------------------------------------------------------------------- /src/src.pro: -------------------------------------------------------------------------------- 1 | TEMPLATE = subdirs 2 | SUBDIRS += \ 3 | plugins \ 4 | doc 5 | -------------------------------------------------------------------------------- /tests/auto/auto.pro: -------------------------------------------------------------------------------- 1 | TEMPLATE = subdirs 2 | 3 | SUBDIRS += \ 4 | cmake \ 5 | -------------------------------------------------------------------------------- /tests/tests.pro: -------------------------------------------------------------------------------- 1 | TEMPLATE = subdirs 2 | CONFIG += no_docs_target 3 | SUBDIRS = auto 4 | -------------------------------------------------------------------------------- /src/plugins/scenegraph/scenegraph.pro: -------------------------------------------------------------------------------- 1 | TEMPLATE = subdirs 2 | SUBDIRS += softwarecontext 3 | -------------------------------------------------------------------------------- /src/plugins/scenegraph/softwarecontext/softwarecontext.json: -------------------------------------------------------------------------------- 1 | { 2 | "Keys": ["softwarecontext"] 3 | } 4 | -------------------------------------------------------------------------------- /tests/auto/cmake/cmake.pro: -------------------------------------------------------------------------------- 1 | # Cause make to do nothing. 2 | TEMPLATE = subdirs 3 | 4 | CMAKE_QT_MODULES_UNDER_TEST = scenegraph-raster 5 | 6 | CONFIG += ctest_testcase 7 | -------------------------------------------------------------------------------- /tests/auto/cmake/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.8) 2 | 3 | project(qmake_cmake_files) 4 | 5 | enable_testing() 6 | 7 | add_test(dummy ${CMAKE_COMMAND} -E echo) 8 | -------------------------------------------------------------------------------- /tools/opengldummy/src/build-gcc.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | ${CC} -DQGS_BUILD_CLIENT_DLL -fPIC -shared --sysroot ${SYSROOT} -I../3rdparty/include -o libEGL.so egl.cpp 3 | ${CC} -DQGS_BUILD_CLIENT_DLL -fPIC -shared --sysroot ${SYSROOT} -I../3rdparty/include -o libGLESv2.so gles2.cpp 4 | -------------------------------------------------------------------------------- /src/doc/doc.pro: -------------------------------------------------------------------------------- 1 | TEMPLATE = aux 2 | QMAKE_DOCS = $$PWD/config/qtquick2drenderer.qdocconf 3 | 4 | OTHER_FILES += \ 5 | $$PWD/config/qtquick2drenderer.qdocconf \ 6 | $$PWD/src/qtquick2drenderer-index.qdoc \ 7 | $$PWD/src/qtquick2drenderer-installation-guide.qdoc \ 8 | $$PWD/src/qtquick2drenderer-performance.qdoc \ 9 | $$PWD/src/qtquick2drenderer-limitations.qdoc 10 | -------------------------------------------------------------------------------- /sync.profile: -------------------------------------------------------------------------------- 1 | # Every module that is required to build this module should have one entry. 2 | # Each of the module version specifiers can take one of the following values: 3 | # - A specific Git revision. 4 | # - any git symbolic ref resolvable from the module's repository (e.g. "refs/heads/master" to track master branch) 5 | # - an empty string to use the same branch under test (dependencies will become "refs/heads/master" if we are in the master branch) 6 | # 7 | %dependencies = ( 8 | "qtbase" => "", 9 | "qtdeclarative" => "", 10 | ); 11 | 12 | -------------------------------------------------------------------------------- /tools/opengldummy/3rdparty/include/GLES2/gl2platform.h: -------------------------------------------------------------------------------- 1 | #ifndef __gl2platform_h_ 2 | #define __gl2platform_h_ 3 | 4 | /* $Revision: 23328 $ on $Date:: 2013-10-02 02:28:28 -0700 #$ */ 5 | 6 | /* 7 | * This document is licensed under the SGI Free Software B License Version 8 | * 2.0. For details, see http://oss.sgi.com/projects/FreeB/ . 9 | */ 10 | 11 | /* Platform-specific types and definitions for OpenGL ES 2.X gl2.h 12 | * 13 | * Adopters may modify khrplatform.h and this file to suit their platform. 14 | * You are encouraged to submit all modifications to the Khronos group so that 15 | * they can be included in future versions of this file. Please submit changes 16 | * by sending them to the public Khronos Bugzilla (http://khronos.org/bugzilla) 17 | * by filing a bug against product "OpenGL-ES" component "Registry". 18 | */ 19 | 20 | #include 21 | 22 | #ifndef GL_APICALL 23 | #define GL_APICALL KHRONOS_APICALL 24 | #endif 25 | 26 | #ifndef GL_APIENTRY 27 | #define GL_APIENTRY KHRONOS_APIENTRY 28 | #endif 29 | 30 | #endif /* __gl2platform_h_ */ 31 | -------------------------------------------------------------------------------- /tools/opengldummy/3rdparty/include/GLES3/gl3platform.h: -------------------------------------------------------------------------------- 1 | #ifndef __gl3platform_h_ 2 | #define __gl3platform_h_ 3 | 4 | /* $Revision: 23328 $ on $Date:: 2013-10-02 02:28:28 -0700 #$ */ 5 | 6 | /* 7 | * This document is licensed under the SGI Free Software B License Version 8 | * 2.0. For details, see http://oss.sgi.com/projects/FreeB/ . 9 | */ 10 | 11 | /* Platform-specific types and definitions for OpenGL ES 3.X gl3.h 12 | * 13 | * Adopters may modify khrplatform.h and this file to suit their platform. 14 | * You are encouraged to submit all modifications to the Khronos group so that 15 | * they can be included in future versions of this file. Please submit changes 16 | * by sending them to the public Khronos Bugzilla (http://khronos.org/bugzilla) 17 | * by filing a bug against product "OpenGL-ES" component "Registry". 18 | */ 19 | 20 | #include 21 | 22 | #ifndef GL_APICALL 23 | #define GL_APICALL KHRONOS_APICALL 24 | #endif 25 | 26 | #ifndef GL_APIENTRY 27 | #define GL_APIENTRY KHRONOS_APIENTRY 28 | #endif 29 | 30 | #endif /* __gl3platform_h_ */ 31 | -------------------------------------------------------------------------------- /src/plugins/scenegraph/softwarecontext/softwarecontext.pro: -------------------------------------------------------------------------------- 1 | TARGET=softwarecontext 2 | 3 | QT += gui-private core-private quick-private qml-private 4 | 5 | PLUGIN_TYPE = scenegraph 6 | PLUGIN_CLASS_NAME = ContextPlugin 7 | load(qt_plugin) 8 | 9 | QMAKE_TARGET_PRODUCT = "Qt Quick 2D Renderer (Qt $$QT_VERSION)" 10 | QMAKE_TARGET_DESCRIPTION = "Quick 2D Renderer for Qt." 11 | 12 | 13 | #DEFINES += QTQUICK2D_DEBUG_FLUSH 14 | 15 | SOURCES += \ 16 | context.cpp \ 17 | pluginmain.cpp \ 18 | renderloop.cpp \ 19 | rectanglenode.cpp \ 20 | imagenode.cpp \ 21 | pixmaptexture.cpp \ 22 | glyphnode.cpp \ 23 | ninepatchnode.cpp \ 24 | softwarelayer.cpp \ 25 | painternode.cpp \ 26 | renderablenode.cpp \ 27 | renderer.cpp \ 28 | pixmaprenderer.cpp \ 29 | renderablenodeupdater.cpp \ 30 | renderlistbuilder.cpp \ 31 | abstractsoftwarerenderer.cpp 32 | 33 | HEADERS += \ 34 | context.h \ 35 | pluginmain.h \ 36 | renderloop.h \ 37 | rectanglenode.h \ 38 | imagenode.h \ 39 | pixmaptexture.h \ 40 | glyphnode.h \ 41 | ninepatchnode.h \ 42 | softwarelayer.h \ 43 | painternode.h \ 44 | renderablenode.h \ 45 | renderer.h \ 46 | pixmaprenderer.h \ 47 | renderablenodeupdater.h \ 48 | renderlistbuilder.h \ 49 | abstractsoftwarerenderer.h 50 | 51 | OTHER_FILES += softwarecontext.json 52 | 53 | -------------------------------------------------------------------------------- /src/doc/config/qtquick2drenderer.qdocconf: -------------------------------------------------------------------------------- 1 | include($QT_INSTALL_DOCS/global/qt-html-templates-offline.qdocconf) 2 | include($QT_INSTALL_DOCS/global/qt-cpp-defines.qdocconf) 3 | include($QT_INSTALL_DOCS/global/fileextensions.qdocconf) 4 | 5 | naturallanguate = en_US 6 | outputencoding = UTF-8 7 | sourceencoding = UTF-8 8 | 9 | projects = QtQuick2dRenderer 10 | url = http://doc.qt.io/QtQuick2DRenderer 11 | description = Qt Quick 2D Renderer Documentation 12 | version = $QT_VERSION 13 | 14 | sourcedirs += ../src 15 | imagedirs += ../images 16 | 17 | qhp.projects = QtQuick2dRenderer 18 | 19 | qhp.QtQuick2dRenderer.file = qtquick2drenderer.qhp 20 | qhp.QtQuick2dRenderer.namespace = com.digia.qtquick2drenderer.$QT_VERSION_TAG 21 | qhp.QtQuick2dRenderer.virtualFolder = qtquick2drenderer 22 | qhp.QtQuick2dRenderer.indexTitle = Qt Quick 2D Renderer 23 | qhp.QtQuick2dRenderer.indexRoot = 24 | 25 | qhp.QtQuick2dRenderer.subprojects = manual 26 | qhp.QtQuick2dRenderer.manual.index = Qt Quick 2D Renderer 27 | qhp.QtQuick2dRenderer.manual.indexTitle = Qt Quick 2D Renderer 28 | qhp.QtQuick2dRenderer.manual.type = manual 29 | 30 | macro.RENDERER = "Qt Quick 2D Renderer" 31 | 32 | navigation.landingpage = "Qt Quick 2D Renderer" 33 | indexes = $QT_INSTALL_DOCS/qtgui/qtgui.index \ 34 | $QT_INSTALL_DOCS/qtquick/qtquick.index \ 35 | $QT_INSTALL_DOCS/qtgraphicaleffects/qtgraphicaleffects.index 36 | -------------------------------------------------------------------------------- /src/doc/src/qtquick2drenderer-index.qdoc: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | ** 3 | ** Copyright (C) 2015 The Qt Company Ltd. 4 | ** Contact: http://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the Qt Quick 2d Renderer module. 7 | ** 8 | ** $QT_BEGIN_LICENSE:COMM$ 9 | ** 10 | ** Commercial License Usage 11 | ** Licensees holding valid commercial Qt licenses may use this file in 12 | ** accordance with the commercial license agreement provided with the 13 | ** Software or, alternatively, in accordance with the terms contained in 14 | ** a written agreement between you and The Qt Company. For licensing terms 15 | ** and conditions see http://www.qt.io/terms-conditions. For further 16 | ** information use the contact form at http://www.qt.io/contact-us. 17 | ** 18 | ** $QT_END_LICENSE$ 19 | ** 20 | ******************************************************************************/ 21 | 22 | /*! 23 | \contentspage{index.html}{Qt Quick 2D Renderer} 24 | \page index.html 25 | \nextpage qtquick2drenderer-installation-guide.html 26 | \title Qt Quick 2D Renderer 27 | 28 | \RENDERER is an alternative renderer for \l {Qt Quick} 2 that uses the Raster 29 | paint engine to render the contents of the scene graph instead of OpenGL. 30 | As a result of not using OpenGL to render the scene graph, some features 31 | and optimizations are no longer available. Most Qt Quick 2 applications 32 | will run without modification though any attempts to use unsupported 33 | features will be ignored. By using the \RENDERER it is now possible to run Qt 34 | Quick 2 applications on hardware and platforms that do not have OpenGL 35 | support. 36 | 37 | \RENDERER is a Qt module that contains a scene graph renderer plugin. 38 | 39 | To use \RENDERER add the following to your run environment: 40 | \badcode 41 | export QMLSCENE_DEVICE=softwarecontext 42 | \endcode 43 | 44 | \section1 Contents 45 | 46 | \list 47 | \li \l{Installation Guide} 48 | \li \l{Limitations} 49 | \li \l{Performance Guide} 50 | \endlist 51 | */ 52 | -------------------------------------------------------------------------------- /src/plugins/scenegraph/softwarecontext/pixmaprenderer.h: -------------------------------------------------------------------------------- 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 Qt Quick 2D Renderer module of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:GPL$ 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 General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU 19 | ** General Public License version 3 or (at your option) any later version 20 | ** approved by the KDE Free Qt Foundation. The licenses are as published by 21 | ** the Free Software Foundation and appearing in the file LICENSE.GPL3 22 | ** included in the packaging of this file. Please review the following 23 | ** information to ensure the GNU General Public License requirements will 24 | ** be met: https://www.gnu.org/licenses/gpl-3.0.html. 25 | ** 26 | ** $QT_END_LICENSE$ 27 | ** 28 | ****************************************************************************/ 29 | 30 | #ifndef PIXMAPRENDERER_H 31 | #define PIXMAPRENDERER_H 32 | 33 | #include "abstractsoftwarerenderer.h" 34 | 35 | QT_BEGIN_NAMESPACE 36 | 37 | namespace SoftwareContext { 38 | 39 | class PixmapRenderer : public AbstractSoftwareRenderer 40 | { 41 | public: 42 | PixmapRenderer(QSGRenderContext *context); 43 | virtual ~PixmapRenderer(); 44 | 45 | void renderScene(GLuint fboId = 0) final; 46 | void render() final; 47 | 48 | void render(QPixmap *target); 49 | void setProjectionRect(const QRect &projectionRect); 50 | 51 | private: 52 | QRect m_projectionRect; 53 | }; 54 | 55 | } // namespace 56 | 57 | QT_END_NAMESPACE 58 | 59 | #endif // PIXMAPRENDERER_H 60 | -------------------------------------------------------------------------------- /src/plugins/scenegraph/softwarecontext/pixmaptexture.h: -------------------------------------------------------------------------------- 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 Qt Quick 2D Renderer module of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:GPL$ 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 General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU 19 | ** General Public License version 3 or (at your option) any later version 20 | ** approved by the KDE Free Qt Foundation. The licenses are as published by 21 | ** the Free Software Foundation and appearing in the file LICENSE.GPL3 22 | ** included in the packaging of this file. Please review the following 23 | ** information to ensure the GNU General Public License requirements will 24 | ** be met: https://www.gnu.org/licenses/gpl-3.0.html. 25 | ** 26 | ** $QT_END_LICENSE$ 27 | ** 28 | ****************************************************************************/ 29 | 30 | #ifndef PIXMAPTEXTURE_H 31 | #define PIXMAPTEXTURE_H 32 | 33 | #include 34 | 35 | QT_BEGIN_NAMESPACE 36 | 37 | class PixmapTexture : public QSGTexture 38 | { 39 | Q_OBJECT 40 | public: 41 | PixmapTexture(const QImage &image); 42 | PixmapTexture(const QPixmap &pixmap); 43 | 44 | int textureId() const override; 45 | QSize textureSize() const override; 46 | bool hasAlphaChannel() const override; 47 | bool hasMipmaps() const override; 48 | void bind() override; 49 | 50 | const QPixmap &pixmap() const { return m_pixmap; } 51 | 52 | private: 53 | QPixmap m_pixmap; 54 | }; 55 | 56 | QT_END_NAMESPACE 57 | 58 | #endif // PIXMAPTEXTURE_H 59 | -------------------------------------------------------------------------------- /src/plugins/scenegraph/softwarecontext/pluginmain.h: -------------------------------------------------------------------------------- 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 Qt Quick 2D Renderer module of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:GPL$ 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 General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU 19 | ** General Public License version 3 or (at your option) any later version 20 | ** approved by the KDE Free Qt Foundation. The licenses are as published by 21 | ** the Free Software Foundation and appearing in the file LICENSE.GPL3 22 | ** included in the packaging of this file. Please review the following 23 | ** information to ensure the GNU General Public License requirements will 24 | ** be met: https://www.gnu.org/licenses/gpl-3.0.html. 25 | ** 26 | ** $QT_END_LICENSE$ 27 | ** 28 | ****************************************************************************/ 29 | 30 | #ifndef PLUGINMAIN_H 31 | #define PLUGINMAIN_H 32 | 33 | #include 34 | #include 35 | 36 | #include 37 | 38 | #include "context.h" 39 | 40 | QT_BEGIN_NAMESPACE 41 | 42 | class ContextPlugin : public QSGContextPlugin 43 | { 44 | Q_OBJECT 45 | 46 | Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QSGContextFactoryInterface" FILE "softwarecontext.json") 47 | 48 | public: 49 | ContextPlugin(QObject *parent = 0); 50 | 51 | QStringList keys() const override; 52 | QSGContext *create(const QString &key) const override; 53 | QSGRenderLoop *createWindowManager() override; 54 | 55 | static SoftwareContext::Context *instance; 56 | }; 57 | 58 | QT_END_NAMESPACE 59 | 60 | #endif // PLUGINMAIN_H 61 | -------------------------------------------------------------------------------- /src/plugins/scenegraph/softwarecontext/ninepatchnode.h: -------------------------------------------------------------------------------- 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 Qt Quick 2D Renderer module of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:GPL$ 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 General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU 19 | ** General Public License version 3 or (at your option) any later version 20 | ** approved by the KDE Free Qt Foundation. The licenses are as published by 21 | ** the Free Software Foundation and appearing in the file LICENSE.GPL3 22 | ** included in the packaging of this file. Please review the following 23 | ** information to ensure the GNU General Public License requirements will 24 | ** be met: https://www.gnu.org/licenses/gpl-3.0.html. 25 | ** 26 | ** $QT_END_LICENSE$ 27 | ** 28 | ****************************************************************************/ 29 | 30 | #ifndef NINEPATCHNODE_H 31 | #define NINEPATCHNODE_H 32 | 33 | #include 34 | 35 | QT_BEGIN_NAMESPACE 36 | 37 | class NinePatchNode : public QSGNinePatchNode 38 | { 39 | public: 40 | NinePatchNode(); 41 | 42 | void setTexture(QSGTexture *texture) override; 43 | void setBounds(const QRectF &bounds) override; 44 | void setDevicePixelRatio(qreal ratio) override; 45 | void setPadding(qreal left, qreal top, qreal right, qreal bottom) override; 46 | void update() override; 47 | 48 | void paint(QPainter *painter); 49 | 50 | QRectF bounds() const; 51 | 52 | private: 53 | QPixmap m_pixmap; 54 | QRectF m_bounds; 55 | qreal m_pixelRatio; 56 | QMargins m_margins; 57 | }; 58 | 59 | QT_END_NAMESPACE 60 | 61 | #endif // NINEPATCHNODE_H 62 | -------------------------------------------------------------------------------- /src/plugins/scenegraph/softwarecontext/pluginmain.cpp: -------------------------------------------------------------------------------- 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 Qt Quick 2D Renderer module of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:GPL$ 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 General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU 19 | ** General Public License version 3 or (at your option) any later version 20 | ** approved by the KDE Free Qt Foundation. The licenses are as published by 21 | ** the Free Software Foundation and appearing in the file LICENSE.GPL3 22 | ** included in the packaging of this file. Please review the following 23 | ** information to ensure the GNU General Public License requirements will 24 | ** be met: https://www.gnu.org/licenses/gpl-3.0.html. 25 | ** 26 | ** $QT_END_LICENSE$ 27 | ** 28 | ****************************************************************************/ 29 | 30 | #include "pluginmain.h" 31 | #include "context.h" 32 | #include "renderloop.h" 33 | 34 | #include 35 | #include 36 | 37 | QT_BEGIN_NAMESPACE 38 | 39 | ContextPlugin::ContextPlugin(QObject *parent) 40 | : QSGContextPlugin(parent) 41 | { 42 | } 43 | 44 | QStringList ContextPlugin::keys() const 45 | { 46 | return QStringList() << QLatin1String("softwarecontext"); 47 | } 48 | 49 | QSGContext *ContextPlugin::create(const QString &) const 50 | { 51 | if (!instance) 52 | instance = new SoftwareContext::Context(); 53 | return instance; 54 | } 55 | 56 | QSGRenderLoop *ContextPlugin::createWindowManager() 57 | { 58 | return new RenderLoop(); 59 | } 60 | 61 | SoftwareContext::Context *ContextPlugin::instance = 0; 62 | 63 | QT_END_NAMESPACE 64 | -------------------------------------------------------------------------------- /tools/opengldummy/README: -------------------------------------------------------------------------------- 1 | How to use the OpenGL dummy libraries 2 | 3 | The OpenGL Dummy libraries provide both headers and shared object files containing 4 | the symbols for both OpenGL ES2 and EGL. The headers get copied into your sysroot 5 | in the /usr/include folder, and the *.so file gets copied into your /usr/lib/ 6 | folder in both the sysroot, as well as in the target image (distributed on the device). 7 | The library that is generated contains all the symbols needed to succesffuly link 8 | an application as if you had support for OpenGL ES2 and EGL. It is important to 9 | make sure that you do not actually call any of these symbols in your application. 10 | 11 | 12 | Installation: 13 | 14 | You need to have three things: 15 | 16 | Toolchain to cross compile code for your device 17 | Sysroot containing development headers and shared objects to link against when 18 | building applications 19 | Target image inteded to be deployed to your device. 20 | 21 | 1) Build the library 22 | Setup your build environment by defining where your compiler and sysroot 23 | are located: 24 | eg. 25 | export CC=/opt/arm-toolchain/usr/bin/arm-linux-gnueabi-g++ 26 | export SYSROOT=/opt/device-name/sysroot/ 27 | 28 | Run the build script inside the client-dummy directory: 29 | cd client-dummy 30 | ./build-gcc.sh 31 | 32 | That should generate a two files: libEGL.so, libGLESv2.so 33 | 34 | 2) Installation of files 35 | Copy the include folder to the /usr/include folder in your sysroot. This 36 | installs the OpenGL/EGL headers: 37 | cp -r 3rdparty/include/* ${SYSROOT}/usr/include/ 38 | 39 | Copy libEGL.so and libGLESv2.so to the /usr/lib folder in your sysroot: 40 | cp src/lib*.so ${SYSROOT}/usr/lib/ 41 | 42 | Copy the libEGL.so and libGLESv2.so to the target device image and/or device 43 | (this is the copy that is linked against on the device). 44 | 45 | 3) Build Qt against this fake OpenGL library 46 | When configuring Qt, make sure to build with es2 support: 47 | ./configure -opengl es2 ... 48 | 49 | Build as normal. 50 | 51 | 4) Done 52 | Now when you deploy your Qt build to the device it will depend on the dummy 53 | libs libEGL.so and libGLESv2.so, but as long as you are using the Qt Quick 54 | 2D Renderer plugin you will be able to use QtQuick2 without actually making 55 | any OpenGL/EGL calls. 56 | -------------------------------------------------------------------------------- /src/plugins/scenegraph/softwarecontext/pixmaptexture.cpp: -------------------------------------------------------------------------------- 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 Qt Quick 2D Renderer module of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:GPL$ 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 General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU 19 | ** General Public License version 3 or (at your option) any later version 20 | ** approved by the KDE Free Qt Foundation. The licenses are as published by 21 | ** the Free Software Foundation and appearing in the file LICENSE.GPL3 22 | ** included in the packaging of this file. Please review the following 23 | ** information to ensure the GNU General Public License requirements will 24 | ** be met: https://www.gnu.org/licenses/gpl-3.0.html. 25 | ** 26 | ** $QT_END_LICENSE$ 27 | ** 28 | ****************************************************************************/ 29 | 30 | #include "pixmaptexture.h" 31 | 32 | QT_BEGIN_NAMESPACE 33 | 34 | PixmapTexture::PixmapTexture(const QImage &image) 35 | // Prevent pixmap format conversion to reduce memory consumption 36 | // and surprises in calling code. (See QTBUG-47328) 37 | : m_pixmap(QPixmap::fromImage(image, Qt::NoFormatConversion)) 38 | { 39 | } 40 | 41 | PixmapTexture::PixmapTexture(const QPixmap &pixmap) 42 | : m_pixmap(pixmap) 43 | { 44 | } 45 | 46 | 47 | int PixmapTexture::textureId() const 48 | { 49 | return 0; 50 | } 51 | 52 | QSize PixmapTexture::textureSize() const 53 | { 54 | return m_pixmap.size(); 55 | } 56 | 57 | bool PixmapTexture::hasAlphaChannel() const 58 | { 59 | return m_pixmap.hasAlphaChannel(); 60 | } 61 | 62 | bool PixmapTexture::hasMipmaps() const 63 | { 64 | return false; 65 | } 66 | 67 | void PixmapTexture::bind() 68 | { 69 | Q_UNREACHABLE(); 70 | } 71 | 72 | QT_END_NAMESPACE 73 | -------------------------------------------------------------------------------- /src/plugins/scenegraph/softwarecontext/glyphnode.h: -------------------------------------------------------------------------------- 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 Qt Quick 2D Renderer module of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:GPL$ 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 General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU 19 | ** General Public License version 3 or (at your option) any later version 20 | ** approved by the KDE Free Qt Foundation. The licenses are as published by 21 | ** the Free Software Foundation and appearing in the file LICENSE.GPL3 22 | ** included in the packaging of this file. Please review the following 23 | ** information to ensure the GNU General Public License requirements will 24 | ** be met: https://www.gnu.org/licenses/gpl-3.0.html. 25 | ** 26 | ** $QT_END_LICENSE$ 27 | ** 28 | ****************************************************************************/ 29 | 30 | #ifndef GLYPHNODE_H 31 | #define GLYPHNODE_H 32 | 33 | #include 34 | 35 | QT_BEGIN_NAMESPACE 36 | 37 | class GlyphNode : public QSGGlyphNode 38 | { 39 | public: 40 | GlyphNode(); 41 | 42 | void setGlyphs(const QPointF &position, const QGlyphRun &glyphs) override; 43 | void setColor(const QColor &color) override; 44 | void setStyle(QQuickText::TextStyle style) override; 45 | void setStyleColor(const QColor &color) override; 46 | QPointF baseLine() const override; 47 | void setPreferredAntialiasingMode(AntialiasingMode) override; 48 | void update() override; 49 | 50 | void paint(QPainter *painter); 51 | 52 | private: 53 | QPointF m_position; 54 | QGlyphRun m_glyphRun; 55 | QColor m_color; 56 | QSGGeometry m_geometry; 57 | QQuickText::TextStyle m_style; 58 | QColor m_styleColor; 59 | }; 60 | 61 | QT_END_NAMESPACE 62 | 63 | #endif // GLYPHNODE_H 64 | -------------------------------------------------------------------------------- /src/plugins/scenegraph/softwarecontext/renderer.h: -------------------------------------------------------------------------------- 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 Qt Quick 2D Renderer module of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:GPL$ 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 General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU 19 | ** General Public License version 3 or (at your option) any later version 20 | ** approved by the KDE Free Qt Foundation. The licenses are as published by 21 | ** the Free Software Foundation and appearing in the file LICENSE.GPL3 22 | ** included in the packaging of this file. Please review the following 23 | ** information to ensure the GNU General Public License requirements will 24 | ** be met: https://www.gnu.org/licenses/gpl-3.0.html. 25 | ** 26 | ** $QT_END_LICENSE$ 27 | ** 28 | ****************************************************************************/ 29 | 30 | #ifndef RENDERER_H 31 | #define RENDERER_H 32 | 33 | #include "abstractsoftwarerenderer.h" 34 | 35 | #include 36 | 37 | #ifdef QTQUICK2D_DEBUG_FLUSH 38 | #include 39 | #endif 40 | 41 | QT_BEGIN_NAMESPACE 42 | 43 | class QSGSimpleRectNode; 44 | 45 | namespace SoftwareContext{ 46 | 47 | class Renderer : public AbstractSoftwareRenderer 48 | { 49 | public: 50 | Renderer(QSGRenderContext *context); 51 | virtual ~Renderer(); 52 | 53 | QBackingStore *backingStore() const { return m_backingStore.data(); } 54 | 55 | protected: 56 | void renderScene(GLuint fboId = 0) final; 57 | void render() final; 58 | 59 | private: 60 | QScopedPointer m_backingStore; 61 | 62 | #ifdef QTQUICK2D_DEBUG_FLUSH 63 | QVector m_previousFlushes; 64 | QImage m_outputBuffer; 65 | #endif 66 | }; 67 | 68 | } // namespace 69 | 70 | QT_END_NAMESPACE 71 | 72 | #endif // RENDERER_H 73 | -------------------------------------------------------------------------------- /src/doc/src/qtquick2drenderer-limitations.qdoc: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | ** 3 | ** Copyright (C) 2015 The Qt Company Ltd. 4 | ** Contact: http://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the Qt Quick 2d Renderer module. 7 | ** 8 | ** $QT_BEGIN_LICENSE:COMM$ 9 | ** 10 | ** Commercial License Usage 11 | ** Licensees holding valid commercial Qt licenses may use this file in 12 | ** accordance with the commercial license agreement provided with the 13 | ** Software or, alternatively, in accordance with the terms contained in 14 | ** a written agreement between you and The Qt Company. For licensing terms 15 | ** and conditions see http://www.qt.io/terms-conditions. For further 16 | ** information use the contact form at http://www.qt.io/contact-us. 17 | ** 18 | ** $QT_END_LICENSE$ 19 | ** 20 | ******************************************************************************/ 21 | 22 | /*! 23 | \page qtquick2drenderer-limitations.html 24 | \previouspage qtquick2drenderer-installation-guide.html 25 | \nextpage qtquick2drenderer-performance.html 26 | 27 | \title Limitations 28 | 29 | \l {Qt Quick} 2 was designed to take full advantage of OpenGL to make the most 30 | out of available graphics hardware. By not relying on OpenGL, \RENDERER 31 | presents certain limitations regarding the available features. 32 | 33 | Since \RENDERER does not use OpenGL, there are some features that cannot be 34 | supported. The following are known limitations: 35 | 36 | \section1 Shader Effects 37 | ShaderEffect components in QtQuick 2 can not be rendered with \RENDERER. 38 | 39 | \section1 Qt Graphical Effects Module 40 | \l {Qt Graphical Effects} uses ShaderEffect items to render effects. If you use 41 | graphical effects from this module, then you should not hide the source 42 | item so that the original item can still be rendered. 43 | 44 | \section1 Particle Effects 45 | It is not possible to render particle effects with \RENDERER. Whenever 46 | possible, remove particles completely from the scene. Otherwise they will still 47 | require some processing, even though they are not visible with \RENDERER. 48 | 49 | \section1 Sprites 50 | The Sprite item depends on inaccessible OpenGL functions and will 51 | not be visible. 52 | 53 | \section1 Rendering Text 54 | The text rendering with \RENDERER is based on software rasterization and does 55 | not respond as well to transformations such as scaling as when using OpenGL. 56 | The quality is similar to choosing \l [QML] {Text::renderType} 57 | {Text.NativeRendering} with \l [QML] {Text} items. 58 | 59 | \section1 Render Control 60 | QQuickRenderControl depends on OpenGL to function and will not function 61 | with \RENDERER. Using QQuickRenderControl can lead to unexpected behavior 62 | and crashes. 63 | */ 64 | -------------------------------------------------------------------------------- /src/plugins/scenegraph/softwarecontext/rectanglenode.h: -------------------------------------------------------------------------------- 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 Qt Quick 2D Renderer module of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:GPL$ 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 General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU 19 | ** General Public License version 3 or (at your option) any later version 20 | ** approved by the KDE Free Qt Foundation. The licenses are as published by 21 | ** the Free Software Foundation and appearing in the file LICENSE.GPL3 22 | ** included in the packaging of this file. Please review the following 23 | ** information to ensure the GNU General Public License requirements will 24 | ** be met: https://www.gnu.org/licenses/gpl-3.0.html. 25 | ** 26 | ** $QT_END_LICENSE$ 27 | ** 28 | ****************************************************************************/ 29 | 30 | #ifndef RECTANGLENODE_H 31 | #define RECTANGLENODE_H 32 | 33 | #include 34 | 35 | #include 36 | #include 37 | #include 38 | 39 | QT_BEGIN_NAMESPACE 40 | 41 | class RectangleNode : public QSGRectangleNode 42 | { 43 | public: 44 | RectangleNode(); 45 | 46 | void setRect(const QRectF &rect) override; 47 | void setColor(const QColor &color) override; 48 | void setPenColor(const QColor &color) override; 49 | void setPenWidth(qreal width) override; 50 | void setGradientStops(const QGradientStops &stops) override; 51 | void setRadius(qreal radius) override; 52 | void setAntialiasing(bool antialiasing) override { Q_UNUSED(antialiasing) } 53 | void setAligned(bool aligned) override; 54 | 55 | void update() override; 56 | 57 | void paint(QPainter *); 58 | 59 | bool isOpaque() const; 60 | QRectF rect() const; 61 | private: 62 | void paintRectangle(QPainter *painter, const QRect &rect); 63 | void generateCornerPixmap(); 64 | 65 | QRect m_rect; 66 | QColor m_color; 67 | QColor m_penColor; 68 | double m_penWidth; 69 | QGradientStops m_stops; 70 | double m_radius; 71 | QPen m_pen; 72 | QBrush m_brush; 73 | 74 | bool m_cornerPixmapIsDirty; 75 | QPixmap m_cornerPixmap; 76 | 77 | int m_devicePixelRatio; 78 | }; 79 | 80 | QT_END_NAMESPACE 81 | 82 | #endif // RECTANGLENODE_H 83 | -------------------------------------------------------------------------------- /src/plugins/scenegraph/softwarecontext/renderloop.h: -------------------------------------------------------------------------------- 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 Qt Quick 2D Renderer module of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:GPL$ 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 General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU 19 | ** General Public License version 3 or (at your option) any later version 20 | ** approved by the KDE Free Qt Foundation. The licenses are as published by 21 | ** the Free Software Foundation and appearing in the file LICENSE.GPL3 22 | ** included in the packaging of this file. Please review the following 23 | ** information to ensure the GNU General Public License requirements will 24 | ** be met: https://www.gnu.org/licenses/gpl-3.0.html. 25 | ** 26 | ** $QT_END_LICENSE$ 27 | ** 28 | ****************************************************************************/ 29 | 30 | #ifndef RENDERLOOP_H 31 | #define RENDERLOOP_H 32 | 33 | #include 34 | 35 | QT_BEGIN_NAMESPACE 36 | 37 | class RenderLoop : public QSGRenderLoop 38 | { 39 | Q_OBJECT 40 | public: 41 | RenderLoop(); 42 | ~RenderLoop(); 43 | 44 | void show(QQuickWindow *window) override; 45 | void hide(QQuickWindow *window) override; 46 | 47 | void windowDestroyed(QQuickWindow *window) override; 48 | 49 | void renderWindow(QQuickWindow *window); 50 | void exposureChanged(QQuickWindow *window) override; 51 | QImage grab(QQuickWindow *window) override; 52 | 53 | void maybeUpdate(QQuickWindow *window) override; 54 | void update(QQuickWindow *window) override { maybeUpdate(window); } // identical for this implementation. 55 | void handleUpdateRequest(QQuickWindow *) override; 56 | 57 | void releaseResources(QQuickWindow *) override { } 58 | 59 | QSurface::SurfaceType windowSurfaceType() const override; 60 | 61 | QAnimationDriver *animationDriver() const override { return 0; } 62 | 63 | QSGContext *sceneGraphContext() const override; 64 | QSGRenderContext *createRenderContext(QSGContext *) const override { return rc; } 65 | 66 | struct WindowData { 67 | bool updatePending : 1; 68 | bool grabOnly : 1; 69 | }; 70 | 71 | QHash m_windows; 72 | 73 | QSGContext *sg; 74 | QSGRenderContext *rc; 75 | 76 | QImage grabContent; 77 | }; 78 | 79 | QT_END_NAMESPACE 80 | 81 | #endif // RENDERLOOP_H 82 | -------------------------------------------------------------------------------- /src/plugins/scenegraph/softwarecontext/renderlistbuilder.h: -------------------------------------------------------------------------------- 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 Qt Quick 2D Renderer module of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:GPL$ 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 General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU 19 | ** General Public License version 3 or (at your option) any later version 20 | ** approved by the KDE Free Qt Foundation. The licenses are as published by 21 | ** the Free Software Foundation and appearing in the file LICENSE.GPL3 22 | ** included in the packaging of this file. Please review the following 23 | ** information to ensure the GNU General Public License requirements will 24 | ** be met: https://www.gnu.org/licenses/gpl-3.0.html. 25 | ** 26 | ** $QT_END_LICENSE$ 27 | ** 28 | ****************************************************************************/ 29 | 30 | #ifndef RENDERLISTBUILDER_H 31 | #define RENDERLISTBUILDER_H 32 | 33 | #include 34 | 35 | QT_BEGIN_NAMESPACE 36 | 37 | namespace SoftwareContext { 38 | 39 | class AbstractSoftwareRenderer; 40 | 41 | class RenderListBuilder : public QSGNodeVisitorEx 42 | { 43 | public: 44 | RenderListBuilder(AbstractSoftwareRenderer *renderer); 45 | 46 | bool visit(QSGTransformNode *) override; 47 | void endVisit(QSGTransformNode *) override; 48 | bool visit(QSGClipNode *) override; 49 | void endVisit(QSGClipNode *) override; 50 | bool visit(QSGGeometryNode *) override; 51 | void endVisit(QSGGeometryNode *) override; 52 | bool visit(QSGOpacityNode *) override; 53 | void endVisit(QSGOpacityNode *) override; 54 | bool visit(QSGImageNode *) override; 55 | void endVisit(QSGImageNode *) override; 56 | bool visit(QSGPainterNode *) override; 57 | void endVisit(QSGPainterNode *) override; 58 | bool visit(QSGRectangleNode *) override; 59 | void endVisit(QSGRectangleNode *) override; 60 | bool visit(QSGGlyphNode *) override; 61 | void endVisit(QSGGlyphNode *) override; 62 | bool visit(QSGNinePatchNode *) override; 63 | void endVisit(QSGNinePatchNode *) override; 64 | bool visit(QSGRootNode *) override; 65 | void endVisit(QSGRootNode *) override; 66 | 67 | private: 68 | bool addRenderableNode(QSGNode *node); 69 | 70 | AbstractSoftwareRenderer *m_renderer; 71 | }; 72 | 73 | } 74 | 75 | QT_END_NAMESPACE 76 | 77 | #endif // RENDERLISTBUILDER_H 78 | -------------------------------------------------------------------------------- /src/plugins/scenegraph/softwarecontext/abstractsoftwarerenderer.h: -------------------------------------------------------------------------------- 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 Qt Quick 2D Renderer module of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:GPL$ 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 General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU 19 | ** General Public License version 3 or (at your option) any later version 20 | ** approved by the KDE Free Qt Foundation. The licenses are as published by 21 | ** the Free Software Foundation and appearing in the file LICENSE.GPL3 22 | ** included in the packaging of this file. Please review the following 23 | ** information to ensure the GNU General Public License requirements will 24 | ** be met: https://www.gnu.org/licenses/gpl-3.0.html. 25 | ** 26 | ** $QT_END_LICENSE$ 27 | ** 28 | ****************************************************************************/ 29 | 30 | #ifndef ABSTRACTSOFTWARERENDERER_H 31 | #define ABSTRACTSOFTWARERENDERER_H 32 | 33 | #include 34 | 35 | #include 36 | #include 37 | 38 | QT_BEGIN_NAMESPACE 39 | 40 | class QSGSimpleRectNode; 41 | 42 | namespace SoftwareContext{ 43 | 44 | class RenderableNode; 45 | class RenderableNodeUpdater; 46 | 47 | class AbstractSoftwareRenderer : public QSGRenderer 48 | { 49 | public: 50 | AbstractSoftwareRenderer(QSGRenderContext *context); 51 | virtual ~AbstractSoftwareRenderer(); 52 | 53 | RenderableNode *renderableNode(QSGNode *node) const; 54 | void addNodeMapping(QSGNode *node, RenderableNode *renderableNode); 55 | void appendRenderableNode(RenderableNode *node); 56 | 57 | void nodeChanged(QSGNode *node, QSGNode::DirtyState state) override; 58 | 59 | protected: 60 | QRegion renderNodes(QPainter *painter); 61 | void buildRenderList(); 62 | void optimizeRenderList(); 63 | 64 | void setBackgroundColor(const QColor &color); 65 | void setBackgroundSize(const QSize &size); 66 | QColor backgroundColor(); 67 | QSize backgroundSize(); 68 | 69 | private: 70 | void nodeAdded(QSGNode *node); 71 | void nodeRemoved(QSGNode *node); 72 | void nodeGeometryUpdated(QSGNode *node); 73 | void nodeMaterialUpdated(QSGNode *node); 74 | void nodeMatrixUpdated(QSGNode *node); 75 | void nodeOpacityUpdated(QSGNode *node); 76 | 77 | QHash m_nodes; 78 | QLinkedList m_renderableNodes; 79 | 80 | QSGSimpleRectNode *m_background; 81 | 82 | QRegion m_dirtyRegion; 83 | QRegion m_obscuredRegion; 84 | 85 | RenderableNodeUpdater *m_nodeUpdater; 86 | }; 87 | 88 | } // namespace 89 | 90 | QT_END_NAMESPACE 91 | 92 | #endif // ABSTRACTSOFTWARERENDERER_H 93 | -------------------------------------------------------------------------------- /src/plugins/scenegraph/softwarecontext/context.h: -------------------------------------------------------------------------------- 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 Qt Quick 2D Renderer module of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:GPL$ 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 General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU 19 | ** General Public License version 3 or (at your option) any later version 20 | ** approved by the KDE Free Qt Foundation. The licenses are as published by 21 | ** the Free Software Foundation and appearing in the file LICENSE.GPL3 22 | ** included in the packaging of this file. Please review the following 23 | ** information to ensure the GNU General Public License requirements will 24 | ** be met: https://www.gnu.org/licenses/gpl-3.0.html. 25 | ** 26 | ** $QT_END_LICENSE$ 27 | ** 28 | ****************************************************************************/ 29 | 30 | #ifndef CONTEXT_H 31 | #define CONTEXT_H 32 | 33 | #include 34 | #include 35 | 36 | Q_DECLARE_LOGGING_CATEGORY(QSG_RASTER_LOG_TIME_RENDERLOOP) 37 | Q_DECLARE_LOGGING_CATEGORY(QSG_RASTER_LOG_TIME_COMPILATION) 38 | Q_DECLARE_LOGGING_CATEGORY(QSG_RASTER_LOG_TIME_TEXTURE) 39 | Q_DECLARE_LOGGING_CATEGORY(QSG_RASTER_LOG_TIME_GLYPH) 40 | Q_DECLARE_LOGGING_CATEGORY(QSG_RASTER_LOG_TIME_RENDERER) 41 | Q_DECLARE_LOGGING_CATEGORY(QSG_RASTER_LOG_INFO) 42 | Q_DECLARE_LOGGING_CATEGORY(QSG_RASTER_LOG_RENDERLOOP) 43 | 44 | QT_BEGIN_NAMESPACE 45 | 46 | namespace SoftwareContext 47 | { 48 | 49 | class RenderContext : public QSGRenderContext 50 | { 51 | public: 52 | RenderContext(QSGContext *ctx); 53 | void initialize(QOpenGLContext *context) override; 54 | void initializeIfNeeded(); 55 | void invalidate() override; 56 | void renderNextFrame(QSGRenderer *renderer, GLuint fbo) override; 57 | QSGTexture *createTexture(const QImage &image, uint flags = CreateTexture_Alpha) const override; 58 | QSGRenderer *createRenderer() override; 59 | 60 | QWindow *currentWindow; 61 | bool m_initialized; 62 | }; 63 | 64 | class Context : public QSGContext 65 | { 66 | Q_OBJECT 67 | public: 68 | explicit Context(QObject *parent = nullptr); 69 | 70 | QSGRenderContext *createRenderContext() override { return new RenderContext(this); } 71 | QSGRectangleNode *createRectangleNode() override; 72 | QSGImageNode *createImageNode() override; 73 | QSGPainterNode *createPainterNode(QQuickPaintedItem *item) override; 74 | QSGGlyphNode *createGlyphNode(QSGRenderContext *rc, bool preferNativeGlyphNode) override; 75 | QSGNinePatchNode *createNinePatchNode() override; 76 | QSGLayer *createLayer(QSGRenderContext *renderContext) override; 77 | QSurfaceFormat defaultSurfaceFormat() const override; 78 | }; 79 | 80 | } // namespace 81 | 82 | QT_END_NAMESPACE 83 | 84 | #endif // CONTEXT_H 85 | -------------------------------------------------------------------------------- /src/plugins/scenegraph/softwarecontext/ninepatchnode.cpp: -------------------------------------------------------------------------------- 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 Qt Quick 2D Renderer module of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:GPL$ 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 General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU 19 | ** General Public License version 3 or (at your option) any later version 20 | ** approved by the KDE Free Qt Foundation. The licenses are as published by 21 | ** the Free Software Foundation and appearing in the file LICENSE.GPL3 22 | ** included in the packaging of this file. Please review the following 23 | ** information to ensure the GNU General Public License requirements will 24 | ** be met: https://www.gnu.org/licenses/gpl-3.0.html. 25 | ** 26 | ** $QT_END_LICENSE$ 27 | ** 28 | ****************************************************************************/ 29 | 30 | #include "ninepatchnode.h" 31 | #include "pixmaptexture.h" 32 | #include "imagenode.h" 33 | 34 | QT_BEGIN_NAMESPACE 35 | 36 | NinePatchNode::NinePatchNode() 37 | { 38 | setMaterial((QSGMaterial*)1); 39 | setGeometry((QSGGeometry*)1); 40 | } 41 | 42 | void NinePatchNode::setTexture(QSGTexture *texture) 43 | { 44 | PixmapTexture *pt = qobject_cast(texture); 45 | if (!pt) { 46 | qWarning() << "Image used with invalid texture format."; 47 | return; 48 | } 49 | m_pixmap = pt->pixmap(); 50 | markDirty(DirtyMaterial); 51 | } 52 | 53 | void NinePatchNode::setBounds(const QRectF &bounds) 54 | { 55 | if (m_bounds == bounds) 56 | return; 57 | 58 | m_bounds = bounds; 59 | markDirty(DirtyGeometry); 60 | } 61 | 62 | void NinePatchNode::setDevicePixelRatio(qreal ratio) 63 | { 64 | if (m_pixelRatio == ratio) 65 | return; 66 | 67 | m_pixelRatio = ratio; 68 | markDirty(DirtyGeometry); 69 | } 70 | 71 | void NinePatchNode::setPadding(qreal left, qreal top, qreal right, qreal bottom) 72 | { 73 | QMargins margins(qRound(left), qRound(top), qRound(right), qRound(bottom)); 74 | if (m_margins == margins) 75 | return; 76 | 77 | m_margins = QMargins(qRound(left), qRound(top), qRound(right), qRound(bottom)); 78 | markDirty(DirtyGeometry); 79 | } 80 | 81 | void NinePatchNode::update() 82 | { 83 | } 84 | 85 | void NinePatchNode::paint(QPainter *painter) 86 | { 87 | if (m_margins.isNull()) 88 | painter->drawPixmap(m_bounds, m_pixmap, QRectF(0, 0, m_pixmap.width(), m_pixmap.height())); 89 | else 90 | SoftwareContext::qDrawBorderPixmap(painter, m_bounds.toRect(), m_margins, m_pixmap, QRect(0, 0, m_pixmap.width(), m_pixmap.height()), 91 | m_margins, Qt::StretchTile, QDrawBorderPixmap::DrawingHints(0)); 92 | } 93 | 94 | QRectF NinePatchNode::bounds() const 95 | { 96 | return m_bounds; 97 | } 98 | 99 | QT_END_NAMESPACE 100 | -------------------------------------------------------------------------------- /src/plugins/scenegraph/softwarecontext/softwarelayer.h: -------------------------------------------------------------------------------- 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 Qt Quick 2D Renderer module of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:GPL$ 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 General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU 19 | ** General Public License version 3 or (at your option) any later version 20 | ** approved by the KDE Free Qt Foundation. The licenses are as published by 21 | ** the Free Software Foundation and appearing in the file LICENSE.GPL3 22 | ** included in the packaging of this file. Please review the following 23 | ** information to ensure the GNU General Public License requirements will 24 | ** be met: https://www.gnu.org/licenses/gpl-3.0.html. 25 | ** 26 | ** $QT_END_LICENSE$ 27 | ** 28 | ****************************************************************************/ 29 | 30 | #ifndef SOFTWARELAYER_H 31 | #define SOFTWARELAYER_H 32 | 33 | #include 34 | #include 35 | 36 | QT_BEGIN_NAMESPACE 37 | 38 | namespace SoftwareContext { 39 | class PixmapRenderer; 40 | } 41 | 42 | class SoftwareLayer : public QSGLayer 43 | { 44 | Q_OBJECT 45 | public: 46 | SoftwareLayer(QSGRenderContext *renderContext); 47 | ~SoftwareLayer(); 48 | 49 | const QPixmap &pixmap() const { return m_pixmap; } 50 | 51 | // QSGTexture interface 52 | public: 53 | int textureId() const override; 54 | QSize textureSize() const override; 55 | bool hasAlphaChannel() const override; 56 | bool hasMipmaps() const override; 57 | void bind() override; 58 | 59 | // QSGDynamicTexture interface 60 | public: 61 | bool updateTexture() override; 62 | 63 | // QSGLayer interface 64 | public: 65 | void setItem(QSGNode *item) override; 66 | void setRect(const QRectF &rect) override; 67 | void setSize(const QSize &size) override; 68 | void scheduleUpdate() override; 69 | QImage toImage() const override; 70 | void setLive(bool live) override; 71 | void setRecursive(bool recursive) override; 72 | void setFormat(GLenum) override; 73 | void setHasMipmaps(bool) override; 74 | void setDevicePixelRatio(qreal ratio) override; 75 | void setMirrorHorizontal(bool mirror) override; 76 | void setMirrorVertical(bool mirror) override; 77 | 78 | public slots: 79 | void markDirtyTexture() override; 80 | void invalidated() override; 81 | 82 | private: 83 | void grab(); 84 | 85 | QSGNode *m_item; 86 | QSGRenderContext *m_context; 87 | SoftwareContext::PixmapRenderer *m_renderer; 88 | QRectF m_rect; 89 | QSize m_size; 90 | QPixmap m_pixmap; 91 | qreal m_device_pixel_ratio; 92 | bool m_mirrorHorizontal; 93 | bool m_mirrorVertical; 94 | bool m_live; 95 | bool m_grab; 96 | bool m_recursive; 97 | bool m_dirtyTexture; 98 | }; 99 | 100 | QT_END_NAMESPACE 101 | 102 | #endif // SOFTWARELAYER_H 103 | -------------------------------------------------------------------------------- /src/plugins/scenegraph/softwarecontext/pixmaprenderer.cpp: -------------------------------------------------------------------------------- 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 Qt Quick 2D Renderer module of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:GPL$ 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 General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU 19 | ** General Public License version 3 or (at your option) any later version 20 | ** approved by the KDE Free Qt Foundation. The licenses are as published by 21 | ** the Free Software Foundation and appearing in the file LICENSE.GPL3 22 | ** included in the packaging of this file. Please review the following 23 | ** information to ensure the GNU General Public License requirements will 24 | ** be met: https://www.gnu.org/licenses/gpl-3.0.html. 25 | ** 26 | ** $QT_END_LICENSE$ 27 | ** 28 | ****************************************************************************/ 29 | 30 | #include "pixmaprenderer.h" 31 | 32 | #include 33 | 34 | #include 35 | 36 | Q_LOGGING_CATEGORY(lcPixmapRenderer, "qt.scenegraph.softwarecontext.pixmapRenderer") 37 | 38 | QT_BEGIN_NAMESPACE 39 | 40 | namespace SoftwareContext { 41 | 42 | PixmapRenderer::PixmapRenderer(QSGRenderContext *context) 43 | : AbstractSoftwareRenderer(context) 44 | { 45 | 46 | } 47 | 48 | PixmapRenderer::~PixmapRenderer() 49 | { 50 | 51 | } 52 | 53 | void PixmapRenderer::renderScene(GLuint) 54 | { 55 | class B : public QSGBindable 56 | { 57 | public: 58 | void bind() const { } 59 | } bindable; 60 | QSGRenderer::renderScene(bindable); 61 | } 62 | 63 | void PixmapRenderer::render() 64 | { 65 | 66 | } 67 | 68 | void PixmapRenderer::render(QPixmap *target) 69 | { 70 | QElapsedTimer renderTimer; 71 | 72 | // Setup background item 73 | setBackgroundSize(target->size()); 74 | setBackgroundColor(clearColor()); 75 | 76 | QPainter painter(target); 77 | painter.setRenderHint(QPainter::Antialiasing); 78 | painter.setWindow(m_projectionRect); 79 | 80 | renderTimer.start(); 81 | buildRenderList(); 82 | qint64 buildRenderListTime = renderTimer.restart(); 83 | 84 | // Optimize Renderlist 85 | // Right now there is an assumption that when possible the same pixmap will 86 | // be reused. So we can treat it like a backing store in that we can assume 87 | // that when the pixmap is not being resized, the data can be reused. What is 88 | // different though is that everything should be marked as dirty on a resize. 89 | optimizeRenderList(); 90 | qint64 optimizeRenderListTime = renderTimer.restart(); 91 | 92 | QRegion paintedRegion = renderNodes(&painter); 93 | qint64 renderTime = renderTimer.elapsed(); 94 | 95 | qCDebug(lcPixmapRenderer) << "pixmapRender" << paintedRegion << buildRenderListTime << optimizeRenderListTime << renderTime; 96 | } 97 | 98 | void PixmapRenderer::setProjectionRect(const QRect &projectionRect) 99 | { 100 | m_projectionRect = projectionRect; 101 | } 102 | 103 | } // namespace 104 | 105 | QT_END_NAMESPACE 106 | -------------------------------------------------------------------------------- /src/plugins/scenegraph/softwarecontext/glyphnode.cpp: -------------------------------------------------------------------------------- 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 Qt Quick 2D Renderer module of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:GPL$ 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 General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU 19 | ** General Public License version 3 or (at your option) any later version 20 | ** approved by the KDE Free Qt Foundation. The licenses are as published by 21 | ** the Free Software Foundation and appearing in the file LICENSE.GPL3 22 | ** included in the packaging of this file. Please review the following 23 | ** information to ensure the GNU General Public License requirements will 24 | ** be met: https://www.gnu.org/licenses/gpl-3.0.html. 25 | ** 26 | ** $QT_END_LICENSE$ 27 | ** 28 | ****************************************************************************/ 29 | 30 | #include "glyphnode.h" 31 | 32 | QT_BEGIN_NAMESPACE 33 | 34 | GlyphNode::GlyphNode() 35 | : m_geometry(QSGGeometry::defaultAttributes_TexturedPoint2D(), 0) 36 | , m_style(QQuickText::Normal) 37 | { 38 | setMaterial((QSGMaterial*)1); 39 | setGeometry(&m_geometry); 40 | } 41 | 42 | 43 | void GlyphNode::setGlyphs(const QPointF &position, const QGlyphRun &glyphs) 44 | { 45 | m_position = position; 46 | m_glyphRun = glyphs; 47 | m_bounding_rect = glyphs.boundingRect().translated(m_position - QPointF(0.0, glyphs.rawFont().ascent())); 48 | } 49 | 50 | void GlyphNode::setColor(const QColor &color) 51 | { 52 | m_color = color; 53 | } 54 | 55 | void GlyphNode::setStyle(QQuickText::TextStyle style) 56 | { 57 | m_style = style; 58 | } 59 | 60 | void GlyphNode::setStyleColor(const QColor &color) 61 | { 62 | m_styleColor = color; 63 | } 64 | 65 | QPointF GlyphNode::baseLine() const 66 | { 67 | return QPointF(); 68 | } 69 | 70 | void GlyphNode::setPreferredAntialiasingMode(QSGGlyphNode::AntialiasingMode) 71 | { 72 | } 73 | 74 | void GlyphNode::update() 75 | { 76 | } 77 | 78 | void GlyphNode::paint(QPainter *painter) 79 | { 80 | painter->setBrush(QBrush()); 81 | QPointF pos = m_position - QPointF(0, m_glyphRun.rawFont().ascent()); 82 | 83 | switch (m_style) { 84 | case QQuickText::Normal: break; 85 | case QQuickText::Outline: 86 | painter->setPen(m_styleColor); 87 | painter->drawGlyphRun(pos + QPointF(0, 1), m_glyphRun); 88 | painter->drawGlyphRun(pos + QPointF(0, -1), m_glyphRun); 89 | painter->drawGlyphRun(pos + QPointF(1, 0), m_glyphRun); 90 | painter->drawGlyphRun(pos + QPointF(-1, 0), m_glyphRun); 91 | break; 92 | case QQuickText::Raised: 93 | painter->setPen(m_styleColor); 94 | painter->drawGlyphRun(pos + QPointF(0, 1), m_glyphRun); 95 | break; 96 | case QQuickText::Sunken: 97 | painter->setPen(m_styleColor); 98 | painter->drawGlyphRun(pos + QPointF(0, -1), m_glyphRun); 99 | break; 100 | } 101 | 102 | painter->setPen(m_color); 103 | painter->drawGlyphRun(pos, m_glyphRun); 104 | } 105 | 106 | QT_END_NAMESPACE 107 | -------------------------------------------------------------------------------- /src/doc/src/qtquick2drenderer-performance.qdoc: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | ** 3 | ** Copyright (C) 2015 The Qt Company Ltd. 4 | ** Contact: http://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the Qt Quick 2d Renderer module. 7 | ** 8 | ** $QT_BEGIN_LICENSE:COMM$ 9 | ** 10 | ** Commercial License Usage 11 | ** Licensees holding valid commercial Qt licenses may use this file in 12 | ** accordance with the commercial license agreement provided with the 13 | ** Software or, alternatively, in accordance with the terms contained in 14 | ** a written agreement between you and The Qt Company. For licensing terms 15 | ** and conditions see http://www.qt.io/terms-conditions. For further 16 | ** information use the contact form at http://www.qt.io/contact-us. 17 | ** 18 | ** $QT_END_LICENSE$ 19 | ** 20 | ******************************************************************************/ 21 | 22 | /*! 23 | \contentspage{index.html}{Qt Quick 2D Renderer} 24 | \page qtquick2drenderer-performance.html 25 | \previouspage qtquick2drenderer-limitations.html 26 | 27 | \title Performance Guide 28 | 29 | Since \RENDERER does not use OpenGL, we lose the ability to use many 30 | optimizations that can improve rendering speed. To get the most out of 31 | \RENDERER there are some guidelines that should be followed. 32 | 33 | \section1 2D Hardware Acceleration 34 | 35 | \RENDERER is designed to use operations that can be accelerated by 2D 36 | acceleration hardware. 2D hardware acceleration uses platform plugins that take advantage of 37 | the QBlitter API (like DirectFB). 38 | 39 | \section1 Animation 40 | 41 | It is important to keep in mind that with Qt Quick 2 the entire window will 42 | need to be rendered every time a node in the scene graph is marked dirty. 43 | There is no partial update mechanimism that will update only the dirty regions 44 | of the window. This means that any animation that is running will be forcing 45 | a full repaint of the window, and with \RENDERER this can cause a heavy CPU load. 46 | 47 | \section1 Transforms 48 | 49 | Transformations come with no performance penalty when rendering the scene 50 | graph with the OpenGL renderer. This is not the case with \RENDERER. 51 | Translation operations do not come with performance penalties, but scaling 52 | and rotation transformations should be avoided whenever possible. 53 | 54 | \section1 Hidden Items 55 | 56 | \RENDERER will paint all items that are not hidden explicitly with either 57 | the visibility property or with an opacity of 0. Without OpenGL there is no 58 | depth buffer to check for items completely obscured by opaque items, so 59 | everything will be painted - even if it is unnecessary. 60 | 61 | \section1 Pixel Fill Budget 62 | 63 | When developing an application that will be using \RENDERER, it is important 64 | to keep in mind your pixel fill budget, or the the amount of pixels you 65 | can push to the screen in the time needed for your target framerate. For 66 | example, if your goal is to render your application at 60 frames per second, 67 | then you have about 16 milliseconds render to the framebuffer before 68 | needing to flush the pixels to the screen. Depending on your hardware's 69 | performance, you will only be able to handle a finite amount of pixel write 70 | operations before the 16 milliseconds expire. The interface you design 71 | should take into consideration that each added item subtracts from 72 | your pixel fill budget. 73 | 74 | \RENDERER uses the painters algorithm to paint each item in the scene 75 | back-to-front. If you have an interface that stacks many items on top of 76 | each other, keep in mind that each layer is painted completely, not just the 77 | parts that are visible. It can be very easy to waste your pixel fill 78 | budget with too many over-paints. 79 | 80 | */ 81 | -------------------------------------------------------------------------------- /src/plugins/scenegraph/softwarecontext/renderablenode.h: -------------------------------------------------------------------------------- 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 Qt Quick 2D Renderer module of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:GPL$ 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 General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU 19 | ** General Public License version 3 or (at your option) any later version 20 | ** approved by the KDE Free Qt Foundation. The licenses are as published by 21 | ** the Free Software Foundation and appearing in the file LICENSE.GPL3 22 | ** included in the packaging of this file. Please review the following 23 | ** information to ensure the GNU General Public License requirements will 24 | ** be met: https://www.gnu.org/licenses/gpl-3.0.html. 25 | ** 26 | ** $QT_END_LICENSE$ 27 | ** 28 | ****************************************************************************/ 29 | 30 | #ifndef RENDERABLENODE_H 31 | #define RENDERABLENODE_H 32 | 33 | #include 34 | #include 35 | #include 36 | 37 | QT_BEGIN_NAMESPACE 38 | 39 | class QSGNode; 40 | class QSGSimpleRectNode; 41 | class QSGSimpleTextureNode; 42 | class ImageNode; 43 | class PainterNode; 44 | class RectangleNode; 45 | class GlyphNode; 46 | class NinePatchNode; 47 | 48 | namespace SoftwareContext{ 49 | 50 | class RenderableNode 51 | { 52 | public: 53 | enum NodeType { 54 | Invalid = -1, 55 | SimpleRect, 56 | SimpleTexture, 57 | Image, 58 | Painter, 59 | Rectangle, 60 | Glyph, 61 | NinePatch 62 | }; 63 | 64 | RenderableNode(NodeType type, QSGNode *node); 65 | ~RenderableNode(); 66 | 67 | void update(); 68 | 69 | QRegion renderNode(QPainter *painter, bool forceOpaquePainting = false); 70 | QRect boundingRect() const; 71 | NodeType type() const { return m_nodeType; } 72 | bool isOpaque() const { return m_isOpaque; } 73 | bool isDirty() const { return m_isDirty; } 74 | bool isDirtyRegionEmpty() const; 75 | 76 | void setTransform(const QTransform &transform); 77 | void setClipRect(const QRectF &clipRect); 78 | void setOpacity(float opacity); 79 | QTransform transform() const { return m_transform; } 80 | QRectF clipRect() const { return m_clipRect; } 81 | float opacity() const { return m_opacity; } 82 | 83 | void markGeometryDirty(); 84 | void markMaterialDirty(); 85 | 86 | void addDirtyRegion(const QRegion &dirtyRegion, bool forceDirty = true); 87 | void subtractDirtyRegion(const QRegion &dirtyRegion); 88 | 89 | QRegion previousDirtyRegion() const; 90 | QRegion dirtyRegion() const; 91 | 92 | private: 93 | union RenderableNodeHandle { 94 | QSGSimpleRectNode *simpleRectNode; 95 | QSGSimpleTextureNode *simpleTextureNode; 96 | ImageNode *imageNode; 97 | PainterNode *painterNode; 98 | RectangleNode *rectangleNode; 99 | GlyphNode *glpyhNode; 100 | NinePatchNode *ninePatchNode; 101 | }; 102 | 103 | const NodeType m_nodeType; 104 | RenderableNodeHandle m_handle; 105 | 106 | bool m_isOpaque; 107 | 108 | bool m_isDirty; 109 | QRegion m_dirtyRegion; 110 | QRegion m_previousDirtyRegion; 111 | 112 | QTransform m_transform; 113 | QRectF m_clipRect; 114 | float m_opacity; 115 | 116 | QRect m_boundingRect; 117 | }; 118 | 119 | } // namespace 120 | 121 | QT_END_NAMESPACE 122 | 123 | #endif // RENDERABLENODE_H 124 | -------------------------------------------------------------------------------- /src/plugins/scenegraph/softwarecontext/painternode.h: -------------------------------------------------------------------------------- 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 Qt Quick 2D Renderer module of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:GPL$ 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 General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU 19 | ** General Public License version 3 or (at your option) any later version 20 | ** approved by the KDE Free Qt Foundation. The licenses are as published by 21 | ** the Free Software Foundation and appearing in the file LICENSE.GPL3 22 | ** included in the packaging of this file. Please review the following 23 | ** information to ensure the GNU General Public License requirements will 24 | ** be met: https://www.gnu.org/licenses/gpl-3.0.html. 25 | ** 26 | ** $QT_END_LICENSE$ 27 | ** 28 | ****************************************************************************/ 29 | 30 | #ifndef PAINTERNODE_H 31 | #define PAINTERNODE_H 32 | 33 | #include 34 | #include 35 | 36 | #include 37 | 38 | QT_BEGIN_NAMESPACE 39 | 40 | class PainterNode : public QSGPainterNode 41 | { 42 | public: 43 | PainterNode(QQuickPaintedItem *item); 44 | ~PainterNode(); 45 | 46 | void setPreferredRenderTarget(QQuickPaintedItem::RenderTarget target) override; 47 | 48 | void setSize(const QSize &size) override; 49 | QSize size() const { return m_size; } 50 | 51 | void setDirty(const QRect &dirtyRect = QRect()) override; 52 | 53 | void setOpaquePainting(bool opaque) override; 54 | bool opaquePainting() const { return m_opaquePainting; } 55 | 56 | void setLinearFiltering(bool linearFiltering) override; 57 | bool linearFiltering() const { return m_linear_filtering; } 58 | 59 | void setMipmapping(bool mipmapping) override; 60 | bool mipmapping() const { return m_mipmapping; } 61 | 62 | void setSmoothPainting(bool s) override; 63 | bool smoothPainting() const { return m_smoothPainting; } 64 | 65 | void setFillColor(const QColor &c) override; 66 | QColor fillColor() const { return m_fillColor; } 67 | 68 | void setContentsScale(qreal s) override; 69 | qreal contentsScale() const { return m_contentsScale; } 70 | 71 | void setFastFBOResizing(bool dynamic) override; 72 | bool fastFBOResizing() const { return m_fastFBOResizing; } 73 | 74 | QImage toImage() const override; 75 | void update() override; 76 | QSGTexture *texture() const override { return m_texture; } 77 | 78 | void paint(QPainter *painter); 79 | 80 | void paint(); 81 | 82 | void setTextureSize(const QSize &size) override; 83 | QSize textureSize() const { return m_textureSize; } 84 | 85 | private: 86 | 87 | QQuickPaintedItem::RenderTarget m_preferredRenderTarget; 88 | QQuickPaintedItem::RenderTarget m_actualRenderTarget; 89 | 90 | QQuickPaintedItem *m_item; 91 | 92 | QPixmap m_pixmap; 93 | QSGTexture *m_texture; 94 | 95 | QSize m_size; 96 | bool m_dirtyContents; 97 | QRect m_dirtyRect; 98 | bool m_opaquePainting; 99 | bool m_linear_filtering; 100 | bool m_mipmapping; 101 | bool m_smoothPainting; 102 | bool m_extensionsChecked; 103 | bool m_multisamplingSupported; 104 | bool m_fastFBOResizing; 105 | QColor m_fillColor; 106 | qreal m_contentsScale; 107 | QSize m_textureSize; 108 | 109 | bool m_dirtyGeometry; 110 | }; 111 | 112 | QT_END_NAMESPACE 113 | 114 | #endif // PAINTERNODE_H 115 | -------------------------------------------------------------------------------- /src/plugins/scenegraph/softwarecontext/renderlistbuilder.cpp: -------------------------------------------------------------------------------- 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 Qt Quick 2D Renderer module of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:GPL$ 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 General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU 19 | ** General Public License version 3 or (at your option) any later version 20 | ** approved by the KDE Free Qt Foundation. The licenses are as published by 21 | ** the Free Software Foundation and appearing in the file LICENSE.GPL3 22 | ** included in the packaging of this file. Please review the following 23 | ** information to ensure the GNU General Public License requirements will 24 | ** be met: https://www.gnu.org/licenses/gpl-3.0.html. 25 | ** 26 | ** $QT_END_LICENSE$ 27 | ** 28 | ****************************************************************************/ 29 | 30 | #include "renderlistbuilder.h" 31 | 32 | #include "renderablenode.h" 33 | #include "abstractsoftwarerenderer.h" 34 | #include "imagenode.h" 35 | #include "rectanglenode.h" 36 | #include "glyphnode.h" 37 | #include "ninepatchnode.h" 38 | #include "painternode.h" 39 | #include "pixmaptexture.h" 40 | 41 | #include 42 | #include 43 | 44 | QT_BEGIN_NAMESPACE 45 | 46 | namespace SoftwareContext { 47 | 48 | 49 | RenderListBuilder::RenderListBuilder(AbstractSoftwareRenderer *renderer) 50 | : m_renderer(renderer) 51 | { 52 | 53 | } 54 | 55 | bool RenderListBuilder::visit(QSGTransformNode *) 56 | { 57 | return true; 58 | } 59 | 60 | void RenderListBuilder::endVisit(QSGTransformNode *) 61 | { 62 | } 63 | 64 | bool RenderListBuilder::visit(QSGClipNode *) 65 | { 66 | return true; 67 | } 68 | 69 | void RenderListBuilder::endVisit(QSGClipNode *) 70 | { 71 | } 72 | 73 | bool RenderListBuilder::visit(QSGGeometryNode *node) 74 | { 75 | return addRenderableNode(node); 76 | } 77 | 78 | void RenderListBuilder::endVisit(QSGGeometryNode *) 79 | { 80 | } 81 | 82 | bool RenderListBuilder::visit(QSGOpacityNode *) 83 | { 84 | return true; 85 | } 86 | 87 | void RenderListBuilder::endVisit(QSGOpacityNode *) 88 | { 89 | } 90 | 91 | bool RenderListBuilder::visit(QSGImageNode *node) 92 | { 93 | return addRenderableNode(node); 94 | } 95 | 96 | void RenderListBuilder::endVisit(QSGImageNode *) 97 | { 98 | } 99 | 100 | bool RenderListBuilder::visit(QSGPainterNode *node) 101 | { 102 | return addRenderableNode(node); 103 | } 104 | 105 | void RenderListBuilder::endVisit(QSGPainterNode *) 106 | { 107 | } 108 | 109 | bool RenderListBuilder::visit(QSGRectangleNode *node) 110 | { 111 | return addRenderableNode(node); 112 | } 113 | 114 | void RenderListBuilder::endVisit(QSGRectangleNode *) 115 | { 116 | } 117 | 118 | bool RenderListBuilder::visit(QSGGlyphNode *node) 119 | { 120 | return addRenderableNode(node); 121 | } 122 | 123 | void RenderListBuilder::endVisit(QSGGlyphNode *) 124 | { 125 | } 126 | 127 | bool RenderListBuilder::visit(QSGNinePatchNode *node) 128 | { 129 | return addRenderableNode(node); 130 | } 131 | 132 | void RenderListBuilder::endVisit(QSGNinePatchNode *) 133 | { 134 | } 135 | 136 | bool RenderListBuilder::visit(QSGRootNode *) 137 | { 138 | return true; 139 | } 140 | 141 | void RenderListBuilder::endVisit(QSGRootNode *) 142 | { 143 | } 144 | 145 | bool RenderListBuilder::addRenderableNode(QSGNode *node) 146 | { 147 | auto renderableNode = m_renderer->renderableNode(node); 148 | if (renderableNode == nullptr) { 149 | // Not a node we can render 150 | return false; 151 | } 152 | m_renderer->appendRenderableNode(renderableNode); 153 | return true; 154 | } 155 | 156 | } // namespace 157 | 158 | QT_END_NAMESPACE 159 | -------------------------------------------------------------------------------- /src/plugins/scenegraph/softwarecontext/renderablenodeupdater.h: -------------------------------------------------------------------------------- 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 Qt Quick 2D Renderer module of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:GPL$ 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 General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU 19 | ** General Public License version 3 or (at your option) any later version 20 | ** approved by the KDE Free Qt Foundation. The licenses are as published by 21 | ** the Free Software Foundation and appearing in the file LICENSE.GPL3 22 | ** included in the packaging of this file. Please review the following 23 | ** information to ensure the GNU General Public License requirements will 24 | ** be met: https://www.gnu.org/licenses/gpl-3.0.html. 25 | ** 26 | ** $QT_END_LICENSE$ 27 | ** 28 | ****************************************************************************/ 29 | 30 | #ifndef RENDERABLENODEUPDATER_H 31 | #define RENDERABLENODEUPDATER_H 32 | 33 | #include "renderablenode.h" 34 | #include "abstractsoftwarerenderer.h" 35 | 36 | #include 37 | 38 | #include 39 | #include 40 | #include 41 | 42 | QT_BEGIN_NAMESPACE 43 | 44 | namespace SoftwareContext { 45 | 46 | class RenderableNodeUpdater : public QSGNodeVisitorEx 47 | { 48 | public: 49 | RenderableNodeUpdater(AbstractSoftwareRenderer *renderer); 50 | virtual ~RenderableNodeUpdater(); 51 | 52 | bool visit(QSGTransformNode *) override; 53 | void endVisit(QSGTransformNode *) override; 54 | bool visit(QSGClipNode *) override; 55 | void endVisit(QSGClipNode *) override; 56 | bool visit(QSGGeometryNode *) override; 57 | void endVisit(QSGGeometryNode *) override; 58 | bool visit(QSGOpacityNode *) override; 59 | void endVisit(QSGOpacityNode *) override; 60 | bool visit(QSGImageNode *) override; 61 | void endVisit(QSGImageNode *) override; 62 | bool visit(QSGPainterNode *) override; 63 | void endVisit(QSGPainterNode *) override; 64 | bool visit(QSGRectangleNode *) override; 65 | void endVisit(QSGRectangleNode *) override; 66 | bool visit(QSGGlyphNode *) override; 67 | void endVisit(QSGGlyphNode *) override; 68 | bool visit(QSGNinePatchNode *) override; 69 | void endVisit(QSGNinePatchNode *) override; 70 | bool visit(QSGRootNode *) override; 71 | void endVisit(QSGRootNode *) override; 72 | 73 | void updateNodes(QSGNode *node, bool isNodeRemoved = false); 74 | 75 | private: 76 | struct NodeState { 77 | float opacity; 78 | QRectF clip; 79 | QTransform transform; 80 | QSGNode *parent; 81 | }; 82 | 83 | NodeState currentState(QSGNode *node) const; 84 | 85 | template 86 | bool updateRenderableNode(RenderableNode::NodeType type, NODE *node); 87 | 88 | AbstractSoftwareRenderer *m_renderer; 89 | QStack m_opacityState; 90 | QStack m_clipState; 91 | QStack m_transformState; 92 | QHash m_stateMap; 93 | }; 94 | 95 | template 96 | bool RenderableNodeUpdater::updateRenderableNode(RenderableNode::NodeType type, NODE *node) 97 | { 98 | //Check if we already know about node 99 | auto renderableNode = m_renderer->renderableNode(node); 100 | if (renderableNode == nullptr) { 101 | renderableNode = new RenderableNode(type, node); 102 | m_renderer->addNodeMapping(node, renderableNode); 103 | } 104 | 105 | //Update the node 106 | renderableNode->setTransform(m_transformState.top()); 107 | renderableNode->setOpacity(m_opacityState.top()); 108 | renderableNode->setClipRect(m_clipState.top()); 109 | 110 | renderableNode->update(); 111 | m_stateMap[node] = currentState(node); 112 | 113 | return true; 114 | } 115 | 116 | } // namespace 117 | 118 | QT_END_NAMESPACE 119 | 120 | #endif // RENDERABLENODEUPDATER_H 121 | -------------------------------------------------------------------------------- /src/plugins/scenegraph/softwarecontext/imagenode.h: -------------------------------------------------------------------------------- 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 Qt Quick 2D Renderer module of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:GPL$ 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 General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU 19 | ** General Public License version 3 or (at your option) any later version 20 | ** approved by the KDE Free Qt Foundation. The licenses are as published by 21 | ** the Free Software Foundation and appearing in the file LICENSE.GPL3 22 | ** included in the packaging of this file. Please review the following 23 | ** information to ensure the GNU General Public License requirements will 24 | ** be met: https://www.gnu.org/licenses/gpl-3.0.html. 25 | ** 26 | ** $QT_END_LICENSE$ 27 | ** 28 | ****************************************************************************/ 29 | 30 | #ifndef IMAGENODE_H 31 | #define IMAGENODE_H 32 | 33 | #include 34 | #include 35 | 36 | QT_BEGIN_NAMESPACE 37 | 38 | typedef QVarLengthArray QPixmapFragmentsArray; 39 | 40 | struct QTileRules 41 | { 42 | inline QTileRules(Qt::TileRule horizontalRule, Qt::TileRule verticalRule) 43 | : horizontal(horizontalRule), vertical(verticalRule) {} 44 | inline QTileRules(Qt::TileRule rule = Qt::StretchTile) 45 | : horizontal(rule), vertical(rule) {} 46 | Qt::TileRule horizontal; 47 | Qt::TileRule vertical; 48 | }; 49 | 50 | #ifndef Q_QDOC 51 | // For internal use only. 52 | namespace QDrawBorderPixmap 53 | { 54 | enum DrawingHint 55 | { 56 | OpaqueTopLeft = 0x0001, 57 | OpaqueTop = 0x0002, 58 | OpaqueTopRight = 0x0004, 59 | OpaqueLeft = 0x0008, 60 | OpaqueCenter = 0x0010, 61 | OpaqueRight = 0x0020, 62 | OpaqueBottomLeft = 0x0040, 63 | OpaqueBottom = 0x0080, 64 | OpaqueBottomRight = 0x0100, 65 | OpaqueCorners = OpaqueTopLeft | OpaqueTopRight | OpaqueBottomLeft | OpaqueBottomRight, 66 | OpaqueEdges = OpaqueTop | OpaqueLeft | OpaqueRight | OpaqueBottom, 67 | OpaqueFrame = OpaqueCorners | OpaqueEdges, 68 | OpaqueAll = OpaqueCenter | OpaqueFrame 69 | }; 70 | 71 | Q_DECLARE_FLAGS(DrawingHints, DrawingHint) 72 | } 73 | #endif 74 | 75 | namespace SoftwareContext { 76 | 77 | void qDrawBorderPixmap(QPainter *painter, const QRect &targetRect, const QMargins &targetMargins, 78 | const QPixmap &pixmap, const QRect &sourceRect,const QMargins &sourceMargins, 79 | const QTileRules &rules, QDrawBorderPixmap::DrawingHints hints); 80 | 81 | } 82 | 83 | class ImageNode : public QSGImageNode 84 | { 85 | public: 86 | ImageNode(); 87 | 88 | void setTargetRect(const QRectF &rect) override; 89 | void setInnerTargetRect(const QRectF &rect) override; 90 | void setInnerSourceRect(const QRectF &rect) override; 91 | void setSubSourceRect(const QRectF &rect) override; 92 | void setTexture(QSGTexture *texture) override; 93 | void setMirror(bool mirror) override; 94 | void setMipmapFiltering(QSGTexture::Filtering filtering) override; 95 | void setFiltering(QSGTexture::Filtering filtering) override; 96 | void setHorizontalWrapMode(QSGTexture::WrapMode wrapMode) override; 97 | void setVerticalWrapMode(QSGTexture::WrapMode wrapMode) override; 98 | void update() override; 99 | 100 | void preprocess() override; 101 | 102 | void paint(QPainter *painter); 103 | 104 | QRectF rect() const; 105 | 106 | private: 107 | const QPixmap &pixmap() const; 108 | 109 | QRectF m_targetRect; 110 | QRectF m_innerTargetRect; 111 | QRectF m_innerSourceRect; 112 | QRectF m_subSourceRect; 113 | 114 | QSGTexture *m_texture; 115 | QPixmap m_cachedMirroredPixmap; 116 | 117 | bool m_mirror; 118 | bool m_smooth; 119 | bool m_tileHorizontal; 120 | bool m_tileVertical; 121 | bool m_cachedMirroredPixmapIsDirty; 122 | }; 123 | 124 | QT_END_NAMESPACE 125 | 126 | #endif // IMAGENODE_H 127 | -------------------------------------------------------------------------------- /src/doc/src/qtquick2drenderer-installation-guide.qdoc: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | ** 3 | ** Copyright (C) 2015 The Qt Company Ltd. 4 | ** Contact: http://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the Qt Quick 2d Renderer module. 7 | ** 8 | ** $QT_BEGIN_LICENSE:COMM$ 9 | ** 10 | ** Commercial License Usage 11 | ** Licensees holding valid commercial Qt licenses may use this file in 12 | ** accordance with the commercial license agreement provided with the 13 | ** Software or, alternatively, in accordance with the terms contained in 14 | ** a written agreement between you and The Qt Company. For licensing terms 15 | ** and conditions see http://www.qt.io/terms-conditions. For further 16 | ** information use the contact form at http://www.qt.io/contact-us. 17 | ** 18 | ** $QT_END_LICENSE$ 19 | ** 20 | ******************************************************************************/ 21 | 22 | /*! 23 | \page qtquick2drenderer-installation-guide.html 24 | \previouspage index.html 25 | \nextpage qtquick2drenderer-limitations.html 26 | 27 | \title Installation Guide 28 | 29 | The building of \RENDERER is complicated by the fact that \l{Qt Quick} 2 30 | always requires OpenGL support regardless of whether it is being used or 31 | not. You will need to build Qt with support for OpenGL even if the target 32 | system does not support it. If you have a Qt build that already supports 33 | OpenGL, you can skip to \l {building-renderer}{Building \RENDERER}. 34 | 35 | \section1 Providing the OpenGL Dependency 36 | 37 | \RENDERER works in such a way that it renders the Qt Quick 2 scene 38 | graph with QPainter, instead of using hardware acceleration via the OpenGL API. 39 | However, Qt Quick 2 still assumes that OpenGL is always available. With 40 | \RENDERER we can avoid making OpenGL calls, but that does not change the 41 | fact that QtQuick 2 requires the OpenGL development headers to be available 42 | at build-time and will link against OpenGL libraries at run-time. 43 | 44 | The solution is to provide a dummy OpenGL library and development 45 | headers to build Qt against. In this way you can build Qt with virtual OpenGL 46 | support and get access to the QtQuick 2 APIs. You should have no problems 47 | using \RENDERER provided that you use a platform plugin that does not make calls to 48 | EGL or OpenGL commands, and that you refrain from using APIs that access OpenGL directly. 49 | 50 | \section1 How to use the OpenGL Dummy Libraries 51 | 52 | The OpenGL dummy libraries provide both headers and shared object files 53 | containing the symbols for both OpenGL and EGL. The headers get copied 54 | into your INCLUDE path, and the shared object files get copied into your LIB 55 | path in both the sysroot, as well as in the target image distributed on the 56 | device. The library that is generated contains all the symbols needed to 57 | link an application as if you had support for OpenGL and EGL. It is important 58 | to make sure that you do not call any of these symbols in your application. 59 | 60 | \section2 Prerequisites 61 | 62 | Three elements are required: 63 | \list 1 64 | \li Toolchain to cross compile code for your device. 65 | \li Sysroot containing development headers and shared objects to link 66 | against when building applications. 67 | \li Target image intended to be deployed to your device. 68 | \endlist 69 | 70 | \section2 How to build the OpenGL Dummy Libraries 71 | 72 | Set up your build environment by defining where your compiler and sysroot 73 | are located: 74 | \badcode 75 | export CC=/opt/arm-toolchain/usr/bin/arm-linux-gnueabi-g++ 76 | export SYSROOT=/opt/device-name/sysroot/ 77 | \endcode 78 | Run the build script inside the client-dummy directory: 79 | \badcode 80 | cd client-dummy 81 | ./build-gcc.sh 82 | \endcode 83 | That should generate two files: \c libEGL.so, \c libGLESv2.so 84 | 85 | \section2 Installation of Files 86 | 87 | Copy the include folder to the /usr/include folder in your sysroot. This 88 | installs the OpenGL/EGL headers: 89 | \badcode 90 | cp -r 3rdparty/include/* ${SYSROOT}/usr/include/ 91 | \endcode 92 | Copy \c libEGL.so and \c libGLESv2.so to the /usr/lib folder in your sysroot: 93 | \badcode 94 | cp src/lib*.so ${SYSROOT}/usr/lib/ 95 | \endcode 96 | 97 | Copy the \c libEGL.so and \c libGLESv2.so libraries to the target device image as well. 98 | 99 | \section1 Building Qt 100 | 101 | When configuring Qt, make sure to append \c {-opengl es2} to your configure arguments. 102 | 103 | \target building-renderer 104 | \section1 Building \RENDERER 105 | 106 | Build \RENDERER like any other Qt module: 107 | \badcode 108 | qmake 109 | make 110 | make install 111 | \endcode 112 | 113 | \section1 Deployment 114 | 115 | Now, when you deploy your Qt build to the device, it will depend on the dummy 116 | libs \c libEGL.so and \c libGLESv2.so, but as long as you are using the \RENDERER 117 | plugin you will be able to use Qt Quick 2 without actually making any 118 | OpenGL or EGL calls. 119 | 120 | */ 121 | -------------------------------------------------------------------------------- /tools/opengldummy/3rdparty/include/EGL/eglplatform.h: -------------------------------------------------------------------------------- 1 | #ifndef __eglplatform_h_ 2 | #define __eglplatform_h_ 3 | 4 | /* 5 | ** Copyright (c) 2007-2013 The Khronos Group Inc. 6 | ** 7 | ** Permission is hereby granted, free of charge, to any person obtaining a 8 | ** copy of this software and/or associated documentation files (the 9 | ** "Materials"), to deal in the Materials without restriction, including 10 | ** without limitation the rights to use, copy, modify, merge, publish, 11 | ** distribute, sublicense, and/or sell copies of the Materials, and to 12 | ** permit persons to whom the Materials are furnished to do so, subject to 13 | ** the following conditions: 14 | ** 15 | ** The above copyright notice and this permission notice shall be included 16 | ** in all copies or substantial portions of the Materials. 17 | ** 18 | ** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | ** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 20 | ** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 21 | ** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 22 | ** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 23 | ** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 24 | ** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. 25 | */ 26 | 27 | /* Platform-specific types and definitions for egl.h 28 | * $Revision: 23432 $ on $Date: 2013-10-09 00:57:24 -0700 (Wed, 09 Oct 2013) $ 29 | * 30 | * Adopters may modify khrplatform.h and this file to suit their platform. 31 | * You are encouraged to submit all modifications to the Khronos group so that 32 | * they can be included in future versions of this file. Please submit changes 33 | * by sending them to the public Khronos Bugzilla (http://khronos.org/bugzilla) 34 | * by filing a bug against product "EGL" component "Registry". 35 | */ 36 | 37 | #include 38 | 39 | /* Macros used in EGL function prototype declarations. 40 | * 41 | * EGL functions should be prototyped as: 42 | * 43 | * EGLAPI return-type EGLAPIENTRY eglFunction(arguments); 44 | * typedef return-type (EXPAPIENTRYP PFNEGLFUNCTIONPROC) (arguments); 45 | * 46 | * KHRONOS_APICALL and KHRONOS_APIENTRY are defined in KHR/khrplatform.h 47 | */ 48 | 49 | #ifndef EGLAPI 50 | #define EGLAPI KHRONOS_APICALL 51 | #endif 52 | 53 | #ifndef EGLAPIENTRY 54 | #define EGLAPIENTRY KHRONOS_APIENTRY 55 | #endif 56 | #define EGLAPIENTRYP EGLAPIENTRY* 57 | 58 | /* The types NativeDisplayType, NativeWindowType, and NativePixmapType 59 | * are aliases of window-system-dependent types, such as X Display * or 60 | * Windows Device Context. They must be defined in platform-specific 61 | * code below. The EGL-prefixed versions of Native*Type are the same 62 | * types, renamed in EGL 1.3 so all types in the API start with "EGL". 63 | * 64 | * Khronos STRONGLY RECOMMENDS that you use the default definitions 65 | * provided below, since these changes affect both binary and source 66 | * portability of applications using EGL running on different EGL 67 | * implementations. 68 | */ 69 | 70 | #if defined(_WIN32) || defined(__VC32__) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__) /* Win32 and WinCE */ 71 | 72 | #if 1 73 | /* QtGlesStream */ 74 | typedef unsigned int EGLNativeDisplayType; 75 | typedef unsigned int EGLNativeWindowType; 76 | typedef unsigned int EGLNativePixmapType; 77 | #else 78 | #ifndef WIN32_LEAN_AND_MEAN 79 | #define WIN32_LEAN_AND_MEAN 1 80 | #endif 81 | #include 82 | 83 | typedef HDC EGLNativeDisplayType; 84 | typedef HBITMAP EGLNativePixmapType; 85 | typedef HWND EGLNativeWindowType; 86 | #endif 87 | 88 | #elif defined(__WINSCW__) || defined(__SYMBIAN32__) /* Symbian */ 89 | 90 | typedef int EGLNativeDisplayType; 91 | typedef void *EGLNativeWindowType; 92 | typedef void *EGLNativePixmapType; 93 | 94 | #elif defined(__ANDROID__) || defined(ANDROID) 95 | 96 | #include 97 | 98 | struct egl_native_pixmap_t; 99 | 100 | typedef struct ANativeWindow* EGLNativeWindowType; 101 | typedef struct egl_native_pixmap_t* EGLNativePixmapType; 102 | typedef void* EGLNativeDisplayType; 103 | 104 | #elif defined(__unix__) || (defined(__APPLE__) && defined(__MACH__)) 105 | #if 1 106 | 107 | /* QtGlesStream */ 108 | typedef unsigned int EGLNativeDisplayType; 109 | typedef unsigned int EGLNativeWindowType; 110 | typedef unsigned int EGLNativePixmapType; 111 | 112 | #else 113 | 114 | /* X11 (tentative) */ 115 | #include 116 | #include 117 | 118 | typedef Display *EGLNativeDisplayType; 119 | typedef Pixmap EGLNativePixmapType; 120 | typedef Window EGLNativeWindowType; 121 | 122 | #endif 123 | 124 | #else 125 | #error "Platform not recognized" 126 | #endif 127 | 128 | /* EGL 1.2 types, renamed for consistency in EGL 1.3 */ 129 | typedef EGLNativeDisplayType NativeDisplayType; 130 | typedef EGLNativePixmapType NativePixmapType; 131 | typedef EGLNativeWindowType NativeWindowType; 132 | 133 | 134 | /* Define EGLint. This must be a signed integral type large enough to contain 135 | * all legal attribute names and values passed into and out of EGL, whether 136 | * their type is boolean, bitmask, enumerant (symbolic constant), integer, 137 | * handle, or other. While in general a 32-bit integer will suffice, if 138 | * handles are 64 bit types, then EGLint should be defined as a signed 64-bit 139 | * integer type. 140 | */ 141 | typedef khronos_int32_t EGLint; 142 | 143 | #endif /* __eglplatform_h */ 144 | -------------------------------------------------------------------------------- /tools/opengldummy/src/egl.cpp: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | ** 3 | ** Copyright (C) 2015 The Qt Company Ltd. 4 | ** Contact: http://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the Qt Quick 2d Renderer module. 7 | ** 8 | ** $QT_BEGIN_LICENSE:COMM$ 9 | ** 10 | ** Commercial License Usage 11 | ** Licensees holding valid commercial Qt licenses may use this file in 12 | ** accordance with the commercial license agreement provided with the 13 | ** Software or, alternatively, in accordance with the terms contained in 14 | ** a written agreement between you and The Qt Company. For licensing terms 15 | ** and conditions see http://www.qt.io/terms-conditions. For further 16 | ** information use the contact form at http://www.qt.io/contact-us. 17 | ** 18 | ** $QT_END_LICENSE$ 19 | ** 20 | ******************************************************************************/ 21 | 22 | #include 23 | 24 | extern "C" { 25 | 26 | EGLAPI EGLBoolean EGLAPIENTRY eglChooseConfig(EGLDisplay dpy, const EGLint * attrib_list, EGLConfig* configs, EGLint config_size, EGLint* num_config) 27 | { 28 | return 0; 29 | } 30 | 31 | EGLAPI EGLBoolean EGLAPIENTRY eglCopyBuffers(EGLDisplay dpy, EGLSurface surface, EGLNativePixmapType target) 32 | { 33 | return 0; 34 | } 35 | 36 | EGLAPI EGLContext EGLAPIENTRY eglCreateContext(EGLDisplay dpy, EGLConfig config, EGLContext share_context, const EGLint * attrib_list) 37 | { 38 | return 0; 39 | } 40 | 41 | EGLAPI EGLSurface EGLAPIENTRY eglCreatePbufferSurface(EGLDisplay dpy, EGLConfig config, const EGLint * attrib_list) 42 | { 43 | return 0; 44 | } 45 | 46 | EGLAPI EGLSurface EGLAPIENTRY eglCreatePixmapSurface(EGLDisplay dpy, EGLConfig config, EGLNativePixmapType pixmap, const EGLint * attrib_list) 47 | { 48 | return 0; 49 | } 50 | 51 | EGLAPI EGLSurface EGLAPIENTRY eglCreateWindowSurface(EGLDisplay dpy, EGLConfig config, EGLNativeWindowType win, const EGLint * attrib_list) 52 | { 53 | return 0; 54 | } 55 | 56 | EGLAPI EGLBoolean EGLAPIENTRY eglDestroyContext(EGLDisplay dpy, EGLContext ctx) 57 | { 58 | return 0; 59 | } 60 | 61 | EGLAPI EGLBoolean EGLAPIENTRY eglDestroySurface(EGLDisplay dpy, EGLSurface surface) 62 | { 63 | return 0; 64 | } 65 | 66 | EGLAPI EGLBoolean EGLAPIENTRY eglGetConfigAttrib(EGLDisplay dpy, EGLConfig config, EGLint attribute, EGLint* value) 67 | { 68 | return 0; 69 | } 70 | 71 | EGLAPI EGLBoolean EGLAPIENTRY eglGetConfigs(EGLDisplay dpy, EGLConfig* configs, EGLint config_size, EGLint* num_config) 72 | { 73 | return 0; 74 | } 75 | 76 | EGLAPI EGLDisplay EGLAPIENTRY eglGetCurrentDisplay() 77 | { 78 | return 0; 79 | } 80 | 81 | EGLAPI EGLSurface EGLAPIENTRY eglGetCurrentSurface(EGLint readdraw) 82 | { 83 | return 0; 84 | } 85 | 86 | EGLAPI EGLDisplay EGLAPIENTRY eglGetDisplay(EGLNativeDisplayType display_id) 87 | { 88 | return 0; 89 | } 90 | 91 | EGLAPI EGLint EGLAPIENTRY eglGetError() 92 | { 93 | return 0; 94 | } 95 | 96 | EGLAPI __eglMustCastToProperFunctionPointerType EGLAPIENTRY eglGetProcAddress(const char * procname) 97 | { 98 | return 0; 99 | } 100 | 101 | EGLAPI EGLBoolean EGLAPIENTRY eglInitialize(EGLDisplay dpy, EGLint* major, EGLint* minor) 102 | { 103 | return 0; 104 | } 105 | 106 | EGLAPI EGLBoolean EGLAPIENTRY eglMakeCurrent(EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx) 107 | { 108 | return 0; 109 | } 110 | 111 | EGLAPI EGLBoolean EGLAPIENTRY eglQueryContext(EGLDisplay dpy, EGLContext ctx, EGLint attribute, EGLint* value) 112 | { 113 | return 0; 114 | } 115 | 116 | EGLAPI const char * EGLAPIENTRY eglQueryString(EGLDisplay dpy, EGLint name) 117 | { 118 | return 0; 119 | } 120 | 121 | EGLAPI EGLBoolean EGLAPIENTRY eglQuerySurface(EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint* value) 122 | { 123 | return 0; 124 | } 125 | 126 | EGLAPI EGLBoolean EGLAPIENTRY eglSwapBuffers(EGLDisplay dpy, EGLSurface surface) 127 | { 128 | return 0; 129 | } 130 | 131 | EGLAPI EGLBoolean EGLAPIENTRY eglTerminate(EGLDisplay dpy) 132 | { 133 | return 0; 134 | } 135 | 136 | EGLAPI EGLBoolean EGLAPIENTRY eglWaitGL() 137 | { 138 | return 0; 139 | } 140 | 141 | EGLAPI EGLBoolean EGLAPIENTRY eglWaitNative(EGLint engine) 142 | { 143 | return 0; 144 | } 145 | 146 | EGLAPI EGLBoolean EGLAPIENTRY eglBindTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer) 147 | { 148 | return 0; 149 | } 150 | 151 | EGLAPI EGLBoolean EGLAPIENTRY eglReleaseTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer) 152 | { 153 | return 0; 154 | } 155 | 156 | EGLAPI EGLBoolean EGLAPIENTRY eglSurfaceAttrib(EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint value) 157 | { 158 | return 0; 159 | } 160 | 161 | EGLAPI EGLBoolean EGLAPIENTRY eglSwapInterval(EGLDisplay dpy, EGLint interval) 162 | { 163 | return 0; 164 | } 165 | 166 | EGLAPI EGLBoolean EGLAPIENTRY eglBindAPI(EGLenum api) 167 | { 168 | return 0; 169 | } 170 | 171 | EGLAPI EGLSurface EGLAPIENTRY eglCreatePbufferFromClientBuffer(EGLDisplay dpy, EGLenum buftype, EGLClientBuffer buffer, EGLConfig config, const EGLint * attrib_list) 172 | { 173 | return 0; 174 | } 175 | 176 | EGLAPI EGLenum EGLAPIENTRY eglQueryAPI() 177 | { 178 | return 0; 179 | } 180 | 181 | EGLAPI EGLBoolean EGLAPIENTRY eglReleaseThread() 182 | { 183 | return 0; 184 | } 185 | 186 | EGLAPI EGLBoolean EGLAPIENTRY eglWaitClient() 187 | { 188 | return 0; 189 | } 190 | 191 | EGLAPI EGLContext EGLAPIENTRY eglGetCurrentContext() 192 | { 193 | return 0; 194 | } 195 | 196 | } // extern "C" 197 | 198 | -------------------------------------------------------------------------------- /src/plugins/scenegraph/softwarecontext/context.cpp: -------------------------------------------------------------------------------- 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 Qt Quick 2D Renderer module of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:GPL$ 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 General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU 19 | ** General Public License version 3 or (at your option) any later version 20 | ** approved by the KDE Free Qt Foundation. The licenses are as published by 21 | ** the Free Software Foundation and appearing in the file LICENSE.GPL3 22 | ** included in the packaging of this file. Please review the following 23 | ** information to ensure the GNU General Public License requirements will 24 | ** be met: https://www.gnu.org/licenses/gpl-3.0.html. 25 | ** 26 | ** $QT_END_LICENSE$ 27 | ** 28 | ****************************************************************************/ 29 | 30 | #include "context.h" 31 | 32 | #include "rectanglenode.h" 33 | #include "imagenode.h" 34 | #include "painternode.h" 35 | #include "pixmaptexture.h" 36 | #include "glyphnode.h" 37 | #include "ninepatchnode.h" 38 | #include "softwarelayer.h" 39 | #include "renderer.h" 40 | 41 | #include 42 | #include 43 | 44 | #include 45 | 46 | #include 47 | #include 48 | #include 49 | #include 50 | #include 51 | #include 52 | #include 53 | #include 54 | 55 | #ifndef QSG_NO_RENDERER_TIMING 56 | static bool qsg_render_timing = !qgetenv("QSG_RENDER_TIMING").isEmpty(); 57 | #endif 58 | 59 | // Used for very high-level info about the renderering and gl context 60 | // Includes GL_VERSION, type of render loop, atlas size, etc. 61 | Q_LOGGING_CATEGORY(QSG_RASTER_LOG_INFO, "qt.scenegraph.info") 62 | 63 | // Used to debug the renderloop logic. Primarily useful for platform integrators 64 | // and when investigating the render loop logic. 65 | Q_LOGGING_CATEGORY(QSG_RASTER_LOG_RENDERLOOP, "qt.scenegraph.renderloop") 66 | 67 | // GLSL shader compilation 68 | Q_LOGGING_CATEGORY(QSG_RASTER_LOG_TIME_COMPILATION, "qt.scenegraph.time.compilation") 69 | 70 | // polish, animations, sync, render and swap in the render loop 71 | Q_LOGGING_CATEGORY(QSG_RASTER_LOG_TIME_RENDERLOOP, "qt.scenegraph.time.renderloop") 72 | 73 | // Texture uploads and swizzling 74 | Q_LOGGING_CATEGORY(QSG_RASTER_LOG_TIME_TEXTURE, "qt.scenegraph.time.texture") 75 | 76 | // Glyph preparation (only for distance fields atm) 77 | Q_LOGGING_CATEGORY(QSG_RASTER_LOG_TIME_GLYPH, "qt.scenegraph.time.glyph") 78 | 79 | // Timing inside the renderer base class 80 | Q_LOGGING_CATEGORY(QSG_RASTER_LOG_TIME_RENDERER, "qt.scenegraph.time.renderer") 81 | 82 | QT_BEGIN_NAMESPACE 83 | 84 | namespace SoftwareContext 85 | { 86 | 87 | RenderContext::RenderContext(QSGContext *ctx) 88 | : QSGRenderContext(ctx) 89 | , currentWindow(0) 90 | , m_initialized(false) 91 | { 92 | } 93 | Context::Context(QObject *parent) 94 | : QSGContext(parent) 95 | { 96 | setDistanceFieldEnabled(false); 97 | } 98 | 99 | QSGRectangleNode *Context::createRectangleNode() 100 | { 101 | return new RectangleNode(); 102 | } 103 | 104 | QSGImageNode *Context::createImageNode() 105 | { 106 | return new ImageNode(); 107 | } 108 | 109 | QSGPainterNode *Context::createPainterNode(QQuickPaintedItem *item) 110 | { 111 | return new PainterNode(item); 112 | } 113 | 114 | QSGGlyphNode *Context::createGlyphNode(QSGRenderContext *rc, bool preferNativeGlyphNode) 115 | { 116 | Q_UNUSED(rc); 117 | Q_UNUSED(preferNativeGlyphNode); 118 | return new GlyphNode(); 119 | } 120 | 121 | QSGNinePatchNode *Context::createNinePatchNode() 122 | { 123 | return new NinePatchNode(); 124 | } 125 | 126 | QSGLayer *Context::createLayer(QSGRenderContext *renderContext) 127 | { 128 | return new SoftwareLayer(renderContext); 129 | } 130 | 131 | QSurfaceFormat Context::defaultSurfaceFormat() const 132 | { 133 | QSurfaceFormat format = QSurfaceFormat::defaultFormat(); 134 | format.setRenderableType(QSurfaceFormat::DefaultRenderableType); 135 | format.setMajorVersion(0); 136 | format.setMinorVersion(0); 137 | return format; 138 | } 139 | 140 | void RenderContext::initialize(QOpenGLContext *context) 141 | { 142 | Q_UNUSED(context) 143 | Q_UNREACHABLE(); 144 | } 145 | 146 | void RenderContext::initializeIfNeeded() 147 | { 148 | if (m_initialized) 149 | return; 150 | m_initialized = true; 151 | emit initialized(); 152 | } 153 | 154 | void RenderContext::invalidate() 155 | { 156 | QSGRenderContext::invalidate(); 157 | } 158 | 159 | QSGTexture *RenderContext::createTexture(const QImage &image, uint flags) const 160 | { 161 | Q_UNUSED(flags) 162 | return new PixmapTexture(image); 163 | } 164 | 165 | QSGRenderer *RenderContext::createRenderer() 166 | { 167 | return new Renderer(this); 168 | } 169 | 170 | 171 | void RenderContext::renderNextFrame(QSGRenderer *renderer, GLuint fbo) 172 | { 173 | QSGRenderContext::renderNextFrame(renderer, fbo); 174 | } 175 | 176 | } // namespace 177 | 178 | QT_END_NAMESPACE 179 | -------------------------------------------------------------------------------- /src/plugins/scenegraph/softwarecontext/renderer.cpp: -------------------------------------------------------------------------------- 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 Qt Quick 2D Renderer module of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:GPL$ 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 General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU 19 | ** General Public License version 3 or (at your option) any later version 20 | ** approved by the KDE Free Qt Foundation. The licenses are as published by 21 | ** the Free Software Foundation and appearing in the file LICENSE.GPL3 22 | ** included in the packaging of this file. Please review the following 23 | ** information to ensure the GNU General Public License requirements will 24 | ** be met: https://www.gnu.org/licenses/gpl-3.0.html. 25 | ** 26 | ** $QT_END_LICENSE$ 27 | ** 28 | ****************************************************************************/ 29 | 30 | #include "renderer.h" 31 | 32 | #include "renderablenodeupdater.h" 33 | #include "renderlistbuilder.h" 34 | #include "context.h" 35 | #include "renderablenode.h" 36 | 37 | #include 38 | #include 39 | 40 | #include 41 | 42 | Q_LOGGING_CATEGORY(lcRenderer, "qt.scenegraph.softwarecontext.renderer") 43 | 44 | QT_BEGIN_NAMESPACE 45 | 46 | namespace SoftwareContext { 47 | 48 | Renderer::Renderer(QSGRenderContext *context) 49 | : AbstractSoftwareRenderer(context) 50 | { 51 | } 52 | 53 | Renderer::~Renderer() 54 | { 55 | } 56 | 57 | void Renderer::renderScene(GLuint) 58 | { 59 | class B : public QSGBindable 60 | { 61 | public: 62 | void bind() const { } 63 | } bindable; 64 | QSGRenderer::renderScene(bindable); 65 | } 66 | 67 | void Renderer::render() 68 | { 69 | QElapsedTimer renderTimer; 70 | 71 | QWindow *currentWindow = static_cast(m_context)->currentWindow; 72 | if (!m_backingStore) 73 | m_backingStore.reset(new QBackingStore(currentWindow)); 74 | 75 | if (m_backingStore->size() != currentWindow->size()) { 76 | m_backingStore->resize(currentWindow->size()); 77 | } 78 | 79 | setBackgroundColor(clearColor()); 80 | setBackgroundSize(currentWindow->size()); 81 | 82 | const QRect rect(0, 0, currentWindow->width(), currentWindow->height()); 83 | m_backingStore->beginPaint(rect); 84 | 85 | QPaintDevice *device = m_backingStore->paintDevice(); 86 | #ifndef QTQUICK2D_DEBUG_FLUSH 87 | QPainter painter(device); 88 | #else 89 | if (m_outputBuffer.size() != m_backingStore->size()) { 90 | m_outputBuffer = QImage(m_backingStore->size(), QImage::Format_ARGB32_Premultiplied); 91 | m_outputBuffer.fill(Qt::transparent); 92 | } 93 | QPainter painter(&m_outputBuffer); 94 | #endif 95 | painter.setRenderHint(QPainter::Antialiasing); 96 | 97 | // Build Renderlist 98 | // The renderlist is created by visiting each node in the tree and when a 99 | // renderable node is reach, we find the coorosponding RenderableNode object 100 | // and append it to the renderlist. At this point the RenderableNode object 101 | // should not need any further updating so it is just a matter of appending 102 | // RenderableNodes 103 | renderTimer.start(); 104 | buildRenderList(); 105 | qint64 buildRenderListTime = renderTimer.restart(); 106 | 107 | // Optimize Renderlist 108 | // This is a pass through the renderlist to determine what actually needs to 109 | // be painted. Without this pass the renderlist will simply render each item 110 | // from back to front, with a high potential for overdraw. It would also lead 111 | // to the entire window being flushed every frame. The objective of the 112 | // optimization pass is to only paint dirty nodes that are not occuluded. A 113 | // side effect of this is that additional nodes may need to be marked dirty to 114 | // force a repaint. It is also important that any item that needs to be 115 | // repainted only paints what is needed, via the use of clip regions. 116 | optimizeRenderList(); 117 | qint64 optimizeRenderListTime = renderTimer.restart(); 118 | 119 | // Render the contents Renderlist 120 | QRegion dirtyRegion = renderNodes(&painter); 121 | qint64 renderTime = renderTimer.elapsed(); 122 | 123 | qCDebug(lcRenderer) << "render" << dirtyRegion << buildRenderListTime << optimizeRenderListTime << renderTime; 124 | 125 | #ifdef QTQUICK2D_DEBUG_FLUSH 126 | // Keep up with the last 5 flushes 127 | if (m_previousFlushes.count() == 5) 128 | m_previousFlushes.pop_front(); 129 | m_previousFlushes.append(dirtyRegion); 130 | 131 | QPainter backingStorePainter(device); 132 | backingStorePainter.drawImage(QRect(0, 0, m_backingStore->size().width(), m_backingStore->size().height()), m_outputBuffer, m_outputBuffer.rect()); 133 | QPen pen(Qt::NoPen); 134 | QBrush brush(QColor(255, 0, 0, 50)); 135 | backingStorePainter.setPen(pen); 136 | backingStorePainter.setBrush(brush); 137 | for (auto region : qAsConst(m_previousFlushes)) { 138 | backingStorePainter.drawRects(region.rects()); 139 | } 140 | m_backingStore->endPaint(); 141 | 142 | m_backingStore->flush(rect); 143 | #else 144 | m_backingStore->endPaint(); 145 | // Flush the updated regions to the window 146 | m_backingStore->flush(dirtyRegion); 147 | #endif 148 | } 149 | 150 | } // namespace 151 | 152 | QT_END_NAMESPACE 153 | -------------------------------------------------------------------------------- /src/plugins/scenegraph/softwarecontext/painternode.cpp: -------------------------------------------------------------------------------- 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 Qt Quick 2D Renderer module of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:GPL$ 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 General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU 19 | ** General Public License version 3 or (at your option) any later version 20 | ** approved by the KDE Free Qt Foundation. The licenses are as published by 21 | ** the Free Software Foundation and appearing in the file LICENSE.GPL3 22 | ** included in the packaging of this file. Please review the following 23 | ** information to ensure the GNU General Public License requirements will 24 | ** be met: https://www.gnu.org/licenses/gpl-3.0.html. 25 | ** 26 | ** $QT_END_LICENSE$ 27 | ** 28 | ****************************************************************************/ 29 | 30 | #include "painternode.h" 31 | #include "pixmaptexture.h" 32 | #include 33 | 34 | QT_BEGIN_NAMESPACE 35 | 36 | PainterNode::PainterNode(QQuickPaintedItem *item) 37 | : QSGPainterNode() 38 | , m_preferredRenderTarget(QQuickPaintedItem::Image) 39 | , m_actualRenderTarget(QQuickPaintedItem::Image) 40 | , m_item(item) 41 | , m_texture(0) 42 | , m_dirtyContents(false) 43 | , m_opaquePainting(false) 44 | , m_linear_filtering(false) 45 | , m_mipmapping(false) 46 | , m_smoothPainting(false) 47 | , m_extensionsChecked(false) 48 | , m_multisamplingSupported(false) 49 | , m_fastFBOResizing(false) 50 | , m_fillColor(Qt::transparent) 51 | , m_contentsScale(1.0) 52 | , m_dirtyGeometry(false) 53 | { 54 | setMaterial((QSGMaterial*)1); 55 | setGeometry((QSGGeometry*)1); 56 | } 57 | 58 | PainterNode::~PainterNode() 59 | { 60 | delete m_texture; 61 | } 62 | 63 | void PainterNode::setPreferredRenderTarget(QQuickPaintedItem::RenderTarget target) 64 | { 65 | if (m_preferredRenderTarget == target) 66 | return; 67 | 68 | m_preferredRenderTarget = target; 69 | } 70 | 71 | void PainterNode::setSize(const QSize &size) 72 | { 73 | if (size == m_size) 74 | return; 75 | 76 | m_size = size; 77 | 78 | m_dirtyGeometry = true; 79 | } 80 | 81 | void PainterNode::setDirty(const QRect &dirtyRect) 82 | { 83 | m_dirtyContents = true; 84 | m_dirtyRect = dirtyRect; 85 | markDirty(DirtyMaterial); 86 | } 87 | 88 | void PainterNode::setOpaquePainting(bool opaque) 89 | { 90 | if (opaque == m_opaquePainting) 91 | return; 92 | 93 | m_opaquePainting = opaque; 94 | } 95 | 96 | void PainterNode::setLinearFiltering(bool linearFiltering) 97 | { 98 | if (linearFiltering == m_linear_filtering) 99 | return; 100 | 101 | m_linear_filtering = linearFiltering; 102 | } 103 | 104 | void PainterNode::setMipmapping(bool mipmapping) 105 | { 106 | if (mipmapping == m_mipmapping) 107 | return; 108 | 109 | m_mipmapping = mipmapping; 110 | } 111 | 112 | void PainterNode::setSmoothPainting(bool s) 113 | { 114 | if (s == m_smoothPainting) 115 | return; 116 | 117 | m_smoothPainting = s; 118 | } 119 | 120 | void PainterNode::setFillColor(const QColor &c) 121 | { 122 | if (c == m_fillColor) 123 | return; 124 | 125 | m_fillColor = c; 126 | markDirty(DirtyMaterial); 127 | } 128 | 129 | void PainterNode::setContentsScale(qreal s) 130 | { 131 | if (s == m_contentsScale) 132 | return; 133 | 134 | m_contentsScale = s; 135 | markDirty(DirtyMaterial); 136 | } 137 | 138 | void PainterNode::setFastFBOResizing(bool dynamic) 139 | { 140 | m_fastFBOResizing = dynamic; 141 | } 142 | 143 | QImage PainterNode::toImage() const 144 | { 145 | return m_pixmap.toImage(); 146 | } 147 | 148 | void PainterNode::update() 149 | { 150 | if (m_dirtyGeometry) { 151 | m_pixmap = QPixmap(m_textureSize); 152 | if (!m_opaquePainting) 153 | m_pixmap.fill(Qt::transparent); 154 | 155 | if (m_texture) 156 | delete m_texture; 157 | m_texture = new PixmapTexture(m_pixmap); 158 | } 159 | 160 | if (m_dirtyContents) 161 | paint(); 162 | 163 | m_dirtyGeometry = false; 164 | m_dirtyContents = false; 165 | } 166 | 167 | void PainterNode::paint(QPainter *painter) 168 | { 169 | painter->drawPixmap(0, 0, m_size.width(), m_size.height(), m_pixmap); 170 | } 171 | 172 | void PainterNode::paint() 173 | { 174 | QRect dirtyRect = m_dirtyRect.isNull() ? QRect(0, 0, m_size.width(), m_size.height()) : m_dirtyRect; 175 | 176 | QPainter painter; 177 | 178 | painter.begin(&m_pixmap); 179 | if (m_smoothPainting) { 180 | painter.setRenderHints(QPainter::Antialiasing | QPainter::TextAntialiasing | QPainter::SmoothPixmapTransform); 181 | } 182 | 183 | QRect clipRect; 184 | 185 | if (m_contentsScale == 1) { 186 | qreal scaleX = m_textureSize.width() / (qreal) m_size.width(); 187 | qreal scaleY = m_textureSize.height() / (qreal) m_size.height(); 188 | painter.scale(scaleX, scaleY); 189 | clipRect = dirtyRect; 190 | } else { 191 | painter.scale(m_contentsScale, m_contentsScale); 192 | 193 | QRect sclip(qFloor(dirtyRect.x()/m_contentsScale), 194 | qFloor(dirtyRect.y()/m_contentsScale), 195 | qCeil(dirtyRect.width()/m_contentsScale+dirtyRect.x()/m_contentsScale-qFloor(dirtyRect.x()/m_contentsScale)), 196 | qCeil(dirtyRect.height()/m_contentsScale+dirtyRect.y()/m_contentsScale-qFloor(dirtyRect.y()/m_contentsScale))); 197 | 198 | clipRect = sclip; 199 | } 200 | 201 | if (!m_dirtyRect.isNull()) 202 | painter.setClipRect(clipRect); 203 | 204 | painter.setCompositionMode(QPainter::CompositionMode_Source); 205 | painter.fillRect(clipRect, m_fillColor); 206 | painter.setCompositionMode(QPainter::CompositionMode_SourceOver); 207 | 208 | m_item->paint(&painter); 209 | painter.end(); 210 | 211 | m_dirtyRect = QRect(); 212 | } 213 | 214 | 215 | void PainterNode::setTextureSize(const QSize &size) 216 | { 217 | if (size == m_textureSize) 218 | return; 219 | 220 | m_textureSize = size; 221 | m_dirtyGeometry = true; 222 | } 223 | 224 | QT_END_NAMESPACE 225 | -------------------------------------------------------------------------------- /src/plugins/scenegraph/softwarecontext/renderloop.cpp: -------------------------------------------------------------------------------- 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 Qt Quick 2D Renderer module of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:GPL$ 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 General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU 19 | ** General Public License version 3 or (at your option) any later version 20 | ** approved by the KDE Free Qt Foundation. The licenses are as published by 21 | ** the Free Software Foundation and appearing in the file LICENSE.GPL3 22 | ** included in the packaging of this file. Please review the following 23 | ** information to ensure the GNU General Public License requirements will 24 | ** be met: https://www.gnu.org/licenses/gpl-3.0.html. 25 | ** 26 | ** $QT_END_LICENSE$ 27 | ** 28 | ****************************************************************************/ 29 | 30 | #include "renderloop.h" 31 | 32 | #include "context.h" 33 | 34 | #include 35 | 36 | #include 37 | #include 38 | #include 39 | 40 | QT_BEGIN_NAMESPACE 41 | 42 | RenderLoop::RenderLoop() 43 | { 44 | sg = QSGContext::createDefaultContext(); 45 | rc = sg->createRenderContext(); 46 | } 47 | 48 | RenderLoop::~RenderLoop() 49 | { 50 | delete rc; 51 | delete sg; 52 | } 53 | 54 | void RenderLoop::show(QQuickWindow *window) 55 | { 56 | WindowData data; 57 | data.updatePending = false; 58 | data.grabOnly = false; 59 | m_windows[window] = data; 60 | 61 | maybeUpdate(window); 62 | } 63 | 64 | void RenderLoop::hide(QQuickWindow *window) 65 | { 66 | QQuickWindowPrivate *cd = QQuickWindowPrivate::get(window); 67 | cd->fireAboutToStop(); 68 | } 69 | 70 | void RenderLoop::windowDestroyed(QQuickWindow *window) 71 | { 72 | m_windows.remove(window); 73 | hide(window); 74 | 75 | QQuickWindowPrivate *d = QQuickWindowPrivate::get(window); 76 | d->cleanupNodesOnShutdown(); 77 | 78 | if (m_windows.size() == 0) { 79 | rc->invalidate(); 80 | QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); 81 | } 82 | } 83 | 84 | void RenderLoop::renderWindow(QQuickWindow *window) 85 | { 86 | QQuickWindowPrivate *cd = QQuickWindowPrivate::get(window); 87 | if (!cd->isRenderable() || !m_windows.contains(window)) 88 | return; 89 | 90 | WindowData &data = const_cast(m_windows[window]); 91 | 92 | // ### create QPainter and set up pointer to current window/painter 93 | SoftwareContext::RenderContext *ctx = static_cast(cd->context); 94 | ctx->currentWindow = window; 95 | ctx->initializeIfNeeded(); 96 | 97 | bool alsoSwap = data.updatePending; 98 | data.updatePending = false; 99 | 100 | if (!data.grabOnly) { 101 | cd->flushDelayedTouchEvent(); 102 | // Event delivery/processing triggered the window to be deleted or stop rendering. 103 | if (!m_windows.contains(window)) 104 | return; 105 | } 106 | QElapsedTimer renderTimer; 107 | qint64 renderTime = 0, syncTime = 0, polishTime = 0; 108 | bool profileFrames = QSG_RASTER_LOG_TIME_RENDERLOOP().isDebugEnabled(); 109 | if (profileFrames) 110 | renderTimer.start(); 111 | Q_QUICK_SG_PROFILE_START(QQuickProfiler::SceneGraphPolishFrame); 112 | 113 | cd->polishItems(); 114 | 115 | if (profileFrames) 116 | polishTime = renderTimer.nsecsElapsed(); 117 | Q_QUICK_SG_PROFILE_SWITCH(QQuickProfiler::SceneGraphPolishFrame, 118 | QQuickProfiler::SceneGraphRenderLoopFrame); 119 | 120 | emit window->afterAnimating(); 121 | 122 | cd->syncSceneGraph(); 123 | 124 | if (profileFrames) 125 | syncTime = renderTimer.nsecsElapsed(); 126 | Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphRenderLoopFrame); 127 | 128 | cd->renderSceneGraph(window->size()); 129 | 130 | if (profileFrames) 131 | renderTime = renderTimer.nsecsElapsed(); 132 | Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphRenderLoopFrame); 133 | 134 | if (data.grabOnly) { 135 | // #### grabContent = qt_gl_read_framebuffer(window->size() * window->effectiveDevicePixelRatio(), false, false); 136 | data.grabOnly = false; 137 | } 138 | 139 | if (alsoSwap && window->isVisible()) { 140 | // ### gl->swapBuffers(window); 141 | cd->fireFrameSwapped(); 142 | } 143 | 144 | qint64 swapTime = 0; 145 | if (profileFrames) 146 | swapTime = renderTimer.nsecsElapsed(); 147 | Q_QUICK_SG_PROFILE_END(QQuickProfiler::SceneGraphRenderLoopFrame); 148 | 149 | if (QSG_RASTER_LOG_TIME_RENDERLOOP().isDebugEnabled()) { 150 | static QTime lastFrameTime = QTime::currentTime(); 151 | qCDebug(QSG_RASTER_LOG_TIME_RENDERLOOP, 152 | "Frame rendered with 'basic' renderloop in %dms, polish=%d, sync=%d, render=%d, swap=%d, frameDelta=%d", 153 | int(swapTime / 1000000), 154 | int(polishTime / 1000000), 155 | int((syncTime - polishTime) / 1000000), 156 | int((renderTime - syncTime) / 1000000), 157 | int((swapTime - renderTime) / 10000000), 158 | int(lastFrameTime.msecsTo(QTime::currentTime()))); 159 | lastFrameTime = QTime::currentTime(); 160 | } 161 | 162 | // Might have been set during syncSceneGraph() 163 | if (data.updatePending) 164 | maybeUpdate(window); 165 | } 166 | 167 | void RenderLoop::exposureChanged(QQuickWindow *window) 168 | { 169 | if (window->isExposed()) { 170 | m_windows[window].updatePending = true; 171 | renderWindow(window); 172 | } 173 | } 174 | 175 | QImage RenderLoop::grab(QQuickWindow *window) 176 | { 177 | if (!m_windows.contains(window)) 178 | return QImage(); 179 | 180 | m_windows[window].grabOnly = true; 181 | 182 | renderWindow(window); 183 | 184 | QImage grabbed = grabContent; 185 | grabContent = QImage(); 186 | return grabbed; 187 | } 188 | 189 | 190 | 191 | void RenderLoop::maybeUpdate(QQuickWindow *window) 192 | { 193 | if (!m_windows.contains(window)) 194 | return; 195 | 196 | m_windows[window].updatePending = true; 197 | window->requestUpdate(); 198 | } 199 | 200 | QSurface::SurfaceType RenderLoop::windowSurfaceType() const 201 | { 202 | return QSurface::RasterSurface; 203 | } 204 | 205 | 206 | 207 | QSGContext *RenderLoop::sceneGraphContext() const 208 | { 209 | return sg; 210 | } 211 | 212 | 213 | void RenderLoop::handleUpdateRequest(QQuickWindow *window) 214 | { 215 | renderWindow(window); 216 | } 217 | 218 | QT_END_NAMESPACE 219 | -------------------------------------------------------------------------------- /src/plugins/scenegraph/softwarecontext/softwarelayer.cpp: -------------------------------------------------------------------------------- 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 Qt Quick 2D Renderer module of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:GPL$ 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 General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU 19 | ** General Public License version 3 or (at your option) any later version 20 | ** approved by the KDE Free Qt Foundation. The licenses are as published by 21 | ** the Free Software Foundation and appearing in the file LICENSE.GPL3 22 | ** included in the packaging of this file. Please review the following 23 | ** information to ensure the GNU General Public License requirements will 24 | ** be met: https://www.gnu.org/licenses/gpl-3.0.html. 25 | ** 26 | ** $QT_END_LICENSE$ 27 | ** 28 | ****************************************************************************/ 29 | 30 | #include "softwarelayer.h" 31 | 32 | #include "context.h" 33 | #include "pixmaprenderer.h" 34 | 35 | QT_BEGIN_NAMESPACE 36 | 37 | SoftwareLayer::SoftwareLayer(QSGRenderContext *renderContext) 38 | : m_item(0) 39 | , m_context(renderContext) 40 | , m_renderer(0) 41 | , m_device_pixel_ratio(1) 42 | , m_mirrorHorizontal(false) 43 | , m_mirrorVertical(false) 44 | , m_live(true) 45 | , m_grab(true) 46 | , m_recursive(false) 47 | , m_dirtyTexture(true) 48 | { 49 | 50 | } 51 | 52 | SoftwareLayer::~SoftwareLayer() 53 | { 54 | invalidated(); 55 | } 56 | 57 | int SoftwareLayer::textureId() const 58 | { 59 | return 0; 60 | } 61 | 62 | QSize SoftwareLayer::textureSize() const 63 | { 64 | return m_pixmap.size(); 65 | } 66 | 67 | bool SoftwareLayer::hasAlphaChannel() const 68 | { 69 | return m_pixmap.hasAlphaChannel(); 70 | } 71 | 72 | bool SoftwareLayer::hasMipmaps() const 73 | { 74 | return false; 75 | } 76 | 77 | void SoftwareLayer::bind() 78 | { 79 | } 80 | 81 | bool SoftwareLayer::updateTexture() 82 | { 83 | bool doGrab = (m_live || m_grab) && m_dirtyTexture; 84 | if (doGrab) 85 | grab(); 86 | if (m_grab) 87 | emit scheduledUpdateCompleted(); 88 | m_grab = false; 89 | return doGrab; 90 | } 91 | 92 | void SoftwareLayer::setItem(QSGNode *item) 93 | { 94 | if (item == m_item) 95 | return; 96 | m_item = item; 97 | 98 | if (m_live && !m_item) 99 | m_pixmap = QPixmap(); 100 | 101 | markDirtyTexture(); 102 | } 103 | 104 | void SoftwareLayer::setRect(const QRectF &rect) 105 | { 106 | if (rect == m_rect) 107 | return; 108 | m_rect = rect; 109 | markDirtyTexture(); 110 | } 111 | 112 | void SoftwareLayer::setSize(const QSize &size) 113 | { 114 | if (size == m_size) 115 | return; 116 | m_size = size; 117 | 118 | if (m_live && m_size.isNull()) 119 | m_pixmap = QPixmap(); 120 | 121 | markDirtyTexture(); 122 | } 123 | 124 | void SoftwareLayer::scheduleUpdate() 125 | { 126 | if (m_grab) 127 | return; 128 | m_grab = true; 129 | if (m_dirtyTexture) { 130 | emit updateRequested(); 131 | } 132 | } 133 | 134 | QImage SoftwareLayer::toImage() const 135 | { 136 | return m_pixmap.toImage(); 137 | } 138 | 139 | void SoftwareLayer::setLive(bool live) 140 | { 141 | if (live == m_live) 142 | return; 143 | m_live = live; 144 | 145 | if (m_live && (!m_item || m_size.isNull())) 146 | m_pixmap = QPixmap(); 147 | 148 | markDirtyTexture(); 149 | } 150 | 151 | void SoftwareLayer::setRecursive(bool recursive) 152 | { 153 | m_recursive = recursive; 154 | } 155 | 156 | void SoftwareLayer::setFormat(GLenum) 157 | { 158 | } 159 | 160 | void SoftwareLayer::setHasMipmaps(bool) 161 | { 162 | } 163 | 164 | void SoftwareLayer::setDevicePixelRatio(qreal ratio) 165 | { 166 | m_device_pixel_ratio = ratio; 167 | } 168 | 169 | void SoftwareLayer::setMirrorHorizontal(bool mirror) 170 | { 171 | if (m_mirrorHorizontal == mirror) 172 | return; 173 | m_mirrorHorizontal = mirror; 174 | markDirtyTexture(); 175 | } 176 | 177 | void SoftwareLayer::setMirrorVertical(bool mirror) 178 | { 179 | if (m_mirrorVertical == mirror) 180 | return; 181 | m_mirrorVertical = mirror; 182 | markDirtyTexture(); 183 | } 184 | 185 | void SoftwareLayer::markDirtyTexture() 186 | { 187 | m_dirtyTexture = true; 188 | if (m_live || m_grab) { 189 | emit updateRequested(); 190 | } 191 | } 192 | 193 | void SoftwareLayer::invalidated() 194 | { 195 | delete m_renderer; 196 | m_renderer = 0; 197 | } 198 | 199 | void SoftwareLayer::grab() 200 | { 201 | if (!m_item || m_size.isNull()) { 202 | m_pixmap = QPixmap(); 203 | m_dirtyTexture = false; 204 | return; 205 | } 206 | QSGNode *root = m_item; 207 | while (root->firstChild() && root->type() != QSGNode::RootNodeType) 208 | root = root->firstChild(); 209 | if (root->type() != QSGNode::RootNodeType) 210 | return; 211 | 212 | if (!m_renderer) { 213 | m_renderer = new SoftwareContext::PixmapRenderer(m_context); 214 | connect(m_renderer, SIGNAL(sceneGraphChanged()), this, SLOT(markDirtyTexture())); 215 | } 216 | m_renderer->setDevicePixelRatio(m_device_pixel_ratio); 217 | m_renderer->setRootNode(static_cast(root)); 218 | 219 | if (m_pixmap.size() != m_size) { 220 | m_pixmap = QPixmap(m_size); 221 | m_pixmap.setDevicePixelRatio(m_device_pixel_ratio); 222 | // This fill here is wasteful, but necessary because it is the only way 223 | // to force a QImage based pixmap to have an alpha channel. 224 | m_pixmap.fill(Qt::transparent); 225 | } 226 | 227 | // Render texture. 228 | root->markDirty(QSGNode::DirtyForceUpdate); // Force matrix, clip and opacity update. 229 | m_renderer->nodeChanged(root, QSGNode::DirtyForceUpdate); // Force render list update. 230 | 231 | m_dirtyTexture = false; 232 | 233 | m_renderer->setDeviceRect(m_size); 234 | m_renderer->setViewportRect(m_size); 235 | QRect mirrored(m_mirrorHorizontal ? m_rect.right() * m_device_pixel_ratio : m_rect.left() * m_device_pixel_ratio, 236 | m_mirrorVertical ? m_rect.top() * m_device_pixel_ratio : m_rect.bottom() * m_device_pixel_ratio, 237 | m_mirrorHorizontal ? -m_rect.width() * m_device_pixel_ratio : m_rect.width() * m_device_pixel_ratio, 238 | m_mirrorVertical ? m_rect.height() * m_device_pixel_ratio : -m_rect.height() * m_device_pixel_ratio); 239 | m_renderer->setProjectionRect(mirrored); 240 | m_renderer->setClearColor(Qt::transparent); 241 | 242 | m_renderer->renderScene(); 243 | m_renderer->render(&m_pixmap); 244 | 245 | root->markDirty(QSGNode::DirtyForceUpdate); // Force matrix, clip, opacity and render list update. 246 | 247 | if (m_recursive) 248 | markDirtyTexture(); // Continuously update if 'live' and 'recursive'. 249 | } 250 | 251 | QT_END_NAMESPACE 252 | -------------------------------------------------------------------------------- /src/plugins/scenegraph/softwarecontext/renderablenodeupdater.cpp: -------------------------------------------------------------------------------- 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 Qt Quick 2D Renderer module of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:GPL$ 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 General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU 19 | ** General Public License version 3 or (at your option) any later version 20 | ** approved by the KDE Free Qt Foundation. The licenses are as published by 21 | ** the Free Software Foundation and appearing in the file LICENSE.GPL3 22 | ** included in the packaging of this file. Please review the following 23 | ** information to ensure the GNU General Public License requirements will 24 | ** be met: https://www.gnu.org/licenses/gpl-3.0.html. 25 | ** 26 | ** $QT_END_LICENSE$ 27 | ** 28 | ****************************************************************************/ 29 | 30 | #include "renderablenodeupdater.h" 31 | 32 | #include "abstractsoftwarerenderer.h" 33 | #include "imagenode.h" 34 | #include "rectanglenode.h" 35 | #include "glyphnode.h" 36 | #include "ninepatchnode.h" 37 | #include "painternode.h" 38 | #include "pixmaptexture.h" 39 | 40 | #include 41 | #include 42 | 43 | QT_BEGIN_NAMESPACE 44 | 45 | namespace SoftwareContext { 46 | 47 | RenderableNodeUpdater::RenderableNodeUpdater(AbstractSoftwareRenderer *renderer) 48 | : m_renderer(renderer) 49 | { 50 | m_opacityState.push(1.0f); 51 | // Invalid RectF by default for no clip 52 | m_clipState.push(QRectF(0.0f, 0.0f, -1.0f, -1.0f)); 53 | m_transformState.push(QTransform()); 54 | } 55 | 56 | RenderableNodeUpdater::~RenderableNodeUpdater() 57 | { 58 | 59 | } 60 | 61 | bool RenderableNodeUpdater::visit(QSGTransformNode *node) 62 | { 63 | m_transformState.push(node->matrix().toTransform() * m_transformState.top()); 64 | m_stateMap[node] = currentState(node); 65 | return true; 66 | } 67 | 68 | void RenderableNodeUpdater::endVisit(QSGTransformNode *) 69 | { 70 | m_transformState.pop(); 71 | } 72 | 73 | bool RenderableNodeUpdater::visit(QSGClipNode *node) 74 | { 75 | // Make sure to translate the clip rect into world coordinates 76 | if (!m_clipState.top().isValid()) 77 | m_clipState.push(m_transformState.top().mapRect(node->clipRect())); 78 | else 79 | m_clipState.push(m_transformState.top().mapRect(node->clipRect()).intersected(m_clipState.top())); 80 | m_stateMap[node] = currentState(node); 81 | return true; 82 | } 83 | 84 | void RenderableNodeUpdater::endVisit(QSGClipNode *) 85 | { 86 | m_clipState.pop(); 87 | } 88 | 89 | bool RenderableNodeUpdater::visit(QSGGeometryNode *node) 90 | { 91 | if (QSGSimpleRectNode *rectNode = dynamic_cast(node)) { 92 | return updateRenderableNode(RenderableNode::SimpleRect, rectNode); 93 | } else if (QSGSimpleTextureNode *tn = dynamic_cast(node)) { 94 | return updateRenderableNode(RenderableNode::SimpleTexture, tn); 95 | } else { 96 | // We dont know, so skip 97 | return false; 98 | } 99 | } 100 | 101 | void RenderableNodeUpdater::endVisit(QSGGeometryNode *) 102 | { 103 | } 104 | 105 | bool RenderableNodeUpdater::visit(QSGOpacityNode *node) 106 | { 107 | m_opacityState.push(m_opacityState.top() * node->opacity()); 108 | m_stateMap[node] = currentState(node); 109 | return true; 110 | } 111 | 112 | void RenderableNodeUpdater::endVisit(QSGOpacityNode *) 113 | { 114 | m_opacityState.pop(); 115 | } 116 | 117 | bool RenderableNodeUpdater::visit(QSGImageNode *node) 118 | { 119 | return updateRenderableNode(RenderableNode::Image, node); 120 | } 121 | 122 | void RenderableNodeUpdater::endVisit(QSGImageNode *) 123 | { 124 | } 125 | 126 | bool RenderableNodeUpdater::visit(QSGPainterNode *node) 127 | { 128 | return updateRenderableNode(RenderableNode::Painter, node); 129 | } 130 | 131 | void RenderableNodeUpdater::endVisit(QSGPainterNode *) 132 | { 133 | } 134 | 135 | bool RenderableNodeUpdater::visit(QSGRectangleNode *node) 136 | { 137 | return updateRenderableNode(RenderableNode::Rectangle, node); 138 | } 139 | 140 | void RenderableNodeUpdater::endVisit(QSGRectangleNode *) 141 | { 142 | } 143 | 144 | bool RenderableNodeUpdater::visit(QSGGlyphNode *node) 145 | { 146 | return updateRenderableNode(RenderableNode::Glyph, node); 147 | } 148 | 149 | void RenderableNodeUpdater::endVisit(QSGGlyphNode *) 150 | { 151 | } 152 | 153 | bool RenderableNodeUpdater::visit(QSGNinePatchNode *node) 154 | { 155 | return updateRenderableNode(RenderableNode::NinePatch, node); 156 | } 157 | 158 | void RenderableNodeUpdater::endVisit(QSGNinePatchNode *) 159 | { 160 | } 161 | 162 | bool RenderableNodeUpdater::visit(QSGRootNode *node) 163 | { 164 | m_stateMap[node] = currentState(node); 165 | return true; 166 | } 167 | 168 | void RenderableNodeUpdater::endVisit(QSGRootNode *) 169 | { 170 | } 171 | 172 | void RenderableNodeUpdater::updateNodes(QSGNode *node, bool isNodeRemoved) 173 | { 174 | m_opacityState.clear(); 175 | m_clipState.clear(); 176 | m_transformState.clear(); 177 | 178 | auto parentNode = node->parent(); 179 | // If the node was deleted, it will have no parent 180 | // check if the state map has the previous parent 181 | if ((!parentNode || isNodeRemoved ) && m_stateMap.contains(node)) 182 | parentNode = m_stateMap[node].parent; 183 | 184 | // If we find a parent, use its state for updating the new children 185 | if (parentNode && m_stateMap.contains(parentNode)) { 186 | auto state = m_stateMap[parentNode]; 187 | m_opacityState.push(state.opacity); 188 | m_transformState.push(state.transform); 189 | m_clipState.push(state.clip); 190 | 191 | } else { 192 | // There is no parent, and no previous parent, so likely a root node 193 | m_opacityState.push(1.0f); 194 | m_transformState.push(QTransform()); 195 | m_clipState.push(QRectF(0.0f, 0.0f, -1.0f, -1.0f)); 196 | } 197 | 198 | // If the node is being removed, then cleanup the state data 199 | // Then just visit the children without visiting the now removed node 200 | if (isNodeRemoved) { 201 | m_stateMap.remove(node); 202 | return; 203 | } 204 | 205 | // Visit the current node itself first 206 | switch (node->type()) { 207 | case QSGNode::ClipNodeType: { 208 | QSGClipNode *c = static_cast(node); 209 | if (visit(c)) 210 | visitChildren(c); 211 | endVisit(c); 212 | break; 213 | } 214 | case QSGNode::TransformNodeType: { 215 | QSGTransformNode *c = static_cast(node); 216 | if (visit(c)) 217 | visitChildren(c); 218 | endVisit(c); 219 | break; 220 | } 221 | case QSGNode::OpacityNodeType: { 222 | QSGOpacityNode *c = static_cast(node); 223 | if (visit(c)) 224 | visitChildren(c); 225 | endVisit(c); 226 | break; 227 | } 228 | case QSGNode::GeometryNodeType: { 229 | if (node->flags() & QSGNode::IsVisitableNode) { 230 | QSGVisitableNode *v = static_cast(node); 231 | v->accept(this); 232 | } else { 233 | QSGGeometryNode *c = static_cast(node); 234 | if (visit(c)) 235 | visitChildren(c); 236 | endVisit(c); 237 | } 238 | break; 239 | } 240 | case QSGNode::RootNodeType: { 241 | QSGRootNode *root = static_cast(node); 242 | if (visit(root)) 243 | visitChildren(root); 244 | endVisit(root); 245 | break; 246 | } 247 | case QSGNode::BasicNodeType: { 248 | visitChildren(node); 249 | break; 250 | } 251 | default: 252 | Q_UNREACHABLE(); 253 | break; 254 | } 255 | } 256 | 257 | RenderableNodeUpdater::NodeState RenderableNodeUpdater::currentState(QSGNode *node) const 258 | { 259 | NodeState state; 260 | state.opacity = m_opacityState.top(); 261 | state.clip = m_clipState.top(); 262 | state.transform = m_transformState.top(); 263 | state.parent = node->parent(); 264 | return state; 265 | } 266 | 267 | } // namespace 268 | 269 | QT_END_NAMESPACE 270 | -------------------------------------------------------------------------------- /src/plugins/scenegraph/softwarecontext/renderablenode.cpp: -------------------------------------------------------------------------------- 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 Qt Quick 2D Renderer module of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:GPL$ 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 General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU 19 | ** General Public License version 3 or (at your option) any later version 20 | ** approved by the KDE Free Qt Foundation. The licenses are as published by 21 | ** the Free Software Foundation and appearing in the file LICENSE.GPL3 22 | ** included in the packaging of this file. Please review the following 23 | ** information to ensure the GNU General Public License requirements will 24 | ** be met: https://www.gnu.org/licenses/gpl-3.0.html. 25 | ** 26 | ** $QT_END_LICENSE$ 27 | ** 28 | ****************************************************************************/ 29 | 30 | #include "renderablenode.h" 31 | 32 | #include "imagenode.h" 33 | #include "rectanglenode.h" 34 | #include "glyphnode.h" 35 | #include "ninepatchnode.h" 36 | #include "painternode.h" 37 | #include "pixmaptexture.h" 38 | 39 | #include 40 | #include 41 | #include 42 | #include 43 | 44 | Q_LOGGING_CATEGORY(lcRenderable, "qt.scenegraph.softwarecontext.renderable") 45 | 46 | QT_BEGIN_NAMESPACE 47 | 48 | namespace SoftwareContext{ 49 | 50 | RenderableNode::RenderableNode(NodeType type, QSGNode *node) 51 | : m_nodeType(type) 52 | , m_isOpaque(true) 53 | , m_isDirty(true) 54 | , m_opacity(1.0f) 55 | { 56 | switch (m_nodeType) { 57 | case RenderableNode::SimpleRect: 58 | m_handle.simpleRectNode = static_cast(node); 59 | break; 60 | case RenderableNode::SimpleTexture: 61 | m_handle.simpleTextureNode = static_cast(node); 62 | break; 63 | case RenderableNode::Image: 64 | m_handle.imageNode = static_cast(node); 65 | break; 66 | case RenderableNode::Painter: 67 | m_handle.painterNode = static_cast(node); 68 | break; 69 | case RenderableNode::Rectangle: 70 | m_handle.rectangleNode = static_cast(node); 71 | break; 72 | case RenderableNode::Glyph: 73 | m_handle.glpyhNode = static_cast(node); 74 | break; 75 | case RenderableNode::NinePatch: 76 | m_handle.ninePatchNode = static_cast(node); 77 | break; 78 | case RenderableNode::Invalid: 79 | m_handle.simpleRectNode = nullptr; 80 | break; 81 | } 82 | } 83 | 84 | RenderableNode::~RenderableNode() 85 | { 86 | 87 | } 88 | 89 | void RenderableNode::update() 90 | { 91 | // Update the Node properties 92 | m_isDirty = true; 93 | 94 | QRect boundingRect; 95 | 96 | switch (m_nodeType) { 97 | case RenderableNode::SimpleRect: 98 | if (m_handle.simpleRectNode->color().alpha() == 255 && !m_transform.isRotating()) 99 | m_isOpaque = true; 100 | else 101 | m_isOpaque = false; 102 | 103 | boundingRect = m_handle.simpleRectNode->rect().toRect(); 104 | break; 105 | case RenderableNode::SimpleTexture: 106 | if (!m_handle.simpleTextureNode->texture()->hasAlphaChannel() && !m_transform.isRotating()) 107 | m_isOpaque = true; 108 | else 109 | m_isOpaque = false; 110 | 111 | boundingRect = m_handle.simpleTextureNode->rect().toRect(); 112 | break; 113 | case RenderableNode::Image: 114 | // There isn't a way to tell, so assume it's not 115 | m_isOpaque = false; 116 | 117 | boundingRect = m_handle.imageNode->rect().toRect(); 118 | break; 119 | case RenderableNode::Painter: 120 | if (m_handle.painterNode->opaquePainting() && !m_transform.isRotating()) 121 | m_isOpaque = true; 122 | else 123 | m_isOpaque = false; 124 | 125 | boundingRect = QRect(0, 0, m_handle.painterNode->size().width(), m_handle.painterNode->size().height()); 126 | break; 127 | case RenderableNode::Rectangle: 128 | if (m_handle.rectangleNode->isOpaque() && !m_transform.isRotating()) 129 | m_isOpaque = true; 130 | else 131 | m_isOpaque = false; 132 | 133 | boundingRect = m_handle.rectangleNode->rect().toRect(); 134 | break; 135 | case RenderableNode::Glyph: 136 | // Always has alpha 137 | m_isOpaque = false; 138 | 139 | boundingRect = m_handle.glpyhNode->boundingRect().toAlignedRect(); 140 | break; 141 | case RenderableNode::NinePatch: 142 | // Difficult to tell, assume non-opaque 143 | m_isOpaque = false; 144 | 145 | boundingRect = m_handle.ninePatchNode->bounds().toRect(); 146 | break; 147 | default: 148 | break; 149 | } 150 | 151 | m_boundingRect = m_transform.mapRect(boundingRect); 152 | 153 | if (m_clipRect.isValid()) { 154 | m_boundingRect = m_boundingRect.intersected(m_clipRect.toRect()); 155 | } 156 | 157 | // Overrides 158 | if (m_opacity < 1.0f) 159 | m_isOpaque = false; 160 | 161 | m_dirtyRegion = QRegion(m_boundingRect); 162 | } 163 | 164 | QRegion RenderableNode::renderNode(QPainter *painter, bool forceOpaquePainting) 165 | { 166 | Q_ASSERT(painter); 167 | 168 | // Check for don't paint conditions 169 | if (!m_isDirty || qFuzzyIsNull(m_opacity) || m_dirtyRegion.isEmpty()) { 170 | m_isDirty = false; 171 | m_dirtyRegion = QRegion(); 172 | return QRegion(); 173 | } 174 | 175 | painter->save(); 176 | painter->setOpacity(m_opacity); 177 | 178 | // Set clipRegion to m_dirtyRegion (in world coordinates) 179 | // as m_dirtyRegion already accounts for clipRegion 180 | painter->setClipRegion(m_dirtyRegion, Qt::ReplaceClip); 181 | 182 | painter->setTransform(m_transform, false); //precalculated worldTransform 183 | if (forceOpaquePainting || m_isOpaque) 184 | painter->setCompositionMode(QPainter::CompositionMode_Source); 185 | 186 | switch (m_nodeType) { 187 | case RenderableNode::SimpleRect: 188 | painter->fillRect(m_handle.simpleRectNode->rect(), m_handle.simpleRectNode->color()); 189 | break; 190 | case RenderableNode::SimpleTexture: 191 | { 192 | QSGTexture *texture = m_handle.simpleTextureNode->texture(); 193 | if (PixmapTexture *pt = dynamic_cast(texture)) { 194 | const QPixmap &pm = pt->pixmap(); 195 | painter->drawPixmap(m_handle.simpleTextureNode->rect(), pm, QRectF(0, 0, pm.width(), pm.height())); 196 | } else if (QSGPlainTexture *pt = dynamic_cast(texture)) { 197 | const QImage &im = pt->image(); 198 | painter->drawImage(m_handle.simpleTextureNode->rect(), im, QRectF(0, 0, im.width(), im.height())); 199 | } 200 | } 201 | break; 202 | case RenderableNode::Image: 203 | m_handle.imageNode->paint(painter); 204 | break; 205 | case RenderableNode::Painter: 206 | m_handle.painterNode->paint(painter); 207 | break; 208 | case RenderableNode::Rectangle: 209 | m_handle.rectangleNode->paint(painter); 210 | break; 211 | case RenderableNode::Glyph: 212 | m_handle.glpyhNode->paint(painter); 213 | break; 214 | case RenderableNode::NinePatch: 215 | m_handle.ninePatchNode->paint(painter); 216 | break; 217 | default: 218 | break; 219 | } 220 | 221 | painter->restore(); 222 | 223 | QRegion areaToBeFlushed = m_dirtyRegion; 224 | m_previousDirtyRegion = QRegion(m_boundingRect); 225 | m_isDirty = false; 226 | m_dirtyRegion = QRegion(); 227 | 228 | return areaToBeFlushed; 229 | } 230 | 231 | QRect RenderableNode::boundingRect() const 232 | { 233 | // This returns the bounding area of a renderable node in world coordinates 234 | return m_boundingRect; 235 | } 236 | 237 | bool RenderableNode::isDirtyRegionEmpty() const 238 | { 239 | return m_dirtyRegion.isEmpty(); 240 | } 241 | 242 | void RenderableNode::setTransform(const QTransform &transform) 243 | { 244 | if (m_transform == transform) 245 | return; 246 | m_transform = transform; 247 | update(); 248 | } 249 | 250 | void RenderableNode::setClipRect(const QRectF &clipRect) 251 | { 252 | if (m_clipRect == clipRect) 253 | return; 254 | 255 | m_clipRect = clipRect; 256 | update(); 257 | } 258 | 259 | void RenderableNode::setOpacity(float opacity) 260 | { 261 | if (qFuzzyCompare(m_opacity, opacity)) 262 | return; 263 | 264 | m_opacity = opacity; 265 | update(); 266 | } 267 | 268 | void RenderableNode::markGeometryDirty() 269 | { 270 | update(); 271 | } 272 | 273 | void RenderableNode::markMaterialDirty() 274 | { 275 | update(); 276 | } 277 | 278 | void RenderableNode::addDirtyRegion(const QRegion &dirtyRegion, bool forceDirty) 279 | { 280 | // Check if the dirty region applys to this node 281 | QRegion prev = m_dirtyRegion; 282 | if (dirtyRegion.intersects(boundingRect())) { 283 | if (forceDirty) 284 | m_isDirty = true; 285 | m_dirtyRegion += dirtyRegion.intersected(boundingRect()); 286 | } 287 | qCDebug(lcRenderable) << "addDirtyRegion: " << dirtyRegion << "old dirtyRegion: " << prev << "new dirtyRegion: " << m_dirtyRegion; 288 | } 289 | 290 | void RenderableNode::subtractDirtyRegion(const QRegion &dirtyRegion) 291 | { 292 | QRegion prev = m_dirtyRegion; 293 | if (m_isDirty) { 294 | // Check if this rect concerns us 295 | if (dirtyRegion.intersects(QRegion(boundingRect()))) { 296 | m_dirtyRegion -= dirtyRegion; 297 | if (m_dirtyRegion.isEmpty()) 298 | m_isDirty = false; 299 | } 300 | } 301 | qCDebug(lcRenderable) << "subtractDirtyRegion: " << dirtyRegion << "old dirtyRegion" << prev << "new dirtyRegion: " << m_dirtyRegion; 302 | } 303 | 304 | QRegion RenderableNode::previousDirtyRegion() const 305 | { 306 | return m_previousDirtyRegion.subtracted(QRegion(m_boundingRect)); 307 | } 308 | 309 | QRegion RenderableNode::dirtyRegion() const 310 | { 311 | return m_dirtyRegion; 312 | } 313 | 314 | } // namespace 315 | 316 | QT_END_NAMESPACE 317 | -------------------------------------------------------------------------------- /src/plugins/scenegraph/softwarecontext/abstractsoftwarerenderer.cpp: -------------------------------------------------------------------------------- 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 Qt Quick 2D Renderer module of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:GPL$ 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 General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU 19 | ** General Public License version 3 or (at your option) any later version 20 | ** approved by the KDE Free Qt Foundation. The licenses are as published by 21 | ** the Free Software Foundation and appearing in the file LICENSE.GPL3 22 | ** included in the packaging of this file. Please review the following 23 | ** information to ensure the GNU General Public License requirements will 24 | ** be met: https://www.gnu.org/licenses/gpl-3.0.html. 25 | ** 26 | ** $QT_END_LICENSE$ 27 | ** 28 | ****************************************************************************/ 29 | 30 | #include "abstractsoftwarerenderer.h" 31 | 32 | #include "renderablenodeupdater.h" 33 | #include "renderlistbuilder.h" 34 | #include "context.h" 35 | #include "renderablenode.h" 36 | 37 | #include 38 | #include 39 | #include 40 | 41 | Q_LOGGING_CATEGORY(lc2DRender, "qt.scenegraph.softwarecontext.abstractrenderer") 42 | 43 | QT_BEGIN_NAMESPACE 44 | 45 | namespace SoftwareContext{ 46 | 47 | AbstractSoftwareRenderer::AbstractSoftwareRenderer(QSGRenderContext *context) 48 | : QSGRenderer(context) 49 | , m_background(new QSGSimpleRectNode) 50 | , m_nodeUpdater(new RenderableNodeUpdater(this)) 51 | { 52 | // Setup special background node 53 | auto backgroundRenderable = new RenderableNode(RenderableNode::SimpleRect, m_background); 54 | addNodeMapping(m_background, backgroundRenderable); 55 | } 56 | 57 | AbstractSoftwareRenderer::~AbstractSoftwareRenderer() 58 | { 59 | // Cleanup RenderableNodes 60 | delete m_background; 61 | 62 | for (RenderableNode *node : m_nodes.values()) { 63 | delete node; 64 | } 65 | 66 | delete m_nodeUpdater; 67 | } 68 | 69 | RenderableNode *AbstractSoftwareRenderer::renderableNode(QSGNode *node) const 70 | { 71 | return m_nodes.value(node, nullptr); 72 | } 73 | 74 | void AbstractSoftwareRenderer::addNodeMapping(QSGNode *node, RenderableNode *renderableNode) 75 | { 76 | m_nodes.insert(node, renderableNode); 77 | } 78 | 79 | void AbstractSoftwareRenderer::appendRenderableNode(RenderableNode *node) 80 | { 81 | m_renderableNodes.append(node); 82 | } 83 | 84 | void AbstractSoftwareRenderer::nodeChanged(QSGNode *node, QSGNode::DirtyState state) 85 | { 86 | if (state & QSGNode::DirtyGeometry) { 87 | nodeGeometryUpdated(node); 88 | } 89 | if (state & QSGNode::DirtyMaterial) { 90 | nodeMaterialUpdated(node); 91 | } 92 | if (state & QSGNode::DirtyMatrix) { 93 | nodeMatrixUpdated(node); 94 | } 95 | if (state & QSGNode::DirtyNodeAdded) { 96 | nodeAdded(node); 97 | } 98 | if (state & QSGNode::DirtyNodeRemoved) { 99 | nodeRemoved(node); 100 | } 101 | if (state & QSGNode::DirtyOpacity) { 102 | nodeOpacityUpdated(node); 103 | } 104 | if (state & QSGNode::DirtySubtreeBlocked) { 105 | m_nodeUpdater->updateNodes(node); 106 | } 107 | if (state & QSGNode::DirtyForceUpdate) { 108 | m_nodeUpdater->updateNodes(node); 109 | } 110 | QSGRenderer::nodeChanged(node, state); 111 | } 112 | 113 | QRegion AbstractSoftwareRenderer::renderNodes(QPainter *painter) 114 | { 115 | QRegion dirtyRegion; 116 | // If there are no nodes, do nothing 117 | if (m_renderableNodes.isEmpty()) 118 | return dirtyRegion; 119 | 120 | auto iterator = m_renderableNodes.begin(); 121 | // First node is the background and needs to painted without blending 122 | auto backgroundNode = *iterator; 123 | dirtyRegion += backgroundNode->renderNode(painter, /*force opaque painting*/ true); 124 | iterator++; 125 | 126 | for (; iterator != m_renderableNodes.end(); ++iterator) { 127 | auto node = *iterator; 128 | dirtyRegion += node->renderNode(painter); 129 | } 130 | 131 | return dirtyRegion; 132 | } 133 | 134 | void AbstractSoftwareRenderer::buildRenderList() 135 | { 136 | // Clear the previous renderlist 137 | m_renderableNodes.clear(); 138 | // Add the background renderable (always first) 139 | m_renderableNodes.append(renderableNode(m_background)); 140 | // Build the renderlist 141 | RenderListBuilder(this).visitChildren(rootNode()); 142 | } 143 | 144 | void AbstractSoftwareRenderer::optimizeRenderList() 145 | { 146 | // Iterate through the renderlist from front to back 147 | // Objective is to update the dirty status and rects. 148 | for (auto i = m_renderableNodes.rbegin(); i != m_renderableNodes.rend(); ++i) { 149 | auto node = *i; 150 | if (!m_dirtyRegion.isEmpty()) { 151 | // See if the current dirty regions apply to the current node 152 | node->addDirtyRegion(m_dirtyRegion, true); 153 | } 154 | 155 | if (!m_obscuredRegion.isEmpty()) { 156 | // Don't try to paint things that are covered by opaque objects 157 | node->subtractDirtyRegion(m_obscuredRegion); 158 | } 159 | 160 | // Keep up with obscured regions 161 | if (node->isOpaque()) { 162 | m_obscuredRegion += QRegion(node->boundingRect()); 163 | } 164 | 165 | if (node->isDirty()) { 166 | // Don't paint things outside of the rendering area 167 | if (!m_background->rect().toRect().contains(node->boundingRect(), /*proper*/ true)) { 168 | // Some part(s) of node is(are) outside of the rendering area 169 | QRegion renderArea(m_background->rect().toRect()); 170 | QRegion outsideRegions = node->dirtyRegion().subtracted(renderArea); 171 | if (!outsideRegions.isEmpty()) 172 | node->subtractDirtyRegion(outsideRegions); 173 | } 174 | 175 | // Get the dirty region's to pass to the next nodes 176 | if (node->isOpaque()) { 177 | // if isOpaque, subtract node's dirty rect from m_dirtyRegion 178 | m_dirtyRegion -= node->dirtyRegion(); 179 | } else { 180 | // if isAlpha, add node's dirty rect to m_dirtyRegion 181 | m_dirtyRegion += node->dirtyRegion(); 182 | } 183 | // if previousDirtyRegion has content outside of boundingRect add to m_dirtyRegion 184 | QRegion prevDirty = node->previousDirtyRegion(); 185 | if (!prevDirty.isNull()) 186 | m_dirtyRegion += prevDirty; 187 | } 188 | } 189 | 190 | // Empty dirtyRegion (for second pass) 191 | m_dirtyRegion = QRegion(); 192 | m_obscuredRegion = QRegion(); 193 | 194 | // Iterate through the renderlist from back to front 195 | // Objective is to make sure all non-opaque items are painted when an item under them is dirty 196 | for (auto j = m_renderableNodes.begin(); j != m_renderableNodes.end(); ++j) { 197 | auto node = *j; 198 | 199 | if (!node->isOpaque() && !m_dirtyRegion.isEmpty()) { 200 | // Only blended nodes need to be updated 201 | node->addDirtyRegion(m_dirtyRegion, true); 202 | } 203 | 204 | m_dirtyRegion += node->dirtyRegion(); 205 | } 206 | 207 | // Empty dirtyRegion 208 | m_dirtyRegion = QRegion(); 209 | m_obscuredRegion = QRegion(); 210 | } 211 | 212 | void AbstractSoftwareRenderer::setBackgroundColor(const QColor &color) 213 | { 214 | if (m_background->color() == color) 215 | return; 216 | m_background->setColor(color); 217 | renderableNode(m_background)->markMaterialDirty(); 218 | } 219 | 220 | void AbstractSoftwareRenderer::setBackgroundSize(const QSize &size) 221 | { 222 | if (m_background->rect().size().toSize() == size) 223 | return; 224 | m_background->setRect(0.0f, 0.0f, size.width(), size.height()); 225 | renderableNode(m_background)->markGeometryDirty(); 226 | // Invalidate the whole scene when the background is resized 227 | m_dirtyRegion = QRegion(m_background->rect().toRect()); 228 | } 229 | 230 | QColor AbstractSoftwareRenderer::backgroundColor() 231 | { 232 | return m_background->color(); 233 | } 234 | 235 | QSize AbstractSoftwareRenderer::backgroundSize() 236 | { 237 | return m_background->rect().size().toSize(); 238 | } 239 | 240 | void AbstractSoftwareRenderer::nodeAdded(QSGNode *node) 241 | { 242 | qCDebug(lc2DRender) << "nodeAdded" << (void*)node; 243 | 244 | m_nodeUpdater->updateNodes(node); 245 | } 246 | 247 | void AbstractSoftwareRenderer::nodeRemoved(QSGNode *node) 248 | { 249 | qCDebug(lc2DRender) << "nodeRemoved" << (void*)node; 250 | 251 | auto renderable = renderableNode(node); 252 | // remove mapping 253 | if (renderable != nullptr) { 254 | // Need to mark this region dirty in the other nodes 255 | QRegion dirtyRegion = renderable->previousDirtyRegion(); 256 | if (dirtyRegion.isEmpty()) 257 | dirtyRegion = renderable->boundingRect(); 258 | m_dirtyRegion += dirtyRegion; 259 | m_nodes.remove(node); 260 | delete renderable; 261 | } 262 | 263 | // Remove all children nodes as well 264 | for (QSGNode *child = node->firstChild(); child; child = child->nextSibling()) { 265 | nodeRemoved(child); 266 | } 267 | 268 | m_nodeUpdater->updateNodes(node, true); 269 | } 270 | 271 | void AbstractSoftwareRenderer::nodeGeometryUpdated(QSGNode *node) 272 | { 273 | qCDebug(lc2DRender) << "nodeGeometryUpdated"; 274 | 275 | // Mark node as dirty 276 | auto renderable = renderableNode(node); 277 | if (renderable != nullptr) { 278 | renderable->markGeometryDirty(); 279 | } else { 280 | m_nodeUpdater->updateNodes(node); 281 | } 282 | } 283 | 284 | void AbstractSoftwareRenderer::nodeMaterialUpdated(QSGNode *node) 285 | { 286 | qCDebug(lc2DRender) << "nodeMaterialUpdated"; 287 | 288 | // Mark node as dirty 289 | auto renderable = renderableNode(node); 290 | if (renderable != nullptr) { 291 | renderable->markMaterialDirty(); 292 | } else { 293 | m_nodeUpdater->updateNodes(node); 294 | } 295 | } 296 | 297 | void AbstractSoftwareRenderer::nodeMatrixUpdated(QSGNode *node) 298 | { 299 | qCDebug(lc2DRender) << "nodeMaterialUpdated"; 300 | 301 | // Update children nodes 302 | m_nodeUpdater->updateNodes(node); 303 | } 304 | 305 | void AbstractSoftwareRenderer::nodeOpacityUpdated(QSGNode *node) 306 | { 307 | qCDebug(lc2DRender) << "nodeOpacityUpdated"; 308 | 309 | // Update children nodes 310 | m_nodeUpdater->updateNodes(node); 311 | } 312 | 313 | } 314 | 315 | QT_END_NAMESPACE 316 | -------------------------------------------------------------------------------- /tools/opengldummy/3rdparty/include/KHR/khrplatform.h: -------------------------------------------------------------------------------- 1 | #ifndef __khrplatform_h_ 2 | #define __khrplatform_h_ 3 | 4 | /* 5 | ** Copyright (c) 2008-2009 The Khronos Group Inc. 6 | ** 7 | ** Permission is hereby granted, free of charge, to any person obtaining a 8 | ** copy of this software and/or associated documentation files (the 9 | ** "Materials"), to deal in the Materials without restriction, including 10 | ** without limitation the rights to use, copy, modify, merge, publish, 11 | ** distribute, sublicense, and/or sell copies of the Materials, and to 12 | ** permit persons to whom the Materials are furnished to do so, subject to 13 | ** the following conditions: 14 | ** 15 | ** The above copyright notice and this permission notice shall be included 16 | ** in all copies or substantial portions of the Materials. 17 | ** 18 | ** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | ** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 20 | ** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 21 | ** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 22 | ** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 23 | ** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 24 | ** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. 25 | */ 26 | 27 | /* Khronos platform-specific types and definitions. 28 | * 29 | * $Revision: 23298 $ on $Date: 2013-09-30 17:07:13 -0700 (Mon, 30 Sep 2013) $ 30 | * 31 | * Adopters may modify this file to suit their platform. Adopters are 32 | * encouraged to submit platform specific modifications to the Khronos 33 | * group so that they can be included in future versions of this file. 34 | * Please submit changes by sending them to the public Khronos Bugzilla 35 | * (http://khronos.org/bugzilla) by filing a bug against product 36 | * "Khronos (general)" component "Registry". 37 | * 38 | * A predefined template which fills in some of the bug fields can be 39 | * reached using http://tinyurl.com/khrplatform-h-bugreport, but you 40 | * must create a Bugzilla login first. 41 | * 42 | * 43 | * See the Implementer's Guidelines for information about where this file 44 | * should be located on your system and for more details of its use: 45 | * http://www.khronos.org/registry/implementers_guide.pdf 46 | * 47 | * This file should be included as 48 | * #include 49 | * by Khronos client API header files that use its types and defines. 50 | * 51 | * The types in khrplatform.h should only be used to define API-specific types. 52 | * 53 | * Types defined in khrplatform.h: 54 | * khronos_int8_t signed 8 bit 55 | * khronos_uint8_t unsigned 8 bit 56 | * khronos_int16_t signed 16 bit 57 | * khronos_uint16_t unsigned 16 bit 58 | * khronos_int32_t signed 32 bit 59 | * khronos_uint32_t unsigned 32 bit 60 | * khronos_int64_t signed 64 bit 61 | * khronos_uint64_t unsigned 64 bit 62 | * khronos_intptr_t signed same number of bits as a pointer 63 | * khronos_uintptr_t unsigned same number of bits as a pointer 64 | * khronos_ssize_t signed size 65 | * khronos_usize_t unsigned size 66 | * khronos_float_t signed 32 bit floating point 67 | * khronos_time_ns_t unsigned 64 bit time in nanoseconds 68 | * khronos_utime_nanoseconds_t unsigned time interval or absolute time in 69 | * nanoseconds 70 | * khronos_stime_nanoseconds_t signed time interval in nanoseconds 71 | * khronos_boolean_enum_t enumerated boolean type. This should 72 | * only be used as a base type when a client API's boolean type is 73 | * an enum. Client APIs which use an integer or other type for 74 | * booleans cannot use this as the base type for their boolean. 75 | * 76 | * Tokens defined in khrplatform.h: 77 | * 78 | * KHRONOS_FALSE, KHRONOS_TRUE Enumerated boolean false/true values. 79 | * 80 | * KHRONOS_SUPPORT_INT64 is 1 if 64 bit integers are supported; otherwise 0. 81 | * KHRONOS_SUPPORT_FLOAT is 1 if floats are supported; otherwise 0. 82 | * 83 | * Calling convention macros defined in this file: 84 | * KHRONOS_APICALL 85 | * KHRONOS_APIENTRY 86 | * KHRONOS_APIATTRIBUTES 87 | * 88 | * These may be used in function prototypes as: 89 | * 90 | * KHRONOS_APICALL void KHRONOS_APIENTRY funcname( 91 | * int arg1, 92 | * int arg2) KHRONOS_APIATTRIBUTES; 93 | */ 94 | 95 | /*------------------------------------------------------------------------- 96 | * Definition of KHRONOS_APICALL 97 | *------------------------------------------------------------------------- 98 | * This precedes the return type of the function in the function prototype. 99 | */ 100 | #if defined(_WIN32) && !defined(__SCITECH_SNAP__) 101 | /* QtGlesStream */ 102 | #ifdef QGS_BUILD_CLIENT_DLL 103 | # define KHRONOS_APICALL __declspec(dllexport) 104 | #else 105 | # define KHRONOS_APICALL __declspec(dllimport) 106 | #endif 107 | #elif defined (__SYMBIAN32__) 108 | # define KHRONOS_APICALL IMPORT_C 109 | #else 110 | # define KHRONOS_APICALL 111 | #endif 112 | 113 | /*------------------------------------------------------------------------- 114 | * Definition of KHRONOS_APIENTRY 115 | *------------------------------------------------------------------------- 116 | * This follows the return type of the function and precedes the function 117 | * name in the function prototype. 118 | */ 119 | #if defined(_WIN32) && !defined(_WIN32_WCE) && !defined(__SCITECH_SNAP__) 120 | /* Win32 but not WinCE */ 121 | # define KHRONOS_APIENTRY __stdcall 122 | #else 123 | # define KHRONOS_APIENTRY 124 | #endif 125 | 126 | /*------------------------------------------------------------------------- 127 | * Definition of KHRONOS_APIATTRIBUTES 128 | *------------------------------------------------------------------------- 129 | * This follows the closing parenthesis of the function prototype arguments. 130 | */ 131 | #if defined (__ARMCC_2__) 132 | #define KHRONOS_APIATTRIBUTES __softfp 133 | #else 134 | #define KHRONOS_APIATTRIBUTES 135 | #endif 136 | 137 | /*------------------------------------------------------------------------- 138 | * basic type definitions 139 | *-----------------------------------------------------------------------*/ 140 | #if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || defined(__GNUC__) || defined(__SCO__) || defined(__USLC__) 141 | 142 | 143 | /* 144 | * Using 145 | */ 146 | #include 147 | typedef int32_t khronos_int32_t; 148 | typedef uint32_t khronos_uint32_t; 149 | typedef int64_t khronos_int64_t; 150 | typedef uint64_t khronos_uint64_t; 151 | #define KHRONOS_SUPPORT_INT64 1 152 | #define KHRONOS_SUPPORT_FLOAT 1 153 | 154 | #elif defined(__VMS ) || defined(__sgi) 155 | 156 | /* 157 | * Using 158 | */ 159 | #include 160 | typedef int32_t khronos_int32_t; 161 | typedef uint32_t khronos_uint32_t; 162 | typedef int64_t khronos_int64_t; 163 | typedef uint64_t khronos_uint64_t; 164 | #define KHRONOS_SUPPORT_INT64 1 165 | #define KHRONOS_SUPPORT_FLOAT 1 166 | 167 | #elif defined(_WIN32) && !defined(__SCITECH_SNAP__) 168 | 169 | /* 170 | * Win32 171 | */ 172 | typedef __int32 khronos_int32_t; 173 | typedef unsigned __int32 khronos_uint32_t; 174 | typedef __int64 khronos_int64_t; 175 | typedef unsigned __int64 khronos_uint64_t; 176 | #define KHRONOS_SUPPORT_INT64 1 177 | #define KHRONOS_SUPPORT_FLOAT 1 178 | 179 | #elif defined(__sun__) || defined(__digital__) 180 | 181 | /* 182 | * Sun or Digital 183 | */ 184 | typedef int khronos_int32_t; 185 | typedef unsigned int khronos_uint32_t; 186 | #if defined(__arch64__) || defined(_LP64) 187 | typedef long int khronos_int64_t; 188 | typedef unsigned long int khronos_uint64_t; 189 | #else 190 | typedef long long int khronos_int64_t; 191 | typedef unsigned long long int khronos_uint64_t; 192 | #endif /* __arch64__ */ 193 | #define KHRONOS_SUPPORT_INT64 1 194 | #define KHRONOS_SUPPORT_FLOAT 1 195 | 196 | #elif 0 197 | 198 | /* 199 | * Hypothetical platform with no float or int64 support 200 | */ 201 | typedef int khronos_int32_t; 202 | typedef unsigned int khronos_uint32_t; 203 | #define KHRONOS_SUPPORT_INT64 0 204 | #define KHRONOS_SUPPORT_FLOAT 0 205 | 206 | #else 207 | 208 | /* 209 | * Generic fallback 210 | */ 211 | #include 212 | typedef int32_t khronos_int32_t; 213 | typedef uint32_t khronos_uint32_t; 214 | typedef int64_t khronos_int64_t; 215 | typedef uint64_t khronos_uint64_t; 216 | #define KHRONOS_SUPPORT_INT64 1 217 | #define KHRONOS_SUPPORT_FLOAT 1 218 | 219 | #endif 220 | 221 | 222 | /* 223 | * Types that are (so far) the same on all platforms 224 | */ 225 | typedef signed char khronos_int8_t; 226 | typedef unsigned char khronos_uint8_t; 227 | typedef signed short int khronos_int16_t; 228 | typedef unsigned short int khronos_uint16_t; 229 | 230 | #if 1 231 | 232 | /* QtGlesStream */ 233 | #include 234 | typedef ptrdiff_t khronos_intptr_t; 235 | typedef ptrdiff_t khronos_ssize_t; 236 | 237 | #else 238 | 239 | /* 240 | * Types that differ between LLP64 and LP64 architectures - in LLP64, 241 | * pointers are 64 bits, but 'long' is still 32 bits. Win64 appears 242 | * to be the only LLP64 architecture in current use. 243 | */ 244 | #ifdef _WIN64 245 | typedef signed long long int khronos_intptr_t; 246 | typedef unsigned long long int khronos_uintptr_t; 247 | typedef signed long long int khronos_ssize_t; 248 | typedef unsigned long long int khronos_usize_t; 249 | #else 250 | typedef signed long int khronos_intptr_t; 251 | typedef unsigned long int khronos_uintptr_t; 252 | typedef signed long int khronos_ssize_t; 253 | typedef unsigned long int khronos_usize_t; 254 | #endif 255 | 256 | #endif 257 | 258 | #if KHRONOS_SUPPORT_FLOAT 259 | /* 260 | * Float type 261 | */ 262 | typedef float khronos_float_t; 263 | #endif 264 | 265 | #if KHRONOS_SUPPORT_INT64 266 | /* Time types 267 | * 268 | * These types can be used to represent a time interval in nanoseconds or 269 | * an absolute Unadjusted System Time. Unadjusted System Time is the number 270 | * of nanoseconds since some arbitrary system event (e.g. since the last 271 | * time the system booted). The Unadjusted System Time is an unsigned 272 | * 64 bit value that wraps back to 0 every 584 years. Time intervals 273 | * may be either signed or unsigned. 274 | */ 275 | typedef khronos_uint64_t khronos_utime_nanoseconds_t; 276 | typedef khronos_int64_t khronos_stime_nanoseconds_t; 277 | #endif 278 | 279 | /* 280 | * Dummy value used to pad enum types to 32 bits. 281 | */ 282 | #ifndef KHRONOS_MAX_ENUM 283 | #define KHRONOS_MAX_ENUM 0x7FFFFFFF 284 | #endif 285 | 286 | /* 287 | * Enumerated boolean type 288 | * 289 | * Values other than zero should be considered to be true. Therefore 290 | * comparisons should not be made against KHRONOS_TRUE. 291 | */ 292 | typedef enum { 293 | KHRONOS_FALSE = 0, 294 | KHRONOS_TRUE = 1, 295 | KHRONOS_BOOLEAN_ENUM_FORCE_SIZE = KHRONOS_MAX_ENUM 296 | } khronos_boolean_enum_t; 297 | 298 | #endif /* __khrplatform_h_ */ 299 | -------------------------------------------------------------------------------- /tools/opengldummy/3rdparty/include/EGL/egl.h: -------------------------------------------------------------------------------- 1 | /* -*- mode: c; tab-width: 8; -*- */ 2 | /* vi: set sw=4 ts=8: */ 3 | /* Reference version of egl.h for EGL 1.4. 4 | * $Revision: 9356 $ on $Date: 2009-10-21 02:52:25 -0700 (Wed, 21 Oct 2009) $ 5 | */ 6 | 7 | /* 8 | ** Copyright (c) 2007-2009 The Khronos Group Inc. 9 | ** 10 | ** Permission is hereby granted, free of charge, to any person obtaining a 11 | ** copy of this software and/or associated documentation files (the 12 | ** "Materials"), to deal in the Materials without restriction, including 13 | ** without limitation the rights to use, copy, modify, merge, publish, 14 | ** distribute, sublicense, and/or sell copies of the Materials, and to 15 | ** permit persons to whom the Materials are furnished to do so, subject to 16 | ** the following conditions: 17 | ** 18 | ** The above copyright notice and this permission notice shall be included 19 | ** in all copies or substantial portions of the Materials. 20 | ** 21 | ** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | ** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 23 | ** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 24 | ** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 25 | ** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 26 | ** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 27 | ** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. 28 | */ 29 | 30 | #ifndef __egl_h_ 31 | #define __egl_h_ 32 | 33 | /* All platform-dependent types and macro boilerplate (such as EGLAPI 34 | * and EGLAPIENTRY) should go in eglplatform.h. 35 | */ 36 | #include 37 | 38 | #ifdef __cplusplus 39 | extern "C" { 40 | #endif 41 | 42 | /* EGL Types */ 43 | /* EGLint is defined in eglplatform.h */ 44 | typedef unsigned int EGLBoolean; 45 | typedef unsigned int EGLenum; 46 | typedef void *EGLConfig; 47 | typedef void *EGLContext; 48 | typedef void *EGLDisplay; 49 | typedef void *EGLSurface; 50 | typedef void *EGLClientBuffer; 51 | 52 | /* EGL Versioning */ 53 | #define EGL_VERSION_1_0 1 54 | #define EGL_VERSION_1_1 1 55 | #define EGL_VERSION_1_2 1 56 | #define EGL_VERSION_1_3 1 57 | #define EGL_VERSION_1_4 1 58 | 59 | /* EGL Enumerants. Bitmasks and other exceptional cases aside, most 60 | * enums are assigned unique values starting at 0x3000. 61 | */ 62 | 63 | /* EGL aliases */ 64 | #define EGL_FALSE 0 65 | #define EGL_TRUE 1 66 | 67 | /* Out-of-band handle values */ 68 | #define EGL_DEFAULT_DISPLAY ((EGLNativeDisplayType)0) 69 | #define EGL_NO_CONTEXT ((EGLContext)0) 70 | #define EGL_NO_DISPLAY ((EGLDisplay)0) 71 | #define EGL_NO_SURFACE ((EGLSurface)0) 72 | 73 | /* Out-of-band attribute value */ 74 | #define EGL_DONT_CARE ((EGLint)-1) 75 | 76 | /* Errors / GetError return values */ 77 | #define EGL_SUCCESS 0x3000 78 | #define EGL_NOT_INITIALIZED 0x3001 79 | #define EGL_BAD_ACCESS 0x3002 80 | #define EGL_BAD_ALLOC 0x3003 81 | #define EGL_BAD_ATTRIBUTE 0x3004 82 | #define EGL_BAD_CONFIG 0x3005 83 | #define EGL_BAD_CONTEXT 0x3006 84 | #define EGL_BAD_CURRENT_SURFACE 0x3007 85 | #define EGL_BAD_DISPLAY 0x3008 86 | #define EGL_BAD_MATCH 0x3009 87 | #define EGL_BAD_NATIVE_PIXMAP 0x300A 88 | #define EGL_BAD_NATIVE_WINDOW 0x300B 89 | #define EGL_BAD_PARAMETER 0x300C 90 | #define EGL_BAD_SURFACE 0x300D 91 | #define EGL_CONTEXT_LOST 0x300E /* EGL 1.1 - IMG_power_management */ 92 | 93 | /* Reserved 0x300F-0x301F for additional errors */ 94 | 95 | /* Config attributes */ 96 | #define EGL_BUFFER_SIZE 0x3020 97 | #define EGL_ALPHA_SIZE 0x3021 98 | #define EGL_BLUE_SIZE 0x3022 99 | #define EGL_GREEN_SIZE 0x3023 100 | #define EGL_RED_SIZE 0x3024 101 | #define EGL_DEPTH_SIZE 0x3025 102 | #define EGL_STENCIL_SIZE 0x3026 103 | #define EGL_CONFIG_CAVEAT 0x3027 104 | #define EGL_CONFIG_ID 0x3028 105 | #define EGL_LEVEL 0x3029 106 | #define EGL_MAX_PBUFFER_HEIGHT 0x302A 107 | #define EGL_MAX_PBUFFER_PIXELS 0x302B 108 | #define EGL_MAX_PBUFFER_WIDTH 0x302C 109 | #define EGL_NATIVE_RENDERABLE 0x302D 110 | #define EGL_NATIVE_VISUAL_ID 0x302E 111 | #define EGL_NATIVE_VISUAL_TYPE 0x302F 112 | #define EGL_SAMPLES 0x3031 113 | #define EGL_SAMPLE_BUFFERS 0x3032 114 | #define EGL_SURFACE_TYPE 0x3033 115 | #define EGL_TRANSPARENT_TYPE 0x3034 116 | #define EGL_TRANSPARENT_BLUE_VALUE 0x3035 117 | #define EGL_TRANSPARENT_GREEN_VALUE 0x3036 118 | #define EGL_TRANSPARENT_RED_VALUE 0x3037 119 | #define EGL_NONE 0x3038 /* Attrib list terminator */ 120 | #define EGL_BIND_TO_TEXTURE_RGB 0x3039 121 | #define EGL_BIND_TO_TEXTURE_RGBA 0x303A 122 | #define EGL_MIN_SWAP_INTERVAL 0x303B 123 | #define EGL_MAX_SWAP_INTERVAL 0x303C 124 | #define EGL_LUMINANCE_SIZE 0x303D 125 | #define EGL_ALPHA_MASK_SIZE 0x303E 126 | #define EGL_COLOR_BUFFER_TYPE 0x303F 127 | #define EGL_RENDERABLE_TYPE 0x3040 128 | #define EGL_MATCH_NATIVE_PIXMAP 0x3041 /* Pseudo-attribute (not queryable) */ 129 | #define EGL_CONFORMANT 0x3042 130 | 131 | /* Reserved 0x3041-0x304F for additional config attributes */ 132 | 133 | /* Config attribute values */ 134 | #define EGL_SLOW_CONFIG 0x3050 /* EGL_CONFIG_CAVEAT value */ 135 | #define EGL_NON_CONFORMANT_CONFIG 0x3051 /* EGL_CONFIG_CAVEAT value */ 136 | #define EGL_TRANSPARENT_RGB 0x3052 /* EGL_TRANSPARENT_TYPE value */ 137 | #define EGL_RGB_BUFFER 0x308E /* EGL_COLOR_BUFFER_TYPE value */ 138 | #define EGL_LUMINANCE_BUFFER 0x308F /* EGL_COLOR_BUFFER_TYPE value */ 139 | 140 | /* More config attribute values, for EGL_TEXTURE_FORMAT */ 141 | #define EGL_NO_TEXTURE 0x305C 142 | #define EGL_TEXTURE_RGB 0x305D 143 | #define EGL_TEXTURE_RGBA 0x305E 144 | #define EGL_TEXTURE_2D 0x305F 145 | 146 | /* Config attribute mask bits */ 147 | #define EGL_PBUFFER_BIT 0x0001 /* EGL_SURFACE_TYPE mask bits */ 148 | #define EGL_PIXMAP_BIT 0x0002 /* EGL_SURFACE_TYPE mask bits */ 149 | #define EGL_WINDOW_BIT 0x0004 /* EGL_SURFACE_TYPE mask bits */ 150 | #define EGL_VG_COLORSPACE_LINEAR_BIT 0x0020 /* EGL_SURFACE_TYPE mask bits */ 151 | #define EGL_VG_ALPHA_FORMAT_PRE_BIT 0x0040 /* EGL_SURFACE_TYPE mask bits */ 152 | #define EGL_MULTISAMPLE_RESOLVE_BOX_BIT 0x0200 /* EGL_SURFACE_TYPE mask bits */ 153 | #define EGL_SWAP_BEHAVIOR_PRESERVED_BIT 0x0400 /* EGL_SURFACE_TYPE mask bits */ 154 | 155 | #define EGL_OPENGL_ES_BIT 0x0001 /* EGL_RENDERABLE_TYPE mask bits */ 156 | #define EGL_OPENVG_BIT 0x0002 /* EGL_RENDERABLE_TYPE mask bits */ 157 | #define EGL_OPENGL_ES2_BIT 0x0004 /* EGL_RENDERABLE_TYPE mask bits */ 158 | #define EGL_OPENGL_BIT 0x0008 /* EGL_RENDERABLE_TYPE mask bits */ 159 | 160 | /* QueryString targets */ 161 | #define EGL_VENDOR 0x3053 162 | #define EGL_VERSION 0x3054 163 | #define EGL_EXTENSIONS 0x3055 164 | #define EGL_CLIENT_APIS 0x308D 165 | 166 | /* QuerySurface / SurfaceAttrib / CreatePbufferSurface targets */ 167 | #define EGL_HEIGHT 0x3056 168 | #define EGL_WIDTH 0x3057 169 | #define EGL_LARGEST_PBUFFER 0x3058 170 | #define EGL_TEXTURE_FORMAT 0x3080 171 | #define EGL_TEXTURE_TARGET 0x3081 172 | #define EGL_MIPMAP_TEXTURE 0x3082 173 | #define EGL_MIPMAP_LEVEL 0x3083 174 | #define EGL_RENDER_BUFFER 0x3086 175 | #define EGL_VG_COLORSPACE 0x3087 176 | #define EGL_VG_ALPHA_FORMAT 0x3088 177 | #define EGL_HORIZONTAL_RESOLUTION 0x3090 178 | #define EGL_VERTICAL_RESOLUTION 0x3091 179 | #define EGL_PIXEL_ASPECT_RATIO 0x3092 180 | #define EGL_SWAP_BEHAVIOR 0x3093 181 | #define EGL_MULTISAMPLE_RESOLVE 0x3099 182 | 183 | /* EGL_RENDER_BUFFER values / BindTexImage / ReleaseTexImage buffer targets */ 184 | #define EGL_BACK_BUFFER 0x3084 185 | #define EGL_SINGLE_BUFFER 0x3085 186 | 187 | /* OpenVG color spaces */ 188 | #define EGL_VG_COLORSPACE_sRGB 0x3089 /* EGL_VG_COLORSPACE value */ 189 | #define EGL_VG_COLORSPACE_LINEAR 0x308A /* EGL_VG_COLORSPACE value */ 190 | 191 | /* OpenVG alpha formats */ 192 | #define EGL_VG_ALPHA_FORMAT_NONPRE 0x308B /* EGL_ALPHA_FORMAT value */ 193 | #define EGL_VG_ALPHA_FORMAT_PRE 0x308C /* EGL_ALPHA_FORMAT value */ 194 | 195 | /* Constant scale factor by which fractional display resolutions & 196 | * aspect ratio are scaled when queried as integer values. 197 | */ 198 | #define EGL_DISPLAY_SCALING 10000 199 | 200 | /* Unknown display resolution/aspect ratio */ 201 | #define EGL_UNKNOWN ((EGLint)-1) 202 | 203 | /* Back buffer swap behaviors */ 204 | #define EGL_BUFFER_PRESERVED 0x3094 /* EGL_SWAP_BEHAVIOR value */ 205 | #define EGL_BUFFER_DESTROYED 0x3095 /* EGL_SWAP_BEHAVIOR value */ 206 | 207 | /* CreatePbufferFromClientBuffer buffer types */ 208 | #define EGL_OPENVG_IMAGE 0x3096 209 | 210 | /* QueryContext targets */ 211 | #define EGL_CONTEXT_CLIENT_TYPE 0x3097 212 | 213 | /* CreateContext attributes */ 214 | #define EGL_CONTEXT_CLIENT_VERSION 0x3098 215 | 216 | /* Multisample resolution behaviors */ 217 | #define EGL_MULTISAMPLE_RESOLVE_DEFAULT 0x309A /* EGL_MULTISAMPLE_RESOLVE value */ 218 | #define EGL_MULTISAMPLE_RESOLVE_BOX 0x309B /* EGL_MULTISAMPLE_RESOLVE value */ 219 | 220 | /* BindAPI/QueryAPI targets */ 221 | #define EGL_OPENGL_ES_API 0x30A0 222 | #define EGL_OPENVG_API 0x30A1 223 | #define EGL_OPENGL_API 0x30A2 224 | 225 | /* GetCurrentSurface targets */ 226 | #define EGL_DRAW 0x3059 227 | #define EGL_READ 0x305A 228 | 229 | /* WaitNative engines */ 230 | #define EGL_CORE_NATIVE_ENGINE 0x305B 231 | 232 | /* EGL 1.2 tokens renamed for consistency in EGL 1.3 */ 233 | #define EGL_COLORSPACE EGL_VG_COLORSPACE 234 | #define EGL_ALPHA_FORMAT EGL_VG_ALPHA_FORMAT 235 | #define EGL_COLORSPACE_sRGB EGL_VG_COLORSPACE_sRGB 236 | #define EGL_COLORSPACE_LINEAR EGL_VG_COLORSPACE_LINEAR 237 | #define EGL_ALPHA_FORMAT_NONPRE EGL_VG_ALPHA_FORMAT_NONPRE 238 | #define EGL_ALPHA_FORMAT_PRE EGL_VG_ALPHA_FORMAT_PRE 239 | 240 | /* EGL extensions must request enum blocks from the Khronos 241 | * API Registrar, who maintains the enumerant registry. Submit 242 | * a bug in Khronos Bugzilla against task "Registry". 243 | */ 244 | 245 | 246 | 247 | /* EGL Functions */ 248 | 249 | EGLAPI EGLint EGLAPIENTRY eglGetError(void); 250 | 251 | EGLAPI EGLDisplay EGLAPIENTRY eglGetDisplay(EGLNativeDisplayType display_id); 252 | EGLAPI EGLBoolean EGLAPIENTRY eglInitialize(EGLDisplay dpy, EGLint *major, EGLint *minor); 253 | EGLAPI EGLBoolean EGLAPIENTRY eglTerminate(EGLDisplay dpy); 254 | 255 | EGLAPI const char * EGLAPIENTRY eglQueryString(EGLDisplay dpy, EGLint name); 256 | 257 | EGLAPI EGLBoolean EGLAPIENTRY eglGetConfigs(EGLDisplay dpy, EGLConfig *configs, 258 | EGLint config_size, EGLint *num_config); 259 | EGLAPI EGLBoolean EGLAPIENTRY eglChooseConfig(EGLDisplay dpy, const EGLint *attrib_list, 260 | EGLConfig *configs, EGLint config_size, 261 | EGLint *num_config); 262 | EGLAPI EGLBoolean EGLAPIENTRY eglGetConfigAttrib(EGLDisplay dpy, EGLConfig config, 263 | EGLint attribute, EGLint *value); 264 | 265 | EGLAPI EGLSurface EGLAPIENTRY eglCreateWindowSurface(EGLDisplay dpy, EGLConfig config, 266 | EGLNativeWindowType win, 267 | const EGLint *attrib_list); 268 | EGLAPI EGLSurface EGLAPIENTRY eglCreatePbufferSurface(EGLDisplay dpy, EGLConfig config, 269 | const EGLint *attrib_list); 270 | EGLAPI EGLSurface EGLAPIENTRY eglCreatePixmapSurface(EGLDisplay dpy, EGLConfig config, 271 | EGLNativePixmapType pixmap, 272 | const EGLint *attrib_list); 273 | EGLAPI EGLBoolean EGLAPIENTRY eglDestroySurface(EGLDisplay dpy, EGLSurface surface); 274 | EGLAPI EGLBoolean EGLAPIENTRY eglQuerySurface(EGLDisplay dpy, EGLSurface surface, 275 | EGLint attribute, EGLint *value); 276 | 277 | EGLAPI EGLBoolean EGLAPIENTRY eglBindAPI(EGLenum api); 278 | EGLAPI EGLenum EGLAPIENTRY eglQueryAPI(void); 279 | 280 | EGLAPI EGLBoolean EGLAPIENTRY eglWaitClient(void); 281 | 282 | EGLAPI EGLBoolean EGLAPIENTRY eglReleaseThread(void); 283 | 284 | EGLAPI EGLSurface EGLAPIENTRY eglCreatePbufferFromClientBuffer( 285 | EGLDisplay dpy, EGLenum buftype, EGLClientBuffer buffer, 286 | EGLConfig config, const EGLint *attrib_list); 287 | 288 | EGLAPI EGLBoolean EGLAPIENTRY eglSurfaceAttrib(EGLDisplay dpy, EGLSurface surface, 289 | EGLint attribute, EGLint value); 290 | EGLAPI EGLBoolean EGLAPIENTRY eglBindTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer); 291 | EGLAPI EGLBoolean EGLAPIENTRY eglReleaseTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer); 292 | 293 | 294 | EGLAPI EGLBoolean EGLAPIENTRY eglSwapInterval(EGLDisplay dpy, EGLint interval); 295 | 296 | 297 | EGLAPI EGLContext EGLAPIENTRY eglCreateContext(EGLDisplay dpy, EGLConfig config, 298 | EGLContext share_context, 299 | const EGLint *attrib_list); 300 | EGLAPI EGLBoolean EGLAPIENTRY eglDestroyContext(EGLDisplay dpy, EGLContext ctx); 301 | EGLAPI EGLBoolean EGLAPIENTRY eglMakeCurrent(EGLDisplay dpy, EGLSurface draw, 302 | EGLSurface read, EGLContext ctx); 303 | 304 | EGLAPI EGLContext EGLAPIENTRY eglGetCurrentContext(void); 305 | EGLAPI EGLSurface EGLAPIENTRY eglGetCurrentSurface(EGLint readdraw); 306 | EGLAPI EGLDisplay EGLAPIENTRY eglGetCurrentDisplay(void); 307 | EGLAPI EGLBoolean EGLAPIENTRY eglQueryContext(EGLDisplay dpy, EGLContext ctx, 308 | EGLint attribute, EGLint *value); 309 | 310 | EGLAPI EGLBoolean EGLAPIENTRY eglWaitGL(void); 311 | EGLAPI EGLBoolean EGLAPIENTRY eglWaitNative(EGLint engine); 312 | EGLAPI EGLBoolean EGLAPIENTRY eglSwapBuffers(EGLDisplay dpy, EGLSurface surface); 313 | EGLAPI EGLBoolean EGLAPIENTRY eglCopyBuffers(EGLDisplay dpy, EGLSurface surface, 314 | EGLNativePixmapType target); 315 | 316 | /* This is a generic function pointer type, whose name indicates it must 317 | * be cast to the proper type *and calling convention* before use. 318 | */ 319 | typedef void (*__eglMustCastToProperFunctionPointerType)(void); 320 | 321 | /* Now, define eglGetProcAddress using the generic function ptr. type */ 322 | EGLAPI __eglMustCastToProperFunctionPointerType EGLAPIENTRY 323 | eglGetProcAddress(const char *procname); 324 | 325 | #ifdef __cplusplus 326 | } 327 | #endif 328 | 329 | #endif /* __egl_h_ */ 330 | -------------------------------------------------------------------------------- /tools/opengldummy/src/gles2.cpp: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | ** 3 | ** Copyright (C) 2015 The Qt Company Ltd. 4 | ** Contact: http://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the Qt Quick 2d Renderer module. 7 | ** 8 | ** $QT_BEGIN_LICENSE:COMM$ 9 | ** 10 | ** Commercial License Usage 11 | ** Licensees holding valid commercial Qt licenses may use this file in 12 | ** accordance with the commercial license agreement provided with the 13 | ** Software or, alternatively, in accordance with the terms contained in 14 | ** a written agreement between you and The Qt Company. For licensing terms 15 | ** and conditions see http://www.qt.io/terms-conditions. For further 16 | ** information use the contact form at http://www.qt.io/contact-us. 17 | ** 18 | ** $QT_END_LICENSE$ 19 | ** 20 | ******************************************************************************/ 21 | 22 | #include 23 | 24 | extern "C" { 25 | 26 | GL_APICALL void GL_APIENTRY glActiveTexture(GLenum texture) 27 | { 28 | 29 | } 30 | 31 | GL_APICALL void GL_APIENTRY glAttachShader(GLuint program, GLuint shader) 32 | { 33 | 34 | } 35 | 36 | GL_APICALL void GL_APIENTRY glBindAttribLocation(GLuint program, GLuint index, const GLchar * name) 37 | { 38 | 39 | } 40 | 41 | GL_APICALL void GL_APIENTRY glBindBuffer(GLenum target, GLuint buffer) 42 | { 43 | 44 | } 45 | 46 | GL_APICALL void GL_APIENTRY glBindFramebuffer(GLenum target, GLuint framebuffer) 47 | { 48 | 49 | } 50 | 51 | GL_APICALL void GL_APIENTRY glBindRenderbuffer(GLenum target, GLuint renderbuffer) 52 | { 53 | 54 | } 55 | 56 | GL_APICALL void GL_APIENTRY glBindTexture(GLenum target, GLuint texture) 57 | { 58 | 59 | } 60 | 61 | GL_APICALL void GL_APIENTRY glBlendColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha) 62 | { 63 | 64 | } 65 | 66 | GL_APICALL void GL_APIENTRY glBlendEquation(GLenum mode) 67 | { 68 | 69 | } 70 | 71 | GL_APICALL void GL_APIENTRY glBlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha) 72 | { 73 | 74 | } 75 | 76 | GL_APICALL void GL_APIENTRY glBlendFunc(GLenum sfactor, GLenum dfactor) 77 | { 78 | 79 | } 80 | 81 | GL_APICALL void GL_APIENTRY glBlendFuncSeparate(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha) 82 | { 83 | 84 | } 85 | 86 | GL_APICALL void GL_APIENTRY glBufferData(GLenum target, GLsizeiptr size, const void * data, GLenum usage) 87 | { 88 | 89 | } 90 | 91 | GL_APICALL void GL_APIENTRY glBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, const void * data) 92 | { 93 | 94 | } 95 | 96 | GL_APICALL GLenum GL_APIENTRY glCheckFramebufferStatus(GLenum target) 97 | { 98 | return 0; 99 | } 100 | 101 | GL_APICALL void GL_APIENTRY glClear(GLbitfield mask) 102 | { 103 | 104 | } 105 | 106 | GL_APICALL void GL_APIENTRY glClearColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha) 107 | { 108 | 109 | } 110 | 111 | GL_APICALL void GL_APIENTRY glClearDepthf(GLfloat d) 112 | { 113 | 114 | } 115 | 116 | GL_APICALL void GL_APIENTRY glClearStencil(GLint s) 117 | { 118 | 119 | } 120 | 121 | GL_APICALL void GL_APIENTRY glColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha) 122 | { 123 | 124 | } 125 | 126 | GL_APICALL void GL_APIENTRY glCompileShader(GLuint shader) 127 | { 128 | 129 | } 130 | 131 | GL_APICALL void GL_APIENTRY glCompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void * data) 132 | { 133 | 134 | } 135 | 136 | GL_APICALL void GL_APIENTRY glCompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void * data) 137 | { 138 | 139 | } 140 | 141 | GL_APICALL void GL_APIENTRY glCopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border) 142 | { 143 | 144 | } 145 | 146 | GL_APICALL void GL_APIENTRY glCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height) 147 | { 148 | 149 | } 150 | 151 | GL_APICALL GLuint GL_APIENTRY glCreateProgram() 152 | { 153 | return 0; 154 | } 155 | 156 | GL_APICALL GLuint GL_APIENTRY glCreateShader(GLenum type) 157 | { 158 | return 0; 159 | } 160 | 161 | GL_APICALL void GL_APIENTRY glCullFace(GLenum mode) 162 | { 163 | 164 | } 165 | 166 | GL_APICALL void GL_APIENTRY glDeleteBuffers(GLsizei n, const GLuint * buffers) 167 | { 168 | 169 | } 170 | 171 | GL_APICALL void GL_APIENTRY glDeleteFramebuffers(GLsizei n, const GLuint * framebuffers) 172 | { 173 | 174 | } 175 | 176 | GL_APICALL void GL_APIENTRY glDeleteProgram(GLuint program) 177 | { 178 | 179 | } 180 | 181 | GL_APICALL void GL_APIENTRY glDeleteRenderbuffers(GLsizei n, const GLuint * renderbuffers) 182 | { 183 | 184 | } 185 | 186 | GL_APICALL void GL_APIENTRY glDeleteShader(GLuint shader) 187 | { 188 | 189 | } 190 | 191 | GL_APICALL void GL_APIENTRY glDeleteTextures(GLsizei n, const GLuint * textures) 192 | { 193 | 194 | } 195 | 196 | GL_APICALL void GL_APIENTRY glDepthFunc(GLenum func) 197 | { 198 | 199 | } 200 | 201 | GL_APICALL void GL_APIENTRY glDepthMask(GLboolean flag) 202 | { 203 | 204 | } 205 | 206 | GL_APICALL void GL_APIENTRY glDepthRangef(GLfloat n, GLfloat f) 207 | { 208 | 209 | } 210 | 211 | GL_APICALL void GL_APIENTRY glDetachShader(GLuint program, GLuint shader) 212 | { 213 | 214 | } 215 | 216 | GL_APICALL void GL_APIENTRY glDisable(GLenum cap) 217 | { 218 | 219 | } 220 | 221 | GL_APICALL void GL_APIENTRY glDisableVertexAttribArray(GLuint index) 222 | { 223 | 224 | } 225 | 226 | GL_APICALL void GL_APIENTRY glDrawArrays(GLenum mode, GLint first, GLsizei count) 227 | { 228 | 229 | } 230 | 231 | GL_APICALL void GL_APIENTRY glDrawElements(GLenum mode, GLsizei count, GLenum type, const void * indices) 232 | { 233 | 234 | } 235 | 236 | GL_APICALL void GL_APIENTRY glEnable(GLenum cap) 237 | { 238 | 239 | } 240 | 241 | GL_APICALL void GL_APIENTRY glEnableVertexAttribArray(GLuint index) 242 | { 243 | 244 | } 245 | 246 | GL_APICALL void GL_APIENTRY glFinish() 247 | { 248 | 249 | } 250 | 251 | GL_APICALL void GL_APIENTRY glFlush() 252 | { 253 | 254 | } 255 | 256 | GL_APICALL void GL_APIENTRY glFramebufferRenderbuffer(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer) 257 | { 258 | 259 | } 260 | 261 | GL_APICALL void GL_APIENTRY glFramebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level) 262 | { 263 | 264 | } 265 | 266 | GL_APICALL void GL_APIENTRY glFrontFace(GLenum mode) 267 | { 268 | 269 | } 270 | 271 | GL_APICALL void GL_APIENTRY glGenBuffers(GLsizei n, GLuint* buffers) 272 | { 273 | 274 | } 275 | 276 | GL_APICALL void GL_APIENTRY glGenFramebuffers(GLsizei n, GLuint* framebuffers) 277 | { 278 | 279 | } 280 | 281 | GL_APICALL void GL_APIENTRY glGenRenderbuffers(GLsizei n, GLuint* renderbuffers) 282 | { 283 | 284 | } 285 | 286 | GL_APICALL void GL_APIENTRY glGenTextures(GLsizei n, GLuint* textures) 287 | { 288 | 289 | } 290 | 291 | GL_APICALL void GL_APIENTRY glGenerateMipmap(GLenum target) 292 | { 293 | 294 | } 295 | 296 | GL_APICALL void GL_APIENTRY glGetActiveAttrib(GLuint program, GLuint index, GLsizei bufSize, GLsizei* length, GLint* size, GLenum* type, GLchar* name) 297 | { 298 | 299 | } 300 | 301 | GL_APICALL void GL_APIENTRY glGetActiveUniform(GLuint program, GLuint index, GLsizei bufSize, GLsizei* length, GLint* size, GLenum* type, GLchar* name) 302 | { 303 | 304 | } 305 | 306 | GL_APICALL void GL_APIENTRY glGetAttachedShaders(GLuint program, GLsizei maxCount, GLsizei* count, GLuint* shaders) 307 | { 308 | 309 | } 310 | 311 | GL_APICALL GLint GL_APIENTRY glGetAttribLocation(GLuint program, const GLchar * name) 312 | { 313 | return 0; 314 | } 315 | 316 | GL_APICALL void GL_APIENTRY glGetBooleanv(GLenum pname, GLboolean* data) 317 | { 318 | 319 | } 320 | 321 | GL_APICALL void GL_APIENTRY glGetBufferParameteriv(GLenum target, GLenum pname, GLint* params) 322 | { 323 | 324 | } 325 | 326 | GL_APICALL GLenum GL_APIENTRY glGetError() 327 | { 328 | return 0; 329 | } 330 | 331 | GL_APICALL void GL_APIENTRY glGetFloatv(GLenum pname, GLfloat* data) 332 | { 333 | 334 | } 335 | 336 | GL_APICALL void GL_APIENTRY glGetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, GLenum pname, GLint* params) 337 | { 338 | 339 | } 340 | 341 | GL_APICALL void GL_APIENTRY glGetIntegerv(GLenum pname, GLint* data) 342 | { 343 | 344 | } 345 | 346 | GL_APICALL void GL_APIENTRY glGetProgramInfoLog(GLuint program, GLsizei bufSize, GLsizei* length, GLchar* infoLog) 347 | { 348 | 349 | } 350 | 351 | GL_APICALL void GL_APIENTRY glGetProgramiv(GLuint program, GLenum pname, GLint* params) 352 | { 353 | 354 | } 355 | 356 | GL_APICALL void GL_APIENTRY glGetRenderbufferParameteriv(GLenum target, GLenum pname, GLint* params) 357 | { 358 | 359 | } 360 | 361 | GL_APICALL void GL_APIENTRY glGetShaderInfoLog(GLuint shader, GLsizei bufSize, GLsizei* length, GLchar* infoLog) 362 | { 363 | 364 | } 365 | 366 | GL_APICALL void GL_APIENTRY glGetShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision) 367 | { 368 | 369 | } 370 | 371 | GL_APICALL void GL_APIENTRY glGetShaderSource(GLuint shader, GLsizei bufSize, GLsizei* length, GLchar* source) 372 | { 373 | 374 | } 375 | 376 | GL_APICALL void GL_APIENTRY glGetShaderiv(GLuint shader, GLenum pname, GLint* params) 377 | { 378 | 379 | } 380 | 381 | GL_APICALL const GLubyte * GL_APIENTRY glGetString(GLenum name) 382 | { 383 | return 0; 384 | } 385 | 386 | GL_APICALL void GL_APIENTRY glGetTexParameterfv(GLenum target, GLenum pname, GLfloat* params) 387 | { 388 | 389 | } 390 | 391 | GL_APICALL void GL_APIENTRY glGetTexParameteriv(GLenum target, GLenum pname, GLint* params) 392 | { 393 | 394 | } 395 | 396 | GL_APICALL GLint GL_APIENTRY glGetUniformLocation(GLuint program, const GLchar * name) 397 | { 398 | return 0; 399 | } 400 | 401 | GL_APICALL void GL_APIENTRY glGetUniformfv(GLuint program, GLint location, GLfloat* params) 402 | { 403 | 404 | } 405 | 406 | GL_APICALL void GL_APIENTRY glGetUniformiv(GLuint program, GLint location, GLint* params) 407 | { 408 | 409 | } 410 | 411 | GL_APICALL void GL_APIENTRY glGetVertexAttribPointerv(GLuint index, GLenum pname, void ** pointer) 412 | { 413 | 414 | } 415 | 416 | GL_APICALL void GL_APIENTRY glGetVertexAttribfv(GLuint index, GLenum pname, GLfloat* params) 417 | { 418 | 419 | } 420 | 421 | GL_APICALL void GL_APIENTRY glGetVertexAttribiv(GLuint index, GLenum pname, GLint* params) 422 | { 423 | 424 | } 425 | 426 | GL_APICALL void GL_APIENTRY glHint(GLenum target, GLenum mode) 427 | { 428 | 429 | } 430 | 431 | GL_APICALL GLboolean GL_APIENTRY glIsBuffer(GLuint buffer) 432 | { 433 | return 0; 434 | } 435 | 436 | GL_APICALL GLboolean GL_APIENTRY glIsEnabled(GLenum cap) 437 | { 438 | return 0; 439 | } 440 | 441 | GL_APICALL GLboolean GL_APIENTRY glIsFramebuffer(GLuint framebuffer) 442 | { 443 | return 0; 444 | } 445 | 446 | GL_APICALL GLboolean GL_APIENTRY glIsProgram(GLuint program) 447 | { 448 | return 0; 449 | } 450 | 451 | GL_APICALL GLboolean GL_APIENTRY glIsRenderbuffer(GLuint renderbuffer) 452 | { 453 | return 0; 454 | } 455 | 456 | GL_APICALL GLboolean GL_APIENTRY glIsShader(GLuint shader) 457 | { 458 | return 0; 459 | } 460 | 461 | GL_APICALL GLboolean GL_APIENTRY glIsTexture(GLuint texture) 462 | { 463 | return 0; 464 | } 465 | 466 | GL_APICALL void GL_APIENTRY glLineWidth(GLfloat width) 467 | { 468 | 469 | } 470 | 471 | GL_APICALL void GL_APIENTRY glLinkProgram(GLuint program) 472 | { 473 | 474 | } 475 | 476 | GL_APICALL void GL_APIENTRY glPixelStorei(GLenum pname, GLint param) 477 | { 478 | 479 | } 480 | 481 | GL_APICALL void GL_APIENTRY glPolygonOffset(GLfloat factor, GLfloat units) 482 | { 483 | 484 | } 485 | 486 | GL_APICALL void GL_APIENTRY glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void * pixels) 487 | { 488 | 489 | } 490 | 491 | GL_APICALL void GL_APIENTRY glReleaseShaderCompiler() 492 | { 493 | 494 | } 495 | 496 | GL_APICALL void GL_APIENTRY glRenderbufferStorage(GLenum target, GLenum internalformat, GLsizei width, GLsizei height) 497 | { 498 | 499 | } 500 | 501 | GL_APICALL void GL_APIENTRY glSampleCoverage(GLfloat value, GLboolean invert) 502 | { 503 | 504 | } 505 | 506 | GL_APICALL void GL_APIENTRY glScissor(GLint x, GLint y, GLsizei width, GLsizei height) 507 | { 508 | 509 | } 510 | 511 | GL_APICALL void GL_APIENTRY glShaderBinary(GLsizei count, const GLuint * shaders, GLenum binaryformat, const void * binary, GLsizei length) 512 | { 513 | 514 | } 515 | 516 | GL_APICALL void GL_APIENTRY glShaderSource(GLuint shader, GLsizei count, const GLchar *const* string, const GLint * length) 517 | { 518 | 519 | } 520 | 521 | GL_APICALL void GL_APIENTRY glStencilFunc(GLenum func, GLint ref, GLuint mask) 522 | { 523 | 524 | } 525 | 526 | GL_APICALL void GL_APIENTRY glStencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask) 527 | { 528 | 529 | } 530 | 531 | GL_APICALL void GL_APIENTRY glStencilMask(GLuint mask) 532 | { 533 | 534 | } 535 | 536 | GL_APICALL void GL_APIENTRY glStencilMaskSeparate(GLenum face, GLuint mask) 537 | { 538 | 539 | } 540 | 541 | GL_APICALL void GL_APIENTRY glStencilOp(GLenum fail, GLenum zfail, GLenum zpass) 542 | { 543 | 544 | } 545 | 546 | GL_APICALL void GL_APIENTRY glStencilOpSeparate(GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass) 547 | { 548 | 549 | } 550 | 551 | GL_APICALL void GL_APIENTRY glTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void * pixels) 552 | { 553 | 554 | } 555 | 556 | GL_APICALL void GL_APIENTRY glTexParameterf(GLenum target, GLenum pname, GLfloat param) 557 | { 558 | 559 | } 560 | 561 | GL_APICALL void GL_APIENTRY glTexParameterfv(GLenum target, GLenum pname, const GLfloat * params) 562 | { 563 | 564 | } 565 | 566 | GL_APICALL void GL_APIENTRY glTexParameteri(GLenum target, GLenum pname, GLint param) 567 | { 568 | 569 | } 570 | 571 | GL_APICALL void GL_APIENTRY glTexParameteriv(GLenum target, GLenum pname, const GLint * params) 572 | { 573 | 574 | } 575 | 576 | GL_APICALL void GL_APIENTRY glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void * pixels) 577 | { 578 | 579 | } 580 | 581 | GL_APICALL void GL_APIENTRY glUniform1f(GLint location, GLfloat v0) 582 | { 583 | 584 | } 585 | 586 | GL_APICALL void GL_APIENTRY glUniform1fv(GLint location, GLsizei count, const GLfloat * value) 587 | { 588 | 589 | } 590 | 591 | GL_APICALL void GL_APIENTRY glUniform1i(GLint location, GLint v0) 592 | { 593 | 594 | } 595 | 596 | GL_APICALL void GL_APIENTRY glUniform1iv(GLint location, GLsizei count, const GLint * value) 597 | { 598 | 599 | } 600 | 601 | GL_APICALL void GL_APIENTRY glUniform2f(GLint location, GLfloat v0, GLfloat v1) 602 | { 603 | 604 | } 605 | 606 | GL_APICALL void GL_APIENTRY glUniform2fv(GLint location, GLsizei count, const GLfloat * value) 607 | { 608 | 609 | } 610 | 611 | GL_APICALL void GL_APIENTRY glUniform2i(GLint location, GLint v0, GLint v1) 612 | { 613 | 614 | } 615 | 616 | GL_APICALL void GL_APIENTRY glUniform2iv(GLint location, GLsizei count, const GLint * value) 617 | { 618 | 619 | } 620 | 621 | GL_APICALL void GL_APIENTRY glUniform3f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2) 622 | { 623 | 624 | } 625 | 626 | GL_APICALL void GL_APIENTRY glUniform3fv(GLint location, GLsizei count, const GLfloat * value) 627 | { 628 | 629 | } 630 | 631 | GL_APICALL void GL_APIENTRY glUniform3i(GLint location, GLint v0, GLint v1, GLint v2) 632 | { 633 | 634 | } 635 | 636 | GL_APICALL void GL_APIENTRY glUniform3iv(GLint location, GLsizei count, const GLint * value) 637 | { 638 | 639 | } 640 | 641 | GL_APICALL void GL_APIENTRY glUniform4f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3) 642 | { 643 | 644 | } 645 | 646 | GL_APICALL void GL_APIENTRY glUniform4fv(GLint location, GLsizei count, const GLfloat * value) 647 | { 648 | 649 | } 650 | 651 | GL_APICALL void GL_APIENTRY glUniform4i(GLint location, GLint v0, GLint v1, GLint v2, GLint v3) 652 | { 653 | 654 | } 655 | 656 | GL_APICALL void GL_APIENTRY glUniform4iv(GLint location, GLsizei count, const GLint * value) 657 | { 658 | 659 | } 660 | 661 | GL_APICALL void GL_APIENTRY glUniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) 662 | { 663 | 664 | } 665 | 666 | GL_APICALL void GL_APIENTRY glUniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) 667 | { 668 | 669 | } 670 | 671 | GL_APICALL void GL_APIENTRY glUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) 672 | { 673 | 674 | } 675 | 676 | GL_APICALL void GL_APIENTRY glUseProgram(GLuint program) 677 | { 678 | 679 | } 680 | 681 | GL_APICALL void GL_APIENTRY glValidateProgram(GLuint program) 682 | { 683 | 684 | } 685 | 686 | GL_APICALL void GL_APIENTRY glVertexAttrib1f(GLuint index, GLfloat x) 687 | { 688 | 689 | } 690 | 691 | GL_APICALL void GL_APIENTRY glVertexAttrib1fv(GLuint index, const GLfloat * v) 692 | { 693 | 694 | } 695 | 696 | GL_APICALL void GL_APIENTRY glVertexAttrib2f(GLuint index, GLfloat x, GLfloat y) 697 | { 698 | 699 | } 700 | 701 | GL_APICALL void GL_APIENTRY glVertexAttrib2fv(GLuint index, const GLfloat * v) 702 | { 703 | 704 | } 705 | 706 | GL_APICALL void GL_APIENTRY glVertexAttrib3f(GLuint index, GLfloat x, GLfloat y, GLfloat z) 707 | { 708 | 709 | } 710 | 711 | GL_APICALL void GL_APIENTRY glVertexAttrib3fv(GLuint index, const GLfloat * v) 712 | { 713 | 714 | } 715 | 716 | GL_APICALL void GL_APIENTRY glVertexAttrib4f(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w) 717 | { 718 | 719 | } 720 | 721 | GL_APICALL void GL_APIENTRY glVertexAttrib4fv(GLuint index, const GLfloat * v) 722 | { 723 | 724 | } 725 | 726 | GL_APICALL void GL_APIENTRY glVertexAttribPointer(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void * pointer) 727 | { 728 | 729 | } 730 | 731 | GL_APICALL void GL_APIENTRY glViewport(GLint x, GLint y, GLsizei width, GLsizei height) 732 | { 733 | 734 | } 735 | 736 | GL_APICALL void GL_APIENTRY glBlitFramebufferEXT(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter) 737 | { 738 | 739 | } 740 | 741 | GL_APICALL void GL_APIENTRY glRenderbufferStorageMultisampleEXT(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height) 742 | { 743 | 744 | } 745 | 746 | } // extern "C" 747 | 748 | --------------------------------------------------------------------------------