diff options
Diffstat (limited to 'src/gui/opengl')
-rw-r--r-- | src/gui/opengl/qopengl.cpp | 11 | ||||
-rw-r--r-- | src/gui/opengl/qopenglcustomshaderstage_p.h | 2 | ||||
-rw-r--r-- | src/gui/opengl/qopenglext.h | 11 | ||||
-rw-r--r-- | src/gui/opengl/qopenglfunctions.h | 18 | ||||
-rw-r--r-- | src/gui/opengl/qopenglpaintdevice.h | 2 | ||||
-rw-r--r-- | src/gui/opengl/qopenglpaintengine.cpp | 5 | ||||
-rw-r--r-- | src/gui/opengl/qopenglpaintengine_p.h | 2 | ||||
-rw-r--r-- | src/gui/opengl/qopenglshaderprogram.h | 11 | ||||
-rw-r--r-- | src/gui/opengl/qopengltextureuploader.cpp | 28 | ||||
-rw-r--r-- | src/gui/opengl/qopengltextureuploader_p.h | 2 | ||||
-rw-r--r-- | src/gui/opengl/qopenglversionfunctions.h | 1 |
11 files changed, 42 insertions, 51 deletions
diff --git a/src/gui/opengl/qopengl.cpp b/src/gui/opengl/qopengl.cpp index 3a476978e7..e961c42a25 100644 --- a/src/gui/opengl/qopengl.cpp +++ b/src/gui/opengl/qopengl.cpp @@ -54,8 +54,6 @@ #include <QtCore/QFile> #include <QtCore/QDir> -#include <set> - QT_BEGIN_NAMESPACE #if defined(QT_OPENGL_3) @@ -527,13 +525,4 @@ QOpenGLConfig::Gpu QOpenGLConfig::Gpu::fromContext() return gpu; } -Q_GUI_EXPORT std::set<QByteArray> *qgpu_features(const QString &filename) -{ - const QSet<QString> features = QOpenGLConfig::gpuFeatures(QOpenGLConfig::Gpu::fromContext(), filename); - std::set<QByteArray> *result = new std::set<QByteArray>; - for (const QString &feature : features) - result->insert(feature.toUtf8()); - return result; -} - QT_END_NAMESPACE diff --git a/src/gui/opengl/qopenglcustomshaderstage_p.h b/src/gui/opengl/qopenglcustomshaderstage_p.h index f4a71af88e..ce3e9efd23 100644 --- a/src/gui/opengl/qopenglcustomshaderstage_p.h +++ b/src/gui/opengl/qopenglcustomshaderstage_p.h @@ -80,7 +80,7 @@ protected: private: QOpenGLCustomShaderStagePrivate* d_ptr; - Q_DISABLE_COPY(QOpenGLCustomShaderStage) + Q_DISABLE_COPY_MOVE(QOpenGLCustomShaderStage) }; diff --git a/src/gui/opengl/qopenglext.h b/src/gui/opengl/qopenglext.h index 856adb679e..63873476e4 100644 --- a/src/gui/opengl/qopenglext.h +++ b/src/gui/opengl/qopenglext.h @@ -468,9 +468,14 @@ GLAPI void APIENTRY glBlendEquation (GLenum mode); #ifndef GL_VERSION_1_5 #define GL_VERSION_1_5 1 -#include <stddef.h> -typedef ptrdiff_t GLsizeiptr; -typedef ptrdiff_t GLintptr; +#ifdef _WIN64 +typedef signed long long int GLsizeiptr; +typedef signed long long int GLintptr; +#else +typedef signed long int GLsizeiptr; +typedef signed long int GLintptr; +#endif + #define GL_BUFFER_SIZE 0x8764 #define GL_BUFFER_USAGE 0x8765 #define GL_QUERY_COUNTER_BITS 0x8864 diff --git a/src/gui/opengl/qopenglfunctions.h b/src/gui/opengl/qopenglfunctions.h index 00287b0665..4554291bbd 100644 --- a/src/gui/opengl/qopenglfunctions.h +++ b/src/gui/opengl/qopenglfunctions.h @@ -228,26 +228,8 @@ struct QOpenGLFunctionsPrivate; #undef glTexLevelParameteriv #if defined(Q_CLANG_QDOC) -#undef GLint -typedef int GLint; -#undef GLsizei -typedef int GLsizei; -#undef GLuint -typedef unsigned int GLuint; -#undef GLubyte -typedef unsigned int GLubyte; -#undef GLenum -typedef unsigned int GLenum; #undef GLbitfield typedef unsigned int GLbitfield; -#undef GLfloat -typedef float GLfloat; -#undef GLclampf -typedef float GLclampf; -#undef GLboolean -typedef bool GLboolean; -#undef GLvoid -typedef void GLvoid; #undef GLchar typedef char GLchar; #endif diff --git a/src/gui/opengl/qopenglpaintdevice.h b/src/gui/opengl/qopenglpaintdevice.h index 300002a9c1..54118f2926 100644 --- a/src/gui/opengl/qopenglpaintdevice.h +++ b/src/gui/opengl/qopenglpaintdevice.h @@ -59,7 +59,7 @@ public: QOpenGLPaintDevice(); explicit QOpenGLPaintDevice(const QSize &size); QOpenGLPaintDevice(int width, int height); - virtual ~QOpenGLPaintDevice(); + ~QOpenGLPaintDevice(); int devType() const override { return QInternal::OpenGL; } QPaintEngine *paintEngine() const override; diff --git a/src/gui/opengl/qopenglpaintengine.cpp b/src/gui/opengl/qopenglpaintengine.cpp index 001cb839fa..042b9ebd79 100644 --- a/src/gui/opengl/qopenglpaintengine.cpp +++ b/src/gui/opengl/qopenglpaintengine.cpp @@ -1574,14 +1574,15 @@ void QOpenGL2PaintEngineEx::drawImage(const QRectF& dest, const QImage& image, c case QImage::Format_Alpha8: if (ctx->functions()->hasOpenGLFeature(QOpenGLFunctions::TextureRGFormats)) { d->shaderManager->setSrcPixelType(QOpenGLEngineShaderManager::AlphaImageSrc); - bindOption = QOpenGLTextureUploader::UseRedFor8BitBindOption; + bindOption = QOpenGLTextureUploader::UseRedForAlphaAndLuminanceBindOption; } else d->shaderManager->setSrcPixelType(QOpenGLEngineShaderManager::ImageSrc); break; case QImage::Format_Grayscale8: + case QImage::Format_Grayscale16: if (ctx->functions()->hasOpenGLFeature(QOpenGLFunctions::TextureRGFormats)) { d->shaderManager->setSrcPixelType(QOpenGLEngineShaderManager::GrayscaleImageSrc); - bindOption = QOpenGLTextureUploader::UseRedFor8BitBindOption; + bindOption = QOpenGLTextureUploader::UseRedForAlphaAndLuminanceBindOption; } else d->shaderManager->setSrcPixelType(QOpenGLEngineShaderManager::ImageSrc); break; diff --git a/src/gui/opengl/qopenglpaintengine_p.h b/src/gui/opengl/qopenglpaintengine_p.h index 0541ce6168..15ac240b89 100644 --- a/src/gui/opengl/qopenglpaintengine_p.h +++ b/src/gui/opengl/qopenglpaintengine_p.h @@ -166,7 +166,7 @@ public: bool shouldDrawCachedGlyphs(QFontEngine *, const QTransform &) const override; private: - Q_DISABLE_COPY(QOpenGL2PaintEngineEx) + Q_DISABLE_COPY_MOVE(QOpenGL2PaintEngineEx) friend class QOpenGLEngineShaderManager; }; diff --git a/src/gui/opengl/qopenglshaderprogram.h b/src/gui/opengl/qopenglshaderprogram.h index 84eb8d6956..c79101fd4d 100644 --- a/src/gui/opengl/qopenglshaderprogram.h +++ b/src/gui/opengl/qopenglshaderprogram.h @@ -50,13 +50,6 @@ #include <QtGui/qvector4d.h> #include <QtGui/qmatrix4x4.h> -#if defined(Q_CLANG_QDOC) -#undef GLint -typedef int GLint; -#undef GLfloat -typedef double GLfloat; -#endif - QT_BEGIN_NAMESPACE @@ -80,7 +73,7 @@ public: Q_DECLARE_FLAGS(ShaderType, ShaderTypeBit) explicit QOpenGLShader(QOpenGLShader::ShaderType type, QObject *parent = nullptr); - virtual ~QOpenGLShader(); + ~QOpenGLShader(); QOpenGLShader::ShaderType shaderType() const; @@ -115,7 +108,7 @@ class Q_GUI_EXPORT QOpenGLShaderProgram : public QObject Q_OBJECT public: explicit QOpenGLShaderProgram(QObject *parent = nullptr); - virtual ~QOpenGLShaderProgram(); + ~QOpenGLShaderProgram(); bool addShader(QOpenGLShader *shader); void removeShader(QOpenGLShader *shader); diff --git a/src/gui/opengl/qopengltextureuploader.cpp b/src/gui/opengl/qopengltextureuploader.cpp index 42e309b733..90253546c8 100644 --- a/src/gui/opengl/qopengltextureuploader.cpp +++ b/src/gui/opengl/qopengltextureuploader.cpp @@ -104,7 +104,7 @@ qsizetype QOpenGLTextureUploader::textureImage(GLenum target, const QImage &imag const bool isOpenGLES3orBetter = context->isOpenGLES() && context->format().majorVersion() >= 3; const bool sRgbBinding = (options & SRgbBindOption); Q_ASSERT(isOpenGL12orBetter || context->isOpenGLES()); - Q_ASSERT((options & (SRgbBindOption | UseRedFor8BitBindOption)) != (SRgbBindOption | UseRedFor8BitBindOption)); + Q_ASSERT((options & (SRgbBindOption | UseRedForAlphaAndLuminanceBindOption)) != (SRgbBindOption | UseRedForAlphaAndLuminanceBindOption)); switch (image.format()) { case QImage::Format_RGB32: @@ -213,7 +213,7 @@ qsizetype QOpenGLTextureUploader::textureImage(GLenum target, const QImage &imag if (sRgbBinding) { // Always needs conversion break; - } else if (options & UseRedFor8BitBindOption) { + } else if (options & UseRedForAlphaAndLuminanceBindOption) { externalFormat = internalFormat = GL_RED; pixelType = GL_UNSIGNED_BYTE; targetFormat = image.format(); @@ -223,7 +223,7 @@ qsizetype QOpenGLTextureUploader::textureImage(GLenum target, const QImage &imag if (sRgbBinding) { // Always needs conversion break; - } else if (options & UseRedFor8BitBindOption) { + } else if (options & UseRedForAlphaAndLuminanceBindOption) { externalFormat = internalFormat = GL_RED; pixelType = GL_UNSIGNED_BYTE; targetFormat = image.format(); @@ -243,7 +243,7 @@ qsizetype QOpenGLTextureUploader::textureImage(GLenum target, const QImage &imag if (sRgbBinding) { // Always needs conversion break; - } else if (options & UseRedFor8BitBindOption) { + } else if (options & UseRedForAlphaAndLuminanceBindOption) { externalFormat = internalFormat = GL_RED; pixelType = GL_UNSIGNED_BYTE; targetFormat = image.format(); @@ -259,6 +259,26 @@ qsizetype QOpenGLTextureUploader::textureImage(GLenum target, const QImage &imag targetFormat = image.format(); } break; + case QImage::Format_Grayscale16: + if (sRgbBinding) { + // Always needs conversion + break; + } else if (options & UseRedForAlphaAndLuminanceBindOption) { + externalFormat = internalFormat = GL_RED; + pixelType = GL_UNSIGNED_SHORT; + targetFormat = image.format(); + } else if (context->isOpenGLES() || context->format().profile() != QSurfaceFormat::CoreProfile) { + externalFormat = internalFormat = GL_LUMINANCE; + pixelType = GL_UNSIGNED_SHORT; + targetFormat = image.format(); + } else if (funcs->hasOpenGLExtension(QOpenGLExtensions::TextureSwizzle)) { + GLint swizzle[4] = { GL_RED, GL_RED, GL_RED, GL_ONE }; + funcs->glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_RGBA, swizzle); + externalFormat = internalFormat = GL_RED; + pixelType = GL_UNSIGNED_SHORT; + targetFormat = image.format(); + } + break; default: break; } diff --git a/src/gui/opengl/qopengltextureuploader_p.h b/src/gui/opengl/qopengltextureuploader_p.h index d758b3787b..0dcf709d7e 100644 --- a/src/gui/opengl/qopengltextureuploader_p.h +++ b/src/gui/opengl/qopengltextureuploader_p.h @@ -65,7 +65,7 @@ public: enum BindOption { NoBindOption = 0x0000, PremultipliedAlphaBindOption = 0x0001, - UseRedFor8BitBindOption = 0x0002, + UseRedForAlphaAndLuminanceBindOption = 0x0002, SRgbBindOption = 0x0004, PowerOfTwoBindOption = 0x0008 }; diff --git a/src/gui/opengl/qopenglversionfunctions.h b/src/gui/opengl/qopenglversionfunctions.h index 3af1ed0466..f828e5668b 100644 --- a/src/gui/opengl/qopenglversionfunctions.h +++ b/src/gui/opengl/qopenglversionfunctions.h @@ -214,6 +214,7 @@ public: virtual bool initializeOpenGLFunctions(); + Q_DISABLE_COPY(QAbstractOpenGLFunctions) Q_DECLARE_PRIVATE(QAbstractOpenGLFunctions) protected: |