aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/scenegraph/d3d12
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/scenegraph/d3d12')
-rw-r--r--src/plugins/scenegraph/d3d12/qsgd3d12context.cpp3
-rw-r--r--src/plugins/scenegraph/d3d12/qsgd3d12context_p.h2
-rw-r--r--src/plugins/scenegraph/d3d12/qsgd3d12layer.cpp9
-rw-r--r--src/plugins/scenegraph/d3d12/qsgd3d12layer_p.h10
-rw-r--r--src/plugins/scenegraph/d3d12/qsgd3d12rendercontext.cpp2
-rw-r--r--src/plugins/scenegraph/d3d12/qsgd3d12rendercontext_p.h2
-rw-r--r--src/plugins/scenegraph/d3d12/qsgd3d12renderloop.cpp2
-rw-r--r--src/plugins/scenegraph/d3d12/qsgd3d12shadereffectnode.cpp54
-rw-r--r--src/plugins/scenegraph/d3d12/qsgd3d12shadereffectnode_p.h1
-rw-r--r--src/plugins/scenegraph/d3d12/qsgd3d12texture.cpp12
-rw-r--r--src/plugins/scenegraph/d3d12/qsgd3d12texture_p.h13
-rw-r--r--src/plugins/scenegraph/d3d12/qsgd3d12threadedrenderloop.cpp16
12 files changed, 50 insertions, 76 deletions
diff --git a/src/plugins/scenegraph/d3d12/qsgd3d12context.cpp b/src/plugins/scenegraph/d3d12/qsgd3d12context.cpp
index 9b88af995d..f9bd04aa54 100644
--- a/src/plugins/scenegraph/d3d12/qsgd3d12context.cpp
+++ b/src/plugins/scenegraph/d3d12/qsgd3d12context.cpp
@@ -61,8 +61,9 @@ QSGInternalRectangleNode *QSGD3D12Context::createInternalRectangleNode()
return new QSGD3D12InternalRectangleNode;
}
-QSGInternalImageNode *QSGD3D12Context::createInternalImageNode()
+QSGInternalImageNode *QSGD3D12Context::createInternalImageNode(QSGRenderContext *renderContext)
{
+ Q_UNUSED(renderContext);
return new QSGD3D12InternalImageNode;
}
diff --git a/src/plugins/scenegraph/d3d12/qsgd3d12context_p.h b/src/plugins/scenegraph/d3d12/qsgd3d12context_p.h
index 70cc606b52..382183fef6 100644
--- a/src/plugins/scenegraph/d3d12/qsgd3d12context_p.h
+++ b/src/plugins/scenegraph/d3d12/qsgd3d12context_p.h
@@ -62,7 +62,7 @@ public:
QSGRenderContext *createRenderContext() override;
QSGInternalRectangleNode *createInternalRectangleNode() override;
- QSGInternalImageNode *createInternalImageNode() override;
+ QSGInternalImageNode *createInternalImageNode(QSGRenderContext *renderContext) override;
QSGPainterNode *createPainterNode(QQuickPaintedItem *item) override;
QSGGlyphNode *createGlyphNode(QSGRenderContext *renderContext, bool preferNativeGlyphNode) override;
QSGLayer *createLayer(QSGRenderContext *renderContext) override;
diff --git a/src/plugins/scenegraph/d3d12/qsgd3d12layer.cpp b/src/plugins/scenegraph/d3d12/qsgd3d12layer.cpp
index faa6f7566a..b9d3a180cf 100644
--- a/src/plugins/scenegraph/d3d12/qsgd3d12layer.cpp
+++ b/src/plugins/scenegraph/d3d12/qsgd3d12layer.cpp
@@ -53,7 +53,8 @@ QT_BEGIN_NAMESPACE
DECLARE_DEBUG_VAR(render)
QSGD3D12Layer::QSGD3D12Layer(QSGD3D12RenderContext *rc)
- : m_rc(rc)
+ : QSGLayer(*(new QSGD3D12LayerPrivate)),
+ m_rc(rc)
{
if (Q_UNLIKELY(debug_render()))
qDebug("new layer %p", this);
@@ -74,6 +75,12 @@ int QSGD3D12Layer::textureId() const
return m_rt; // not a texture id per se but will do
}
+int QSGD3D12LayerPrivate::comparisonKey() const
+{
+ Q_Q(const QSGD3D12Layer);
+ return q->m_rt;
+}
+
QSize QSGD3D12Layer::textureSize() const
{
return m_size;
diff --git a/src/plugins/scenegraph/d3d12/qsgd3d12layer_p.h b/src/plugins/scenegraph/d3d12/qsgd3d12layer_p.h
index f828843227..42a56877cf 100644
--- a/src/plugins/scenegraph/d3d12/qsgd3d12layer_p.h
+++ b/src/plugins/scenegraph/d3d12/qsgd3d12layer_p.h
@@ -52,13 +52,16 @@
//
#include <private/qsgadaptationlayer_p.h>
+#include <private/qsgtexture_p.h>
QT_BEGIN_NAMESPACE
class QSGD3D12RenderContext;
+class QSGD3D12LayerPrivate;
class QSGD3D12Layer : public QSGLayer
{
+ Q_DECLARE_PRIVATE(QSGD3D12Layer)
Q_OBJECT
public:
@@ -114,6 +117,13 @@ private:
bool m_updateContentPending = false;
};
+class QSGD3D12LayerPrivate : public QSGTexturePrivate
+{
+ Q_DECLARE_PUBLIC(QSGD3D12Layer)
+public:
+ int comparisonKey() const override;
+};
+
QT_END_NAMESPACE
#endif // QSGD3D12LAYER_P_H
diff --git a/src/plugins/scenegraph/d3d12/qsgd3d12rendercontext.cpp b/src/plugins/scenegraph/d3d12/qsgd3d12rendercontext.cpp
index 4ee4656e63..48693207c6 100644
--- a/src/plugins/scenegraph/d3d12/qsgd3d12rendercontext.cpp
+++ b/src/plugins/scenegraph/d3d12/qsgd3d12rendercontext.cpp
@@ -64,7 +64,7 @@ bool QSGD3D12RenderContext::isValid() const
return m_engine != nullptr;
}
-void QSGD3D12RenderContext::initialize(void *)
+void QSGD3D12RenderContext::initialize(const InitParams *)
{
if (m_initialized)
return;
diff --git a/src/plugins/scenegraph/d3d12/qsgd3d12rendercontext_p.h b/src/plugins/scenegraph/d3d12/qsgd3d12rendercontext_p.h
index 35aca100f4..c555c0808e 100644
--- a/src/plugins/scenegraph/d3d12/qsgd3d12rendercontext_p.h
+++ b/src/plugins/scenegraph/d3d12/qsgd3d12rendercontext_p.h
@@ -63,7 +63,7 @@ class QSGD3D12RenderContext : public QSGRenderContext, public QSGRendererInterfa
public:
QSGD3D12RenderContext(QSGContext *ctx);
bool isValid() const override;
- void initialize(void *context) override;
+ void initialize(const InitParams *params) override;
void invalidate() override;
void renderNextFrame(QSGRenderer *renderer, uint fbo) override;
QSGTexture *createTexture(const QImage &image, uint flags) const override;
diff --git a/src/plugins/scenegraph/d3d12/qsgd3d12renderloop.cpp b/src/plugins/scenegraph/d3d12/qsgd3d12renderloop.cpp
index 0d501f48c0..4a6894e69e 100644
--- a/src/plugins/scenegraph/d3d12/qsgd3d12renderloop.cpp
+++ b/src/plugins/scenegraph/d3d12/qsgd3d12renderloop.cpp
@@ -148,7 +148,7 @@ void QSGD3D12RenderLoop::windowDestroyed(QQuickWindow *window)
delete rc;
delete engine;
- delete wd->animationController;
+ wd->animationController.reset();
}
void QSGD3D12RenderLoop::exposeWindow(QQuickWindow *window)
diff --git a/src/plugins/scenegraph/d3d12/qsgd3d12shadereffectnode.cpp b/src/plugins/scenegraph/d3d12/qsgd3d12shadereffectnode.cpp
index b4fb721a8b..1f574a9802 100644
--- a/src/plugins/scenegraph/d3d12/qsgd3d12shadereffectnode.cpp
+++ b/src/plugins/scenegraph/d3d12/qsgd3d12shadereffectnode.cpp
@@ -78,32 +78,6 @@ void QSGD3D12ShaderLinker::reset(const QByteArray &vertBlob, const QByteArray &f
textureNameMap.clear();
}
-void QSGD3D12ShaderLinker::feedVertexInput(const QSGShaderEffectNode::ShaderData &shader)
-{
- bool foundPos = false, foundTexCoord = false;
-
- for (const auto &ip : qAsConst(shader.shaderInfo.inputParameters)) {
- if (ip.semanticName == QByteArrayLiteral("POSITION"))
- foundPos = true;
- else if (ip.semanticName == QByteArrayLiteral("TEXCOORD"))
- foundTexCoord = true;
- }
-
- if (!foundPos) {
- qWarning("ShaderEffect: No POSITION input found.");
- error = true;
- }
- if (!foundTexCoord) {
- qWarning("ShaderEffect: No TEXCOORD input found.");
- error = true;
- }
-
- // Nothing else to do here, the QSGGeometry::AttributeSet decides anyway
- // and that is already generated by QQuickShaderEffectMesh via
- // QSGGeometry::defaultAttributes_TexturedPoint2D() and has the semantics
- // so it will just work.
-}
-
void QSGD3D12ShaderLinker::feedConstants(const QSGShaderEffectNode::ShaderData &shader, const QSet<int> *dirtyIndices)
{
Q_ASSERT(shader.shaderInfo.variables.count() == shader.varData.count());
@@ -634,19 +608,12 @@ void QSGD3D12ShaderEffectNode::syncMaterial(SyncData *syncData)
m_material.linker.reset(vertBlob, fragBlob);
if (m_material.hasCustomVertexShader) {
- m_material.linker.feedVertexInput(*syncData->vertex.shader);
m_material.linker.feedConstants(*syncData->vertex.shader);
} else {
QSGShaderEffectNode::ShaderData defaultSD;
defaultSD.shaderInfo.blob = vertBlob;
defaultSD.shaderInfo.type = QSGGuiThreadShaderEffectManager::ShaderInfo::TypeVertex;
- QSGGuiThreadShaderEffectManager::ShaderInfo::InputParameter ip;
- ip.semanticName = QByteArrayLiteral("POSITION");
- defaultSD.shaderInfo.inputParameters.append(ip);
- ip.semanticName = QByteArrayLiteral("TEXCOORD");
- defaultSD.shaderInfo.inputParameters.append(ip);
-
// { float4x4 qt_Matrix; float qt_Opacity; } where only the matrix is used
QSGGuiThreadShaderEffectManager::ShaderInfo::Variable v;
v.name = QByteArrayLiteral("qt_Matrix");
@@ -656,10 +623,7 @@ void QSGD3D12ShaderEffectNode::syncMaterial(SyncData *syncData)
QSGShaderEffectNode::VariableData vd;
vd.specialType = QSGShaderEffectNode::VariableData::Matrix;
defaultSD.varData.append(vd);
-
defaultSD.shaderInfo.constantDataSize = (16 + 1) * sizeof(float);
-
- m_material.linker.feedVertexInput(defaultSD);
m_material.linker.feedConstants(defaultSD);
}
@@ -943,20 +907,6 @@ bool QSGD3D12GuiThreadShaderEffectManager::reflect(ShaderInfo *result)
qDebug("Shader reflection size %d type %d v%u.%u input elems %d cbuffers %d boundres %d",
result->blob.size(), result->type, major, minor, ieCount, cbufferCount, boundResCount);
- for (int i = 0; i < ieCount; ++i) {
- D3D12_SIGNATURE_PARAMETER_DESC desc;
- if (FAILED(reflector->GetInputParameterDesc(i, &desc))) {
- qWarning("D3D reflection: Failed to query input parameter %d", i);
- return false;
- }
- if (desc.SystemValueType != D3D_NAME_UNDEFINED)
- continue;
- ShaderInfo::InputParameter param;
- param.semanticName = QByteArray(desc.SemanticName);
- param.semanticIndex = desc.SemanticIndex;
- result->inputParameters.append(param);
- }
-
for (int i = 0; i < boundResCount; ++i) {
D3D12_SHADER_INPUT_BIND_DESC desc;
if (FAILED(reflector->GetResourceBindingDesc(i, &desc))) {
@@ -1036,10 +986,8 @@ bool QSGD3D12GuiThreadShaderEffectManager::reflect(ShaderInfo *result)
}
}
- if (Q_UNLIKELY(debug_shader())) {
- qDebug() << "Input:" << result->inputParameters;
+ if (Q_UNLIKELY(debug_shader()))
qDebug() << "Variables:" << result->variables << "cbuffer size" << result->constantDataSize;
- }
return true;
}
diff --git a/src/plugins/scenegraph/d3d12/qsgd3d12shadereffectnode_p.h b/src/plugins/scenegraph/d3d12/qsgd3d12shadereffectnode_p.h
index ee17e59130..dec85fd782 100644
--- a/src/plugins/scenegraph/d3d12/qsgd3d12shadereffectnode_p.h
+++ b/src/plugins/scenegraph/d3d12/qsgd3d12shadereffectnode_p.h
@@ -67,7 +67,6 @@ class QSGD3D12ShaderLinker
public:
void reset(const QByteArray &vertBlob, const QByteArray &fragBlob);
- void feedVertexInput(const QSGShaderEffectNode::ShaderData &shader);
void feedConstants(const QSGShaderEffectNode::ShaderData &shader, const QSet<int> *dirtyIndices = nullptr);
void feedSamplers(const QSGShaderEffectNode::ShaderData &shader);
void feedTextures(const QSGShaderEffectNode::ShaderData &shader, const QSet<int> *dirtyIndices = nullptr);
diff --git a/src/plugins/scenegraph/d3d12/qsgd3d12texture.cpp b/src/plugins/scenegraph/d3d12/qsgd3d12texture.cpp
index a5f3eb7a31..b49b851c23 100644
--- a/src/plugins/scenegraph/d3d12/qsgd3d12texture.cpp
+++ b/src/plugins/scenegraph/d3d12/qsgd3d12texture.cpp
@@ -69,6 +69,12 @@ void QSGD3D12Texture::create(const QImage &image, uint flags)
m_createPending = true;
}
+QSGD3D12Texture::QSGD3D12Texture(QSGD3D12Engine *engine)
+ : QSGTexture(*(new QSGD3D12TexturePrivate)),
+ m_engine(engine)
+{
+}
+
QSGD3D12Texture::~QSGD3D12Texture()
{
if (m_id)
@@ -80,6 +86,12 @@ int QSGD3D12Texture::textureId() const
return m_id;
}
+int QSGD3D12TexturePrivate::comparisonKey() const
+{
+ Q_Q(const QSGD3D12Texture);
+ return q->m_id;
+}
+
QSize QSGD3D12Texture::textureSize() const
{
return m_image.size();
diff --git a/src/plugins/scenegraph/d3d12/qsgd3d12texture_p.h b/src/plugins/scenegraph/d3d12/qsgd3d12texture_p.h
index 3d0e226ddb..f6a5257773 100644
--- a/src/plugins/scenegraph/d3d12/qsgd3d12texture_p.h
+++ b/src/plugins/scenegraph/d3d12/qsgd3d12texture_p.h
@@ -51,17 +51,19 @@
// We mean it.
//
-#include <qsgtexture.h>
+#include <private/qsgtexture_p.h>
#include <basetsd.h>
QT_BEGIN_NAMESPACE
class QSGD3D12Engine;
+class QSGD3D12TexturePrivate;
class QSGD3D12Texture : public QSGTexture
{
+ Q_DECLARE_PRIVATE(QSGD3D12Texture)
public:
- QSGD3D12Texture(QSGD3D12Engine *engine) : m_engine(engine) { }
+ QSGD3D12Texture(QSGD3D12Engine *engine);
~QSGD3D12Texture();
void create(const QImage &image, uint flags);
@@ -82,6 +84,13 @@ protected:
bool m_alphaWanted = false;
};
+class QSGD3D12TexturePrivate : public QSGTexturePrivate
+{
+ Q_DECLARE_PUBLIC(QSGD3D12Texture)
+public:
+ int comparisonKey() const override;
+};
+
QT_END_NAMESPACE
#endif
diff --git a/src/plugins/scenegraph/d3d12/qsgd3d12threadedrenderloop.cpp b/src/plugins/scenegraph/d3d12/qsgd3d12threadedrenderloop.cpp
index 120a84566f..4302a9119b 100644
--- a/src/plugins/scenegraph/d3d12/qsgd3d12threadedrenderloop.cpp
+++ b/src/plugins/scenegraph/d3d12/qsgd3d12threadedrenderloop.cpp
@@ -121,10 +121,6 @@ const QEvent::Type WM_Obscure = QEvent::Type(QEvent::User + 1);
// Passed from the RL to RT when GUI has been locked, waiting for sync.
const QEvent::Type WM_RequestSync = QEvent::Type(QEvent::User + 2);
-// Passed by the RT to itself to trigger another render pass. This is typically
-// a result of QQuickWindow::update().
-const QEvent::Type WM_RequestRepaint = QEvent::Type(QEvent::User + 3);
-
// Passed by the RL to the RT to maybe release resource if no windows are
// rendering.
const QEvent::Type WM_TryRelease = QEvent::Type(QEvent::User + 4);
@@ -377,7 +373,7 @@ bool QSGD3D12RenderThread::event(QEvent *e)
QCoreApplication::processEvents();
QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete);
if (wme->destroying)
- delete wd->animationController;
+ wd->animationController.reset();
}
if (wme->destroying)
active = false;
@@ -436,14 +432,6 @@ bool QSGD3D12RenderThread::event(QEvent *e)
return true;
}
- case WM_RequestRepaint:
- if (Q_UNLIKELY(debug_loop()))
- qDebug("RT - WM_RequestPaint");
- // When GUI posts this event, it is followed by a polishAndSync, so we
- // must not exit the event loop yet.
- pendingUpdate |= RepaintRequest;
- break;
-
default:
break;
}
@@ -1018,7 +1006,7 @@ void QSGD3D12ThreadedRenderLoop::handleExposure(QQuickWindow *window)
if (Q_UNLIKELY(debug_loop()))
qDebug("starting render thread");
// Push a few things to the render thread.
- QQuickAnimatorController *controller = QQuickWindowPrivate::get(w->window)->animationController;
+ QQuickAnimatorController *controller = QQuickWindowPrivate::get(w->window)->animationController.data();
if (controller->thread() != w->thread)
controller->moveToThread(w->thread);
if (w->thread->thread() == QThread::currentThread()) {