From 7de18e6f52d6247bddd7bfabe0b2601d7db239b5 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Wed, 15 Jun 2016 15:17:32 +0200 Subject: D3D12: Support runtime threaded shader compilation Let's revise our policy of offline/bytecode only shaders. ShaderEffect benefits greatly from having runtime compilation support for HLSL source strings, especially when dynamically constructing shader strings. There is no reason not to support both approaches since we rely on d3dcompiler for reflection anyhow. What's more, we can call D3DCompile on a dedicated thread, keeping the gui responsive while compilation is on-going. Change-Id: Ie6c02c2aa0ebd0c8371bbf30b3ce6582128c457b Reviewed-by: Andy Nichols --- src/quick/items/qquickgenericshadereffect_p.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/quick/items/qquickgenericshadereffect_p.h') diff --git a/src/quick/items/qquickgenericshadereffect_p.h b/src/quick/items/qquickgenericshadereffect_p.h index ab17a7fb87..5ec83eb60f 100644 --- a/src/quick/items/qquickgenericshadereffect_p.h +++ b/src/quick/items/qquickgenericshadereffect_p.h @@ -103,6 +103,8 @@ private slots: void markGeometryDirtyAndUpdateIfSupportsAtlas(); void itemWindowChanged(QQuickWindow *w); void backendChanged(); + void shaderCodePrepared(bool ok, QSGGuiThreadShaderEffectManager::ShaderInfo::Type typeHint, + const QByteArray &src, QSGGuiThreadShaderEffectManager::ShaderInfo *result); private: QSGGuiThreadShaderEffectManager *shaderEffectManager() const; @@ -113,8 +115,9 @@ private: NShader }; - void updateShader(Shader which, const QByteArray &src); - void disconnectSignals(Shader which); + void updateShader(Shader shaderType, const QByteArray &src); + void updateShaderVars(Shader shaderType); + void disconnectSignals(Shader shaderType); bool sourceIsUnique(QQuickItem *source, Shader typeToSkip, int indexToSkip) const; QQuickShaderEffect *m_item; @@ -132,6 +135,7 @@ private: QSGShaderEffectNode::DirtyShaderFlags m_dirty; QSet m_dirtyConstants[NShader]; QSet m_dirtyTextures[NShader]; + QSGGuiThreadShaderEffectManager::ShaderInfo *m_inProgress[NShader]; struct SignalMapper { SignalMapper() : mapper(nullptr), active(false) { } -- cgit v1.2.3