| Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/gui/opengl/qopengltexture.cpp |
| Source code | Switch to Preprocessed file |
| Line | Source | Count | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | /**************************************************************************** | - | ||||||||||||||||||
| 2 | ** | - | ||||||||||||||||||
| 3 | ** Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB). | - | ||||||||||||||||||
| 4 | ** Contact: http://www.qt.io/licensing/ | - | ||||||||||||||||||
| 5 | ** | - | ||||||||||||||||||
| 6 | ** This file is part of the QtGui module of the Qt Toolkit. | - | ||||||||||||||||||
| 7 | ** | - | ||||||||||||||||||
| 8 | ** $QT_BEGIN_LICENSE:LGPL21$ | - | ||||||||||||||||||
| 9 | ** Commercial License Usage | - | ||||||||||||||||||
| 10 | ** Licensees holding valid commercial Qt licenses may use this file in | - | ||||||||||||||||||
| 11 | ** accordance with the commercial license agreement provided with the | - | ||||||||||||||||||
| 12 | ** Software or, alternatively, in accordance with the terms contained in | - | ||||||||||||||||||
| 13 | ** a written agreement between you and The Qt Company. For licensing terms | - | ||||||||||||||||||
| 14 | ** and conditions see http://www.qt.io/terms-conditions. For further | - | ||||||||||||||||||
| 15 | ** information use the contact form at http://www.qt.io/contact-us. | - | ||||||||||||||||||
| 16 | ** | - | ||||||||||||||||||
| 17 | ** GNU Lesser General Public License Usage | - | ||||||||||||||||||
| 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser | - | ||||||||||||||||||
| 19 | ** General Public License version 2.1 or version 3 as published by the Free | - | ||||||||||||||||||
| 20 | ** Software Foundation and appearing in the file LICENSE.LGPLv21 and | - | ||||||||||||||||||
| 21 | ** LICENSE.LGPLv3 included in the packaging of this file. Please review the | - | ||||||||||||||||||
| 22 | ** following information to ensure the GNU Lesser General Public License | - | ||||||||||||||||||
| 23 | ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and | - | ||||||||||||||||||
| 24 | ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. | - | ||||||||||||||||||
| 25 | ** | - | ||||||||||||||||||
| 26 | ** As a special exception, The Qt Company gives you certain additional | - | ||||||||||||||||||
| 27 | ** rights. These rights are described in The Qt Company LGPL Exception | - | ||||||||||||||||||
| 28 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. | - | ||||||||||||||||||
| 29 | ** | - | ||||||||||||||||||
| 30 | ** $QT_END_LICENSE$ | - | ||||||||||||||||||
| 31 | ** | - | ||||||||||||||||||
| 32 | ****************************************************************************/ | - | ||||||||||||||||||
| 33 | - | |||||||||||||||||||
| 34 | #include "qopengltexture.h" | - | ||||||||||||||||||
| 35 | #include "qopengltexture_p.h" | - | ||||||||||||||||||
| 36 | #include "qopengltexturehelper_p.h" | - | ||||||||||||||||||
| 37 | #include "qopenglfunctions.h" | - | ||||||||||||||||||
| 38 | #include <QtGui/qcolor.h> | - | ||||||||||||||||||
| 39 | #include <QtGui/qopenglcontext.h> | - | ||||||||||||||||||
| 40 | #include <private/qobject_p.h> | - | ||||||||||||||||||
| 41 | #include <private/qopenglcontext_p.h> | - | ||||||||||||||||||
| 42 | - | |||||||||||||||||||
| 43 | QT_BEGIN_NAMESPACE | - | ||||||||||||||||||
| 44 | - | |||||||||||||||||||
| 45 | //this is to work around GL_TEXTURE_WRAP_R_OES which also has 0x8072 as value | - | ||||||||||||||||||
| 46 | #if !defined(GL_TEXTURE_WRAP_R) | - | ||||||||||||||||||
| 47 | #define GL_TEXTURE_WRAP_R 0x8072 | - | ||||||||||||||||||
| 48 | #endif | - | ||||||||||||||||||
| 49 | - | |||||||||||||||||||
| 50 | QOpenGLTexturePrivate::QOpenGLTexturePrivate(QOpenGLTexture::Target textureTarget, | - | ||||||||||||||||||
| 51 | QOpenGLTexture *qq) | - | ||||||||||||||||||
| 52 | : q_ptr(qq), | - | ||||||||||||||||||
| 53 | context(0), | - | ||||||||||||||||||
| 54 | target(textureTarget), | - | ||||||||||||||||||
| 55 | textureId(0), | - | ||||||||||||||||||
| 56 | format(QOpenGLTexture::NoFormat), | - | ||||||||||||||||||
| 57 | formatClass(QOpenGLTexture::NoFormatClass), | - | ||||||||||||||||||
| 58 | requestedMipLevels(1), | - | ||||||||||||||||||
| 59 | mipLevels(-1), | - | ||||||||||||||||||
| 60 | layers(1), | - | ||||||||||||||||||
| 61 | faces(1), | - | ||||||||||||||||||
| 62 | samples(0), | - | ||||||||||||||||||
| 63 | fixedSamplePositions(true), | - | ||||||||||||||||||
| 64 | baseLevel(0), | - | ||||||||||||||||||
| 65 | maxLevel(1000), | - | ||||||||||||||||||
| 66 | depthStencilMode(QOpenGLTexture::DepthMode), | - | ||||||||||||||||||
| 67 | comparisonFunction(QOpenGLTexture::CompareLessEqual), | - | ||||||||||||||||||
| 68 | comparisonMode(QOpenGLTexture::CompareNone), | - | ||||||||||||||||||
| 69 | minFilter(QOpenGLTexture::Nearest), | - | ||||||||||||||||||
| 70 | magFilter(QOpenGLTexture::Nearest), | - | ||||||||||||||||||
| 71 | maxAnisotropy(1.0f), | - | ||||||||||||||||||
| 72 | minLevelOfDetail(-1000.0f), | - | ||||||||||||||||||
| 73 | maxLevelOfDetail(1000.0f), | - | ||||||||||||||||||
| 74 | levelOfDetailBias(0.0f), | - | ||||||||||||||||||
| 75 | textureView(false), | - | ||||||||||||||||||
| 76 | autoGenerateMipMaps(true), | - | ||||||||||||||||||
| 77 | storageAllocated(false), | - | ||||||||||||||||||
| 78 | texFuncs(0) | - | ||||||||||||||||||
| 79 | { | - | ||||||||||||||||||
| 80 | dimensions[0] = dimensions[1] = dimensions[2] = 1; | - | ||||||||||||||||||
| 81 | - | |||||||||||||||||||
| 82 | switch (target) { | - | ||||||||||||||||||
| 83 | case QOpenGLTexture::Target1D: never executed: case QOpenGLTexture::Target1D: | 0 | ||||||||||||||||||
| 84 | bindingTarget = QOpenGLTexture::BindingTarget1D; | - | ||||||||||||||||||
| 85 | break; never executed: break; | 0 | ||||||||||||||||||
| 86 | case QOpenGLTexture::Target1DArray: never executed: case QOpenGLTexture::Target1DArray: | 0 | ||||||||||||||||||
| 87 | bindingTarget = QOpenGLTexture::BindingTarget1DArray; | - | ||||||||||||||||||
| 88 | break; never executed: break; | 0 | ||||||||||||||||||
| 89 | case QOpenGLTexture::Target2D: never executed: case QOpenGLTexture::Target2D: | 0 | ||||||||||||||||||
| 90 | bindingTarget = QOpenGLTexture::BindingTarget2D; | - | ||||||||||||||||||
| 91 | break; never executed: break; | 0 | ||||||||||||||||||
| 92 | case QOpenGLTexture::Target2DArray: never executed: case QOpenGLTexture::Target2DArray: | 0 | ||||||||||||||||||
| 93 | bindingTarget = QOpenGLTexture::BindingTarget2DArray; | - | ||||||||||||||||||
| 94 | break; never executed: break; | 0 | ||||||||||||||||||
| 95 | case QOpenGLTexture::Target3D: never executed: case QOpenGLTexture::Target3D: | 0 | ||||||||||||||||||
| 96 | bindingTarget = QOpenGLTexture::BindingTarget3D; | - | ||||||||||||||||||
| 97 | break; never executed: break; | 0 | ||||||||||||||||||
| 98 | case QOpenGLTexture::TargetCubeMap: never executed: case QOpenGLTexture::TargetCubeMap: | 0 | ||||||||||||||||||
| 99 | bindingTarget = QOpenGLTexture::BindingTargetCubeMap; | - | ||||||||||||||||||
| 100 | faces = 6; | - | ||||||||||||||||||
| 101 | break; never executed: break; | 0 | ||||||||||||||||||
| 102 | case QOpenGLTexture::TargetCubeMapArray: never executed: case QOpenGLTexture::TargetCubeMapArray: | 0 | ||||||||||||||||||
| 103 | bindingTarget = QOpenGLTexture::BindingTargetCubeMapArray; | - | ||||||||||||||||||
| 104 | faces = 6; | - | ||||||||||||||||||
| 105 | break; never executed: break; | 0 | ||||||||||||||||||
| 106 | case QOpenGLTexture::Target2DMultisample: never executed: case QOpenGLTexture::Target2DMultisample: | 0 | ||||||||||||||||||
| 107 | bindingTarget = QOpenGLTexture::BindingTarget2DMultisample; | - | ||||||||||||||||||
| 108 | break; never executed: break; | 0 | ||||||||||||||||||
| 109 | case QOpenGLTexture::Target2DMultisampleArray: never executed: case QOpenGLTexture::Target2DMultisampleArray: | 0 | ||||||||||||||||||
| 110 | bindingTarget = QOpenGLTexture::BindingTarget2DMultisampleArray; | - | ||||||||||||||||||
| 111 | break; never executed: break; | 0 | ||||||||||||||||||
| 112 | case QOpenGLTexture::TargetRectangle: never executed: case QOpenGLTexture::TargetRectangle: | 0 | ||||||||||||||||||
| 113 | bindingTarget = QOpenGLTexture::BindingTargetRectangle; | - | ||||||||||||||||||
| 114 | break; never executed: break; | 0 | ||||||||||||||||||
| 115 | case QOpenGLTexture::TargetBuffer: never executed: case QOpenGLTexture::TargetBuffer: | 0 | ||||||||||||||||||
| 116 | bindingTarget = QOpenGLTexture::BindingTargetBuffer; | - | ||||||||||||||||||
| 117 | break; never executed: break; | 0 | ||||||||||||||||||
| 118 | } | - | ||||||||||||||||||
| 119 | - | |||||||||||||||||||
| 120 | swizzleMask[0] = QOpenGLTexture::RedValue; | - | ||||||||||||||||||
| 121 | swizzleMask[1] = QOpenGLTexture::GreenValue; | - | ||||||||||||||||||
| 122 | swizzleMask[2] = QOpenGLTexture::BlueValue; | - | ||||||||||||||||||
| 123 | swizzleMask[3] = QOpenGLTexture::AlphaValue; | - | ||||||||||||||||||
| 124 | - | |||||||||||||||||||
| 125 | wrapModes[0] = wrapModes[1] = wrapModes[2] = target == QOpenGLTexture::TargetRectangle
| 0 | ||||||||||||||||||
| 126 | ? QOpenGLTexture::ClampToEdge : QOpenGLTexture::Repeat; | - | ||||||||||||||||||
| 127 | } never executed: end of block | 0 | ||||||||||||||||||
| 128 | - | |||||||||||||||||||
| 129 | QOpenGLTexturePrivate::~QOpenGLTexturePrivate() | - | ||||||||||||||||||
| 130 | { | - | ||||||||||||||||||
| 131 | destroy(); | - | ||||||||||||||||||
| 132 | } never executed: end of block | 0 | ||||||||||||||||||
| 133 | - | |||||||||||||||||||
| 134 | void QOpenGLTexturePrivate::initializeOpenGLFunctions() | - | ||||||||||||||||||
| 135 | { | - | ||||||||||||||||||
| 136 | // If we already have a functions object, there is nothing to do | - | ||||||||||||||||||
| 137 | if (texFuncs)
| 0 | ||||||||||||||||||
| 138 | return; never executed: return; | 0 | ||||||||||||||||||
| 139 | - | |||||||||||||||||||
| 140 | // See if the context already has a suitable resource we can use. | - | ||||||||||||||||||
| 141 | // If not create a functions object and add it to the context in case | - | ||||||||||||||||||
| 142 | // others wish to use it too | - | ||||||||||||||||||
| 143 | texFuncs = context->textureFunctions(); | - | ||||||||||||||||||
| 144 | if (!texFuncs) {
| 0 | ||||||||||||||||||
| 145 | texFuncs = new QOpenGLTextureHelper(context); | - | ||||||||||||||||||
| 146 | context->setTextureFunctions(texFuncs); | - | ||||||||||||||||||
| 147 | } never executed: end of block | 0 | ||||||||||||||||||
| 148 | } never executed: end of block | 0 | ||||||||||||||||||
| 149 | - | |||||||||||||||||||
| 150 | bool QOpenGLTexturePrivate::create() | - | ||||||||||||||||||
| 151 | { | - | ||||||||||||||||||
| 152 | if (textureId != 0)
| 0 | ||||||||||||||||||
| 153 | return true; never executed: return true; | 0 | ||||||||||||||||||
| 154 | - | |||||||||||||||||||
| 155 | QOpenGLContext *ctx = QOpenGLContext::currentContext(); | - | ||||||||||||||||||
| 156 | if (!ctx) {
| 0 | ||||||||||||||||||
| 157 | qWarning("Requires a valid current OpenGL context.\n" | - | ||||||||||||||||||
| 158 | "Texture has not been created"); | - | ||||||||||||||||||
| 159 | return false; never executed: return false; | 0 | ||||||||||||||||||
| 160 | } | - | ||||||||||||||||||
| 161 | context = ctx; | - | ||||||||||||||||||
| 162 | - | |||||||||||||||||||
| 163 | // Resolve any functions we will need based upon context version and create the texture | - | ||||||||||||||||||
| 164 | initializeOpenGLFunctions(); | - | ||||||||||||||||||
| 165 | - | |||||||||||||||||||
| 166 | // What features do we have? | - | ||||||||||||||||||
| 167 | QOpenGLTexture::Feature feature = QOpenGLTexture::ImmutableStorage; | - | ||||||||||||||||||
| 168 | while (feature != QOpenGLTexture::MaxFeatureFlag) {
| 0 | ||||||||||||||||||
| 169 | if (QOpenGLTexture::hasFeature(feature))
| 0 | ||||||||||||||||||
| 170 | features |= feature; never executed: features |= feature; | 0 | ||||||||||||||||||
| 171 | feature = static_cast<QOpenGLTexture::Feature>(feature << 1); | - | ||||||||||||||||||
| 172 | } never executed: end of block | 0 | ||||||||||||||||||
| 173 | - | |||||||||||||||||||
| 174 | texFuncs->glGenTextures(1, &textureId); | - | ||||||||||||||||||
| 175 | return textureId != 0; never executed: return textureId != 0; | 0 | ||||||||||||||||||
| 176 | } | - | ||||||||||||||||||
| 177 | - | |||||||||||||||||||
| 178 | void QOpenGLTexturePrivate::destroy() | - | ||||||||||||||||||
| 179 | { | - | ||||||||||||||||||
| 180 | if (!textureId) {
| 0 | ||||||||||||||||||
| 181 | // not created or already destroyed | - | ||||||||||||||||||
| 182 | return; never executed: return; | 0 | ||||||||||||||||||
| 183 | } | - | ||||||||||||||||||
| 184 | QOpenGLContext *currentContext = QOpenGLContext::currentContext(); | - | ||||||||||||||||||
| 185 | if (!currentContext || !QOpenGLContext::areSharing(currentContext, context)) {
| 0 | ||||||||||||||||||
| 186 | qWarning("Texture is not valid in the current context.\n" | - | ||||||||||||||||||
| 187 | "Texture has not been destroyed"); | - | ||||||||||||||||||
| 188 | return; never executed: return; | 0 | ||||||||||||||||||
| 189 | } | - | ||||||||||||||||||
| 190 | - | |||||||||||||||||||
| 191 | texFuncs->glDeleteTextures(1, &textureId); | - | ||||||||||||||||||
| 192 | - | |||||||||||||||||||
| 193 | context = 0; | - | ||||||||||||||||||
| 194 | textureId = 0; | - | ||||||||||||||||||
| 195 | format = QOpenGLTexture::NoFormat; | - | ||||||||||||||||||
| 196 | formatClass = QOpenGLTexture::NoFormatClass; | - | ||||||||||||||||||
| 197 | requestedMipLevels = 1; | - | ||||||||||||||||||
| 198 | mipLevels = -1; | - | ||||||||||||||||||
| 199 | layers = 1; | - | ||||||||||||||||||
| 200 | faces = 1; | - | ||||||||||||||||||
| 201 | samples = 0; | - | ||||||||||||||||||
| 202 | fixedSamplePositions = true, | - | ||||||||||||||||||
| 203 | baseLevel = 0; | - | ||||||||||||||||||
| 204 | maxLevel = 1000; | - | ||||||||||||||||||
| 205 | depthStencilMode = QOpenGLTexture::DepthMode; | - | ||||||||||||||||||
| 206 | minFilter = QOpenGLTexture::Nearest; | - | ||||||||||||||||||
| 207 | magFilter = QOpenGLTexture::Nearest; | - | ||||||||||||||||||
| 208 | maxAnisotropy = 1.0f; | - | ||||||||||||||||||
| 209 | minLevelOfDetail = -1000.0f; | - | ||||||||||||||||||
| 210 | maxLevelOfDetail = 1000.0f; | - | ||||||||||||||||||
| 211 | levelOfDetailBias = 0.0f; | - | ||||||||||||||||||
| 212 | textureView = false; | - | ||||||||||||||||||
| 213 | autoGenerateMipMaps = true; | - | ||||||||||||||||||
| 214 | storageAllocated = false; | - | ||||||||||||||||||
| 215 | texFuncs = 0; | - | ||||||||||||||||||
| 216 | - | |||||||||||||||||||
| 217 | swizzleMask[0] = QOpenGLTexture::RedValue; | - | ||||||||||||||||||
| 218 | swizzleMask[1] = QOpenGLTexture::GreenValue; | - | ||||||||||||||||||
| 219 | swizzleMask[2] = QOpenGLTexture::BlueValue; | - | ||||||||||||||||||
| 220 | swizzleMask[3] = QOpenGLTexture::AlphaValue; | - | ||||||||||||||||||
| 221 | - | |||||||||||||||||||
| 222 | wrapModes[0] = wrapModes[1] = wrapModes[2] = target == QOpenGLTexture::TargetRectangle
| 0 | ||||||||||||||||||
| 223 | ? QOpenGLTexture::ClampToEdge : QOpenGLTexture::Repeat; | - | ||||||||||||||||||
| 224 | } never executed: end of block | 0 | ||||||||||||||||||
| 225 | - | |||||||||||||||||||
| 226 | void QOpenGLTexturePrivate::bind() | - | ||||||||||||||||||
| 227 | { | - | ||||||||||||||||||
| 228 | texFuncs->glBindTexture(target, textureId); | - | ||||||||||||||||||
| 229 | } never executed: end of block | 0 | ||||||||||||||||||
| 230 | - | |||||||||||||||||||
| 231 | void QOpenGLTexturePrivate::bind(uint unit, QOpenGLTexture::TextureUnitReset reset) | - | ||||||||||||||||||
| 232 | { | - | ||||||||||||||||||
| 233 | GLint oldTextureUnit = 0; | - | ||||||||||||||||||
| 234 | if (reset == QOpenGLTexture::ResetTextureUnit)
| 0 | ||||||||||||||||||
| 235 | texFuncs->glGetIntegerv(GL_ACTIVE_TEXTURE, &oldTextureUnit); never executed: texFuncs->glGetIntegerv(0x84E0, &oldTextureUnit); | 0 | ||||||||||||||||||
| 236 | - | |||||||||||||||||||
| 237 | texFuncs->glActiveTexture(GL_TEXTURE0 + unit); | - | ||||||||||||||||||
| 238 | texFuncs->glBindTexture(target, textureId); | - | ||||||||||||||||||
| 239 | - | |||||||||||||||||||
| 240 | if (reset == QOpenGLTexture::ResetTextureUnit)
| 0 | ||||||||||||||||||
| 241 | texFuncs->glActiveTexture(GL_TEXTURE0 + oldTextureUnit); never executed: texFuncs->glActiveTexture(0x84C0 + oldTextureUnit); | 0 | ||||||||||||||||||
| 242 | } never executed: end of block | 0 | ||||||||||||||||||
| 243 | - | |||||||||||||||||||
| 244 | void QOpenGLTexturePrivate::release() | - | ||||||||||||||||||
| 245 | { | - | ||||||||||||||||||
| 246 | texFuncs->glBindTexture(target, 0); | - | ||||||||||||||||||
| 247 | } never executed: end of block | 0 | ||||||||||||||||||
| 248 | - | |||||||||||||||||||
| 249 | void QOpenGLTexturePrivate::release(uint unit, QOpenGLTexture::TextureUnitReset reset) | - | ||||||||||||||||||
| 250 | { | - | ||||||||||||||||||
| 251 | GLint oldTextureUnit = 0; | - | ||||||||||||||||||
| 252 | if (reset == QOpenGLTexture::ResetTextureUnit)
| 0 | ||||||||||||||||||
| 253 | texFuncs->glGetIntegerv(GL_ACTIVE_TEXTURE, &oldTextureUnit); never executed: texFuncs->glGetIntegerv(0x84E0, &oldTextureUnit); | 0 | ||||||||||||||||||
| 254 | - | |||||||||||||||||||
| 255 | texFuncs->glActiveTexture(GL_TEXTURE0 + unit); | - | ||||||||||||||||||
| 256 | texFuncs->glBindTexture(target, 0); | - | ||||||||||||||||||
| 257 | - | |||||||||||||||||||
| 258 | if (reset == QOpenGLTexture::ResetTextureUnit)
| 0 | ||||||||||||||||||
| 259 | texFuncs->glActiveTexture(GL_TEXTURE0 + oldTextureUnit); never executed: texFuncs->glActiveTexture(0x84C0 + oldTextureUnit); | 0 | ||||||||||||||||||
| 260 | } never executed: end of block | 0 | ||||||||||||||||||
| 261 | - | |||||||||||||||||||
| 262 | bool QOpenGLTexturePrivate::isBound() const | - | ||||||||||||||||||
| 263 | { | - | ||||||||||||||||||
| 264 | GLint boundTextureId = 0; | - | ||||||||||||||||||
| 265 | texFuncs->glGetIntegerv(bindingTarget, &boundTextureId); | - | ||||||||||||||||||
| 266 | return (static_cast<GLuint>(boundTextureId) == textureId); never executed: return (static_cast<GLuint>(boundTextureId) == textureId); | 0 | ||||||||||||||||||
| 267 | } | - | ||||||||||||||||||
| 268 | - | |||||||||||||||||||
| 269 | bool QOpenGLTexturePrivate::isBound(uint unit) const | - | ||||||||||||||||||
| 270 | { | - | ||||||||||||||||||
| 271 | GLint oldTextureUnit = 0; | - | ||||||||||||||||||
| 272 | texFuncs->glGetIntegerv(GL_ACTIVE_TEXTURE, &oldTextureUnit); | - | ||||||||||||||||||
| 273 | - | |||||||||||||||||||
| 274 | GLint boundTextureId = 0; | - | ||||||||||||||||||
| 275 | texFuncs->glActiveTexture(GL_TEXTURE0 + unit); | - | ||||||||||||||||||
| 276 | texFuncs->glGetIntegerv(bindingTarget, &boundTextureId); | - | ||||||||||||||||||
| 277 | bool result = (static_cast<GLuint>(boundTextureId) == textureId); | - | ||||||||||||||||||
| 278 | - | |||||||||||||||||||
| 279 | texFuncs->glActiveTexture(GL_TEXTURE0 + oldTextureUnit); | - | ||||||||||||||||||
| 280 | return result; never executed: return result; | 0 | ||||||||||||||||||
| 281 | } | - | ||||||||||||||||||
| 282 | - | |||||||||||||||||||
| 283 | int QOpenGLTexturePrivate::evaluateMipLevels() const | - | ||||||||||||||||||
| 284 | { | - | ||||||||||||||||||
| 285 | switch (target) { | - | ||||||||||||||||||
| 286 | case QOpenGLTexture::Target1D: never executed: case QOpenGLTexture::Target1D: | 0 | ||||||||||||||||||
| 287 | case QOpenGLTexture::Target1DArray: never executed: case QOpenGLTexture::Target1DArray: | 0 | ||||||||||||||||||
| 288 | case QOpenGLTexture::Target2D: never executed: case QOpenGLTexture::Target2D: | 0 | ||||||||||||||||||
| 289 | case QOpenGLTexture::Target2DArray: never executed: case QOpenGLTexture::Target2DArray: | 0 | ||||||||||||||||||
| 290 | case QOpenGLTexture::Target3D: never executed: case QOpenGLTexture::Target3D: | 0 | ||||||||||||||||||
| 291 | case QOpenGLTexture::TargetCubeMap: never executed: case QOpenGLTexture::TargetCubeMap: | 0 | ||||||||||||||||||
| 292 | case QOpenGLTexture::TargetCubeMapArray: never executed: case QOpenGLTexture::TargetCubeMapArray: | 0 | ||||||||||||||||||
| 293 | return qMin(maximumMipLevelCount(), qMax(1, requestedMipLevels)); never executed: return qMin(maximumMipLevelCount(), qMax(1, requestedMipLevels)); | 0 | ||||||||||||||||||
| 294 | - | |||||||||||||||||||
| 295 | case QOpenGLTexture::TargetRectangle: never executed: case QOpenGLTexture::TargetRectangle: | 0 | ||||||||||||||||||
| 296 | case QOpenGLTexture::Target2DMultisample: never executed: case QOpenGLTexture::Target2DMultisample: | 0 | ||||||||||||||||||
| 297 | case QOpenGLTexture::Target2DMultisampleArray: never executed: case QOpenGLTexture::Target2DMultisampleArray: | 0 | ||||||||||||||||||
| 298 | case QOpenGLTexture::TargetBuffer: never executed: case QOpenGLTexture::TargetBuffer: | 0 | ||||||||||||||||||
| 299 | default: never executed: default: | 0 | ||||||||||||||||||
| 300 | return 1; never executed: return 1; | 0 | ||||||||||||||||||
| 301 | } | - | ||||||||||||||||||
| 302 | } | - | ||||||||||||||||||
| 303 | - | |||||||||||||||||||
| 304 | static bool isSizedTextureFormat(QOpenGLTexture::TextureFormat internalFormat) | - | ||||||||||||||||||
| 305 | { | - | ||||||||||||||||||
| 306 | switch (internalFormat) { | - | ||||||||||||||||||
| 307 | case QOpenGLTexture::NoFormat: never executed: case QOpenGLTexture::NoFormat: | 0 | ||||||||||||||||||
| 308 | return false; never executed: return false; | 0 | ||||||||||||||||||
| 309 | - | |||||||||||||||||||
| 310 | case QOpenGLTexture::R8_UNorm: never executed: case QOpenGLTexture::R8_UNorm: | 0 | ||||||||||||||||||
| 311 | case QOpenGLTexture::RG8_UNorm: never executed: case QOpenGLTexture::RG8_UNorm: | 0 | ||||||||||||||||||
| 312 | case QOpenGLTexture::RGB8_UNorm: never executed: case QOpenGLTexture::RGB8_UNorm: | 0 | ||||||||||||||||||
| 313 | case QOpenGLTexture::RGBA8_UNorm: never executed: case QOpenGLTexture::RGBA8_UNorm: | 0 | ||||||||||||||||||
| 314 | case QOpenGLTexture::R16_UNorm: never executed: case QOpenGLTexture::R16_UNorm: | 0 | ||||||||||||||||||
| 315 | case QOpenGLTexture::RG16_UNorm: never executed: case QOpenGLTexture::RG16_UNorm: | 0 | ||||||||||||||||||
| 316 | case QOpenGLTexture::RGB16_UNorm: never executed: case QOpenGLTexture::RGB16_UNorm: | 0 | ||||||||||||||||||
| 317 | case QOpenGLTexture::RGBA16_UNorm: never executed: case QOpenGLTexture::RGBA16_UNorm: | 0 | ||||||||||||||||||
| 318 | case QOpenGLTexture::R8_SNorm: never executed: case QOpenGLTexture::R8_SNorm: | 0 | ||||||||||||||||||
| 319 | case QOpenGLTexture::RG8_SNorm: never executed: case QOpenGLTexture::RG8_SNorm: | 0 | ||||||||||||||||||
| 320 | case QOpenGLTexture::RGB8_SNorm: never executed: case QOpenGLTexture::RGB8_SNorm: | 0 | ||||||||||||||||||
| 321 | case QOpenGLTexture::RGBA8_SNorm: never executed: case QOpenGLTexture::RGBA8_SNorm: | 0 | ||||||||||||||||||
| 322 | case QOpenGLTexture::R16_SNorm: never executed: case QOpenGLTexture::R16_SNorm: | 0 | ||||||||||||||||||
| 323 | case QOpenGLTexture::RG16_SNorm: never executed: case QOpenGLTexture::RG16_SNorm: | 0 | ||||||||||||||||||
| 324 | case QOpenGLTexture::RGB16_SNorm: never executed: case QOpenGLTexture::RGB16_SNorm: | 0 | ||||||||||||||||||
| 325 | case QOpenGLTexture::RGBA16_SNorm: never executed: case QOpenGLTexture::RGBA16_SNorm: | 0 | ||||||||||||||||||
| 326 | case QOpenGLTexture::R8U: never executed: case QOpenGLTexture::R8U: | 0 | ||||||||||||||||||
| 327 | case QOpenGLTexture::RG8U: never executed: case QOpenGLTexture::RG8U: | 0 | ||||||||||||||||||
| 328 | case QOpenGLTexture::RGB8U: never executed: case QOpenGLTexture::RGB8U: | 0 | ||||||||||||||||||
| 329 | case QOpenGLTexture::RGBA8U: never executed: case QOpenGLTexture::RGBA8U: | 0 | ||||||||||||||||||
| 330 | case QOpenGLTexture::R16U: never executed: case QOpenGLTexture::R16U: | 0 | ||||||||||||||||||
| 331 | case QOpenGLTexture::RG16U: never executed: case QOpenGLTexture::RG16U: | 0 | ||||||||||||||||||
| 332 | case QOpenGLTexture::RGB16U: never executed: case QOpenGLTexture::RGB16U: | 0 | ||||||||||||||||||
| 333 | case QOpenGLTexture::RGBA16U: never executed: case QOpenGLTexture::RGBA16U: | 0 | ||||||||||||||||||
| 334 | case QOpenGLTexture::R32U: never executed: case QOpenGLTexture::R32U: | 0 | ||||||||||||||||||
| 335 | case QOpenGLTexture::RG32U: never executed: case QOpenGLTexture::RG32U: | 0 | ||||||||||||||||||
| 336 | case QOpenGLTexture::RGB32U: never executed: case QOpenGLTexture::RGB32U: | 0 | ||||||||||||||||||
| 337 | case QOpenGLTexture::RGBA32U: never executed: case QOpenGLTexture::RGBA32U: | 0 | ||||||||||||||||||
| 338 | case QOpenGLTexture::R8I: never executed: case QOpenGLTexture::R8I: | 0 | ||||||||||||||||||
| 339 | case QOpenGLTexture::RG8I: never executed: case QOpenGLTexture::RG8I: | 0 | ||||||||||||||||||
| 340 | case QOpenGLTexture::RGB8I: never executed: case QOpenGLTexture::RGB8I: | 0 | ||||||||||||||||||
| 341 | case QOpenGLTexture::RGBA8I: never executed: case QOpenGLTexture::RGBA8I: | 0 | ||||||||||||||||||
| 342 | case QOpenGLTexture::R16I: never executed: case QOpenGLTexture::R16I: | 0 | ||||||||||||||||||
| 343 | case QOpenGLTexture::RG16I: never executed: case QOpenGLTexture::RG16I: | 0 | ||||||||||||||||||
| 344 | case QOpenGLTexture::RGB16I: never executed: case QOpenGLTexture::RGB16I: | 0 | ||||||||||||||||||
| 345 | case QOpenGLTexture::RGBA16I: never executed: case QOpenGLTexture::RGBA16I: | 0 | ||||||||||||||||||
| 346 | case QOpenGLTexture::R32I: never executed: case QOpenGLTexture::R32I: | 0 | ||||||||||||||||||
| 347 | case QOpenGLTexture::RG32I: never executed: case QOpenGLTexture::RG32I: | 0 | ||||||||||||||||||
| 348 | case QOpenGLTexture::RGB32I: never executed: case QOpenGLTexture::RGB32I: | 0 | ||||||||||||||||||
| 349 | case QOpenGLTexture::RGBA32I: never executed: case QOpenGLTexture::RGBA32I: | 0 | ||||||||||||||||||
| 350 | case QOpenGLTexture::R16F: never executed: case QOpenGLTexture::R16F: | 0 | ||||||||||||||||||
| 351 | case QOpenGLTexture::RG16F: never executed: case QOpenGLTexture::RG16F: | 0 | ||||||||||||||||||
| 352 | case QOpenGLTexture::RGB16F: never executed: case QOpenGLTexture::RGB16F: | 0 | ||||||||||||||||||
| 353 | case QOpenGLTexture::RGBA16F: never executed: case QOpenGLTexture::RGBA16F: | 0 | ||||||||||||||||||
| 354 | case QOpenGLTexture::R32F: never executed: case QOpenGLTexture::R32F: | 0 | ||||||||||||||||||
| 355 | case QOpenGLTexture::RG32F: never executed: case QOpenGLTexture::RG32F: | 0 | ||||||||||||||||||
| 356 | case QOpenGLTexture::RGB32F: never executed: case QOpenGLTexture::RGB32F: | 0 | ||||||||||||||||||
| 357 | case QOpenGLTexture::RGBA32F: never executed: case QOpenGLTexture::RGBA32F: | 0 | ||||||||||||||||||
| 358 | case QOpenGLTexture::RGB9E5: never executed: case QOpenGLTexture::RGB9E5: | 0 | ||||||||||||||||||
| 359 | case QOpenGLTexture::RG11B10F: never executed: case QOpenGLTexture::RG11B10F: | 0 | ||||||||||||||||||
| 360 | case QOpenGLTexture::RG3B2: never executed: case QOpenGLTexture::RG3B2: | 0 | ||||||||||||||||||
| 361 | case QOpenGLTexture::R5G6B5: never executed: case QOpenGLTexture::R5G6B5: | 0 | ||||||||||||||||||
| 362 | case QOpenGLTexture::RGB5A1: never executed: case QOpenGLTexture::RGB5A1: | 0 | ||||||||||||||||||
| 363 | case QOpenGLTexture::RGBA4: never executed: case QOpenGLTexture::RGBA4: | 0 | ||||||||||||||||||
| 364 | case QOpenGLTexture::RGB10A2: never executed: case QOpenGLTexture::RGB10A2: | 0 | ||||||||||||||||||
| 365 | - | |||||||||||||||||||
| 366 | case QOpenGLTexture::D16: never executed: case QOpenGLTexture::D16: | 0 | ||||||||||||||||||
| 367 | case QOpenGLTexture::D24: never executed: case QOpenGLTexture::D24: | 0 | ||||||||||||||||||
| 368 | case QOpenGLTexture::D32: never executed: case QOpenGLTexture::D32: | 0 | ||||||||||||||||||
| 369 | case QOpenGLTexture::D32F: never executed: case QOpenGLTexture::D32F: | 0 | ||||||||||||||||||
| 370 | - | |||||||||||||||||||
| 371 | case QOpenGLTexture::D24S8: never executed: case QOpenGLTexture::D24S8: | 0 | ||||||||||||||||||
| 372 | case QOpenGLTexture::D32FS8X24: never executed: case QOpenGLTexture::D32FS8X24: | 0 | ||||||||||||||||||
| 373 | - | |||||||||||||||||||
| 374 | case QOpenGLTexture::S8: never executed: case QOpenGLTexture::S8: | 0 | ||||||||||||||||||
| 375 | - | |||||||||||||||||||
| 376 | case QOpenGLTexture::RGB_DXT1: never executed: case QOpenGLTexture::RGB_DXT1: | 0 | ||||||||||||||||||
| 377 | case QOpenGLTexture::RGBA_DXT1: never executed: case QOpenGLTexture::RGBA_DXT1: | 0 | ||||||||||||||||||
| 378 | case QOpenGLTexture::RGBA_DXT3: never executed: case QOpenGLTexture::RGBA_DXT3: | 0 | ||||||||||||||||||
| 379 | case QOpenGLTexture::RGBA_DXT5: never executed: case QOpenGLTexture::RGBA_DXT5: | 0 | ||||||||||||||||||
| 380 | case QOpenGLTexture::R_ATI1N_UNorm: never executed: case QOpenGLTexture::R_ATI1N_UNorm: | 0 | ||||||||||||||||||
| 381 | case QOpenGLTexture::R_ATI1N_SNorm: never executed: case QOpenGLTexture::R_ATI1N_SNorm: | 0 | ||||||||||||||||||
| 382 | case QOpenGLTexture::RG_ATI2N_UNorm: never executed: case QOpenGLTexture::RG_ATI2N_UNorm: | 0 | ||||||||||||||||||
| 383 | case QOpenGLTexture::RG_ATI2N_SNorm: never executed: case QOpenGLTexture::RG_ATI2N_SNorm: | 0 | ||||||||||||||||||
| 384 | case QOpenGLTexture::RGB_BP_UNSIGNED_FLOAT: never executed: case QOpenGLTexture::RGB_BP_UNSIGNED_FLOAT: | 0 | ||||||||||||||||||
| 385 | case QOpenGLTexture::RGB_BP_SIGNED_FLOAT: never executed: case QOpenGLTexture::RGB_BP_SIGNED_FLOAT: | 0 | ||||||||||||||||||
| 386 | case QOpenGLTexture::RGB_BP_UNorm: never executed: case QOpenGLTexture::RGB_BP_UNorm: | 0 | ||||||||||||||||||
| 387 | case QOpenGLTexture::SRGB8: never executed: case QOpenGLTexture::SRGB8: | 0 | ||||||||||||||||||
| 388 | case QOpenGLTexture::SRGB8_Alpha8: never executed: case QOpenGLTexture::SRGB8_Alpha8: | 0 | ||||||||||||||||||
| 389 | case QOpenGLTexture::SRGB_DXT1: never executed: case QOpenGLTexture::SRGB_DXT1: | 0 | ||||||||||||||||||
| 390 | case QOpenGLTexture::SRGB_Alpha_DXT1: never executed: case QOpenGLTexture::SRGB_Alpha_DXT1: | 0 | ||||||||||||||||||
| 391 | case QOpenGLTexture::SRGB_Alpha_DXT3: never executed: case QOpenGLTexture::SRGB_Alpha_DXT3: | 0 | ||||||||||||||||||
| 392 | case QOpenGLTexture::SRGB_Alpha_DXT5: never executed: case QOpenGLTexture::SRGB_Alpha_DXT5: | 0 | ||||||||||||||||||
| 393 | case QOpenGLTexture::SRGB_BP_UNorm: never executed: case QOpenGLTexture::SRGB_BP_UNorm: | 0 | ||||||||||||||||||
| 394 | case QOpenGLTexture::R11_EAC_UNorm: never executed: case QOpenGLTexture::R11_EAC_UNorm: | 0 | ||||||||||||||||||
| 395 | case QOpenGLTexture::R11_EAC_SNorm: never executed: case QOpenGLTexture::R11_EAC_SNorm: | 0 | ||||||||||||||||||
| 396 | case QOpenGLTexture::RG11_EAC_UNorm: never executed: case QOpenGLTexture::RG11_EAC_UNorm: | 0 | ||||||||||||||||||
| 397 | case QOpenGLTexture::RG11_EAC_SNorm: never executed: case QOpenGLTexture::RG11_EAC_SNorm: | 0 | ||||||||||||||||||
| 398 | case QOpenGLTexture::RGB8_ETC2: never executed: case QOpenGLTexture::RGB8_ETC2: | 0 | ||||||||||||||||||
| 399 | case QOpenGLTexture::SRGB8_ETC2: never executed: case QOpenGLTexture::SRGB8_ETC2: | 0 | ||||||||||||||||||
| 400 | case QOpenGLTexture::RGB8_PunchThrough_Alpha1_ETC2: never executed: case QOpenGLTexture::RGB8_PunchThrough_Alpha1_ETC2: | 0 | ||||||||||||||||||
| 401 | case QOpenGLTexture::SRGB8_PunchThrough_Alpha1_ETC2: never executed: case QOpenGLTexture::SRGB8_PunchThrough_Alpha1_ETC2: | 0 | ||||||||||||||||||
| 402 | case QOpenGLTexture::RGBA8_ETC2_EAC: never executed: case QOpenGLTexture::RGBA8_ETC2_EAC: | 0 | ||||||||||||||||||
| 403 | case QOpenGLTexture::SRGB8_Alpha8_ETC2_EAC: never executed: case QOpenGLTexture::SRGB8_Alpha8_ETC2_EAC: | 0 | ||||||||||||||||||
| 404 | return true; never executed: return true; | 0 | ||||||||||||||||||
| 405 | - | |||||||||||||||||||
| 406 | case QOpenGLTexture::RGB8_ETC1: never executed: case QOpenGLTexture::RGB8_ETC1: | 0 | ||||||||||||||||||
| 407 | return false; never executed: return false; | 0 | ||||||||||||||||||
| 408 | - | |||||||||||||||||||
| 409 | case QOpenGLTexture::DepthFormat: never executed: case QOpenGLTexture::DepthFormat: | 0 | ||||||||||||||||||
| 410 | case QOpenGLTexture::AlphaFormat: never executed: case QOpenGLTexture::AlphaFormat: | 0 | ||||||||||||||||||
| 411 | - | |||||||||||||||||||
| 412 | case QOpenGLTexture::RGBFormat: never executed: case QOpenGLTexture::RGBFormat: | 0 | ||||||||||||||||||
| 413 | case QOpenGLTexture::RGBAFormat: never executed: case QOpenGLTexture::RGBAFormat: | 0 | ||||||||||||||||||
| 414 | - | |||||||||||||||||||
| 415 | case QOpenGLTexture::LuminanceFormat: never executed: case QOpenGLTexture::LuminanceFormat: | 0 | ||||||||||||||||||
| 416 | - | |||||||||||||||||||
| 417 | case QOpenGLTexture::LuminanceAlphaFormat: never executed: case QOpenGLTexture::LuminanceAlphaFormat: | 0 | ||||||||||||||||||
| 418 | return false; never executed: return false; | 0 | ||||||||||||||||||
| 419 | } | - | ||||||||||||||||||
| 420 | - | |||||||||||||||||||
| 421 | Q_UNREACHABLE(); | - | ||||||||||||||||||
| 422 | return false; never executed: return false; | 0 | ||||||||||||||||||
| 423 | } | - | ||||||||||||||||||
| 424 | - | |||||||||||||||||||
| 425 | static bool isTextureTargetMultisample(QOpenGLTexture::Target target) | - | ||||||||||||||||||
| 426 | { | - | ||||||||||||||||||
| 427 | switch (target) { | - | ||||||||||||||||||
| 428 | case QOpenGLTexture::Target1D: never executed: case QOpenGLTexture::Target1D: | 0 | ||||||||||||||||||
| 429 | case QOpenGLTexture::Target1DArray: never executed: case QOpenGLTexture::Target1DArray: | 0 | ||||||||||||||||||
| 430 | case QOpenGLTexture::Target2D: never executed: case QOpenGLTexture::Target2D: | 0 | ||||||||||||||||||
| 431 | case QOpenGLTexture::Target2DArray: never executed: case QOpenGLTexture::Target2DArray: | 0 | ||||||||||||||||||
| 432 | case QOpenGLTexture::Target3D: never executed: case QOpenGLTexture::Target3D: | 0 | ||||||||||||||||||
| 433 | case QOpenGLTexture::TargetCubeMap: never executed: case QOpenGLTexture::TargetCubeMap: | 0 | ||||||||||||||||||
| 434 | case QOpenGLTexture::TargetCubeMapArray: never executed: case QOpenGLTexture::TargetCubeMapArray: | 0 | ||||||||||||||||||
| 435 | return false; never executed: return false; | 0 | ||||||||||||||||||
| 436 | - | |||||||||||||||||||
| 437 | case QOpenGLTexture::Target2DMultisample: never executed: case QOpenGLTexture::Target2DMultisample: | 0 | ||||||||||||||||||
| 438 | case QOpenGLTexture::Target2DMultisampleArray: never executed: case QOpenGLTexture::Target2DMultisampleArray: | 0 | ||||||||||||||||||
| 439 | return true; never executed: return true; | 0 | ||||||||||||||||||
| 440 | - | |||||||||||||||||||
| 441 | case QOpenGLTexture::TargetRectangle: never executed: case QOpenGLTexture::TargetRectangle: | 0 | ||||||||||||||||||
| 442 | case QOpenGLTexture::TargetBuffer: never executed: case QOpenGLTexture::TargetBuffer: | 0 | ||||||||||||||||||
| 443 | return false; never executed: return false; | 0 | ||||||||||||||||||
| 444 | } | - | ||||||||||||||||||
| 445 | - | |||||||||||||||||||
| 446 | Q_UNREACHABLE(); | - | ||||||||||||||||||
| 447 | return false; never executed: return false; | 0 | ||||||||||||||||||
| 448 | } | - | ||||||||||||||||||
| 449 | - | |||||||||||||||||||
| 450 | bool QOpenGLTexturePrivate::isUsingImmutableStorage() const | - | ||||||||||||||||||
| 451 | { | - | ||||||||||||||||||
| 452 | // Use immutable storage whenever possible, falling back to mutable | - | ||||||||||||||||||
| 453 | // Note that if multisample textures are not supported at all, we'll still fail into | - | ||||||||||||||||||
| 454 | // the mutable storage allocation | - | ||||||||||||||||||
| 455 | return isSizedTextureFormat(format) never executed: return isSizedTextureFormat(format) && (isTextureTargetMultisample(target) ? features.testFlag(QOpenGLTexture::ImmutableMultisampleStorage) : features.testFlag(QOpenGLTexture::ImmutableStorage));
| 0 | ||||||||||||||||||
| 456 | && (isTextureTargetMultisample(target) never executed: return isSizedTextureFormat(format) && (isTextureTargetMultisample(target) ? features.testFlag(QOpenGLTexture::ImmutableMultisampleStorage) : features.testFlag(QOpenGLTexture::ImmutableStorage));
| 0 | ||||||||||||||||||
| 457 | ? features.testFlag(QOpenGLTexture::ImmutableMultisampleStorage) never executed: return isSizedTextureFormat(format) && (isTextureTargetMultisample(target) ? features.testFlag(QOpenGLTexture::ImmutableMultisampleStorage) : features.testFlag(QOpenGLTexture::ImmutableStorage));
| 0 | ||||||||||||||||||
| 458 | : features.testFlag(QOpenGLTexture::ImmutableStorage)); never executed: return isSizedTextureFormat(format) && (isTextureTargetMultisample(target) ? features.testFlag(QOpenGLTexture::ImmutableMultisampleStorage) : features.testFlag(QOpenGLTexture::ImmutableStorage));
| 0 | ||||||||||||||||||
| 459 | } | - | ||||||||||||||||||
| 460 | - | |||||||||||||||||||
| 461 | void QOpenGLTexturePrivate::allocateStorage(QOpenGLTexture::PixelFormat pixelFormat, QOpenGLTexture::PixelType pixelType) | - | ||||||||||||||||||
| 462 | { | - | ||||||||||||||||||
| 463 | // Resolve the actual number of mipmap levels we can use | - | ||||||||||||||||||
| 464 | mipLevels = evaluateMipLevels(); | - | ||||||||||||||||||
| 465 | - | |||||||||||||||||||
| 466 | if (isUsingImmutableStorage())
| 0 | ||||||||||||||||||
| 467 | allocateImmutableStorage(); never executed: allocateImmutableStorage(); | 0 | ||||||||||||||||||
| 468 | else | - | ||||||||||||||||||
| 469 | allocateMutableStorage(pixelFormat, pixelType); never executed: allocateMutableStorage(pixelFormat, pixelType); | 0 | ||||||||||||||||||
| 470 | } | - | ||||||||||||||||||
| 471 | - | |||||||||||||||||||
| 472 | static QOpenGLTexture::PixelFormat pixelFormatCompatibleWithInternalFormat(QOpenGLTexture::TextureFormat internalFormat) | - | ||||||||||||||||||
| 473 | { | - | ||||||||||||||||||
| 474 | switch (internalFormat) { | - | ||||||||||||||||||
| 475 | case QOpenGLTexture::NoFormat: never executed: case QOpenGLTexture::NoFormat: | 0 | ||||||||||||||||||
| 476 | return QOpenGLTexture::NoSourceFormat; never executed: return QOpenGLTexture::NoSourceFormat; | 0 | ||||||||||||||||||
| 477 | - | |||||||||||||||||||
| 478 | case QOpenGLTexture::R8_UNorm: never executed: case QOpenGLTexture::R8_UNorm: | 0 | ||||||||||||||||||
| 479 | return QOpenGLTexture::Red; never executed: return QOpenGLTexture::Red; | 0 | ||||||||||||||||||
| 480 | - | |||||||||||||||||||
| 481 | case QOpenGLTexture::RG8_UNorm: never executed: case QOpenGLTexture::RG8_UNorm: | 0 | ||||||||||||||||||
| 482 | return QOpenGLTexture::RG; never executed: return QOpenGLTexture::RG; | 0 | ||||||||||||||||||
| 483 | - | |||||||||||||||||||
| 484 | case QOpenGLTexture::RGB8_UNorm: never executed: case QOpenGLTexture::RGB8_UNorm: | 0 | ||||||||||||||||||
| 485 | return QOpenGLTexture::RGB; never executed: return QOpenGLTexture::RGB; | 0 | ||||||||||||||||||
| 486 | - | |||||||||||||||||||
| 487 | case QOpenGLTexture::RGBA8_UNorm: never executed: case QOpenGLTexture::RGBA8_UNorm: | 0 | ||||||||||||||||||
| 488 | return QOpenGLTexture::RGBA; never executed: return QOpenGLTexture::RGBA; | 0 | ||||||||||||||||||
| 489 | - | |||||||||||||||||||
| 490 | case QOpenGLTexture::R16_UNorm: never executed: case QOpenGLTexture::R16_UNorm: | 0 | ||||||||||||||||||
| 491 | return QOpenGLTexture::Red; never executed: return QOpenGLTexture::Red; | 0 | ||||||||||||||||||
| 492 | - | |||||||||||||||||||
| 493 | case QOpenGLTexture::RG16_UNorm: never executed: case QOpenGLTexture::RG16_UNorm: | 0 | ||||||||||||||||||
| 494 | return QOpenGLTexture::RG; never executed: return QOpenGLTexture::RG; | 0 | ||||||||||||||||||
| 495 | - | |||||||||||||||||||
| 496 | case QOpenGLTexture::RGB16_UNorm: never executed: case QOpenGLTexture::RGB16_UNorm: | 0 | ||||||||||||||||||
| 497 | return QOpenGLTexture::RGB; never executed: return QOpenGLTexture::RGB; | 0 | ||||||||||||||||||
| 498 | - | |||||||||||||||||||
| 499 | case QOpenGLTexture::RGBA16_UNorm: never executed: case QOpenGLTexture::RGBA16_UNorm: | 0 | ||||||||||||||||||
| 500 | return QOpenGLTexture::RGBA; never executed: return QOpenGLTexture::RGBA; | 0 | ||||||||||||||||||
| 501 | - | |||||||||||||||||||
| 502 | case QOpenGLTexture::R8_SNorm: never executed: case QOpenGLTexture::R8_SNorm: | 0 | ||||||||||||||||||
| 503 | return QOpenGLTexture::Red; never executed: return QOpenGLTexture::Red; | 0 | ||||||||||||||||||
| 504 | - | |||||||||||||||||||
| 505 | case QOpenGLTexture::RG8_SNorm: never executed: case QOpenGLTexture::RG8_SNorm: | 0 | ||||||||||||||||||
| 506 | return QOpenGLTexture::RG; never executed: return QOpenGLTexture::RG; | 0 | ||||||||||||||||||
| 507 | - | |||||||||||||||||||
| 508 | case QOpenGLTexture::RGB8_SNorm: never executed: case QOpenGLTexture::RGB8_SNorm: | 0 | ||||||||||||||||||
| 509 | return QOpenGLTexture::RGB; never executed: return QOpenGLTexture::RGB; | 0 | ||||||||||||||||||
| 510 | - | |||||||||||||||||||
| 511 | case QOpenGLTexture::RGBA8_SNorm: never executed: case QOpenGLTexture::RGBA8_SNorm: | 0 | ||||||||||||||||||
| 512 | return QOpenGLTexture::RGBA; never executed: return QOpenGLTexture::RGBA; | 0 | ||||||||||||||||||
| 513 | - | |||||||||||||||||||
| 514 | case QOpenGLTexture::R16_SNorm: never executed: case QOpenGLTexture::R16_SNorm: | 0 | ||||||||||||||||||
| 515 | return QOpenGLTexture::Red; never executed: return QOpenGLTexture::Red; | 0 | ||||||||||||||||||
| 516 | - | |||||||||||||||||||
| 517 | case QOpenGLTexture::RG16_SNorm: never executed: case QOpenGLTexture::RG16_SNorm: | 0 | ||||||||||||||||||
| 518 | return QOpenGLTexture::RG; never executed: return QOpenGLTexture::RG; | 0 | ||||||||||||||||||
| 519 | - | |||||||||||||||||||
| 520 | case QOpenGLTexture::RGB16_SNorm: never executed: case QOpenGLTexture::RGB16_SNorm: | 0 | ||||||||||||||||||
| 521 | return QOpenGLTexture::RGB; never executed: return QOpenGLTexture::RGB; | 0 | ||||||||||||||||||
| 522 | - | |||||||||||||||||||
| 523 | case QOpenGLTexture::RGBA16_SNorm: never executed: case QOpenGLTexture::RGBA16_SNorm: | 0 | ||||||||||||||||||
| 524 | return QOpenGLTexture::RGBA; never executed: return QOpenGLTexture::RGBA; | 0 | ||||||||||||||||||
| 525 | - | |||||||||||||||||||
| 526 | case QOpenGLTexture::R8U: never executed: case QOpenGLTexture::R8U: | 0 | ||||||||||||||||||
| 527 | return QOpenGLTexture::Red_Integer; never executed: return QOpenGLTexture::Red_Integer; | 0 | ||||||||||||||||||
| 528 | - | |||||||||||||||||||
| 529 | case QOpenGLTexture::RG8U: never executed: case QOpenGLTexture::RG8U: | 0 | ||||||||||||||||||
| 530 | return QOpenGLTexture::RG_Integer; never executed: return QOpenGLTexture::RG_Integer; | 0 | ||||||||||||||||||
| 531 | - | |||||||||||||||||||
| 532 | case QOpenGLTexture::RGB8U: never executed: case QOpenGLTexture::RGB8U: | 0 | ||||||||||||||||||
| 533 | return QOpenGLTexture::RGB_Integer; never executed: return QOpenGLTexture::RGB_Integer; | 0 | ||||||||||||||||||
| 534 | - | |||||||||||||||||||
| 535 | case QOpenGLTexture::RGBA8U: never executed: case QOpenGLTexture::RGBA8U: | 0 | ||||||||||||||||||
| 536 | return QOpenGLTexture::RGBA_Integer; never executed: return QOpenGLTexture::RGBA_Integer; | 0 | ||||||||||||||||||
| 537 | - | |||||||||||||||||||
| 538 | case QOpenGLTexture::R16U: never executed: case QOpenGLTexture::R16U: | 0 | ||||||||||||||||||
| 539 | return QOpenGLTexture::Red_Integer; never executed: return QOpenGLTexture::Red_Integer; | 0 | ||||||||||||||||||
| 540 | - | |||||||||||||||||||
| 541 | case QOpenGLTexture::RG16U: never executed: case QOpenGLTexture::RG16U: | 0 | ||||||||||||||||||
| 542 | return QOpenGLTexture::RG_Integer; never executed: return QOpenGLTexture::RG_Integer; | 0 | ||||||||||||||||||
| 543 | - | |||||||||||||||||||
| 544 | case QOpenGLTexture::RGB16U: never executed: case QOpenGLTexture::RGB16U: | 0 | ||||||||||||||||||
| 545 | return QOpenGLTexture::RGB_Integer; never executed: return QOpenGLTexture::RGB_Integer; | 0 | ||||||||||||||||||
| 546 | - | |||||||||||||||||||
| 547 | case QOpenGLTexture::RGBA16U: never executed: case QOpenGLTexture::RGBA16U: | 0 | ||||||||||||||||||
| 548 | return QOpenGLTexture::RGBA_Integer; never executed: return QOpenGLTexture::RGBA_Integer; | 0 | ||||||||||||||||||
| 549 | - | |||||||||||||||||||
| 550 | case QOpenGLTexture::R32U: never executed: case QOpenGLTexture::R32U: | 0 | ||||||||||||||||||
| 551 | return QOpenGLTexture::Red_Integer; never executed: return QOpenGLTexture::Red_Integer; | 0 | ||||||||||||||||||
| 552 | - | |||||||||||||||||||
| 553 | case QOpenGLTexture::RG32U: never executed: case QOpenGLTexture::RG32U: | 0 | ||||||||||||||||||
| 554 | return QOpenGLTexture::RG_Integer; never executed: return QOpenGLTexture::RG_Integer; | 0 | ||||||||||||||||||
| 555 | - | |||||||||||||||||||
| 556 | case QOpenGLTexture::RGB32U: never executed: case QOpenGLTexture::RGB32U: | 0 | ||||||||||||||||||
| 557 | return QOpenGLTexture::RGB_Integer; never executed: return QOpenGLTexture::RGB_Integer; | 0 | ||||||||||||||||||
| 558 | - | |||||||||||||||||||
| 559 | case QOpenGLTexture::RGBA32U: never executed: case QOpenGLTexture::RGBA32U: | 0 | ||||||||||||||||||
| 560 | return QOpenGLTexture::RGBA_Integer; never executed: return QOpenGLTexture::RGBA_Integer; | 0 | ||||||||||||||||||
| 561 | - | |||||||||||||||||||
| 562 | case QOpenGLTexture::R8I: never executed: case QOpenGLTexture::R8I: | 0 | ||||||||||||||||||
| 563 | return QOpenGLTexture::Red_Integer; never executed: return QOpenGLTexture::Red_Integer; | 0 | ||||||||||||||||||
| 564 | - | |||||||||||||||||||
| 565 | case QOpenGLTexture::RG8I: never executed: case QOpenGLTexture::RG8I: | 0 | ||||||||||||||||||
| 566 | return QOpenGLTexture::RG_Integer; never executed: return QOpenGLTexture::RG_Integer; | 0 | ||||||||||||||||||
| 567 | - | |||||||||||||||||||
| 568 | case QOpenGLTexture::RGB8I: never executed: case QOpenGLTexture::RGB8I: | 0 | ||||||||||||||||||
| 569 | return QOpenGLTexture::RGB_Integer; never executed: return QOpenGLTexture::RGB_Integer; | 0 | ||||||||||||||||||
| 570 | - | |||||||||||||||||||
| 571 | case QOpenGLTexture::RGBA8I: never executed: case QOpenGLTexture::RGBA8I: | 0 | ||||||||||||||||||
| 572 | return QOpenGLTexture::RGBA_Integer; never executed: return QOpenGLTexture::RGBA_Integer; | 0 | ||||||||||||||||||
| 573 | - | |||||||||||||||||||
| 574 | case QOpenGLTexture::R16I: never executed: case QOpenGLTexture::R16I: | 0 | ||||||||||||||||||
| 575 | return QOpenGLTexture::Red_Integer; never executed: return QOpenGLTexture::Red_Integer; | 0 | ||||||||||||||||||
| 576 | - | |||||||||||||||||||
| 577 | case QOpenGLTexture::RG16I: never executed: case QOpenGLTexture::RG16I: | 0 | ||||||||||||||||||
| 578 | return QOpenGLTexture::RG_Integer; never executed: return QOpenGLTexture::RG_Integer; | 0 | ||||||||||||||||||
| 579 | - | |||||||||||||||||||
| 580 | case QOpenGLTexture::RGB16I: never executed: case QOpenGLTexture::RGB16I: | 0 | ||||||||||||||||||
| 581 | return QOpenGLTexture::RGB_Integer; never executed: return QOpenGLTexture::RGB_Integer; | 0 | ||||||||||||||||||
| 582 | - | |||||||||||||||||||
| 583 | case QOpenGLTexture::RGBA16I: never executed: case QOpenGLTexture::RGBA16I: | 0 | ||||||||||||||||||
| 584 | return QOpenGLTexture::RGBA_Integer; never executed: return QOpenGLTexture::RGBA_Integer; | 0 | ||||||||||||||||||
| 585 | - | |||||||||||||||||||
| 586 | case QOpenGLTexture::R32I: never executed: case QOpenGLTexture::R32I: | 0 | ||||||||||||||||||
| 587 | return QOpenGLTexture::Red_Integer; never executed: return QOpenGLTexture::Red_Integer; | 0 | ||||||||||||||||||
| 588 | - | |||||||||||||||||||
| 589 | case QOpenGLTexture::RG32I: never executed: case QOpenGLTexture::RG32I: | 0 | ||||||||||||||||||
| 590 | return QOpenGLTexture::RG_Integer; never executed: return QOpenGLTexture::RG_Integer; | 0 | ||||||||||||||||||
| 591 | - | |||||||||||||||||||
| 592 | case QOpenGLTexture::RGB32I: never executed: case QOpenGLTexture::RGB32I: | 0 | ||||||||||||||||||
| 593 | return QOpenGLTexture::RGB_Integer; never executed: return QOpenGLTexture::RGB_Integer; | 0 | ||||||||||||||||||
| 594 | - | |||||||||||||||||||
| 595 | case QOpenGLTexture::RGBA32I: never executed: case QOpenGLTexture::RGBA32I: | 0 | ||||||||||||||||||
| 596 | return QOpenGLTexture::RGBA_Integer; never executed: return QOpenGLTexture::RGBA_Integer; | 0 | ||||||||||||||||||
| 597 | - | |||||||||||||||||||
| 598 | case QOpenGLTexture::R16F: never executed: case QOpenGLTexture::R16F: | 0 | ||||||||||||||||||
| 599 | return QOpenGLTexture::Red; never executed: return QOpenGLTexture::Red; | 0 | ||||||||||||||||||
| 600 | - | |||||||||||||||||||
| 601 | case QOpenGLTexture::RG16F: never executed: case QOpenGLTexture::RG16F: | 0 | ||||||||||||||||||
| 602 | return QOpenGLTexture::RG; never executed: return QOpenGLTexture::RG; | 0 | ||||||||||||||||||
| 603 | - | |||||||||||||||||||
| 604 | case QOpenGLTexture::RGB16F: never executed: case QOpenGLTexture::RGB16F: | 0 | ||||||||||||||||||
| 605 | return QOpenGLTexture::RGB; never executed: return QOpenGLTexture::RGB; | 0 | ||||||||||||||||||
| 606 | - | |||||||||||||||||||
| 607 | case QOpenGLTexture::RGBA16F: never executed: case QOpenGLTexture::RGBA16F: | 0 | ||||||||||||||||||
| 608 | return QOpenGLTexture::RGBA; never executed: return QOpenGLTexture::RGBA; | 0 | ||||||||||||||||||
| 609 | - | |||||||||||||||||||
| 610 | case QOpenGLTexture::R32F: never executed: case QOpenGLTexture::R32F: | 0 | ||||||||||||||||||
| 611 | return QOpenGLTexture::Red; never executed: return QOpenGLTexture::Red; | 0 | ||||||||||||||||||
| 612 | - | |||||||||||||||||||
| 613 | case QOpenGLTexture::RG32F: never executed: case QOpenGLTexture::RG32F: | 0 | ||||||||||||||||||
| 614 | return QOpenGLTexture::RG; never executed: return QOpenGLTexture::RG; | 0 | ||||||||||||||||||
| 615 | - | |||||||||||||||||||
| 616 | case QOpenGLTexture::RGB32F: never executed: case QOpenGLTexture::RGB32F: | 0 | ||||||||||||||||||
| 617 | return QOpenGLTexture::RGB; never executed: return QOpenGLTexture::RGB; | 0 | ||||||||||||||||||
| 618 | - | |||||||||||||||||||
| 619 | case QOpenGLTexture::RGBA32F: never executed: case QOpenGLTexture::RGBA32F: | 0 | ||||||||||||||||||
| 620 | return QOpenGLTexture::RGBA; never executed: return QOpenGLTexture::RGBA; | 0 | ||||||||||||||||||
| 621 | - | |||||||||||||||||||
| 622 | case QOpenGLTexture::RGB9E5: never executed: case QOpenGLTexture::RGB9E5: | 0 | ||||||||||||||||||
| 623 | return QOpenGLTexture::RGB; never executed: return QOpenGLTexture::RGB; | 0 | ||||||||||||||||||
| 624 | - | |||||||||||||||||||
| 625 | case QOpenGLTexture::RG11B10F: never executed: case QOpenGLTexture::RG11B10F: | 0 | ||||||||||||||||||
| 626 | return QOpenGLTexture::RGB; never executed: return QOpenGLTexture::RGB; | 0 | ||||||||||||||||||
| 627 | - | |||||||||||||||||||
| 628 | case QOpenGLTexture::RG3B2: never executed: case QOpenGLTexture::RG3B2: | 0 | ||||||||||||||||||
| 629 | return QOpenGLTexture::RGB; never executed: return QOpenGLTexture::RGB; | 0 | ||||||||||||||||||
| 630 | - | |||||||||||||||||||
| 631 | case QOpenGLTexture::R5G6B5: never executed: case QOpenGLTexture::R5G6B5: | 0 | ||||||||||||||||||
| 632 | return QOpenGLTexture::RGB; never executed: return QOpenGLTexture::RGB; | 0 | ||||||||||||||||||
| 633 | - | |||||||||||||||||||
| 634 | case QOpenGLTexture::RGB5A1: never executed: case QOpenGLTexture::RGB5A1: | 0 | ||||||||||||||||||
| 635 | return QOpenGLTexture::RGBA; never executed: return QOpenGLTexture::RGBA; | 0 | ||||||||||||||||||
| 636 | - | |||||||||||||||||||
| 637 | case QOpenGLTexture::RGBA4: never executed: case QOpenGLTexture::RGBA4: | 0 | ||||||||||||||||||
| 638 | return QOpenGLTexture::RGBA; never executed: return QOpenGLTexture::RGBA; | 0 | ||||||||||||||||||
| 639 | - | |||||||||||||||||||
| 640 | case QOpenGLTexture::RGB10A2: never executed: case QOpenGLTexture::RGB10A2: | 0 | ||||||||||||||||||
| 641 | return QOpenGLTexture::RGBA; never executed: return QOpenGLTexture::RGBA; | 0 | ||||||||||||||||||
| 642 | - | |||||||||||||||||||
| 643 | case QOpenGLTexture::D16: never executed: case QOpenGLTexture::D16: | 0 | ||||||||||||||||||
| 644 | case QOpenGLTexture::D24: never executed: case QOpenGLTexture::D24: | 0 | ||||||||||||||||||
| 645 | case QOpenGLTexture::D32: never executed: case QOpenGLTexture::D32: | 0 | ||||||||||||||||||
| 646 | case QOpenGLTexture::D32F: never executed: case QOpenGLTexture::D32F: | 0 | ||||||||||||||||||
| 647 | return QOpenGLTexture::Depth; never executed: return QOpenGLTexture::Depth; | 0 | ||||||||||||||||||
| 648 | - | |||||||||||||||||||
| 649 | case QOpenGLTexture::D24S8: never executed: case QOpenGLTexture::D24S8: | 0 | ||||||||||||||||||
| 650 | case QOpenGLTexture::D32FS8X24: never executed: case QOpenGLTexture::D32FS8X24: | 0 | ||||||||||||||||||
| 651 | return QOpenGLTexture::DepthStencil; never executed: return QOpenGLTexture::DepthStencil; | 0 | ||||||||||||||||||
| 652 | - | |||||||||||||||||||
| 653 | case QOpenGLTexture::S8: never executed: case QOpenGLTexture::S8: | 0 | ||||||||||||||||||
| 654 | return QOpenGLTexture::Stencil; never executed: return QOpenGLTexture::Stencil; | 0 | ||||||||||||||||||
| 655 | - | |||||||||||||||||||
| 656 | case QOpenGLTexture::RGB_DXT1: never executed: case QOpenGLTexture::RGB_DXT1: | 0 | ||||||||||||||||||
| 657 | case QOpenGLTexture::RGBA_DXT1: never executed: case QOpenGLTexture::RGBA_DXT1: | 0 | ||||||||||||||||||
| 658 | case QOpenGLTexture::RGBA_DXT3: never executed: case QOpenGLTexture::RGBA_DXT3: | 0 | ||||||||||||||||||
| 659 | case QOpenGLTexture::RGBA_DXT5: never executed: case QOpenGLTexture::RGBA_DXT5: | 0 | ||||||||||||||||||
| 660 | case QOpenGLTexture::R_ATI1N_UNorm: never executed: case QOpenGLTexture::R_ATI1N_UNorm: | 0 | ||||||||||||||||||
| 661 | case QOpenGLTexture::R_ATI1N_SNorm: never executed: case QOpenGLTexture::R_ATI1N_SNorm: | 0 | ||||||||||||||||||
| 662 | case QOpenGLTexture::RG_ATI2N_UNorm: never executed: case QOpenGLTexture::RG_ATI2N_UNorm: | 0 | ||||||||||||||||||
| 663 | case QOpenGLTexture::RG_ATI2N_SNorm: never executed: case QOpenGLTexture::RG_ATI2N_SNorm: | 0 | ||||||||||||||||||
| 664 | case QOpenGLTexture::RGB_BP_UNSIGNED_FLOAT: never executed: case QOpenGLTexture::RGB_BP_UNSIGNED_FLOAT: | 0 | ||||||||||||||||||
| 665 | case QOpenGLTexture::RGB_BP_SIGNED_FLOAT: never executed: case QOpenGLTexture::RGB_BP_SIGNED_FLOAT: | 0 | ||||||||||||||||||
| 666 | case QOpenGLTexture::RGB_BP_UNorm: never executed: case QOpenGLTexture::RGB_BP_UNorm: | 0 | ||||||||||||||||||
| 667 | case QOpenGLTexture::SRGB8: never executed: case QOpenGLTexture::SRGB8: | 0 | ||||||||||||||||||
| 668 | case QOpenGLTexture::SRGB8_Alpha8: never executed: case QOpenGLTexture::SRGB8_Alpha8: | 0 | ||||||||||||||||||
| 669 | case QOpenGLTexture::SRGB_DXT1: never executed: case QOpenGLTexture::SRGB_DXT1: | 0 | ||||||||||||||||||
| 670 | case QOpenGLTexture::SRGB_Alpha_DXT1: never executed: case QOpenGLTexture::SRGB_Alpha_DXT1: | 0 | ||||||||||||||||||
| 671 | case QOpenGLTexture::SRGB_Alpha_DXT3: never executed: case QOpenGLTexture::SRGB_Alpha_DXT3: | 0 | ||||||||||||||||||
| 672 | case QOpenGLTexture::SRGB_Alpha_DXT5: never executed: case QOpenGLTexture::SRGB_Alpha_DXT5: | 0 | ||||||||||||||||||
| 673 | case QOpenGLTexture::SRGB_BP_UNorm: never executed: case QOpenGLTexture::SRGB_BP_UNorm: | 0 | ||||||||||||||||||
| 674 | case QOpenGLTexture::RGB8_ETC1: never executed: case QOpenGLTexture::RGB8_ETC1: | 0 | ||||||||||||||||||
| 675 | return QOpenGLTexture::RGBA; never executed: return QOpenGLTexture::RGBA; | 0 | ||||||||||||||||||
| 676 | - | |||||||||||||||||||
| 677 | case QOpenGLTexture::R11_EAC_UNorm: never executed: case QOpenGLTexture::R11_EAC_UNorm: | 0 | ||||||||||||||||||
| 678 | case QOpenGLTexture::R11_EAC_SNorm: never executed: case QOpenGLTexture::R11_EAC_SNorm: | 0 | ||||||||||||||||||
| 679 | return QOpenGLTexture::Red; never executed: return QOpenGLTexture::Red; | 0 | ||||||||||||||||||
| 680 | - | |||||||||||||||||||
| 681 | case QOpenGLTexture::RG11_EAC_UNorm: never executed: case QOpenGLTexture::RG11_EAC_UNorm: | 0 | ||||||||||||||||||
| 682 | case QOpenGLTexture::RG11_EAC_SNorm: never executed: case QOpenGLTexture::RG11_EAC_SNorm: | 0 | ||||||||||||||||||
| 683 | return QOpenGLTexture::RG; never executed: return QOpenGLTexture::RG; | 0 | ||||||||||||||||||
| 684 | - | |||||||||||||||||||
| 685 | case QOpenGLTexture::RGB8_ETC2: never executed: case QOpenGLTexture::RGB8_ETC2: | 0 | ||||||||||||||||||
| 686 | case QOpenGLTexture::SRGB8_ETC2: never executed: case QOpenGLTexture::SRGB8_ETC2: | 0 | ||||||||||||||||||
| 687 | return QOpenGLTexture::RGB; never executed: return QOpenGLTexture::RGB; | 0 | ||||||||||||||||||
| 688 | - | |||||||||||||||||||
| 689 | case QOpenGLTexture::RGB8_PunchThrough_Alpha1_ETC2: never executed: case QOpenGLTexture::RGB8_PunchThrough_Alpha1_ETC2: | 0 | ||||||||||||||||||
| 690 | case QOpenGLTexture::SRGB8_PunchThrough_Alpha1_ETC2: never executed: case QOpenGLTexture::SRGB8_PunchThrough_Alpha1_ETC2: | 0 | ||||||||||||||||||
| 691 | return QOpenGLTexture::RGBA; never executed: return QOpenGLTexture::RGBA; | 0 | ||||||||||||||||||
| 692 | - | |||||||||||||||||||
| 693 | case QOpenGLTexture::RGBA8_ETC2_EAC: never executed: case QOpenGLTexture::RGBA8_ETC2_EAC: | 0 | ||||||||||||||||||
| 694 | case QOpenGLTexture::SRGB8_Alpha8_ETC2_EAC: never executed: case QOpenGLTexture::SRGB8_Alpha8_ETC2_EAC: | 0 | ||||||||||||||||||
| 695 | return QOpenGLTexture::RGBA; never executed: return QOpenGLTexture::RGBA; | 0 | ||||||||||||||||||
| 696 | - | |||||||||||||||||||
| 697 | case QOpenGLTexture::DepthFormat: never executed: case QOpenGLTexture::DepthFormat: | 0 | ||||||||||||||||||
| 698 | return QOpenGLTexture::Depth; never executed: return QOpenGLTexture::Depth; | 0 | ||||||||||||||||||
| 699 | - | |||||||||||||||||||
| 700 | case QOpenGLTexture::AlphaFormat: never executed: case QOpenGLTexture::AlphaFormat: | 0 | ||||||||||||||||||
| 701 | return QOpenGLTexture::Alpha; never executed: return QOpenGLTexture::Alpha; | 0 | ||||||||||||||||||
| 702 | - | |||||||||||||||||||
| 703 | case QOpenGLTexture::RGBFormat: never executed: case QOpenGLTexture::RGBFormat: | 0 | ||||||||||||||||||
| 704 | case QOpenGLTexture::RGBAFormat: never executed: case QOpenGLTexture::RGBAFormat: | 0 | ||||||||||||||||||
| 705 | return QOpenGLTexture::RGBA; never executed: return QOpenGLTexture::RGBA; | 0 | ||||||||||||||||||
| 706 | - | |||||||||||||||||||
| 707 | case QOpenGLTexture::LuminanceFormat: never executed: case QOpenGLTexture::LuminanceFormat: | 0 | ||||||||||||||||||
| 708 | return QOpenGLTexture::Luminance; never executed: return QOpenGLTexture::Luminance; | 0 | ||||||||||||||||||
| 709 | - | |||||||||||||||||||
| 710 | case QOpenGLTexture::LuminanceAlphaFormat: never executed: case QOpenGLTexture::LuminanceAlphaFormat: | 0 | ||||||||||||||||||
| 711 | return QOpenGLTexture::LuminanceAlpha; never executed: return QOpenGLTexture::LuminanceAlpha; | 0 | ||||||||||||||||||
| 712 | } | - | ||||||||||||||||||
| 713 | - | |||||||||||||||||||
| 714 | Q_UNREACHABLE(); | - | ||||||||||||||||||
| 715 | return QOpenGLTexture::NoSourceFormat; never executed: return QOpenGLTexture::NoSourceFormat; | 0 | ||||||||||||||||||
| 716 | } | - | ||||||||||||||||||
| 717 | - | |||||||||||||||||||
| 718 | static QOpenGLTexture::PixelType pixelTypeCompatibleWithInternalFormat(QOpenGLTexture::TextureFormat internalFormat) | - | ||||||||||||||||||
| 719 | { | - | ||||||||||||||||||
| 720 | switch (internalFormat) { | - | ||||||||||||||||||
| 721 | case QOpenGLTexture::NoFormat: never executed: case QOpenGLTexture::NoFormat: | 0 | ||||||||||||||||||
| 722 | return QOpenGLTexture::NoPixelType; never executed: return QOpenGLTexture::NoPixelType; | 0 | ||||||||||||||||||
| 723 | - | |||||||||||||||||||
| 724 | case QOpenGLTexture::R8_UNorm: never executed: case QOpenGLTexture::R8_UNorm: | 0 | ||||||||||||||||||
| 725 | case QOpenGLTexture::RG8_UNorm: never executed: case QOpenGLTexture::RG8_UNorm: | 0 | ||||||||||||||||||
| 726 | case QOpenGLTexture::RGB8_UNorm: never executed: case QOpenGLTexture::RGB8_UNorm: | 0 | ||||||||||||||||||
| 727 | case QOpenGLTexture::RGBA8_UNorm: never executed: case QOpenGLTexture::RGBA8_UNorm: | 0 | ||||||||||||||||||
| 728 | case QOpenGLTexture::R16_UNorm: never executed: case QOpenGLTexture::R16_UNorm: | 0 | ||||||||||||||||||
| 729 | case QOpenGLTexture::RG16_UNorm: never executed: case QOpenGLTexture::RG16_UNorm: | 0 | ||||||||||||||||||
| 730 | case QOpenGLTexture::RGB16_UNorm: never executed: case QOpenGLTexture::RGB16_UNorm: | 0 | ||||||||||||||||||
| 731 | case QOpenGLTexture::RGBA16_UNorm: never executed: case QOpenGLTexture::RGBA16_UNorm: | 0 | ||||||||||||||||||
| 732 | return QOpenGLTexture::UInt8; never executed: return QOpenGLTexture::UInt8; | 0 | ||||||||||||||||||
| 733 | - | |||||||||||||||||||
| 734 | case QOpenGLTexture::R8_SNorm: never executed: case QOpenGLTexture::R8_SNorm: | 0 | ||||||||||||||||||
| 735 | case QOpenGLTexture::RG8_SNorm: never executed: case QOpenGLTexture::RG8_SNorm: | 0 | ||||||||||||||||||
| 736 | case QOpenGLTexture::RGB8_SNorm: never executed: case QOpenGLTexture::RGB8_SNorm: | 0 | ||||||||||||||||||
| 737 | case QOpenGLTexture::RGBA8_SNorm: never executed: case QOpenGLTexture::RGBA8_SNorm: | 0 | ||||||||||||||||||
| 738 | case QOpenGLTexture::R16_SNorm: never executed: case QOpenGLTexture::R16_SNorm: | 0 | ||||||||||||||||||
| 739 | case QOpenGLTexture::RG16_SNorm: never executed: case QOpenGLTexture::RG16_SNorm: | 0 | ||||||||||||||||||
| 740 | case QOpenGLTexture::RGB16_SNorm: never executed: case QOpenGLTexture::RGB16_SNorm: | 0 | ||||||||||||||||||
| 741 | case QOpenGLTexture::RGBA16_SNorm: never executed: case QOpenGLTexture::RGBA16_SNorm: | 0 | ||||||||||||||||||
| 742 | return QOpenGLTexture::Int8; never executed: return QOpenGLTexture::Int8; | 0 | ||||||||||||||||||
| 743 | - | |||||||||||||||||||
| 744 | case QOpenGLTexture::R8U: never executed: case QOpenGLTexture::R8U: | 0 | ||||||||||||||||||
| 745 | case QOpenGLTexture::RG8U: never executed: case QOpenGLTexture::RG8U: | 0 | ||||||||||||||||||
| 746 | case QOpenGLTexture::RGB8U: never executed: case QOpenGLTexture::RGB8U: | 0 | ||||||||||||||||||
| 747 | case QOpenGLTexture::RGBA8U: never executed: case QOpenGLTexture::RGBA8U: | 0 | ||||||||||||||||||
| 748 | case QOpenGLTexture::R16U: never executed: case QOpenGLTexture::R16U: | 0 | ||||||||||||||||||
| 749 | case QOpenGLTexture::RG16U: never executed: case QOpenGLTexture::RG16U: | 0 | ||||||||||||||||||
| 750 | case QOpenGLTexture::RGB16U: never executed: case QOpenGLTexture::RGB16U: | 0 | ||||||||||||||||||
| 751 | case QOpenGLTexture::RGBA16U: never executed: case QOpenGLTexture::RGBA16U: | 0 | ||||||||||||||||||
| 752 | case QOpenGLTexture::R32U: never executed: case QOpenGLTexture::R32U: | 0 | ||||||||||||||||||
| 753 | case QOpenGLTexture::RG32U: never executed: case QOpenGLTexture::RG32U: | 0 | ||||||||||||||||||
| 754 | case QOpenGLTexture::RGB32U: never executed: case QOpenGLTexture::RGB32U: | 0 | ||||||||||||||||||
| 755 | case QOpenGLTexture::RGBA32U: never executed: case QOpenGLTexture::RGBA32U: | 0 | ||||||||||||||||||
| 756 | return QOpenGLTexture::UInt8; never executed: return QOpenGLTexture::UInt8; | 0 | ||||||||||||||||||
| 757 | - | |||||||||||||||||||
| 758 | case QOpenGLTexture::R8I: never executed: case QOpenGLTexture::R8I: | 0 | ||||||||||||||||||
| 759 | case QOpenGLTexture::RG8I: never executed: case QOpenGLTexture::RG8I: | 0 | ||||||||||||||||||
| 760 | case QOpenGLTexture::RGB8I: never executed: case QOpenGLTexture::RGB8I: | 0 | ||||||||||||||||||
| 761 | case QOpenGLTexture::RGBA8I: never executed: case QOpenGLTexture::RGBA8I: | 0 | ||||||||||||||||||
| 762 | case QOpenGLTexture::R16I: never executed: case QOpenGLTexture::R16I: | 0 | ||||||||||||||||||
| 763 | case QOpenGLTexture::RG16I: never executed: case QOpenGLTexture::RG16I: | 0 | ||||||||||||||||||
| 764 | case QOpenGLTexture::RGB16I: never executed: case QOpenGLTexture::RGB16I: | 0 | ||||||||||||||||||
| 765 | case QOpenGLTexture::RGBA16I: never executed: case QOpenGLTexture::RGBA16I: | 0 | ||||||||||||||||||
| 766 | case QOpenGLTexture::R32I: never executed: case QOpenGLTexture::R32I: | 0 | ||||||||||||||||||
| 767 | case QOpenGLTexture::RG32I: never executed: case QOpenGLTexture::RG32I: | 0 | ||||||||||||||||||
| 768 | case QOpenGLTexture::RGB32I: never executed: case QOpenGLTexture::RGB32I: | 0 | ||||||||||||||||||
| 769 | case QOpenGLTexture::RGBA32I: never executed: case QOpenGLTexture::RGBA32I: | 0 | ||||||||||||||||||
| 770 | return QOpenGLTexture::Int8; never executed: return QOpenGLTexture::Int8; | 0 | ||||||||||||||||||
| 771 | - | |||||||||||||||||||
| 772 | case QOpenGLTexture::R16F: never executed: case QOpenGLTexture::R16F: | 0 | ||||||||||||||||||
| 773 | case QOpenGLTexture::RG16F: never executed: case QOpenGLTexture::RG16F: | 0 | ||||||||||||||||||
| 774 | case QOpenGLTexture::RGB16F: never executed: case QOpenGLTexture::RGB16F: | 0 | ||||||||||||||||||
| 775 | case QOpenGLTexture::RGBA16F: never executed: case QOpenGLTexture::RGBA16F: | 0 | ||||||||||||||||||
| 776 | return QOpenGLTexture::Float16; never executed: return QOpenGLTexture::Float16; | 0 | ||||||||||||||||||
| 777 | - | |||||||||||||||||||
| 778 | case QOpenGLTexture::R32F: never executed: case QOpenGLTexture::R32F: | 0 | ||||||||||||||||||
| 779 | case QOpenGLTexture::RG32F: never executed: case QOpenGLTexture::RG32F: | 0 | ||||||||||||||||||
| 780 | case QOpenGLTexture::RGB32F: never executed: case QOpenGLTexture::RGB32F: | 0 | ||||||||||||||||||
| 781 | case QOpenGLTexture::RGBA32F: never executed: case QOpenGLTexture::RGBA32F: | 0 | ||||||||||||||||||
| 782 | return QOpenGLTexture::Float32; never executed: return QOpenGLTexture::Float32; | 0 | ||||||||||||||||||
| 783 | - | |||||||||||||||||||
| 784 | case QOpenGLTexture::RGB9E5: never executed: case QOpenGLTexture::RGB9E5: | 0 | ||||||||||||||||||
| 785 | return QOpenGLTexture::UInt16_RGB5A1_Rev; never executed: return QOpenGLTexture::UInt16_RGB5A1_Rev; | 0 | ||||||||||||||||||
| 786 | - | |||||||||||||||||||
| 787 | case QOpenGLTexture::RG11B10F: never executed: case QOpenGLTexture::RG11B10F: | 0 | ||||||||||||||||||
| 788 | return QOpenGLTexture::UInt32_RG11B10F; never executed: return QOpenGLTexture::UInt32_RG11B10F; | 0 | ||||||||||||||||||
| 789 | - | |||||||||||||||||||
| 790 | case QOpenGLTexture::RG3B2: never executed: case QOpenGLTexture::RG3B2: | 0 | ||||||||||||||||||
| 791 | return QOpenGLTexture::UInt8_RG3B2; never executed: return QOpenGLTexture::UInt8_RG3B2; | 0 | ||||||||||||||||||
| 792 | - | |||||||||||||||||||
| 793 | case QOpenGLTexture::R5G6B5: never executed: case QOpenGLTexture::R5G6B5: | 0 | ||||||||||||||||||
| 794 | return QOpenGLTexture::UInt16_R5G6B5; never executed: return QOpenGLTexture::UInt16_R5G6B5; | 0 | ||||||||||||||||||
| 795 | - | |||||||||||||||||||
| 796 | case QOpenGLTexture::RGB5A1: never executed: case QOpenGLTexture::RGB5A1: | 0 | ||||||||||||||||||
| 797 | return QOpenGLTexture::UInt16_RGB5A1; never executed: return QOpenGLTexture::UInt16_RGB5A1; | 0 | ||||||||||||||||||
| 798 | - | |||||||||||||||||||
| 799 | case QOpenGLTexture::RGBA4: never executed: case QOpenGLTexture::RGBA4: | 0 | ||||||||||||||||||
| 800 | return QOpenGLTexture::UInt16_RGBA4; never executed: return QOpenGLTexture::UInt16_RGBA4; | 0 | ||||||||||||||||||
| 801 | - | |||||||||||||||||||
| 802 | case QOpenGLTexture::RGB10A2: never executed: case QOpenGLTexture::RGB10A2: | 0 | ||||||||||||||||||
| 803 | return QOpenGLTexture::UInt32_RGB10A2; never executed: return QOpenGLTexture::UInt32_RGB10A2; | 0 | ||||||||||||||||||
| 804 | - | |||||||||||||||||||
| 805 | case QOpenGLTexture::D16: never executed: case QOpenGLTexture::D16: | 0 | ||||||||||||||||||
| 806 | return QOpenGLTexture::UInt16; never executed: return QOpenGLTexture::UInt16; | 0 | ||||||||||||||||||
| 807 | - | |||||||||||||||||||
| 808 | case QOpenGLTexture::D24: never executed: case QOpenGLTexture::D24: | 0 | ||||||||||||||||||
| 809 | case QOpenGLTexture::D32: never executed: case QOpenGLTexture::D32: | 0 | ||||||||||||||||||
| 810 | return QOpenGLTexture::UInt32; never executed: return QOpenGLTexture::UInt32; | 0 | ||||||||||||||||||
| 811 | - | |||||||||||||||||||
| 812 | case QOpenGLTexture::D32F: never executed: case QOpenGLTexture::D32F: | 0 | ||||||||||||||||||
| 813 | return QOpenGLTexture::Float32; never executed: return QOpenGLTexture::Float32; | 0 | ||||||||||||||||||
| 814 | - | |||||||||||||||||||
| 815 | case QOpenGLTexture::D24S8: never executed: case QOpenGLTexture::D24S8: | 0 | ||||||||||||||||||
| 816 | return QOpenGLTexture::UInt32_D24S8; never executed: return QOpenGLTexture::UInt32_D24S8; | 0 | ||||||||||||||||||
| 817 | - | |||||||||||||||||||
| 818 | case QOpenGLTexture::D32FS8X24: never executed: case QOpenGLTexture::D32FS8X24: | 0 | ||||||||||||||||||
| 819 | return QOpenGLTexture::Float32_D32_UInt32_S8_X24; never executed: return QOpenGLTexture::Float32_D32_UInt32_S8_X24; | 0 | ||||||||||||||||||
| 820 | - | |||||||||||||||||||
| 821 | case QOpenGLTexture::S8: never executed: case QOpenGLTexture::S8: | 0 | ||||||||||||||||||
| 822 | return QOpenGLTexture::UInt8; never executed: return QOpenGLTexture::UInt8; | 0 | ||||||||||||||||||
| 823 | - | |||||||||||||||||||
| 824 | case QOpenGLTexture::RGB_DXT1: never executed: case QOpenGLTexture::RGB_DXT1: | 0 | ||||||||||||||||||
| 825 | case QOpenGLTexture::RGBA_DXT1: never executed: case QOpenGLTexture::RGBA_DXT1: | 0 | ||||||||||||||||||
| 826 | case QOpenGLTexture::RGBA_DXT3: never executed: case QOpenGLTexture::RGBA_DXT3: | 0 | ||||||||||||||||||
| 827 | case QOpenGLTexture::RGBA_DXT5: never executed: case QOpenGLTexture::RGBA_DXT5: | 0 | ||||||||||||||||||
| 828 | case QOpenGLTexture::R_ATI1N_UNorm: never executed: case QOpenGLTexture::R_ATI1N_UNorm: | 0 | ||||||||||||||||||
| 829 | case QOpenGLTexture::R_ATI1N_SNorm: never executed: case QOpenGLTexture::R_ATI1N_SNorm: | 0 | ||||||||||||||||||
| 830 | case QOpenGLTexture::RG_ATI2N_UNorm: never executed: case QOpenGLTexture::RG_ATI2N_UNorm: | 0 | ||||||||||||||||||
| 831 | case QOpenGLTexture::RG_ATI2N_SNorm: never executed: case QOpenGLTexture::RG_ATI2N_SNorm: | 0 | ||||||||||||||||||
| 832 | case QOpenGLTexture::RGB_BP_UNSIGNED_FLOAT: never executed: case QOpenGLTexture::RGB_BP_UNSIGNED_FLOAT: | 0 | ||||||||||||||||||
| 833 | case QOpenGLTexture::RGB_BP_SIGNED_FLOAT: never executed: case QOpenGLTexture::RGB_BP_SIGNED_FLOAT: | 0 | ||||||||||||||||||
| 834 | case QOpenGLTexture::RGB_BP_UNorm: never executed: case QOpenGLTexture::RGB_BP_UNorm: | 0 | ||||||||||||||||||
| 835 | case QOpenGLTexture::SRGB8: never executed: case QOpenGLTexture::SRGB8: | 0 | ||||||||||||||||||
| 836 | case QOpenGLTexture::SRGB8_Alpha8: never executed: case QOpenGLTexture::SRGB8_Alpha8: | 0 | ||||||||||||||||||
| 837 | case QOpenGLTexture::SRGB_DXT1: never executed: case QOpenGLTexture::SRGB_DXT1: | 0 | ||||||||||||||||||
| 838 | case QOpenGLTexture::SRGB_Alpha_DXT1: never executed: case QOpenGLTexture::SRGB_Alpha_DXT1: | 0 | ||||||||||||||||||
| 839 | case QOpenGLTexture::SRGB_Alpha_DXT3: never executed: case QOpenGLTexture::SRGB_Alpha_DXT3: | 0 | ||||||||||||||||||
| 840 | case QOpenGLTexture::SRGB_Alpha_DXT5: never executed: case QOpenGLTexture::SRGB_Alpha_DXT5: | 0 | ||||||||||||||||||
| 841 | case QOpenGLTexture::SRGB_BP_UNorm: never executed: case QOpenGLTexture::SRGB_BP_UNorm: | 0 | ||||||||||||||||||
| 842 | case QOpenGLTexture::R11_EAC_UNorm: never executed: case QOpenGLTexture::R11_EAC_UNorm: | 0 | ||||||||||||||||||
| 843 | case QOpenGLTexture::R11_EAC_SNorm: never executed: case QOpenGLTexture::R11_EAC_SNorm: | 0 | ||||||||||||||||||
| 844 | case QOpenGLTexture::RG11_EAC_UNorm: never executed: case QOpenGLTexture::RG11_EAC_UNorm: | 0 | ||||||||||||||||||
| 845 | case QOpenGLTexture::RG11_EAC_SNorm: never executed: case QOpenGLTexture::RG11_EAC_SNorm: | 0 | ||||||||||||||||||
| 846 | case QOpenGLTexture::RGB8_ETC2: never executed: case QOpenGLTexture::RGB8_ETC2: | 0 | ||||||||||||||||||
| 847 | case QOpenGLTexture::SRGB8_ETC2: never executed: case QOpenGLTexture::SRGB8_ETC2: | 0 | ||||||||||||||||||
| 848 | case QOpenGLTexture::RGB8_PunchThrough_Alpha1_ETC2: never executed: case QOpenGLTexture::RGB8_PunchThrough_Alpha1_ETC2: | 0 | ||||||||||||||||||
| 849 | case QOpenGLTexture::SRGB8_PunchThrough_Alpha1_ETC2: never executed: case QOpenGLTexture::SRGB8_PunchThrough_Alpha1_ETC2: | 0 | ||||||||||||||||||
| 850 | case QOpenGLTexture::RGBA8_ETC2_EAC: never executed: case QOpenGLTexture::RGBA8_ETC2_EAC: | 0 | ||||||||||||||||||
| 851 | case QOpenGLTexture::SRGB8_Alpha8_ETC2_EAC: never executed: case QOpenGLTexture::SRGB8_Alpha8_ETC2_EAC: | 0 | ||||||||||||||||||
| 852 | case QOpenGLTexture::RGB8_ETC1: never executed: case QOpenGLTexture::RGB8_ETC1: | 0 | ||||||||||||||||||
| 853 | return QOpenGLTexture::UInt8; never executed: return QOpenGLTexture::UInt8; | 0 | ||||||||||||||||||
| 854 | - | |||||||||||||||||||
| 855 | case QOpenGLTexture::DepthFormat: never executed: case QOpenGLTexture::DepthFormat: | 0 | ||||||||||||||||||
| 856 | return QOpenGLTexture::UInt32; never executed: return QOpenGLTexture::UInt32; | 0 | ||||||||||||||||||
| 857 | - | |||||||||||||||||||
| 858 | case QOpenGLTexture::AlphaFormat: never executed: case QOpenGLTexture::AlphaFormat: | 0 | ||||||||||||||||||
| 859 | case QOpenGLTexture::RGBFormat: never executed: case QOpenGLTexture::RGBFormat: | 0 | ||||||||||||||||||
| 860 | case QOpenGLTexture::RGBAFormat: never executed: case QOpenGLTexture::RGBAFormat: | 0 | ||||||||||||||||||
| 861 | case QOpenGLTexture::LuminanceFormat: never executed: case QOpenGLTexture::LuminanceFormat: | 0 | ||||||||||||||||||
| 862 | case QOpenGLTexture::LuminanceAlphaFormat: never executed: case QOpenGLTexture::LuminanceAlphaFormat: | 0 | ||||||||||||||||||
| 863 | return QOpenGLTexture::UInt8; never executed: return QOpenGLTexture::UInt8; | 0 | ||||||||||||||||||
| 864 | } | - | ||||||||||||||||||
| 865 | - | |||||||||||||||||||
| 866 | Q_UNREACHABLE(); | - | ||||||||||||||||||
| 867 | return QOpenGLTexture::NoPixelType; never executed: return QOpenGLTexture::NoPixelType; | 0 | ||||||||||||||||||
| 868 | } | - | ||||||||||||||||||
| 869 | - | |||||||||||||||||||
| 870 | static bool isCompressedFormat(QOpenGLTexture::TextureFormat internalFormat) | - | ||||||||||||||||||
| 871 | { | - | ||||||||||||||||||
| 872 | switch (internalFormat) { | - | ||||||||||||||||||
| 873 | case QOpenGLTexture::NoFormat: never executed: case QOpenGLTexture::NoFormat: | 0 | ||||||||||||||||||
| 874 | - | |||||||||||||||||||
| 875 | case QOpenGLTexture::R8_UNorm: never executed: case QOpenGLTexture::R8_UNorm: | 0 | ||||||||||||||||||
| 876 | case QOpenGLTexture::RG8_UNorm: never executed: case QOpenGLTexture::RG8_UNorm: | 0 | ||||||||||||||||||
| 877 | case QOpenGLTexture::RGB8_UNorm: never executed: case QOpenGLTexture::RGB8_UNorm: | 0 | ||||||||||||||||||
| 878 | case QOpenGLTexture::RGBA8_UNorm: never executed: case QOpenGLTexture::RGBA8_UNorm: | 0 | ||||||||||||||||||
| 879 | case QOpenGLTexture::R16_UNorm: never executed: case QOpenGLTexture::R16_UNorm: | 0 | ||||||||||||||||||
| 880 | case QOpenGLTexture::RG16_UNorm: never executed: case QOpenGLTexture::RG16_UNorm: | 0 | ||||||||||||||||||
| 881 | case QOpenGLTexture::RGB16_UNorm: never executed: case QOpenGLTexture::RGB16_UNorm: | 0 | ||||||||||||||||||
| 882 | case QOpenGLTexture::RGBA16_UNorm: never executed: case QOpenGLTexture::RGBA16_UNorm: | 0 | ||||||||||||||||||
| 883 | case QOpenGLTexture::R8_SNorm: never executed: case QOpenGLTexture::R8_SNorm: | 0 | ||||||||||||||||||
| 884 | case QOpenGLTexture::RG8_SNorm: never executed: case QOpenGLTexture::RG8_SNorm: | 0 | ||||||||||||||||||
| 885 | case QOpenGLTexture::RGB8_SNorm: never executed: case QOpenGLTexture::RGB8_SNorm: | 0 | ||||||||||||||||||
| 886 | case QOpenGLTexture::RGBA8_SNorm: never executed: case QOpenGLTexture::RGBA8_SNorm: | 0 | ||||||||||||||||||
| 887 | case QOpenGLTexture::R16_SNorm: never executed: case QOpenGLTexture::R16_SNorm: | 0 | ||||||||||||||||||
| 888 | case QOpenGLTexture::RG16_SNorm: never executed: case QOpenGLTexture::RG16_SNorm: | 0 | ||||||||||||||||||
| 889 | case QOpenGLTexture::RGB16_SNorm: never executed: case QOpenGLTexture::RGB16_SNorm: | 0 | ||||||||||||||||||
| 890 | case QOpenGLTexture::RGBA16_SNorm: never executed: case QOpenGLTexture::RGBA16_SNorm: | 0 | ||||||||||||||||||
| 891 | case QOpenGLTexture::R8U: never executed: case QOpenGLTexture::R8U: | 0 | ||||||||||||||||||
| 892 | case QOpenGLTexture::RG8U: never executed: case QOpenGLTexture::RG8U: | 0 | ||||||||||||||||||
| 893 | case QOpenGLTexture::RGB8U: never executed: case QOpenGLTexture::RGB8U: | 0 | ||||||||||||||||||
| 894 | case QOpenGLTexture::RGBA8U: never executed: case QOpenGLTexture::RGBA8U: | 0 | ||||||||||||||||||
| 895 | case QOpenGLTexture::R16U: never executed: case QOpenGLTexture::R16U: | 0 | ||||||||||||||||||
| 896 | case QOpenGLTexture::RG16U: never executed: case QOpenGLTexture::RG16U: | 0 | ||||||||||||||||||
| 897 | case QOpenGLTexture::RGB16U: never executed: case QOpenGLTexture::RGB16U: | 0 | ||||||||||||||||||
| 898 | case QOpenGLTexture::RGBA16U: never executed: case QOpenGLTexture::RGBA16U: | 0 | ||||||||||||||||||
| 899 | case QOpenGLTexture::R32U: never executed: case QOpenGLTexture::R32U: | 0 | ||||||||||||||||||
| 900 | case QOpenGLTexture::RG32U: never executed: case QOpenGLTexture::RG32U: | 0 | ||||||||||||||||||
| 901 | case QOpenGLTexture::RGB32U: never executed: case QOpenGLTexture::RGB32U: | 0 | ||||||||||||||||||
| 902 | case QOpenGLTexture::RGBA32U: never executed: case QOpenGLTexture::RGBA32U: | 0 | ||||||||||||||||||
| 903 | case QOpenGLTexture::R8I: never executed: case QOpenGLTexture::R8I: | 0 | ||||||||||||||||||
| 904 | case QOpenGLTexture::RG8I: never executed: case QOpenGLTexture::RG8I: | 0 | ||||||||||||||||||
| 905 | case QOpenGLTexture::RGB8I: never executed: case QOpenGLTexture::RGB8I: | 0 | ||||||||||||||||||
| 906 | case QOpenGLTexture::RGBA8I: never executed: case QOpenGLTexture::RGBA8I: | 0 | ||||||||||||||||||
| 907 | case QOpenGLTexture::R16I: never executed: case QOpenGLTexture::R16I: | 0 | ||||||||||||||||||
| 908 | case QOpenGLTexture::RG16I: never executed: case QOpenGLTexture::RG16I: | 0 | ||||||||||||||||||
| 909 | case QOpenGLTexture::RGB16I: never executed: case QOpenGLTexture::RGB16I: | 0 | ||||||||||||||||||
| 910 | case QOpenGLTexture::RGBA16I: never executed: case QOpenGLTexture::RGBA16I: | 0 | ||||||||||||||||||
| 911 | case QOpenGLTexture::R32I: never executed: case QOpenGLTexture::R32I: | 0 | ||||||||||||||||||
| 912 | case QOpenGLTexture::RG32I: never executed: case QOpenGLTexture::RG32I: | 0 | ||||||||||||||||||
| 913 | case QOpenGLTexture::RGB32I: never executed: case QOpenGLTexture::RGB32I: | 0 | ||||||||||||||||||
| 914 | case QOpenGLTexture::RGBA32I: never executed: case QOpenGLTexture::RGBA32I: | 0 | ||||||||||||||||||
| 915 | case QOpenGLTexture::R16F: never executed: case QOpenGLTexture::R16F: | 0 | ||||||||||||||||||
| 916 | case QOpenGLTexture::RG16F: never executed: case QOpenGLTexture::RG16F: | 0 | ||||||||||||||||||
| 917 | case QOpenGLTexture::RGB16F: never executed: case QOpenGLTexture::RGB16F: | 0 | ||||||||||||||||||
| 918 | case QOpenGLTexture::RGBA16F: never executed: case QOpenGLTexture::RGBA16F: | 0 | ||||||||||||||||||
| 919 | case QOpenGLTexture::R32F: never executed: case QOpenGLTexture::R32F: | 0 | ||||||||||||||||||
| 920 | case QOpenGLTexture::RG32F: never executed: case QOpenGLTexture::RG32F: | 0 | ||||||||||||||||||
| 921 | case QOpenGLTexture::RGB32F: never executed: case QOpenGLTexture::RGB32F: | 0 | ||||||||||||||||||
| 922 | case QOpenGLTexture::RGBA32F: never executed: case QOpenGLTexture::RGBA32F: | 0 | ||||||||||||||||||
| 923 | case QOpenGLTexture::RGB9E5: never executed: case QOpenGLTexture::RGB9E5: | 0 | ||||||||||||||||||
| 924 | case QOpenGLTexture::RG11B10F: never executed: case QOpenGLTexture::RG11B10F: | 0 | ||||||||||||||||||
| 925 | case QOpenGLTexture::RG3B2: never executed: case QOpenGLTexture::RG3B2: | 0 | ||||||||||||||||||
| 926 | case QOpenGLTexture::R5G6B5: never executed: case QOpenGLTexture::R5G6B5: | 0 | ||||||||||||||||||
| 927 | case QOpenGLTexture::RGB5A1: never executed: case QOpenGLTexture::RGB5A1: | 0 | ||||||||||||||||||
| 928 | case QOpenGLTexture::RGBA4: never executed: case QOpenGLTexture::RGBA4: | 0 | ||||||||||||||||||
| 929 | case QOpenGLTexture::RGB10A2: never executed: case QOpenGLTexture::RGB10A2: | 0 | ||||||||||||||||||
| 930 | - | |||||||||||||||||||
| 931 | case QOpenGLTexture::D16: never executed: case QOpenGLTexture::D16: | 0 | ||||||||||||||||||
| 932 | case QOpenGLTexture::D24: never executed: case QOpenGLTexture::D24: | 0 | ||||||||||||||||||
| 933 | case QOpenGLTexture::D32: never executed: case QOpenGLTexture::D32: | 0 | ||||||||||||||||||
| 934 | case QOpenGLTexture::D32F: never executed: case QOpenGLTexture::D32F: | 0 | ||||||||||||||||||
| 935 | - | |||||||||||||||||||
| 936 | case QOpenGLTexture::D24S8: never executed: case QOpenGLTexture::D24S8: | 0 | ||||||||||||||||||
| 937 | case QOpenGLTexture::D32FS8X24: never executed: case QOpenGLTexture::D32FS8X24: | 0 | ||||||||||||||||||
| 938 | - | |||||||||||||||||||
| 939 | case QOpenGLTexture::S8: never executed: case QOpenGLTexture::S8: | 0 | ||||||||||||||||||
| 940 | return false; never executed: return false; | 0 | ||||||||||||||||||
| 941 | - | |||||||||||||||||||
| 942 | case QOpenGLTexture::RGB_DXT1: never executed: case QOpenGLTexture::RGB_DXT1: | 0 | ||||||||||||||||||
| 943 | case QOpenGLTexture::RGBA_DXT1: never executed: case QOpenGLTexture::RGBA_DXT1: | 0 | ||||||||||||||||||
| 944 | case QOpenGLTexture::RGBA_DXT3: never executed: case QOpenGLTexture::RGBA_DXT3: | 0 | ||||||||||||||||||
| 945 | case QOpenGLTexture::RGBA_DXT5: never executed: case QOpenGLTexture::RGBA_DXT5: | 0 | ||||||||||||||||||
| 946 | case QOpenGLTexture::R_ATI1N_UNorm: never executed: case QOpenGLTexture::R_ATI1N_UNorm: | 0 | ||||||||||||||||||
| 947 | case QOpenGLTexture::R_ATI1N_SNorm: never executed: case QOpenGLTexture::R_ATI1N_SNorm: | 0 | ||||||||||||||||||
| 948 | case QOpenGLTexture::RG_ATI2N_UNorm: never executed: case QOpenGLTexture::RG_ATI2N_UNorm: | 0 | ||||||||||||||||||
| 949 | case QOpenGLTexture::RG_ATI2N_SNorm: never executed: case QOpenGLTexture::RG_ATI2N_SNorm: | 0 | ||||||||||||||||||
| 950 | case QOpenGLTexture::RGB_BP_UNSIGNED_FLOAT: never executed: case QOpenGLTexture::RGB_BP_UNSIGNED_FLOAT: | 0 | ||||||||||||||||||
| 951 | case QOpenGLTexture::RGB_BP_SIGNED_FLOAT: never executed: case QOpenGLTexture::RGB_BP_SIGNED_FLOAT: | 0 | ||||||||||||||||||
| 952 | case QOpenGLTexture::RGB_BP_UNorm: never executed: case QOpenGLTexture::RGB_BP_UNorm: | 0 | ||||||||||||||||||
| 953 | case QOpenGLTexture::SRGB8: never executed: case QOpenGLTexture::SRGB8: | 0 | ||||||||||||||||||
| 954 | case QOpenGLTexture::SRGB8_Alpha8: never executed: case QOpenGLTexture::SRGB8_Alpha8: | 0 | ||||||||||||||||||
| 955 | case QOpenGLTexture::SRGB_DXT1: never executed: case QOpenGLTexture::SRGB_DXT1: | 0 | ||||||||||||||||||
| 956 | case QOpenGLTexture::SRGB_Alpha_DXT1: never executed: case QOpenGLTexture::SRGB_Alpha_DXT1: | 0 | ||||||||||||||||||
| 957 | case QOpenGLTexture::SRGB_Alpha_DXT3: never executed: case QOpenGLTexture::SRGB_Alpha_DXT3: | 0 | ||||||||||||||||||
| 958 | case QOpenGLTexture::SRGB_Alpha_DXT5: never executed: case QOpenGLTexture::SRGB_Alpha_DXT5: | 0 | ||||||||||||||||||
| 959 | case QOpenGLTexture::SRGB_BP_UNorm: never executed: case QOpenGLTexture::SRGB_BP_UNorm: | 0 | ||||||||||||||||||
| 960 | case QOpenGLTexture::R11_EAC_UNorm: never executed: case QOpenGLTexture::R11_EAC_UNorm: | 0 | ||||||||||||||||||
| 961 | case QOpenGLTexture::R11_EAC_SNorm: never executed: case QOpenGLTexture::R11_EAC_SNorm: | 0 | ||||||||||||||||||
| 962 | case QOpenGLTexture::RG11_EAC_UNorm: never executed: case QOpenGLTexture::RG11_EAC_UNorm: | 0 | ||||||||||||||||||
| 963 | case QOpenGLTexture::RG11_EAC_SNorm: never executed: case QOpenGLTexture::RG11_EAC_SNorm: | 0 | ||||||||||||||||||
| 964 | case QOpenGLTexture::RGB8_ETC2: never executed: case QOpenGLTexture::RGB8_ETC2: | 0 | ||||||||||||||||||
| 965 | case QOpenGLTexture::SRGB8_ETC2: never executed: case QOpenGLTexture::SRGB8_ETC2: | 0 | ||||||||||||||||||
| 966 | case QOpenGLTexture::RGB8_PunchThrough_Alpha1_ETC2: never executed: case QOpenGLTexture::RGB8_PunchThrough_Alpha1_ETC2: | 0 | ||||||||||||||||||
| 967 | case QOpenGLTexture::SRGB8_PunchThrough_Alpha1_ETC2: never executed: case QOpenGLTexture::SRGB8_PunchThrough_Alpha1_ETC2: | 0 | ||||||||||||||||||
| 968 | case QOpenGLTexture::RGBA8_ETC2_EAC: never executed: case QOpenGLTexture::RGBA8_ETC2_EAC: | 0 | ||||||||||||||||||
| 969 | case QOpenGLTexture::SRGB8_Alpha8_ETC2_EAC: never executed: case QOpenGLTexture::SRGB8_Alpha8_ETC2_EAC: | 0 | ||||||||||||||||||
| 970 | case QOpenGLTexture::RGB8_ETC1: never executed: case QOpenGLTexture::RGB8_ETC1: | 0 | ||||||||||||||||||
| 971 | return true; never executed: return true; | 0 | ||||||||||||||||||
| 972 | - | |||||||||||||||||||
| 973 | case QOpenGLTexture::DepthFormat: never executed: case QOpenGLTexture::DepthFormat: | 0 | ||||||||||||||||||
| 974 | case QOpenGLTexture::AlphaFormat: never executed: case QOpenGLTexture::AlphaFormat: | 0 | ||||||||||||||||||
| 975 | case QOpenGLTexture::RGBFormat: never executed: case QOpenGLTexture::RGBFormat: | 0 | ||||||||||||||||||
| 976 | case QOpenGLTexture::RGBAFormat: never executed: case QOpenGLTexture::RGBAFormat: | 0 | ||||||||||||||||||
| 977 | case QOpenGLTexture::LuminanceFormat: never executed: case QOpenGLTexture::LuminanceFormat: | 0 | ||||||||||||||||||
| 978 | case QOpenGLTexture::LuminanceAlphaFormat: never executed: case QOpenGLTexture::LuminanceAlphaFormat: | 0 | ||||||||||||||||||
| 979 | return false; never executed: return false; | 0 | ||||||||||||||||||
| 980 | } | - | ||||||||||||||||||
| 981 | - | |||||||||||||||||||
| 982 | Q_UNREACHABLE(); | - | ||||||||||||||||||
| 983 | return false; never executed: return false; | 0 | ||||||||||||||||||
| 984 | } | - | ||||||||||||||||||
| 985 | - | |||||||||||||||||||
| 986 | void QOpenGLTexturePrivate::allocateMutableStorage(QOpenGLTexture::PixelFormat pixelFormat, QOpenGLTexture::PixelType pixelType) | - | ||||||||||||||||||
| 987 | { | - | ||||||||||||||||||
| 988 | // There is no way to allocate mutable storage for compressed textures in in | - | ||||||||||||||||||
| 989 | // versions older than OpenGL 3.1 and OpenGL ES 3.0, because the older specs | - | ||||||||||||||||||
| 990 | // do not mandate accepting null data pointers for glCompressedTexImage*D, | - | ||||||||||||||||||
| 991 | // unlike glTexImage*D (which in turn does not accept compressed formats). | - | ||||||||||||||||||
| 992 | if (isCompressedFormat(format)) {
| 0 | ||||||||||||||||||
| 993 | storageAllocated = true; | - | ||||||||||||||||||
| 994 | return; never executed: return; | 0 | ||||||||||||||||||
| 995 | } | - | ||||||||||||||||||
| 996 | - | |||||||||||||||||||
| 997 | switch (target) { | - | ||||||||||||||||||
| 998 | case QOpenGLTexture::TargetBuffer: never executed: case QOpenGLTexture::TargetBuffer: | 0 | ||||||||||||||||||
| 999 | // Buffer textures get their storage from an external OpenGL buffer | - | ||||||||||||||||||
| 1000 | qWarning("Buffer textures do not allocate storage"); | - | ||||||||||||||||||
| 1001 | return; never executed: return; | 0 | ||||||||||||||||||
| 1002 | - | |||||||||||||||||||
| 1003 | case QOpenGLTexture::Target1D: never executed: case QOpenGLTexture::Target1D: | 0 | ||||||||||||||||||
| 1004 | if (features.testFlag(QOpenGLTexture::Texture1D)) {
| 0 | ||||||||||||||||||
| 1005 | for (int level = 0; level < mipLevels; ++level)
| 0 | ||||||||||||||||||
| 1006 | texFuncs->glTextureImage1D(textureId, target, bindingTarget, level, format, never executed: texFuncs->glTextureImage1D(textureId, target, bindingTarget, level, format, mipLevelSize(level, dimensions[0]), 0, pixelFormat, pixelType, 0); | 0 | ||||||||||||||||||
| 1007 | mipLevelSize(level, dimensions[0]), never executed: texFuncs->glTextureImage1D(textureId, target, bindingTarget, level, format, mipLevelSize(level, dimensions[0]), 0, pixelFormat, pixelType, 0); | 0 | ||||||||||||||||||
| 1008 | 0, never executed: texFuncs->glTextureImage1D(textureId, target, bindingTarget, level, format, mipLevelSize(level, dimensions[0]), 0, pixelFormat, pixelType, 0); | 0 | ||||||||||||||||||
| 1009 | pixelFormat, pixelType, 0); never executed: texFuncs->glTextureImage1D(textureId, target, bindingTarget, level, format, mipLevelSize(level, dimensions[0]), 0, pixelFormat, pixelType, 0); | 0 | ||||||||||||||||||
| 1010 | } else { never executed: end of block | 0 | ||||||||||||||||||
| 1011 | qWarning("1D textures are not supported"); | - | ||||||||||||||||||
| 1012 | return; never executed: return; | 0 | ||||||||||||||||||
| 1013 | } | - | ||||||||||||||||||
| 1014 | break; never executed: break; | 0 | ||||||||||||||||||
| 1015 | - | |||||||||||||||||||
| 1016 | case QOpenGLTexture::Target1DArray: never executed: case QOpenGLTexture::Target1DArray: | 0 | ||||||||||||||||||
| 1017 | if (features.testFlag(QOpenGLTexture::Texture1D)
| 0 | ||||||||||||||||||
| 1018 | && features.testFlag(QOpenGLTexture::TextureArrays)) {
| 0 | ||||||||||||||||||
| 1019 | for (int level = 0; level < mipLevels; ++level)
| 0 | ||||||||||||||||||
| 1020 | texFuncs->glTextureImage2D(textureId, target, bindingTarget, level, format, never executed: texFuncs->glTextureImage2D(textureId, target, bindingTarget, level, format, mipLevelSize(level, dimensions[0]), layers, 0, pixelFormat, pixelType, 0); | 0 | ||||||||||||||||||
| 1021 | mipLevelSize(level, dimensions[0]), never executed: texFuncs->glTextureImage2D(textureId, target, bindingTarget, level, format, mipLevelSize(level, dimensions[0]), layers, 0, pixelFormat, pixelType, 0); | 0 | ||||||||||||||||||
| 1022 | layers, never executed: texFuncs->glTextureImage2D(textureId, target, bindingTarget, level, format, mipLevelSize(level, dimensions[0]), layers, 0, pixelFormat, pixelType, 0); | 0 | ||||||||||||||||||
| 1023 | 0, never executed: texFuncs->glTextureImage2D(textureId, target, bindingTarget, level, format, mipLevelSize(level, dimensions[0]), layers, 0, pixelFormat, pixelType, 0); | 0 | ||||||||||||||||||
| 1024 | pixelFormat, pixelType, 0); never executed: texFuncs->glTextureImage2D(textureId, target, bindingTarget, level, format, mipLevelSize(level, dimensions[0]), layers, 0, pixelFormat, pixelType, 0); | 0 | ||||||||||||||||||
| 1025 | } else { never executed: end of block | 0 | ||||||||||||||||||
| 1026 | qWarning("1D array textures are not supported"); | - | ||||||||||||||||||
| 1027 | return; never executed: return; | 0 | ||||||||||||||||||
| 1028 | } | - | ||||||||||||||||||
| 1029 | break; never executed: break; | 0 | ||||||||||||||||||
| 1030 | - | |||||||||||||||||||
| 1031 | case QOpenGLTexture::Target2D: never executed: case QOpenGLTexture::Target2D: | 0 | ||||||||||||||||||
| 1032 | case QOpenGLTexture::TargetRectangle: never executed: case QOpenGLTexture::TargetRectangle: | 0 | ||||||||||||||||||
| 1033 | for (int level = 0; level < mipLevels; ++level)
| 0 | ||||||||||||||||||
| 1034 | texFuncs->glTextureImage2D(textureId, target, bindingTarget, level, format, never executed: texFuncs->glTextureImage2D(textureId, target, bindingTarget, level, format, mipLevelSize(level, dimensions[0]), mipLevelSize(level, dimensions[1]), 0, pixelFormat, pixelType, 0); | 0 | ||||||||||||||||||
| 1035 | mipLevelSize(level, dimensions[0]), never executed: texFuncs->glTextureImage2D(textureId, target, bindingTarget, level, format, mipLevelSize(level, dimensions[0]), mipLevelSize(level, dimensions[1]), 0, pixelFormat, pixelType, 0); | 0 | ||||||||||||||||||
| 1036 | mipLevelSize(level, dimensions[1]), never executed: texFuncs->glTextureImage2D(textureId, target, bindingTarget, level, format, mipLevelSize(level, dimensions[0]), mipLevelSize(level, dimensions[1]), 0, pixelFormat, pixelType, 0); | 0 | ||||||||||||||||||
| 1037 | 0, never executed: texFuncs->glTextureImage2D(textureId, target, bindingTarget, level, format, mipLevelSize(level, dimensions[0]), mipLevelSize(level, dimensions[1]), 0, pixelFormat, pixelType, 0); | 0 | ||||||||||||||||||
| 1038 | pixelFormat, pixelType, 0); never executed: texFuncs->glTextureImage2D(textureId, target, bindingTarget, level, format, mipLevelSize(level, dimensions[0]), mipLevelSize(level, dimensions[1]), 0, pixelFormat, pixelType, 0); | 0 | ||||||||||||||||||
| 1039 | break; never executed: break; | 0 | ||||||||||||||||||
| 1040 | - | |||||||||||||||||||
| 1041 | case QOpenGLTexture::TargetCubeMap: { never executed: case QOpenGLTexture::TargetCubeMap: | 0 | ||||||||||||||||||
| 1042 | // Cubemaps are the odd one out. We have to allocate storage for each | - | ||||||||||||||||||
| 1043 | // face and miplevel using the special cubemap face targets rather than | - | ||||||||||||||||||
| 1044 | // GL_TARGET_CUBEMAP. | - | ||||||||||||||||||
| 1045 | const QOpenGLTexture::CubeMapFace faceTargets[] = { | - | ||||||||||||||||||
| 1046 | QOpenGLTexture::CubeMapPositiveX, QOpenGLTexture::CubeMapNegativeX, | - | ||||||||||||||||||
| 1047 | QOpenGLTexture::CubeMapPositiveY, QOpenGLTexture::CubeMapNegativeY, | - | ||||||||||||||||||
| 1048 | QOpenGLTexture::CubeMapPositiveZ, QOpenGLTexture::CubeMapNegativeZ | - | ||||||||||||||||||
| 1049 | }; | - | ||||||||||||||||||
| 1050 | - | |||||||||||||||||||
| 1051 | for (int faceTarget = 0; faceTarget < 6; ++faceTarget) {
| 0 | ||||||||||||||||||
| 1052 | for (int level = 0; level < mipLevels; ++level) {
| 0 | ||||||||||||||||||
| 1053 | texFuncs->glTextureImage2D(textureId, faceTargets[faceTarget], bindingTarget, | - | ||||||||||||||||||
| 1054 | level, format, | - | ||||||||||||||||||
| 1055 | mipLevelSize(level, dimensions[0]), | - | ||||||||||||||||||
| 1056 | mipLevelSize(level, dimensions[1]), | - | ||||||||||||||||||
| 1057 | 0, | - | ||||||||||||||||||
| 1058 | pixelFormat, pixelType, 0); | - | ||||||||||||||||||
| 1059 | } never executed: end of block | 0 | ||||||||||||||||||
| 1060 | } never executed: end of block | 0 | ||||||||||||||||||
| 1061 | break; never executed: break; | 0 | ||||||||||||||||||
| 1062 | } | - | ||||||||||||||||||
| 1063 | - | |||||||||||||||||||
| 1064 | case QOpenGLTexture::Target2DArray: never executed: case QOpenGLTexture::Target2DArray: | 0 | ||||||||||||||||||
| 1065 | if (features.testFlag(QOpenGLTexture::TextureArrays)) {
| 0 | ||||||||||||||||||
| 1066 | for (int level = 0; level < mipLevels; ++level)
| 0 | ||||||||||||||||||
| 1067 | texFuncs->glTextureImage3D(textureId, target, bindingTarget, level, format, never executed: texFuncs->glTextureImage3D(textureId, target, bindingTarget, level, format, mipLevelSize(level, dimensions[0]), mipLevelSize(level, dimensions[1]), layers, 0, pixelFormat, pixelType, 0); | 0 | ||||||||||||||||||
| 1068 | mipLevelSize(level, dimensions[0]), never executed: texFuncs->glTextureImage3D(textureId, target, bindingTarget, level, format, mipLevelSize(level, dimensions[0]), mipLevelSize(level, dimensions[1]), layers, 0, pixelFormat, pixelType, 0); | 0 | ||||||||||||||||||
| 1069 | mipLevelSize(level, dimensions[1]), never executed: texFuncs->glTextureImage3D(textureId, target, bindingTarget, level, format, mipLevelSize(level, dimensions[0]), mipLevelSize(level, dimensions[1]), layers, 0, pixelFormat, pixelType, 0); | 0 | ||||||||||||||||||
| 1070 | layers, never executed: texFuncs->glTextureImage3D(textureId, target, bindingTarget, level, format, mipLevelSize(level, dimensions[0]), mipLevelSize(level, dimensions[1]), layers, 0, pixelFormat, pixelType, 0); | 0 | ||||||||||||||||||
| 1071 | 0, never executed: texFuncs->glTextureImage3D(textureId, target, bindingTarget, level, format, mipLevelSize(level, dimensions[0]), mipLevelSize(level, dimensions[1]), layers, 0, pixelFormat, pixelType, 0); | 0 | ||||||||||||||||||
| 1072 | pixelFormat, pixelType, 0); never executed: texFuncs->glTextureImage3D(textureId, target, bindingTarget, level, format, mipLevelSize(level, dimensions[0]), mipLevelSize(level, dimensions[1]), layers, 0, pixelFormat, pixelType, 0); | 0 | ||||||||||||||||||
| 1073 | } else { never executed: end of block | 0 | ||||||||||||||||||
| 1074 | qWarning("Array textures are not supported"); | - | ||||||||||||||||||
| 1075 | return; never executed: return; | 0 | ||||||||||||||||||
| 1076 | } | - | ||||||||||||||||||
| 1077 | break; never executed: break; | 0 | ||||||||||||||||||
| 1078 | - | |||||||||||||||||||
| 1079 | case QOpenGLTexture::TargetCubeMapArray: never executed: case QOpenGLTexture::TargetCubeMapArray: | 0 | ||||||||||||||||||
| 1080 | // Cubemap arrays must specify number of layer-faces (6 * layers) as depth parameter | - | ||||||||||||||||||
| 1081 | if (features.testFlag(QOpenGLTexture::TextureCubeMapArrays)) {
| 0 | ||||||||||||||||||
| 1082 | for (int level = 0; level < mipLevels; ++level)
| 0 | ||||||||||||||||||
| 1083 | texFuncs->glTextureImage3D(textureId, target, bindingTarget, level, format, never executed: texFuncs->glTextureImage3D(textureId, target, bindingTarget, level, format, mipLevelSize(level, dimensions[0]), mipLevelSize(level, dimensions[1]), 6 * layers, 0, pixelFormat, pixelType, 0); | 0 | ||||||||||||||||||
| 1084 | mipLevelSize(level, dimensions[0]), never executed: texFuncs->glTextureImage3D(textureId, target, bindingTarget, level, format, mipLevelSize(level, dimensions[0]), mipLevelSize(level, dimensions[1]), 6 * layers, 0, pixelFormat, pixelType, 0); | 0 | ||||||||||||||||||
| 1085 | mipLevelSize(level, dimensions[1]), never executed: texFuncs->glTextureImage3D(textureId, target, bindingTarget, level, format, mipLevelSize(level, dimensions[0]), mipLevelSize(level, dimensions[1]), 6 * layers, 0, pixelFormat, pixelType, 0); | 0 | ||||||||||||||||||
| 1086 | 6 * layers, never executed: texFuncs->glTextureImage3D(textureId, target, bindingTarget, level, format, mipLevelSize(level, dimensions[0]), mipLevelSize(level, dimensions[1]), 6 * layers, 0, pixelFormat, pixelType, 0); | 0 | ||||||||||||||||||
| 1087 | 0, never executed: texFuncs->glTextureImage3D(textureId, target, bindingTarget, level, format, mipLevelSize(level, dimensions[0]), mipLevelSize(level, dimensions[1]), 6 * layers, 0, pixelFormat, pixelType, 0); | 0 | ||||||||||||||||||
| 1088 | pixelFormat, pixelType, 0); never executed: texFuncs->glTextureImage3D(textureId, target, bindingTarget, level, format, mipLevelSize(level, dimensions[0]), mipLevelSize(level, dimensions[1]), 6 * layers, 0, pixelFormat, pixelType, 0); | 0 | ||||||||||||||||||
| 1089 | } else { never executed: end of block | 0 | ||||||||||||||||||
| 1090 | qWarning("Cubemap Array textures are not supported"); | - | ||||||||||||||||||
| 1091 | return; never executed: return; | 0 | ||||||||||||||||||
| 1092 | } | - | ||||||||||||||||||
| 1093 | break; never executed: break; | 0 | ||||||||||||||||||
| 1094 | - | |||||||||||||||||||
| 1095 | case QOpenGLTexture::Target3D: never executed: case QOpenGLTexture::Target3D: | 0 | ||||||||||||||||||
| 1096 | if (features.testFlag(QOpenGLTexture::Texture3D)) {
| 0 | ||||||||||||||||||
| 1097 | for (int level = 0; level < mipLevels; ++level)
| 0 | ||||||||||||||||||
| 1098 | texFuncs->glTextureImage3D(textureId, target, bindingTarget, level, format, never executed: texFuncs->glTextureImage3D(textureId, target, bindingTarget, level, format, mipLevelSize(level, dimensions[0]), mipLevelSize(level, dimensions[1]), mipLevelSize(level, dimensions[2]), 0, pixelFormat, pixelType, 0); | 0 | ||||||||||||||||||
| 1099 | mipLevelSize(level, dimensions[0]), never executed: texFuncs->glTextureImage3D(textureId, target, bindingTarget, level, format, mipLevelSize(level, dimensions[0]), mipLevelSize(level, dimensions[1]), mipLevelSize(level, dimensions[2]), 0, pixelFormat, pixelType, 0); | 0 | ||||||||||||||||||
| 1100 | mipLevelSize(level, dimensions[1]), never executed: texFuncs->glTextureImage3D(textureId, target, bindingTarget, level, format, mipLevelSize(level, dimensions[0]), mipLevelSize(level, dimensions[1]), mipLevelSize(level, dimensions[2]), 0, pixelFormat, pixelType, 0); | 0 | ||||||||||||||||||
| 1101 | mipLevelSize(level, dimensions[2]), never executed: texFuncs->glTextureImage3D(textureId, target, bindingTarget, level, format, mipLevelSize(level, dimensions[0]), mipLevelSize(level, dimensions[1]), mipLevelSize(level, dimensions[2]), 0, pixelFormat, pixelType, 0); | 0 | ||||||||||||||||||
| 1102 | 0, never executed: texFuncs->glTextureImage3D(textureId, target, bindingTarget, level, format, mipLevelSize(level, dimensions[0]), mipLevelSize(level, dimensions[1]), mipLevelSize(level, dimensions[2]), 0, pixelFormat, pixelType, 0); | 0 | ||||||||||||||||||
| 1103 | pixelFormat, pixelType, 0); never executed: texFuncs->glTextureImage3D(textureId, target, bindingTarget, level, format, mipLevelSize(level, dimensions[0]), mipLevelSize(level, dimensions[1]), mipLevelSize(level, dimensions[2]), 0, pixelFormat, pixelType, 0); | 0 | ||||||||||||||||||
| 1104 | } else { never executed: end of block | 0 | ||||||||||||||||||
| 1105 | qWarning("3D textures are not supported"); | - | ||||||||||||||||||
| 1106 | return; never executed: return; | 0 | ||||||||||||||||||
| 1107 | } | - | ||||||||||||||||||
| 1108 | break; never executed: break; | 0 | ||||||||||||||||||
| 1109 | - | |||||||||||||||||||
| 1110 | case QOpenGLTexture::Target2DMultisample: never executed: case QOpenGLTexture::Target2DMultisample: | 0 | ||||||||||||||||||
| 1111 | if (features.testFlag(QOpenGLTexture::TextureMultisample)) {
| 0 | ||||||||||||||||||
| 1112 | texFuncs->glTextureImage2DMultisample(textureId, target, bindingTarget, samples, format, | - | ||||||||||||||||||
| 1113 | dimensions[0], dimensions[1], | - | ||||||||||||||||||
| 1114 | fixedSamplePositions); | - | ||||||||||||||||||
| 1115 | } else { never executed: end of block | 0 | ||||||||||||||||||
| 1116 | qWarning("Multisample textures are not supported"); | - | ||||||||||||||||||
| 1117 | return; never executed: return; | 0 | ||||||||||||||||||
| 1118 | } | - | ||||||||||||||||||
| 1119 | break; never executed: break; | 0 | ||||||||||||||||||
| 1120 | - | |||||||||||||||||||
| 1121 | case QOpenGLTexture::Target2DMultisampleArray: never executed: case QOpenGLTexture::Target2DMultisampleArray: | 0 | ||||||||||||||||||
| 1122 | if (features.testFlag(QOpenGLTexture::TextureMultisample)
| 0 | ||||||||||||||||||
| 1123 | && features.testFlag(QOpenGLTexture::TextureArrays)) {
| 0 | ||||||||||||||||||
| 1124 | texFuncs->glTextureImage3DMultisample(textureId, target, bindingTarget, samples, format, | - | ||||||||||||||||||
| 1125 | dimensions[0], dimensions[1], layers, | - | ||||||||||||||||||
| 1126 | fixedSamplePositions); | - | ||||||||||||||||||
| 1127 | } else { never executed: end of block | 0 | ||||||||||||||||||
| 1128 | qWarning("Multisample array textures are not supported"); | - | ||||||||||||||||||
| 1129 | return; never executed: return; | 0 | ||||||||||||||||||
| 1130 | } | - | ||||||||||||||||||
| 1131 | break; never executed: break; | 0 | ||||||||||||||||||
| 1132 | } | - | ||||||||||||||||||
| 1133 | - | |||||||||||||||||||
| 1134 | storageAllocated = true; | - | ||||||||||||||||||
| 1135 | } never executed: end of block | 0 | ||||||||||||||||||
| 1136 | - | |||||||||||||||||||
| 1137 | void QOpenGLTexturePrivate::allocateImmutableStorage() | - | ||||||||||||||||||
| 1138 | { | - | ||||||||||||||||||
| 1139 | switch (target) { | - | ||||||||||||||||||
| 1140 | case QOpenGLTexture::TargetBuffer: never executed: case QOpenGLTexture::TargetBuffer: | 0 | ||||||||||||||||||
| 1141 | // Buffer textures get their storage from an external OpenGL buffer | - | ||||||||||||||||||
| 1142 | qWarning("Buffer textures do not allocate storage"); | - | ||||||||||||||||||
| 1143 | return; never executed: return; | 0 | ||||||||||||||||||
| 1144 | - | |||||||||||||||||||
| 1145 | case QOpenGLTexture::Target1D: never executed: case QOpenGLTexture::Target1D: | 0 | ||||||||||||||||||
| 1146 | if (features.testFlag(QOpenGLTexture::Texture1D)) {
| 0 | ||||||||||||||||||
| 1147 | texFuncs->glTextureStorage1D(textureId, target, bindingTarget, mipLevels, format, | - | ||||||||||||||||||
| 1148 | dimensions[0]); | - | ||||||||||||||||||
| 1149 | } else { never executed: end of block | 0 | ||||||||||||||||||
| 1150 | qWarning("1D textures are not supported"); | - | ||||||||||||||||||
| 1151 | return; never executed: return; | 0 | ||||||||||||||||||
| 1152 | } | - | ||||||||||||||||||
| 1153 | break; never executed: break; | 0 | ||||||||||||||||||
| 1154 | - | |||||||||||||||||||
| 1155 | case QOpenGLTexture::Target1DArray: never executed: case QOpenGLTexture::Target1DArray: | 0 | ||||||||||||||||||
| 1156 | if (features.testFlag(QOpenGLTexture::Texture1D)
| 0 | ||||||||||||||||||
| 1157 | && features.testFlag(QOpenGLTexture::TextureArrays)) {
| 0 | ||||||||||||||||||
| 1158 | texFuncs->glTextureStorage2D(textureId, target, bindingTarget, mipLevels, format, | - | ||||||||||||||||||
| 1159 | dimensions[0], layers); | - | ||||||||||||||||||
| 1160 | } else { never executed: end of block | 0 | ||||||||||||||||||
| 1161 | qWarning("1D array textures are not supported"); | - | ||||||||||||||||||
| 1162 | return; never executed: return; | 0 | ||||||||||||||||||
| 1163 | } | - | ||||||||||||||||||
| 1164 | break; never executed: break; | 0 | ||||||||||||||||||
| 1165 | - | |||||||||||||||||||
| 1166 | case QOpenGLTexture::Target2D: never executed: case QOpenGLTexture::Target2D: | 0 | ||||||||||||||||||
| 1167 | case QOpenGLTexture::TargetCubeMap: never executed: case QOpenGLTexture::TargetCubeMap: | 0 | ||||||||||||||||||
| 1168 | case QOpenGLTexture::TargetRectangle: never executed: case QOpenGLTexture::TargetRectangle: | 0 | ||||||||||||||||||
| 1169 | texFuncs->glTextureStorage2D(textureId, target, bindingTarget, mipLevels, format, | - | ||||||||||||||||||
| 1170 | dimensions[0], dimensions[1]); | - | ||||||||||||||||||
| 1171 | break; never executed: break; | 0 | ||||||||||||||||||
| 1172 | - | |||||||||||||||||||
| 1173 | case QOpenGLTexture::Target2DArray: never executed: case QOpenGLTexture::Target2DArray: | 0 | ||||||||||||||||||
| 1174 | if (features.testFlag(QOpenGLTexture::TextureArrays)) {
| 0 | ||||||||||||||||||
| 1175 | texFuncs->glTextureStorage3D(textureId, target, bindingTarget, mipLevels, format, | - | ||||||||||||||||||
| 1176 | dimensions[0], dimensions[1], layers); | - | ||||||||||||||||||
| 1177 | } else { never executed: end of block | 0 | ||||||||||||||||||
| 1178 | qWarning("Array textures are not supported"); | - | ||||||||||||||||||
| 1179 | return; never executed: return; | 0 | ||||||||||||||||||
| 1180 | } | - | ||||||||||||||||||
| 1181 | break; never executed: break; | 0 | ||||||||||||||||||
| 1182 | - | |||||||||||||||||||
| 1183 | case QOpenGLTexture::TargetCubeMapArray: never executed: case QOpenGLTexture::TargetCubeMapArray: | 0 | ||||||||||||||||||
| 1184 | // Cubemap arrays must specify number of layer-faces (6 * layers) as depth parameter | - | ||||||||||||||||||
| 1185 | if (features.testFlag(QOpenGLTexture::TextureCubeMapArrays)) {
| 0 | ||||||||||||||||||
| 1186 | texFuncs->glTextureStorage3D(textureId, target, bindingTarget, mipLevels, format, | - | ||||||||||||||||||
| 1187 | dimensions[0], dimensions[1], 6 * layers); | - | ||||||||||||||||||
| 1188 | } else { never executed: end of block | 0 | ||||||||||||||||||
| 1189 | qWarning("Cubemap Array textures are not supported"); | - | ||||||||||||||||||
| 1190 | return; never executed: return; | 0 | ||||||||||||||||||
| 1191 | } | - | ||||||||||||||||||
| 1192 | break; never executed: break; | 0 | ||||||||||||||||||
| 1193 | - | |||||||||||||||||||
| 1194 | case QOpenGLTexture::Target3D: never executed: case QOpenGLTexture::Target3D: | 0 | ||||||||||||||||||
| 1195 | if (features.testFlag(QOpenGLTexture::Texture3D)) {
| 0 | ||||||||||||||||||
| 1196 | texFuncs->glTextureStorage3D(textureId, target, bindingTarget, mipLevels, format, | - | ||||||||||||||||||
| 1197 | dimensions[0], dimensions[1], dimensions[2]); | - | ||||||||||||||||||
| 1198 | } else { never executed: end of block | 0 | ||||||||||||||||||
| 1199 | qWarning("3D textures are not supported"); | - | ||||||||||||||||||
| 1200 | return; never executed: return; | 0 | ||||||||||||||||||
| 1201 | } | - | ||||||||||||||||||
| 1202 | break; never executed: break; | 0 | ||||||||||||||||||
| 1203 | - | |||||||||||||||||||
| 1204 | case QOpenGLTexture::Target2DMultisample: never executed: case QOpenGLTexture::Target2DMultisample: | 0 | ||||||||||||||||||
| 1205 | if (features.testFlag(QOpenGLTexture::ImmutableMultisampleStorage)) {
| 0 | ||||||||||||||||||
| 1206 | texFuncs->glTextureStorage2DMultisample(textureId, target, bindingTarget, samples, format, | - | ||||||||||||||||||
| 1207 | dimensions[0], dimensions[1], | - | ||||||||||||||||||
| 1208 | fixedSamplePositions); | - | ||||||||||||||||||
| 1209 | } else { never executed: end of block | 0 | ||||||||||||||||||
| 1210 | qWarning("Multisample textures are not supported"); | - | ||||||||||||||||||
| 1211 | return; never executed: return; | 0 | ||||||||||||||||||
| 1212 | } | - | ||||||||||||||||||
| 1213 | break; never executed: break; | 0 | ||||||||||||||||||
| 1214 | - | |||||||||||||||||||
| 1215 | case QOpenGLTexture::Target2DMultisampleArray: never executed: case QOpenGLTexture::Target2DMultisampleArray: | 0 | ||||||||||||||||||
| 1216 | if (features.testFlag(QOpenGLTexture::ImmutableMultisampleStorage)
| 0 | ||||||||||||||||||
| 1217 | && features.testFlag(QOpenGLTexture::TextureArrays)) {
| 0 | ||||||||||||||||||
| 1218 | texFuncs->glTextureStorage3DMultisample(textureId, target, bindingTarget, samples, format, | - | ||||||||||||||||||
| 1219 | dimensions[0], dimensions[1], layers, | - | ||||||||||||||||||
| 1220 | fixedSamplePositions); | - | ||||||||||||||||||
| 1221 | } else { never executed: end of block | 0 | ||||||||||||||||||
| 1222 | qWarning("Multisample array textures are not supported"); | - | ||||||||||||||||||
| 1223 | return; never executed: return; | 0 | ||||||||||||||||||
| 1224 | } | - | ||||||||||||||||||
| 1225 | break; never executed: break; | 0 | ||||||||||||||||||
| 1226 | } | - | ||||||||||||||||||
| 1227 | - | |||||||||||||||||||
| 1228 | storageAllocated = true; | - | ||||||||||||||||||
| 1229 | } never executed: end of block | 0 | ||||||||||||||||||
| 1230 | - | |||||||||||||||||||
| 1231 | void QOpenGLTexturePrivate::setData(int mipLevel, int layer, QOpenGLTexture::CubeMapFace cubeFace, | - | ||||||||||||||||||
| 1232 | QOpenGLTexture::PixelFormat sourceFormat, QOpenGLTexture::PixelType sourceType, | - | ||||||||||||||||||
| 1233 | const void *data, const QOpenGLPixelTransferOptions * const options) | - | ||||||||||||||||||
| 1234 | { | - | ||||||||||||||||||
| 1235 | switch (target) { | - | ||||||||||||||||||
| 1236 | case QOpenGLTexture::Target1D: never executed: case QOpenGLTexture::Target1D: | 0 | ||||||||||||||||||
| 1237 | Q_UNUSED(layer); | - | ||||||||||||||||||
| 1238 | Q_UNUSED(cubeFace); | - | ||||||||||||||||||
| 1239 | texFuncs->glTextureSubImage1D(textureId, target, bindingTarget, mipLevel, | - | ||||||||||||||||||
| 1240 | 0, mipLevelSize( mipLevel, dimensions[0] ), | - | ||||||||||||||||||
| 1241 | sourceFormat, sourceType, data, options); | - | ||||||||||||||||||
| 1242 | break; never executed: break; | 0 | ||||||||||||||||||
| 1243 | - | |||||||||||||||||||
| 1244 | case QOpenGLTexture::Target1DArray: never executed: case QOpenGLTexture::Target1DArray: | 0 | ||||||||||||||||||
| 1245 | Q_UNUSED(cubeFace); | - | ||||||||||||||||||
| 1246 | texFuncs->glTextureSubImage2D(textureId, target, bindingTarget, mipLevel, | - | ||||||||||||||||||
| 1247 | 0, layer, | - | ||||||||||||||||||
| 1248 | mipLevelSize(mipLevel, dimensions[0]), | - | ||||||||||||||||||
| 1249 | 1, | - | ||||||||||||||||||
| 1250 | sourceFormat, sourceType, data, options); | - | ||||||||||||||||||
| 1251 | break; never executed: break; | 0 | ||||||||||||||||||
| 1252 | - | |||||||||||||||||||
| 1253 | case QOpenGLTexture::Target2D: never executed: case QOpenGLTexture::Target2D: | 0 | ||||||||||||||||||
| 1254 | Q_UNUSED(layer); | - | ||||||||||||||||||
| 1255 | Q_UNUSED(cubeFace); | - | ||||||||||||||||||
| 1256 | texFuncs->glTextureSubImage2D(textureId, target, bindingTarget, mipLevel, | - | ||||||||||||||||||
| 1257 | 0, 0, | - | ||||||||||||||||||
| 1258 | mipLevelSize(mipLevel, dimensions[0]), | - | ||||||||||||||||||
| 1259 | mipLevelSize(mipLevel, dimensions[1]), | - | ||||||||||||||||||
| 1260 | sourceFormat, sourceType, data, options); | - | ||||||||||||||||||
| 1261 | break; never executed: break; | 0 | ||||||||||||||||||
| 1262 | - | |||||||||||||||||||
| 1263 | case QOpenGLTexture::Target2DArray: never executed: case QOpenGLTexture::Target2DArray: | 0 | ||||||||||||||||||
| 1264 | Q_UNUSED(cubeFace); | - | ||||||||||||||||||
| 1265 | texFuncs->glTextureSubImage3D(textureId, target, bindingTarget, mipLevel, | - | ||||||||||||||||||
| 1266 | 0, 0, layer, | - | ||||||||||||||||||
| 1267 | mipLevelSize(mipLevel, dimensions[0]), | - | ||||||||||||||||||
| 1268 | mipLevelSize(mipLevel, dimensions[1]), | - | ||||||||||||||||||
| 1269 | 1, | - | ||||||||||||||||||
| 1270 | sourceFormat, sourceType, data, options); | - | ||||||||||||||||||
| 1271 | break; never executed: break; | 0 | ||||||||||||||||||
| 1272 | - | |||||||||||||||||||
| 1273 | case QOpenGLTexture::Target3D: never executed: case QOpenGLTexture::Target3D: | 0 | ||||||||||||||||||
| 1274 | Q_UNUSED(cubeFace); | - | ||||||||||||||||||
| 1275 | texFuncs->glTextureSubImage3D(textureId, target, bindingTarget, mipLevel, | - | ||||||||||||||||||
| 1276 | 0, 0, layer, | - | ||||||||||||||||||
| 1277 | mipLevelSize(mipLevel, dimensions[0]), | - | ||||||||||||||||||
| 1278 | mipLevelSize(mipLevel, dimensions[1]), | - | ||||||||||||||||||
| 1279 | mipLevelSize(mipLevel, dimensions[2]), | - | ||||||||||||||||||
| 1280 | sourceFormat, sourceType, data, options); | - | ||||||||||||||||||
| 1281 | break; never executed: break; | 0 | ||||||||||||||||||
| 1282 | - | |||||||||||||||||||
| 1283 | case QOpenGLTexture::TargetCubeMap: never executed: case QOpenGLTexture::TargetCubeMap: | 0 | ||||||||||||||||||
| 1284 | Q_UNUSED(layer); | - | ||||||||||||||||||
| 1285 | texFuncs->glTextureSubImage2D(textureId, cubeFace, bindingTarget, mipLevel, | - | ||||||||||||||||||
| 1286 | 0, 0, | - | ||||||||||||||||||
| 1287 | mipLevelSize(mipLevel, dimensions[0]), | - | ||||||||||||||||||
| 1288 | mipLevelSize(mipLevel, dimensions[1]), | - | ||||||||||||||||||
| 1289 | sourceFormat, sourceType, data, options); | - | ||||||||||||||||||
| 1290 | break; never executed: break; | 0 | ||||||||||||||||||
| 1291 | - | |||||||||||||||||||
| 1292 | case QOpenGLTexture::TargetCubeMapArray: { never executed: case QOpenGLTexture::TargetCubeMapArray: | 0 | ||||||||||||||||||
| 1293 | int faceIndex = cubeFace - QOpenGLTexture::CubeMapPositiveX; | - | ||||||||||||||||||
| 1294 | int layerFace = 6 * layer + faceIndex; | - | ||||||||||||||||||
| 1295 | texFuncs->glTextureSubImage3D(textureId, target, bindingTarget, mipLevel, | - | ||||||||||||||||||
| 1296 | 0, 0, layerFace, | - | ||||||||||||||||||
| 1297 | mipLevelSize(mipLevel, dimensions[0]), | - | ||||||||||||||||||
| 1298 | mipLevelSize(mipLevel, dimensions[1]), | - | ||||||||||||||||||
| 1299 | 1, | - | ||||||||||||||||||
| 1300 | sourceFormat, sourceType, data, options); | - | ||||||||||||||||||
| 1301 | break; never executed: break; | 0 | ||||||||||||||||||
| 1302 | } | - | ||||||||||||||||||
| 1303 | - | |||||||||||||||||||
| 1304 | case QOpenGLTexture::TargetRectangle: never executed: case QOpenGLTexture::TargetRectangle: | 0 | ||||||||||||||||||
| 1305 | Q_UNUSED(mipLevel); | - | ||||||||||||||||||
| 1306 | Q_UNUSED(layer); | - | ||||||||||||||||||
| 1307 | Q_UNUSED(cubeFace); | - | ||||||||||||||||||
| 1308 | texFuncs->glTextureSubImage2D(textureId, target, bindingTarget, 0, | - | ||||||||||||||||||
| 1309 | 0, 0, | - | ||||||||||||||||||
| 1310 | dimensions[0], | - | ||||||||||||||||||
| 1311 | dimensions[1], | - | ||||||||||||||||||
| 1312 | sourceFormat, sourceType, data, options); | - | ||||||||||||||||||
| 1313 | break; never executed: break; | 0 | ||||||||||||||||||
| 1314 | - | |||||||||||||||||||
| 1315 | case QOpenGLTexture::Target2DMultisample: never executed: case QOpenGLTexture::Target2DMultisample: | 0 | ||||||||||||||||||
| 1316 | case QOpenGLTexture::Target2DMultisampleArray: never executed: case QOpenGLTexture::Target2DMultisampleArray: | 0 | ||||||||||||||||||
| 1317 | case QOpenGLTexture::TargetBuffer: never executed: case QOpenGLTexture::TargetBuffer: | 0 | ||||||||||||||||||
| 1318 | // We don't upload pixel data for these targets | - | ||||||||||||||||||
| 1319 | qWarning("QOpenGLTexture::setData(): Texture target does not support pixel data upload"); | - | ||||||||||||||||||
| 1320 | break; never executed: break; | 0 | ||||||||||||||||||
| 1321 | } | - | ||||||||||||||||||
| 1322 | - | |||||||||||||||||||
| 1323 | // If requested perform automatic mip map generation | - | ||||||||||||||||||
| 1324 | if (mipLevel == 0 && autoGenerateMipMaps && mipLevels > 1) {
| 0 | ||||||||||||||||||
| 1325 | Q_Q(QOpenGLTexture); | - | ||||||||||||||||||
| 1326 | q->generateMipMaps(); | - | ||||||||||||||||||
| 1327 | } never executed: end of block | 0 | ||||||||||||||||||
| 1328 | } never executed: end of block | 0 | ||||||||||||||||||
| 1329 | - | |||||||||||||||||||
| 1330 | void QOpenGLTexturePrivate::setCompressedData(int mipLevel, int layer, QOpenGLTexture::CubeMapFace cubeFace, | - | ||||||||||||||||||
| 1331 | int dataSize, const void *data, | - | ||||||||||||||||||
| 1332 | const QOpenGLPixelTransferOptions * const options) | - | ||||||||||||||||||
| 1333 | { | - | ||||||||||||||||||
| 1334 | if (!isCompressedFormat(format)) {
| 0 | ||||||||||||||||||
| 1335 | qWarning("Cannot set compressed data for non-compressed format 0x%x", format); | - | ||||||||||||||||||
| 1336 | return; never executed: return; | 0 | ||||||||||||||||||
| 1337 | } | - | ||||||||||||||||||
| 1338 | - | |||||||||||||||||||
| 1339 | const bool needsFullSpec = !isUsingImmutableStorage(); // was allocateStorage() a no-op? | - | ||||||||||||||||||
| 1340 | - | |||||||||||||||||||
| 1341 | switch (target) { | - | ||||||||||||||||||
| 1342 | case QOpenGLTexture::Target1D: never executed: case QOpenGLTexture::Target1D: | 0 | ||||||||||||||||||
| 1343 | Q_UNUSED(layer); | - | ||||||||||||||||||
| 1344 | Q_UNUSED(cubeFace); | - | ||||||||||||||||||
| 1345 | if (needsFullSpec) {
| 0 | ||||||||||||||||||
| 1346 | texFuncs->glCompressedTextureImage1D(textureId, target, bindingTarget, mipLevel, | - | ||||||||||||||||||
| 1347 | format, | - | ||||||||||||||||||
| 1348 | mipLevelSize(mipLevel, dimensions[0]), | - | ||||||||||||||||||
| 1349 | 0, dataSize, data, options); | - | ||||||||||||||||||
| 1350 | } else { never executed: end of block | 0 | ||||||||||||||||||
| 1351 | texFuncs->glCompressedTextureSubImage1D(textureId, target, bindingTarget, mipLevel, | - | ||||||||||||||||||
| 1352 | 0, mipLevelSize( mipLevel, dimensions[0] ), | - | ||||||||||||||||||
| 1353 | format, dataSize, data, options); | - | ||||||||||||||||||
| 1354 | } never executed: end of block | 0 | ||||||||||||||||||
| 1355 | break; never executed: break; | 0 | ||||||||||||||||||
| 1356 | - | |||||||||||||||||||
| 1357 | case QOpenGLTexture::Target1DArray: never executed: case QOpenGLTexture::Target1DArray: | 0 | ||||||||||||||||||
| 1358 | Q_UNUSED(cubeFace); | - | ||||||||||||||||||
| 1359 | if (!needsFullSpec) {
| 0 | ||||||||||||||||||
| 1360 | texFuncs->glCompressedTextureSubImage2D(textureId, target, bindingTarget, mipLevel, | - | ||||||||||||||||||
| 1361 | 0, layer, | - | ||||||||||||||||||
| 1362 | mipLevelSize(mipLevel, dimensions[0]), | - | ||||||||||||||||||
| 1363 | 1, | - | ||||||||||||||||||
| 1364 | format, dataSize, data, options); | - | ||||||||||||||||||
| 1365 | } never executed: end of block | 0 | ||||||||||||||||||
| 1366 | break; never executed: break; | 0 | ||||||||||||||||||
| 1367 | - | |||||||||||||||||||
| 1368 | case QOpenGLTexture::Target2D: never executed: case QOpenGLTexture::Target2D: | 0 | ||||||||||||||||||
| 1369 | Q_UNUSED(layer); | - | ||||||||||||||||||
| 1370 | Q_UNUSED(cubeFace); | - | ||||||||||||||||||
| 1371 | if (needsFullSpec) {
| 0 | ||||||||||||||||||
| 1372 | texFuncs->glCompressedTextureImage2D(textureId, target, bindingTarget, mipLevel, | - | ||||||||||||||||||
| 1373 | format, | - | ||||||||||||||||||
| 1374 | mipLevelSize(mipLevel, dimensions[0]), | - | ||||||||||||||||||
| 1375 | mipLevelSize(mipLevel, dimensions[1]), | - | ||||||||||||||||||
| 1376 | 0, dataSize, data, options); | - | ||||||||||||||||||
| 1377 | } else { never executed: end of block | 0 | ||||||||||||||||||
| 1378 | texFuncs->glCompressedTextureSubImage2D(textureId, target, bindingTarget, mipLevel, | - | ||||||||||||||||||
| 1379 | 0, 0, | - | ||||||||||||||||||
| 1380 | mipLevelSize(mipLevel, dimensions[0]), | - | ||||||||||||||||||
| 1381 | mipLevelSize(mipLevel, dimensions[1]), | - | ||||||||||||||||||
| 1382 | format, dataSize, data, options); | - | ||||||||||||||||||
| 1383 | } never executed: end of block | 0 | ||||||||||||||||||
| 1384 | break; never executed: break; | 0 | ||||||||||||||||||
| 1385 | - | |||||||||||||||||||
| 1386 | case QOpenGLTexture::Target2DArray: never executed: case QOpenGLTexture::Target2DArray: | 0 | ||||||||||||||||||
| 1387 | Q_UNUSED(cubeFace); | - | ||||||||||||||||||
| 1388 | if (!needsFullSpec) {
| 0 | ||||||||||||||||||
| 1389 | texFuncs->glCompressedTextureSubImage3D(textureId, target, bindingTarget, mipLevel, | - | ||||||||||||||||||
| 1390 | 0, 0, layer, | - | ||||||||||||||||||
| 1391 | mipLevelSize(mipLevel, dimensions[0]), | - | ||||||||||||||||||
| 1392 | mipLevelSize(mipLevel, dimensions[1]), | - | ||||||||||||||||||
| 1393 | 1, | - | ||||||||||||||||||
| 1394 | format, dataSize, data, options); | - | ||||||||||||||||||
| 1395 | } never executed: end of block | 0 | ||||||||||||||||||
| 1396 | break; never executed: break; | 0 | ||||||||||||||||||
| 1397 | - | |||||||||||||||||||
| 1398 | case QOpenGLTexture::Target3D: never executed: case QOpenGLTexture::Target3D: | 0 | ||||||||||||||||||
| 1399 | Q_UNUSED(cubeFace); | - | ||||||||||||||||||
| 1400 | if (needsFullSpec) {
| 0 | ||||||||||||||||||
| 1401 | texFuncs->glCompressedTextureImage3D(textureId, target, bindingTarget, mipLevel, | - | ||||||||||||||||||
| 1402 | format, | - | ||||||||||||||||||
| 1403 | mipLevelSize(mipLevel, dimensions[0]), | - | ||||||||||||||||||
| 1404 | mipLevelSize(mipLevel, dimensions[1]), | - | ||||||||||||||||||
| 1405 | mipLevelSize(mipLevel, dimensions[2]), | - | ||||||||||||||||||
| 1406 | 0, dataSize, data, options); | - | ||||||||||||||||||
| 1407 | } else { never executed: end of block | 0 | ||||||||||||||||||
| 1408 | texFuncs->glCompressedTextureSubImage3D(textureId, target, bindingTarget, mipLevel, | - | ||||||||||||||||||
| 1409 | 0, 0, layer, | - | ||||||||||||||||||
| 1410 | mipLevelSize(mipLevel, dimensions[0]), | - | ||||||||||||||||||
| 1411 | mipLevelSize(mipLevel, dimensions[1]), | - | ||||||||||||||||||
| 1412 | mipLevelSize(mipLevel, dimensions[2]), | - | ||||||||||||||||||
| 1413 | format, dataSize, data, options); | - | ||||||||||||||||||
| 1414 | } never executed: end of block | 0 | ||||||||||||||||||
| 1415 | break; never executed: break; | 0 | ||||||||||||||||||
| 1416 | - | |||||||||||||||||||
| 1417 | case QOpenGLTexture::TargetCubeMap: never executed: case QOpenGLTexture::TargetCubeMap: | 0 | ||||||||||||||||||
| 1418 | Q_UNUSED(layer); | - | ||||||||||||||||||
| 1419 | if (needsFullSpec) {
| 0 | ||||||||||||||||||
| 1420 | texFuncs->glCompressedTextureImage2D(textureId, cubeFace, bindingTarget, mipLevel, | - | ||||||||||||||||||
| 1421 | format, | - | ||||||||||||||||||
| 1422 | mipLevelSize(mipLevel, dimensions[0]), | - | ||||||||||||||||||
| 1423 | mipLevelSize(mipLevel, dimensions[1]), | - | ||||||||||||||||||
| 1424 | 0, dataSize, data, options); | - | ||||||||||||||||||
| 1425 | } else { never executed: end of block | 0 | ||||||||||||||||||
| 1426 | texFuncs->glCompressedTextureSubImage2D(textureId, cubeFace, bindingTarget, mipLevel, | - | ||||||||||||||||||
| 1427 | 0, 0, | - | ||||||||||||||||||
| 1428 | mipLevelSize(mipLevel, dimensions[0]), | - | ||||||||||||||||||
| 1429 | mipLevelSize(mipLevel, dimensions[1]), | - | ||||||||||||||||||
| 1430 | format, dataSize, data, options); | - | ||||||||||||||||||
| 1431 | } never executed: end of block | 0 | ||||||||||||||||||
| 1432 | break; never executed: break; | 0 | ||||||||||||||||||
| 1433 | - | |||||||||||||||||||
| 1434 | case QOpenGLTexture::TargetCubeMapArray: { never executed: case QOpenGLTexture::TargetCubeMapArray: | 0 | ||||||||||||||||||
| 1435 | int faceIndex = cubeFace - QOpenGLTexture::CubeMapPositiveX; | - | ||||||||||||||||||
| 1436 | int layerFace = 6 * layer + faceIndex; | - | ||||||||||||||||||
| 1437 | if (!needsFullSpec) {
| 0 | ||||||||||||||||||
| 1438 | texFuncs->glCompressedTextureSubImage3D(textureId, target, bindingTarget, mipLevel, | - | ||||||||||||||||||
| 1439 | 0, 0, layerFace, | - | ||||||||||||||||||
| 1440 | mipLevelSize(mipLevel, dimensions[0]), | - | ||||||||||||||||||
| 1441 | mipLevelSize(mipLevel, dimensions[1]), | - | ||||||||||||||||||
| 1442 | 1, | - | ||||||||||||||||||
| 1443 | format, dataSize, data, options); | - | ||||||||||||||||||
| 1444 | } never executed: end of block | 0 | ||||||||||||||||||
| 1445 | break; never executed: break; | 0 | ||||||||||||||||||
| 1446 | } | - | ||||||||||||||||||
| 1447 | - | |||||||||||||||||||
| 1448 | case QOpenGLTexture::TargetRectangle: never executed: case QOpenGLTexture::TargetRectangle: | 0 | ||||||||||||||||||
| 1449 | case QOpenGLTexture::Target2DMultisample: never executed: case QOpenGLTexture::Target2DMultisample: | 0 | ||||||||||||||||||
| 1450 | case QOpenGLTexture::Target2DMultisampleArray: never executed: case QOpenGLTexture::Target2DMultisampleArray: | 0 | ||||||||||||||||||
| 1451 | case QOpenGLTexture::TargetBuffer: never executed: case QOpenGLTexture::TargetBuffer: | 0 | ||||||||||||||||||
| 1452 | // We don't upload pixel data for these targets | - | ||||||||||||||||||
| 1453 | qWarning("QOpenGLTexture::setCompressedData(): Texture target does not support pixel data upload"); | - | ||||||||||||||||||
| 1454 | break; never executed: break; | 0 | ||||||||||||||||||
| 1455 | } | - | ||||||||||||||||||
| 1456 | - | |||||||||||||||||||
| 1457 | // If requested perform automatic mip map generation | - | ||||||||||||||||||
| 1458 | if (mipLevel == 0 && autoGenerateMipMaps && mipLevels > 1) {
| 0 | ||||||||||||||||||
| 1459 | Q_Q(QOpenGLTexture); | - | ||||||||||||||||||
| 1460 | q->generateMipMaps(); | - | ||||||||||||||||||
| 1461 | } never executed: end of block | 0 | ||||||||||||||||||
| 1462 | } never executed: end of block | 0 | ||||||||||||||||||
| 1463 | - | |||||||||||||||||||
| 1464 | void QOpenGLTexturePrivate::setWrapMode(QOpenGLTexture::WrapMode mode) | - | ||||||||||||||||||
| 1465 | { | - | ||||||||||||||||||
| 1466 | switch (target) { | - | ||||||||||||||||||
| 1467 | case QOpenGLTexture::Target1D: never executed: case QOpenGLTexture::Target1D: | 0 | ||||||||||||||||||
| 1468 | case QOpenGLTexture::Target1DArray: never executed: case QOpenGLTexture::Target1DArray: | 0 | ||||||||||||||||||
| 1469 | case QOpenGLTexture::TargetBuffer: never executed: case QOpenGLTexture::TargetBuffer: | 0 | ||||||||||||||||||
| 1470 | wrapModes[0] = mode; | - | ||||||||||||||||||
| 1471 | texFuncs->glTextureParameteri(textureId, target, bindingTarget, GL_TEXTURE_WRAP_S, mode); | - | ||||||||||||||||||
| 1472 | break; never executed: break; | 0 | ||||||||||||||||||
| 1473 | - | |||||||||||||||||||
| 1474 | case QOpenGLTexture::Target2D: never executed: case QOpenGLTexture::Target2D: | 0 | ||||||||||||||||||
| 1475 | case QOpenGLTexture::Target2DArray: never executed: case QOpenGLTexture::Target2DArray: | 0 | ||||||||||||||||||
| 1476 | case QOpenGLTexture::TargetCubeMap: never executed: case QOpenGLTexture::TargetCubeMap: | 0 | ||||||||||||||||||
| 1477 | case QOpenGLTexture::TargetCubeMapArray: never executed: case QOpenGLTexture::TargetCubeMapArray: | 0 | ||||||||||||||||||
| 1478 | case QOpenGLTexture::Target2DMultisample: never executed: case QOpenGLTexture::Target2DMultisample: | 0 | ||||||||||||||||||
| 1479 | case QOpenGLTexture::Target2DMultisampleArray: never executed: case QOpenGLTexture::Target2DMultisampleArray: | 0 | ||||||||||||||||||
| 1480 | case QOpenGLTexture::TargetRectangle: never executed: case QOpenGLTexture::TargetRectangle: | 0 | ||||||||||||||||||
| 1481 | wrapModes[0] = wrapModes[1] = mode; | - | ||||||||||||||||||
| 1482 | texFuncs->glTextureParameteri(textureId, target, bindingTarget, GL_TEXTURE_WRAP_S, mode); | - | ||||||||||||||||||
| 1483 | texFuncs->glTextureParameteri(textureId, target, bindingTarget, GL_TEXTURE_WRAP_T, mode); | - | ||||||||||||||||||
| 1484 | break; never executed: break; | 0 | ||||||||||||||||||
| 1485 | - | |||||||||||||||||||
| 1486 | case QOpenGLTexture::Target3D: never executed: case QOpenGLTexture::Target3D: | 0 | ||||||||||||||||||
| 1487 | wrapModes[0] = wrapModes[1] = wrapModes[2] = mode; | - | ||||||||||||||||||
| 1488 | texFuncs->glTextureParameteri(textureId, target, bindingTarget, GL_TEXTURE_WRAP_S, mode); | - | ||||||||||||||||||
| 1489 | texFuncs->glTextureParameteri(textureId, target, bindingTarget, GL_TEXTURE_WRAP_T, mode); | - | ||||||||||||||||||
| 1490 | texFuncs->glTextureParameteri(textureId, target, bindingTarget, GL_TEXTURE_WRAP_R, mode); | - | ||||||||||||||||||
| 1491 | break; never executed: break; | 0 | ||||||||||||||||||
| 1492 | } | - | ||||||||||||||||||
| 1493 | } never executed: end of block | 0 | ||||||||||||||||||
| 1494 | - | |||||||||||||||||||
| 1495 | void QOpenGLTexturePrivate::setWrapMode(QOpenGLTexture::CoordinateDirection direction, QOpenGLTexture::WrapMode mode) | - | ||||||||||||||||||
| 1496 | { | - | ||||||||||||||||||
| 1497 | switch (target) { | - | ||||||||||||||||||
| 1498 | case QOpenGLTexture::Target1D: never executed: case QOpenGLTexture::Target1D: | 0 | ||||||||||||||||||
| 1499 | case QOpenGLTexture::Target1DArray: never executed: case QOpenGLTexture::Target1DArray: | 0 | ||||||||||||||||||
| 1500 | case QOpenGLTexture::TargetBuffer: never executed: case QOpenGLTexture::TargetBuffer: | 0 | ||||||||||||||||||
| 1501 | switch (direction) { | - | ||||||||||||||||||
| 1502 | case QOpenGLTexture::DirectionS: never executed: case QOpenGLTexture::DirectionS: | 0 | ||||||||||||||||||
| 1503 | wrapModes[0] = mode; | - | ||||||||||||||||||
| 1504 | texFuncs->glTextureParameteri(textureId, target, bindingTarget, GL_TEXTURE_WRAP_S, mode); | - | ||||||||||||||||||
| 1505 | break; never executed: break; | 0 | ||||||||||||||||||
| 1506 | - | |||||||||||||||||||
| 1507 | case QOpenGLTexture::DirectionT: never executed: case QOpenGLTexture::DirectionT: | 0 | ||||||||||||||||||
| 1508 | case QOpenGLTexture::DirectionR: never executed: case QOpenGLTexture::DirectionR: | 0 | ||||||||||||||||||
| 1509 | qWarning("QOpenGLTexture::setWrapMode() direction not valid for this texture target"); | - | ||||||||||||||||||
| 1510 | break; never executed: break; | 0 | ||||||||||||||||||
| 1511 | } | - | ||||||||||||||||||
| 1512 | break; never executed: break; | 0 | ||||||||||||||||||
| 1513 | - | |||||||||||||||||||
| 1514 | case QOpenGLTexture::Target2D: never executed: case QOpenGLTexture::Target2D: | 0 | ||||||||||||||||||
| 1515 | case QOpenGLTexture::Target2DArray: never executed: case QOpenGLTexture::Target2DArray: | 0 | ||||||||||||||||||
| 1516 | case QOpenGLTexture::TargetCubeMap: never executed: case QOpenGLTexture::TargetCubeMap: | 0 | ||||||||||||||||||
| 1517 | case QOpenGLTexture::TargetCubeMapArray: never executed: case QOpenGLTexture::TargetCubeMapArray: | 0 | ||||||||||||||||||
| 1518 | case QOpenGLTexture::Target2DMultisample: never executed: case QOpenGLTexture::Target2DMultisample: | 0 | ||||||||||||||||||
| 1519 | case QOpenGLTexture::Target2DMultisampleArray: never executed: case QOpenGLTexture::Target2DMultisampleArray: | 0 | ||||||||||||||||||
| 1520 | case QOpenGLTexture::TargetRectangle: never executed: case QOpenGLTexture::TargetRectangle: | 0 | ||||||||||||||||||
| 1521 | switch (direction) { | - | ||||||||||||||||||
| 1522 | case QOpenGLTexture::DirectionS: never executed: case QOpenGLTexture::DirectionS: | 0 | ||||||||||||||||||
| 1523 | wrapModes[0] = mode; | - | ||||||||||||||||||
| 1524 | texFuncs->glTextureParameteri(textureId, target, bindingTarget, GL_TEXTURE_WRAP_S, mode); | - | ||||||||||||||||||
| 1525 | break; never executed: break; | 0 | ||||||||||||||||||
| 1526 | - | |||||||||||||||||||
| 1527 | case QOpenGLTexture::DirectionT: never executed: case QOpenGLTexture::DirectionT: | 0 | ||||||||||||||||||
| 1528 | wrapModes[1] = mode; | - | ||||||||||||||||||
| 1529 | texFuncs->glTextureParameteri(textureId, target, bindingTarget, GL_TEXTURE_WRAP_T, mode); | - | ||||||||||||||||||
| 1530 | break; never executed: break; | 0 | ||||||||||||||||||
| 1531 | - | |||||||||||||||||||
| 1532 | case QOpenGLTexture::DirectionR: never executed: case QOpenGLTexture::DirectionR: | 0 | ||||||||||||||||||
| 1533 | qWarning("QOpenGLTexture::setWrapMode() direction not valid for this texture target"); | - | ||||||||||||||||||
| 1534 | break; never executed: break; | 0 | ||||||||||||||||||
| 1535 | } | - | ||||||||||||||||||
| 1536 | break; never executed: break; | 0 | ||||||||||||||||||
| 1537 | - | |||||||||||||||||||
| 1538 | case QOpenGLTexture::Target3D: never executed: case QOpenGLTexture::Target3D: | 0 | ||||||||||||||||||
| 1539 | switch (direction) { | - | ||||||||||||||||||
| 1540 | case QOpenGLTexture::DirectionS: never executed: case QOpenGLTexture::DirectionS: | 0 | ||||||||||||||||||
| 1541 | wrapModes[0] = mode; | - | ||||||||||||||||||
| 1542 | texFuncs->glTextureParameteri(textureId, target, bindingTarget, direction, mode); | - | ||||||||||||||||||
| 1543 | break; never executed: break; | 0 | ||||||||||||||||||
| 1544 | - | |||||||||||||||||||
| 1545 | case QOpenGLTexture::DirectionT: never executed: case QOpenGLTexture::DirectionT: | 0 | ||||||||||||||||||
| 1546 | wrapModes[1] = mode; | - | ||||||||||||||||||
| 1547 | texFuncs->glTextureParameteri(textureId, target, bindingTarget, direction, mode); | - | ||||||||||||||||||
| 1548 | break; never executed: break; | 0 | ||||||||||||||||||
| 1549 | - | |||||||||||||||||||
| 1550 | case QOpenGLTexture::DirectionR: never executed: case QOpenGLTexture::DirectionR: | 0 | ||||||||||||||||||
| 1551 | wrapModes[2] = mode; | - | ||||||||||||||||||
| 1552 | texFuncs->glTextureParameteri(textureId, target, bindingTarget, direction, mode); | - | ||||||||||||||||||
| 1553 | break; never executed: break; | 0 | ||||||||||||||||||
| 1554 | } | - | ||||||||||||||||||
| 1555 | break; never executed: break; | 0 | ||||||||||||||||||
| 1556 | } | - | ||||||||||||||||||
| 1557 | } never executed: end of block | 0 | ||||||||||||||||||
| 1558 | - | |||||||||||||||||||
| 1559 | QOpenGLTexture::WrapMode QOpenGLTexturePrivate::wrapMode(QOpenGLTexture::CoordinateDirection direction) const | - | ||||||||||||||||||
| 1560 | { | - | ||||||||||||||||||
| 1561 | switch (target) { | - | ||||||||||||||||||
| 1562 | case QOpenGLTexture::Target1D: never executed: case QOpenGLTexture::Target1D: | 0 | ||||||||||||||||||
| 1563 | case QOpenGLTexture::Target1DArray: never executed: case QOpenGLTexture::Target1DArray: | 0 | ||||||||||||||||||
| 1564 | case QOpenGLTexture::TargetBuffer: never executed: case QOpenGLTexture::TargetBuffer: | 0 | ||||||||||||||||||
| 1565 | switch (direction) { | - | ||||||||||||||||||
| 1566 | case QOpenGLTexture::DirectionS: never executed: case QOpenGLTexture::DirectionS: | 0 | ||||||||||||||||||
| 1567 | return wrapModes[0]; never executed: return wrapModes[0]; | 0 | ||||||||||||||||||
| 1568 | - | |||||||||||||||||||
| 1569 | case QOpenGLTexture::DirectionT: never executed: case QOpenGLTexture::DirectionT: | 0 | ||||||||||||||||||
| 1570 | case QOpenGLTexture::DirectionR: never executed: case QOpenGLTexture::DirectionR: | 0 | ||||||||||||||||||
| 1571 | qWarning("QOpenGLTexture::wrapMode() direction not valid for this texture target"); | - | ||||||||||||||||||
| 1572 | return QOpenGLTexture::Repeat; never executed: return QOpenGLTexture::Repeat; | 0 | ||||||||||||||||||
| 1573 | } | - | ||||||||||||||||||
| 1574 | break; never executed: break; | 0 | ||||||||||||||||||
| 1575 | - | |||||||||||||||||||
| 1576 | case QOpenGLTexture::Target2D: never executed: case QOpenGLTexture::Target2D: | 0 | ||||||||||||||||||
| 1577 | case QOpenGLTexture::Target2DArray: never executed: case QOpenGLTexture::Target2DArray: | 0 | ||||||||||||||||||
| 1578 | case QOpenGLTexture::TargetCubeMap: never executed: case QOpenGLTexture::TargetCubeMap: | 0 | ||||||||||||||||||
| 1579 | case QOpenGLTexture::TargetCubeMapArray: never executed: case QOpenGLTexture::TargetCubeMapArray: | 0 | ||||||||||||||||||
| 1580 | case QOpenGLTexture::Target2DMultisample: never executed: case QOpenGLTexture::Target2DMultisample: | 0 | ||||||||||||||||||
| 1581 | case QOpenGLTexture::Target2DMultisampleArray: never executed: case QOpenGLTexture::Target2DMultisampleArray: | 0 | ||||||||||||||||||
| 1582 | case QOpenGLTexture::TargetRectangle: never executed: case QOpenGLTexture::TargetRectangle: | 0 | ||||||||||||||||||
| 1583 | switch (direction) { | - | ||||||||||||||||||
| 1584 | case QOpenGLTexture::DirectionS: never executed: case QOpenGLTexture::DirectionS: | 0 | ||||||||||||||||||
| 1585 | return wrapModes[0]; never executed: return wrapModes[0]; | 0 | ||||||||||||||||||
| 1586 | - | |||||||||||||||||||
| 1587 | case QOpenGLTexture::DirectionT: never executed: case QOpenGLTexture::DirectionT: | 0 | ||||||||||||||||||
| 1588 | return wrapModes[1]; never executed: return wrapModes[1]; | 0 | ||||||||||||||||||
| 1589 | - | |||||||||||||||||||
| 1590 | case QOpenGLTexture::DirectionR: never executed: case QOpenGLTexture::DirectionR: | 0 | ||||||||||||||||||
| 1591 | qWarning("QOpenGLTexture::wrapMode() direction not valid for this texture target"); | - | ||||||||||||||||||
| 1592 | return QOpenGLTexture::Repeat; never executed: return QOpenGLTexture::Repeat; | 0 | ||||||||||||||||||
| 1593 | } | - | ||||||||||||||||||
| 1594 | break; never executed: break; | 0 | ||||||||||||||||||
| 1595 | - | |||||||||||||||||||
| 1596 | case QOpenGLTexture::Target3D: never executed: case QOpenGLTexture::Target3D: | 0 | ||||||||||||||||||
| 1597 | switch (direction) { | - | ||||||||||||||||||
| 1598 | case QOpenGLTexture::DirectionS: never executed: case QOpenGLTexture::DirectionS: | 0 | ||||||||||||||||||
| 1599 | return wrapModes[0]; never executed: return wrapModes[0]; | 0 | ||||||||||||||||||
| 1600 | - | |||||||||||||||||||
| 1601 | case QOpenGLTexture::DirectionT: never executed: case QOpenGLTexture::DirectionT: | 0 | ||||||||||||||||||
| 1602 | return wrapModes[1]; never executed: return wrapModes[1]; | 0 | ||||||||||||||||||
| 1603 | - | |||||||||||||||||||
| 1604 | case QOpenGLTexture::DirectionR: never executed: case QOpenGLTexture::DirectionR: | 0 | ||||||||||||||||||
| 1605 | return wrapModes[2]; never executed: return wrapModes[2]; | 0 | ||||||||||||||||||
| 1606 | } | - | ||||||||||||||||||
| 1607 | break; never executed: break; | 0 | ||||||||||||||||||
| 1608 | } | - | ||||||||||||||||||
| 1609 | // Should never get here | - | ||||||||||||||||||
| 1610 | Q_ASSERT(false); | - | ||||||||||||||||||
| 1611 | return QOpenGLTexture::Repeat; never executed: return QOpenGLTexture::Repeat; | 0 | ||||||||||||||||||
| 1612 | } | - | ||||||||||||||||||
| 1613 | - | |||||||||||||||||||
| 1614 | QOpenGLTexture *QOpenGLTexturePrivate::createTextureView(QOpenGLTexture::Target viewTarget, | - | ||||||||||||||||||
| 1615 | QOpenGLTexture::TextureFormat viewFormat, | - | ||||||||||||||||||
| 1616 | int minimumMipmapLevel, int maximumMipmapLevel, | - | ||||||||||||||||||
| 1617 | int minimumLayer, int maximumLayer) const | - | ||||||||||||||||||
| 1618 | { | - | ||||||||||||||||||
| 1619 | // Do sanity checks - see http://www.opengl.org/wiki/GLAPI/glTextureView | - | ||||||||||||||||||
| 1620 | - | |||||||||||||||||||
| 1621 | // Check the targets are compatible | - | ||||||||||||||||||
| 1622 | bool viewTargetCompatible = false; | - | ||||||||||||||||||
| 1623 | switch (target) { | - | ||||||||||||||||||
| 1624 | case QOpenGLTexture::Target1D: never executed: case QOpenGLTexture::Target1D: | 0 | ||||||||||||||||||
| 1625 | case QOpenGLTexture::Target1DArray: never executed: case QOpenGLTexture::Target1DArray: | 0 | ||||||||||||||||||
| 1626 | viewTargetCompatible = (viewTarget == QOpenGLTexture::Target1D
| 0 | ||||||||||||||||||
| 1627 | || viewTarget == QOpenGLTexture::Target1DArray);
| 0 | ||||||||||||||||||
| 1628 | break; never executed: break; | 0 | ||||||||||||||||||
| 1629 | - | |||||||||||||||||||
| 1630 | - | |||||||||||||||||||
| 1631 | case QOpenGLTexture::Target2D: never executed: case QOpenGLTexture::Target2D: | 0 | ||||||||||||||||||
| 1632 | case QOpenGLTexture::Target2DArray: never executed: case QOpenGLTexture::Target2DArray: | 0 | ||||||||||||||||||
| 1633 | viewTargetCompatible = (viewTarget == QOpenGLTexture::Target2D
| 0 | ||||||||||||||||||
| 1634 | || viewTarget == QOpenGLTexture::Target2DArray);
| 0 | ||||||||||||||||||
| 1635 | break; never executed: break; | 0 | ||||||||||||||||||
| 1636 | - | |||||||||||||||||||
| 1637 | case QOpenGLTexture::Target3D: never executed: case QOpenGLTexture::Target3D: | 0 | ||||||||||||||||||
| 1638 | viewTargetCompatible = (viewTarget == QOpenGLTexture::Target3D); | - | ||||||||||||||||||
| 1639 | break; never executed: break; | 0 | ||||||||||||||||||
| 1640 | - | |||||||||||||||||||
| 1641 | case QOpenGLTexture::TargetCubeMap: never executed: case QOpenGLTexture::TargetCubeMap: | 0 | ||||||||||||||||||
| 1642 | case QOpenGLTexture::TargetCubeMapArray: never executed: case QOpenGLTexture::TargetCubeMapArray: | 0 | ||||||||||||||||||
| 1643 | viewTargetCompatible = (viewTarget == QOpenGLTexture::TargetCubeMap
| 0 | ||||||||||||||||||
| 1644 | || viewTarget == QOpenGLTexture::Target2D
| 0 | ||||||||||||||||||
| 1645 | || viewTarget == QOpenGLTexture::Target2DArray
| 0 | ||||||||||||||||||
| 1646 | || viewTarget == QOpenGLTexture::TargetCubeMapArray);
| 0 | ||||||||||||||||||
| 1647 | break; never executed: break; | 0 | ||||||||||||||||||
| 1648 | - | |||||||||||||||||||
| 1649 | case QOpenGLTexture::Target2DMultisample: never executed: case QOpenGLTexture::Target2DMultisample: | 0 | ||||||||||||||||||
| 1650 | case QOpenGLTexture::Target2DMultisampleArray: never executed: case QOpenGLTexture::Target2DMultisampleArray: | 0 | ||||||||||||||||||
| 1651 | viewTargetCompatible = (viewTarget == QOpenGLTexture::Target2DMultisample
| 0 | ||||||||||||||||||
| 1652 | || viewTarget == QOpenGLTexture::Target2DMultisampleArray);
| 0 | ||||||||||||||||||
| 1653 | break; never executed: break; | 0 | ||||||||||||||||||
| 1654 | - | |||||||||||||||||||
| 1655 | case QOpenGLTexture::TargetRectangle: never executed: case QOpenGLTexture::TargetRectangle: | 0 | ||||||||||||||||||
| 1656 | viewTargetCompatible = (viewTarget == QOpenGLTexture::TargetRectangle); | - | ||||||||||||||||||
| 1657 | break; never executed: break; | 0 | ||||||||||||||||||
| 1658 | - | |||||||||||||||||||
| 1659 | case QOpenGLTexture::TargetBuffer: never executed: case QOpenGLTexture::TargetBuffer: | 0 | ||||||||||||||||||
| 1660 | // Cannot be used with texture views | - | ||||||||||||||||||
| 1661 | break; never executed: break; | 0 | ||||||||||||||||||
| 1662 | } | - | ||||||||||||||||||
| 1663 | - | |||||||||||||||||||
| 1664 | if (!viewTargetCompatible) {
| 0 | ||||||||||||||||||
| 1665 | qWarning("QOpenGLTexture::createTextureView(): Incompatible source and view targets"); | - | ||||||||||||||||||
| 1666 | return 0; never executed: return 0; | 0 | ||||||||||||||||||
| 1667 | } | - | ||||||||||||||||||
| 1668 | - | |||||||||||||||||||
| 1669 | // Check the formats are compatible | - | ||||||||||||||||||
| 1670 | bool viewFormatCompatible = false; | - | ||||||||||||||||||
| 1671 | switch (formatClass) { | - | ||||||||||||||||||
| 1672 | case QOpenGLTexture::NoFormatClass: never executed: case QOpenGLTexture::NoFormatClass: | 0 | ||||||||||||||||||
| 1673 | break; never executed: break; | 0 | ||||||||||||||||||
| 1674 | - | |||||||||||||||||||
| 1675 | case QOpenGLTexture::FormatClass_128Bit: never executed: case QOpenGLTexture::FormatClass_128Bit: | 0 | ||||||||||||||||||
| 1676 | viewFormatCompatible = (viewFormat == QOpenGLTexture::RGBA32F
| 0 | ||||||||||||||||||
| 1677 | || viewFormat == QOpenGLTexture::RGBA32U
| 0 | ||||||||||||||||||
| 1678 | || viewFormat == QOpenGLTexture::RGBA32I);
| 0 | ||||||||||||||||||
| 1679 | break; never executed: break; | 0 | ||||||||||||||||||
| 1680 | - | |||||||||||||||||||
| 1681 | case QOpenGLTexture::FormatClass_96Bit: never executed: case QOpenGLTexture::FormatClass_96Bit: | 0 | ||||||||||||||||||
| 1682 | viewFormatCompatible = (viewFormat == QOpenGLTexture::RGB32F
| 0 | ||||||||||||||||||
| 1683 | || viewFormat == QOpenGLTexture::RGB32U
| 0 | ||||||||||||||||||
| 1684 | || viewFormat == QOpenGLTexture::RGB32I);
| 0 | ||||||||||||||||||
| 1685 | break; never executed: break; | 0 | ||||||||||||||||||
| 1686 | - | |||||||||||||||||||
| 1687 | case QOpenGLTexture::FormatClass_64Bit: never executed: case QOpenGLTexture::FormatClass_64Bit: | 0 | ||||||||||||||||||
| 1688 | viewFormatCompatible = (viewFormat == QOpenGLTexture::RGBA16F
| 0 | ||||||||||||||||||
| 1689 | || viewFormat == QOpenGLTexture::RG32F
| 0 | ||||||||||||||||||
| 1690 | || viewFormat == QOpenGLTexture::RGBA16U
| 0 | ||||||||||||||||||
| 1691 | || viewFormat == QOpenGLTexture::RG32U
| 0 | ||||||||||||||||||
| 1692 | || viewFormat == QOpenGLTexture::RGBA16I
| 0 | ||||||||||||||||||
| 1693 | || viewFormat == QOpenGLTexture::RG32I
| 0 | ||||||||||||||||||
| 1694 | || viewFormat == QOpenGLTexture::RGBA16_UNorm
| 0 | ||||||||||||||||||
| 1695 | || viewFormat == QOpenGLTexture::RGBA16_SNorm);
| 0 | ||||||||||||||||||
| 1696 | break; never executed: break; | 0 | ||||||||||||||||||
| 1697 | - | |||||||||||||||||||
| 1698 | case QOpenGLTexture::FormatClass_48Bit: never executed: case QOpenGLTexture::FormatClass_48Bit: | 0 | ||||||||||||||||||
| 1699 | viewFormatCompatible = (viewFormat == QOpenGLTexture::RGB16_UNorm
| 0 | ||||||||||||||||||
| 1700 | || viewFormat == QOpenGLTexture::RGB16_SNorm
| 0 | ||||||||||||||||||
| 1701 | || viewFormat == QOpenGLTexture::RGB16F
| 0 | ||||||||||||||||||
| 1702 | || viewFormat == QOpenGLTexture::RGB16U
| 0 | ||||||||||||||||||
| 1703 | || viewFormat == QOpenGLTexture::RGB16I);
| 0 | ||||||||||||||||||
| 1704 | break; never executed: break; | 0 | ||||||||||||||||||
| 1705 | - | |||||||||||||||||||
| 1706 | case QOpenGLTexture::FormatClass_32Bit: never executed: case QOpenGLTexture::FormatClass_32Bit: | 0 | ||||||||||||||||||
| 1707 | viewFormatCompatible = (viewFormat == QOpenGLTexture::RG16F
| 0 | ||||||||||||||||||
| 1708 | || viewFormat == QOpenGLTexture::RG11B10F
| 0 | ||||||||||||||||||
| 1709 | || viewFormat == QOpenGLTexture::R32F
| 0 | ||||||||||||||||||
| 1710 | || viewFormat == QOpenGLTexture::RGB10A2
| 0 | ||||||||||||||||||
| 1711 | || viewFormat == QOpenGLTexture::RGBA8U
| 0 | ||||||||||||||||||
| 1712 | || viewFormat == QOpenGLTexture::RG16U
| 0 | ||||||||||||||||||
| 1713 | || viewFormat == QOpenGLTexture::R32U
| 0 | ||||||||||||||||||
| 1714 | || viewFormat == QOpenGLTexture::RGBA8I
| 0 | ||||||||||||||||||
| 1715 | || viewFormat == QOpenGLTexture::RG16I
| 0 | ||||||||||||||||||
| 1716 | || viewFormat == QOpenGLTexture::R32I
| 0 | ||||||||||||||||||
| 1717 | || viewFormat == QOpenGLTexture::RGBA8_UNorm
| 0 | ||||||||||||||||||
| 1718 | || viewFormat == QOpenGLTexture::RG16_UNorm
| 0 | ||||||||||||||||||
| 1719 | || viewFormat == QOpenGLTexture::RGBA8_SNorm
| 0 | ||||||||||||||||||
| 1720 | || viewFormat == QOpenGLTexture::RG16_SNorm
| 0 | ||||||||||||||||||
| 1721 | || viewFormat == QOpenGLTexture::SRGB8_Alpha8
| 0 | ||||||||||||||||||
| 1722 | || viewFormat == QOpenGLTexture::RGB9E5);
| 0 | ||||||||||||||||||
| 1723 | break; never executed: break; | 0 | ||||||||||||||||||
| 1724 | - | |||||||||||||||||||
| 1725 | case QOpenGLTexture::FormatClass_24Bit: never executed: case QOpenGLTexture::FormatClass_24Bit: | 0 | ||||||||||||||||||
| 1726 | viewFormatCompatible = (viewFormat == QOpenGLTexture::RGB8_UNorm
| 0 | ||||||||||||||||||
| 1727 | || viewFormat == QOpenGLTexture::RGB8_SNorm
| 0 | ||||||||||||||||||
| 1728 | || viewFormat == QOpenGLTexture::SRGB8
| 0 | ||||||||||||||||||
| 1729 | || viewFormat == QOpenGLTexture::RGB8U
| 0 | ||||||||||||||||||
| 1730 | || viewFormat == QOpenGLTexture::RGB8I);
| 0 | ||||||||||||||||||
| 1731 | break; never executed: break; | 0 | ||||||||||||||||||
| 1732 | - | |||||||||||||||||||
| 1733 | case QOpenGLTexture::FormatClass_16Bit: never executed: case QOpenGLTexture::FormatClass_16Bit: | 0 | ||||||||||||||||||
| 1734 | viewFormatCompatible = (viewFormat == QOpenGLTexture::R16F
| 0 | ||||||||||||||||||
| 1735 | || viewFormat == QOpenGLTexture::RG8U
| 0 | ||||||||||||||||||
| 1736 | || viewFormat == QOpenGLTexture::R16U
| 0 | ||||||||||||||||||
| 1737 | || viewFormat == QOpenGLTexture::RG8I
| 0 | ||||||||||||||||||
| 1738 | || viewFormat == QOpenGLTexture::R16I
| 0 | ||||||||||||||||||
| 1739 | || viewFormat == QOpenGLTexture::RG8_UNorm
| 0 | ||||||||||||||||||
| 1740 | || viewFormat == QOpenGLTexture::R16_UNorm
| 0 | ||||||||||||||||||
| 1741 | || viewFormat == QOpenGLTexture::RG8_SNorm
| 0 | ||||||||||||||||||
| 1742 | || viewFormat == QOpenGLTexture::R16_SNorm);
| 0 | ||||||||||||||||||
| 1743 | break; never executed: break; | 0 | ||||||||||||||||||
| 1744 | - | |||||||||||||||||||
| 1745 | case QOpenGLTexture::FormatClass_8Bit: never executed: case QOpenGLTexture::FormatClass_8Bit: | 0 | ||||||||||||||||||
| 1746 | viewFormatCompatible = (viewFormat == QOpenGLTexture::R8U
| 0 | ||||||||||||||||||
| 1747 | || viewFormat == QOpenGLTexture::R8I
| 0 | ||||||||||||||||||
| 1748 | || viewFormat == QOpenGLTexture::R8_UNorm
| 0 | ||||||||||||||||||
| 1749 | || viewFormat == QOpenGLTexture::R8_SNorm);
| 0 | ||||||||||||||||||
| 1750 | break; never executed: break; | 0 | ||||||||||||||||||
| 1751 | - | |||||||||||||||||||
| 1752 | case QOpenGLTexture::FormatClass_RGTC1_R: never executed: case QOpenGLTexture::FormatClass_RGTC1_R: | 0 | ||||||||||||||||||
| 1753 | viewFormatCompatible = (viewFormat == QOpenGLTexture::R_ATI1N_UNorm
| 0 | ||||||||||||||||||
| 1754 | || viewFormat == QOpenGLTexture::R_ATI1N_SNorm);
| 0 | ||||||||||||||||||
| 1755 | break; never executed: break; | 0 | ||||||||||||||||||
| 1756 | - | |||||||||||||||||||
| 1757 | case QOpenGLTexture::FormatClass_RGTC2_RG: never executed: case QOpenGLTexture::FormatClass_RGTC2_RG: | 0 | ||||||||||||||||||
| 1758 | viewFormatCompatible = (viewFormat == QOpenGLTexture::RG_ATI2N_UNorm
| 0 | ||||||||||||||||||
| 1759 | || viewFormat == QOpenGLTexture::RG_ATI2N_SNorm);
| 0 | ||||||||||||||||||
| 1760 | break; never executed: break; | 0 | ||||||||||||||||||
| 1761 | - | |||||||||||||||||||
| 1762 | case QOpenGLTexture::FormatClass_BPTC_Unorm: never executed: case QOpenGLTexture::FormatClass_BPTC_Unorm: | 0 | ||||||||||||||||||
| 1763 | viewFormatCompatible = (viewFormat == QOpenGLTexture::RGB_BP_UNorm
| 0 | ||||||||||||||||||
| 1764 | || viewFormat == QOpenGLTexture::SRGB_BP_UNorm);
| 0 | ||||||||||||||||||
| 1765 | break; never executed: break; | 0 | ||||||||||||||||||
| 1766 | - | |||||||||||||||||||
| 1767 | case QOpenGLTexture::FormatClass_BPTC_Float: never executed: case QOpenGLTexture::FormatClass_BPTC_Float: | 0 | ||||||||||||||||||
| 1768 | viewFormatCompatible = (viewFormat == QOpenGLTexture::RGB_BP_UNSIGNED_FLOAT
| 0 | ||||||||||||||||||
| 1769 | || viewFormat == QOpenGLTexture::RGB_BP_SIGNED_FLOAT);
| 0 | ||||||||||||||||||
| 1770 | break; never executed: break; | 0 | ||||||||||||||||||
| 1771 | - | |||||||||||||||||||
| 1772 | case QOpenGLTexture::FormatClass_S3TC_DXT1_RGB: never executed: case QOpenGLTexture::FormatClass_S3TC_DXT1_RGB: | 0 | ||||||||||||||||||
| 1773 | viewFormatCompatible = (viewFormat == QOpenGLTexture::RGB_DXT1
| 0 | ||||||||||||||||||
| 1774 | || viewFormat == QOpenGLTexture::SRGB_DXT1);
| 0 | ||||||||||||||||||
| 1775 | break; never executed: break; | 0 | ||||||||||||||||||
| 1776 | - | |||||||||||||||||||
| 1777 | case QOpenGLTexture::FormatClass_S3TC_DXT1_RGBA: never executed: case QOpenGLTexture::FormatClass_S3TC_DXT1_RGBA: | 0 | ||||||||||||||||||
| 1778 | viewFormatCompatible = (viewFormat == QOpenGLTexture::RGBA_DXT1
| 0 | ||||||||||||||||||
| 1779 | || viewFormat == QOpenGLTexture::SRGB_Alpha_DXT1);
| 0 | ||||||||||||||||||
| 1780 | break; never executed: break; | 0 | ||||||||||||||||||
| 1781 | - | |||||||||||||||||||
| 1782 | case QOpenGLTexture::FormatClass_S3TC_DXT3_RGBA: never executed: case QOpenGLTexture::FormatClass_S3TC_DXT3_RGBA: | 0 | ||||||||||||||||||
| 1783 | viewFormatCompatible = (viewFormat == QOpenGLTexture::RGBA_DXT3
| 0 | ||||||||||||||||||
| 1784 | || viewFormat == QOpenGLTexture::SRGB_Alpha_DXT3);
| 0 | ||||||||||||||||||
| 1785 | break; never executed: break; | 0 | ||||||||||||||||||
| 1786 | - | |||||||||||||||||||
| 1787 | case QOpenGLTexture::FormatClass_S3TC_DXT5_RGBA: never executed: case QOpenGLTexture::FormatClass_S3TC_DXT5_RGBA: | 0 | ||||||||||||||||||
| 1788 | viewFormatCompatible = (viewFormat == QOpenGLTexture::RGBA_DXT5
| 0 | ||||||||||||||||||
| 1789 | || viewFormat == QOpenGLTexture::SRGB_Alpha_DXT5);
| 0 | ||||||||||||||||||
| 1790 | break; never executed: break; | 0 | ||||||||||||||||||
| 1791 | - | |||||||||||||||||||
| 1792 | case QOpenGLTexture::FormatClass_Unique: never executed: case QOpenGLTexture::FormatClass_Unique: | 0 | ||||||||||||||||||
| 1793 | viewFormatCompatible = (viewFormat == format); | - | ||||||||||||||||||
| 1794 | break; never executed: break; | 0 | ||||||||||||||||||
| 1795 | } | - | ||||||||||||||||||
| 1796 | - | |||||||||||||||||||
| 1797 | if (!viewFormatCompatible) {
| 0 | ||||||||||||||||||
| 1798 | qWarning("QOpenGLTexture::createTextureView(): Incompatible source and view formats"); | - | ||||||||||||||||||
| 1799 | return 0; never executed: return 0; | 0 | ||||||||||||||||||
| 1800 | } | - | ||||||||||||||||||
| 1801 | - | |||||||||||||||||||
| 1802 | - | |||||||||||||||||||
| 1803 | // Create a view | - | ||||||||||||||||||
| 1804 | QOpenGLTexture *view = new QOpenGLTexture(viewTarget); | - | ||||||||||||||||||
| 1805 | view->setFormat(viewFormat); | - | ||||||||||||||||||
| 1806 | view->create(); | - | ||||||||||||||||||
| 1807 | view->d_ptr->textureView = true; | - | ||||||||||||||||||
| 1808 | texFuncs->glTextureView(view->textureId(), viewTarget, textureId, viewFormat, | - | ||||||||||||||||||
| 1809 | minimumMipmapLevel, maximumMipmapLevel - minimumMipmapLevel + 1, | - | ||||||||||||||||||
| 1810 | minimumLayer, maximumLayer - minimumLayer + 1); | - | ||||||||||||||||||
| 1811 | return view; never executed: return view; | 0 | ||||||||||||||||||
| 1812 | } | - | ||||||||||||||||||
| 1813 | - | |||||||||||||||||||
| 1814 | - | |||||||||||||||||||
| 1815 | /*! | - | ||||||||||||||||||
| 1816 | \class QOpenGLTexture | - | ||||||||||||||||||
| 1817 | \inmodule QtGui | - | ||||||||||||||||||
| 1818 | \since 5.2 | - | ||||||||||||||||||
| 1819 | \wrapper | - | ||||||||||||||||||
| 1820 | \brief The QOpenGLTexture class encapsulates an OpenGL texture object. | - | ||||||||||||||||||
| 1821 | - | |||||||||||||||||||
| 1822 | QOpenGLTexture makes it easy to work with OpenGL textures and the myriad features | - | ||||||||||||||||||
| 1823 | and targets that they offer depending upon the capabilities of your OpenGL implementation. | - | ||||||||||||||||||
| 1824 | - | |||||||||||||||||||
| 1825 | The typical usage pattern for QOpenGLTexture is | - | ||||||||||||||||||
| 1826 | \list | - | ||||||||||||||||||
| 1827 | \li Instantiate the object specifying the texture target type | - | ||||||||||||||||||
| 1828 | \li Set properties that affect the storage requirements e.g. storage format, dimensions | - | ||||||||||||||||||
| 1829 | \li Allocate the server-side storage | - | ||||||||||||||||||
| 1830 | \li Optionally upload pixel data | - | ||||||||||||||||||
| 1831 | \li Optionally set any additional properties e.g. filtering and border options | - | ||||||||||||||||||
| 1832 | \li Render with texture or render to texture | - | ||||||||||||||||||
| 1833 | \endlist | - | ||||||||||||||||||
| 1834 | - | |||||||||||||||||||
| 1835 | In the common case of simply using a QImage as the source of texture pixel data | - | ||||||||||||||||||
| 1836 | most of the above steps are performed automatically. | - | ||||||||||||||||||
| 1837 | - | |||||||||||||||||||
| 1838 | \code | - | ||||||||||||||||||
| 1839 | // Prepare texture | - | ||||||||||||||||||
| 1840 | QOpenGLTexture *texture = new QOpenGLTexture(QImage(fileName).mirrored()); | - | ||||||||||||||||||
| 1841 | texture->setMinificationFilter(QOpenGLTexture::LinearMipMapLinear); | - | ||||||||||||||||||
| 1842 | texture->setMagnificationFilter(QOpenGLTexture::Linear); | - | ||||||||||||||||||
| 1843 | ... | - | ||||||||||||||||||
| 1844 | // Render with texture | - | ||||||||||||||||||
| 1845 | texture->bind(); | - | ||||||||||||||||||
| 1846 | glDrawArrays(...); | - | ||||||||||||||||||
| 1847 | \endcode | - | ||||||||||||||||||
| 1848 | - | |||||||||||||||||||
| 1849 | Note that the QImage is mirrored vertically to account for the fact that | - | ||||||||||||||||||
| 1850 | OpenGL and QImage use opposite directions for the y axis. Another option | - | ||||||||||||||||||
| 1851 | would be to transform your texture coordinates. | - | ||||||||||||||||||
| 1852 | */ | - | ||||||||||||||||||
| 1853 | - | |||||||||||||||||||
| 1854 | /*! | - | ||||||||||||||||||
| 1855 | \enum QOpenGLTexture::Filter | - | ||||||||||||||||||
| 1856 | This enum defines the filtering parameters for a QOpenGLTexture object. | - | ||||||||||||||||||
| 1857 | \value Nearest Equivalent to GL_NEAREST | - | ||||||||||||||||||
| 1858 | \value Linear Equivalent to GL_LINEAR | - | ||||||||||||||||||
| 1859 | \value NearestMipMapNearest Equivalent to GL_NEAREST_MIPMAP_NEAREST | - | ||||||||||||||||||
| 1860 | \value NearestMipMapLinear Equivalent to GL_NEAREST_MIPMAP_LINEAR | - | ||||||||||||||||||
| 1861 | \value LinearMipMapNearest Equivalent to GL_LINEAR_MIPMAP_NEAREST | - | ||||||||||||||||||
| 1862 | \value LinearMipMapLinear Equivalent to GL_LINEAR_MIPMAP_LINEAR | - | ||||||||||||||||||
| 1863 | */ | - | ||||||||||||||||||
| 1864 | - | |||||||||||||||||||
| 1865 | /*! | - | ||||||||||||||||||
| 1866 | \enum QOpenGLTexture::Target | - | ||||||||||||||||||
| 1867 | This enum defines the texture target of a QOpenGLTexture object. | - | ||||||||||||||||||
| 1868 | - | |||||||||||||||||||
| 1869 | \value Target1D A 1-dimensional texture. | - | ||||||||||||||||||
| 1870 | Equivalent to GL_TEXTURE_1D. | - | ||||||||||||||||||
| 1871 | \value Target1DArray An array of 1-dimensional textures. | - | ||||||||||||||||||
| 1872 | Equivalent to GL_TEXTURE_1D_ARRAY | - | ||||||||||||||||||
| 1873 | \value Target2D A 2-dimensional texture. | - | ||||||||||||||||||
| 1874 | Equivalent to GL_TEXTURE_2D | - | ||||||||||||||||||
| 1875 | \value Target2DArray An array of 1-dimensional textures. | - | ||||||||||||||||||
| 1876 | Equivalent to GL_TEXTURE_2D_ARRAY | - | ||||||||||||||||||
| 1877 | \value Target3D A 3-dimensional texture. | - | ||||||||||||||||||
| 1878 | Equivalent to GL_TEXTURE_3D | - | ||||||||||||||||||
| 1879 | \value TargetCubeMap A cubemap texture. | - | ||||||||||||||||||
| 1880 | Equivalent to GL_TEXTURE_CUBE_MAP | - | ||||||||||||||||||
| 1881 | \value TargetCubeMapArray An array of cubemap textures. | - | ||||||||||||||||||
| 1882 | Equivalent to GL_TEXTURE_CUBE_MAP_ARRAY | - | ||||||||||||||||||
| 1883 | \value Target2DMultisample A 2-dimensional texture with multisample support. | - | ||||||||||||||||||
| 1884 | Equivalent to GL_TEXTURE_2D_MULTISAMPLE | - | ||||||||||||||||||
| 1885 | \value Target2DMultisampleArray An array of 2-dimensional textures with multisample support. | - | ||||||||||||||||||
| 1886 | Equivalent to GL_TEXTURE_2D_MULTISAMPLE_ARRAY | - | ||||||||||||||||||
| 1887 | \value TargetRectangle A rectangular 2-dimensional texture. | - | ||||||||||||||||||
| 1888 | Equivalent to GL_TEXTURE_RECTANGLE | - | ||||||||||||||||||
| 1889 | \value TargetBuffer A texture with data from an OpenGL buffer object. | - | ||||||||||||||||||
| 1890 | Equivalent to GL_TEXTURE_BUFFER | - | ||||||||||||||||||
| 1891 | */ | - | ||||||||||||||||||
| 1892 | - | |||||||||||||||||||
| 1893 | /*! | - | ||||||||||||||||||
| 1894 | \enum QOpenGLTexture::BindingTarget | - | ||||||||||||||||||
| 1895 | This enum defines the possible binding targets of texture units. | - | ||||||||||||||||||
| 1896 | - | |||||||||||||||||||
| 1897 | \value BindingTarget1D Equivalent to GL_TEXTURE_BINDING_1D | - | ||||||||||||||||||
| 1898 | \value BindingTarget1DArray Equivalent to GL_TEXTURE_BINDING_1D_ARRAY | - | ||||||||||||||||||
| 1899 | \value BindingTarget2D Equivalent to GL_TEXTURE_BINDING_2D | - | ||||||||||||||||||
| 1900 | \value BindingTarget2DArray Equivalent to GL_TEXTURE_BINDING_2D_ARRAY | - | ||||||||||||||||||
| 1901 | \value BindingTarget3D Equivalent to GL_TEXTURE_BINDING_3D | - | ||||||||||||||||||
| 1902 | \value BindingTargetCubeMap Equivalent to GL_TEXTURE_BINDING_CUBE_MAP | - | ||||||||||||||||||
| 1903 | \value BindingTargetCubeMapArray Equivalent to GL_TEXTURE_BINDING_CUBE_MAP_ARRAY | - | ||||||||||||||||||
| 1904 | \value BindingTarget2DMultisample Equivalent to GL_TEXTURE_BINDING_2D_MULTISAMPLE | - | ||||||||||||||||||
| 1905 | \value BindingTarget2DMultisampleArray Equivalent to GL_TEXTURE_BINDING_2D_MULTISAMPLE_ARRAY | - | ||||||||||||||||||
| 1906 | \value BindingTargetRectangle Equivalent to GL_TEXTURE_BINDING_RECTANGLE | - | ||||||||||||||||||
| 1907 | \value BindingTargetBuffer Equivalent to GL_TEXTURE_BINDING_BUFFER | - | ||||||||||||||||||
| 1908 | */ | - | ||||||||||||||||||
| 1909 | - | |||||||||||||||||||
| 1910 | /*! | - | ||||||||||||||||||
| 1911 | \enum QOpenGLTexture::MipMapGeneration | - | ||||||||||||||||||
| 1912 | This enum defines the options to control mipmap generation. | - | ||||||||||||||||||
| 1913 | - | |||||||||||||||||||
| 1914 | \value GenerateMipMaps Mipmaps should be generated | - | ||||||||||||||||||
| 1915 | \value DontGenerateMipMaps Mipmaps should not be generated | - | ||||||||||||||||||
| 1916 | */ | - | ||||||||||||||||||
| 1917 | - | |||||||||||||||||||
| 1918 | /*! | - | ||||||||||||||||||
| 1919 | \enum QOpenGLTexture::TextureUnitReset | - | ||||||||||||||||||
| 1920 | This enum defines options ot control texture unit activation. | - | ||||||||||||||||||
| 1921 | - | |||||||||||||||||||
| 1922 | \value ResetTextureUnit The previous active texture unit will be reset | - | ||||||||||||||||||
| 1923 | \value DontResetTextureUnit The previous active texture unit will not be rest | - | ||||||||||||||||||
| 1924 | */ | - | ||||||||||||||||||
| 1925 | - | |||||||||||||||||||
| 1926 | /*! | - | ||||||||||||||||||
| 1927 | \enum QOpenGLTexture::TextureFormat | - | ||||||||||||||||||
| 1928 | This enum defines the possible texture formats. Depending upon your OpenGL | - | ||||||||||||||||||
| 1929 | implementation only a subset of these may be supported. | - | ||||||||||||||||||
| 1930 | - | |||||||||||||||||||
| 1931 | \value NoFormat Equivalent to GL_NONE | - | ||||||||||||||||||
| 1932 | - | |||||||||||||||||||
| 1933 | \value R8_UNorm Equivalent to GL_R8 | - | ||||||||||||||||||
| 1934 | \value RG8_UNorm Equivalent to GL_RG8 | - | ||||||||||||||||||
| 1935 | \value RGB8_UNorm Equivalent to GL_RGB8 | - | ||||||||||||||||||
| 1936 | \value RGBA8_UNorm Equivalent to GL_RGBA8 | - | ||||||||||||||||||
| 1937 | - | |||||||||||||||||||
| 1938 | \value R16_UNorm Equivalent to GL_R16 | - | ||||||||||||||||||
| 1939 | \value RG16_UNorm Equivalent to GL_RG16 | - | ||||||||||||||||||
| 1940 | \value RGB16_UNorm Equivalent to GL_RGB16 | - | ||||||||||||||||||
| 1941 | \value RGBA16_UNorm Equivalent to GL_RGBA16 | - | ||||||||||||||||||
| 1942 | - | |||||||||||||||||||
| 1943 | \value R8_SNorm Equivalent to GL_R8_SNORM | - | ||||||||||||||||||
| 1944 | \value RG8_SNorm Equivalent to GL_RG8_SNORM | - | ||||||||||||||||||
| 1945 | \value RGB8_SNorm Equivalent to GL_RGB8_SNORM | - | ||||||||||||||||||
| 1946 | \value RGBA8_SNorm Equivalent to GL_RGBA8_SNORM | - | ||||||||||||||||||
| 1947 | - | |||||||||||||||||||
| 1948 | \value R16_SNorm Equivalent to GL_R16_SNORM | - | ||||||||||||||||||
| 1949 | \value RG16_SNorm Equivalent to GL_RG16_SNORM | - | ||||||||||||||||||
| 1950 | \value RGB16_SNorm Equivalent to GL_RGB16_SNORM | - | ||||||||||||||||||
| 1951 | \value RGBA16_SNorm Equivalent to GL_RGBA16_SNORM | - | ||||||||||||||||||
| 1952 | - | |||||||||||||||||||
| 1953 | \value R8U Equivalent to GL_R8UI | - | ||||||||||||||||||
| 1954 | \value RG8U Equivalent to GL_RG8UI | - | ||||||||||||||||||
| 1955 | \value RGB8U Equivalent to GL_RGB8UI | - | ||||||||||||||||||
| 1956 | \value RGBA8U Equivalent to GL_RGBA8UI | - | ||||||||||||||||||
| 1957 | - | |||||||||||||||||||
| 1958 | \value R16U Equivalent to GL_R16UI | - | ||||||||||||||||||
| 1959 | \value RG16U Equivalent to GL_RG16UI | - | ||||||||||||||||||
| 1960 | \value RGB16U Equivalent to GL_RGB16UI | - | ||||||||||||||||||
| 1961 | \value RGBA16U Equivalent to GL_RGBA16UI | - | ||||||||||||||||||
| 1962 | - | |||||||||||||||||||
| 1963 | \value R32U Equivalent to GL_R32UI | - | ||||||||||||||||||
| 1964 | \value RG32U Equivalent to GL_RG32UI | - | ||||||||||||||||||
| 1965 | \value RGB32U Equivalent to GL_RGB32UI | - | ||||||||||||||||||
| 1966 | \value RGBA32U Equivalent to GL_RGBA32UI | - | ||||||||||||||||||
| 1967 | - | |||||||||||||||||||
| 1968 | \value R8I Equivalent to GL_R8I | - | ||||||||||||||||||
| 1969 | \value RG8I Equivalent to GL_RG8I | - | ||||||||||||||||||
| 1970 | \value RGB8I Equivalent to GL_RGB8I | - | ||||||||||||||||||
| 1971 | \value RGBA8I Equivalent to GL_RGBA8I | - | ||||||||||||||||||
| 1972 | - | |||||||||||||||||||
| 1973 | \value R16I Equivalent to GL_R16I | - | ||||||||||||||||||
| 1974 | \value RG16I Equivalent to GL_RG16I | - | ||||||||||||||||||
| 1975 | \value RGB16I Equivalent to GL_RGB16I | - | ||||||||||||||||||
| 1976 | \value RGBA16I Equivalent to GL_RGBA16I | - | ||||||||||||||||||
| 1977 | - | |||||||||||||||||||
| 1978 | \value R32I Equivalent to GL_R32I | - | ||||||||||||||||||
| 1979 | \value RG32I Equivalent to GL_RG32I | - | ||||||||||||||||||
| 1980 | \value RGB32I Equivalent to GL_RGB32I | - | ||||||||||||||||||
| 1981 | \value RGBA32I Equivalent to GL_RGBA32I | - | ||||||||||||||||||
| 1982 | - | |||||||||||||||||||
| 1983 | \value R16F Equivalent to GL_R16F | - | ||||||||||||||||||
| 1984 | \value RG16F Equivalent to GL_RG16F | - | ||||||||||||||||||
| 1985 | \value RGB16F Equivalent to GL_RGB16F | - | ||||||||||||||||||
| 1986 | \value RGBA16F Equivalent to GL_RGBA16F | - | ||||||||||||||||||
| 1987 | - | |||||||||||||||||||
| 1988 | \value R32F Equivalent to GL_R32F | - | ||||||||||||||||||
| 1989 | \value RG32F Equivalent to GL_RG32F | - | ||||||||||||||||||
| 1990 | \value RGB32F Equivalent to GL_RGB32F | - | ||||||||||||||||||
| 1991 | \value RGBA32F Equivalent to GL_RGBA32F | - | ||||||||||||||||||
| 1992 | - | |||||||||||||||||||
| 1993 | \value RGB9E5 Equivalent to GL_RGB9_E5 | - | ||||||||||||||||||
| 1994 | \value RG11B10F Equivalent to GL_R11F_G11F_B10F | - | ||||||||||||||||||
| 1995 | \value RG3B2 Equivalent to GL_R3_G3_B2 | - | ||||||||||||||||||
| 1996 | \value R5G6B5 Equivalent to GL_RGB565 | - | ||||||||||||||||||
| 1997 | \value RGB5A1 Equivalent to GL_RGB5_A1 | - | ||||||||||||||||||
| 1998 | \value RGBA4 Equivalent to GL_RGBA4 | - | ||||||||||||||||||
| 1999 | \value RGB10A2 Equivalent to GL_RGB10_A2UI | - | ||||||||||||||||||
| 2000 | - | |||||||||||||||||||
| 2001 | \value D16 Equivalent to GL_DEPTH_COMPONENT16 | - | ||||||||||||||||||
| 2002 | \value D24 Equivalent to GL_DEPTH_COMPONENT24 | - | ||||||||||||||||||
| 2003 | \value D24S8 Equivalent to GL_DEPTH24_STENCIL8 | - | ||||||||||||||||||
| 2004 | \value D32 Equivalent to GL_DEPTH_COMPONENT32 | - | ||||||||||||||||||
| 2005 | \value D32F Equivalent to GL_DEPTH_COMPONENT32F | - | ||||||||||||||||||
| 2006 | \value D32FS8X24 Equivalent to GL_DEPTH32F_STENCIL8 | - | ||||||||||||||||||
| 2007 | \value S8 Equivalent to GL_STENCIL_INDEX8. Introduced in Qt 5.4 | - | ||||||||||||||||||
| 2008 | - | |||||||||||||||||||
| 2009 | \value RGB_DXT1 Equivalent to GL_COMPRESSED_RGB_S3TC_DXT1_EXT | - | ||||||||||||||||||
| 2010 | \value RGBA_DXT1 Equivalent to GL_COMPRESSED_RGBA_S3TC_DXT1_EXT | - | ||||||||||||||||||
| 2011 | \value RGBA_DXT3 Equivalent to GL_COMPRESSED_RGBA_S3TC_DXT3_EXT | - | ||||||||||||||||||
| 2012 | \value RGBA_DXT5 Equivalent to GL_COMPRESSED_RGBA_S3TC_DXT5_EXT | - | ||||||||||||||||||
| 2013 | \value R_ATI1N_UNorm Equivalent to GL_COMPRESSED_RED_RGTC1 | - | ||||||||||||||||||
| 2014 | \value R_ATI1N_SNorm Equivalent to GL_COMPRESSED_SIGNED_RED_RGTC1 | - | ||||||||||||||||||
| 2015 | \value RG_ATI2N_UNorm Equivalent to GL_COMPRESSED_RG_RGTC2 | - | ||||||||||||||||||
| 2016 | \value RG_ATI2N_SNorm Equivalent to GL_COMPRESSED_SIGNED_RG_RGTC2 | - | ||||||||||||||||||
| 2017 | \value RGB_BP_UNSIGNED_FLOAT Equivalent to GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_ARB | - | ||||||||||||||||||
| 2018 | \value RGB_BP_SIGNED_FLOAT Equivalent to GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT_ARB | - | ||||||||||||||||||
| 2019 | \value RGB_BP_UNorm Equivalent to GL_COMPRESSED_RGBA_BPTC_UNORM_ARB | - | ||||||||||||||||||
| 2020 | \value R11_EAC_UNorm Equivalent to GL_COMPRESSED_R11_EAC | - | ||||||||||||||||||
| 2021 | \value R11_EAC_SNorm Equivalent to GL_COMPRESSED_SIGNED_R11_EAC | - | ||||||||||||||||||
| 2022 | \value RG11_EAC_UNorm Equivalent to GL_COMPRESSED_RG11_EAC | - | ||||||||||||||||||
| 2023 | \value RG11_EAC_SNorm Equivalent to GL_COMPRESSED_SIGNED_RG11_EAC | - | ||||||||||||||||||
| 2024 | \value RGB8_ETC2 Equivalent to GL_COMPRESSED_RGB8_ETC2 | - | ||||||||||||||||||
| 2025 | \value SRGB8_ETC2 Equivalent to GL_COMPRESSED_SRGB8_ETC2 | - | ||||||||||||||||||
| 2026 | \value RGB8_PunchThrough_Alpha1_ETC2 Equivalent to GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2 | - | ||||||||||||||||||
| 2027 | \value SRGB8_PunchThrough_Alpha1_ETC2 Equivalent to GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2 | - | ||||||||||||||||||
| 2028 | \value RGBA8_ETC2_EAC Equivalent to GL_COMPRESSED_RGBA8_ETC2_EAC | - | ||||||||||||||||||
| 2029 | \value SRGB8_Alpha8_ETC2_EAC Equivalent to GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC | - | ||||||||||||||||||
| 2030 | \value RGB8_ETC1 Equivalent to GL_ETC1_RGB8_OES | - | ||||||||||||||||||
| 2031 | - | |||||||||||||||||||
| 2032 | \value SRGB8 Equivalent to GL_SRGB8 | - | ||||||||||||||||||
| 2033 | \value SRGB8_Alpha8 Equivalent to GL_SRGB8_ALPHA8 | - | ||||||||||||||||||
| 2034 | \value SRGB_DXT1 Equivalent to GL_COMPRESSED_SRGB_S3TC_DXT1_EXT | - | ||||||||||||||||||
| 2035 | \value SRGB_Alpha_DXT1 Equivalent to GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT | - | ||||||||||||||||||
| 2036 | \value SRGB_Alpha_DXT3 Equivalent to GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT | - | ||||||||||||||||||
| 2037 | \value SRGB_Alpha_DXT5 Equivalent to GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT | - | ||||||||||||||||||
| 2038 | \value SRGB_BP_UNorm Equivalent to GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM_ARB | - | ||||||||||||||||||
| 2039 | - | |||||||||||||||||||
| 2040 | \value DepthFormat Equivalent to GL_DEPTH_COMPONENT (only OpenGL ES 3 or ES 2 with OES_depth_texture) | - | ||||||||||||||||||
| 2041 | \value AlphaFormat Equivalent to GL_ALPHA (OpenGL ES 2 only) | - | ||||||||||||||||||
| 2042 | \value RGBFormat Equivalent to GL_RGB (OpenGL ES 2 only) | - | ||||||||||||||||||
| 2043 | \value RGBAFormat Equivalent to GL_RGBA (OpenGL ES 2 only) | - | ||||||||||||||||||
| 2044 | \value LuminanceFormat Equivalent to GL_LUMINANCE (OpenGL ES 2 only) | - | ||||||||||||||||||
| 2045 | \value LuminanceAlphaFormat Equivalent to GL_LUMINANCE_ALPHA (OpenGL ES 2 only) | - | ||||||||||||||||||
| 2046 | */ | - | ||||||||||||||||||
| 2047 | - | |||||||||||||||||||
| 2048 | /*! | - | ||||||||||||||||||
| 2049 | \enum QOpenGLTexture::CubeMapFace | - | ||||||||||||||||||
| 2050 | This enum defines the possible CubeMap faces. | - | ||||||||||||||||||
| 2051 | - | |||||||||||||||||||
| 2052 | \value CubeMapPositiveX Equivalent to GL_TEXTURE_CUBE_MAP_POSITIVE_X | - | ||||||||||||||||||
| 2053 | \value CubeMapNegativeX Equivalent to GL_TEXTURE_CUBE_MAP_NEGATIVE_X | - | ||||||||||||||||||
| 2054 | \value CubeMapPositiveY Equivalent to GL_TEXTURE_CUBE_MAP_POSITIVE_Y | - | ||||||||||||||||||
| 2055 | \value CubeMapNegativeY Equivalent to GL_TEXTURE_CUBE_MAP_NEGATIVE_Y | - | ||||||||||||||||||
| 2056 | \value CubeMapPositiveZ Equivalent to GL_TEXTURE_CUBE_MAP_POSITIVE_Z | - | ||||||||||||||||||
| 2057 | \value CubeMapNegativeZ Equivalent to GL_TEXTURE_CUBE_MAP_NEGATIVE_Z | - | ||||||||||||||||||
| 2058 | */ | - | ||||||||||||||||||
| 2059 | - | |||||||||||||||||||
| 2060 | /*! | - | ||||||||||||||||||
| 2061 | \enum QOpenGLTexture::PixelFormat | - | ||||||||||||||||||
| 2062 | This enum defines the possible client-side pixel formats for a pixel | - | ||||||||||||||||||
| 2063 | transfer operation. | - | ||||||||||||||||||
| 2064 | - | |||||||||||||||||||
| 2065 | \value NoSourceFormat Equivalent to GL_NONE | - | ||||||||||||||||||
| 2066 | \value Red Equivalent to GL_RED | - | ||||||||||||||||||
| 2067 | \value RG Equivalent to GL_RG | - | ||||||||||||||||||
| 2068 | \value RGB Equivalent to GL_RGB | - | ||||||||||||||||||
| 2069 | \value BGR Equivalent to GL_BGR | - | ||||||||||||||||||
| 2070 | \value RGBA Equivalent to GL_RGBA | - | ||||||||||||||||||
| 2071 | \value BGRA Equivalent to GL_BGRA | - | ||||||||||||||||||
| 2072 | \value Red_Integer Equivalent to GL_RED_INTEGER | - | ||||||||||||||||||
| 2073 | \value RG_Integer Equivalent to GL_RG_INTEGER | - | ||||||||||||||||||
| 2074 | \value RGB_Integer Equivalent to GL_RGB_INTEGER | - | ||||||||||||||||||
| 2075 | \value BGR_Integer Equivalent to GL_BGR_INTEGER | - | ||||||||||||||||||
| 2076 | \value RGBA_Integer Equivalent to GL_RGBA_INTEGER | - | ||||||||||||||||||
| 2077 | \value BGRA_Integer Equivalent to GL_BGRA_INTEGER | - | ||||||||||||||||||
| 2078 | \value Stencil Equivalent to GL_STENCIL_INDEX. Introduced in Qt 5.4 | - | ||||||||||||||||||
| 2079 | \value Depth Equivalent to GL_DEPTH_COMPONENT | - | ||||||||||||||||||
| 2080 | \value DepthStencil Equivalent to GL_DEPTH_STENCIL | - | ||||||||||||||||||
| 2081 | \value Alpha Equivalent to GL_ALPHA (OpenGL ES 2 only) | - | ||||||||||||||||||
| 2082 | \value Luminance Equivalent to GL_LUMINANCE (OpenGL ES 2 only) | - | ||||||||||||||||||
| 2083 | \value LuminanceAlpha Equivalent to GL_LUMINANCE_ALPHA (OpenGL ES 2 only) | - | ||||||||||||||||||
| 2084 | - | |||||||||||||||||||
| 2085 | */ | - | ||||||||||||||||||
| 2086 | - | |||||||||||||||||||
| 2087 | /*! | - | ||||||||||||||||||
| 2088 | \enum QOpenGLTexture::PixelType | - | ||||||||||||||||||
| 2089 | This enum defines the possible pixel data types for a pixel transfer operation | - | ||||||||||||||||||
| 2090 | - | |||||||||||||||||||
| 2091 | \value NoPixelType Equivalent to GL_NONE | - | ||||||||||||||||||
| 2092 | \value Int8 Equivalent to GL_BYTE | - | ||||||||||||||||||
| 2093 | \value UInt8 Equivalent to GL_UNSIGNED_BYTE | - | ||||||||||||||||||
| 2094 | \value Int16 Equivalent to GL_SHORT | - | ||||||||||||||||||
| 2095 | \value UInt16 Equivalent to GL_UNSIGNED_SHORT | - | ||||||||||||||||||
| 2096 | \value Int32 Equivalent to GL_INT | - | ||||||||||||||||||
| 2097 | \value UInt32 Equivalent to GL_UNSIGNED_INT | - | ||||||||||||||||||
| 2098 | \value Float16 Equivalent to GL_HALF_FLOAT | - | ||||||||||||||||||
| 2099 | \value Float16OES Equivalent to GL_HALF_FLOAT_OES | - | ||||||||||||||||||
| 2100 | \value Float32 Equivalent to GL_FLOAT | - | ||||||||||||||||||
| 2101 | \value UInt32_RGB9_E5 Equivalent to GL_UNSIGNED_INT_5_9_9_9_REV | - | ||||||||||||||||||
| 2102 | \value UInt32_RG11B10F Equivalent to GL_UNSIGNED_INT_10F_11F_11F_REV | - | ||||||||||||||||||
| 2103 | \value UInt8_RG3B2 Equivalent to GL_UNSIGNED_BYTE_3_3_2 | - | ||||||||||||||||||
| 2104 | \value UInt8_RG3B2_Rev Equivalent to GL_UNSIGNED_BYTE_2_3_3_REV | - | ||||||||||||||||||
| 2105 | \value UInt16_RGB5A1 Equivalent to GL_UNSIGNED_SHORT_5_5_5_1 | - | ||||||||||||||||||
| 2106 | \value UInt16_RGB5A1_Rev Equivalent to GL_UNSIGNED_SHORT_1_5_5_5_REV | - | ||||||||||||||||||
| 2107 | \value UInt16_R5G6B5 Equivalent to GL_UNSIGNED_SHORT_5_6_5 | - | ||||||||||||||||||
| 2108 | \value UInt16_R5G6B5_Rev Equivalent to GL_UNSIGNED_SHORT_5_6_5_REV | - | ||||||||||||||||||
| 2109 | \value UInt16_RGBA4 Equivalent to GL_UNSIGNED_SHORT_4_4_4_4 | - | ||||||||||||||||||
| 2110 | \value UInt16_RGBA4_Rev Equivalent to GL_UNSIGNED_SHORT_4_4_4_4_REV | - | ||||||||||||||||||
| 2111 | \value UInt32_RGBA8 Equivalent to GL_UNSIGNED_INT_8_8_8_8 | - | ||||||||||||||||||
| 2112 | \value UInt32_RGBA8_Rev Equivalent to GL_UNSIGNED_INT_8_8_8_8_REV | - | ||||||||||||||||||
| 2113 | \value UInt32_RGB10A2 Equivalent to GL_UNSIGNED_INT_10_10_10_2 | - | ||||||||||||||||||
| 2114 | \value UInt32_RGB10A2_Rev Equivalent to GL_UNSIGNED_INT_2_10_10_10_REV | - | ||||||||||||||||||
| 2115 | \value UInt32_D24S8 Equivalent to GL_UNSIGNED_INT_24_8. Introduced in Qt 5.4 | - | ||||||||||||||||||
| 2116 | \value Float32_D32_UInt32_S8_X24 Equivalent to GL_FLOAT_32_UNSIGNED_INT_24_8_REV. Introduced in Qt 5.4 | - | ||||||||||||||||||
| 2117 | */ | - | ||||||||||||||||||
| 2118 | - | |||||||||||||||||||
| 2119 | /*! | - | ||||||||||||||||||
| 2120 | \enum QOpenGLTexture::Feature | - | ||||||||||||||||||
| 2121 | This enum defines the OpenGL texture-related features that can be tested for. | - | ||||||||||||||||||
| 2122 | - | |||||||||||||||||||
| 2123 | \value ImmutableStorage Support for immutable texture storage | - | ||||||||||||||||||
| 2124 | \value ImmutableMultisampleStorage Support for immutable texture storage with | - | ||||||||||||||||||
| 2125 | multisample targets | - | ||||||||||||||||||
| 2126 | \value TextureRectangle Support for the GL_TEXTURE_RECTANGLE target | - | ||||||||||||||||||
| 2127 | \value TextureArrays Support for texture targets with array layers | - | ||||||||||||||||||
| 2128 | \value Texture3D Support for the 3 dimensional texture target | - | ||||||||||||||||||
| 2129 | \value TextureMultisample Support for texture targets that have multisample capabilities | - | ||||||||||||||||||
| 2130 | \value TextureBuffer Support for textures that use OpenGL buffer objects | - | ||||||||||||||||||
| 2131 | as their data source | - | ||||||||||||||||||
| 2132 | \value TextureCubeMapArrays Support for cubemap array texture target | - | ||||||||||||||||||
| 2133 | \value Swizzle Support for texture component swizzle masks | - | ||||||||||||||||||
| 2134 | \value StencilTexturing Support for stencil texturing (i.e. looking up depth or stencil | - | ||||||||||||||||||
| 2135 | components of a combined depth/stencil format texture in GLSL shaders). | - | ||||||||||||||||||
| 2136 | \value AnisotropicFiltering Support for anisotropic texture filtering | - | ||||||||||||||||||
| 2137 | \value NPOTTextures Basic support for non-power-of-two textures | - | ||||||||||||||||||
| 2138 | \value NPOTTextureRepeat Full support for non-power-of-two textures including texture | - | ||||||||||||||||||
| 2139 | repeat modes | - | ||||||||||||||||||
| 2140 | \value Texture1D Support for the 1 dimensional texture target | - | ||||||||||||||||||
| 2141 | \value TextureComparisonOperators Support for texture comparison operators | - | ||||||||||||||||||
| 2142 | \value TextureMipMapLevel Support for setting the base and maximum mipmap levels | - | ||||||||||||||||||
| 2143 | */ | - | ||||||||||||||||||
| 2144 | - | |||||||||||||||||||
| 2145 | /*! | - | ||||||||||||||||||
| 2146 | \enum QOpenGLTexture::SwizzleComponent | - | ||||||||||||||||||
| 2147 | This enum defines the texture color components that can be assigned a swizzle mask. | - | ||||||||||||||||||
| 2148 | - | |||||||||||||||||||
| 2149 | \value SwizzleRed The red component. Equivalent to GL_TEXTURE_SWIZZLE_R | - | ||||||||||||||||||
| 2150 | \value SwizzleGreen The green component. Equivalent to GL_TEXTURE_SWIZZLE_G | - | ||||||||||||||||||
| 2151 | \value SwizzleBlue The blue component. Equivalent to GL_TEXTURE_SWIZZLE_B | - | ||||||||||||||||||
| 2152 | \value SwizzleAlpha The alpha component. Equivalent to GL_TEXTURE_SWIZZLE_A | - | ||||||||||||||||||
| 2153 | */ | - | ||||||||||||||||||
| 2154 | - | |||||||||||||||||||
| 2155 | /*! | - | ||||||||||||||||||
| 2156 | \enum QOpenGLTexture::SwizzleValue | - | ||||||||||||||||||
| 2157 | This enum defines the possible mask values for texture swizzling. | - | ||||||||||||||||||
| 2158 | - | |||||||||||||||||||
| 2159 | \value RedValue Maps the component to the red channel. Equivalent to GL_RED | - | ||||||||||||||||||
| 2160 | \value GreenValue Maps the component to the green channel. Equivalent to GL_GREEN | - | ||||||||||||||||||
| 2161 | \value BlueValue Maps the component to the blue channel. Equivalent to GL_BLUE | - | ||||||||||||||||||
| 2162 | \value AlphaValue Maps the component to the alpha channel. Equivalent to GL_ALPHA | - | ||||||||||||||||||
| 2163 | \value ZeroValue Maps the component to a fixed value of 0. Equivalent to GL_ZERO | - | ||||||||||||||||||
| 2164 | \value OneValue Maps the component to a fixed value of 1. Equivalent to GL_ONE | - | ||||||||||||||||||
| 2165 | */ | - | ||||||||||||||||||
| 2166 | - | |||||||||||||||||||
| 2167 | /*! | - | ||||||||||||||||||
| 2168 | \enum QOpenGLTexture::WrapMode | - | ||||||||||||||||||
| 2169 | This enum defines the possible texture coordinate wrapping modes. | - | ||||||||||||||||||
| 2170 | - | |||||||||||||||||||
| 2171 | \value Repeat Texture coordinate is repeated. Equivalent to GL_REPEAT | - | ||||||||||||||||||
| 2172 | \value MirroredRepeat Texture coordinate is reflected about 0 and 1. Equivalent to GL_MIRRORED_REPEAT | - | ||||||||||||||||||
| 2173 | \value ClampToEdge Clamps the texture coordinates to [0,1]. Equivalent to GL_CLAMP_TO_EDGE | - | ||||||||||||||||||
| 2174 | \value ClampToBorder As for ClampToEdge but also blends samples at 0 and 1 with a | - | ||||||||||||||||||
| 2175 | fixed border color. Equivalent to GL_CLAMP_TO_BORDER | - | ||||||||||||||||||
| 2176 | */ | - | ||||||||||||||||||
| 2177 | - | |||||||||||||||||||
| 2178 | /*! | - | ||||||||||||||||||
| 2179 | \enum QOpenGLTexture::CoordinateDirection | - | ||||||||||||||||||
| 2180 | This enum defines the possible texture coordinate directions | - | ||||||||||||||||||
| 2181 | - | |||||||||||||||||||
| 2182 | \value DirectionS The horizontal direction. Equivalent to GL_TEXTURE_WRAP_S | - | ||||||||||||||||||
| 2183 | \value DirectionT The vertical direction. Equivalent to GL_TEXTURE_WRAP_T | - | ||||||||||||||||||
| 2184 | \value DirectionR The depth direction. Equivalent to GL_TEXTURE_WRAP_R | - | ||||||||||||||||||
| 2185 | */ | - | ||||||||||||||||||
| 2186 | - | |||||||||||||||||||
| 2187 | /*! | - | ||||||||||||||||||
| 2188 | Creates a QOpenGLTexture object that can later be bound to \a target. | - | ||||||||||||||||||
| 2189 | - | |||||||||||||||||||
| 2190 | This does not create the underlying OpenGL texture object. Therefore, | - | ||||||||||||||||||
| 2191 | construction using this constructor does not require a valid current | - | ||||||||||||||||||
| 2192 | OpenGL context. | - | ||||||||||||||||||
| 2193 | */ | - | ||||||||||||||||||
| 2194 | QOpenGLTexture::QOpenGLTexture(Target target) | - | ||||||||||||||||||
| 2195 | : d_ptr(new QOpenGLTexturePrivate(target, this)) | - | ||||||||||||||||||
| 2196 | { | - | ||||||||||||||||||
| 2197 | } never executed: end of block | 0 | ||||||||||||||||||
| 2198 | - | |||||||||||||||||||
| 2199 | /*! | - | ||||||||||||||||||
| 2200 | Creates a QOpenGLTexture object that can later be bound to the 2D texture | - | ||||||||||||||||||
| 2201 | target and contains the pixel data contained in \a image. If you wish | - | ||||||||||||||||||
| 2202 | to have a chain of mipmaps generated then set \a genMipMaps to \c true (this | - | ||||||||||||||||||
| 2203 | is the default). | - | ||||||||||||||||||
| 2204 | - | |||||||||||||||||||
| 2205 | This does create the underlying OpenGL texture object. Therefore, | - | ||||||||||||||||||
| 2206 | construction using this constructor does require a valid current | - | ||||||||||||||||||
| 2207 | OpenGL context. | - | ||||||||||||||||||
| 2208 | */ | - | ||||||||||||||||||
| 2209 | QOpenGLTexture::QOpenGLTexture(const QImage& image, MipMapGeneration genMipMaps) | - | ||||||||||||||||||
| 2210 | : d_ptr(new QOpenGLTexturePrivate(QOpenGLTexture::Target2D, this)) | - | ||||||||||||||||||
| 2211 | { | - | ||||||||||||||||||
| 2212 | setData(image, genMipMaps); | - | ||||||||||||||||||
| 2213 | } never executed: end of block | 0 | ||||||||||||||||||
| 2214 | - | |||||||||||||||||||
| 2215 | QOpenGLTexture::~QOpenGLTexture() | - | ||||||||||||||||||
| 2216 | { | - | ||||||||||||||||||
| 2217 | } | - | ||||||||||||||||||
| 2218 | - | |||||||||||||||||||
| 2219 | /*! | - | ||||||||||||||||||
| 2220 | Returns the binding target of this texture. | - | ||||||||||||||||||
| 2221 | - | |||||||||||||||||||
| 2222 | \since 5.4 | - | ||||||||||||||||||
| 2223 | */ | - | ||||||||||||||||||
| 2224 | QOpenGLTexture::Target QOpenGLTexture::target() const | - | ||||||||||||||||||
| 2225 | { | - | ||||||||||||||||||
| 2226 | Q_D(const QOpenGLTexture); | - | ||||||||||||||||||
| 2227 | return d->target; never executed: return d->target; | 0 | ||||||||||||||||||
| 2228 | } | - | ||||||||||||||||||
| 2229 | - | |||||||||||||||||||
| 2230 | /*! | - | ||||||||||||||||||
| 2231 | Creates the underlying OpenGL texture object. This requires a current valid | - | ||||||||||||||||||
| 2232 | OpenGL context. If the texture object already exists, this function does | - | ||||||||||||||||||
| 2233 | nothing. | - | ||||||||||||||||||
| 2234 | - | |||||||||||||||||||
| 2235 | Once the texture object is created you can obtain the object | - | ||||||||||||||||||
| 2236 | name from the textureId() function. This may be useful if you wish to make | - | ||||||||||||||||||
| 2237 | some raw OpenGL calls related to this texture. | - | ||||||||||||||||||
| 2238 | - | |||||||||||||||||||
| 2239 | Normally it should not be necessary to call this function directly as all | - | ||||||||||||||||||
| 2240 | functions that set properties of the texture object implicitly call create() | - | ||||||||||||||||||
| 2241 | on your behalf. | - | ||||||||||||||||||
| 2242 | - | |||||||||||||||||||
| 2243 | Returns \c true if the creation succeeded, otherwise returns \c false. | - | ||||||||||||||||||
| 2244 | - | |||||||||||||||||||
| 2245 | \sa destroy(), isCreated(), textureId() | - | ||||||||||||||||||
| 2246 | */ | - | ||||||||||||||||||
| 2247 | bool QOpenGLTexture::create() | - | ||||||||||||||||||
| 2248 | { | - | ||||||||||||||||||
| 2249 | Q_D(QOpenGLTexture); | - | ||||||||||||||||||
| 2250 | return d->create(); never executed: return d->create(); | 0 | ||||||||||||||||||
| 2251 | } | - | ||||||||||||||||||
| 2252 | - | |||||||||||||||||||
| 2253 | /*! | - | ||||||||||||||||||
| 2254 | Destroys the underlying OpenGL texture object. This requires a current valid | - | ||||||||||||||||||
| 2255 | OpenGL context. | - | ||||||||||||||||||
| 2256 | - | |||||||||||||||||||
| 2257 | \sa create(), isCreated(), textureId() | - | ||||||||||||||||||
| 2258 | */ | - | ||||||||||||||||||
| 2259 | void QOpenGLTexture::destroy() | - | ||||||||||||||||||
| 2260 | { | - | ||||||||||||||||||
| 2261 | Q_D(QOpenGLTexture); | - | ||||||||||||||||||
| 2262 | return d->destroy(); never executed: return d->destroy(); | 0 | ||||||||||||||||||
| 2263 | } | - | ||||||||||||||||||
| 2264 | - | |||||||||||||||||||
| 2265 | /*! | - | ||||||||||||||||||
| 2266 | Returns \c true if the underlying OpenGL texture object has been created. | - | ||||||||||||||||||
| 2267 | - | |||||||||||||||||||
| 2268 | \sa create(), destroy(), textureId() | - | ||||||||||||||||||
| 2269 | */ | - | ||||||||||||||||||
| 2270 | bool QOpenGLTexture::isCreated() const | - | ||||||||||||||||||
| 2271 | { | - | ||||||||||||||||||
| 2272 | Q_D(const QOpenGLTexture); | - | ||||||||||||||||||
| 2273 | return d->textureId != 0; never executed: return d->textureId != 0; | 0 | ||||||||||||||||||
| 2274 | } | - | ||||||||||||||||||
| 2275 | - | |||||||||||||||||||
| 2276 | /*! | - | ||||||||||||||||||
| 2277 | Returns the name of the underlying OpenGL texture object or 0 if it has | - | ||||||||||||||||||
| 2278 | not yet been created. | - | ||||||||||||||||||
| 2279 | - | |||||||||||||||||||
| 2280 | \sa create(), destroy(), isCreated() | - | ||||||||||||||||||
| 2281 | */ | - | ||||||||||||||||||
| 2282 | GLuint QOpenGLTexture::textureId() const | - | ||||||||||||||||||
| 2283 | { | - | ||||||||||||||||||
| 2284 | Q_D(const QOpenGLTexture); | - | ||||||||||||||||||
| 2285 | return d->textureId; never executed: return d->textureId; | 0 | ||||||||||||||||||
| 2286 | } | - | ||||||||||||||||||
| 2287 | - | |||||||||||||||||||
| 2288 | /*! | - | ||||||||||||||||||
| 2289 | Binds this texture to the currently active texture unit ready for | - | ||||||||||||||||||
| 2290 | rendering. Note that you do not need to bind QOpenGLTexture objects | - | ||||||||||||||||||
| 2291 | in order to modify them as the implementation makes use of the | - | ||||||||||||||||||
| 2292 | EXT_direct_state_access extension where available and simulates it | - | ||||||||||||||||||
| 2293 | where it is not. | - | ||||||||||||||||||
| 2294 | - | |||||||||||||||||||
| 2295 | \sa release() | - | ||||||||||||||||||
| 2296 | */ | - | ||||||||||||||||||
| 2297 | void QOpenGLTexture::bind() | - | ||||||||||||||||||
| 2298 | { | - | ||||||||||||||||||
| 2299 | Q_D(QOpenGLTexture); | - | ||||||||||||||||||
| 2300 | Q_ASSERT(d->textureId); | - | ||||||||||||||||||
| 2301 | d->bind(); | - | ||||||||||||||||||
| 2302 | } never executed: end of block | 0 | ||||||||||||||||||
| 2303 | - | |||||||||||||||||||
| 2304 | /*! | - | ||||||||||||||||||
| 2305 | Binds this texture to texture unit \a unit ready for | - | ||||||||||||||||||
| 2306 | rendering. Note that you do not need to bind QOpenGLTexture objects | - | ||||||||||||||||||
| 2307 | in order to modify them as the implementation makes use of the | - | ||||||||||||||||||
| 2308 | EXT_direct_state_access extension where available and simulates it | - | ||||||||||||||||||
| 2309 | where it is not. | - | ||||||||||||||||||
| 2310 | - | |||||||||||||||||||
| 2311 | If parameter \a reset is \c true then this function will restore | - | ||||||||||||||||||
| 2312 | the active unit to the texture unit that was active upon entry. | - | ||||||||||||||||||
| 2313 | - | |||||||||||||||||||
| 2314 | \sa release() | - | ||||||||||||||||||
| 2315 | */ | - | ||||||||||||||||||
| 2316 | void QOpenGLTexture::bind(uint unit, TextureUnitReset reset) | - | ||||||||||||||||||
| 2317 | { | - | ||||||||||||||||||
| 2318 | Q_D(QOpenGLTexture); | - | ||||||||||||||||||
| 2319 | Q_ASSERT(d->textureId); | - | ||||||||||||||||||
| 2320 | d->bind(unit, reset); | - | ||||||||||||||||||
| 2321 | } never executed: end of block | 0 | ||||||||||||||||||
| 2322 | - | |||||||||||||||||||
| 2323 | /*! | - | ||||||||||||||||||
| 2324 | Unbinds this texture from the currently active texture unit. | - | ||||||||||||||||||
| 2325 | - | |||||||||||||||||||
| 2326 | \sa bind() | - | ||||||||||||||||||
| 2327 | */ | - | ||||||||||||||||||
| 2328 | void QOpenGLTexture::release() | - | ||||||||||||||||||
| 2329 | { | - | ||||||||||||||||||
| 2330 | Q_D(QOpenGLTexture); | - | ||||||||||||||||||
| 2331 | d->release(); | - | ||||||||||||||||||
| 2332 | } never executed: end of block | 0 | ||||||||||||||||||
| 2333 | - | |||||||||||||||||||
| 2334 | /*! | - | ||||||||||||||||||
| 2335 | Unbinds this texture from texture unit \a unit. | - | ||||||||||||||||||
| 2336 | - | |||||||||||||||||||
| 2337 | If parameter \a reset is \c true then this function | - | ||||||||||||||||||
| 2338 | will restore the active unit to the texture unit that was active | - | ||||||||||||||||||
| 2339 | upon entry. | - | ||||||||||||||||||
| 2340 | */ | - | ||||||||||||||||||
| 2341 | void QOpenGLTexture::release(uint unit, TextureUnitReset reset) | - | ||||||||||||||||||
| 2342 | { | - | ||||||||||||||||||
| 2343 | Q_D(QOpenGLTexture); | - | ||||||||||||||||||
| 2344 | d->release(unit, reset); | - | ||||||||||||||||||
| 2345 | } never executed: end of block | 0 | ||||||||||||||||||
| 2346 | - | |||||||||||||||||||
| 2347 | /*! | - | ||||||||||||||||||
| 2348 | Returns \c true if this texture is bound to the corresponding target | - | ||||||||||||||||||
| 2349 | of the currently active texture unit. | - | ||||||||||||||||||
| 2350 | - | |||||||||||||||||||
| 2351 | \sa bind(), release() | - | ||||||||||||||||||
| 2352 | */ | - | ||||||||||||||||||
| 2353 | bool QOpenGLTexture::isBound() const | - | ||||||||||||||||||
| 2354 | { | - | ||||||||||||||||||
| 2355 | Q_D(const QOpenGLTexture); | - | ||||||||||||||||||
| 2356 | Q_ASSERT(d->textureId); | - | ||||||||||||||||||
| 2357 | return d->isBound(); never executed: return d->isBound(); | 0 | ||||||||||||||||||
| 2358 | } | - | ||||||||||||||||||
| 2359 | - | |||||||||||||||||||
| 2360 | /*! | - | ||||||||||||||||||
| 2361 | Returns \c true if this texture is bound to the corresponding target | - | ||||||||||||||||||
| 2362 | of texture unit \a unit. | - | ||||||||||||||||||
| 2363 | - | |||||||||||||||||||
| 2364 | \sa bind(), release() | - | ||||||||||||||||||
| 2365 | */ | - | ||||||||||||||||||
| 2366 | bool QOpenGLTexture::isBound(uint unit) | - | ||||||||||||||||||
| 2367 | { | - | ||||||||||||||||||
| 2368 | Q_D(const QOpenGLTexture); | - | ||||||||||||||||||
| 2369 | Q_ASSERT(d->textureId); | - | ||||||||||||||||||
| 2370 | return d->isBound(unit); never executed: return d->isBound(unit); | 0 | ||||||||||||||||||
| 2371 | } | - | ||||||||||||||||||
| 2372 | - | |||||||||||||||||||
| 2373 | /*! | - | ||||||||||||||||||
| 2374 | Returns the textureId of the texture that is bound to the \a target | - | ||||||||||||||||||
| 2375 | of the currently active texture unit. | - | ||||||||||||||||||
| 2376 | */ | - | ||||||||||||||||||
| 2377 | GLuint QOpenGLTexture::boundTextureId(BindingTarget target) | - | ||||||||||||||||||
| 2378 | { | - | ||||||||||||||||||
| 2379 | QOpenGLContext *ctx = QOpenGLContext::currentContext(); | - | ||||||||||||||||||
| 2380 | if (!ctx) {
| 0 | ||||||||||||||||||
| 2381 | qWarning("QOpenGLTexture::boundTextureId() requires a valid current context"); | - | ||||||||||||||||||
| 2382 | return 0; never executed: return 0; | 0 | ||||||||||||||||||
| 2383 | } | - | ||||||||||||||||||
| 2384 | - | |||||||||||||||||||
| 2385 | GLint textureId = 0; | - | ||||||||||||||||||
| 2386 | ctx->functions()->glGetIntegerv(target, &textureId); | - | ||||||||||||||||||
| 2387 | return static_cast<GLuint>(textureId); never executed: return static_cast<GLuint>(textureId); | 0 | ||||||||||||||||||
| 2388 | } | - | ||||||||||||||||||
| 2389 | - | |||||||||||||||||||
| 2390 | /*! | - | ||||||||||||||||||
| 2391 | Returns the textureId of the texture that is bound to the \a target | - | ||||||||||||||||||
| 2392 | of the texture unit \a unit. | - | ||||||||||||||||||
| 2393 | */ | - | ||||||||||||||||||
| 2394 | GLuint QOpenGLTexture::boundTextureId(uint unit, BindingTarget target) | - | ||||||||||||||||||
| 2395 | { | - | ||||||||||||||||||
| 2396 | QOpenGLContext *ctx = QOpenGLContext::currentContext(); | - | ||||||||||||||||||
| 2397 | if (!ctx) {
| 0 | ||||||||||||||||||
| 2398 | qWarning("QOpenGLTexture::boundTextureId() requires a valid current context"); | - | ||||||||||||||||||
| 2399 | return 0; never executed: return 0; | 0 | ||||||||||||||||||
| 2400 | } | - | ||||||||||||||||||
| 2401 | - | |||||||||||||||||||
| 2402 | QOpenGLFunctions *funcs = ctx->functions(); | - | ||||||||||||||||||
| 2403 | funcs->initializeOpenGLFunctions(); | - | ||||||||||||||||||
| 2404 | - | |||||||||||||||||||
| 2405 | GLint oldTextureUnit = 0; | - | ||||||||||||||||||
| 2406 | funcs->glGetIntegerv(GL_ACTIVE_TEXTURE, &oldTextureUnit); | - | ||||||||||||||||||
| 2407 | - | |||||||||||||||||||
| 2408 | funcs->glActiveTexture(unit); | - | ||||||||||||||||||
| 2409 | GLint textureId = 0; | - | ||||||||||||||||||
| 2410 | funcs->glGetIntegerv(target, &textureId); | - | ||||||||||||||||||
| 2411 | funcs->glActiveTexture(oldTextureUnit); | - | ||||||||||||||||||
| 2412 | - | |||||||||||||||||||
| 2413 | return static_cast<GLuint>(textureId); never executed: return static_cast<GLuint>(textureId); | 0 | ||||||||||||||||||
| 2414 | } | - | ||||||||||||||||||
| 2415 | - | |||||||||||||||||||
| 2416 | /*! | - | ||||||||||||||||||
| 2417 | Sets the format of this texture object to \a format. This function | - | ||||||||||||||||||
| 2418 | must be called before texture storage is allocated. | - | ||||||||||||||||||
| 2419 | - | |||||||||||||||||||
| 2420 | Note that all formats may not be supported. The exact set of supported | - | ||||||||||||||||||
| 2421 | formats is dependent upon your OpenGL implementation and version. | - | ||||||||||||||||||
| 2422 | - | |||||||||||||||||||
| 2423 | \sa format(), allocateStorage() | - | ||||||||||||||||||
| 2424 | */ | - | ||||||||||||||||||
| 2425 | void QOpenGLTexture::setFormat(TextureFormat format) | - | ||||||||||||||||||
| 2426 | { | - | ||||||||||||||||||
| 2427 | Q_D(QOpenGLTexture); | - | ||||||||||||||||||
| 2428 | d->create(); | - | ||||||||||||||||||
| 2429 | if (isStorageAllocated()) {
| 0 | ||||||||||||||||||
| 2430 | qWarning("QOpenGLTexture::setFormat(): Cannot change format once storage has been allocated"); | - | ||||||||||||||||||
| 2431 | return; never executed: return; | 0 | ||||||||||||||||||
| 2432 | } | - | ||||||||||||||||||
| 2433 | - | |||||||||||||||||||
| 2434 | d->format = format; | - | ||||||||||||||||||
| 2435 | - | |||||||||||||||||||
| 2436 | switch (format) { | - | ||||||||||||||||||
| 2437 | case NoFormat: never executed: case NoFormat: | 0 | ||||||||||||||||||
| 2438 | d->formatClass = NoFormatClass; | - | ||||||||||||||||||
| 2439 | break; never executed: break; | 0 | ||||||||||||||||||
| 2440 | - | |||||||||||||||||||
| 2441 | case RGBA32F: never executed: case RGBA32F: | 0 | ||||||||||||||||||
| 2442 | case RGBA32U: never executed: case RGBA32U: | 0 | ||||||||||||||||||
| 2443 | case RGBA32I: never executed: case RGBA32I: | 0 | ||||||||||||||||||
| 2444 | d->formatClass = FormatClass_128Bit; | - | ||||||||||||||||||
| 2445 | break; never executed: break; | 0 | ||||||||||||||||||
| 2446 | - | |||||||||||||||||||
| 2447 | case RGB32F: never executed: case RGB32F: | 0 | ||||||||||||||||||
| 2448 | case RGB32U: never executed: case RGB32U: | 0 | ||||||||||||||||||
| 2449 | case RGB32I: never executed: case RGB32I: | 0 | ||||||||||||||||||
| 2450 | d->formatClass = FormatClass_96Bit; | - | ||||||||||||||||||
| 2451 | break; never executed: break; | 0 | ||||||||||||||||||
| 2452 | - | |||||||||||||||||||
| 2453 | case RGBA16F: never executed: case RGBA16F: | 0 | ||||||||||||||||||
| 2454 | case RG32F: never executed: case RG32F: | 0 | ||||||||||||||||||
| 2455 | case RGBA16U: never executed: case RGBA16U: | 0 | ||||||||||||||||||
| 2456 | case RG32U: never executed: case RG32U: | 0 | ||||||||||||||||||
| 2457 | case RGBA16I: never executed: case RGBA16I: | 0 | ||||||||||||||||||
| 2458 | case RG32I: never executed: case RG32I: | 0 | ||||||||||||||||||
| 2459 | case RGBA16_UNorm: never executed: case RGBA16_UNorm: | 0 | ||||||||||||||||||
| 2460 | case RGBA16_SNorm: never executed: case RGBA16_SNorm: | 0 | ||||||||||||||||||
| 2461 | d->formatClass = FormatClass_64Bit; | - | ||||||||||||||||||
| 2462 | break; never executed: break; | 0 | ||||||||||||||||||
| 2463 | - | |||||||||||||||||||
| 2464 | case RGB16_UNorm: never executed: case RGB16_UNorm: | 0 | ||||||||||||||||||
| 2465 | case RGB16_SNorm: never executed: case RGB16_SNorm: | 0 | ||||||||||||||||||
| 2466 | case RGB16F: never executed: case RGB16F: | 0 | ||||||||||||||||||
| 2467 | case RGB16U: never executed: case RGB16U: | 0 | ||||||||||||||||||
| 2468 | case RGB16I: never executed: case RGB16I: | 0 | ||||||||||||||||||
| 2469 | d->formatClass = FormatClass_48Bit; | - | ||||||||||||||||||
| 2470 | break; never executed: break; | 0 | ||||||||||||||||||
| 2471 | - | |||||||||||||||||||
| 2472 | case RG16F: never executed: case RG16F: | 0 | ||||||||||||||||||
| 2473 | case RG11B10F: never executed: case RG11B10F: | 0 | ||||||||||||||||||
| 2474 | case R32F: never executed: case R32F: | 0 | ||||||||||||||||||
| 2475 | case RGB10A2: never executed: case RGB10A2: | 0 | ||||||||||||||||||
| 2476 | case RGBA8U: never executed: case RGBA8U: | 0 | ||||||||||||||||||
| 2477 | case RG16U: never executed: case RG16U: | 0 | ||||||||||||||||||
| 2478 | case R32U: never executed: case R32U: | 0 | ||||||||||||||||||
| 2479 | case RGBA8I: never executed: case RGBA8I: | 0 | ||||||||||||||||||
| 2480 | case RG16I: never executed: case RG16I: | 0 | ||||||||||||||||||
| 2481 | case R32I: never executed: case R32I: | 0 | ||||||||||||||||||
| 2482 | case RGBA8_UNorm: never executed: case RGBA8_UNorm: | 0 | ||||||||||||||||||
| 2483 | case RG16_UNorm: never executed: case RG16_UNorm: | 0 | ||||||||||||||||||
| 2484 | case RGBA8_SNorm: never executed: case RGBA8_SNorm: | 0 | ||||||||||||||||||
| 2485 | case RG16_SNorm: never executed: case RG16_SNorm: | 0 | ||||||||||||||||||
| 2486 | case SRGB8_Alpha8: never executed: case SRGB8_Alpha8: | 0 | ||||||||||||||||||
| 2487 | case RGB9E5: never executed: case RGB9E5: | 0 | ||||||||||||||||||
| 2488 | d->formatClass = FormatClass_32Bit; | - | ||||||||||||||||||
| 2489 | break; never executed: break; | 0 | ||||||||||||||||||
| 2490 | - | |||||||||||||||||||
| 2491 | case RGB8_UNorm: never executed: case RGB8_UNorm: | 0 | ||||||||||||||||||
| 2492 | case RGB8_SNorm: never executed: case RGB8_SNorm: | 0 | ||||||||||||||||||
| 2493 | case SRGB8: never executed: case SRGB8: | 0 | ||||||||||||||||||
| 2494 | case RGB8U: never executed: case RGB8U: | 0 | ||||||||||||||||||
| 2495 | case RGB8I: never executed: case RGB8I: | 0 | ||||||||||||||||||
| 2496 | d->formatClass = FormatClass_24Bit; | - | ||||||||||||||||||
| 2497 | break; never executed: break; | 0 | ||||||||||||||||||
| 2498 | - | |||||||||||||||||||
| 2499 | case R16F: never executed: case R16F: | 0 | ||||||||||||||||||
| 2500 | case RG8U: never executed: case RG8U: | 0 | ||||||||||||||||||
| 2501 | case R16U: never executed: case R16U: | 0 | ||||||||||||||||||
| 2502 | case RG8I: never executed: case RG8I: | 0 | ||||||||||||||||||
| 2503 | case R16I: never executed: case R16I: | 0 | ||||||||||||||||||
| 2504 | case RG8_UNorm: never executed: case RG8_UNorm: | 0 | ||||||||||||||||||
| 2505 | case R16_UNorm: never executed: case R16_UNorm: | 0 | ||||||||||||||||||
| 2506 | case RG8_SNorm: never executed: case RG8_SNorm: | 0 | ||||||||||||||||||
| 2507 | case R16_SNorm: never executed: case R16_SNorm: | 0 | ||||||||||||||||||
| 2508 | d->formatClass = FormatClass_16Bit; | - | ||||||||||||||||||
| 2509 | break; never executed: break; | 0 | ||||||||||||||||||
| 2510 | - | |||||||||||||||||||
| 2511 | case R8U: never executed: case R8U: | 0 | ||||||||||||||||||
| 2512 | case R8I: never executed: case R8I: | 0 | ||||||||||||||||||
| 2513 | case R8_UNorm: never executed: case R8_UNorm: | 0 | ||||||||||||||||||
| 2514 | case R8_SNorm: never executed: case R8_SNorm: | 0 | ||||||||||||||||||
| 2515 | d->formatClass = FormatClass_8Bit; | - | ||||||||||||||||||
| 2516 | break; never executed: break; | 0 | ||||||||||||||||||
| 2517 | - | |||||||||||||||||||
| 2518 | case R_ATI1N_UNorm: never executed: case R_ATI1N_UNorm: | 0 | ||||||||||||||||||
| 2519 | case R_ATI1N_SNorm: never executed: case R_ATI1N_SNorm: | 0 | ||||||||||||||||||
| 2520 | d->formatClass = FormatClass_RGTC1_R; | - | ||||||||||||||||||
| 2521 | break; never executed: break; | 0 | ||||||||||||||||||
| 2522 | - | |||||||||||||||||||
| 2523 | case RG_ATI2N_UNorm: never executed: case RG_ATI2N_UNorm: | 0 | ||||||||||||||||||
| 2524 | case RG_ATI2N_SNorm: never executed: case RG_ATI2N_SNorm: | 0 | ||||||||||||||||||
| 2525 | d->formatClass = FormatClass_RGTC2_RG; | - | ||||||||||||||||||
| 2526 | break; never executed: break; | 0 | ||||||||||||||||||
| 2527 | - | |||||||||||||||||||
| 2528 | case RGB_BP_UNorm: never executed: case RGB_BP_UNorm: | 0 | ||||||||||||||||||
| 2529 | case SRGB_BP_UNorm: never executed: case SRGB_BP_UNorm: | 0 | ||||||||||||||||||
| 2530 | d->formatClass = FormatClass_BPTC_Unorm; | - | ||||||||||||||||||
| 2531 | break; never executed: break; | 0 | ||||||||||||||||||
| 2532 | - | |||||||||||||||||||
| 2533 | case RGB_BP_UNSIGNED_FLOAT: never executed: case RGB_BP_UNSIGNED_FLOAT: | 0 | ||||||||||||||||||
| 2534 | case RGB_BP_SIGNED_FLOAT: never executed: case RGB_BP_SIGNED_FLOAT: | 0 | ||||||||||||||||||
| 2535 | d->formatClass = FormatClass_BPTC_Float; | - | ||||||||||||||||||
| 2536 | break; never executed: break; | 0 | ||||||||||||||||||
| 2537 | - | |||||||||||||||||||
| 2538 | case RGB_DXT1: never executed: case RGB_DXT1: | 0 | ||||||||||||||||||
| 2539 | case SRGB_DXT1: never executed: case SRGB_DXT1: | 0 | ||||||||||||||||||
| 2540 | d->formatClass = FormatClass_S3TC_DXT1_RGB; | - | ||||||||||||||||||
| 2541 | break; never executed: break; | 0 | ||||||||||||||||||
| 2542 | - | |||||||||||||||||||
| 2543 | case RGBA_DXT1: never executed: case RGBA_DXT1: | 0 | ||||||||||||||||||
| 2544 | case SRGB_Alpha_DXT1: never executed: case SRGB_Alpha_DXT1: | 0 | ||||||||||||||||||
| 2545 | d->formatClass = FormatClass_S3TC_DXT1_RGBA; | - | ||||||||||||||||||
| 2546 | break; never executed: break; | 0 | ||||||||||||||||||
| 2547 | - | |||||||||||||||||||
| 2548 | case RGBA_DXT3: never executed: case RGBA_DXT3: | 0 | ||||||||||||||||||
| 2549 | case SRGB_Alpha_DXT3: never executed: case SRGB_Alpha_DXT3: | 0 | ||||||||||||||||||
| 2550 | d->formatClass = FormatClass_S3TC_DXT3_RGBA; | - | ||||||||||||||||||
| 2551 | break; never executed: break; | 0 | ||||||||||||||||||
| 2552 | - | |||||||||||||||||||
| 2553 | case RGBA_DXT5: never executed: case RGBA_DXT5: | 0 | ||||||||||||||||||
| 2554 | case SRGB_Alpha_DXT5: never executed: case SRGB_Alpha_DXT5: | 0 | ||||||||||||||||||
| 2555 | d->formatClass = FormatClass_S3TC_DXT5_RGBA; | - | ||||||||||||||||||
| 2556 | break; never executed: break; | 0 | ||||||||||||||||||
| 2557 | - | |||||||||||||||||||
| 2558 | case QOpenGLTexture::R11_EAC_UNorm: never executed: case QOpenGLTexture::R11_EAC_UNorm: | 0 | ||||||||||||||||||
| 2559 | case QOpenGLTexture::R11_EAC_SNorm: never executed: case QOpenGLTexture::R11_EAC_SNorm: | 0 | ||||||||||||||||||
| 2560 | case QOpenGLTexture::RG11_EAC_UNorm: never executed: case QOpenGLTexture::RG11_EAC_UNorm: | 0 | ||||||||||||||||||
| 2561 | case QOpenGLTexture::RG11_EAC_SNorm: never executed: case QOpenGLTexture::RG11_EAC_SNorm: | 0 | ||||||||||||||||||
| 2562 | case QOpenGLTexture::RGB8_ETC2: never executed: case QOpenGLTexture::RGB8_ETC2: | 0 | ||||||||||||||||||
| 2563 | case QOpenGLTexture::SRGB8_ETC2: never executed: case QOpenGLTexture::SRGB8_ETC2: | 0 | ||||||||||||||||||
| 2564 | case QOpenGLTexture::RGB8_PunchThrough_Alpha1_ETC2: never executed: case QOpenGLTexture::RGB8_PunchThrough_Alpha1_ETC2: | 0 | ||||||||||||||||||
| 2565 | case QOpenGLTexture::SRGB8_PunchThrough_Alpha1_ETC2: never executed: case QOpenGLTexture::SRGB8_PunchThrough_Alpha1_ETC2: | 0 | ||||||||||||||||||
| 2566 | case QOpenGLTexture::RGBA8_ETC2_EAC: never executed: case QOpenGLTexture::RGBA8_ETC2_EAC: | 0 | ||||||||||||||||||
| 2567 | case QOpenGLTexture::SRGB8_Alpha8_ETC2_EAC: never executed: case QOpenGLTexture::SRGB8_Alpha8_ETC2_EAC: | 0 | ||||||||||||||||||
| 2568 | case QOpenGLTexture::RGB8_ETC1: never executed: case QOpenGLTexture::RGB8_ETC1: | 0 | ||||||||||||||||||
| 2569 | case RG3B2: never executed: case RG3B2: | 0 | ||||||||||||||||||
| 2570 | case R5G6B5: never executed: case R5G6B5: | 0 | ||||||||||||||||||
| 2571 | case RGB5A1: never executed: case RGB5A1: | 0 | ||||||||||||||||||
| 2572 | case RGBA4: never executed: case RGBA4: | 0 | ||||||||||||||||||
| 2573 | case D16: never executed: case D16: | 0 | ||||||||||||||||||
| 2574 | case D24: never executed: case D24: | 0 | ||||||||||||||||||
| 2575 | case D24S8: never executed: case D24S8: | 0 | ||||||||||||||||||
| 2576 | case D32: never executed: case D32: | 0 | ||||||||||||||||||
| 2577 | case D32F: never executed: case D32F: | 0 | ||||||||||||||||||
| 2578 | case D32FS8X24: never executed: case D32FS8X24: | 0 | ||||||||||||||||||
| 2579 | case S8: never executed: case S8: | 0 | ||||||||||||||||||
| 2580 | case DepthFormat: never executed: case DepthFormat: | 0 | ||||||||||||||||||
| 2581 | case AlphaFormat: never executed: case AlphaFormat: | 0 | ||||||||||||||||||
| 2582 | case RGBFormat: never executed: case RGBFormat: | 0 | ||||||||||||||||||
| 2583 | case RGBAFormat: never executed: case RGBAFormat: | 0 | ||||||||||||||||||
| 2584 | case LuminanceFormat: never executed: case LuminanceFormat: | 0 | ||||||||||||||||||
| 2585 | case LuminanceAlphaFormat: never executed: case LuminanceAlphaFormat: | 0 | ||||||||||||||||||
| 2586 | d->formatClass = FormatClass_Unique; | - | ||||||||||||||||||
| 2587 | break; never executed: break; | 0 | ||||||||||||||||||
| 2588 | } | - | ||||||||||||||||||
| 2589 | } never executed: end of block | 0 | ||||||||||||||||||
| 2590 | - | |||||||||||||||||||
| 2591 | /*! | - | ||||||||||||||||||
| 2592 | Returns the format of this texture object. | - | ||||||||||||||||||
| 2593 | - | |||||||||||||||||||
| 2594 | \sa setFormat() | - | ||||||||||||||||||
| 2595 | */ | - | ||||||||||||||||||
| 2596 | QOpenGLTexture::TextureFormat QOpenGLTexture::format() const | - | ||||||||||||||||||
| 2597 | { | - | ||||||||||||||||||
| 2598 | Q_D(const QOpenGLTexture); | - | ||||||||||||||||||
| 2599 | return d->format; never executed: return d->format; | 0 | ||||||||||||||||||
| 2600 | } | - | ||||||||||||||||||
| 2601 | - | |||||||||||||||||||
| 2602 | /*! | - | ||||||||||||||||||
| 2603 | Sets the dimensions of this texture object to \a width, | - | ||||||||||||||||||
| 2604 | \a height, and \a depth. The default for each dimension is 1. | - | ||||||||||||||||||
| 2605 | The maximum allowable texture size is dependent upon your OpenGL | - | ||||||||||||||||||
| 2606 | implementation. Allocating storage for a texture less than the | - | ||||||||||||||||||
| 2607 | maximum size can still fail if your system is low on resources. | - | ||||||||||||||||||
| 2608 | - | |||||||||||||||||||
| 2609 | \sa width(), height(), depth() | - | ||||||||||||||||||
| 2610 | */ | - | ||||||||||||||||||
| 2611 | void QOpenGLTexture::setSize(int width, int height, int depth) | - | ||||||||||||||||||
| 2612 | { | - | ||||||||||||||||||
| 2613 | Q_D(QOpenGLTexture); | - | ||||||||||||||||||
| 2614 | d->create(); | - | ||||||||||||||||||
| 2615 | if (isStorageAllocated()) {
| 0 | ||||||||||||||||||
| 2616 | qWarning("Cannot resize a texture that already has storage allocated.\n" | - | ||||||||||||||||||
| 2617 | "To do so, destroy() the texture and then create() and setSize()"); | - | ||||||||||||||||||
| 2618 | return; never executed: return; | 0 | ||||||||||||||||||
| 2619 | } | - | ||||||||||||||||||
| 2620 | - | |||||||||||||||||||
| 2621 | switch (d->target) { | - | ||||||||||||||||||
| 2622 | case QOpenGLTexture::Target1D: never executed: case QOpenGLTexture::Target1D: | 0 | ||||||||||||||||||
| 2623 | case QOpenGLTexture::Target1DArray: never executed: case QOpenGLTexture::Target1DArray: | 0 | ||||||||||||||||||
| 2624 | case QOpenGLTexture::TargetBuffer: never executed: case QOpenGLTexture::TargetBuffer: | 0 | ||||||||||||||||||
| 2625 | d->dimensions[0] = width; | - | ||||||||||||||||||
| 2626 | Q_UNUSED(height); | - | ||||||||||||||||||
| 2627 | Q_UNUSED(depth); | - | ||||||||||||||||||
| 2628 | break; never executed: break; | 0 | ||||||||||||||||||
| 2629 | - | |||||||||||||||||||
| 2630 | case QOpenGLTexture::Target2D: never executed: case QOpenGLTexture::Target2D: | 0 | ||||||||||||||||||
| 2631 | case QOpenGLTexture::Target2DArray: never executed: case QOpenGLTexture::Target2DArray: | 0 | ||||||||||||||||||
| 2632 | case QOpenGLTexture::TargetRectangle: never executed: case QOpenGLTexture::TargetRectangle: | 0 | ||||||||||||||||||
| 2633 | case QOpenGLTexture::Target2DMultisample: never executed: case QOpenGLTexture::Target2DMultisample: | 0 | ||||||||||||||||||
| 2634 | case QOpenGLTexture::Target2DMultisampleArray: never executed: case QOpenGLTexture::Target2DMultisampleArray: | 0 | ||||||||||||||||||
| 2635 | d->dimensions[0] = width; | - | ||||||||||||||||||
| 2636 | d->dimensions[1] = height; | - | ||||||||||||||||||
| 2637 | Q_UNUSED(depth); | - | ||||||||||||||||||
| 2638 | break; never executed: break; | 0 | ||||||||||||||||||
| 2639 | - | |||||||||||||||||||
| 2640 | case QOpenGLTexture::TargetCubeMap: never executed: case QOpenGLTexture::TargetCubeMap: | 0 | ||||||||||||||||||
| 2641 | case QOpenGLTexture::TargetCubeMapArray: never executed: case QOpenGLTexture::TargetCubeMapArray: | 0 | ||||||||||||||||||
| 2642 | if (width != height)
| 0 | ||||||||||||||||||
| 2643 | qWarning("QAbstractOpenGLTexture::setSize(): Cube map textures must be square"); never executed: QMessageLogger(__FILE__, 2643, __PRETTY_FUNCTION__).warning("QAbstractOpenGLTexture::setSize(): Cube map textures must be square"); | 0 | ||||||||||||||||||
| 2644 | d->dimensions[0] = d->dimensions[1] = width; | - | ||||||||||||||||||
| 2645 | Q_UNUSED(depth); | - | ||||||||||||||||||
| 2646 | break; never executed: break; | 0 | ||||||||||||||||||
| 2647 | - | |||||||||||||||||||
| 2648 | case QOpenGLTexture::Target3D: never executed: case QOpenGLTexture::Target3D: | 0 | ||||||||||||||||||
| 2649 | d->dimensions[0] = width; | - | ||||||||||||||||||
| 2650 | d->dimensions[1] = height; | - | ||||||||||||||||||
| 2651 | d->dimensions[2] = depth; | - | ||||||||||||||||||
| 2652 | break; never executed: break; | 0 | ||||||||||||||||||
| 2653 | } | - | ||||||||||||||||||
| 2654 | } never executed: end of block | 0 | ||||||||||||||||||
| 2655 | - | |||||||||||||||||||
| 2656 | /*! | - | ||||||||||||||||||
| 2657 | Returns the width of a 1D, 2D or 3D texture. | - | ||||||||||||||||||
| 2658 | - | |||||||||||||||||||
| 2659 | \sa height(), depth(), setSize() | - | ||||||||||||||||||
| 2660 | */ | - | ||||||||||||||||||
| 2661 | int QOpenGLTexture::width() const | - | ||||||||||||||||||
| 2662 | { | - | ||||||||||||||||||
| 2663 | Q_D(const QOpenGLTexture); | - | ||||||||||||||||||
| 2664 | return d->dimensions[0]; never executed: return d->dimensions[0]; | 0 | ||||||||||||||||||
| 2665 | } | - | ||||||||||||||||||
| 2666 | - | |||||||||||||||||||
| 2667 | /*! | - | ||||||||||||||||||
| 2668 | Returns the height of a 2D or 3D texture. | - | ||||||||||||||||||
| 2669 | - | |||||||||||||||||||
| 2670 | \sa width(), depth(), setSize() | - | ||||||||||||||||||
| 2671 | */ | - | ||||||||||||||||||
| 2672 | int QOpenGLTexture::height() const | - | ||||||||||||||||||
| 2673 | { | - | ||||||||||||||||||
| 2674 | Q_D(const QOpenGLTexture); | - | ||||||||||||||||||
| 2675 | return d->dimensions[1]; never executed: return d->dimensions[1]; | 0 | ||||||||||||||||||
| 2676 | } | - | ||||||||||||||||||
| 2677 | - | |||||||||||||||||||
| 2678 | /*! | - | ||||||||||||||||||
| 2679 | Returns the depth of a 3D texture. | - | ||||||||||||||||||
| 2680 | - | |||||||||||||||||||
| 2681 | \sa width(), height(), setSize() | - | ||||||||||||||||||
| 2682 | */ | - | ||||||||||||||||||
| 2683 | int QOpenGLTexture::depth() const | - | ||||||||||||||||||
| 2684 | { | - | ||||||||||||||||||
| 2685 | Q_D(const QOpenGLTexture); | - | ||||||||||||||||||
| 2686 | return d->dimensions[2]; never executed: return d->dimensions[2]; | 0 | ||||||||||||||||||
| 2687 | } | - | ||||||||||||||||||
| 2688 | - | |||||||||||||||||||
| 2689 | /*! | - | ||||||||||||||||||
| 2690 | For texture targets that support mipmaps, this function | - | ||||||||||||||||||
| 2691 | sets the requested number of mipmap \a levels to allocate storage | - | ||||||||||||||||||
| 2692 | for. This function should be called before storage is allocated | - | ||||||||||||||||||
| 2693 | for the texture. | - | ||||||||||||||||||
| 2694 | - | |||||||||||||||||||
| 2695 | If the texture target does not support mipmaps this function | - | ||||||||||||||||||
| 2696 | has no effect. | - | ||||||||||||||||||
| 2697 | - | |||||||||||||||||||
| 2698 | \sa mipLevels(), maximumMipLevels(), isStorageAllocated() | - | ||||||||||||||||||
| 2699 | */ | - | ||||||||||||||||||
| 2700 | void QOpenGLTexture::setMipLevels(int levels) | - | ||||||||||||||||||
| 2701 | { | - | ||||||||||||||||||
| 2702 | Q_D(QOpenGLTexture); | - | ||||||||||||||||||
| 2703 | d->create(); | - | ||||||||||||||||||
| 2704 | if (isStorageAllocated()) {
| 0 | ||||||||||||||||||
| 2705 | qWarning("Cannot set mip levels on a texture that already has storage allocated.\n" | - | ||||||||||||||||||
| 2706 | "To do so, destroy() the texture and then create() and setMipLevels()"); | - | ||||||||||||||||||
| 2707 | return; never executed: return; | 0 | ||||||||||||||||||
| 2708 | } | - | ||||||||||||||||||
| 2709 | - | |||||||||||||||||||
| 2710 | switch (d->target) { | - | ||||||||||||||||||
| 2711 | case QOpenGLTexture::Target1D: never executed: case QOpenGLTexture::Target1D: | 0 | ||||||||||||||||||
| 2712 | case QOpenGLTexture::Target1DArray: never executed: case QOpenGLTexture::Target1DArray: | 0 | ||||||||||||||||||
| 2713 | case QOpenGLTexture::Target2D: never executed: case QOpenGLTexture::Target2D: | 0 | ||||||||||||||||||
| 2714 | case QOpenGLTexture::Target2DArray: never executed: case QOpenGLTexture::Target2DArray: | 0 | ||||||||||||||||||
| 2715 | case QOpenGLTexture::TargetCubeMap: never executed: case QOpenGLTexture::TargetCubeMap: | 0 | ||||||||||||||||||
| 2716 | case QOpenGLTexture::TargetCubeMapArray: never executed: case QOpenGLTexture::TargetCubeMapArray: | 0 | ||||||||||||||||||
| 2717 | case QOpenGLTexture::Target3D: never executed: case QOpenGLTexture::Target3D: | 0 | ||||||||||||||||||
| 2718 | d->requestedMipLevels = levels; | - | ||||||||||||||||||
| 2719 | break; never executed: break; | 0 | ||||||||||||||||||
| 2720 | - | |||||||||||||||||||
| 2721 | case QOpenGLTexture::TargetBuffer: never executed: case QOpenGLTexture::TargetBuffer: | 0 | ||||||||||||||||||
| 2722 | case QOpenGLTexture::TargetRectangle: never executed: case QOpenGLTexture::TargetRectangle: | 0 | ||||||||||||||||||
| 2723 | case QOpenGLTexture::Target2DMultisample: never executed: case QOpenGLTexture::Target2DMultisample: | 0 | ||||||||||||||||||
| 2724 | case QOpenGLTexture::Target2DMultisampleArray: never executed: case QOpenGLTexture::Target2DMultisampleArray: | 0 | ||||||||||||||||||
| 2725 | qWarning("QAbstractOpenGLTexture::setMipLevels(): This texture target does not support mipmaps"); | - | ||||||||||||||||||
| 2726 | break; never executed: break; | 0 | ||||||||||||||||||
| 2727 | } | - | ||||||||||||||||||
| 2728 | } never executed: end of block | 0 | ||||||||||||||||||
| 2729 | - | |||||||||||||||||||
| 2730 | /*! | - | ||||||||||||||||||
| 2731 | Returns the number of mipmap levels for this texture. If storage | - | ||||||||||||||||||
| 2732 | has not yet been allocated for this texture it returns the | - | ||||||||||||||||||
| 2733 | requested number of mipmap levels. | - | ||||||||||||||||||
| 2734 | - | |||||||||||||||||||
| 2735 | \sa setMipLevels(), maximumMipLevels(), isStorageAllocated() | - | ||||||||||||||||||
| 2736 | */ | - | ||||||||||||||||||
| 2737 | int QOpenGLTexture::mipLevels() const | - | ||||||||||||||||||
| 2738 | { | - | ||||||||||||||||||
| 2739 | Q_D(const QOpenGLTexture); | - | ||||||||||||||||||
| 2740 | return isStorageAllocated() ? d->mipLevels : d->requestedMipLevels; never executed: return isStorageAllocated() ? d->mipLevels : d->requestedMipLevels;
| 0 | ||||||||||||||||||
| 2741 | } | - | ||||||||||||||||||
| 2742 | - | |||||||||||||||||||
| 2743 | /*! | - | ||||||||||||||||||
| 2744 | Returns the maximum number of mipmap levels that this texture | - | ||||||||||||||||||
| 2745 | can have given the current dimensions. | - | ||||||||||||||||||
| 2746 | - | |||||||||||||||||||
| 2747 | \sa setMipLevels(), mipLevels(), setSize() | - | ||||||||||||||||||
| 2748 | */ | - | ||||||||||||||||||
| 2749 | int QOpenGLTexture::maximumMipLevels() const | - | ||||||||||||||||||
| 2750 | { | - | ||||||||||||||||||
| 2751 | Q_D(const QOpenGLTexture); | - | ||||||||||||||||||
| 2752 | return d->maximumMipLevelCount(); never executed: return d->maximumMipLevelCount(); | 0 | ||||||||||||||||||
| 2753 | } | - | ||||||||||||||||||
| 2754 | - | |||||||||||||||||||
| 2755 | /*! | - | ||||||||||||||||||
| 2756 | Sets the number of array \a layers to allocate storage for. This | - | ||||||||||||||||||
| 2757 | function should be called before storage is allocated for the texture. | - | ||||||||||||||||||
| 2758 | - | |||||||||||||||||||
| 2759 | For targets that do not support array layers this function has | - | ||||||||||||||||||
| 2760 | no effect. | - | ||||||||||||||||||
| 2761 | - | |||||||||||||||||||
| 2762 | \sa layers(), isStorageAllocated() | - | ||||||||||||||||||
| 2763 | */ | - | ||||||||||||||||||
| 2764 | void QOpenGLTexture::setLayers(int layers) | - | ||||||||||||||||||
| 2765 | { | - | ||||||||||||||||||
| 2766 | Q_D(QOpenGLTexture); | - | ||||||||||||||||||
| 2767 | d->create(); | - | ||||||||||||||||||
| 2768 | if (isStorageAllocated()) {
| 0 | ||||||||||||||||||
| 2769 | qWarning("Cannot set layers on a texture that already has storage allocated.\n" | - | ||||||||||||||||||
| 2770 | "To do so, destroy() the texture and then create() and setLayers()"); | - | ||||||||||||||||||
| 2771 | return; never executed: return; | 0 | ||||||||||||||||||
| 2772 | } | - | ||||||||||||||||||
| 2773 | - | |||||||||||||||||||
| 2774 | switch (d->target) { | - | ||||||||||||||||||
| 2775 | case QOpenGLTexture::Target1DArray: never executed: case QOpenGLTexture::Target1DArray: | 0 | ||||||||||||||||||
| 2776 | case QOpenGLTexture::Target2DArray: never executed: case QOpenGLTexture::Target2DArray: | 0 | ||||||||||||||||||
| 2777 | case QOpenGLTexture::TargetCubeMapArray: never executed: case QOpenGLTexture::TargetCubeMapArray: | 0 | ||||||||||||||||||
| 2778 | case QOpenGLTexture::Target2DMultisampleArray: never executed: case QOpenGLTexture::Target2DMultisampleArray: | 0 | ||||||||||||||||||
| 2779 | d->layers = layers; | - | ||||||||||||||||||
| 2780 | break; never executed: break; | 0 | ||||||||||||||||||
| 2781 | - | |||||||||||||||||||
| 2782 | case QOpenGLTexture::Target1D: never executed: case QOpenGLTexture::Target1D: | 0 | ||||||||||||||||||
| 2783 | case QOpenGLTexture::Target2D: never executed: case QOpenGLTexture::Target2D: | 0 | ||||||||||||||||||
| 2784 | case QOpenGLTexture::Target3D: never executed: case QOpenGLTexture::Target3D: | 0 | ||||||||||||||||||
| 2785 | case QOpenGLTexture::TargetCubeMap: never executed: case QOpenGLTexture::TargetCubeMap: | 0 | ||||||||||||||||||
| 2786 | case QOpenGLTexture::TargetBuffer: never executed: case QOpenGLTexture::TargetBuffer: | 0 | ||||||||||||||||||
| 2787 | case QOpenGLTexture::TargetRectangle: never executed: case QOpenGLTexture::TargetRectangle: | 0 | ||||||||||||||||||
| 2788 | case QOpenGLTexture::Target2DMultisample: never executed: case QOpenGLTexture::Target2DMultisample: | 0 | ||||||||||||||||||
| 2789 | qWarning("Texture target does not support array layers"); | - | ||||||||||||||||||
| 2790 | break; never executed: break; | 0 | ||||||||||||||||||
| 2791 | } | - | ||||||||||||||||||
| 2792 | } never executed: end of block | 0 | ||||||||||||||||||
| 2793 | - | |||||||||||||||||||
| 2794 | /*! | - | ||||||||||||||||||
| 2795 | Returns the number of array layers for this texture. If | - | ||||||||||||||||||
| 2796 | storage has not yet been allocated for this texture then | - | ||||||||||||||||||
| 2797 | this function returns the requested number of array layers. | - | ||||||||||||||||||
| 2798 | - | |||||||||||||||||||
| 2799 | For texture targets that do not support array layers this | - | ||||||||||||||||||
| 2800 | will return 1. | - | ||||||||||||||||||
| 2801 | - | |||||||||||||||||||
| 2802 | \sa setLayers(), isStorageAllocated() | - | ||||||||||||||||||
| 2803 | */ | - | ||||||||||||||||||
| 2804 | int QOpenGLTexture::layers() const | - | ||||||||||||||||||
| 2805 | { | - | ||||||||||||||||||
| 2806 | Q_D(const QOpenGLTexture); | - | ||||||||||||||||||
| 2807 | return d->layers; never executed: return d->layers; | 0 | ||||||||||||||||||
| 2808 | } | - | ||||||||||||||||||
| 2809 | - | |||||||||||||||||||
| 2810 | /*! | - | ||||||||||||||||||
| 2811 | Returns the number of faces for this texture. For cubemap | - | ||||||||||||||||||
| 2812 | and cubemap array type targets this will be 6. | - | ||||||||||||||||||
| 2813 | - | |||||||||||||||||||
| 2814 | For non-cubemap type targets this will return 1. | - | ||||||||||||||||||
| 2815 | */ | - | ||||||||||||||||||
| 2816 | int QOpenGLTexture::faces() const | - | ||||||||||||||||||
| 2817 | { | - | ||||||||||||||||||
| 2818 | Q_D(const QOpenGLTexture); | - | ||||||||||||||||||
| 2819 | return d->faces; never executed: return d->faces; | 0 | ||||||||||||||||||
| 2820 | } | - | ||||||||||||||||||
| 2821 | - | |||||||||||||||||||
| 2822 | /*! | - | ||||||||||||||||||
| 2823 | Sets the number of \a samples to allocate storage for when rendering to | - | ||||||||||||||||||
| 2824 | a multisample capable texture target. This function should | - | ||||||||||||||||||
| 2825 | be called before storage is allocated for the texture. | - | ||||||||||||||||||
| 2826 | - | |||||||||||||||||||
| 2827 | For targets that do not support multisampling this function has | - | ||||||||||||||||||
| 2828 | no effect. | - | ||||||||||||||||||
| 2829 | - | |||||||||||||||||||
| 2830 | \sa samples(), isStorageAllocated() | - | ||||||||||||||||||
| 2831 | */ | - | ||||||||||||||||||
| 2832 | void QOpenGLTexture::setSamples(int samples) | - | ||||||||||||||||||
| 2833 | { | - | ||||||||||||||||||
| 2834 | Q_D(QOpenGLTexture); | - | ||||||||||||||||||
| 2835 | d->create(); | - | ||||||||||||||||||
| 2836 | if (isStorageAllocated()) {
| 0 | ||||||||||||||||||
| 2837 | qWarning("Cannot set sample count on a texture that already has storage allocated.\n" | - | ||||||||||||||||||
| 2838 | "To do so, destroy() the texture and then create() and setSamples()"); | - | ||||||||||||||||||
| 2839 | return; never executed: return; | 0 | ||||||||||||||||||
| 2840 | } | - | ||||||||||||||||||
| 2841 | - | |||||||||||||||||||
| 2842 | switch (d->target) { | - | ||||||||||||||||||
| 2843 | case QOpenGLTexture::Target2DMultisample: never executed: case QOpenGLTexture::Target2DMultisample: | 0 | ||||||||||||||||||
| 2844 | case QOpenGLTexture::Target2DMultisampleArray: never executed: case QOpenGLTexture::Target2DMultisampleArray: | 0 | ||||||||||||||||||
| 2845 | d->samples = samples; | - | ||||||||||||||||||
| 2846 | break; never executed: break; | 0 | ||||||||||||||||||
| 2847 | - | |||||||||||||||||||
| 2848 | case QOpenGLTexture::Target1D: never executed: case QOpenGLTexture::Target1D: | 0 | ||||||||||||||||||
| 2849 | case QOpenGLTexture::Target2D: never executed: case QOpenGLTexture::Target2D: | 0 | ||||||||||||||||||
| 2850 | case QOpenGLTexture::Target3D: never executed: case QOpenGLTexture::Target3D: | 0 | ||||||||||||||||||
| 2851 | case QOpenGLTexture::Target1DArray: never executed: case QOpenGLTexture::Target1DArray: | 0 | ||||||||||||||||||
| 2852 | case QOpenGLTexture::Target2DArray: never executed: case QOpenGLTexture::Target2DArray: | 0 | ||||||||||||||||||
| 2853 | case QOpenGLTexture::TargetCubeMap: never executed: case QOpenGLTexture::TargetCubeMap: | 0 | ||||||||||||||||||
| 2854 | case QOpenGLTexture::TargetCubeMapArray: never executed: case QOpenGLTexture::TargetCubeMapArray: | 0 | ||||||||||||||||||
| 2855 | case QOpenGLTexture::TargetBuffer: never executed: case QOpenGLTexture::TargetBuffer: | 0 | ||||||||||||||||||
| 2856 | case QOpenGLTexture::TargetRectangle: never executed: case QOpenGLTexture::TargetRectangle: | 0 | ||||||||||||||||||
| 2857 | - | |||||||||||||||||||
| 2858 | qWarning("Texture target does not support multisampling"); | - | ||||||||||||||||||
| 2859 | break; never executed: break; | 0 | ||||||||||||||||||
| 2860 | } | - | ||||||||||||||||||
| 2861 | } never executed: end of block | 0 | ||||||||||||||||||
| 2862 | - | |||||||||||||||||||
| 2863 | /*! | - | ||||||||||||||||||
| 2864 | Returns the number of multisample sample points for this texture. | - | ||||||||||||||||||
| 2865 | If storage has not yet been allocated for this texture then | - | ||||||||||||||||||
| 2866 | this function returns the requested number of samples. | - | ||||||||||||||||||
| 2867 | - | |||||||||||||||||||
| 2868 | For texture targets that do not support multisampling this | - | ||||||||||||||||||
| 2869 | will return 0. | - | ||||||||||||||||||
| 2870 | - | |||||||||||||||||||
| 2871 | \sa setSamples(), isStorageAllocated() | - | ||||||||||||||||||
| 2872 | */ | - | ||||||||||||||||||
| 2873 | int QOpenGLTexture::samples() const | - | ||||||||||||||||||
| 2874 | { | - | ||||||||||||||||||
| 2875 | Q_D(const QOpenGLTexture); | - | ||||||||||||||||||
| 2876 | return d->samples; never executed: return d->samples; | 0 | ||||||||||||||||||
| 2877 | } | - | ||||||||||||||||||
| 2878 | - | |||||||||||||||||||
| 2879 | /*! | - | ||||||||||||||||||
| 2880 | Sets whether the sample positions and number of samples used with | - | ||||||||||||||||||
| 2881 | a multisample capable texture target to \a fixed. If set to \c true | - | ||||||||||||||||||
| 2882 | the sample positions and number of samples used are the same for | - | ||||||||||||||||||
| 2883 | all texels in the image and will not depend upon the image size or | - | ||||||||||||||||||
| 2884 | internal format. This function should be called before storage is allocated | - | ||||||||||||||||||
| 2885 | for the texture. | - | ||||||||||||||||||
| 2886 | - | |||||||||||||||||||
| 2887 | For targets that do not support multisampling this function has | - | ||||||||||||||||||
| 2888 | no effect. | - | ||||||||||||||||||
| 2889 | - | |||||||||||||||||||
| 2890 | The default value is \c true. | - | ||||||||||||||||||
| 2891 | - | |||||||||||||||||||
| 2892 | \sa isFixedSamplePositions(), isStorageAllocated() | - | ||||||||||||||||||
| 2893 | */ | - | ||||||||||||||||||
| 2894 | void QOpenGLTexture::setFixedSamplePositions(bool fixed) | - | ||||||||||||||||||
| 2895 | { | - | ||||||||||||||||||
| 2896 | Q_D(QOpenGLTexture); | - | ||||||||||||||||||
| 2897 | d->create(); | - | ||||||||||||||||||
| 2898 | if (isStorageAllocated()) {
| 0 | ||||||||||||||||||
| 2899 | qWarning("Cannot set sample positions on a texture that already has storage allocated.\n" | - | ||||||||||||||||||
| 2900 | "To do so, destroy() the texture and then create() and setFixedSamplePositions()"); | - | ||||||||||||||||||
| 2901 | return; never executed: return; | 0 | ||||||||||||||||||
| 2902 | } | - | ||||||||||||||||||
| 2903 | - | |||||||||||||||||||
| 2904 | switch (d->target) { | - | ||||||||||||||||||
| 2905 | case QOpenGLTexture::Target2DMultisample: never executed: case QOpenGLTexture::Target2DMultisample: | 0 | ||||||||||||||||||
| 2906 | case QOpenGLTexture::Target2DMultisampleArray: never executed: case QOpenGLTexture::Target2DMultisampleArray: | 0 | ||||||||||||||||||
| 2907 | d->fixedSamplePositions = fixed; | - | ||||||||||||||||||
| 2908 | break; never executed: break; | 0 | ||||||||||||||||||
| 2909 | - | |||||||||||||||||||
| 2910 | case QOpenGLTexture::Target1D: never executed: case QOpenGLTexture::Target1D: | 0 | ||||||||||||||||||
| 2911 | case QOpenGLTexture::Target2D: never executed: case QOpenGLTexture::Target2D: | 0 | ||||||||||||||||||
| 2912 | case QOpenGLTexture::Target3D: never executed: case QOpenGLTexture::Target3D: | 0 | ||||||||||||||||||
| 2913 | case QOpenGLTexture::Target1DArray: never executed: case QOpenGLTexture::Target1DArray: | 0 | ||||||||||||||||||
| 2914 | case QOpenGLTexture::Target2DArray: never executed: case QOpenGLTexture::Target2DArray: | 0 | ||||||||||||||||||
| 2915 | case QOpenGLTexture::TargetCubeMap: never executed: case QOpenGLTexture::TargetCubeMap: | 0 | ||||||||||||||||||
| 2916 | case QOpenGLTexture::TargetCubeMapArray: never executed: case QOpenGLTexture::TargetCubeMapArray: | 0 | ||||||||||||||||||
| 2917 | case QOpenGLTexture::TargetBuffer: never executed: case QOpenGLTexture::TargetBuffer: | 0 | ||||||||||||||||||
| 2918 | case QOpenGLTexture::TargetRectangle: never executed: case QOpenGLTexture::TargetRectangle: | 0 | ||||||||||||||||||
| 2919 | - | |||||||||||||||||||
| 2920 | qWarning("Texture target does not support multisampling"); | - | ||||||||||||||||||
| 2921 | break; never executed: break; | 0 | ||||||||||||||||||
| 2922 | } | - | ||||||||||||||||||
| 2923 | } never executed: end of block | 0 | ||||||||||||||||||
| 2924 | - | |||||||||||||||||||
| 2925 | /*! | - | ||||||||||||||||||
| 2926 | Returns whether this texture uses a fixed pattern of multisample | - | ||||||||||||||||||
| 2927 | samples. If storage has not yet been allocated for this texture then | - | ||||||||||||||||||
| 2928 | this function returns the requested fixed sample position setting. | - | ||||||||||||||||||
| 2929 | - | |||||||||||||||||||
| 2930 | For texture targets that do not support multisampling this | - | ||||||||||||||||||
| 2931 | will return \c true. | - | ||||||||||||||||||
| 2932 | - | |||||||||||||||||||
| 2933 | \sa setFixedSamplePositions(), isStorageAllocated() | - | ||||||||||||||||||
| 2934 | */ | - | ||||||||||||||||||
| 2935 | bool QOpenGLTexture::isFixedSamplePositions() const | - | ||||||||||||||||||
| 2936 | { | - | ||||||||||||||||||
| 2937 | Q_D(const QOpenGLTexture); | - | ||||||||||||||||||
| 2938 | return d->fixedSamplePositions; never executed: return d->fixedSamplePositions; | 0 | ||||||||||||||||||
| 2939 | } | - | ||||||||||||||||||
| 2940 | - | |||||||||||||||||||
| 2941 | /*! | - | ||||||||||||||||||
| 2942 | Allocates server-side storage for this texture object taking | - | ||||||||||||||||||
| 2943 | into account, the format, dimensions, mipmap levels, array | - | ||||||||||||||||||
| 2944 | layers and cubemap faces. | - | ||||||||||||||||||
| 2945 | - | |||||||||||||||||||
| 2946 | Once storage has been allocated it is no longer possible to change | - | ||||||||||||||||||
| 2947 | these properties. | - | ||||||||||||||||||
| 2948 | - | |||||||||||||||||||
| 2949 | If supported QOpenGLTexture makes use of immutable texture | - | ||||||||||||||||||
| 2950 | storage. | - | ||||||||||||||||||
| 2951 | - | |||||||||||||||||||
| 2952 | Once storage has been allocated for the texture then pixel data | - | ||||||||||||||||||
| 2953 | can be uploaded via one of the setData() overloads. | - | ||||||||||||||||||
| 2954 | - | |||||||||||||||||||
| 2955 | \note If immutable texture storage is not available, | - | ||||||||||||||||||
| 2956 | then a default pixel format and pixel type will be used to | - | ||||||||||||||||||
| 2957 | create the mutable storage. You can use the other | - | ||||||||||||||||||
| 2958 | allocateStorage() overload to specify exactly the pixel format | - | ||||||||||||||||||
| 2959 | and the pixel type to use when allocating mutable storage; | - | ||||||||||||||||||
| 2960 | this is particulary useful under certain OpenGL ES implementations | - | ||||||||||||||||||
| 2961 | (notably, OpenGL ES 2), where the pixel format and the pixel type | - | ||||||||||||||||||
| 2962 | used at allocation time must perfectly match the format | - | ||||||||||||||||||
| 2963 | and the type passed to any subsequent setData() call. | - | ||||||||||||||||||
| 2964 | - | |||||||||||||||||||
| 2965 | \sa isStorageAllocated(), setData() | - | ||||||||||||||||||
| 2966 | */ | - | ||||||||||||||||||
| 2967 | void QOpenGLTexture::allocateStorage() | - | ||||||||||||||||||
| 2968 | { | - | ||||||||||||||||||
| 2969 | Q_D(QOpenGLTexture); | - | ||||||||||||||||||
| 2970 | if (d->create()) {
| 0 | ||||||||||||||||||
| 2971 | const QOpenGLTexture::PixelFormat pixelFormat = pixelFormatCompatibleWithInternalFormat(d->format); | - | ||||||||||||||||||
| 2972 | const QOpenGLTexture::PixelType pixelType = pixelTypeCompatibleWithInternalFormat(d->format); | - | ||||||||||||||||||
| 2973 | d->allocateStorage(pixelFormat, pixelType); | - | ||||||||||||||||||
| 2974 | } never executed: end of block | 0 | ||||||||||||||||||
| 2975 | } never executed: end of block | 0 | ||||||||||||||||||
| 2976 | - | |||||||||||||||||||
| 2977 | /*! | - | ||||||||||||||||||
| 2978 | \since 5.5 | - | ||||||||||||||||||
| 2979 | - | |||||||||||||||||||
| 2980 | Allocates server-side storage for this texture object taking | - | ||||||||||||||||||
| 2981 | into account, the format, dimensions, mipmap levels, array | - | ||||||||||||||||||
| 2982 | layers and cubemap faces. | - | ||||||||||||||||||
| 2983 | - | |||||||||||||||||||
| 2984 | Once storage has been allocated it is no longer possible to change | - | ||||||||||||||||||
| 2985 | these properties. | - | ||||||||||||||||||
| 2986 | - | |||||||||||||||||||
| 2987 | If supported QOpenGLTexture makes use of immutable texture | - | ||||||||||||||||||
| 2988 | storage. However, if immutable texture storage is not available, | - | ||||||||||||||||||
| 2989 | then the specified \a pixelFormat and \a pixelType will be used | - | ||||||||||||||||||
| 2990 | to allocate mutable storage; note that in certain OpenGL implementations | - | ||||||||||||||||||
| 2991 | (notably, OpenGL ES 2) they must perfectly match the format | - | ||||||||||||||||||
| 2992 | and the type passed to any subsequent setData() call. | - | ||||||||||||||||||
| 2993 | - | |||||||||||||||||||
| 2994 | Once storage has been allocated for the texture then pixel data | - | ||||||||||||||||||
| 2995 | can be uploaded via one of the setData() overloads. | - | ||||||||||||||||||
| 2996 | - | |||||||||||||||||||
| 2997 | \sa isStorageAllocated(), setData() | - | ||||||||||||||||||
| 2998 | */ | - | ||||||||||||||||||
| 2999 | void QOpenGLTexture::allocateStorage(QOpenGLTexture::PixelFormat pixelFormat, QOpenGLTexture::PixelType pixelType) | - | ||||||||||||||||||
| 3000 | { | - | ||||||||||||||||||
| 3001 | Q_D(QOpenGLTexture); | - | ||||||||||||||||||
| 3002 | if (d->create())
| 0 | ||||||||||||||||||
| 3003 | d->allocateStorage(pixelFormat, pixelType); never executed: d->allocateStorage(pixelFormat, pixelType); | 0 | ||||||||||||||||||
| 3004 | } never executed: end of block | 0 | ||||||||||||||||||
| 3005 | - | |||||||||||||||||||
| 3006 | /*! | - | ||||||||||||||||||
| 3007 | Returns \c true if server-side storage for this texture as been | - | ||||||||||||||||||
| 3008 | allocated. | - | ||||||||||||||||||
| 3009 | - | |||||||||||||||||||
| 3010 | The texture format, dimensions, mipmap levels and array layers | - | ||||||||||||||||||
| 3011 | cannot be altered once storage ihas been allocated. | - | ||||||||||||||||||
| 3012 | - | |||||||||||||||||||
| 3013 | \sa allocateStorage(), setSize(), setMipLevels(), setLayers(), setFormat() | - | ||||||||||||||||||
| 3014 | */ | - | ||||||||||||||||||
| 3015 | bool QOpenGLTexture::isStorageAllocated() const | - | ||||||||||||||||||
| 3016 | { | - | ||||||||||||||||||
| 3017 | Q_D(const QOpenGLTexture); | - | ||||||||||||||||||
| 3018 | return d->storageAllocated; never executed: return d->storageAllocated; | 0 | ||||||||||||||||||
| 3019 | } | - | ||||||||||||||||||
| 3020 | - | |||||||||||||||||||
| 3021 | /*! | - | ||||||||||||||||||
| 3022 | Attempts to create a texture view onto this texture. A texture | - | ||||||||||||||||||
| 3023 | view is somewhat analogous to a view in SQL in that it presents | - | ||||||||||||||||||
| 3024 | a restricted or reinterpreted view of the original data. Texture | - | ||||||||||||||||||
| 3025 | views do not allocate any more server-side storage, insted relying | - | ||||||||||||||||||
| 3026 | on the storage buffer of the source texture. | - | ||||||||||||||||||
| 3027 | - | |||||||||||||||||||
| 3028 | Texture views are only available when using immutable storage. For | - | ||||||||||||||||||
| 3029 | more information on texture views see | - | ||||||||||||||||||
| 3030 | http://www.opengl.org/wiki/Texture_Storage#Texture_views. | - | ||||||||||||||||||
| 3031 | - | |||||||||||||||||||
| 3032 | The \a target argument specifies the target to use for the view. | - | ||||||||||||||||||
| 3033 | Only some targets can be used depending upon the target of the original | - | ||||||||||||||||||
| 3034 | target. For e.g. a view onto a Target1DArray texture can specify | - | ||||||||||||||||||
| 3035 | either Target1DArray or Target1D but for the latter the number of | - | ||||||||||||||||||
| 3036 | array layers specified with \a minimumLayer and \a maximumLayer must | - | ||||||||||||||||||
| 3037 | be exactly 1. | - | ||||||||||||||||||
| 3038 | - | |||||||||||||||||||
| 3039 | Simpliar constraints apply for the \a viewFormat. See the above link | - | ||||||||||||||||||
| 3040 | and the specification for more details. | - | ||||||||||||||||||
| 3041 | - | |||||||||||||||||||
| 3042 | The \a minimumMipmapLevel, \a maximumMipmapLevel, \a minimumLayer, | - | ||||||||||||||||||
| 3043 | and \a maximumLayer arguments serve to restrict the parts of the | - | ||||||||||||||||||
| 3044 | texture accessible by the texture view. | - | ||||||||||||||||||
| 3045 | - | |||||||||||||||||||
| 3046 | If creation of the texture view fails this function will return | - | ||||||||||||||||||
| 3047 | 0. If the function succeeds it will return a pointer to a new | - | ||||||||||||||||||
| 3048 | QOpenGLTexture object that will return \c true from its isTextureView() | - | ||||||||||||||||||
| 3049 | function. | - | ||||||||||||||||||
| 3050 | - | |||||||||||||||||||
| 3051 | \sa isTextureView() | - | ||||||||||||||||||
| 3052 | */ | - | ||||||||||||||||||
| 3053 | QOpenGLTexture *QOpenGLTexture::createTextureView(Target target, | - | ||||||||||||||||||
| 3054 | TextureFormat viewFormat, | - | ||||||||||||||||||
| 3055 | int minimumMipmapLevel, int maximumMipmapLevel, | - | ||||||||||||||||||
| 3056 | int minimumLayer, int maximumLayer) const | - | ||||||||||||||||||
| 3057 | { | - | ||||||||||||||||||
| 3058 | Q_D(const QOpenGLTexture); | - | ||||||||||||||||||
| 3059 | if (!isStorageAllocated()) {
| 0 | ||||||||||||||||||
| 3060 | qWarning("Cannot set create a texture view of a texture that does not have storage allocated."); | - | ||||||||||||||||||
| 3061 | return 0; never executed: return 0; | 0 | ||||||||||||||||||
| 3062 | } | - | ||||||||||||||||||
| 3063 | Q_ASSERT(maximumMipmapLevel >= minimumMipmapLevel); | - | ||||||||||||||||||
| 3064 | Q_ASSERT(maximumLayer >= minimumLayer); | - | ||||||||||||||||||
| 3065 | return d->createTextureView(target, viewFormat, never executed: return d->createTextureView(target, viewFormat, minimumMipmapLevel, maximumMipmapLevel, minimumLayer, maximumLayer); | 0 | ||||||||||||||||||
| 3066 | minimumMipmapLevel, maximumMipmapLevel, never executed: return d->createTextureView(target, viewFormat, minimumMipmapLevel, maximumMipmapLevel, minimumLayer, maximumLayer); | 0 | ||||||||||||||||||
| 3067 | minimumLayer, maximumLayer); never executed: return d->createTextureView(target, viewFormat, minimumMipmapLevel, maximumMipmapLevel, minimumLayer, maximumLayer); | 0 | ||||||||||||||||||
| 3068 | } | - | ||||||||||||||||||
| 3069 | - | |||||||||||||||||||
| 3070 | /*! | - | ||||||||||||||||||
| 3071 | Returns \c true if this texture object is actually a view onto another | - | ||||||||||||||||||
| 3072 | texture object. | - | ||||||||||||||||||
| 3073 | - | |||||||||||||||||||
| 3074 | \sa createTextureView() | - | ||||||||||||||||||
| 3075 | */ | - | ||||||||||||||||||
| 3076 | bool QOpenGLTexture::isTextureView() const | - | ||||||||||||||||||
| 3077 | { | - | ||||||||||||||||||
| 3078 | Q_D(const QOpenGLTexture); | - | ||||||||||||||||||
| 3079 | Q_ASSERT(d->textureId); | - | ||||||||||||||||||
| 3080 | return d->textureView; never executed: return d->textureView; | 0 | ||||||||||||||||||
| 3081 | } | - | ||||||||||||||||||
| 3082 | - | |||||||||||||||||||
| 3083 | /*! | - | ||||||||||||||||||
| 3084 | Uploads pixel \a data for this texture object \a mipLevel, array \a layer, and \a cubeFace. | - | ||||||||||||||||||
| 3085 | Storage must have been allocated before uploading pixel data. Some overloads of setData() | - | ||||||||||||||||||
| 3086 | will set appropriate dimensions, mipmap levels, and array layers and then allocate storage | - | ||||||||||||||||||
| 3087 | for you if they have enough information to do so. This will be noted in the function | - | ||||||||||||||||||
| 3088 | documentation. | - | ||||||||||||||||||
| 3089 | - | |||||||||||||||||||
| 3090 | The structure of the pixel data pointed to by \a data is specified by \a sourceFormat | - | ||||||||||||||||||
| 3091 | and \a sourceType. The pixel data upload can optionally be controlled by \a options. | - | ||||||||||||||||||
| 3092 | - | |||||||||||||||||||
| 3093 | If using a compressed format() then you should use setCompressedData() instead of this | - | ||||||||||||||||||
| 3094 | function. | - | ||||||||||||||||||
| 3095 | - | |||||||||||||||||||
| 3096 | \since 5.3 | - | ||||||||||||||||||
| 3097 | \sa setCompressedData() | - | ||||||||||||||||||
| 3098 | */ | - | ||||||||||||||||||
| 3099 | void QOpenGLTexture::setData(int mipLevel, int layer, CubeMapFace cubeFace, | - | ||||||||||||||||||
| 3100 | PixelFormat sourceFormat, PixelType sourceType, | - | ||||||||||||||||||
| 3101 | const void *data, const QOpenGLPixelTransferOptions * const options) | - | ||||||||||||||||||
| 3102 | { | - | ||||||||||||||||||
| 3103 | Q_D(QOpenGLTexture); | - | ||||||||||||||||||
| 3104 | Q_ASSERT(d->textureId); | - | ||||||||||||||||||
| 3105 | if (!isStorageAllocated()) {
| 0 | ||||||||||||||||||
| 3106 | qWarning("Cannot set data on a texture that does not have storage allocated.\n" | - | ||||||||||||||||||
| 3107 | "To do so call allocateStorage() before this function"); | - | ||||||||||||||||||
| 3108 | return; never executed: return; | 0 | ||||||||||||||||||
| 3109 | } | - | ||||||||||||||||||
| 3110 | d->setData(mipLevel, layer, cubeFace, sourceFormat, sourceType, data, options); | - | ||||||||||||||||||
| 3111 | } never executed: end of block | 0 | ||||||||||||||||||
| 3112 | - | |||||||||||||||||||
| 3113 | /*! | - | ||||||||||||||||||
| 3114 | \since 5.3 | - | ||||||||||||||||||
| 3115 | \overload | - | ||||||||||||||||||
| 3116 | */ | - | ||||||||||||||||||
| 3117 | void QOpenGLTexture::setData(int mipLevel, int layer, | - | ||||||||||||||||||
| 3118 | PixelFormat sourceFormat, PixelType sourceType, | - | ||||||||||||||||||
| 3119 | const void *data, const QOpenGLPixelTransferOptions * const options) | - | ||||||||||||||||||
| 3120 | { | - | ||||||||||||||||||
| 3121 | Q_D(QOpenGLTexture); | - | ||||||||||||||||||
| 3122 | Q_ASSERT(d->textureId); | - | ||||||||||||||||||
| 3123 | d->setData(mipLevel, layer, QOpenGLTexture::CubeMapPositiveX, sourceFormat, sourceType, data, options); | - | ||||||||||||||||||
| 3124 | } never executed: end of block | 0 | ||||||||||||||||||
| 3125 | - | |||||||||||||||||||
| 3126 | /*! | - | ||||||||||||||||||
| 3127 | \since 5.3 | - | ||||||||||||||||||
| 3128 | \overload | - | ||||||||||||||||||
| 3129 | */ | - | ||||||||||||||||||
| 3130 | void QOpenGLTexture::setData(int mipLevel, | - | ||||||||||||||||||
| 3131 | PixelFormat sourceFormat, PixelType sourceType, | - | ||||||||||||||||||
| 3132 | const void *data, const QOpenGLPixelTransferOptions * const options) | - | ||||||||||||||||||
| 3133 | { | - | ||||||||||||||||||
| 3134 | Q_D(QOpenGLTexture); | - | ||||||||||||||||||
| 3135 | Q_ASSERT(d->textureId); | - | ||||||||||||||||||
| 3136 | d->setData(mipLevel, 0, QOpenGLTexture::CubeMapPositiveX, sourceFormat, sourceType, data, options); | - | ||||||||||||||||||
| 3137 | } never executed: end of block | 0 | ||||||||||||||||||
| 3138 | - | |||||||||||||||||||
| 3139 | /*! | - | ||||||||||||||||||
| 3140 | \since 5.3 | - | ||||||||||||||||||
| 3141 | \overload | - | ||||||||||||||||||
| 3142 | */ | - | ||||||||||||||||||
| 3143 | void QOpenGLTexture::setData(PixelFormat sourceFormat, PixelType sourceType, | - | ||||||||||||||||||
| 3144 | const void *data, const QOpenGLPixelTransferOptions * const options) | - | ||||||||||||||||||
| 3145 | { | - | ||||||||||||||||||
| 3146 | Q_D(QOpenGLTexture); | - | ||||||||||||||||||
| 3147 | Q_ASSERT(d->textureId); | - | ||||||||||||||||||
| 3148 | d->setData(0, 0, QOpenGLTexture::CubeMapPositiveX, sourceFormat, sourceType, data, options); | - | ||||||||||||||||||
| 3149 | } never executed: end of block | 0 | ||||||||||||||||||
| 3150 | - | |||||||||||||||||||
| 3151 | #if QT_DEPRECATED_SINCE(5, 3) | - | ||||||||||||||||||
| 3152 | /*! | - | ||||||||||||||||||
| 3153 | \obsolete | - | ||||||||||||||||||
| 3154 | \overload | - | ||||||||||||||||||
| 3155 | - | |||||||||||||||||||
| 3156 | \sa setCompressedData() | - | ||||||||||||||||||
| 3157 | */ | - | ||||||||||||||||||
| 3158 | void QOpenGLTexture::setData(int mipLevel, int layer, CubeMapFace cubeFace, | - | ||||||||||||||||||
| 3159 | PixelFormat sourceFormat, PixelType sourceType, | - | ||||||||||||||||||
| 3160 | void *data, const QOpenGLPixelTransferOptions * const options) | - | ||||||||||||||||||
| 3161 | { | - | ||||||||||||||||||
| 3162 | Q_D(QOpenGLTexture); | - | ||||||||||||||||||
| 3163 | Q_ASSERT(d->textureId); | - | ||||||||||||||||||
| 3164 | if (!isStorageAllocated()) {
| 0 | ||||||||||||||||||
| 3165 | qWarning("Cannot set data on a texture that does not have storage allocated.\n" | - | ||||||||||||||||||
| 3166 | "To do so call allocateStorage() before this function"); | - | ||||||||||||||||||
| 3167 | return; never executed: return; | 0 | ||||||||||||||||||
| 3168 | } | - | ||||||||||||||||||
| 3169 | d->setData(mipLevel, layer, cubeFace, sourceFormat, sourceType, data, options); | - | ||||||||||||||||||
| 3170 | } never executed: end of block | 0 | ||||||||||||||||||
| 3171 | - | |||||||||||||||||||
| 3172 | /*! | - | ||||||||||||||||||
| 3173 | \obsolete | - | ||||||||||||||||||
| 3174 | \overload | - | ||||||||||||||||||
| 3175 | */ | - | ||||||||||||||||||
| 3176 | void QOpenGLTexture::setData(int mipLevel, int layer, | - | ||||||||||||||||||
| 3177 | PixelFormat sourceFormat, PixelType sourceType, | - | ||||||||||||||||||
| 3178 | void *data, const QOpenGLPixelTransferOptions * const options) | - | ||||||||||||||||||
| 3179 | { | - | ||||||||||||||||||
| 3180 | Q_D(QOpenGLTexture); | - | ||||||||||||||||||
| 3181 | Q_ASSERT(d->textureId); | - | ||||||||||||||||||
| 3182 | d->setData(mipLevel, layer, QOpenGLTexture::CubeMapPositiveX, sourceFormat, sourceType, data, options); | - | ||||||||||||||||||
| 3183 | } never executed: end of block | 0 | ||||||||||||||||||
| 3184 | - | |||||||||||||||||||
| 3185 | /*! | - | ||||||||||||||||||
| 3186 | \obsolete | - | ||||||||||||||||||
| 3187 | \overload | - | ||||||||||||||||||
| 3188 | */ | - | ||||||||||||||||||
| 3189 | void QOpenGLTexture::setData(int mipLevel, | - | ||||||||||||||||||
| 3190 | PixelFormat sourceFormat, PixelType sourceType, | - | ||||||||||||||||||
| 3191 | void *data, const QOpenGLPixelTransferOptions * const options) | - | ||||||||||||||||||
| 3192 | { | - | ||||||||||||||||||
| 3193 | Q_D(QOpenGLTexture); | - | ||||||||||||||||||
| 3194 | Q_ASSERT(d->textureId); | - | ||||||||||||||||||
| 3195 | d->setData(mipLevel, 0, QOpenGLTexture::CubeMapPositiveX, sourceFormat, sourceType, data, options); | - | ||||||||||||||||||
| 3196 | } never executed: end of block | 0 | ||||||||||||||||||
| 3197 | - | |||||||||||||||||||
| 3198 | /*! | - | ||||||||||||||||||
| 3199 | \obsolete | - | ||||||||||||||||||
| 3200 | \overload | - | ||||||||||||||||||
| 3201 | */ | - | ||||||||||||||||||
| 3202 | void QOpenGLTexture::setData(PixelFormat sourceFormat, PixelType sourceType, | - | ||||||||||||||||||
| 3203 | void *data, const QOpenGLPixelTransferOptions * const options) | - | ||||||||||||||||||
| 3204 | { | - | ||||||||||||||||||
| 3205 | Q_D(QOpenGLTexture); | - | ||||||||||||||||||
| 3206 | Q_ASSERT(d->textureId); | - | ||||||||||||||||||
| 3207 | d->setData(0, 0, QOpenGLTexture::CubeMapPositiveX, sourceFormat, sourceType, data, options); | - | ||||||||||||||||||
| 3208 | } never executed: end of block | 0 | ||||||||||||||||||
| 3209 | #endif | - | ||||||||||||||||||
| 3210 | - | |||||||||||||||||||
| 3211 | /*! | - | ||||||||||||||||||
| 3212 | This overload of setData() will allocate storage for you. | - | ||||||||||||||||||
| 3213 | The pixel data is contained in \a image. Mipmaps are generated by default. | - | ||||||||||||||||||
| 3214 | Set \a genMipMaps to \l DontGenerateMipMaps to turn off mipmap generation. | - | ||||||||||||||||||
| 3215 | - | |||||||||||||||||||
| 3216 | \overload | - | ||||||||||||||||||
| 3217 | */ | - | ||||||||||||||||||
| 3218 | void QOpenGLTexture::setData(const QImage& image, MipMapGeneration genMipMaps) | - | ||||||||||||||||||
| 3219 | { | - | ||||||||||||||||||
| 3220 | QOpenGLContext *context = QOpenGLContext::currentContext(); | - | ||||||||||||||||||
| 3221 | if (!context) {
| 0 | ||||||||||||||||||
| 3222 | qWarning("QOpenGLTexture::setData() requires a valid current context"); | - | ||||||||||||||||||
| 3223 | return; never executed: return; | 0 | ||||||||||||||||||
| 3224 | } | - | ||||||||||||||||||
| 3225 | - | |||||||||||||||||||
| 3226 | if (image.isNull()) {
| 0 | ||||||||||||||||||
| 3227 | qWarning("QOpenGLTexture::setData() tried to set a null image"); | - | ||||||||||||||||||
| 3228 | return; never executed: return; | 0 | ||||||||||||||||||
| 3229 | } | - | ||||||||||||||||||
| 3230 | - | |||||||||||||||||||
| 3231 | if (context->isOpenGLES() && context->format().majorVersion() < 3)
| 0 | ||||||||||||||||||
| 3232 | setFormat(QOpenGLTexture::RGBAFormat); never executed: setFormat(QOpenGLTexture::RGBAFormat); | 0 | ||||||||||||||||||
| 3233 | else | - | ||||||||||||||||||
| 3234 | setFormat(QOpenGLTexture::RGBA8_UNorm); never executed: setFormat(QOpenGLTexture::RGBA8_UNorm); | 0 | ||||||||||||||||||
| 3235 | - | |||||||||||||||||||
| 3236 | setSize(image.width(), image.height()); | - | ||||||||||||||||||
| 3237 | setMipLevels(genMipMaps == GenerateMipMaps ? maximumMipLevels() : 1); | - | ||||||||||||||||||
| 3238 | allocateStorage(QOpenGLTexture::RGBA, QOpenGLTexture::UInt8); | - | ||||||||||||||||||
| 3239 | - | |||||||||||||||||||
| 3240 | // Upload pixel data and generate mipmaps | - | ||||||||||||||||||
| 3241 | QImage glImage = image.convertToFormat(QImage::Format_RGBA8888); | - | ||||||||||||||||||
| 3242 | QOpenGLPixelTransferOptions uploadOptions; | - | ||||||||||||||||||
| 3243 | uploadOptions.setAlignment(1); | - | ||||||||||||||||||
| 3244 | setData(0, QOpenGLTexture::RGBA, QOpenGLTexture::UInt8, glImage.constBits(), &uploadOptions); | - | ||||||||||||||||||
| 3245 | } never executed: end of block | 0 | ||||||||||||||||||
| 3246 | - | |||||||||||||||||||
| 3247 | /*! | - | ||||||||||||||||||
| 3248 | Uploads compressed pixel \a data to \a mipLevel, array \a layer, and \a cubeFace. | - | ||||||||||||||||||
| 3249 | The pixel transfer can optionally be controlled with \a options. The \a dataSize | - | ||||||||||||||||||
| 3250 | argument should specify the size of the data pointed to by \a data. | - | ||||||||||||||||||
| 3251 | - | |||||||||||||||||||
| 3252 | If not using a compressed format() then you should use setData() instead of this | - | ||||||||||||||||||
| 3253 | function. | - | ||||||||||||||||||
| 3254 | - | |||||||||||||||||||
| 3255 | \since 5.3 | - | ||||||||||||||||||
| 3256 | */ | - | ||||||||||||||||||
| 3257 | void QOpenGLTexture::setCompressedData(int mipLevel, int layer, CubeMapFace cubeFace, | - | ||||||||||||||||||
| 3258 | int dataSize, const void *data, | - | ||||||||||||||||||
| 3259 | const QOpenGLPixelTransferOptions * const options) | - | ||||||||||||||||||
| 3260 | { | - | ||||||||||||||||||
| 3261 | Q_D(QOpenGLTexture); | - | ||||||||||||||||||
| 3262 | Q_ASSERT(d->textureId); | - | ||||||||||||||||||
| 3263 | if (!isStorageAllocated()) {
| 0 | ||||||||||||||||||
| 3264 | qWarning("Cannot set data on a texture that does not have storage allocated.\n" | - | ||||||||||||||||||
| 3265 | "To do so call allocateStorage() before this function"); | - | ||||||||||||||||||
| 3266 | return; never executed: return; | 0 | ||||||||||||||||||
| 3267 | } | - | ||||||||||||||||||
| 3268 | d->setCompressedData(mipLevel, layer, cubeFace, dataSize, data, options); | - | ||||||||||||||||||
| 3269 | } never executed: end of block | 0 | ||||||||||||||||||
| 3270 | - | |||||||||||||||||||
| 3271 | /*! | - | ||||||||||||||||||
| 3272 | \overload | - | ||||||||||||||||||
| 3273 | */ | - | ||||||||||||||||||
| 3274 | void QOpenGLTexture::setCompressedData(int mipLevel, int layer, int dataSize, const void *data, | - | ||||||||||||||||||
| 3275 | const QOpenGLPixelTransferOptions * const options) | - | ||||||||||||||||||
| 3276 | { | - | ||||||||||||||||||
| 3277 | Q_D(QOpenGLTexture); | - | ||||||||||||||||||
| 3278 | Q_ASSERT(d->textureId); | - | ||||||||||||||||||
| 3279 | d->setCompressedData(mipLevel, layer, QOpenGLTexture::CubeMapPositiveX, dataSize, data, options); | - | ||||||||||||||||||
| 3280 | } never executed: end of block | 0 | ||||||||||||||||||
| 3281 | - | |||||||||||||||||||
| 3282 | /*! | - | ||||||||||||||||||
| 3283 | \overload | - | ||||||||||||||||||
| 3284 | */ | - | ||||||||||||||||||
| 3285 | void QOpenGLTexture::setCompressedData(int mipLevel, int dataSize, const void *data, | - | ||||||||||||||||||
| 3286 | const QOpenGLPixelTransferOptions * const options) | - | ||||||||||||||||||
| 3287 | { | - | ||||||||||||||||||
| 3288 | Q_D(QOpenGLTexture); | - | ||||||||||||||||||
| 3289 | Q_ASSERT(d->textureId); | - | ||||||||||||||||||
| 3290 | d->setCompressedData(mipLevel, 0, QOpenGLTexture::CubeMapPositiveX, dataSize, data, options); | - | ||||||||||||||||||
| 3291 | } never executed: end of block | 0 | ||||||||||||||||||
| 3292 | - | |||||||||||||||||||
| 3293 | /*! | - | ||||||||||||||||||
| 3294 | \overload | - | ||||||||||||||||||
| 3295 | */ | - | ||||||||||||||||||
| 3296 | void QOpenGLTexture::setCompressedData(int dataSize, const void *data, | - | ||||||||||||||||||
| 3297 | const QOpenGLPixelTransferOptions * const options) | - | ||||||||||||||||||
| 3298 | { | - | ||||||||||||||||||
| 3299 | Q_D(QOpenGLTexture); | - | ||||||||||||||||||
| 3300 | Q_ASSERT(d->textureId); | - | ||||||||||||||||||
| 3301 | d->setCompressedData(0, 0, QOpenGLTexture::CubeMapPositiveX, dataSize, data, options); | - | ||||||||||||||||||
| 3302 | } never executed: end of block | 0 | ||||||||||||||||||
| 3303 | - | |||||||||||||||||||
| 3304 | #if QT_DEPRECATED_SINCE(5, 3) | - | ||||||||||||||||||
| 3305 | /*! | - | ||||||||||||||||||
| 3306 | \obsolete | - | ||||||||||||||||||
| 3307 | \overload | - | ||||||||||||||||||
| 3308 | */ | - | ||||||||||||||||||
| 3309 | void QOpenGLTexture::setCompressedData(int mipLevel, int layer, CubeMapFace cubeFace, | - | ||||||||||||||||||
| 3310 | int dataSize, void *data, | - | ||||||||||||||||||
| 3311 | const QOpenGLPixelTransferOptions * const options) | - | ||||||||||||||||||
| 3312 | { | - | ||||||||||||||||||
| 3313 | Q_D(QOpenGLTexture); | - | ||||||||||||||||||
| 3314 | Q_ASSERT(d->textureId); | - | ||||||||||||||||||
| 3315 | if (!isStorageAllocated()) {
| 0 | ||||||||||||||||||
| 3316 | qWarning("Cannot set data on a texture that does not have storage allocated.\n" | - | ||||||||||||||||||
| 3317 | "To do so call allocateStorage() before this function"); | - | ||||||||||||||||||
| 3318 | return; never executed: return; | 0 | ||||||||||||||||||
| 3319 | } | - | ||||||||||||||||||
| 3320 | d->setCompressedData(mipLevel, layer, cubeFace, dataSize, data, options); | - | ||||||||||||||||||
| 3321 | } never executed: end of block | 0 | ||||||||||||||||||
| 3322 | - | |||||||||||||||||||
| 3323 | /*! | - | ||||||||||||||||||
| 3324 | \obsolete | - | ||||||||||||||||||
| 3325 | \overload | - | ||||||||||||||||||
| 3326 | */ | - | ||||||||||||||||||
| 3327 | void QOpenGLTexture::setCompressedData(int mipLevel, int layer, int dataSize, void *data, | - | ||||||||||||||||||
| 3328 | const QOpenGLPixelTransferOptions * const options) | - | ||||||||||||||||||
| 3329 | { | - | ||||||||||||||||||
| 3330 | Q_D(QOpenGLTexture); | - | ||||||||||||||||||
| 3331 | Q_ASSERT(d->textureId); | - | ||||||||||||||||||
| 3332 | d->setCompressedData(mipLevel, layer, QOpenGLTexture::CubeMapPositiveX, dataSize, data, options); | - | ||||||||||||||||||
| 3333 | } never executed: end of block | 0 | ||||||||||||||||||
| 3334 | - | |||||||||||||||||||
| 3335 | /*! | - | ||||||||||||||||||
| 3336 | \obsolete | - | ||||||||||||||||||
| 3337 | \overload | - | ||||||||||||||||||
| 3338 | */ | - | ||||||||||||||||||
| 3339 | void QOpenGLTexture::setCompressedData(int mipLevel, int dataSize, void *data, | - | ||||||||||||||||||
| 3340 | const QOpenGLPixelTransferOptions * const options) | - | ||||||||||||||||||
| 3341 | { | - | ||||||||||||||||||
| 3342 | Q_D(QOpenGLTexture); | - | ||||||||||||||||||
| 3343 | Q_ASSERT(d->textureId); | - | ||||||||||||||||||
| 3344 | d->setCompressedData(mipLevel, 0, QOpenGLTexture::CubeMapPositiveX, dataSize, data, options); | - | ||||||||||||||||||
| 3345 | } never executed: end of block | 0 | ||||||||||||||||||
| 3346 | - | |||||||||||||||||||
| 3347 | /*! | - | ||||||||||||||||||
| 3348 | \obsolete | - | ||||||||||||||||||
| 3349 | \overload | - | ||||||||||||||||||
| 3350 | */ | - | ||||||||||||||||||
| 3351 | void QOpenGLTexture::setCompressedData(int dataSize, void *data, | - | ||||||||||||||||||
| 3352 | const QOpenGLPixelTransferOptions * const options) | - | ||||||||||||||||||
| 3353 | { | - | ||||||||||||||||||
| 3354 | Q_D(QOpenGLTexture); | - | ||||||||||||||||||
| 3355 | Q_ASSERT(d->textureId); | - | ||||||||||||||||||
| 3356 | d->setCompressedData(0, 0, QOpenGLTexture::CubeMapPositiveX, dataSize, data, options); | - | ||||||||||||||||||
| 3357 | } never executed: end of block | 0 | ||||||||||||||||||
| 3358 | #endif | - | ||||||||||||||||||
| 3359 | - | |||||||||||||||||||
| 3360 | /*! | - | ||||||||||||||||||
| 3361 | Returns \c true if your OpenGL implementation and version supports the texture | - | ||||||||||||||||||
| 3362 | feature \a feature. | - | ||||||||||||||||||
| 3363 | */ | - | ||||||||||||||||||
| 3364 | bool QOpenGLTexture::hasFeature(Feature feature) | - | ||||||||||||||||||
| 3365 | { | - | ||||||||||||||||||
| 3366 | QOpenGLContext *ctx = QOpenGLContext::currentContext(); | - | ||||||||||||||||||
| 3367 | if (!ctx) {
| 0 | ||||||||||||||||||
| 3368 | qWarning("QOpenGLTexture::hasFeature() requires a valid current context"); | - | ||||||||||||||||||
| 3369 | return false; never executed: return false; | 0 | ||||||||||||||||||
| 3370 | } | - | ||||||||||||||||||
| 3371 | - | |||||||||||||||||||
| 3372 | QSurfaceFormat f = ctx->format(); | - | ||||||||||||||||||
| 3373 | - | |||||||||||||||||||
| 3374 | bool supported = false; | - | ||||||||||||||||||
| 3375 | - | |||||||||||||||||||
| 3376 | #if !defined(QT_OPENGL_ES_2) | - | ||||||||||||||||||
| 3377 | if (!ctx->isOpenGLES()) {
| 0 | ||||||||||||||||||
| 3378 | switch (feature) { | - | ||||||||||||||||||
| 3379 | case ImmutableMultisampleStorage: never executed: case ImmutableMultisampleStorage: | 0 | ||||||||||||||||||
| 3380 | supported = f.version() >= qMakePair(4, 3)
| 0 | ||||||||||||||||||
| 3381 | || ctx->hasExtension(QByteArrayLiteral("GL_ARB_texture_storage_multisample")); never executed: return ba;
| 0 | ||||||||||||||||||
| 3382 | break; never executed: break; | 0 | ||||||||||||||||||
| 3383 | - | |||||||||||||||||||
| 3384 | case TextureBuffer: never executed: case TextureBuffer: | 0 | ||||||||||||||||||
| 3385 | supported = f.version() >= qMakePair(3, 0)
| 0 | ||||||||||||||||||
| 3386 | || ctx->hasExtension(QByteArrayLiteral("GL_ARB_texture_buffer_object")); never executed: return ba;
| 0 | ||||||||||||||||||
| 3387 | break; never executed: break; | 0 | ||||||||||||||||||
| 3388 | - | |||||||||||||||||||
| 3389 | case StencilTexturing: never executed: case StencilTexturing: | 0 | ||||||||||||||||||
| 3390 | supported = f.version() >= qMakePair(4, 3)
| 0 | ||||||||||||||||||
| 3391 | || ctx->hasExtension(QByteArrayLiteral("GL_ARB_stencil_texturing")); never executed: return ba;
| 0 | ||||||||||||||||||
| 3392 | break; never executed: break; | 0 | ||||||||||||||||||
| 3393 | - | |||||||||||||||||||
| 3394 | case ImmutableStorage: never executed: case ImmutableStorage: | 0 | ||||||||||||||||||
| 3395 | supported = f.version() >= qMakePair(4, 2)
| 0 | ||||||||||||||||||
| 3396 | || ctx->hasExtension(QByteArrayLiteral("GL_ARB_texture_storage")) never executed: return ba;
| 0 | ||||||||||||||||||
| 3397 | || ctx->hasExtension(QByteArrayLiteral("GL_EXT_texture_storage")); never executed: return ba;
| 0 | ||||||||||||||||||
| 3398 | break; never executed: break; | 0 | ||||||||||||||||||
| 3399 | - | |||||||||||||||||||
| 3400 | case TextureCubeMapArrays: never executed: case TextureCubeMapArrays: | 0 | ||||||||||||||||||
| 3401 | supported = f.version() >= qMakePair(4, 0)
| 0 | ||||||||||||||||||
| 3402 | || ctx->hasExtension(QByteArrayLiteral("ARB_texture_cube_map_array")); never executed: return ba;
| 0 | ||||||||||||||||||
| 3403 | break; never executed: break; | 0 | ||||||||||||||||||
| 3404 | - | |||||||||||||||||||
| 3405 | case Swizzle: never executed: case Swizzle: | 0 | ||||||||||||||||||
| 3406 | supported = f.version() >= qMakePair(3, 3)
| 0 | ||||||||||||||||||
| 3407 | || ctx->hasExtension(QByteArrayLiteral("GL_ARB_texture_swizzle")); never executed: return ba;
| 0 | ||||||||||||||||||
| 3408 | break; never executed: break; | 0 | ||||||||||||||||||
| 3409 | - | |||||||||||||||||||
| 3410 | case TextureMultisample: never executed: case TextureMultisample: | 0 | ||||||||||||||||||
| 3411 | supported = f.version() >= qMakePair(3, 2)
| 0 | ||||||||||||||||||
| 3412 | || ctx->hasExtension(QByteArrayLiteral("GL_ARB_texture_multisample")); never executed: return ba;
| 0 | ||||||||||||||||||
| 3413 | break; never executed: break; | 0 | ||||||||||||||||||
| 3414 | - | |||||||||||||||||||
| 3415 | case TextureArrays: never executed: case TextureArrays: | 0 | ||||||||||||||||||
| 3416 | supported = f.version() >= qMakePair(3, 0)
| 0 | ||||||||||||||||||
| 3417 | || ctx->hasExtension(QByteArrayLiteral("GL_EXT_texture_array")); never executed: return ba;
| 0 | ||||||||||||||||||
| 3418 | break; never executed: break; | 0 | ||||||||||||||||||
| 3419 | - | |||||||||||||||||||
| 3420 | case TextureRectangle: never executed: case TextureRectangle: | 0 | ||||||||||||||||||
| 3421 | supported = f.version() >= qMakePair(2, 1)
| 0 | ||||||||||||||||||
| 3422 | || ctx->hasExtension(QByteArrayLiteral("ARB_texture_rectangle")); never executed: return ba;
| 0 | ||||||||||||||||||
| 3423 | break; never executed: break; | 0 | ||||||||||||||||||
| 3424 | - | |||||||||||||||||||
| 3425 | case Texture3D: never executed: case Texture3D: | 0 | ||||||||||||||||||
| 3426 | supported = f.version() >= qMakePair(1, 3); | - | ||||||||||||||||||
| 3427 | break; never executed: break; | 0 | ||||||||||||||||||
| 3428 | - | |||||||||||||||||||
| 3429 | case AnisotropicFiltering: never executed: case AnisotropicFiltering: | 0 | ||||||||||||||||||
| 3430 | supported = ctx->hasExtension(QByteArrayLiteral("GL_EXT_texture_filter_anisotropic")); never executed: return ba; | 0 | ||||||||||||||||||
| 3431 | break; never executed: break; | 0 | ||||||||||||||||||
| 3432 | - | |||||||||||||||||||
| 3433 | case NPOTTextures: never executed: case NPOTTextures: | 0 | ||||||||||||||||||
| 3434 | case NPOTTextureRepeat: never executed: case NPOTTextureRepeat: | 0 | ||||||||||||||||||
| 3435 | supported = ctx->hasExtension(QByteArrayLiteral("GL_ARB_texture_non_power_of_two")); never executed: return ba; | 0 | ||||||||||||||||||
| 3436 | break; never executed: break; | 0 | ||||||||||||||||||
| 3437 | - | |||||||||||||||||||
| 3438 | case Texture1D: never executed: case Texture1D: | 0 | ||||||||||||||||||
| 3439 | supported = f.version() >= qMakePair(1, 1); | - | ||||||||||||||||||
| 3440 | break; never executed: break; | 0 | ||||||||||||||||||
| 3441 | - | |||||||||||||||||||
| 3442 | case TextureComparisonOperators: never executed: case TextureComparisonOperators: | 0 | ||||||||||||||||||
| 3443 | // GL 1.4 and GL_ARB_shadow alone support only LEQUAL and GEQUAL; | - | ||||||||||||||||||
| 3444 | // since we're talking about history anyhow avoid to be extra pedantic | - | ||||||||||||||||||
| 3445 | // in the feature set, and simply claim supported if we have the full set of operators | - | ||||||||||||||||||
| 3446 | // (which has been added into 1.5 / GL_EXT_shadow_funcs). | - | ||||||||||||||||||
| 3447 | supported = f.version() >= qMakePair(1, 5)
| 0 | ||||||||||||||||||
| 3448 | || (ctx->hasExtension(QByteArrayLiteral("GL_ARB_shadow")) never executed: return ba;
| 0 | ||||||||||||||||||
| 3449 | && ctx->hasExtension(QByteArrayLiteral("GL_EXT_shadow_funcs"))); never executed: return ba;
| 0 | ||||||||||||||||||
| 3450 | break; never executed: break; | 0 | ||||||||||||||||||
| 3451 | - | |||||||||||||||||||
| 3452 | case TextureMipMapLevel: never executed: case TextureMipMapLevel: | 0 | ||||||||||||||||||
| 3453 | supported = f.version() >= qMakePair(1, 2); | - | ||||||||||||||||||
| 3454 | break; never executed: break; | 0 | ||||||||||||||||||
| 3455 | - | |||||||||||||||||||
| 3456 | case MaxFeatureFlag: never executed: case MaxFeatureFlag: | 0 | ||||||||||||||||||
| 3457 | break; never executed: break; | 0 | ||||||||||||||||||
| 3458 | } | - | ||||||||||||||||||
| 3459 | } never executed: end of block | 0 | ||||||||||||||||||
| 3460 | - | |||||||||||||||||||
| 3461 | if (ctx->isOpenGLES())
| 0 | ||||||||||||||||||
| 3462 | #endif | - | ||||||||||||||||||
| 3463 | { | - | ||||||||||||||||||
| 3464 | const char *renderer = reinterpret_cast<const char *>(ctx->functions()->glGetString(GL_RENDERER)); | - | ||||||||||||||||||
| 3465 | switch (feature) { | - | ||||||||||||||||||
| 3466 | case ImmutableStorage: never executed: case ImmutableStorage: | 0 | ||||||||||||||||||
| 3467 | supported = (f.version() >= qMakePair(3, 0) || ctx->hasExtension(QByteArrayLiteral("EXT_texture_storage"))) never executed: return ba;
| 0 | ||||||||||||||||||
| 3468 | && !(renderer && strstr(renderer, "Mali")); // do not use on Mali: QTBUG-45106
| 0 | ||||||||||||||||||
| 3469 | break; never executed: break; | 0 | ||||||||||||||||||
| 3470 | - | |||||||||||||||||||
| 3471 | case ImmutableMultisampleStorage: never executed: case ImmutableMultisampleStorage: | 0 | ||||||||||||||||||
| 3472 | supported = f.version() >= qMakePair(3, 1); | - | ||||||||||||||||||
| 3473 | break; never executed: break; | 0 | ||||||||||||||||||
| 3474 | - | |||||||||||||||||||
| 3475 | case TextureRectangle: never executed: case TextureRectangle: | 0 | ||||||||||||||||||
| 3476 | break; never executed: break; | 0 | ||||||||||||||||||
| 3477 | - | |||||||||||||||||||
| 3478 | case TextureArrays: never executed: case TextureArrays: | 0 | ||||||||||||||||||
| 3479 | supported = f.version() >= qMakePair(3, 0); | - | ||||||||||||||||||
| 3480 | break; never executed: break; | 0 | ||||||||||||||||||
| 3481 | - | |||||||||||||||||||
| 3482 | case Texture3D: never executed: case Texture3D: | 0 | ||||||||||||||||||
| 3483 | supported = f.version() >= qMakePair(3, 0)
| 0 | ||||||||||||||||||
| 3484 | || ctx->hasExtension(QByteArrayLiteral("GL_OES_texture_3D")); never executed: return ba;
| 0 | ||||||||||||||||||
| 3485 | break; never executed: break; | 0 | ||||||||||||||||||
| 3486 | - | |||||||||||||||||||
| 3487 | case TextureMultisample: never executed: case TextureMultisample: | 0 | ||||||||||||||||||
| 3488 | supported = f.version() >= qMakePair(3, 1); | - | ||||||||||||||||||
| 3489 | break; never executed: break; | 0 | ||||||||||||||||||
| 3490 | - | |||||||||||||||||||
| 3491 | case TextureBuffer: never executed: case TextureBuffer: | 0 | ||||||||||||||||||
| 3492 | break; never executed: break; | 0 | ||||||||||||||||||
| 3493 | - | |||||||||||||||||||
| 3494 | case TextureCubeMapArrays: never executed: case TextureCubeMapArrays: | 0 | ||||||||||||||||||
| 3495 | break; never executed: break; | 0 | ||||||||||||||||||
| 3496 | - | |||||||||||||||||||
| 3497 | case Swizzle: never executed: case Swizzle: | 0 | ||||||||||||||||||
| 3498 | supported = f.version() >= qMakePair(3, 0); | - | ||||||||||||||||||
| 3499 | break; never executed: break; | 0 | ||||||||||||||||||
| 3500 | - | |||||||||||||||||||
| 3501 | case StencilTexturing: never executed: case StencilTexturing: | 0 | ||||||||||||||||||
| 3502 | break; never executed: break; | 0 | ||||||||||||||||||
| 3503 | - | |||||||||||||||||||
| 3504 | case AnisotropicFiltering: never executed: case AnisotropicFiltering: | 0 | ||||||||||||||||||
| 3505 | supported = ctx->hasExtension(QByteArrayLiteral("GL_EXT_texture_filter_anisotropic")); never executed: return ba; | 0 | ||||||||||||||||||
| 3506 | break; never executed: break; | 0 | ||||||||||||||||||
| 3507 | - | |||||||||||||||||||
| 3508 | case NPOTTextures: never executed: case NPOTTextures: | 0 | ||||||||||||||||||
| 3509 | case NPOTTextureRepeat: never executed: case NPOTTextureRepeat: | 0 | ||||||||||||||||||
| 3510 | supported = f.version() >= qMakePair(3,0)
| 0 | ||||||||||||||||||
| 3511 | || ctx->hasExtension(QByteArrayLiteral("GL_OES_texture_npot")) never executed: return ba;
| 0 | ||||||||||||||||||
| 3512 | || ctx->hasExtension(QByteArrayLiteral("GL_ARB_texture_non_power_of_two")); never executed: return ba;
| 0 | ||||||||||||||||||
| 3513 | break; never executed: break; | 0 | ||||||||||||||||||
| 3514 | - | |||||||||||||||||||
| 3515 | case Texture1D: never executed: case Texture1D: | 0 | ||||||||||||||||||
| 3516 | break; never executed: break; | 0 | ||||||||||||||||||
| 3517 | - | |||||||||||||||||||
| 3518 | case TextureComparisonOperators: never executed: case TextureComparisonOperators: | 0 | ||||||||||||||||||
| 3519 | supported = f.version() >= qMakePair(3, 0)
| 0 | ||||||||||||||||||
| 3520 | || ctx->hasExtension(QByteArrayLiteral("GL_EXT_shadow_samplers")); never executed: return ba;
| 0 | ||||||||||||||||||
| 3521 | break; never executed: break; | 0 | ||||||||||||||||||
| 3522 | - | |||||||||||||||||||
| 3523 | case TextureMipMapLevel: never executed: case TextureMipMapLevel: | 0 | ||||||||||||||||||
| 3524 | supported = f.version() >= qMakePair(3, 0); | - | ||||||||||||||||||
| 3525 | break; never executed: break; | 0 | ||||||||||||||||||
| 3526 | - | |||||||||||||||||||
| 3527 | case MaxFeatureFlag: never executed: case MaxFeatureFlag: | 0 | ||||||||||||||||||
| 3528 | break; never executed: break; | 0 | ||||||||||||||||||
| 3529 | } | - | ||||||||||||||||||
| 3530 | } never executed: end of block | 0 | ||||||||||||||||||
| 3531 | - | |||||||||||||||||||
| 3532 | return supported; never executed: return supported; | 0 | ||||||||||||||||||
| 3533 | } | - | ||||||||||||||||||
| 3534 | - | |||||||||||||||||||
| 3535 | /*! | - | ||||||||||||||||||
| 3536 | Sets the base mipmap level used for all texture lookups with this texture to \a baseLevel. | - | ||||||||||||||||||
| 3537 | - | |||||||||||||||||||
| 3538 | \note This function has no effect on Qt built for OpenGL ES 2. | - | ||||||||||||||||||
| 3539 | \sa mipBaseLevel(), setMipMaxLevel(), setMipLevelRange() | - | ||||||||||||||||||
| 3540 | */ | - | ||||||||||||||||||
| 3541 | void QOpenGLTexture::setMipBaseLevel(int baseLevel) | - | ||||||||||||||||||
| 3542 | { | - | ||||||||||||||||||
| 3543 | Q_D(QOpenGLTexture); | - | ||||||||||||||||||
| 3544 | d->create(); | - | ||||||||||||||||||
| 3545 | if (!d->features.testFlag(TextureMipMapLevel)) {
| 0 | ||||||||||||||||||
| 3546 | qWarning("QOpenGLTexture::setMipBaseLevel: requires OpenGL >= 1.2 or OpenGL ES >= 3.0"); | - | ||||||||||||||||||
| 3547 | return; never executed: return; | 0 | ||||||||||||||||||
| 3548 | } | - | ||||||||||||||||||
| 3549 | Q_ASSERT(d->textureId); | - | ||||||||||||||||||
| 3550 | Q_ASSERT(d->texFuncs); | - | ||||||||||||||||||
| 3551 | Q_ASSERT(baseLevel <= d->maxLevel); | - | ||||||||||||||||||
| 3552 | d->baseLevel = baseLevel; | - | ||||||||||||||||||
| 3553 | d->texFuncs->glTextureParameteri(d->textureId, d->target, d->bindingTarget, GL_TEXTURE_BASE_LEVEL, baseLevel); | - | ||||||||||||||||||
| 3554 | } never executed: end of block | 0 | ||||||||||||||||||
| 3555 | - | |||||||||||||||||||
| 3556 | /*! | - | ||||||||||||||||||
| 3557 | Returns the mipmap base level used for all texture lookups with this texture. | - | ||||||||||||||||||
| 3558 | The default is 0. | - | ||||||||||||||||||
| 3559 | - | |||||||||||||||||||
| 3560 | \sa setMipBaseLevel(), mipMaxLevel(), mipLevelRange() | - | ||||||||||||||||||
| 3561 | */ | - | ||||||||||||||||||
| 3562 | int QOpenGLTexture::mipBaseLevel() const | - | ||||||||||||||||||
| 3563 | { | - | ||||||||||||||||||
| 3564 | Q_D(const QOpenGLTexture); | - | ||||||||||||||||||
| 3565 | return d->baseLevel; never executed: return d->baseLevel; | 0 | ||||||||||||||||||
| 3566 | } | - | ||||||||||||||||||
| 3567 | - | |||||||||||||||||||
| 3568 | /*! | - | ||||||||||||||||||
| 3569 | Sets the maximum mipmap level used for all texture lookups with this texture to \a maxLevel. | - | ||||||||||||||||||
| 3570 | - | |||||||||||||||||||
| 3571 | \note This function has no effect on Qt built for OpenGL ES 2. | - | ||||||||||||||||||
| 3572 | \sa mipMaxLevel(), setMipBaseLevel(), setMipLevelRange() | - | ||||||||||||||||||
| 3573 | */ | - | ||||||||||||||||||
| 3574 | void QOpenGLTexture::setMipMaxLevel(int maxLevel) | - | ||||||||||||||||||
| 3575 | { | - | ||||||||||||||||||
| 3576 | Q_D(QOpenGLTexture); | - | ||||||||||||||||||
| 3577 | d->create(); | - | ||||||||||||||||||
| 3578 | if (!d->features.testFlag(TextureMipMapLevel)) {
| 0 | ||||||||||||||||||
| 3579 | qWarning("QOpenGLTexture::setMipMaxLevel: requires OpenGL >= 1.2 or OpenGL ES >= 3.0"); | - | ||||||||||||||||||
| 3580 | return; never executed: return; | 0 | ||||||||||||||||||
| 3581 | } | - | ||||||||||||||||||
| 3582 | Q_ASSERT(d->textureId); | - | ||||||||||||||||||
| 3583 | Q_ASSERT(d->texFuncs); | - | ||||||||||||||||||
| 3584 | Q_ASSERT(d->baseLevel <= maxLevel); | - | ||||||||||||||||||
| 3585 | d->maxLevel = maxLevel; | - | ||||||||||||||||||
| 3586 | d->texFuncs->glTextureParameteri(d->textureId, d->target, d->bindingTarget, GL_TEXTURE_MAX_LEVEL, maxLevel); | - | ||||||||||||||||||
| 3587 | } never executed: end of block | 0 | ||||||||||||||||||
| 3588 | - | |||||||||||||||||||
| 3589 | /*! | - | ||||||||||||||||||
| 3590 | Returns the mipmap maximum level used for all texture lookups with this texture. | - | ||||||||||||||||||
| 3591 | - | |||||||||||||||||||
| 3592 | \sa setMipMaxLevel(), mipBaseLevel(), mipLevelRange() | - | ||||||||||||||||||
| 3593 | */ | - | ||||||||||||||||||
| 3594 | int QOpenGLTexture::mipMaxLevel() const | - | ||||||||||||||||||
| 3595 | { | - | ||||||||||||||||||
| 3596 | Q_D(const QOpenGLTexture); | - | ||||||||||||||||||
| 3597 | return d->maxLevel; never executed: return d->maxLevel; | 0 | ||||||||||||||||||
| 3598 | } | - | ||||||||||||||||||
| 3599 | - | |||||||||||||||||||
| 3600 | /*! | - | ||||||||||||||||||
| 3601 | Sets the range of mipmap levels that can be used for texture lookups with this texture | - | ||||||||||||||||||
| 3602 | to range from \a baseLevel to \a maxLevel. | - | ||||||||||||||||||
| 3603 | - | |||||||||||||||||||
| 3604 | \note This function has no effect on Qt built for OpenGL ES 2. | - | ||||||||||||||||||
| 3605 | \sa setMipBaseLevel(), setMipMaxLevel(), mipLevelRange() | - | ||||||||||||||||||
| 3606 | */ | - | ||||||||||||||||||
| 3607 | void QOpenGLTexture::setMipLevelRange(int baseLevel, int maxLevel) | - | ||||||||||||||||||
| 3608 | { | - | ||||||||||||||||||
| 3609 | Q_D(QOpenGLTexture); | - | ||||||||||||||||||
| 3610 | d->create(); | - | ||||||||||||||||||
| 3611 | if (!d->features.testFlag(TextureMipMapLevel)) {
| 0 | ||||||||||||||||||
| 3612 | qWarning("QOpenGLTexture::setMipLevelRange: requires OpenGL >= 1.2 or OpenGL ES >= 3.0"); | - | ||||||||||||||||||
| 3613 | return; never executed: return; | 0 | ||||||||||||||||||
| 3614 | } | - | ||||||||||||||||||
| 3615 | Q_ASSERT(d->textureId); | - | ||||||||||||||||||
| 3616 | Q_ASSERT(d->texFuncs); | - | ||||||||||||||||||
| 3617 | Q_ASSERT(baseLevel <= maxLevel); | - | ||||||||||||||||||
| 3618 | d->texFuncs->glTextureParameteri(d->textureId, d->target, d->bindingTarget, GL_TEXTURE_BASE_LEVEL, baseLevel); | - | ||||||||||||||||||
| 3619 | d->texFuncs->glTextureParameteri(d->textureId, d->target, d->bindingTarget, GL_TEXTURE_MAX_LEVEL, maxLevel); | - | ||||||||||||||||||
| 3620 | } never executed: end of block | 0 | ||||||||||||||||||
| 3621 | - | |||||||||||||||||||
| 3622 | /*! | - | ||||||||||||||||||
| 3623 | Returns the range of mipmap levels that can be used for texture lookups with this texture. | - | ||||||||||||||||||
| 3624 | - | |||||||||||||||||||
| 3625 | \sa mipBaseLevel(), mipMaxLevel() | - | ||||||||||||||||||
| 3626 | */ | - | ||||||||||||||||||
| 3627 | QPair<int, int> QOpenGLTexture::mipLevelRange() const | - | ||||||||||||||||||
| 3628 | { | - | ||||||||||||||||||
| 3629 | Q_D(const QOpenGLTexture); | - | ||||||||||||||||||
| 3630 | return qMakePair(d->baseLevel, d->maxLevel); never executed: return qMakePair(d->baseLevel, d->maxLevel); | 0 | ||||||||||||||||||
| 3631 | } | - | ||||||||||||||||||
| 3632 | - | |||||||||||||||||||
| 3633 | /*! | - | ||||||||||||||||||
| 3634 | If \a enabled is \c true, enables automatic mipmap generation for this texture object | - | ||||||||||||||||||
| 3635 | to occur whenever the level 0 mipmap data is set via setData(). | - | ||||||||||||||||||
| 3636 | - | |||||||||||||||||||
| 3637 | The automatic mipmap generation is enabled by default. | - | ||||||||||||||||||
| 3638 | - | |||||||||||||||||||
| 3639 | \note Mipmap generation is not supported for compressed textures with OpenGL ES 2.0. | - | ||||||||||||||||||
| 3640 | - | |||||||||||||||||||
| 3641 | \sa isAutoMipMapGenerationEnabled(), generateMipMaps() | - | ||||||||||||||||||
| 3642 | */ | - | ||||||||||||||||||
| 3643 | void QOpenGLTexture::setAutoMipMapGenerationEnabled(bool enabled) | - | ||||||||||||||||||
| 3644 | { | - | ||||||||||||||||||
| 3645 | Q_D(QOpenGLTexture); | - | ||||||||||||||||||
| 3646 | d->autoGenerateMipMaps = enabled; | - | ||||||||||||||||||
| 3647 | } never executed: end of block | 0 | ||||||||||||||||||
| 3648 | - | |||||||||||||||||||
| 3649 | /*! | - | ||||||||||||||||||
| 3650 | Returns whether auto mipmap generation is enabled for this texture object. | - | ||||||||||||||||||
| 3651 | - | |||||||||||||||||||
| 3652 | \sa setAutoMipMapGenerationEnabled(), generateMipMaps() | - | ||||||||||||||||||
| 3653 | */ | - | ||||||||||||||||||
| 3654 | bool QOpenGLTexture::isAutoMipMapGenerationEnabled() const | - | ||||||||||||||||||
| 3655 | { | - | ||||||||||||||||||
| 3656 | Q_D(const QOpenGLTexture); | - | ||||||||||||||||||
| 3657 | return d->autoGenerateMipMaps; never executed: return d->autoGenerateMipMaps; | 0 | ||||||||||||||||||
| 3658 | } | - | ||||||||||||||||||
| 3659 | - | |||||||||||||||||||
| 3660 | /*! | - | ||||||||||||||||||
| 3661 | Generates mipmaps for this texture object from mipmap level 0. If you are | - | ||||||||||||||||||
| 3662 | using a texture target and filtering option that requires mipmaps and you | - | ||||||||||||||||||
| 3663 | have disabled automatic mipmap generation then you need to call this function | - | ||||||||||||||||||
| 3664 | or the overload to create the mipmap chain. | - | ||||||||||||||||||
| 3665 | - | |||||||||||||||||||
| 3666 | \note Mipmap generation is not supported for compressed textures with OpenGL | - | ||||||||||||||||||
| 3667 | ES 2.0. | - | ||||||||||||||||||
| 3668 | - | |||||||||||||||||||
| 3669 | \sa setAutoMipMapGenerationEnabled(), setMipLevels(), mipLevels() | - | ||||||||||||||||||
| 3670 | */ | - | ||||||||||||||||||
| 3671 | void QOpenGLTexture::generateMipMaps() | - | ||||||||||||||||||
| 3672 | { | - | ||||||||||||||||||
| 3673 | Q_D(QOpenGLTexture); | - | ||||||||||||||||||
| 3674 | Q_ASSERT(d->texFuncs); | - | ||||||||||||||||||
| 3675 | Q_ASSERT(d->textureId); | - | ||||||||||||||||||
| 3676 | if (isCompressedFormat(d->format)) {
| 0 | ||||||||||||||||||
| 3677 | if (QOpenGLContext *ctx = QOpenGLContext::currentContext())
| 0 | ||||||||||||||||||
| 3678 | if (ctx->isOpenGLES() && ctx->format().majorVersion() < 3)
| 0 | ||||||||||||||||||
| 3679 | return; never executed: return; | 0 | ||||||||||||||||||
| 3680 | } never executed: end of block | 0 | ||||||||||||||||||
| 3681 | d->texFuncs->glGenerateTextureMipmap(d->textureId, d->target, d->bindingTarget); | - | ||||||||||||||||||
| 3682 | } never executed: end of block | 0 | ||||||||||||||||||
| 3683 | - | |||||||||||||||||||
| 3684 | /*! | - | ||||||||||||||||||
| 3685 | Generates mipmaps for this texture object from mipmap level \a baseLevel. If you are | - | ||||||||||||||||||
| 3686 | using a texture target and filtering option that requires mipmaps and you | - | ||||||||||||||||||
| 3687 | have disabled automatic mipmap generation then you need to call this function | - | ||||||||||||||||||
| 3688 | or the overload to create the mipmap chain. | - | ||||||||||||||||||
| 3689 | - | |||||||||||||||||||
| 3690 | The generation of mipmaps to above \a baseLevel is achieved by setting the mipmap | - | ||||||||||||||||||
| 3691 | base level to \a baseLevel and then generating the mipmap chain. If \a resetBaseLevel | - | ||||||||||||||||||
| 3692 | is \c true, then the baseLevel of the texture will be reset to its previous value. | - | ||||||||||||||||||
| 3693 | - | |||||||||||||||||||
| 3694 | \sa setAutoMipMapGenerationEnabled(), setMipLevels(), mipLevels() | - | ||||||||||||||||||
| 3695 | */ | - | ||||||||||||||||||
| 3696 | void QOpenGLTexture::generateMipMaps(int baseLevel, bool resetBaseLevel) | - | ||||||||||||||||||
| 3697 | { | - | ||||||||||||||||||
| 3698 | Q_D(QOpenGLTexture); | - | ||||||||||||||||||
| 3699 | Q_ASSERT(d->texFuncs); | - | ||||||||||||||||||
| 3700 | Q_ASSERT(d->textureId); | - | ||||||||||||||||||
| 3701 | if (isCompressedFormat(d->format)) {
| 0 | ||||||||||||||||||
| 3702 | if (QOpenGLContext *ctx = QOpenGLContext::currentContext())
| 0 | ||||||||||||||||||
| 3703 | if (ctx->isOpenGLES() && ctx->format().majorVersion() < 3)
| 0 | ||||||||||||||||||
| 3704 | return; never executed: return; | 0 | ||||||||||||||||||
| 3705 | } never executed: end of block | 0 | ||||||||||||||||||
| 3706 | int oldBaseLevel; | - | ||||||||||||||||||
| 3707 | if (resetBaseLevel)
| 0 | ||||||||||||||||||
| 3708 | oldBaseLevel = mipBaseLevel(); never executed: oldBaseLevel = mipBaseLevel(); | 0 | ||||||||||||||||||
| 3709 | setMipBaseLevel(baseLevel); | - | ||||||||||||||||||
| 3710 | d->texFuncs->glGenerateTextureMipmap(d->textureId, d->target, d->bindingTarget); | - | ||||||||||||||||||
| 3711 | if (resetBaseLevel)
| 0 | ||||||||||||||||||
| 3712 | setMipBaseLevel(oldBaseLevel); never executed: setMipBaseLevel(oldBaseLevel); | 0 | ||||||||||||||||||
| 3713 | } never executed: end of block | 0 | ||||||||||||||||||
| 3714 | - | |||||||||||||||||||
| 3715 | /*! | - | ||||||||||||||||||
| 3716 | GLSL shaders are able to reorder the components of the vec4 returned by texture | - | ||||||||||||||||||
| 3717 | functions. It is also desirable to be able to control this reordering from CPU | - | ||||||||||||||||||
| 3718 | side code. This is made possible by swizzle masks since OpenGL 3.3. | - | ||||||||||||||||||
| 3719 | - | |||||||||||||||||||
| 3720 | Each component of the texture can be mapped to one of the SwizzleValue options. | - | ||||||||||||||||||
| 3721 | - | |||||||||||||||||||
| 3722 | This function maps \a component to the output \a value. | - | ||||||||||||||||||
| 3723 | - | |||||||||||||||||||
| 3724 | \note This function has no effect on Mac and Qt built for OpenGL ES 2. | - | ||||||||||||||||||
| 3725 | \sa swizzleMask() | - | ||||||||||||||||||
| 3726 | */ | - | ||||||||||||||||||
| 3727 | void QOpenGLTexture::setSwizzleMask(SwizzleComponent component, SwizzleValue value) | - | ||||||||||||||||||
| 3728 | { | - | ||||||||||||||||||
| 3729 | #if !defined(Q_OS_MAC) && !defined(QT_OPENGL_ES_2) | - | ||||||||||||||||||
| 3730 | if (!QOpenGLContext::currentContext()->isOpenGLES()) {
| 0 | ||||||||||||||||||
| 3731 | Q_D(QOpenGLTexture); | - | ||||||||||||||||||
| 3732 | d->create(); | - | ||||||||||||||||||
| 3733 | Q_ASSERT(d->texFuncs); | - | ||||||||||||||||||
| 3734 | Q_ASSERT(d->textureId); | - | ||||||||||||||||||
| 3735 | if (!d->features.testFlag(Swizzle)) {
| 0 | ||||||||||||||||||
| 3736 | qWarning("QOpenGLTexture::setSwizzleMask() requires OpenGL >= 3.3"); | - | ||||||||||||||||||
| 3737 | return; never executed: return; | 0 | ||||||||||||||||||
| 3738 | } | - | ||||||||||||||||||
| 3739 | d->swizzleMask[component - SwizzleRed] = value; | - | ||||||||||||||||||
| 3740 | d->texFuncs->glTextureParameteri(d->textureId, d->target, d->bindingTarget, component, value); | - | ||||||||||||||||||
| 3741 | return; never executed: return; | 0 | ||||||||||||||||||
| 3742 | } | - | ||||||||||||||||||
| 3743 | #else | - | ||||||||||||||||||
| 3744 | Q_UNUSED(component); | - | ||||||||||||||||||
| 3745 | Q_UNUSED(value); | - | ||||||||||||||||||
| 3746 | #endif | - | ||||||||||||||||||
| 3747 | qWarning("QOpenGLTexture: Texture swizzling is not supported"); | - | ||||||||||||||||||
| 3748 | } never executed: end of block | 0 | ||||||||||||||||||
| 3749 | - | |||||||||||||||||||
| 3750 | /*! | - | ||||||||||||||||||
| 3751 | Parameters \a {r}, \a {g}, \a {b}, and \a {a} are values used for setting | - | ||||||||||||||||||
| 3752 | the colors red, green, blue, and the alpha value. | - | ||||||||||||||||||
| 3753 | \overload | - | ||||||||||||||||||
| 3754 | */ | - | ||||||||||||||||||
| 3755 | void QOpenGLTexture::setSwizzleMask(SwizzleValue r, SwizzleValue g, | - | ||||||||||||||||||
| 3756 | SwizzleValue b, SwizzleValue a) | - | ||||||||||||||||||
| 3757 | { | - | ||||||||||||||||||
| 3758 | #if !defined(Q_OS_MAC) && !defined(QT_OPENGL_ES_2) | - | ||||||||||||||||||
| 3759 | if (!QOpenGLContext::currentContext()->isOpenGLES()) {
| 0 | ||||||||||||||||||
| 3760 | Q_D(QOpenGLTexture); | - | ||||||||||||||||||
| 3761 | d->create(); | - | ||||||||||||||||||
| 3762 | Q_ASSERT(d->texFuncs); | - | ||||||||||||||||||
| 3763 | Q_ASSERT(d->textureId); | - | ||||||||||||||||||
| 3764 | if (!d->features.testFlag(Swizzle)) {
| 0 | ||||||||||||||||||
| 3765 | qWarning("QOpenGLTexture::setSwizzleMask() requires OpenGL >= 3.3"); | - | ||||||||||||||||||
| 3766 | return; never executed: return; | 0 | ||||||||||||||||||
| 3767 | } | - | ||||||||||||||||||
| 3768 | GLint swizzleMask[] = {GLint(r), GLint(g), GLint(b), GLint(a)}; | - | ||||||||||||||||||
| 3769 | d->swizzleMask[0] = r; | - | ||||||||||||||||||
| 3770 | d->swizzleMask[1] = g; | - | ||||||||||||||||||
| 3771 | d->swizzleMask[2] = b; | - | ||||||||||||||||||
| 3772 | d->swizzleMask[3] = a; | - | ||||||||||||||||||
| 3773 | d->texFuncs->glTextureParameteriv(d->textureId, d->target, d->bindingTarget, GL_TEXTURE_SWIZZLE_RGBA, swizzleMask); | - | ||||||||||||||||||
| 3774 | return; never executed: return; | 0 | ||||||||||||||||||
| 3775 | } | - | ||||||||||||||||||
| 3776 | #else | - | ||||||||||||||||||
| 3777 | Q_UNUSED(r); | - | ||||||||||||||||||
| 3778 | Q_UNUSED(g); | - | ||||||||||||||||||
| 3779 | Q_UNUSED(b); | - | ||||||||||||||||||
| 3780 | Q_UNUSED(a); | - | ||||||||||||||||||
| 3781 | #endif | - | ||||||||||||||||||
| 3782 | qWarning("QOpenGLTexture: Texture swizzling is not supported"); | - | ||||||||||||||||||
| 3783 | } never executed: end of block | 0 | ||||||||||||||||||
| 3784 | - | |||||||||||||||||||
| 3785 | /*! | - | ||||||||||||||||||
| 3786 | Returns the swizzle mask for texture \a component. | - | ||||||||||||||||||
| 3787 | */ | - | ||||||||||||||||||
| 3788 | QOpenGLTexture::SwizzleValue QOpenGLTexture::swizzleMask(SwizzleComponent component) const | - | ||||||||||||||||||
| 3789 | { | - | ||||||||||||||||||
| 3790 | Q_D(const QOpenGLTexture); | - | ||||||||||||||||||
| 3791 | return d->swizzleMask[component - SwizzleRed]; never executed: return d->swizzleMask[component - SwizzleRed]; | 0 | ||||||||||||||||||
| 3792 | } | - | ||||||||||||||||||
| 3793 | - | |||||||||||||||||||
| 3794 | /*! | - | ||||||||||||||||||
| 3795 | \enum QOpenGLTexture::DepthStencilMode | - | ||||||||||||||||||
| 3796 | \since 5.4 | - | ||||||||||||||||||
| 3797 | This enum specifies which component of a depth/stencil texture is | - | ||||||||||||||||||
| 3798 | accessed when the texture is sampled. | - | ||||||||||||||||||
| 3799 | - | |||||||||||||||||||
| 3800 | \value DepthMode Equivalent to GL_DEPTH_COMPONENT. | - | ||||||||||||||||||
| 3801 | \value StencilMode Equivalent to GL_STENCIL_INDEX. | - | ||||||||||||||||||
| 3802 | */ | - | ||||||||||||||||||
| 3803 | - | |||||||||||||||||||
| 3804 | /*! | - | ||||||||||||||||||
| 3805 | If using a texture that has a combined depth/stencil format this function sets | - | ||||||||||||||||||
| 3806 | which component of the texture is accessed to \a mode. | - | ||||||||||||||||||
| 3807 | - | |||||||||||||||||||
| 3808 | When the parameter is set to DepthMode, then accessing it from the | - | ||||||||||||||||||
| 3809 | shader will access the depth component as a single float, as normal. But when | - | ||||||||||||||||||
| 3810 | the parameter is set to StencilMode, the shader will access the stencil component. | - | ||||||||||||||||||
| 3811 | - | |||||||||||||||||||
| 3812 | \note This function has no effect on Mac and Qt built for OpenGL ES 2. | - | ||||||||||||||||||
| 3813 | \since 5.4 | - | ||||||||||||||||||
| 3814 | \sa depthStencilMode() | - | ||||||||||||||||||
| 3815 | */ | - | ||||||||||||||||||
| 3816 | void QOpenGLTexture::setDepthStencilMode(QOpenGLTexture::DepthStencilMode mode) | - | ||||||||||||||||||
| 3817 | { | - | ||||||||||||||||||
| 3818 | #if !defined(Q_OS_MAC) && !defined(QT_OPENGL_ES_2) | - | ||||||||||||||||||
| 3819 | if (!QOpenGLContext::currentContext()->isOpenGLES()) {
| 0 | ||||||||||||||||||
| 3820 | Q_D(QOpenGLTexture); | - | ||||||||||||||||||
| 3821 | d->create(); | - | ||||||||||||||||||
| 3822 | Q_ASSERT(d->texFuncs); | - | ||||||||||||||||||
| 3823 | Q_ASSERT(d->textureId); | - | ||||||||||||||||||
| 3824 | if (!d->features.testFlag(StencilTexturing)) {
| 0 | ||||||||||||||||||
| 3825 | qWarning("QOpenGLTexture::setDepthStencilMode() requires OpenGL >= 4.3 or GL_ARB_stencil_texturing"); | - | ||||||||||||||||||
| 3826 | return; never executed: return; | 0 | ||||||||||||||||||
| 3827 | } | - | ||||||||||||||||||
| 3828 | d->depthStencilMode = mode; | - | ||||||||||||||||||
| 3829 | d->texFuncs->glTextureParameteri(d->textureId, d->target, d->bindingTarget, GL_DEPTH_STENCIL_TEXTURE_MODE, mode); | - | ||||||||||||||||||
| 3830 | return; never executed: return; | 0 | ||||||||||||||||||
| 3831 | } | - | ||||||||||||||||||
| 3832 | #else | - | ||||||||||||||||||
| 3833 | Q_UNUSED(mode); | - | ||||||||||||||||||
| 3834 | #endif | - | ||||||||||||||||||
| 3835 | qWarning("QOpenGLTexture: DepthStencil Mode is not supported"); | - | ||||||||||||||||||
| 3836 | } never executed: end of block | 0 | ||||||||||||||||||
| 3837 | - | |||||||||||||||||||
| 3838 | /*! | - | ||||||||||||||||||
| 3839 | Returns the depth stencil mode for textures using a combined depth/stencil format. | - | ||||||||||||||||||
| 3840 | - | |||||||||||||||||||
| 3841 | \since 5.4 | - | ||||||||||||||||||
| 3842 | \sa setDepthStencilMode() | - | ||||||||||||||||||
| 3843 | */ | - | ||||||||||||||||||
| 3844 | QOpenGLTexture::DepthStencilMode QOpenGLTexture::depthStencilMode() const | - | ||||||||||||||||||
| 3845 | { | - | ||||||||||||||||||
| 3846 | Q_D(const QOpenGLTexture); | - | ||||||||||||||||||
| 3847 | return d->depthStencilMode; never executed: return d->depthStencilMode; | 0 | ||||||||||||||||||
| 3848 | } | - | ||||||||||||||||||
| 3849 | - | |||||||||||||||||||
| 3850 | /*! | - | ||||||||||||||||||
| 3851 | \enum QOpenGLTexture::ComparisonFunction | - | ||||||||||||||||||
| 3852 | \since 5.5 | - | ||||||||||||||||||
| 3853 | This enum specifies which comparison operator is used when texture comparison | - | ||||||||||||||||||
| 3854 | is enabled on this texture. | - | ||||||||||||||||||
| 3855 | - | |||||||||||||||||||
| 3856 | \value CompareLessEqual Equivalent to GL_LEQUAL. | - | ||||||||||||||||||
| 3857 | \value CompareGreaterEqual Equivalent to GL_GEQUAL. | - | ||||||||||||||||||
| 3858 | \value CompareLess Equivalent to GL_LESS. | - | ||||||||||||||||||
| 3859 | \value CompareGreater Equivalent to GL_GREATER. | - | ||||||||||||||||||
| 3860 | \value CompareEqual Equivalent to GL_EQUAL. | - | ||||||||||||||||||
| 3861 | \value CommpareNotEqual Equivalent to GL_NOTEQUAL. | - | ||||||||||||||||||
| 3862 | \value CompareAlways Equivalent to GL_ALWAYS. | - | ||||||||||||||||||
| 3863 | \value CompareNever Equivalent to GL_NEVER. | - | ||||||||||||||||||
| 3864 | - | |||||||||||||||||||
| 3865 | */ | - | ||||||||||||||||||
| 3866 | - | |||||||||||||||||||
| 3867 | /* | - | ||||||||||||||||||
| 3868 | \since 5.5 | - | ||||||||||||||||||
| 3869 | - | |||||||||||||||||||
| 3870 | Sets the texture comparison function on this texture to \a function. The texture | - | ||||||||||||||||||
| 3871 | comparison function is used by shadow samplers when sampling a depth texture. | - | ||||||||||||||||||
| 3872 | - | |||||||||||||||||||
| 3873 | \sa comparisonFunction() | - | ||||||||||||||||||
| 3874 | */ | - | ||||||||||||||||||
| 3875 | void QOpenGLTexture::setComparisonFunction(QOpenGLTexture::ComparisonFunction function) | - | ||||||||||||||||||
| 3876 | { | - | ||||||||||||||||||
| 3877 | Q_D(QOpenGLTexture); | - | ||||||||||||||||||
| 3878 | d->create(); | - | ||||||||||||||||||
| 3879 | if (!d->features.testFlag(TextureComparisonOperators)) {
| 0 | ||||||||||||||||||
| 3880 | qWarning("QOpenGLTexture::setComparisonFunction: requires OpenGL >= 1.5 or OpenGL ES >= 3.0"); | - | ||||||||||||||||||
| 3881 | return; never executed: return; | 0 | ||||||||||||||||||
| 3882 | } | - | ||||||||||||||||||
| 3883 | d->comparisonFunction = function; | - | ||||||||||||||||||
| 3884 | d->texFuncs->glTextureParameteri(d->textureId, d->target, d->bindingTarget, GL_TEXTURE_COMPARE_FUNC, function); | - | ||||||||||||||||||
| 3885 | } never executed: end of block | 0 | ||||||||||||||||||
| 3886 | - | |||||||||||||||||||
| 3887 | /*! | - | ||||||||||||||||||
| 3888 | \since 5.5 | - | ||||||||||||||||||
| 3889 | - | |||||||||||||||||||
| 3890 | Returns the texture comparison operator set on this texture. By default, a | - | ||||||||||||||||||
| 3891 | texture has a CompareLessEqual comparison function. | - | ||||||||||||||||||
| 3892 | - | |||||||||||||||||||
| 3893 | \sa setComparisonFunction() | - | ||||||||||||||||||
| 3894 | */ | - | ||||||||||||||||||
| 3895 | QOpenGLTexture::ComparisonFunction QOpenGLTexture::comparisonFunction() const | - | ||||||||||||||||||
| 3896 | { | - | ||||||||||||||||||
| 3897 | Q_D(const QOpenGLTexture); | - | ||||||||||||||||||
| 3898 | return d->comparisonFunction; never executed: return d->comparisonFunction; | 0 | ||||||||||||||||||
| 3899 | } | - | ||||||||||||||||||
| 3900 | - | |||||||||||||||||||
| 3901 | /*! | - | ||||||||||||||||||
| 3902 | \enum QOpenGLTexture::ComparisonMode | - | ||||||||||||||||||
| 3903 | \since 5.5 | - | ||||||||||||||||||
| 3904 | This enum specifies which comparison mode is used when sampling this texture. | - | ||||||||||||||||||
| 3905 | - | |||||||||||||||||||
| 3906 | \value CompareRefToTexture Equivalent to GL_COMPARE_REF_TO_TEXTURE. | - | ||||||||||||||||||
| 3907 | \value CompareNone Equivalent to GL_NONE. | - | ||||||||||||||||||
| 3908 | */ | - | ||||||||||||||||||
| 3909 | - | |||||||||||||||||||
| 3910 | /*! | - | ||||||||||||||||||
| 3911 | \since 5.5 | - | ||||||||||||||||||
| 3912 | - | |||||||||||||||||||
| 3913 | Sets the texture comparison mode on this texture to \a mode. The texture | - | ||||||||||||||||||
| 3914 | comparison mode is used by shadow samplers when sampling a depth texture. | - | ||||||||||||||||||
| 3915 | - | |||||||||||||||||||
| 3916 | \sa comparisonMode() | - | ||||||||||||||||||
| 3917 | */ | - | ||||||||||||||||||
| 3918 | void QOpenGLTexture::setComparisonMode(QOpenGLTexture::ComparisonMode mode) | - | ||||||||||||||||||
| 3919 | { | - | ||||||||||||||||||
| 3920 | Q_D(QOpenGLTexture); | - | ||||||||||||||||||
| 3921 | d->create(); | - | ||||||||||||||||||
| 3922 | if (!d->features.testFlag(TextureComparisonOperators)) {
| 0 | ||||||||||||||||||
| 3923 | qWarning("QOpenGLTexture::setComparisonMode: requires OpenGL >= 1.5 or OpenGL ES >= 3.0"); | - | ||||||||||||||||||
| 3924 | return; never executed: return; | 0 | ||||||||||||||||||
| 3925 | } | - | ||||||||||||||||||
| 3926 | d->comparisonMode = mode; | - | ||||||||||||||||||
| 3927 | d->texFuncs->glTextureParameteri(d->textureId, d->target, d->bindingTarget, GL_TEXTURE_COMPARE_MODE, mode); | - | ||||||||||||||||||
| 3928 | } never executed: end of block | 0 | ||||||||||||||||||
| 3929 | - | |||||||||||||||||||
| 3930 | /*! | - | ||||||||||||||||||
| 3931 | \since 5.5 | - | ||||||||||||||||||
| 3932 | - | |||||||||||||||||||
| 3933 | Returns the texture comparison mode set on this texture. By default, a | - | ||||||||||||||||||
| 3934 | texture has a CompareNone comparison mode (i.e. comparisons are disabled). | - | ||||||||||||||||||
| 3935 | - | |||||||||||||||||||
| 3936 | \sa setComparisonMode() | - | ||||||||||||||||||
| 3937 | */ | - | ||||||||||||||||||
| 3938 | QOpenGLTexture::ComparisonMode QOpenGLTexture::comparisonMode() const | - | ||||||||||||||||||
| 3939 | { | - | ||||||||||||||||||
| 3940 | Q_D(const QOpenGLTexture); | - | ||||||||||||||||||
| 3941 | return d->comparisonMode; never executed: return d->comparisonMode; | 0 | ||||||||||||||||||
| 3942 | } | - | ||||||||||||||||||
| 3943 | - | |||||||||||||||||||
| 3944 | /*! | - | ||||||||||||||||||
| 3945 | Sets the filter used for minification to \a filter. | - | ||||||||||||||||||
| 3946 | - | |||||||||||||||||||
| 3947 | \sa minificationFilter(), setMagnificationFilter(), setMinMagFilters() | - | ||||||||||||||||||
| 3948 | */ | - | ||||||||||||||||||
| 3949 | void QOpenGLTexture::setMinificationFilter(QOpenGLTexture::Filter filter) | - | ||||||||||||||||||
| 3950 | { | - | ||||||||||||||||||
| 3951 | Q_D(QOpenGLTexture); | - | ||||||||||||||||||
| 3952 | d->create(); | - | ||||||||||||||||||
| 3953 | Q_ASSERT(d->texFuncs); | - | ||||||||||||||||||
| 3954 | Q_ASSERT(d->textureId); | - | ||||||||||||||||||
| 3955 | d->minFilter = filter; | - | ||||||||||||||||||
| 3956 | d->texFuncs->glTextureParameteri(d->textureId, d->target, d->bindingTarget, GL_TEXTURE_MIN_FILTER, filter); | - | ||||||||||||||||||
| 3957 | } never executed: end of block | 0 | ||||||||||||||||||
| 3958 | - | |||||||||||||||||||
| 3959 | /*! | - | ||||||||||||||||||
| 3960 | Returns the minification filter. | - | ||||||||||||||||||
| 3961 | - | |||||||||||||||||||
| 3962 | \sa setMinificationFilter() | - | ||||||||||||||||||
| 3963 | */ | - | ||||||||||||||||||
| 3964 | QOpenGLTexture::Filter QOpenGLTexture::minificationFilter() const | - | ||||||||||||||||||
| 3965 | { | - | ||||||||||||||||||
| 3966 | Q_D(const QOpenGLTexture); | - | ||||||||||||||||||
| 3967 | return d->minFilter; never executed: return d->minFilter; | 0 | ||||||||||||||||||
| 3968 | } | - | ||||||||||||||||||
| 3969 | - | |||||||||||||||||||
| 3970 | /*! | - | ||||||||||||||||||
| 3971 | Sets the magnification filter to \a filter. | - | ||||||||||||||||||
| 3972 | - | |||||||||||||||||||
| 3973 | \sa magnificationFilter(), setMinificationFilter(), setMinMagFilters() | - | ||||||||||||||||||
| 3974 | */ | - | ||||||||||||||||||
| 3975 | void QOpenGLTexture::setMagnificationFilter(QOpenGLTexture::Filter filter) | - | ||||||||||||||||||
| 3976 | { | - | ||||||||||||||||||
| 3977 | Q_D(QOpenGLTexture); | - | ||||||||||||||||||
| 3978 | d->create(); | - | ||||||||||||||||||
| 3979 | Q_ASSERT(d->texFuncs); | - | ||||||||||||||||||
| 3980 | Q_ASSERT(d->textureId); | - | ||||||||||||||||||
| 3981 | d->magFilter = filter; | - | ||||||||||||||||||
| 3982 | d->texFuncs->glTextureParameteri(d->textureId, d->target, d->bindingTarget, GL_TEXTURE_MAG_FILTER, filter); | - | ||||||||||||||||||
| 3983 | } never executed: end of block | 0 | ||||||||||||||||||
| 3984 | - | |||||||||||||||||||
| 3985 | /*! | - | ||||||||||||||||||
| 3986 | Returns the magnification filter. | - | ||||||||||||||||||
| 3987 | - | |||||||||||||||||||
| 3988 | \sa setMagnificationFilter() | - | ||||||||||||||||||
| 3989 | */ | - | ||||||||||||||||||
| 3990 | QOpenGLTexture::Filter QOpenGLTexture::magnificationFilter() const | - | ||||||||||||||||||
| 3991 | { | - | ||||||||||||||||||
| 3992 | Q_D(const QOpenGLTexture); | - | ||||||||||||||||||
| 3993 | return d->magFilter; never executed: return d->magFilter; | 0 | ||||||||||||||||||
| 3994 | } | - | ||||||||||||||||||
| 3995 | - | |||||||||||||||||||
| 3996 | /*! | - | ||||||||||||||||||
| 3997 | Sets the minification filter to \a minificationFilter and the magnification filter | - | ||||||||||||||||||
| 3998 | to \a magnificationFilter. | - | ||||||||||||||||||
| 3999 | - | |||||||||||||||||||
| 4000 | \sa minMagFilters(), setMinificationFilter(), setMagnificationFilter() | - | ||||||||||||||||||
| 4001 | */ | - | ||||||||||||||||||
| 4002 | void QOpenGLTexture::setMinMagFilters(QOpenGLTexture::Filter minificationFilter, | - | ||||||||||||||||||
| 4003 | QOpenGLTexture::Filter magnificationFilter) | - | ||||||||||||||||||
| 4004 | { | - | ||||||||||||||||||
| 4005 | Q_D(QOpenGLTexture); | - | ||||||||||||||||||
| 4006 | d->create(); | - | ||||||||||||||||||
| 4007 | Q_ASSERT(d->texFuncs); | - | ||||||||||||||||||
| 4008 | Q_ASSERT(d->textureId); | - | ||||||||||||||||||
| 4009 | d->minFilter = minificationFilter; | - | ||||||||||||||||||
| 4010 | d->magFilter = magnificationFilter; | - | ||||||||||||||||||
| 4011 | d->texFuncs->glTextureParameteri(d->textureId, d->target, d->bindingTarget, GL_TEXTURE_MIN_FILTER, minificationFilter); | - | ||||||||||||||||||
| 4012 | d->texFuncs->glTextureParameteri(d->textureId, d->target, d->bindingTarget, GL_TEXTURE_MAG_FILTER, magnificationFilter); | - | ||||||||||||||||||
| 4013 | } never executed: end of block | 0 | ||||||||||||||||||
| 4014 | - | |||||||||||||||||||
| 4015 | /*! | - | ||||||||||||||||||
| 4016 | Returns the current minification and magnification filters. | - | ||||||||||||||||||
| 4017 | - | |||||||||||||||||||
| 4018 | \sa setMinMagFilters() | - | ||||||||||||||||||
| 4019 | */ | - | ||||||||||||||||||
| 4020 | QPair<QOpenGLTexture::Filter, QOpenGLTexture::Filter> QOpenGLTexture::minMagFilters() const | - | ||||||||||||||||||
| 4021 | { | - | ||||||||||||||||||
| 4022 | Q_D(const QOpenGLTexture); | - | ||||||||||||||||||
| 4023 | return QPair<QOpenGLTexture::Filter, QOpenGLTexture::Filter>(d->minFilter, d->magFilter); never executed: return QPair<QOpenGLTexture::Filter, QOpenGLTexture::Filter>(d->minFilter, d->magFilter); | 0 | ||||||||||||||||||
| 4024 | } | - | ||||||||||||||||||
| 4025 | - | |||||||||||||||||||
| 4026 | /*! | - | ||||||||||||||||||
| 4027 | If your OpenGL implementation supports the GL_EXT_texture_filter_anisotropic extension | - | ||||||||||||||||||
| 4028 | this function sets the maximum anisotropy level to \a anisotropy. | - | ||||||||||||||||||
| 4029 | - | |||||||||||||||||||
| 4030 | \sa maximumAnisotropy() | - | ||||||||||||||||||
| 4031 | */ | - | ||||||||||||||||||
| 4032 | void QOpenGLTexture::setMaximumAnisotropy(float anisotropy) | - | ||||||||||||||||||
| 4033 | { | - | ||||||||||||||||||
| 4034 | Q_D(QOpenGLTexture); | - | ||||||||||||||||||
| 4035 | d->create(); | - | ||||||||||||||||||
| 4036 | Q_ASSERT(d->texFuncs); | - | ||||||||||||||||||
| 4037 | Q_ASSERT(d->textureId); | - | ||||||||||||||||||
| 4038 | if (!d->features.testFlag(AnisotropicFiltering)) {
| 0 | ||||||||||||||||||
| 4039 | qWarning("QOpenGLTexture::setMaximumAnisotropy() requires GL_EXT_texture_filter_anisotropic"); | - | ||||||||||||||||||
| 4040 | return; never executed: return; | 0 | ||||||||||||||||||
| 4041 | } | - | ||||||||||||||||||
| 4042 | d->maxAnisotropy = anisotropy; | - | ||||||||||||||||||
| 4043 | d->texFuncs->glTextureParameteri(d->textureId, d->target, d->bindingTarget, GL_TEXTURE_MAX_ANISOTROPY_EXT, anisotropy); | - | ||||||||||||||||||
| 4044 | } never executed: end of block | 0 | ||||||||||||||||||
| 4045 | - | |||||||||||||||||||
| 4046 | /*! | - | ||||||||||||||||||
| 4047 | Returns the maximum level of anisotropy to be accounted for when performing texture lookups. | - | ||||||||||||||||||
| 4048 | This requires the GL_EXT_texture_filter_anisotropic extension. | - | ||||||||||||||||||
| 4049 | - | |||||||||||||||||||
| 4050 | \sa setMaximumAnisotropy() | - | ||||||||||||||||||
| 4051 | */ | - | ||||||||||||||||||
| 4052 | float QOpenGLTexture::maximumAnisotropy() const | - | ||||||||||||||||||
| 4053 | { | - | ||||||||||||||||||
| 4054 | Q_D(const QOpenGLTexture); | - | ||||||||||||||||||
| 4055 | return d->maxAnisotropy; never executed: return d->maxAnisotropy; | 0 | ||||||||||||||||||
| 4056 | } | - | ||||||||||||||||||
| 4057 | - | |||||||||||||||||||
| 4058 | /*! | - | ||||||||||||||||||
| 4059 | Sets the wrap (or repeat mode) for all texture dimentions to \a mode. | - | ||||||||||||||||||
| 4060 | - | |||||||||||||||||||
| 4061 | \sa wrapMode() | - | ||||||||||||||||||
| 4062 | */ | - | ||||||||||||||||||
| 4063 | void QOpenGLTexture::setWrapMode(QOpenGLTexture::WrapMode mode) | - | ||||||||||||||||||
| 4064 | { | - | ||||||||||||||||||
| 4065 | Q_D(QOpenGLTexture); | - | ||||||||||||||||||
| 4066 | d->create(); | - | ||||||||||||||||||
| 4067 | Q_ASSERT(d->texFuncs); | - | ||||||||||||||||||
| 4068 | Q_ASSERT(d->textureId); | - | ||||||||||||||||||
| 4069 | d->setWrapMode(mode); | - | ||||||||||||||||||
| 4070 | } never executed: end of block | 0 | ||||||||||||||||||
| 4071 | - | |||||||||||||||||||
| 4072 | /*! | - | ||||||||||||||||||
| 4073 | Holds the texture dimension \a direction. | - | ||||||||||||||||||
| 4074 | \overload | - | ||||||||||||||||||
| 4075 | */ | - | ||||||||||||||||||
| 4076 | void QOpenGLTexture::setWrapMode(QOpenGLTexture::CoordinateDirection direction, QOpenGLTexture::WrapMode mode) | - | ||||||||||||||||||
| 4077 | { | - | ||||||||||||||||||
| 4078 | Q_D(QOpenGLTexture); | - | ||||||||||||||||||
| 4079 | d->create(); | - | ||||||||||||||||||
| 4080 | Q_ASSERT(d->texFuncs); | - | ||||||||||||||||||
| 4081 | Q_ASSERT(d->textureId); | - | ||||||||||||||||||
| 4082 | d->setWrapMode(direction, mode); | - | ||||||||||||||||||
| 4083 | } never executed: end of block | 0 | ||||||||||||||||||
| 4084 | - | |||||||||||||||||||
| 4085 | /*! | - | ||||||||||||||||||
| 4086 | Returns the wrap mode for the texture dimension \a direction. | - | ||||||||||||||||||
| 4087 | - | |||||||||||||||||||
| 4088 | \sa setWrapMode() | - | ||||||||||||||||||
| 4089 | */ | - | ||||||||||||||||||
| 4090 | QOpenGLTexture::WrapMode QOpenGLTexture::wrapMode(QOpenGLTexture::CoordinateDirection direction) const | - | ||||||||||||||||||
| 4091 | { | - | ||||||||||||||||||
| 4092 | Q_D(const QOpenGLTexture); | - | ||||||||||||||||||
| 4093 | return d->wrapMode(direction); never executed: return d->wrapMode(direction); | 0 | ||||||||||||||||||
| 4094 | } | - | ||||||||||||||||||
| 4095 | - | |||||||||||||||||||
| 4096 | /*! | - | ||||||||||||||||||
| 4097 | Sets the border color of the texture to \a color. | - | ||||||||||||||||||
| 4098 | - | |||||||||||||||||||
| 4099 | \note This function has no effect on Mac and Qt built for OpenGL ES 2. | - | ||||||||||||||||||
| 4100 | \sa borderColor() | - | ||||||||||||||||||
| 4101 | */ | - | ||||||||||||||||||
| 4102 | void QOpenGLTexture::setBorderColor(QColor color) | - | ||||||||||||||||||
| 4103 | { | - | ||||||||||||||||||
| 4104 | #if !defined(QT_OPENGL_ES_2) | - | ||||||||||||||||||
| 4105 | if (!QOpenGLContext::currentContext()->isOpenGLES()) {
| 0 | ||||||||||||||||||
| 4106 | Q_D(QOpenGLTexture); | - | ||||||||||||||||||
| 4107 | d->create(); | - | ||||||||||||||||||
| 4108 | Q_ASSERT(d->texFuncs); | - | ||||||||||||||||||
| 4109 | Q_ASSERT(d->textureId); | - | ||||||||||||||||||
| 4110 | float values[4]; | - | ||||||||||||||||||
| 4111 | values[0] = color.redF(); | - | ||||||||||||||||||
| 4112 | values[1] = color.greenF(); | - | ||||||||||||||||||
| 4113 | values[2] = color.blueF(); | - | ||||||||||||||||||
| 4114 | values[3] = color.alphaF(); | - | ||||||||||||||||||
| 4115 | d->borderColor.clear(); | - | ||||||||||||||||||
| 4116 | for (int i = 0; i < 4; ++i)
| 0 | ||||||||||||||||||
| 4117 | d->borderColor.append(QVariant(values[i])); never executed: d->borderColor.append(QVariant(values[i])); | 0 | ||||||||||||||||||
| 4118 | d->texFuncs->glTextureParameterfv(d->textureId, d->target, d->bindingTarget, GL_TEXTURE_BORDER_COLOR, values); | - | ||||||||||||||||||
| 4119 | return; never executed: return; | 0 | ||||||||||||||||||
| 4120 | } | - | ||||||||||||||||||
| 4121 | #else | - | ||||||||||||||||||
| 4122 | Q_UNUSED(color); | - | ||||||||||||||||||
| 4123 | #endif | - | ||||||||||||||||||
| 4124 | qWarning("QOpenGLTexture: Border color is not supported"); | - | ||||||||||||||||||
| 4125 | } never executed: end of block | 0 | ||||||||||||||||||
| 4126 | - | |||||||||||||||||||
| 4127 | /*! | - | ||||||||||||||||||
| 4128 | Sets the color red to \a {r}, green to \a {g}, blue to \a {b}, and \a {a} to the | - | ||||||||||||||||||
| 4129 | alpha value. | - | ||||||||||||||||||
| 4130 | \overload | - | ||||||||||||||||||
| 4131 | */ | - | ||||||||||||||||||
| 4132 | void QOpenGLTexture::setBorderColor(float r, float g, float b, float a) | - | ||||||||||||||||||
| 4133 | { | - | ||||||||||||||||||
| 4134 | #if !defined(QT_OPENGL_ES_2) | - | ||||||||||||||||||
| 4135 | if (!QOpenGLContext::currentContext()->isOpenGLES()) {
| 0 | ||||||||||||||||||
| 4136 | Q_D(QOpenGLTexture); | - | ||||||||||||||||||
| 4137 | d->create(); | - | ||||||||||||||||||
| 4138 | Q_ASSERT(d->texFuncs); | - | ||||||||||||||||||
| 4139 | Q_ASSERT(d->textureId); | - | ||||||||||||||||||
| 4140 | float values[4]; | - | ||||||||||||||||||
| 4141 | values[0] = r; | - | ||||||||||||||||||
| 4142 | values[1] = g; | - | ||||||||||||||||||
| 4143 | values[2] = b; | - | ||||||||||||||||||
| 4144 | values[3] = a; | - | ||||||||||||||||||
| 4145 | d->borderColor.clear(); | - | ||||||||||||||||||
| 4146 | for (int i = 0; i < 4; ++i)
| 0 | ||||||||||||||||||
| 4147 | d->borderColor.append(QVariant(values[i])); never executed: d->borderColor.append(QVariant(values[i])); | 0 | ||||||||||||||||||
| 4148 | d->texFuncs->glTextureParameterfv(d->textureId, d->target, d->bindingTarget, GL_TEXTURE_BORDER_COLOR, values); | - | ||||||||||||||||||
| 4149 | return; never executed: return; | 0 | ||||||||||||||||||
| 4150 | } | - | ||||||||||||||||||
| 4151 | #else | - | ||||||||||||||||||
| 4152 | Q_UNUSED(r); | - | ||||||||||||||||||
| 4153 | Q_UNUSED(g); | - | ||||||||||||||||||
| 4154 | Q_UNUSED(b); | - | ||||||||||||||||||
| 4155 | Q_UNUSED(a); | - | ||||||||||||||||||
| 4156 | #endif | - | ||||||||||||||||||
| 4157 | qWarning("QOpenGLTexture: Border color is not supported"); | - | ||||||||||||||||||
| 4158 | } never executed: end of block | 0 | ||||||||||||||||||
| 4159 | - | |||||||||||||||||||
| 4160 | /*! | - | ||||||||||||||||||
| 4161 | Sets the color red to \a {r}, green to \a {g}, blue to \a {b}, and the alpha | - | ||||||||||||||||||
| 4162 | value to \a {a}. | - | ||||||||||||||||||
| 4163 | \overload | - | ||||||||||||||||||
| 4164 | */ | - | ||||||||||||||||||
| 4165 | void QOpenGLTexture::setBorderColor(int r, int g, int b, int a) | - | ||||||||||||||||||
| 4166 | { | - | ||||||||||||||||||
| 4167 | #if !defined(QT_OPENGL_ES_2) | - | ||||||||||||||||||
| 4168 | if (!QOpenGLContext::currentContext()->isOpenGLES()) {
| 0 | ||||||||||||||||||
| 4169 | Q_D(QOpenGLTexture); | - | ||||||||||||||||||
| 4170 | d->create(); | - | ||||||||||||||||||
| 4171 | Q_ASSERT(d->texFuncs); | - | ||||||||||||||||||
| 4172 | Q_ASSERT(d->textureId); | - | ||||||||||||||||||
| 4173 | int values[4]; | - | ||||||||||||||||||
| 4174 | values[0] = r; | - | ||||||||||||||||||
| 4175 | values[1] = g; | - | ||||||||||||||||||
| 4176 | values[2] = b; | - | ||||||||||||||||||
| 4177 | values[3] = a; | - | ||||||||||||||||||
| 4178 | d->borderColor.clear(); | - | ||||||||||||||||||
| 4179 | for (int i = 0; i < 4; ++i)
| 0 | ||||||||||||||||||
| 4180 | d->borderColor.append(QVariant(values[i])); never executed: d->borderColor.append(QVariant(values[i])); | 0 | ||||||||||||||||||
| 4181 | d->texFuncs->glTextureParameteriv(d->textureId, d->target, d->bindingTarget, GL_TEXTURE_BORDER_COLOR, values); | - | ||||||||||||||||||
| 4182 | return; never executed: return; | 0 | ||||||||||||||||||
| 4183 | } | - | ||||||||||||||||||
| 4184 | #else | - | ||||||||||||||||||
| 4185 | Q_UNUSED(r); | - | ||||||||||||||||||
| 4186 | Q_UNUSED(g); | - | ||||||||||||||||||
| 4187 | Q_UNUSED(b); | - | ||||||||||||||||||
| 4188 | Q_UNUSED(a); | - | ||||||||||||||||||
| 4189 | #endif | - | ||||||||||||||||||
| 4190 | qWarning("QOpenGLTexture: Border color is not supported"); | - | ||||||||||||||||||
| 4191 | - | |||||||||||||||||||
| 4192 | // TODO Handle case of using glTextureParameterIiv() based on format | - | ||||||||||||||||||
| 4193 | } never executed: end of block | 0 | ||||||||||||||||||
| 4194 | - | |||||||||||||||||||
| 4195 | /*! | - | ||||||||||||||||||
| 4196 | Sets the color red to \a {r}, green to \a {g}, blue to \a {b}, and the alpha | - | ||||||||||||||||||
| 4197 | value to \a {a}. | - | ||||||||||||||||||
| 4198 | \overload | - | ||||||||||||||||||
| 4199 | */ | - | ||||||||||||||||||
| 4200 | void QOpenGLTexture::setBorderColor(uint r, uint g, uint b, uint a) | - | ||||||||||||||||||
| 4201 | { | - | ||||||||||||||||||
| 4202 | #if !defined(QT_OPENGL_ES_2) | - | ||||||||||||||||||
| 4203 | if (!QOpenGLContext::currentContext()->isOpenGLES()) {
| 0 | ||||||||||||||||||
| 4204 | Q_D(QOpenGLTexture); | - | ||||||||||||||||||
| 4205 | d->create(); | - | ||||||||||||||||||
| 4206 | Q_ASSERT(d->texFuncs); | - | ||||||||||||||||||
| 4207 | Q_ASSERT(d->textureId); | - | ||||||||||||||||||
| 4208 | int values[4]; | - | ||||||||||||||||||
| 4209 | values[0] = int(r); | - | ||||||||||||||||||
| 4210 | values[1] = int(g); | - | ||||||||||||||||||
| 4211 | values[2] = int(b); | - | ||||||||||||||||||
| 4212 | values[3] = int(a); | - | ||||||||||||||||||
| 4213 | d->borderColor.clear(); | - | ||||||||||||||||||
| 4214 | for (int i = 0; i < 4; ++i)
| 0 | ||||||||||||||||||
| 4215 | d->borderColor.append(QVariant(values[i])); never executed: d->borderColor.append(QVariant(values[i])); | 0 | ||||||||||||||||||
| 4216 | d->texFuncs->glTextureParameteriv(d->textureId, d->target, d->bindingTarget, GL_TEXTURE_BORDER_COLOR, values); | - | ||||||||||||||||||
| 4217 | return; never executed: return; | 0 | ||||||||||||||||||
| 4218 | } | - | ||||||||||||||||||
| 4219 | #else | - | ||||||||||||||||||
| 4220 | Q_UNUSED(r); | - | ||||||||||||||||||
| 4221 | Q_UNUSED(g); | - | ||||||||||||||||||
| 4222 | Q_UNUSED(b); | - | ||||||||||||||||||
| 4223 | Q_UNUSED(a); | - | ||||||||||||||||||
| 4224 | #endif | - | ||||||||||||||||||
| 4225 | qWarning("QOpenGLTexture: Border color is not supported"); | - | ||||||||||||||||||
| 4226 | - | |||||||||||||||||||
| 4227 | // TODO Handle case of using glTextureParameterIuiv() based on format | - | ||||||||||||||||||
| 4228 | } never executed: end of block | 0 | ||||||||||||||||||
| 4229 | - | |||||||||||||||||||
| 4230 | /*! | - | ||||||||||||||||||
| 4231 | Returns the borderColor of this texture. | - | ||||||||||||||||||
| 4232 | - | |||||||||||||||||||
| 4233 | \sa setBorderColor() | - | ||||||||||||||||||
| 4234 | */ | - | ||||||||||||||||||
| 4235 | QColor QOpenGLTexture::borderColor() const | - | ||||||||||||||||||
| 4236 | { | - | ||||||||||||||||||
| 4237 | Q_D(const QOpenGLTexture); | - | ||||||||||||||||||
| 4238 | QColor c(0.0f, 0.0f, 0.0f, 0.0f); | - | ||||||||||||||||||
| 4239 | if (!d->borderColor.isEmpty()) {
| 0 | ||||||||||||||||||
| 4240 | c.setRedF(d->borderColor.at(0).toFloat()); | - | ||||||||||||||||||
| 4241 | c.setGreenF(d->borderColor.at(1).toFloat()); | - | ||||||||||||||||||
| 4242 | c.setBlueF(d->borderColor.at(2).toFloat()); | - | ||||||||||||||||||
| 4243 | c.setAlphaF(d->borderColor.at(3).toFloat()); | - | ||||||||||||||||||
| 4244 | } never executed: end of block | 0 | ||||||||||||||||||
| 4245 | return c; never executed: return c; | 0 | ||||||||||||||||||
| 4246 | } | - | ||||||||||||||||||
| 4247 | - | |||||||||||||||||||
| 4248 | /*! | - | ||||||||||||||||||
| 4249 | Writes the texture border color into the first four elements | - | ||||||||||||||||||
| 4250 | of the array pointed to by \a border. | - | ||||||||||||||||||
| 4251 | - | |||||||||||||||||||
| 4252 | \sa setBorderColor() | - | ||||||||||||||||||
| 4253 | */ | - | ||||||||||||||||||
| 4254 | void QOpenGLTexture::borderColor(float *border) const | - | ||||||||||||||||||
| 4255 | { | - | ||||||||||||||||||
| 4256 | Q_D(const QOpenGLTexture); | - | ||||||||||||||||||
| 4257 | Q_ASSERT(border); | - | ||||||||||||||||||
| 4258 | if (d->borderColor.isEmpty()) {
| 0 | ||||||||||||||||||
| 4259 | for (int i = 0; i < 4; ++i)
| 0 | ||||||||||||||||||
| 4260 | border[i] = 0.0f; never executed: border[i] = 0.0f; | 0 | ||||||||||||||||||
| 4261 | } else { never executed: end of block | 0 | ||||||||||||||||||
| 4262 | for (int i = 0; i < 4; ++i)
| 0 | ||||||||||||||||||
| 4263 | border[i] = d->borderColor.at(i).toFloat(); never executed: border[i] = d->borderColor.at(i).toFloat(); | 0 | ||||||||||||||||||
| 4264 | } never executed: end of block | 0 | ||||||||||||||||||
| 4265 | } | - | ||||||||||||||||||
| 4266 | - | |||||||||||||||||||
| 4267 | /*! | - | ||||||||||||||||||
| 4268 | Writes the texture border color into the first four elements | - | ||||||||||||||||||
| 4269 | of the array pointed to by \a border. | - | ||||||||||||||||||
| 4270 | - | |||||||||||||||||||
| 4271 | \overload | - | ||||||||||||||||||
| 4272 | */ | - | ||||||||||||||||||
| 4273 | void QOpenGLTexture::borderColor(int *border) const | - | ||||||||||||||||||
| 4274 | { | - | ||||||||||||||||||
| 4275 | Q_D(const QOpenGLTexture); | - | ||||||||||||||||||
| 4276 | Q_ASSERT(border); | - | ||||||||||||||||||
| 4277 | if (d->borderColor.isEmpty()) {
| 0 | ||||||||||||||||||
| 4278 | for (int i = 0; i < 4; ++i)
| 0 | ||||||||||||||||||
| 4279 | border[i] = 0; never executed: border[i] = 0; | 0 | ||||||||||||||||||
| 4280 | } else { never executed: end of block | 0 | ||||||||||||||||||
| 4281 | for (int i = 0; i < 4; ++i)
| 0 | ||||||||||||||||||
| 4282 | border[i] = d->borderColor.at(i).toInt(); never executed: border[i] = d->borderColor.at(i).toInt(); | 0 | ||||||||||||||||||
| 4283 | } never executed: end of block | 0 | ||||||||||||||||||
| 4284 | } | - | ||||||||||||||||||
| 4285 | - | |||||||||||||||||||
| 4286 | /*! | - | ||||||||||||||||||
| 4287 | Writes the texture border color into the first four elements | - | ||||||||||||||||||
| 4288 | of the array pointed to by \a border. | - | ||||||||||||||||||
| 4289 | - | |||||||||||||||||||
| 4290 | \overload | - | ||||||||||||||||||
| 4291 | */ | - | ||||||||||||||||||
| 4292 | void QOpenGLTexture::borderColor(unsigned int *border) const | - | ||||||||||||||||||
| 4293 | { | - | ||||||||||||||||||
| 4294 | Q_D(const QOpenGLTexture); | - | ||||||||||||||||||
| 4295 | Q_ASSERT(border); | - | ||||||||||||||||||
| 4296 | if (d->borderColor.isEmpty()) {
| 0 | ||||||||||||||||||
| 4297 | for (int i = 0; i < 4; ++i)
| 0 | ||||||||||||||||||
| 4298 | border[i] = 0; never executed: border[i] = 0; | 0 | ||||||||||||||||||
| 4299 | } else { never executed: end of block | 0 | ||||||||||||||||||
| 4300 | for (int i = 0; i < 4; ++i)
| 0 | ||||||||||||||||||
| 4301 | border[i] = d->borderColor.at(i).toUInt(); never executed: border[i] = d->borderColor.at(i).toUInt(); | 0 | ||||||||||||||||||
| 4302 | } never executed: end of block | 0 | ||||||||||||||||||
| 4303 | } | - | ||||||||||||||||||
| 4304 | - | |||||||||||||||||||
| 4305 | /*! | - | ||||||||||||||||||
| 4306 | Sets the minimum level of detail to \a value. This limits the selection of highest | - | ||||||||||||||||||
| 4307 | resolution mipmap (lowest mipmap level). The default value is -1000. | - | ||||||||||||||||||
| 4308 | - | |||||||||||||||||||
| 4309 | \note This function has no effect on Qt built for OpenGL ES 2. | - | ||||||||||||||||||
| 4310 | \sa minimumLevelOfDetail(), setMaximumLevelOfDetail(), setLevelOfDetailRange() | - | ||||||||||||||||||
| 4311 | */ | - | ||||||||||||||||||
| 4312 | void QOpenGLTexture::setMinimumLevelOfDetail(float value) | - | ||||||||||||||||||
| 4313 | { | - | ||||||||||||||||||
| 4314 | #if !defined(QT_OPENGL_ES_2) | - | ||||||||||||||||||
| 4315 | if (!QOpenGLContext::currentContext()->isOpenGLES()) {
| 0 | ||||||||||||||||||
| 4316 | Q_D(QOpenGLTexture); | - | ||||||||||||||||||
| 4317 | d->create(); | - | ||||||||||||||||||
| 4318 | Q_ASSERT(d->texFuncs); | - | ||||||||||||||||||
| 4319 | Q_ASSERT(d->textureId); | - | ||||||||||||||||||
| 4320 | Q_ASSERT(value < d->maxLevelOfDetail); | - | ||||||||||||||||||
| 4321 | d->minLevelOfDetail = value; | - | ||||||||||||||||||
| 4322 | d->texFuncs->glTextureParameterf(d->textureId, d->target, d->bindingTarget, GL_TEXTURE_MIN_LOD, value); | - | ||||||||||||||||||
| 4323 | return; never executed: return; | 0 | ||||||||||||||||||
| 4324 | } | - | ||||||||||||||||||
| 4325 | #else | - | ||||||||||||||||||
| 4326 | Q_UNUSED(value); | - | ||||||||||||||||||
| 4327 | #endif | - | ||||||||||||||||||
| 4328 | qWarning("QOpenGLTexture: Detail level is not supported"); | - | ||||||||||||||||||
| 4329 | } never executed: end of block | 0 | ||||||||||||||||||
| 4330 | - | |||||||||||||||||||
| 4331 | /*! | - | ||||||||||||||||||
| 4332 | Returns the minimum level of detail parameter. | - | ||||||||||||||||||
| 4333 | - | |||||||||||||||||||
| 4334 | \sa setMinimumLevelOfDetail(), maximumLevelOfDetail(), levelOfDetailRange() | - | ||||||||||||||||||
| 4335 | */ | - | ||||||||||||||||||
| 4336 | float QOpenGLTexture::minimumLevelOfDetail() const | - | ||||||||||||||||||
| 4337 | { | - | ||||||||||||||||||
| 4338 | Q_D(const QOpenGLTexture); | - | ||||||||||||||||||
| 4339 | return d->minLevelOfDetail; never executed: return d->minLevelOfDetail; | 0 | ||||||||||||||||||
| 4340 | } | - | ||||||||||||||||||
| 4341 | - | |||||||||||||||||||
| 4342 | /*! | - | ||||||||||||||||||
| 4343 | Sets the maximum level of detail to \a value. This limits the selection of lowest | - | ||||||||||||||||||
| 4344 | resolution mipmap (highest mipmap level). The default value is 1000. | - | ||||||||||||||||||
| 4345 | - | |||||||||||||||||||
| 4346 | \note This function has no effect on Qt built for OpenGL ES 2. | - | ||||||||||||||||||
| 4347 | \sa maximumLevelOfDetail(), setMinimumLevelOfDetail(), setLevelOfDetailRange() | - | ||||||||||||||||||
| 4348 | */ | - | ||||||||||||||||||
| 4349 | void QOpenGLTexture::setMaximumLevelOfDetail(float value) | - | ||||||||||||||||||
| 4350 | { | - | ||||||||||||||||||
| 4351 | #if !defined(QT_OPENGL_ES_2) | - | ||||||||||||||||||
| 4352 | if (!QOpenGLContext::currentContext()->isOpenGLES()) {
| 0 | ||||||||||||||||||
| 4353 | Q_D(QOpenGLTexture); | - | ||||||||||||||||||
| 4354 | d->create(); | - | ||||||||||||||||||
| 4355 | Q_ASSERT(d->texFuncs); | - | ||||||||||||||||||
| 4356 | Q_ASSERT(d->textureId); | - | ||||||||||||||||||
| 4357 | Q_ASSERT(value > d->minLevelOfDetail); | - | ||||||||||||||||||
| 4358 | d->maxLevelOfDetail = value; | - | ||||||||||||||||||
| 4359 | d->texFuncs->glTextureParameterf(d->textureId, d->target, d->bindingTarget, GL_TEXTURE_MAX_LOD, value); | - | ||||||||||||||||||
| 4360 | return; never executed: return; | 0 | ||||||||||||||||||
| 4361 | } | - | ||||||||||||||||||
| 4362 | #else | - | ||||||||||||||||||
| 4363 | Q_UNUSED(value); | - | ||||||||||||||||||
| 4364 | #endif | - | ||||||||||||||||||
| 4365 | qWarning("QOpenGLTexture: Detail level is not supported"); | - | ||||||||||||||||||
| 4366 | } never executed: end of block | 0 | ||||||||||||||||||
| 4367 | - | |||||||||||||||||||
| 4368 | /*! | - | ||||||||||||||||||
| 4369 | Returns the maximum level of detail parameter. | - | ||||||||||||||||||
| 4370 | - | |||||||||||||||||||
| 4371 | \sa setMaximumLevelOfDetail(), minimumLevelOfDetail(), levelOfDetailRange() | - | ||||||||||||||||||
| 4372 | */ | - | ||||||||||||||||||
| 4373 | float QOpenGLTexture::maximumLevelOfDetail() const | - | ||||||||||||||||||
| 4374 | { | - | ||||||||||||||||||
| 4375 | Q_D(const QOpenGLTexture); | - | ||||||||||||||||||
| 4376 | return d->maxLevelOfDetail; never executed: return d->maxLevelOfDetail; | 0 | ||||||||||||||||||
| 4377 | } | - | ||||||||||||||||||
| 4378 | - | |||||||||||||||||||
| 4379 | /*! | - | ||||||||||||||||||
| 4380 | Sets the minimum level of detail parameters to \a min and the maximum level | - | ||||||||||||||||||
| 4381 | to \a max. | - | ||||||||||||||||||
| 4382 | \note This function has no effect on Qt built for OpenGL ES 2. | - | ||||||||||||||||||
| 4383 | \sa levelOfDetailRange(), setMinimumLevelOfDetail(), setMaximumLevelOfDetail() | - | ||||||||||||||||||
| 4384 | */ | - | ||||||||||||||||||
| 4385 | void QOpenGLTexture::setLevelOfDetailRange(float min, float max) | - | ||||||||||||||||||
| 4386 | { | - | ||||||||||||||||||
| 4387 | #if !defined(QT_OPENGL_ES_2) | - | ||||||||||||||||||
| 4388 | if (!QOpenGLContext::currentContext()->isOpenGLES()) {
| 0 | ||||||||||||||||||
| 4389 | Q_D(QOpenGLTexture); | - | ||||||||||||||||||
| 4390 | d->create(); | - | ||||||||||||||||||
| 4391 | Q_ASSERT(d->texFuncs); | - | ||||||||||||||||||
| 4392 | Q_ASSERT(d->textureId); | - | ||||||||||||||||||
| 4393 | Q_ASSERT(min < max); | - | ||||||||||||||||||
| 4394 | d->minLevelOfDetail = min; | - | ||||||||||||||||||
| 4395 | d->maxLevelOfDetail = max; | - | ||||||||||||||||||
| 4396 | d->texFuncs->glTextureParameterf(d->textureId, d->target, d->bindingTarget, GL_TEXTURE_MIN_LOD, min); | - | ||||||||||||||||||
| 4397 | d->texFuncs->glTextureParameterf(d->textureId, d->target, d->bindingTarget, GL_TEXTURE_MAX_LOD, max); | - | ||||||||||||||||||
| 4398 | return; never executed: return; | 0 | ||||||||||||||||||
| 4399 | } | - | ||||||||||||||||||
| 4400 | #else | - | ||||||||||||||||||
| 4401 | Q_UNUSED(min); | - | ||||||||||||||||||
| 4402 | Q_UNUSED(max); | - | ||||||||||||||||||
| 4403 | #endif | - | ||||||||||||||||||
| 4404 | qWarning("QOpenGLTexture: Detail level is not supported"); | - | ||||||||||||||||||
| 4405 | } never executed: end of block | 0 | ||||||||||||||||||
| 4406 | - | |||||||||||||||||||
| 4407 | /*! | - | ||||||||||||||||||
| 4408 | Returns the minimum and maximum level of detail parameters. | - | ||||||||||||||||||
| 4409 | - | |||||||||||||||||||
| 4410 | \sa setLevelOfDetailRange(), minimumLevelOfDetail(), maximumLevelOfDetail() | - | ||||||||||||||||||
| 4411 | */ | - | ||||||||||||||||||
| 4412 | QPair<float, float> QOpenGLTexture::levelOfDetailRange() const | - | ||||||||||||||||||
| 4413 | { | - | ||||||||||||||||||
| 4414 | Q_D(const QOpenGLTexture); | - | ||||||||||||||||||
| 4415 | return qMakePair(d->minLevelOfDetail, d->maxLevelOfDetail); never executed: return qMakePair(d->minLevelOfDetail, d->maxLevelOfDetail); | 0 | ||||||||||||||||||
| 4416 | } | - | ||||||||||||||||||
| 4417 | - | |||||||||||||||||||
| 4418 | /*! | - | ||||||||||||||||||
| 4419 | Sets the level of detail bias to \a bias. | - | ||||||||||||||||||
| 4420 | Level of detail bias affects the point at which mipmapping levels change. | - | ||||||||||||||||||
| 4421 | Increasing values for level of detail bias makes the overall images blurrier | - | ||||||||||||||||||
| 4422 | or smoother. Decreasing values make the overall images sharper. | - | ||||||||||||||||||
| 4423 | - | |||||||||||||||||||
| 4424 | \note This function has no effect on Qt built for OpenGL ES 2. | - | ||||||||||||||||||
| 4425 | \sa levelofDetailBias() | - | ||||||||||||||||||
| 4426 | */ | - | ||||||||||||||||||
| 4427 | void QOpenGLTexture::setLevelofDetailBias(float bias) | - | ||||||||||||||||||
| 4428 | { | - | ||||||||||||||||||
| 4429 | #if !defined(QT_OPENGL_ES_2) | - | ||||||||||||||||||
| 4430 | if (!QOpenGLContext::currentContext()->isOpenGLES()) {
| 0 | ||||||||||||||||||
| 4431 | Q_D(QOpenGLTexture); | - | ||||||||||||||||||
| 4432 | d->create(); | - | ||||||||||||||||||
| 4433 | Q_ASSERT(d->texFuncs); | - | ||||||||||||||||||
| 4434 | Q_ASSERT(d->textureId); | - | ||||||||||||||||||
| 4435 | d->levelOfDetailBias = bias; | - | ||||||||||||||||||
| 4436 | d->texFuncs->glTextureParameterf(d->textureId, d->target, d->bindingTarget, GL_TEXTURE_LOD_BIAS, bias); | - | ||||||||||||||||||
| 4437 | return; never executed: return; | 0 | ||||||||||||||||||
| 4438 | } | - | ||||||||||||||||||
| 4439 | #else | - | ||||||||||||||||||
| 4440 | Q_UNUSED(bias); | - | ||||||||||||||||||
| 4441 | #endif | - | ||||||||||||||||||
| 4442 | qWarning("QOpenGLTexture: Detail level is not supported"); | - | ||||||||||||||||||
| 4443 | } never executed: end of block | 0 | ||||||||||||||||||
| 4444 | - | |||||||||||||||||||
| 4445 | /*! | - | ||||||||||||||||||
| 4446 | Returns the level of detail bias parameter. | - | ||||||||||||||||||
| 4447 | - | |||||||||||||||||||
| 4448 | \sa setLevelofDetailBias() | - | ||||||||||||||||||
| 4449 | */ | - | ||||||||||||||||||
| 4450 | float QOpenGLTexture::levelofDetailBias() const | - | ||||||||||||||||||
| 4451 | { | - | ||||||||||||||||||
| 4452 | Q_D(const QOpenGLTexture); | - | ||||||||||||||||||
| 4453 | return d->levelOfDetailBias; never executed: return d->levelOfDetailBias; | 0 | ||||||||||||||||||
| 4454 | } | - | ||||||||||||||||||
| 4455 | - | |||||||||||||||||||
| 4456 | QT_END_NAMESPACE | - | ||||||||||||||||||
| Source code | Switch to Preprocessed file |