diff options
author | Laszlo Agocs <laszlo.agocs@theqtcompany.com> | 2016-05-26 16:04:03 +0200 |
---|---|---|
committer | Laszlo Agocs <laszlo.agocs@theqtcompany.com> | 2016-06-01 10:32:18 +0000 |
commit | 1c6d4353f742a740e54b234db4d7b8913d515376 (patch) | |
tree | 2b0a7602cd96345240f3b021e4453ca560e932c1 /src/quick/scenegraph | |
parent | a6d3e3afcdd8f08893cff4deed7e866a5daf3cbd (diff) |
One GraphicsInfo to rule them all
Rename RendererInfo to GraphicsInfo. Deprecate OpenGLInfo and move
the surface format properties into GraphicsInfo. Move also the
shader info properties from ShaderEffect.
Change-Id: I3b3f01080e059b3a30a132fd67de19a4bfca54ef
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
Diffstat (limited to 'src/quick/scenegraph')
7 files changed, 106 insertions, 22 deletions
diff --git a/src/quick/scenegraph/adaptations/software/qsgsoftwarecontext.cpp b/src/quick/scenegraph/adaptations/software/qsgsoftwarecontext.cpp index fe9ad67901..dee1ac8954 100644 --- a/src/quick/scenegraph/adaptations/software/qsgsoftwarecontext.cpp +++ b/src/quick/scenegraph/adaptations/software/qsgsoftwarecontext.cpp @@ -179,4 +179,19 @@ QSGRendererInterface::GraphicsApi QSGSoftwareContext::graphicsApi() const return Software; } +QSGRendererInterface::ShaderType QSGSoftwareContext::shaderType() const +{ + return UnknownShadingLanguage; +} + +QSGRendererInterface::ShaderCompilationTypes QSGSoftwareContext::shaderCompilationType() const +{ + return 0; +} + +QSGRendererInterface::ShaderSourceTypes QSGSoftwareContext::shaderSourceType() const +{ + return 0; +} + QT_END_NAMESPACE diff --git a/src/quick/scenegraph/adaptations/software/qsgsoftwarecontext_p.h b/src/quick/scenegraph/adaptations/software/qsgsoftwarecontext_p.h index 023a33cbd5..992f6f5677 100644 --- a/src/quick/scenegraph/adaptations/software/qsgsoftwarecontext_p.h +++ b/src/quick/scenegraph/adaptations/software/qsgsoftwarecontext_p.h @@ -96,6 +96,9 @@ public: QSGRendererInterface *rendererInterface(QSGRenderContext *renderContext) override; GraphicsApi graphicsApi() const override; + ShaderType shaderType() const override; + ShaderCompilationTypes shaderCompilationType() const override; + ShaderSourceTypes shaderSourceType() const override; }; QT_END_NAMESPACE diff --git a/src/quick/scenegraph/coreapi/qsgrendererinterface.cpp b/src/quick/scenegraph/coreapi/qsgrendererinterface.cpp index 2920a187e2..ffde9d8930 100644 --- a/src/quick/scenegraph/coreapi/qsgrendererinterface.cpp +++ b/src/quick/scenegraph/coreapi/qsgrendererinterface.cpp @@ -63,7 +63,7 @@ QT_BEGIN_NAMESPACE */ /*! - \enum QSGRenderNode::GraphicsApi + \enum QSGRendererInterface::GraphicsApi \value Unknown An unknown graphics API is in use \value Software The Qt Quick 2D Renderer is in use \value OpenGL OpenGL ES 2.0 or higher @@ -73,7 +73,7 @@ QT_BEGIN_NAMESPACE */ /*! - \enum QSGRenderNode::Resource + \enum QSGRendererInterface::Resource \value Device The graphics device \value CommandQueue The graphics command queue used by the scenergaph \value CommandList The command list or buffer used by the scenegraph @@ -84,7 +84,7 @@ QSGRendererInterface::~QSGRendererInterface() } /*! - \fn QSGRenderNode::GraphicsApi QSGRenderNode::graphicsApi() const + \fn QSGRendererInterface::GraphicsApi QSGRendererInterface::graphicsApi() const Returns the graphics API that is in use by the Qt Quick scenegraph. @@ -125,4 +125,45 @@ void *QSGRendererInterface::getResource(const char *resource) const return nullptr; } +/*! + \fn QSGRendererInterface::ShaderType QSGRendererInterface::shaderType() const + + \return the shading language supported by the Qt Quick backend the + application is using. + + \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. + + \sa QtQuick::GraphicsInfo + */ + +/*! + \fn QSGRendererInterface::ShaderCompilationTypes QSGRendererInterface::shaderCompilationType() const + + \return a bitmask of the shader compilation approaches supported by the Qt + Quick backend the application is using. + + \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. + + \sa QtQuick::GraphicsInfo + */ + +/*! + \fn QSGRendererInterface::ShaderSourceTypes QSGRendererInterface::shaderSourceType() const + + \return a bitmask of the supported ways of providing shader sources. + + \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. + + \sa QtQuick::GraphicsInfo + */ + QT_END_NAMESPACE diff --git a/src/quick/scenegraph/coreapi/qsgrendererinterface.h b/src/quick/scenegraph/coreapi/qsgrendererinterface.h index 75b79336fd..234a061d0e 100644 --- a/src/quick/scenegraph/coreapi/qsgrendererinterface.h +++ b/src/quick/scenegraph/coreapi/qsgrendererinterface.h @@ -60,14 +60,40 @@ public: CommandList }; + enum ShaderType { + UnknownShadingLanguage, + GLSL, + HLSL + }; + + enum ShaderCompilationType { + RuntimeCompilation = 0x01, + OfflineCompilation = 0x02 + }; + Q_DECLARE_FLAGS(ShaderCompilationTypes, ShaderCompilationType) + + enum ShaderSourceType { + ShaderSourceString = 0x01, + ShaderSourceFile = 0x02, + ShaderByteCode = 0x04 + }; + Q_DECLARE_FLAGS(ShaderSourceTypes, ShaderSourceType) + virtual ~QSGRendererInterface(); virtual GraphicsApi graphicsApi() const = 0; virtual void *getResource(Resource resource) const; virtual void *getResource(const char *resource) const; + + virtual ShaderType shaderType() const = 0; + virtual ShaderCompilationTypes shaderCompilationType() const = 0; + virtual ShaderSourceTypes shaderSourceType() const = 0; }; +Q_DECLARE_OPERATORS_FOR_FLAGS(QSGRendererInterface::ShaderCompilationTypes) +Q_DECLARE_OPERATORS_FOR_FLAGS(QSGRendererInterface::ShaderSourceTypes) + QT_END_NAMESPACE #endif diff --git a/src/quick/scenegraph/qsgadaptationlayer_p.h b/src/quick/scenegraph/qsgadaptationlayer_p.h index 0df42c2aa8..8fdcf7af64 100644 --- a/src/quick/scenegraph/qsgadaptationlayer_p.h +++ b/src/quick/scenegraph/qsgadaptationlayer_p.h @@ -228,31 +228,12 @@ class Q_QUICK_PRIVATE_EXPORT QSGGuiThreadShaderEffectManager : public QObject Q_OBJECT public: - // Enum values must match ShaderEffect. - enum ShaderType { - UnknownShadingLanguage, - GLSL, - HLSL - }; - enum ShaderCompilationType { - RuntimeCompilation = 0x01, - OfflineCompilation = 0x02 - }; - enum ShaderSourceType { - ShaderSourceString = 0x01, - ShaderSourceFile = 0x02, - ShaderByteCode = 0x04 - }; enum Status { Compiled, Uncompiled, Error }; - virtual ShaderType shaderType() const = 0; - virtual int shaderCompilationType() const = 0; - virtual int shaderSourceType() const = 0; - virtual bool hasSeparateSamplerAndTextureObjects() const = 0; virtual QString log() const = 0; diff --git a/src/quick/scenegraph/qsgdefaultcontext.cpp b/src/quick/scenegraph/qsgdefaultcontext.cpp index 46127544a0..f9978e816c 100644 --- a/src/quick/scenegraph/qsgdefaultcontext.cpp +++ b/src/quick/scenegraph/qsgdefaultcontext.cpp @@ -251,4 +251,19 @@ QSGRendererInterface::GraphicsApi QSGDefaultContext::graphicsApi() const return OpenGL; } +QSGRendererInterface::ShaderType QSGDefaultContext::shaderType() const +{ + return GLSL; +} + +QSGRendererInterface::ShaderCompilationTypes QSGDefaultContext::shaderCompilationType() const +{ + return RuntimeCompilation; +} + +QSGRendererInterface::ShaderSourceTypes QSGDefaultContext::shaderSourceType() const +{ + return ShaderSourceString; +} + QT_END_NAMESPACE diff --git a/src/quick/scenegraph/qsgdefaultcontext_p.h b/src/quick/scenegraph/qsgdefaultcontext_p.h index d14d9d6812..6686ab98a0 100644 --- a/src/quick/scenegraph/qsgdefaultcontext_p.h +++ b/src/quick/scenegraph/qsgdefaultcontext_p.h @@ -79,6 +79,9 @@ public: bool isDistanceFieldEnabled() const; GraphicsApi graphicsApi() const override; + ShaderType shaderType() const override; + ShaderCompilationTypes shaderCompilationType() const override; + ShaderSourceTypes shaderSourceType() const override; private: QMutex m_mutex; |