diff --git a/src/plugins/plugins.pro b/src/plugins/plugins.pro index 70a1eb22b6..11c8641e21 100644 --- a/src/plugins/plugins.pro +++ b/src/plugins/plugins.pro @@ -1,3 +1,4 @@ TEMPLATE = subdirs !contains(QT_CONFIG, no-qml-debug):SUBDIRS += qmltooling +SUBDIRS += scenegraph diff --git a/src/plugins/scenegraph/d3d12/d3d12.json b/src/plugins/scenegraph/d3d12/d3d12.json new file mode 100644 index 0000000000..c450a38556 --- /dev/null +++ b/src/plugins/scenegraph/d3d12/d3d12.json @@ -0,0 +1,3 @@ +{ + "Keys": ["d3d12"] +} diff --git a/src/quick/scenegraph/adaptations/d3d12/d3d12.pri b/src/plugins/scenegraph/d3d12/d3d12.pro similarity index 77% rename from src/quick/scenegraph/adaptations/d3d12/d3d12.pri rename to src/plugins/scenegraph/d3d12/d3d12.pro index 1a24f84756..32bd6810e3 100644 --- a/src/quick/scenegraph/adaptations/d3d12/d3d12.pri +++ b/src/plugins/scenegraph/d3d12/d3d12.pro @@ -1,3 +1,14 @@ +TARGET = qsgd3d12backend + +QT += core-private gui-private qml-private quick-private + +PLUGIN_TYPE = scenegraph +PLUGIN_CLASS_NAME = QSGD3D12Adaptation +load(qt_plugin) + +QMAKE_TARGET_PRODUCT = "Qt Quick D3D12 Renderer (Qt $$QT_VERSION)" +QMAKE_TARGET_DESCRIPTION = "Quick D3D12 Renderer for Qt." + SOURCES += \ $$PWD/qsgd3d12adaptation.cpp \ $$PWD/qsgd3d12renderloop.cpp \ @@ -35,6 +46,6 @@ HEADERS += \ LIBS += -ldxgi -ld3d12 -DEFINES += QSG_D3D12 - include($$PWD/shaders/shaders.pri) + +OTHER_FILES += $$PWD/d3d12.json diff --git a/src/quick/scenegraph/adaptations/d3d12/qsgd3d12adaptation.cpp b/src/plugins/scenegraph/d3d12/qsgd3d12adaptation.cpp similarity index 100% rename from src/quick/scenegraph/adaptations/d3d12/qsgd3d12adaptation.cpp rename to src/plugins/scenegraph/d3d12/qsgd3d12adaptation.cpp diff --git a/src/quick/scenegraph/adaptations/d3d12/qsgd3d12adaptation_p.h b/src/plugins/scenegraph/d3d12/qsgd3d12adaptation_p.h similarity index 96% rename from src/quick/scenegraph/adaptations/d3d12/qsgd3d12adaptation_p.h rename to src/plugins/scenegraph/d3d12/qsgd3d12adaptation_p.h index dbb408975d..035c3408ff 100644 --- a/src/quick/scenegraph/adaptations/d3d12/qsgd3d12adaptation_p.h +++ b/src/plugins/scenegraph/d3d12/qsgd3d12adaptation_p.h @@ -61,6 +61,9 @@ class QSGRenderLoop; class QSGD3D12Adaptation : public QSGContextPlugin { + Q_OBJECT + Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QSGContextFactoryInterface" FILE "d3d12.json") + public: QSGD3D12Adaptation(QObject *parent = 0); diff --git a/src/quick/scenegraph/adaptations/d3d12/qsgd3d12builtinmaterials.cpp b/src/plugins/scenegraph/d3d12/qsgd3d12builtinmaterials.cpp similarity index 99% rename from src/quick/scenegraph/adaptations/d3d12/qsgd3d12builtinmaterials.cpp rename to src/plugins/scenegraph/d3d12/qsgd3d12builtinmaterials.cpp index ab0c98a8cd..09d70fd168 100644 --- a/src/quick/scenegraph/adaptations/d3d12/qsgd3d12builtinmaterials.cpp +++ b/src/plugins/scenegraph/d3d12/qsgd3d12builtinmaterials.cpp @@ -40,6 +40,8 @@ #include "qsgd3d12builtinmaterials_p.h" #include "qsgd3d12rendercontext_p.h" #include +#include +#include #include "vs_vertexcolor.hlslh" #include "ps_vertexcolor.hlslh" diff --git a/src/quick/scenegraph/adaptations/d3d12/qsgd3d12builtinmaterials_p.h b/src/plugins/scenegraph/d3d12/qsgd3d12builtinmaterials_p.h similarity index 100% rename from src/quick/scenegraph/adaptations/d3d12/qsgd3d12builtinmaterials_p.h rename to src/plugins/scenegraph/d3d12/qsgd3d12builtinmaterials_p.h diff --git a/src/quick/scenegraph/adaptations/d3d12/qsgd3d12context.cpp b/src/plugins/scenegraph/d3d12/qsgd3d12context.cpp similarity index 100% rename from src/quick/scenegraph/adaptations/d3d12/qsgd3d12context.cpp rename to src/plugins/scenegraph/d3d12/qsgd3d12context.cpp diff --git a/src/quick/scenegraph/adaptations/d3d12/qsgd3d12context_p.h b/src/plugins/scenegraph/d3d12/qsgd3d12context_p.h similarity index 100% rename from src/quick/scenegraph/adaptations/d3d12/qsgd3d12context_p.h rename to src/plugins/scenegraph/d3d12/qsgd3d12context_p.h diff --git a/src/quick/scenegraph/adaptations/d3d12/qsgd3d12engine.cpp b/src/plugins/scenegraph/d3d12/qsgd3d12engine.cpp similarity index 100% rename from src/quick/scenegraph/adaptations/d3d12/qsgd3d12engine.cpp rename to src/plugins/scenegraph/d3d12/qsgd3d12engine.cpp diff --git a/src/quick/scenegraph/adaptations/d3d12/qsgd3d12engine_p.h b/src/plugins/scenegraph/d3d12/qsgd3d12engine_p.h similarity index 100% rename from src/quick/scenegraph/adaptations/d3d12/qsgd3d12engine_p.h rename to src/plugins/scenegraph/d3d12/qsgd3d12engine_p.h diff --git a/src/quick/scenegraph/adaptations/d3d12/qsgd3d12engine_p_p.h b/src/plugins/scenegraph/d3d12/qsgd3d12engine_p_p.h similarity index 100% rename from src/quick/scenegraph/adaptations/d3d12/qsgd3d12engine_p_p.h rename to src/plugins/scenegraph/d3d12/qsgd3d12engine_p_p.h diff --git a/src/quick/scenegraph/adaptations/d3d12/qsgd3d12glyphcache.cpp b/src/plugins/scenegraph/d3d12/qsgd3d12glyphcache.cpp similarity index 100% rename from src/quick/scenegraph/adaptations/d3d12/qsgd3d12glyphcache.cpp rename to src/plugins/scenegraph/d3d12/qsgd3d12glyphcache.cpp diff --git a/src/quick/scenegraph/adaptations/d3d12/qsgd3d12glyphcache_p.h b/src/plugins/scenegraph/d3d12/qsgd3d12glyphcache_p.h similarity index 100% rename from src/quick/scenegraph/adaptations/d3d12/qsgd3d12glyphcache_p.h rename to src/plugins/scenegraph/d3d12/qsgd3d12glyphcache_p.h diff --git a/src/quick/scenegraph/adaptations/d3d12/qsgd3d12glyphnode.cpp b/src/plugins/scenegraph/d3d12/qsgd3d12glyphnode.cpp similarity index 100% rename from src/quick/scenegraph/adaptations/d3d12/qsgd3d12glyphnode.cpp rename to src/plugins/scenegraph/d3d12/qsgd3d12glyphnode.cpp diff --git a/src/quick/scenegraph/adaptations/d3d12/qsgd3d12glyphnode_p.h b/src/plugins/scenegraph/d3d12/qsgd3d12glyphnode_p.h similarity index 100% rename from src/quick/scenegraph/adaptations/d3d12/qsgd3d12glyphnode_p.h rename to src/plugins/scenegraph/d3d12/qsgd3d12glyphnode_p.h diff --git a/src/quick/scenegraph/adaptations/d3d12/qsgd3d12imagenode.cpp b/src/plugins/scenegraph/d3d12/qsgd3d12imagenode.cpp similarity index 100% rename from src/quick/scenegraph/adaptations/d3d12/qsgd3d12imagenode.cpp rename to src/plugins/scenegraph/d3d12/qsgd3d12imagenode.cpp diff --git a/src/quick/scenegraph/adaptations/d3d12/qsgd3d12imagenode_p.h b/src/plugins/scenegraph/d3d12/qsgd3d12imagenode_p.h similarity index 100% rename from src/quick/scenegraph/adaptations/d3d12/qsgd3d12imagenode_p.h rename to src/plugins/scenegraph/d3d12/qsgd3d12imagenode_p.h diff --git a/src/quick/scenegraph/adaptations/d3d12/qsgd3d12layer.cpp b/src/plugins/scenegraph/d3d12/qsgd3d12layer.cpp similarity index 100% rename from src/quick/scenegraph/adaptations/d3d12/qsgd3d12layer.cpp rename to src/plugins/scenegraph/d3d12/qsgd3d12layer.cpp diff --git a/src/quick/scenegraph/adaptations/d3d12/qsgd3d12layer_p.h b/src/plugins/scenegraph/d3d12/qsgd3d12layer_p.h similarity index 100% rename from src/quick/scenegraph/adaptations/d3d12/qsgd3d12layer_p.h rename to src/plugins/scenegraph/d3d12/qsgd3d12layer_p.h diff --git a/src/quick/scenegraph/adaptations/d3d12/qsgd3d12material.cpp b/src/plugins/scenegraph/d3d12/qsgd3d12material.cpp similarity index 100% rename from src/quick/scenegraph/adaptations/d3d12/qsgd3d12material.cpp rename to src/plugins/scenegraph/d3d12/qsgd3d12material.cpp diff --git a/src/quick/scenegraph/adaptations/d3d12/qsgd3d12material_p.h b/src/plugins/scenegraph/d3d12/qsgd3d12material_p.h similarity index 100% rename from src/quick/scenegraph/adaptations/d3d12/qsgd3d12material_p.h rename to src/plugins/scenegraph/d3d12/qsgd3d12material_p.h diff --git a/src/quick/scenegraph/adaptations/d3d12/qsgd3d12rectanglenode.cpp b/src/plugins/scenegraph/d3d12/qsgd3d12rectanglenode.cpp similarity index 100% rename from src/quick/scenegraph/adaptations/d3d12/qsgd3d12rectanglenode.cpp rename to src/plugins/scenegraph/d3d12/qsgd3d12rectanglenode.cpp diff --git a/src/quick/scenegraph/adaptations/d3d12/qsgd3d12rectanglenode_p.h b/src/plugins/scenegraph/d3d12/qsgd3d12rectanglenode_p.h similarity index 100% rename from src/quick/scenegraph/adaptations/d3d12/qsgd3d12rectanglenode_p.h rename to src/plugins/scenegraph/d3d12/qsgd3d12rectanglenode_p.h diff --git a/src/quick/scenegraph/adaptations/d3d12/qsgd3d12rendercontext.cpp b/src/plugins/scenegraph/d3d12/qsgd3d12rendercontext.cpp similarity index 100% rename from src/quick/scenegraph/adaptations/d3d12/qsgd3d12rendercontext.cpp rename to src/plugins/scenegraph/d3d12/qsgd3d12rendercontext.cpp diff --git a/src/quick/scenegraph/adaptations/d3d12/qsgd3d12rendercontext_p.h b/src/plugins/scenegraph/d3d12/qsgd3d12rendercontext_p.h similarity index 100% rename from src/quick/scenegraph/adaptations/d3d12/qsgd3d12rendercontext_p.h rename to src/plugins/scenegraph/d3d12/qsgd3d12rendercontext_p.h diff --git a/src/quick/scenegraph/adaptations/d3d12/qsgd3d12renderer.cpp b/src/plugins/scenegraph/d3d12/qsgd3d12renderer.cpp similarity index 100% rename from src/quick/scenegraph/adaptations/d3d12/qsgd3d12renderer.cpp rename to src/plugins/scenegraph/d3d12/qsgd3d12renderer.cpp diff --git a/src/quick/scenegraph/adaptations/d3d12/qsgd3d12renderer_p.h b/src/plugins/scenegraph/d3d12/qsgd3d12renderer_p.h similarity index 99% rename from src/quick/scenegraph/adaptations/d3d12/qsgd3d12renderer_p.h rename to src/plugins/scenegraph/d3d12/qsgd3d12renderer_p.h index adb2252f80..0877c3699a 100644 --- a/src/quick/scenegraph/adaptations/d3d12/qsgd3d12renderer_p.h +++ b/src/plugins/scenegraph/d3d12/qsgd3d12renderer_p.h @@ -53,6 +53,7 @@ #include #include +#include #include "qsgd3d12engine_p.h" #include "qsgd3d12material_p.h" diff --git a/src/quick/scenegraph/adaptations/d3d12/qsgd3d12renderloop.cpp b/src/plugins/scenegraph/d3d12/qsgd3d12renderloop.cpp similarity index 99% rename from src/quick/scenegraph/adaptations/d3d12/qsgd3d12renderloop.cpp rename to src/plugins/scenegraph/d3d12/qsgd3d12renderloop.cpp index 121d010bbb..94bdf38819 100644 --- a/src/quick/scenegraph/adaptations/d3d12/qsgd3d12renderloop.cpp +++ b/src/plugins/scenegraph/d3d12/qsgd3d12renderloop.cpp @@ -49,6 +49,8 @@ #include #include #include +#include +#include QT_BEGIN_NAMESPACE @@ -517,8 +519,7 @@ void QSGD3D12RenderThread::sync(bool inExpose) void QSGD3D12RenderThread::syncAndRender() { - bool profileFrames = QSG_LOG_TIME_RENDERLOOP().isDebugEnabled(); - if (profileFrames) { + if (Q_UNLIKELY(debug_time())) { sinceLastTime = threadTimer.nsecsElapsed(); threadTimer.start(); } @@ -542,7 +543,7 @@ void QSGD3D12RenderThread::syncAndRender() sync(exposeRequested); #ifndef QSG_NO_RENDER_TIMING - if (profileFrames) + if (Q_UNLIKELY(debug_time())) syncTime = threadTimer.nsecsElapsed(); #endif Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphRenderLoopFrame); @@ -578,7 +579,7 @@ void QSGD3D12RenderThread::syncAndRender() if (canRender) { wd->renderSceneGraph(engine->windowSize()); - if (profileFrames) + if (Q_UNLIKELY(debug_time())) renderTime = threadTimer.nsecsElapsed(); Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphRenderLoopFrame); @@ -1035,15 +1036,14 @@ void QSGD3D12RenderLoop::polishAndSync(WindowData *w, bool inExpose) qint64 polishTime = 0; qint64 waitTime = 0; qint64 syncTime = 0; - bool profileFrames = QSG_LOG_TIME_RENDERLOOP().isDebugEnabled(); - if (profileFrames) + if (Q_UNLIKELY(debug_time())) timer.start(); Q_QUICK_SG_PROFILE_START(QQuickProfiler::SceneGraphPolishAndSync); QQuickWindowPrivate *wd = QQuickWindowPrivate::get(window); wd->polishItems(); - if (profileFrames) + if (Q_UNLIKELY(debug_time())) polishTime = timer.nsecsElapsed(); Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphPolishAndSync); @@ -1060,7 +1060,7 @@ void QSGD3D12RenderLoop::polishAndSync(WindowData *w, bool inExpose) if (Q_UNLIKELY(debug_loop())) qDebug("polishAndSync - wait for sync"); - if (profileFrames) + if (Q_UNLIKELY(debug_time())) waitTime = timer.nsecsElapsed(); Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphPolishAndSync); w->thread->waitCondition.wait(&w->thread->mutex); @@ -1069,7 +1069,7 @@ void QSGD3D12RenderLoop::polishAndSync(WindowData *w, bool inExpose) if (Q_UNLIKELY(debug_loop())) qDebug("polishAndSync - unlock after sync"); - if (profileFrames) + if (Q_UNLIKELY(debug_time())) syncTime = timer.nsecsElapsed(); Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphPolishAndSync); diff --git a/src/quick/scenegraph/adaptations/d3d12/qsgd3d12renderloop_p.h b/src/plugins/scenegraph/d3d12/qsgd3d12renderloop_p.h similarity index 100% rename from src/quick/scenegraph/adaptations/d3d12/qsgd3d12renderloop_p.h rename to src/plugins/scenegraph/d3d12/qsgd3d12renderloop_p.h diff --git a/src/quick/scenegraph/adaptations/d3d12/qsgd3d12texture.cpp b/src/plugins/scenegraph/d3d12/qsgd3d12texture.cpp similarity index 100% rename from src/quick/scenegraph/adaptations/d3d12/qsgd3d12texture.cpp rename to src/plugins/scenegraph/d3d12/qsgd3d12texture.cpp diff --git a/src/quick/scenegraph/adaptations/d3d12/qsgd3d12texture_p.h b/src/plugins/scenegraph/d3d12/qsgd3d12texture_p.h similarity index 100% rename from src/quick/scenegraph/adaptations/d3d12/qsgd3d12texture_p.h rename to src/plugins/scenegraph/d3d12/qsgd3d12texture_p.h diff --git a/src/quick/scenegraph/adaptations/d3d12/shaders/mipmapgen.hlsl b/src/plugins/scenegraph/d3d12/shaders/mipmapgen.hlsl similarity index 100% rename from src/quick/scenegraph/adaptations/d3d12/shaders/mipmapgen.hlsl rename to src/plugins/scenegraph/d3d12/shaders/mipmapgen.hlsl diff --git a/src/quick/scenegraph/adaptations/d3d12/shaders/shaders.pri b/src/plugins/scenegraph/d3d12/shaders/shaders.pri similarity index 100% rename from src/quick/scenegraph/adaptations/d3d12/shaders/shaders.pri rename to src/plugins/scenegraph/d3d12/shaders/shaders.pri diff --git a/src/quick/scenegraph/adaptations/d3d12/shaders/smoothcolor.hlsl b/src/plugins/scenegraph/d3d12/shaders/smoothcolor.hlsl similarity index 100% rename from src/quick/scenegraph/adaptations/d3d12/shaders/smoothcolor.hlsl rename to src/plugins/scenegraph/d3d12/shaders/smoothcolor.hlsl diff --git a/src/quick/scenegraph/adaptations/d3d12/shaders/smoothtexture.hlsl b/src/plugins/scenegraph/d3d12/shaders/smoothtexture.hlsl similarity index 100% rename from src/quick/scenegraph/adaptations/d3d12/shaders/smoothtexture.hlsl rename to src/plugins/scenegraph/d3d12/shaders/smoothtexture.hlsl diff --git a/src/quick/scenegraph/adaptations/d3d12/shaders/stencilclip.hlsl b/src/plugins/scenegraph/d3d12/shaders/stencilclip.hlsl similarity index 100% rename from src/quick/scenegraph/adaptations/d3d12/shaders/stencilclip.hlsl rename to src/plugins/scenegraph/d3d12/shaders/stencilclip.hlsl diff --git a/src/quick/scenegraph/adaptations/d3d12/shaders/textmask.hlsl b/src/plugins/scenegraph/d3d12/shaders/textmask.hlsl similarity index 100% rename from src/quick/scenegraph/adaptations/d3d12/shaders/textmask.hlsl rename to src/plugins/scenegraph/d3d12/shaders/textmask.hlsl diff --git a/src/quick/scenegraph/adaptations/d3d12/shaders/texture.hlsl b/src/plugins/scenegraph/d3d12/shaders/texture.hlsl similarity index 100% rename from src/quick/scenegraph/adaptations/d3d12/shaders/texture.hlsl rename to src/plugins/scenegraph/d3d12/shaders/texture.hlsl diff --git a/src/quick/scenegraph/adaptations/d3d12/shaders/vertexcolor.hlsl b/src/plugins/scenegraph/d3d12/shaders/vertexcolor.hlsl similarity index 100% rename from src/quick/scenegraph/adaptations/d3d12/shaders/vertexcolor.hlsl rename to src/plugins/scenegraph/d3d12/shaders/vertexcolor.hlsl diff --git a/src/plugins/scenegraph/scenegraph.pro b/src/plugins/scenegraph/scenegraph.pro new file mode 100644 index 0000000000..2cf05165c4 --- /dev/null +++ b/src/plugins/scenegraph/scenegraph.pro @@ -0,0 +1,2 @@ +TEMPLATE = subdirs +config_d3d12: SUBDIRS += d3d12 diff --git a/src/quick/scenegraph/adaptations/adaptations.pri b/src/quick/scenegraph/adaptations/adaptations.pri index a3738d6b82..40fa739e15 100644 --- a/src/quick/scenegraph/adaptations/adaptations.pri +++ b/src/quick/scenegraph/adaptations/adaptations.pri @@ -1,2 +1 @@ include(software/software.pri) -config_d3d12: include(d3d12/d3d12.pri) diff --git a/src/quick/scenegraph/qsgbasicglyphnode_p.h b/src/quick/scenegraph/qsgbasicglyphnode_p.h index 6c6e1d7cc6..1d09367ea5 100644 --- a/src/quick/scenegraph/qsgbasicglyphnode_p.h +++ b/src/quick/scenegraph/qsgbasicglyphnode_p.h @@ -57,7 +57,7 @@ QT_BEGIN_NAMESPACE class QSGMaterial; -class QSGBasicGlyphNode: public QSGGlyphNode +class Q_QUICK_PRIVATE_EXPORT QSGBasicGlyphNode: public QSGGlyphNode { public: QSGBasicGlyphNode(); diff --git a/src/quick/scenegraph/qsgcontextplugin.cpp b/src/quick/scenegraph/qsgcontextplugin.cpp index 646798efe2..5a5a16e005 100644 --- a/src/quick/scenegraph/qsgcontextplugin.cpp +++ b/src/quick/scenegraph/qsgcontextplugin.cpp @@ -45,9 +45,6 @@ // Built-in adaptations #include -#ifdef QSG_D3D12 -#include -#endif #ifndef QT_NO_OPENGL #include #endif @@ -89,9 +86,6 @@ QSGAdaptionBackendData::QSGAdaptionBackendData() { // Fill in the table with the built-in adaptations. builtIns.append(new QSGSoftwareAdaptation); -#ifdef QSG_D3D12 - builtIns.append(new QSGD3D12Adaptation); -#endif } Q_GLOBAL_STATIC(QSGAdaptionBackendData, qsg_adaptation_data)