aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/scenegraph/qsgcontext.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Enforce window rendering in sequence on llvmpipe.Gunnar Sletta2013-11-201-0/+12
| | | | | | | | | | | When rendering multiple windows in parallel on llvmpipe we end up with crashes deep inside llvmpipe as multiple threads seem to access unprotected resources. Work around this bug by enforcing that scene graph rendering happens on one window at a time. Task-number: QTCREATORBUG-10666 Change-Id: I2f734e8f653b2a9b4108eb189280ab922581e2c0 Reviewed-by: Kai Koehne <kai.koehne@digia.com>
* Adapt Qt Quick 2 renderer to work with OpenGL Core ProfileSean Harmer2013-11-131-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The basic approach is to have the batched renderer create and bind a vertex array object if it detects we are using an OpenGL Core profile context. The VAO is bound for the duration of the QQ2 renderer's work cycle and unbound at the end so as to not interfere with any other VAO's a user may wish to use. All shaders have been copied and ported to be compliant with the GLSL 150 core specification which is the minimum for a Core profile context (OpenGL 3.2 Core). We are not using any newer features as yet so this will work anywhere we can get a Core profile context. The QSGShaderSourceBuilder class has been extended to resolve any requests for shaders to the same basefilename with "_core" appended prior to any file extension. This could be extended in the future to allow version, or GPU or platform specific shaders. The QSGShaderSourceBuilder has also been extended to allow it to insert #define definitions in the prologue of a shader. Any such definition is inserted: * After the last #extension directive (if any are found) * Otherwise after the #version directive (if found) * Otherwise at the start of the shader source This is required by the custom particle shaders which make extensive use of such #defines. In addition the mechanism used by the distance field glyph cache to extend the cache with new glyphs has been modified to work (and work more efficiently) when using a Core profile context. Rather than using a shader program and a buffer filling quad to blit the old texture into the new cache texture, we instead use the technique of framebuffer blitting. The existing fallback implementation using glTexSubImage2D() is still available if needed. The DECLARATIVE_EXAMPLE_MAIN macro has been extended to allow easy testing of any of the QtDeclarative examples with a core profile context. Just run the example with QT_QUICK_CORE_PROFILE=1 ./text for e.g. The only ones that may not work out of the box are those that provide GLSL shader source e.g. the customparticles or shader effect examples. These work fine if the shader source is adapted to GLSL 150 core. In the future it may be a good idea to expose some context property to QML that the user can use to determine what shader source variation to provide to Qt Quick. Along these lines it would also be very nice to allow the provision of shader source to ShaderEffect or CustomParticle from a separate source file just as we now do within Qt Quick. Task-number: QTBUG-32050 Change-Id: Ia6e9f06dbb8508af9ae03c6b60fb418b4cc9e41f Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Fix crash when invalidating QSGContext.Yoann Lopes2013-11-071-0/+1
| | | | | | | | A pointer list was not cleared when invalidating the context, potentially holding dangling pointers after that. Change-Id: I0618c54ffa67b31b115901e8be3a6d3cd16dc844 Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
* Added QSG_INFO=1 environment variable to spit out graphics infoGunnar Sletta2013-11-051-0/+10
| | | | | Change-Id: I12bc0bc475b3e99185aefcd58eef5a0fb5e9852e Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
* Added private API for enabling sharing between the QQuickwindow instances.Gunnar Sletta2013-11-011-0/+18
| | | | | | | | This API is primarily a hook which is needed by the Qt WebEngine to set up sharing with the scene graph's OpenGL contexts. Change-Id: I5bb03abd9ab99f502db8e413fe838a8b30365b8d Reviewed-by: Jocelyn Turcotte <jocelyn.turcotte@digia.com>
* Work around Nouveau driver bugsGunnar Sletta2013-10-301-0/+7
| | | | | Change-Id: I25311a2bd88f41087352e0a43ba505f4e27b7e85 Reviewed-by: Jørgen Lind <jorgen.lind@digia.com>
* Use one render loop per QQuickWindowGunnar Sletta2013-10-301-298/+252
| | | | | | | | | | | | | | | | | | | See the task for the full reasoning behind this patch. The threaded renderloop has been refactored to have one window per thread. This is mostly a simplification of the current code path where for loops over multiple windows are turned into if (window). The QSGContext has been split into two classes, QSGRenderContext for which there is one per OpenGLContext. The rest of the patch is name changes and a couple of cleanups in the hopes of simplifying this change. Task-number: QTBUG-33993 Change-Id: I31c81f9694d7da7474a72333169be38de62613c4 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Avoid infinite loop with distance fields disabledLaszlo Agocs2013-10-161-1/+5
| | | | | | | | createGlyphNode() and createNativeGlyphNode() kept calling each other on GLES whenever QML_DISABLE_DISTANCEFIELD was set. Change-Id: Ic1c2cfe0c4c7301f82cbbcce1cb512bd515b52ef Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
* Remove QSGContext's precompilation step.Gunnar Sletta2013-10-031-74/+0
| | | | | | | | | Materials are managed solely inside the renderer now, so these are just wasting time. Task-number: QTBUG-33456 Change-Id: Ie320df20b7971633c257b1bd3a218e7d70e52c3d Reviewed-by: Yoann Lopes <yoann.lopes@digia.com>
* Don't delete scene-graph atlas manager if it hasn't been created yetTor Arne Vestbø2013-10-021-2/+4
| | | | | | | | | | | | QSGContext::invalidate() is called from the QSGContext destructor, but the atlas manager is only created if QSGContext::initialize() is called, which may not always happen. The result was a bunch of "QCoreApplication::postEvent: Unexpected null receiver" messages during testing. Change-Id: I11a294d48c06d687a9f82cf1ce825063cda8ecf6 Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
* Fix license headers of QtQuick sources.Gunnar Sletta2013-09-301-1/+1
| | | | | Change-Id: I3750c47640bf21c3567c5fa1c4667e3e2552942e Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Prefer multisample antialiasing when we have a msaa contextGunnar Sletta2013-09-061-2/+35
| | | | | | Task-number: QTBUG-32699 Change-Id: Id4382c154954cb114af2cc29b075ddab8df9f387 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* New scenegraph renderer and atlas textures.Gunnar Sletta2013-09-021-7/+32
| | | | | | | | | | | | | The renderer tries to batch primitives together where possible, isolate non-changing subparts of the scene from changing subparts and retain vertexdata on the GPU as much as possible. Atlas textures are crucial in enabling batching. The renderer and atlas texture are described in detail in the doc page "Qt Quick Scene Graph Renderer". Change-Id: Ia476c7f0f42e1fc57a2cef528e93ee88cf8f7055 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
* Public API for creating atlas textures, when available.Gunnar Sletta2013-08-121-0/+7
| | | | | | | | | Atlas textures are currently only used when scenegraph is combined with the customcontext from the playground/scenegraph module. Change-Id: I42f62abdad42e97cc1dcdc05bfb16ecf2839dc0e Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
* Revert "Cut performance cost in QSGContext::prepareMaterial()".Gunnar Sletta2013-06-201-8/+1
| | | | | | | | | | | This reverts commit 0e9cd8b4098661bf611fa73a787c58c85e7d7338. This optimization breaks ShaderEffects with changing fragment and vertex shaders and needs some more thought. Task-number: QTBUG-31837 Change-Id: I1abe249c65dd785825c249a7c22baee928bd76c8 Reviewed-by: Yoann Lopes <yoann.lopes@digia.com>
* Prefix internal classes properly and private export them.Gunnar Sletta2013-06-171-2/+2
| | | | | | | | | Without the private export on these classes, the private export on the QSGDefaultImageNode and QSGDefaultTextureNode is useless, as the symbols fail to resolve Change-Id: I25a265a7669e5f5015c482aa24fe154c2c9a1062 Reviewed-by: Alan Alpert <aalpert@blackberry.com>
* Merge remote-tracking branch 'origin/release' into stableFrederik Gladhorn2013-06-101-0/+28
|\ | | | | | | Change-Id: Iafc0497812acb7850cd4e72c49d63ec9c9320b58
| * Precompile the most common materialsGunnar Sletta2013-05-311-0/+28
| | | | | | | | | | Change-Id: Idfa76f9fcdbac61a248b38e1f793a6628af12552 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
* | Merge remote-tracking branch 'origin/release' into stableFrederik Gladhorn2013-05-311-0/+3
|\| | | | | | | Change-Id: Ie4ce4c3e64f093eec26754e06199d350a46ae2a2
| * Added QQuickWindow::setDefaultAlphaBuffer()Shawn Rutledge2013-05-301-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | All QQuickWindows will render using the same OpenGL context, so for a window to support transparency, the OpenGL context needs to be created with support for transparency from the very start. Therefore the application needs to call setDefaultAlphaBuffer() before creating windows. There are some relevant comments in QTBUG-20768 although the bug itself is not the same use case (it was already OK as long as the first window had a translucent color, because of setAlphaBufferSize in QQuickWindow::setColor()). Change-Id: I92e111c1a62c0d510821b646fd334e52254f8f57 Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
* | Do not use QApp::arguments() to select antialiasing mode.Gunnar Sletta2013-05-311-7/+5
|/ | | | | | | | | This selection typically interfers with an application's command line arguments. Creator's qml2puppet needs to set this mode to avoid getting subpixel antialiased text from DesignerSupport. Change-Id: Iabf2bece211b897c58e2933d5502fdcf7c360c55 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
* Cut performance cost in QSGContext::prepareMaterial()Gunnar Sletta2013-05-231-1/+8
| | | | | | | | | | | | The hash-lookup in this function is costing us a lot, and since we're looking up the same materials again and again, and the material has a place holder for it, we can store it directly in the material at no extra cost. This was a 10% gain in this particular benchmark. Change-Id: I46b67791ce39f453fa86d1ee82f6f5c7785b46a1 Reviewed-by: Yoann Lopes <yoann.lopes@digia.com> Reviewed-by: Samuel Rødal <samuel.rodal@digia.com>
* QmlProfiler: SceneGraph profilingChristiaan Janssen2013-05-061-1/+9
| | | | | Change-Id: Ide71b330b13fc3816ed191bd9af84e0fce0d9587 Reviewed-by: Kai Koehne <kai.koehne@digia.com>
* Disable native glyph rendering on embeddedGunnar Sletta2013-04-251-0/+4
| | | | | Change-Id: I71769affe8f0138dd65f3b94fb27176bd069ab8d Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
* Our debug env vars are a mess. Standardize on QSG_RENDER_TIMINGGunnar Sletta2013-04-041-4/+4
| | | | | Change-Id: I4e88b479a8a9a5126312a05800e8170511b1f7ac Reviewed-by: Samuel Rødal <samuel.rodal@digia.com>
* Warn if the OpenGL context lacks depth/stencil when requested.Gunnar Sletta2013-02-051-0/+8
| | | | | | | | | | | I thought this was a serious bug in the renderer, but it turned out to be qmlscene just overriding the surface format without requesting the needed depth and stencil buffers. An easy mistake to make, hence introduce the warning. Task-number: QTBUG-29037 Change-Id: I59d09d1b2a139e3add851777ff2eeb6c4efb47ec Reviewed-by: Samuel Rødal <samuel.rodal@digia.com>
* Added to QML_RENDERER_TIMING logic to capture most render bottlenecks.Gunnar Sletta2013-01-301-0/+16
| | | | | | | | | The typical bottlenecks during rendering are usually compiling shader programs, uploading textures and preparing glyphs, so add profiling data around them. Change-Id: I9c330a0f6b769836d303a035b2c0dce832842aec Reviewed-by: Samuel Rødal <samuel.rodal@digia.com>
* Enable sub-pixel anti-aliasing for default builds on WindowsEskil Abrahamsen Blomfeldt2013-01-171-1/+1
| | | | | | | | | | While ANGLE builds only provide the OpenGL ES2 APIs, it's still a desktop technology and we should default to using high quality anti-aliasing. Task-number: QTBUG-28782 Change-Id: Iefc764589e935899ead278cedef4c302694dd2bb Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
* Update copyright year in Digia's license headersSergio Ahumada2013-01-101-1/+1
| | | | | | Change-Id: I6c3bd7bebe3d62d1cfd0fa6334544c9db8398c76 Reviewed-by: Akseli Salovaara <akseli.salovaara@digia.com> Reviewed-by: Sergio Ahumada <sergio.ahumada@digia.com>
* Change copyrights from Nokia to DigiaIikka Eklund2012-09-231-24/+24
| | | | | | | Change copyrights and license headers from Nokia to Digia Change-Id: Ie7f5d49ed8235d7a7845ab68f99ad1c220e64d5c Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* QSGContext::defaultSurfaceFormat() should be double-bufferedJan-Arve Saether2012-07-231-0/+1
| | | | | | | | | The problem was that if the opengl driver is single-buffered by default it will remain so. The scene graph really want double-buffered rendering. Change-Id: Ie80f71276d1dd1304c75170f3ca17e585800e8b8 Reviewed-by: Kim M. Kalland <kim.kalland@nokia.com>
* QQuickCanvas renamesAlan Alpert2012-07-171-2/+2
| | | | | | | | | | | | | | | | QQuickCanvas is now called QQuickWindow QQuickCanvas::rootItem is now QQuickWindow::contentItem QQuickItem::canvas is now QQuickItem::window QQuickItem::ItemChangeData::canvas is also renamed window QQuickCanvas::grabFrameBuffer is now QQuickWindow::grabWindow The functions related to the color property have dropped the clear from their names. The first three changes have interim compatibility measures in place to ease the transition. Change-Id: Id34e29546a22a74a7ae2ad90ee3a8def6fc541d2 Reviewed-by: Martin Jones <martin.jones@nokia.com>
* Change antialiasing method for QML2.Kim Motoyoshi Kalland2012-07-131-1/+0
| | | | | | | | | | | | | Since multisampling can require a lot of memory, and might not be supported on some hardware, turn off multisampling and implement antialiasing in the vertex shader instead. The alternative method of antialiasing is implemented for Rectangle, Image, BorderImage and AnimatedImage, and must be explicitly enabled by setting the new antialiasing property. Task-number: QTBUG-26268 Change-Id: I39a93d978658a494bf51e9f0fd02d8414eb8be12 Reviewed-by: Gunnar Sletta <gunnar.sletta@nokia.com>
* Add option to use native rasterizer for SceneGraph textEskil Abrahamsen Blomfeldt2012-07-101-1/+10
| | | | | | | | | | For old-style (desktop components) apps using QML 2 on regular density displays, distance field text will look out of place. We introduce an option to use the native rasterizer instead if you would rather have native look and feel than scalable text items. Change-Id: Idb38e3c89f2deab9ae1963357c6c5fb235ddeab8 Reviewed-by: Jiang Jiang <jiang.jiang@nokia.com>
* Removed ### from scenegraphGunnar Sletta2012-05-161-9/+1
| | | | | Change-Id: I6b114938d2c52df95469975ffa87449f7fd8c647 Reviewed-by: Kim M. Kalland <kim.kalland@nokia.com>
* QtQuick: Fix string related warnings, single character strings.Friedemann Kleint2012-05-141-1/+1
| | | | | | | | | - Fix warnings about truncation from size_t to int (MSVC 2010, 64bit). - Remove single character strings. Change-Id: Iaf4406e4e04d55d2d8b762f3433269868842a6f9 Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com>
* Adapt to _qpa file rename in qtbase.Girish Ramakrishnan2012-05-081-2/+2
| | | | | | | | | qtbase change 36547f4eff44361f7a6acd0cff107c0e47561f93 renamed qpa headers. Change-Id: I903b48d145837557d305366e2eb4eedd0ad32c14 Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com> Reviewed-by: Gunnar Sletta <gunnar.sletta@nokia.com>
* Merge master into api_changesKent Hansen2012-03-231-44/+96
|\ | | | | | | | | | | | | | | Conflicts: src/qml/qml/qqmlboundsignal.cpp src/qml/qml/qqmlpropertycache.cpp Change-Id: I5193a193fa301c0b518291645bf626a5fa07118f
| * Share depth-stencil buffers between ShaderEffectSources of same size.Kim Motoyoshi Kalland2012-03-221-1/+41
| | | | | | | | | | Change-Id: If325a38175249c3a3ffe5043d42ba35dbf90ce0c Reviewed-by: Gunnar Sletta <gunnar.sletta@nokia.com>
| * Decouple QSGDistanceFieldGlyphNode from it's cache manager.Andrew den Exter2012-03-201-43/+55
| | | | | | | | | | | | | | | | | | | | | | | | | | To implement a custom distance field glyph node currently it's necessary to also provide a duplicate implementation of QSGContext::createDistanceFieldGlyphCache() as the default implemention references the cache manager created by createGlyphNode(). By isolating references to the cache manager to just createDistanceFieldGlyph() cache it becomes possible to just overwrite createGlyphNode() and still use the default cache. Change-Id: I7261bdbf247966b55512d2671e2ee85239bcca05 Reviewed-by: Yoann Lopes <yoann.lopes@nokia.com>
* | Merge remote-tracking branch 'origin/master' into api_changesLars Knoll2012-03-071-4/+23
|\| | | | | | | Change-Id: I121cb9c9316b5e47476dcb982bc28b6f3f358f78
| * Fix crash with AnimatedImage caused by race condition.Gunnar Sletta2012-03-051-4/+23
| | | | | | | | | | | | | | | | | | | | | | | | In QDeclarativePixmap::setImage() we deleted a QDeclPixmapData and recreated a new one in a very short timespan and the new texture factory was the same pointer as the deleted one, yet a queued destroyed signal was still emitted. Depending on when the queued connection was handled in the rendering thread, this would cause problems with the value returned from textureForFactory. Change-Id: Ibd785ca12667c99efb88b92689ae7ac4fa87c7ee Reviewed-by: Kim M. Kalland <kim.kalland@nokia.com>
* | Remove uses of QtGui symbols in QQmlEngine.Matthew Vogt2012-03-071-1/+0
|/ | | | | | | | | Move the code dealing with QImage and QPixmap out of QQmlEngine and into the QtQuick library. QQmlEngine remains the owner of image provider resources, but does not use them directly. Change-Id: I52083581394d9c308db446372883eb7479ccf807 Reviewed-by: Martin Jones <martin.jones@nokia.com>
* Merge master <-> api_changesMatthew Vogt2012-03-051-1/+1
|\ | | | | | | Change-Id: Iad2f07b989b25349fd2d4fff010e24dcd5a1688f
| * Remove unused member.Michael Brasser2012-02-271-1/+1
| | | | | | | | | | Change-Id: Ibfcc7a78e442c2be5bab6933e2e85ed39344e6c2 Reviewed-by: Kim M. Kalland <kim.kalland@nokia.com>
* | Rename QDeclarative symbols to QQuick and QQmlMatthew Vogt2012-02-241-8/+8
|/ | | | | | | | | | | | | Symbols beginning with QDeclarative are already exported by the quick1 module. Users can apply the bin/rename-qtdeclarative-symbols.sh script to modify client code using the previous names of the renamed symbols. Task-number: QTBUG-23737 Change-Id: Ifaa482663767634931e8711a8e9bf6e404859e66 Reviewed-by: Martin Jones <martin.jones@nokia.com>
* Make compile.Michael Brasser2012-02-211-0/+1
| | | | | | | Fix compile after 054114a459580b71e170dc6bf356e8943d0ed068 in qtbase. Change-Id: Ibeea6b4b2e3c5f420446b15edd1df7bf88535dcd Reviewed-by: Martin Jones <martin.jones@nokia.com>
* Pass the QQuickCanvas to texture factories.Gunnar Sletta2012-02-091-2/+2
| | | | | | | | | This makes it a lot more convenient as we then have direct access to the GL context, createTexture(), invalidation signal and more. Change-Id: I114514d1379c4d0efcc35c512fa2b485da3438b0 Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com> Reviewed-by: Kim M. Kalland <kim.kalland@nokia.com>
* Added QQuickCanvas::setRenderTarget(uint fbo, const QSize &size)Gunnar Sletta2012-02-081-3/+3
| | | | | | | This allows to hook in non-QOpenGLFrameBufferObject FBO's also Change-Id: I8a2f8f7f15d5a92262bdbb0507b232d7c11fdf25 Reviewed-by: Jani Hautakangas <jani.hautakangas@nokia.com>
* Remove "All rights reserved" line from license headers.Jason McDonald2012-01-301-1/+1
| | | | | | | | | | As in the past, to avoid rewriting various autotests that contain line-number information, an extra blank line has been inserted at the end of the license text to ensure that this commit does not change the total number of lines in the license header. Change-Id: If39bd256b0fa85eba17ea30f8ab87ea27d758908 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>