diff options
author | Laszlo Agocs <laszlo.agocs@theqtcompany.com> | 2016-04-20 12:36:15 +0200 |
---|---|---|
committer | Laszlo Agocs <laszlo.agocs@theqtcompany.com> | 2016-04-29 09:36:33 +0000 |
commit | e88e2940598086b57e6c844afa2eca4153d0f528 (patch) | |
tree | 54dc790adf9b8b384cb7067cce848c32dd58057f /src/quick/scenegraph/coreapi/qsgrendererinterface.cpp | |
parent | e4d56b01b30ad6c8482dab3dab6600676a9d6632 (diff) |
Adaptable shader effect enablers
The D3D12 node implementation is mostly missing. The rest of the enablers
should be in place now however.
Importing QtQuick 2.8 provides new properties for ShaderEffect:
- shaderType can be used to decide which language should be used
- shaderCompilationType tells if compilation is runtime or offline
- shaderSourceType tells if the vertex/fragmentShader properties refer
to source strings or source files or pre-compiled bytecode files
The last two are bitmasks. In practice however we will support only
one approach per backend for now (runtime + source string for OpenGL,
offline + bytecode for D3D12).
In addition to QSGShaderEffectNode, introduce the QSGGuiThreadShaderEffectManager
interface. This provides the gui thread bits for the above and performs shader
reflection. Backends that use the new ShaderEffect system must provide both.
For each ShaderEffect item there will be a manager (on the gui thread) and
a node (on the render thread).
Reflection is expected to be done via standard helper libs (d3d12shader
+ D3DReflect from d3dcompiler for the D3D12 backend), or via manually inspecting
SPIR-V, or parsing the source (like the GL path does now), or by using some
3rd party library (not recommended). In any case we require that reflection is
doable on the gui thread without dependencies to the actual graphics API.
The ShaderEffect documentation is greatly extended, covering HLSL and the new
properties.
The test app uses manually compiled shaders on its HLSL path for now. This
is because there is no story yet for build system integration for public
use (the internal HLSL -> bytecode in C header rule is only suitable for
the d3d12 plugin itself, apps need something different).
Change-Id: Id112104906fbcb26b9902a35f19d8d509b340d1b
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
Diffstat (limited to 'src/quick/scenegraph/coreapi/qsgrendererinterface.cpp')
-rw-r--r-- | src/quick/scenegraph/coreapi/qsgrendererinterface.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/quick/scenegraph/coreapi/qsgrendererinterface.cpp b/src/quick/scenegraph/coreapi/qsgrendererinterface.cpp index 6a01fac212..b680dbe3d5 100644 --- a/src/quick/scenegraph/coreapi/qsgrendererinterface.cpp +++ b/src/quick/scenegraph/coreapi/qsgrendererinterface.cpp @@ -87,6 +87,11 @@ QSGRendererInterface::~QSGRendererInterface() \fn QSGRenderNode::GraphicsAPI QSGRenderNode::graphicsAPI() const Returns the graphics API that is in use by the Qt Quick scenegraph. + + \note This function can be called on any thread. However, the renderer + interface's lifetime may be tied to the render thread and therefore calling + this function from other threads during the process of application shutdown + or QQuickWindow closing is likely to become invalid. */ /*! @@ -98,6 +103,8 @@ QSGRendererInterface::~QSGRendererInterface() pointer to an opaque handle that needs to be dereferenced first (for example, \c{VkDevice dev = *static_cast<VkDevice *>(result)}). The latter is necessary since such handles may have sizes different from a pointer. + + \note This function must only be called on the render thread. */ void *QSGRendererInterface::getResource(Resource resource) const { @@ -109,6 +116,8 @@ void *QSGRendererInterface::getResource(Resource resource) const Queries a graphics resource. \a resource is a backend-specific key. This allows supporting any future resources that are not listed in the Resource enum. + + \note This function must only be called on the render thread. */ void *QSGRendererInterface::getResource(const char *resource) const { |