summaryrefslogtreecommitdiffstats
path: root/src/opengl/qopengltextureuploader.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/opengl/qopengltextureuploader.cpp')
-rw-r--r--src/opengl/qopengltextureuploader.cpp79
1 files changed, 41 insertions, 38 deletions
diff --git a/src/opengl/qopengltextureuploader.cpp b/src/opengl/qopengltextureuploader.cpp
index 469ddc56c1..3dca0a439a 100644
--- a/src/opengl/qopengltextureuploader.cpp
+++ b/src/opengl/qopengltextureuploader.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtOpenGL module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2018 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qopengltextureuploader_p.h"
@@ -45,6 +9,10 @@
#include <private/qopenglcontext_p.h>
#include <private/qopenglextensions_p.h>
+#ifndef GL_HALF_FLOAT
+#define GL_HALF_FLOAT 0x140B
+#endif
+
#ifndef GL_RED
#define GL_RED 0x1903
#endif
@@ -81,6 +49,14 @@
#define GL_UNSIGNED_INT_2_10_10_10_REV 0x8368
#endif
+#ifndef GL_RGBA16F
+#define GL_RGBA16F 0x881A
+#endif
+
+#ifndef GL_RGBA32F
+#define GL_RGBA32F 0x8814
+#endif
+
#ifndef GL_TEXTURE_SWIZZLE_R
#define GL_TEXTURE_SWIZZLE_R 0x8E42
#endif
@@ -236,6 +212,25 @@ qsizetype QOpenGLTextureUploader::textureImage(GLenum target, const QImage &imag
pixelType = GL_UNSIGNED_SHORT;
targetFormat = image.format();
break;
+ case QImage::Format_RGBX16FPx4:
+ case QImage::Format_RGBA16FPx4:
+ case QImage::Format_RGBA16FPx4_Premultiplied:
+ if (context->format().majorVersion() >= 3) {
+ externalFormat = GL_RGBA;
+ internalFormat = GL_RGBA16F;
+ pixelType = GL_HALF_FLOAT;
+ targetFormat = image.format();
+ }
+ break;
+ case QImage::Format_RGBX32FPx4:
+ case QImage::Format_RGBA32FPx4:
+ case QImage::Format_RGBA32FPx4_Premultiplied:
+ externalFormat = internalFormat = GL_RGBA;
+ if (context->format().majorVersion() >= 3)
+ internalFormat = GL_RGBA32F;
+ pixelType = GL_FLOAT;
+ targetFormat = image.format();
+ break;
case QImage::Format_Indexed8:
if (sRgbBinding) {
// Always needs conversion
@@ -333,6 +328,10 @@ qsizetype QOpenGLTextureUploader::textureImage(GLenum target, const QImage &imag
targetFormat = QImage::Format_RGBA8888_Premultiplied;
else if (targetFormat == QImage::Format_RGBA64)
targetFormat = QImage::Format_RGBA64_Premultiplied;
+ else if (targetFormat == QImage::Format_RGBA16FPx4)
+ targetFormat = QImage::Format_RGBA16FPx4_Premultiplied;
+ else if (targetFormat == QImage::Format_RGBA32FPx4)
+ targetFormat = QImage::Format_RGBA32FPx4_Premultiplied;
} else {
if (targetFormat == QImage::Format_ARGB32_Premultiplied)
targetFormat = QImage::Format_ARGB32;
@@ -340,6 +339,10 @@ qsizetype QOpenGLTextureUploader::textureImage(GLenum target, const QImage &imag
targetFormat = QImage::Format_RGBA8888;
else if (targetFormat == QImage::Format_RGBA64_Premultiplied)
targetFormat = QImage::Format_RGBA64;
+ else if (targetFormat == QImage::Format_RGBA16FPx4_Premultiplied)
+ targetFormat = QImage::Format_RGBA16FPx4;
+ else if (targetFormat == QImage::Format_RGBA32FPx4_Premultiplied)
+ targetFormat = QImage::Format_RGBA32FPx4;
}
if (sRgbBinding) {