Move QOpenGLShaderProgram from QtGui to QtOpenGL

Task-number: QTBUG-74409
Change-Id: I20dfafc0c9bf8e2b68b03e171d70c2cb4ad2bfaf
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
This commit is contained in:
Johan Klokkhammer Helsing 2020-01-17 14:40:36 +01:00
parent 012bb039e3
commit 4b611d649e
19 changed files with 29 additions and 32 deletions

View File

@ -14,6 +14,7 @@ set(INSTALL_EXAMPLEDIR "examples/opengl/contextinfo")
find_package(Qt6 COMPONENTS Core) find_package(Qt6 COMPONENTS Core)
find_package(Qt6 COMPONENTS Gui) find_package(Qt6 COMPONENTS Gui)
find_package(Qt6 COMPONENTS Widgets) find_package(Qt6 COMPONENTS Widgets)
find_package(Qt6 COMPONENTS OpenGL)
add_qt_gui_executable(contextinfo add_qt_gui_executable(contextinfo
main.cpp main.cpp
@ -23,6 +24,7 @@ add_qt_gui_executable(contextinfo
target_link_libraries(contextinfo PUBLIC target_link_libraries(contextinfo PUBLIC
Qt::Core Qt::Core
Qt::Gui Qt::Gui
Qt::OpenGL
Qt::Widgets Qt::Widgets
) )

View File

@ -1,5 +1,5 @@
TEMPLATE = app TEMPLATE = app
QT += widgets QT += widgets opengl
requires(qtConfig(filedialog)) requires(qtConfig(filedialog))
SOURCES += main.cpp \ SOURCES += main.cpp \

View File

@ -52,7 +52,7 @@
#include <QTimer> #include <QTimer>
#include <QMatrix4x4> #include <QMatrix4x4>
#include <QOpenGLContext> #include <QOpenGLContext>
#include <QOpenGLShaderProgram> #include <QtOpenGL/QOpenGLShaderProgram>
#include <QOpenGLFunctions> #include <QOpenGLFunctions>
RenderWindow::RenderWindow(const QSurfaceFormat &format) RenderWindow::RenderWindow(const QSurfaceFormat &format)

View File

@ -13,6 +13,7 @@ set(INSTALL_EXAMPLEDIR "examples/opengl/hellowindow")
find_package(Qt6 COMPONENTS Core) find_package(Qt6 COMPONENTS Core)
find_package(Qt6 COMPONENTS Gui) find_package(Qt6 COMPONENTS Gui)
find_package(Qt6 COMPONENTS OpenGL)
add_qt_gui_executable(hellowindow add_qt_gui_executable(hellowindow
hellowindow.cpp hellowindow.h hellowindow.cpp hellowindow.h
@ -23,6 +24,7 @@ target_link_libraries(hellowindow PUBLIC
Qt::CorePrivate Qt::CorePrivate
Qt::Gui Qt::Gui
Qt::GuiPrivate Qt::GuiPrivate
Qt::OpenGL
) )
install(TARGETS hellowindow install(TARGETS hellowindow

View File

@ -52,7 +52,7 @@
#include <QColor> #include <QColor>
#include <QMutex> #include <QMutex>
#include <QOpenGLShaderProgram> #include <QtOpenGL/QOpenGLShaderProgram>
#include <QOpenGLBuffer> #include <QOpenGLBuffer>
#include <QSharedPointer> #include <QSharedPointer>
#include <QTimer> #include <QTimer>

View File

@ -1,4 +1,4 @@
QT += gui-private core-private QT += gui-private core-private opengl
HEADERS += hellowindow.h HEADERS += hellowindow.h
SOURCES += hellowindow.cpp main.cpp SOURCES += hellowindow.cpp main.cpp

View File

@ -51,7 +51,7 @@
#include <QWindow> #include <QWindow>
#include <QtGui/qopengl.h> #include <QtGui/qopengl.h>
#include <QtGui/qopenglshaderprogram.h> #include <QtOpenGL/qopenglshaderprogram.h>
#include <QtOpenGL/qopenglframebufferobject.h> #include <QtOpenGL/qopenglframebufferobject.h>
#include <QPropertyAnimation> #include <QPropertyAnimation>

View File

@ -260,7 +260,6 @@ qt_extend_target(Gui CONDITION QT_FEATURE_opengl
opengl/qopenglextrafunctions.h opengl/qopenglextrafunctions.h
opengl/qopenglfunctions.cpp opengl/qopenglfunctions.h opengl/qopenglfunctions.cpp opengl/qopenglfunctions.h
opengl/qopenglprogrambinarycache.cpp opengl/qopenglprogrambinarycache_p.h opengl/qopenglprogrambinarycache.cpp opengl/qopenglprogrambinarycache_p.h
opengl/qopenglshaderprogram.cpp opengl/qopenglshaderprogram.h
opengl/qopenglversionfunctions.cpp opengl/qopenglversionfunctions.h opengl/qopenglversionfunctions.cpp opengl/qopenglversionfunctions.h
opengl/qopenglversionfunctionsfactory.cpp opengl/qopenglversionfunctionsfactory_p.h opengl/qopenglversionfunctionsfactory.cpp opengl/qopenglversionfunctionsfactory_p.h
opengl/qopenglvertexarrayobject.cpp opengl/qopenglvertexarrayobject.h opengl/qopenglvertexarrayobject.cpp opengl/qopenglvertexarrayobject.h

View File

@ -342,7 +342,6 @@ qt_extend_target(Gui CONDITION QT_FEATURE_opengl
opengl/qopenglextrafunctions.h opengl/qopenglextrafunctions.h
opengl/qopenglfunctions.cpp opengl/qopenglfunctions.h opengl/qopenglfunctions.cpp opengl/qopenglfunctions.h
opengl/qopenglprogrambinarycache.cpp opengl/qopenglprogrambinarycache_p.h opengl/qopenglprogrambinarycache.cpp opengl/qopenglprogrambinarycache_p.h
opengl/qopenglshaderprogram.cpp opengl/qopenglshaderprogram.h
opengl/qopenglversionfunctions.cpp opengl/qopenglversionfunctions.h opengl/qopenglversionfunctions.cpp opengl/qopenglversionfunctions.h
opengl/qopenglversionfunctionsfactory.cpp opengl/qopenglversionfunctionsfactory_p.h opengl/qopenglversionfunctionsfactory.cpp opengl/qopenglversionfunctionsfactory_p.h
opengl/qopenglvertexarrayobject.cpp opengl/qopenglvertexarrayobject.h opengl/qopenglvertexarrayobject.cpp opengl/qopenglvertexarrayobject.h

View File

@ -9,7 +9,6 @@ qtConfig(opengl) {
opengl/qopengl_p.h \ opengl/qopengl_p.h \
opengl/qopenglfunctions.h \ opengl/qopenglfunctions.h \
opengl/qopenglbuffer.h \ opengl/qopenglbuffer.h \
opengl/qopenglshaderprogram.h \
opengl/qopenglextensions_p.h \ opengl/qopenglextensions_p.h \
opengl/qopenglversionfunctions.h \ opengl/qopenglversionfunctions.h \
opengl/qopenglversionfunctionsfactory_p.h \ opengl/qopenglversionfunctionsfactory_p.h \
@ -20,7 +19,6 @@ qtConfig(opengl) {
SOURCES += opengl/qopengl.cpp \ SOURCES += opengl/qopengl.cpp \
opengl/qopenglfunctions.cpp \ opengl/qopenglfunctions.cpp \
opengl/qopenglbuffer.cpp \ opengl/qopenglbuffer.cpp \
opengl/qopenglshaderprogram.cpp \
opengl/qopenglversionfunctions.cpp \ opengl/qopenglversionfunctions.cpp \
opengl/qopenglversionfunctionsfactory.cpp \ opengl/qopenglversionfunctionsfactory.cpp \
opengl/qopenglvertexarrayobject.cpp \ opengl/qopenglvertexarrayobject.cpp \

View File

@ -45,7 +45,6 @@
#include <QDir> #include <QDir>
#include <QSaveFile> #include <QSaveFile>
#include <QCoreApplication> #include <QCoreApplication>
#include <QLoggingCategory>
#include <QCryptographicHash> #include <QCryptographicHash>
#ifdef Q_OS_UNIX #ifdef Q_OS_UNIX

View File

@ -54,6 +54,7 @@
#include <QtGui/qtguiglobal.h> #include <QtGui/qtguiglobal.h>
#include <QtCore/qcache.h> #include <QtCore/qcache.h>
#include <QtCore/qmutex.h> #include <QtCore/qmutex.h>
#include <QtCore/QLoggingCategory>
#include <QtGui/private/qopenglcontext_p.h> #include <QtGui/private/qopenglcontext_p.h>
#include <QtGui/private/qshader_p.h> #include <QtGui/private/qshader_p.h>
@ -63,10 +64,12 @@ QT_BEGIN_NAMESPACE
// therefore stay independent from QOpenGLShader(Program). Must rely only on // therefore stay independent from QOpenGLShader(Program). Must rely only on
// QOpenGLContext/Functions. // QOpenGLContext/Functions.
class QOpenGLProgramBinaryCache Q_GUI_EXPORT Q_DECLARE_LOGGING_CATEGORY(lcOpenGLProgramDiskCache)
class Q_GUI_EXPORT QOpenGLProgramBinaryCache
{ {
public: public:
struct ShaderDesc { struct Q_GUI_EXPORT ShaderDesc {
ShaderDesc() { } ShaderDesc() { }
ShaderDesc(QShader::Stage stage, const QByteArray &source = QByteArray()) ShaderDesc(QShader::Stage stage, const QByteArray &source = QByteArray())
: stage(stage), source(source) : stage(stage), source(source)
@ -74,7 +77,7 @@ public:
QShader::Stage stage; QShader::Stage stage;
QByteArray source; QByteArray source;
}; };
struct ProgramDesc { struct Q_GUI_EXPORT ProgramDesc {
QVector<ShaderDesc> shaders; QVector<ShaderDesc> shaders;
QByteArray cacheKey() const; QByteArray cacheKey() const;
}; };
@ -114,7 +117,7 @@ private:
// per-context basis, not just once per process. QOpenGLSharedResource enables this, // per-context basis, not just once per process. QOpenGLSharedResource enables this,
// although it's once-per-sharing-context-group, not per-context. Still, this should // although it's once-per-sharing-context-group, not per-context. Still, this should
// be good enough in practice. // be good enough in practice.
class QOpenGLProgramBinarySupportCheck : public QOpenGLSharedResource class Q_GUI_EXPORT QOpenGLProgramBinarySupportCheck : public QOpenGLSharedResource
{ {
public: public:
QOpenGLProgramBinarySupportCheck(QOpenGLContext *context); QOpenGLProgramBinarySupportCheck(QOpenGLContext *context);

View File

@ -289,8 +289,6 @@ QT_BEGIN_NAMESPACE
#define GL_MAP_READ_BIT 0x0001 #define GL_MAP_READ_BIT 0x0001
#endif #endif
Q_DECLARE_LOGGING_CATEGORY(lcOpenGLProgramDiskCache)
/*! /*!
Constructs a new QRhiGles2InitParams. Constructs a new QRhiGles2InitParams.

View File

@ -17,6 +17,7 @@ qt_add_module(OpenGL
qopenglpaintengine.cpp qopenglpaintengine_p.h qopenglpaintengine.cpp qopenglpaintengine_p.h
qopenglpixeltransferoptions.cpp qopenglpixeltransferoptions.h qopenglpixeltransferoptions.cpp qopenglpixeltransferoptions.h
qopenglshadercache_p.h qopenglshadercache_p.h
qopenglshaderprogram.cpp qopenglshaderprogram.h
qopengltexture.cpp qopengltexture.h qopengltexture_p.h qopengltexture.cpp qopengltexture.h qopengltexture_p.h
qopengltextureblitter.cpp qopengltextureblitter.h qopengltextureblitter.cpp qopengltextureblitter.h
qopengltexturecache.cpp qopengltexturecache_p.h qopengltexturecache.cpp qopengltexturecache_p.h

View File

@ -22,6 +22,7 @@ HEADERS += \
qopenglpaintengine_p.h \ qopenglpaintengine_p.h \
qopenglpixeltransferoptions.h \ qopenglpixeltransferoptions.h \
qopenglshadercache_p.h \ qopenglshadercache_p.h \
qopenglshaderprogram.h \
qopengltexture.h \ qopengltexture.h \
qopengltexture_p.h \ qopengltexture_p.h \
qopengltexturehelper_p.h \ qopengltexturehelper_p.h \
@ -41,6 +42,7 @@ SOURCES += \
qopenglpaintdevice.cpp \ qopenglpaintdevice.cpp \
qopenglpaintengine.cpp \ qopenglpaintengine.cpp \
qopenglpixeltransferoptions.cpp \ qopenglpixeltransferoptions.cpp \
qopenglshaderprogram.cpp \
qopengltexture.cpp \ qopengltexture.cpp \
qopengltexturehelper.cpp \ qopengltexturehelper.cpp \
qopengltextureblitter.cpp \ qopengltextureblitter.cpp \

View File

@ -3,7 +3,7 @@
** Copyright (C) 2016 The Qt Company Ltd. ** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/ ** Contact: https://www.qt.io/licensing/
** **
** This file is part of the QtGui module of the Qt Toolkit. ** This file is part of the QtOpenGL module of the Qt Toolkit.
** **
** $QT_BEGIN_LICENSE:LGPL$ ** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage ** Commercial License Usage
@ -38,7 +38,6 @@
****************************************************************************/ ****************************************************************************/
#include "qopenglshaderprogram.h" #include "qopenglshaderprogram.h"
#include "qopenglprogrambinarycache_p.h"
#include "qopenglextrafunctions.h" #include "qopenglextrafunctions.h"
#include "private/qopenglcontext_p.h" #include "private/qopenglcontext_p.h"
#include <QtCore/private/qobject_p.h> #include <QtCore/private/qobject_p.h>
@ -47,6 +46,7 @@
#include <QtCore/qvarlengtharray.h> #include <QtCore/qvarlengtharray.h>
#include <QtCore/qvector.h> #include <QtCore/qvector.h>
#include <QtCore/qloggingcategory.h> #include <QtCore/qloggingcategory.h>
#include <QtGui/private/qopenglprogrambinarycache_p.h>
#include <QtGui/qtransform.h> #include <QtGui/qtransform.h>
#include <QtGui/QColor> #include <QtGui/QColor>
#include <QtGui/QSurfaceFormat> #include <QtGui/QSurfaceFormat>
@ -64,7 +64,7 @@ QT_BEGIN_NAMESPACE
\brief The QOpenGLShaderProgram class allows OpenGL shader programs to be linked and used. \brief The QOpenGLShaderProgram class allows OpenGL shader programs to be linked and used.
\since 5.0 \since 5.0
\ingroup painting-3D \ingroup painting-3D
\inmodule QtGui \inmodule QtOpenGL
\section1 Introduction \section1 Introduction
@ -150,7 +150,7 @@ QT_BEGIN_NAMESPACE
\brief The QOpenGLShader class allows OpenGL shaders to be compiled. \brief The QOpenGLShader class allows OpenGL shaders to be compiled.
\since 5.0 \since 5.0
\ingroup painting-3D \ingroup painting-3D
\inmodule QtGui \inmodule QtOpenGL
This class supports shaders written in the OpenGL Shading Language (GLSL) This class supports shaders written in the OpenGL Shading Language (GLSL)
and in the OpenGL/ES Shading Language (GLSL/ES). and in the OpenGL/ES Shading Language (GLSL/ES).
@ -177,8 +177,6 @@ QT_BEGIN_NAMESPACE
(requires OpenGL >= 4.3 or OpenGL ES >= 3.1). (requires OpenGL >= 4.3 or OpenGL ES >= 3.1).
*/ */
Q_DECLARE_LOGGING_CATEGORY(lcOpenGLProgramDiskCache)
// For GLES 3.1/3.2 // For GLES 3.1/3.2
#ifndef GL_GEOMETRY_SHADER #ifndef GL_GEOMETRY_SHADER
#define GL_GEOMETRY_SHADER 0x8DD9 #define GL_GEOMETRY_SHADER 0x8DD9

View File

@ -3,7 +3,7 @@
** Copyright (C) 2016 The Qt Company Ltd. ** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/ ** Contact: https://www.qt.io/licensing/
** **
** This file is part of the QtGui module of the Qt Toolkit. ** This file is part of the QtOpenGL module of the Qt Toolkit.
** **
** $QT_BEGIN_LICENSE:LGPL$ ** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage ** Commercial License Usage
@ -40,9 +40,7 @@
#ifndef QOPENGLSHADERPROGRAM_H #ifndef QOPENGLSHADERPROGRAM_H
#define QOPENGLSHADERPROGRAM_H #define QOPENGLSHADERPROGRAM_H
#include <QtGui/qtguiglobal.h> #include <QtOpenGL/qtopenglglobal.h>
#ifndef QT_NO_OPENGL
#include <QtGui/qopengl.h> #include <QtGui/qopengl.h>
#include <QtGui/qvector2d.h> #include <QtGui/qvector2d.h>
@ -57,7 +55,7 @@ class QOpenGLContext;
class QOpenGLShaderProgram; class QOpenGLShaderProgram;
class QOpenGLShaderPrivate; class QOpenGLShaderPrivate;
class Q_GUI_EXPORT QOpenGLShader : public QObject class Q_OPENGL_EXPORT QOpenGLShader : public QObject
{ {
Q_OBJECT Q_OBJECT
public: public:
@ -103,7 +101,7 @@ Q_DECLARE_OPERATORS_FOR_FLAGS(QOpenGLShader::ShaderType)
class QOpenGLShaderProgramPrivate; class QOpenGLShaderProgramPrivate;
class Q_GUI_EXPORT QOpenGLShaderProgram : public QObject class Q_OPENGL_EXPORT QOpenGLShaderProgram : public QObject
{ {
Q_OBJECT Q_OBJECT
public: public:
@ -313,6 +311,4 @@ private:
QT_END_NAMESPACE QT_END_NAMESPACE
#endif // QT_NO_OPENGL
#endif #endif

View File

@ -39,8 +39,8 @@
#include "qopengltextureblitter.h" #include "qopengltextureblitter.h"
#include <QtOpenGL/QOpenGLShaderProgram>
#include <QtGui/QOpenGLBuffer> #include <QtGui/QOpenGLBuffer>
#include <QtGui/QOpenGLShaderProgram>
#include <QtGui/QOpenGLVertexArrayObject> #include <QtGui/QOpenGLVertexArrayObject>
#include <QtGui/QOpenGLContext> #include <QtGui/QOpenGLContext>
#include <QtGui/QOpenGLFunctions> #include <QtGui/QOpenGLFunctions>

View File

@ -54,9 +54,9 @@
#include "qeglfsglobal_p.h" #include "qeglfsglobal_p.h"
#include <qpa/qplatformcursor.h> #include <qpa/qplatformcursor.h>
#include <qpa/qplatformscreen.h> #include <qpa/qplatformscreen.h>
#include <QtOpenGL/QOpenGLShaderProgram>
#include <QtGui/QMatrix4x4> #include <QtGui/QMatrix4x4>
#include <QtGui/QOpenGLFunctions> #include <QtGui/QOpenGLFunctions>
#include <QtGui/QOpenGLShaderProgram>
#include <QtGui/private/qinputdevicemanager_p.h> #include <QtGui/private/qinputdevicemanager_p.h>
#include <QtCore/qvector.h> #include <QtCore/qvector.h>