aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/items/context2d/qquickcontext2d.cpp
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@theqtcompany.com>2016-05-03 10:40:44 +0200
committerLaszlo Agocs <laszlo.agocs@theqtcompany.com>2016-05-03 10:12:49 +0000
commitd45718b33cb97218ff042e95ee7774fd8c8d63a3 (patch)
treed95fff7e975aed3288ba80ca7ed46b8803e27480 /src/quick/items/context2d/qquickcontext2d.cpp
parente96fe44ff09703fe3033d6e90d787d2fb68c9e63 (diff)
D3D12: Fix up Context2D
Querying openglContext() on a non-GL specific path is never a good idea. The usage of QSGSimpleTextureNode is replaced with the correct multi-backend way, i.e. creating an image node via the adaptation layer. Demos like stocqt are now functional with the d3d12 backend as well. Change-Id: I24a6b85163fec5841349057e2fec0be6cbf01130 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
Diffstat (limited to 'src/quick/items/context2d/qquickcontext2d.cpp')
-rw-r--r--src/quick/items/context2d/qquickcontext2d.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/quick/items/context2d/qquickcontext2d.cpp b/src/quick/items/context2d/qquickcontext2d.cpp
index 74666fb8b6..ed3eaf0703 100644
--- a/src/quick/items/context2d/qquickcontext2d.cpp
+++ b/src/quick/items/context2d/qquickcontext2d.cpp
@@ -43,6 +43,7 @@
#include <private/qquickcontext2dtexture_p.h>
#include <private/qquickitem_p.h>
#include <QtQuick/private/qquickshadereffectsource_p.h>
+#include <qsgrendererinterface.h>
#include <QtQuick/private/qsgcontext_p.h>
#include <private/qquicksvgparser_p.h>
@@ -4087,6 +4088,13 @@ void QQuickContext2D::init(QQuickCanvasItem *canvasItem, const QVariantMap &args
m_renderTarget = QQuickCanvasItem::Image;
}
+ // Disable Framebuffer Object based rendering when not running with OpenGL
+ if (m_renderTarget == QQuickCanvasItem::FramebufferObject) {
+ QSGRendererInterface *rif = canvasItem->window()->rendererInterface();
+ if (rif && rif->graphicsAPI() != QSGRendererInterface::OpenGL)
+ m_renderTarget = QQuickCanvasItem::Image;
+ }
+
switch (m_renderTarget) {
case QQuickCanvasItem::Image:
m_texture = new QQuickContext2DImageTexture;
@@ -4111,7 +4119,8 @@ void QQuickContext2D::init(QQuickCanvasItem *canvasItem, const QVariantMap &args
QThread *renderThread = m_thread;
#ifndef QT_NO_OPENGL
QQuickWindow *window = canvasItem->window();
- QThread *sceneGraphThread = window->openglContext() ? window->openglContext()->thread() : 0;
+ QQuickWindowPrivate *wd = QQuickWindowPrivate::get(window);
+ QThread *sceneGraphThread = wd->context->thread();
if (m_renderStrategy == QQuickCanvasItem::Threaded)
renderThread = QQuickContext2DRenderThread::instance(qmlEngine(canvasItem));